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/CodeGen/ModuleBuilder.h | |
parent | 9685917341315774aad5733b1793b1e533a88bbb (diff) | |
download | ydb-11a895b7e15d1c5a1f52706396b82e3f9db953cb.tar.gz |
Export clang-format16 via ydblib project
6e6be3a95868fde888d801b7590af4044049563f
Diffstat (limited to 'contrib/libs/clang16/include/clang/CodeGen/ModuleBuilder.h')
-rw-r--r-- | contrib/libs/clang16/include/clang/CodeGen/ModuleBuilder.h | 126 |
1 files changed, 126 insertions, 0 deletions
diff --git a/contrib/libs/clang16/include/clang/CodeGen/ModuleBuilder.h b/contrib/libs/clang16/include/clang/CodeGen/ModuleBuilder.h new file mode 100644 index 0000000000..d9b7df7391 --- /dev/null +++ b/contrib/libs/clang16/include/clang/CodeGen/ModuleBuilder.h @@ -0,0 +1,126 @@ +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//===--- CodeGen/ModuleBuilder.h - Build LLVM from ASTs ---------*- 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 +// +//===----------------------------------------------------------------------===// +// +// This file defines the ModuleBuilder interface. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_CLANG_CODEGEN_MODULEBUILDER_H +#define LLVM_CLANG_CODEGEN_MODULEBUILDER_H + +#include "clang/AST/ASTConsumer.h" +#include "clang/Basic/LLVM.h" + +namespace llvm { + class Constant; + class LLVMContext; + class Module; + class StringRef; + + namespace vfs { + class FileSystem; + } +} + +namespace clang { + class CodeGenOptions; + class CoverageSourceInfo; + class Decl; + class DiagnosticsEngine; + class GlobalDecl; + class HeaderSearchOptions; + class LangOptions; + class PreprocessorOptions; + +namespace CodeGen { + class CodeGenModule; + class CGDebugInfo; +} + +/// The primary public interface to the Clang code generator. +/// +/// This is not really an abstract interface. +class CodeGenerator : public ASTConsumer { + virtual void anchor(); + +public: + /// Return an opaque reference to the CodeGenModule object, which can + /// be used in various secondary APIs. It is valid as long as the + /// CodeGenerator exists. + CodeGen::CodeGenModule &CGM(); + + /// Return the module that this code generator is building into. + /// + /// This may return null after HandleTranslationUnit is called; + /// this signifies that there was an error generating code. A + /// diagnostic will have been generated in this case, and the module + /// will be deleted. + /// + /// It will also return null if the module is released. + llvm::Module *GetModule(); + + /// Release ownership of the module to the caller. + /// + /// It is illegal to call methods other than GetModule on the + /// CodeGenerator after releasing its module. + llvm::Module *ReleaseModule(); + + /// Return debug info code generator. + CodeGen::CGDebugInfo *getCGDebugInfo(); + + /// Given a mangled name, return a declaration which mangles that way + /// which has been added to this code generator via a Handle method. + /// + /// This may return null if there was no matching declaration. + const Decl *GetDeclForMangledName(llvm::StringRef MangledName); + + /// Given a global declaration, return a mangled name for this declaration + /// which has been added to this code generator via a Handle method. + llvm::StringRef GetMangledName(GlobalDecl GD); + + /// Return the LLVM address of the given global entity. + /// + /// \param isForDefinition If true, the caller intends to define the + /// entity; the object returned will be an llvm::GlobalValue of + /// some sort. If false, the caller just intends to use the entity; + /// the object returned may be any sort of constant value, and the + /// code generator will schedule the entity for emission if a + /// definition has been registered with this code generator. + llvm::Constant *GetAddrOfGlobal(GlobalDecl decl, bool isForDefinition); + + /// Create a new \c llvm::Module after calling HandleTranslationUnit. This + /// enable codegen in interactive processing environments. + llvm::Module* StartModule(llvm::StringRef ModuleName, llvm::LLVMContext &C); +}; + +/// CreateLLVMCodeGen - Create a CodeGenerator instance. +/// It is the responsibility of the caller to call delete on +/// the allocated CodeGenerator instance. +CodeGenerator *CreateLLVMCodeGen(DiagnosticsEngine &Diags, + llvm::StringRef ModuleName, + IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS, + const HeaderSearchOptions &HeaderSearchOpts, + const PreprocessorOptions &PreprocessorOpts, + const CodeGenOptions &CGO, + llvm::LLVMContext &C, + CoverageSourceInfo *CoverageInfo = nullptr); + +} // end namespace clang + +#endif + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif |