clang API Documentation
#include "CodeGenModule.h"#include "CGCUDARuntime.h"#include "CGCXXABI.h"#include "CGCall.h"#include "CGDebugInfo.h"#include "CGObjCRuntime.h"#include "CGOpenCLRuntime.h"#include "CGOpenMPRuntime.h"#include "CodeGenFunction.h"#include "CodeGenPGO.h"#include "CoverageMappingGen.h"#include "CodeGenTBAA.h"#include "TargetInfo.h"#include "clang/AST/ASTContext.h"#include "clang/AST/CharUnits.h"#include "clang/AST/DeclCXX.h"#include "clang/AST/DeclObjC.h"#include "clang/AST/DeclTemplate.h"#include "clang/AST/Mangle.h"#include "clang/AST/RecordLayout.h"#include "clang/AST/RecursiveASTVisitor.h"#include "clang/Basic/Builtins.h"#include "clang/Basic/CharInfo.h"#include "clang/Basic/Diagnostic.h"#include "clang/Basic/Module.h"#include "clang/Basic/SourceManager.h"#include "clang/Basic/TargetInfo.h"#include "clang/Basic/Version.h"#include "clang/Frontend/CodeGenOptions.h"#include "clang/Sema/SemaDiagnostic.h"#include "llvm/ADT/APSInt.h"#include "llvm/ADT/Triple.h"#include "llvm/IR/CallSite.h"#include "llvm/IR/CallingConv.h"#include "llvm/IR/DataLayout.h"#include "llvm/IR/Intrinsics.h"#include "llvm/IR/LLVMContext.h"#include "llvm/IR/Module.h"#include "llvm/ProfileData/InstrProfReader.h"#include "llvm/Support/ConvertUTF.h"#include "llvm/Support/ErrorHandling.h"
Go to the source code of this file.
Functions | |
| static CGCXXABI * | createCXXABI (CodeGenModule &CGM) |
| static const llvm::GlobalObject * | getAliasedGlobal (const llvm::GlobalAlias &GA) |
| static llvm::GlobalVariable::ThreadLocalMode | GetLLVMTLSModel (StringRef S) |
| static llvm::GlobalVariable::ThreadLocalMode | GetLLVMTLSModel (CodeGenOptions::TLSModel M) |
| static bool | hasUnwindExceptions (const LangOptions &LangOpts) |
| static void | setLinkageAndVisibilityForGV (llvm::GlobalValue *GV, const NamedDecl *ND) |
| static void | emitUsed (CodeGenModule &CGM, StringRef Name, std::vector< llvm::WeakVH > &List) |
| static void | addLinkOptionsPostorder (CodeGenModule &CGM, Module *Mod, SmallVectorImpl< llvm::Value * > &Metadata, llvm::SmallPtrSet< Module *, 16 > &Visited) |
| Add link options implied by the given module, including modules it depends on, using a postorder walk. | |
| static bool | isVarDeclStrongDefinition (const ASTContext &Context, const VarDecl *D, bool NoCommon) |
| static void | replaceUsesOfNonProtoConstant (llvm::Constant *old, llvm::Function *newFn) |
| static void | ReplaceUsesOfNonProtoTypeWithRealFunction (llvm::GlobalValue *Old, llvm::Function *NewFn) |
| static llvm::StringMapEntry < llvm::Constant * > & | GetConstantCFStringEntry (llvm::StringMap< llvm::Constant * > &Map, const StringLiteral *Literal, bool TargetIsLSB, bool &IsUTF16, unsigned &StringLength) |
| static llvm::StringMapEntry < llvm::Constant * > & | GetConstantStringEntry (llvm::StringMap< llvm::Constant * > &Map, const StringLiteral *Literal, unsigned &StringLength) |
| static llvm::GlobalVariable * | GenerateStringLiteral (llvm::Constant *C, llvm::GlobalValue::LinkageTypes LT, CodeGenModule &CGM, StringRef GlobalName, unsigned Alignment) |
| static bool | needsDestructMethod (ObjCImplementationDecl *impl) |
| static bool | AllTrivialInitializers (CodeGenModule &CGM, ObjCImplementationDecl *D) |
| static llvm::Constant * | GetPointerConstant (llvm::LLVMContext &Context, const void *Ptr) |
| Turns the given pointer into a constant. | |
| static void | EmitGlobalDeclMetadata (CodeGenModule &CGM, llvm::NamedMDNode *&GlobalMetadata, GlobalDecl D, llvm::GlobalValue *Addr) |
Variables | |
| static const char | AnnotationSection [] = "llvm.metadata" |
| static void addLinkOptionsPostorder | ( | CodeGenModule & | CGM, |
| Module * | Mod, | ||
| SmallVectorImpl< llvm::Value * > & | Metadata, | ||
| llvm::SmallPtrSet< Module *, 16 > & | Visited | ||
| ) | [static] |
Add link options implied by the given module, including modules it depends on, using a postorder walk.
Definition at line 972 of file CodeGenModule.cpp.
References clang::TargetCodeGenInfo::getDependentLibraryOption(), clang::CodeGen::CodeGenModule::getLLVMContext(), clang::CodeGen::CodeGenModule::getTargetCodeGenInfo(), clang::Module::Imports, clang::Module::LinkLibraries, and clang::Module::Parent.
| static bool AllTrivialInitializers | ( | CodeGenModule & | CGM, |
| ObjCImplementationDecl * | D | ||
| ) | [static] |
Definition at line 3020 of file CodeGenModule.cpp.
References clang::CXXCtorInitializer::getInit(), clang::ObjCImplementationDecl::init_begin(), clang::ObjCImplementationDecl::init_end(), and clang::CodeGen::CodeGenFunction::isTrivialInitializer().
| static CGCXXABI* createCXXABI | ( | CodeGenModule & | CGM | ) | [static] |
Definition at line 61 of file CodeGenModule.cpp.
References clang::CodeGen::CreateItaniumCXXABI(), clang::CodeGen::CreateMicrosoftCXXABI(), clang::TargetCXXABI::GenericAArch64, clang::TargetCXXABI::GenericARM, clang::TargetCXXABI::GenericItanium, clang::TargetInfo::getCXXABI(), clang::TargetCXXABI::getKind(), clang::CodeGen::CodeGenModule::getTarget(), clang::TargetCXXABI::iOS, clang::TargetCXXABI::iOS64, and clang::TargetCXXABI::Microsoft.
| static void EmitGlobalDeclMetadata | ( | CodeGenModule & | CGM, |
| llvm::NamedMDNode *& | GlobalMetadata, | ||
| GlobalDecl | D, | ||
| llvm::GlobalValue * | Addr | ||
| ) | [static] |
Definition at line 3370 of file CodeGenModule.cpp.
References clang::CodeGen::CodeGenModule::addUsedGlobal(), clang::serialized_diags::create(), clang::GlobalDecl::getDecl(), clang::CodeGen::CodeGenModule::getLLVMContext(), clang::CodeGen::CodeGenModule::getModule(), clang::IdentifierInfo::getName(), and GetPointerConstant().
| static void emitUsed | ( | CodeGenModule & | CGM, |
| StringRef | Name, | ||
| std::vector< llvm::WeakVH > & | List | ||
| ) | [static] |
Definition at line 920 of file CodeGenModule.cpp.
References clang::CodeGen::CodeGenModule::getModule(), and clang::CodeGen::CodeGenTypeCache::Int8PtrTy.
| static llvm::GlobalVariable* GenerateStringLiteral | ( | llvm::Constant * | C, |
| llvm::GlobalValue::LinkageTypes | LT, | ||
| CodeGenModule & | CGM, | ||
| StringRef | GlobalName, | ||
| unsigned | Alignment | ||
| ) | [static] |
Definition at line 2794 of file CodeGenModule.cpp.
References AttributeLangSupport::C, clang::CodeGen::CodeGenModule::getContext(), clang::CodeGen::CodeGenModule::getLangOpts(), clang::CodeGen::CodeGenModule::getModule(), clang::ASTContext::getTargetAddressSpace(), and clang::LangAS::opencl_constant.
Referenced by clang::CodeGen::CodeGenModule::GetAddrOfConstantCString(), and clang::CodeGen::CodeGenModule::GetAddrOfConstantStringFromLiteral().
| static const llvm::GlobalObject* getAliasedGlobal | ( | const llvm::GlobalAlias & | GA | ) | [static] |
Definition at line 237 of file CodeGenModule.cpp.
References AttributeLangSupport::C.
| static llvm::StringMapEntry<llvm::Constant*>& GetConstantCFStringEntry | ( | llvm::StringMap< llvm::Constant * > & | Map, |
| const StringLiteral * | Literal, | ||
| bool | TargetIsLSB, | ||
| bool & | IsUTF16, | ||
| unsigned & | StringLength | ||
| ) | [static] |
Definition at line 2462 of file CodeGenModule.cpp.
References clang::StringLiteral::containsNonAsciiOrNull(), and clang::StringLiteral::getString().
Referenced by clang::CodeGen::CodeGenModule::GetAddrOfConstantCFString().
| static llvm::StringMapEntry<llvm::Constant*>& GetConstantStringEntry | ( | llvm::StringMap< llvm::Constant * > & | Map, |
| const StringLiteral * | Literal, | ||
| unsigned & | StringLength | ||
| ) | [static] |
Definition at line 2498 of file CodeGenModule.cpp.
References clang::StringLiteral::getString().
Referenced by clang::CodeGen::CodeGenModule::GetAddrOfConstantString().
| static llvm::GlobalVariable::ThreadLocalMode GetLLVMTLSModel | ( | StringRef | S | ) | [static] |
Definition at line 515 of file CodeGenModule.cpp.
References S.
Referenced by clang::CodeGen::CodeGenModule::setTLSMode().
| static llvm::GlobalVariable::ThreadLocalMode GetLLVMTLSModel | ( | CodeGenOptions::TLSModel | M | ) | [static] |
Definition at line 523 of file CodeGenModule.cpp.
References clang::CodeGenOptions::GeneralDynamicTLSModel, clang::CodeGenOptions::InitialExecTLSModel, clang::CodeGenOptions::LocalDynamicTLSModel, and clang::CodeGenOptions::LocalExecTLSModel.
| static llvm::Constant* GetPointerConstant | ( | llvm::LLVMContext & | Context, |
| const void * | Ptr | ||
| ) | [static] |
Turns the given pointer into a constant.
Definition at line 3363 of file CodeGenModule.cpp.
Referenced by EmitGlobalDeclMetadata().
| static bool hasUnwindExceptions | ( | const LangOptions & | LangOpts | ) | [static] |
Determines whether the language options require us to model unwind exceptions. We treat -fexceptions as mandating this except under the fragile ObjC ABI with only ObjC exceptions enabled. This means, for example, that C with -fexceptions enables this.
Definition at line 689 of file CodeGenModule.cpp.
References clang::ObjCRuntime::hasUnwindExceptions(), and clang::LangOptions::ObjCRuntime.
Referenced by clang::CodeGen::CodeGenModule::SetLLVMFunctionAttributesForDefinition().
| static bool isVarDeclStrongDefinition | ( | const ASTContext & | Context, |
| const VarDecl * | D, | ||
| bool | NoCommon | ||
| ) | [static] |
Definition at line 2048 of file CodeGenModule.cpp.
References clang::VarDecl::getInit(), clang::ASTContext::getLangOpts(), clang::VarDecl::getTLSKind(), clang::ValueDecl::getType(), clang::Decl::hasAttr(), clang::VarDecl::hasExternalStorage(), and clang::ASTContext::isAlignmentRequired().
Referenced by clang::CodeGen::CodeGenModule::getLLVMLinkageForDeclarator().
| static bool needsDestructMethod | ( | ObjCImplementationDecl * | impl | ) | [static] |
Definition at line 3010 of file CodeGenModule.cpp.
References clang::ObjCInterfaceDecl::all_declared_ivar_begin(), clang::ObjCImplDecl::getClassInterface(), and clang::ObjCIvarDecl::getNextIvar().
| static void replaceUsesOfNonProtoConstant | ( | llvm::Constant * | old, |
| llvm::Function * | newFn | ||
| ) | [static] |
Replace the uses of a function that was declared with a non-proto type. We want to silently drop extra arguments from call sites
Definition at line 2150 of file CodeGenModule.cpp.
Referenced by ReplaceUsesOfNonProtoTypeWithRealFunction().
| static void ReplaceUsesOfNonProtoTypeWithRealFunction | ( | llvm::GlobalValue * | Old, |
| llvm::Function * | NewFn | ||
| ) | [static] |
ReplaceUsesOfNonProtoTypeWithRealFunction - This function is called when we implement a function with no prototype, e.g. "int foo() {}". If there are existing call uses of the old function in the module, this adjusts them to call the new function directly.
This is not just a cleanup: the always_inline pass requires direct calls to functions to be able to inline them. If there is a bitcast in the way, it won't inline them. Instcombine normally deletes these calls, but it isn't run at -O0.
Definition at line 2264 of file CodeGenModule.cpp.
References replaceUsesOfNonProtoConstant().
| static void setLinkageAndVisibilityForGV | ( | llvm::GlobalValue * | GV, |
| const NamedDecl * | ND | ||
| ) | [static] |
Definition at line 832 of file CodeGenModule.cpp.
References clang::ExternalLinkage, clang::LinkageInfo::getLinkage(), clang::NamedDecl::getLinkageAndVisibility(), clang::CodeGen::CodeGenModule::GetLLVMVisibility(), clang::LinkageInfo::getVisibility(), clang::Decl::hasAttr(), clang::LinkageInfo::isVisibilityExplicit(), clang::Decl::isWeakImported(), and clang::LinkageInfo::setLinkage().
const char AnnotationSection[] = "llvm.metadata" [static] |
Definition at line 59 of file CodeGenModule.cpp.
Referenced by clang::CodeGen::CodeGenModule::EmitAnnotationString(), and clang::CodeGen::CodeGenModule::EmitGlobalAnnotations().