diff options
author | thegeorg <thegeorg@yandex-team.com> | 2024-03-13 13:58:24 +0300 |
---|---|---|
committer | thegeorg <thegeorg@yandex-team.com> | 2024-03-13 14:11:53 +0300 |
commit | 11a895b7e15d1c5a1f52706396b82e3f9db953cb (patch) | |
tree | fabc6d883b0f946151f61ae7865cee9f529a1fdd /contrib/libs/clang16/include/clang/ExtractAPI/FrontendActions.h | |
parent | 9685917341315774aad5733b1793b1e533a88bbb (diff) | |
download | ydb-11a895b7e15d1c5a1f52706396b82e3f9db953cb.tar.gz |
Export clang-format16 via ydblib project
6e6be3a95868fde888d801b7590af4044049563f
Diffstat (limited to 'contrib/libs/clang16/include/clang/ExtractAPI/FrontendActions.h')
-rw-r--r-- | contrib/libs/clang16/include/clang/ExtractAPI/FrontendActions.h | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/contrib/libs/clang16/include/clang/ExtractAPI/FrontendActions.h b/contrib/libs/clang16/include/clang/ExtractAPI/FrontendActions.h new file mode 100644 index 0000000000..fa2ead6aa5 --- /dev/null +++ b/contrib/libs/clang16/include/clang/ExtractAPI/FrontendActions.h @@ -0,0 +1,84 @@ +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//===- ExtractAPI/FrontendActions.h -----------------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +/// +/// \file +/// This file defines the ExtractAPIAction frontend action. +/// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_CLANG_EXTRACTAPI_FRONTEND_ACTIONS_H +#define LLVM_CLANG_EXTRACTAPI_FRONTEND_ACTIONS_H + +#include "clang/ExtractAPI/API.h" +#include "clang/ExtractAPI/APIIgnoresList.h" +#include "clang/Frontend/FrontendAction.h" + +namespace clang { + +/// ExtractAPIAction sets up the output file and creates the ExtractAPIVisitor. +class ExtractAPIAction : public ASTFrontendAction { +protected: + std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI, + StringRef InFile) override; + +private: + /// A representation of the APIs this action extracts. + std::unique_ptr<extractapi::APISet> API; + + /// A stream to the output file of this action. + std::unique_ptr<raw_pwrite_stream> OS; + + /// The product this action is extracting API information for. + std::string ProductName; + + /// The synthesized input buffer that contains all the provided input header + /// files. + std::unique_ptr<llvm::MemoryBuffer> Buffer; + + /// The list of symbols to ignore during serialization + extractapi::APIIgnoresList IgnoresList; + + /// The input file originally provided on the command line. + /// + /// This captures the spelling used to include the file and whether the + /// include is quoted or not. + SmallVector<std::pair<SmallString<32>, bool>> KnownInputFiles; + + /// Prepare to execute the action on the given CompilerInstance. + /// + /// This is called before executing the action on any inputs. This generates a + /// single header that includes all of CI's inputs and replaces CI's input + /// list with it before actually executing the action. + bool PrepareToExecuteAction(CompilerInstance &CI) override; + + /// Called after executing the action on the synthesized input buffer. + /// + /// Note: Now that we have gathered all the API definitions to surface we can + /// emit them in this callback. + void EndSourceFileAction() override; + + static std::unique_ptr<llvm::raw_pwrite_stream> + CreateOutputFile(CompilerInstance &CI, StringRef InFile); + + static StringRef getInputBufferName() { return "<extract-api-includes>"; } +}; + +} // namespace clang + +#endif // LLVM_CLANG_EXTRACTAPI_FRONTEND_ACTIONS_H + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif |