|
clang 23.0.0git
|
#include "CGDebugInfo.h"#include "CGBlocks.h"#include "CGCXXABI.h"#include "CGObjCRuntime.h"#include "CGRecordLayout.h"#include "CodeGenFunction.h"#include "CodeGenModule.h"#include "ConstantEmitter.h"#include "TargetInfo.h"#include "clang/AST/ASTContext.h"#include "clang/AST/Attr.h"#include "clang/AST/DeclCXX.h"#include "clang/AST/DeclFriend.h"#include "clang/AST/DeclObjC.h"#include "clang/AST/DeclTemplate.h"#include "clang/AST/Expr.h"#include "clang/AST/LambdaCapture.h"#include "clang/AST/RecordLayout.h"#include "clang/AST/RecursiveASTVisitor.h"#include "clang/AST/VTableBuilder.h"#include "clang/Basic/CodeGenOptions.h"#include "clang/Basic/SourceManager.h"#include "clang/Basic/Version.h"#include "clang/CodeGen/ModuleBuilder.h"#include "clang/Frontend/FrontendOptions.h"#include "clang/Lex/HeaderSearchOptions.h"#include "clang/Lex/ModuleMap.h"#include "clang/Lex/PreprocessorOptions.h"#include "llvm/ADT/DenseSet.h"#include "llvm/ADT/SmallVector.h"#include "llvm/ADT/StringExtras.h"#include "llvm/IR/Constants.h"#include "llvm/IR/DataLayout.h"#include "llvm/IR/DerivedTypes.h"#include "llvm/IR/Instruction.h"#include "llvm/IR/Instructions.h"#include "llvm/IR/Intrinsics.h"#include "llvm/IR/Metadata.h"#include "llvm/IR/Module.h"#include "llvm/Support/MD5.h"#include "llvm/Support/Path.h"#include "llvm/Support/SHA1.h"#include "llvm/Support/SHA256.h"#include "llvm/Support/TimeProfiler.h"#include <cstdint>#include <optional>#include "clang/AST/BuiltinTypes.def"#include "clang/Basic/OpenCLImageTypes.def"#include "clang/Basic/OpenCLExtensionTypes.def"#include "clang/Basic/HLSLIntangibleTypes.def"#include "clang/Basic/AArch64ACLETypes.def"#include "clang/Basic/PPCTypes.def"#include "clang/Basic/RISCVVTypes.def"#include "clang/Basic/WebAssemblyReferenceTypes.def"#include "clang/Basic/AMDGPUTypes.def"#include "clang/AST/TypeNodes.inc"#include "clang/Basic/Sanitizers.def"Go to the source code of this file.
Macros | |
| #define | BUILTIN_TYPE(Id, SingletonId) |
| #define | PLACEHOLDER_TYPE(Id, SingletonId) |
| #define | IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) |
| #define | EXT_OPAQUE_TYPE(ExtType, Id, Ext) |
| #define | HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) |
| #define | SVE_TYPE(Name, Id, SingletonId) |
| #define | PPC_VECTOR_TYPE(Name, Id, size) |
| #define | RVV_TYPE(Name, Id, SingletonId) |
| #define | WASM_REF_TYPE(Name, MangledName, Id, SingletonId, AS) |
| #define | AMDGPU_OPAQUE_PTR_TYPE(Name, Id, SingletonId, Width, Align, AS) |
| #define | AMDGPU_NAMED_BARRIER_TYPE(Name, Id, SingletonId, Width, Align, Scope) |
| #define | AMDGPU_FEATURE_PREDICATE_TYPE(Name, Id, SingletonId, Width, Align) |
| #define | CC_VLS_CASE(ABI_VLEN) |
| #define | TYPE(Class, Base) |
| #define | ABSTRACT_TYPE(Class, Base) |
| #define | NON_CANONICAL_TYPE(Class, Base) |
| #define | DEPENDENT_TYPE(Class, Base) |
| #define | SANITIZER_CHECK(Enum, Name, Version, Msg) |
| #define | SANITIZER(NAME, ID) |
Functions | |
| static SourceLocation | getMacroDebugLoc (const CodeGenModule &CGM, SourceLocation Loc) |
| static uint32_t | getTypeAlignIfRequired (const Type *Ty, const ASTContext &Ctx) |
| static uint32_t | getTypeAlignIfRequired (QualType Ty, const ASTContext &Ctx) |
| static uint32_t | getDeclAlignIfRequired (const Decl *D, const ASTContext &Ctx) |
| static bool | IsDecomposedVarDecl (VarDecl const *VD) |
| Returns true if VD is a a holding variable (aka a VarDecl retrieved using BindingDecl::getHoldingVar). | |
| static bool | IsArtificial (VarDecl const *VD) |
| Returns true if VD is a compiler-generated variable and should be treated as artificial for the purposes of debug-info generation. | |
| static bool | IsObjCSynthesizedPropertyExplicitParameter (VarDecl const *VD) |
Returns true if the specified variable VD is an explicit parameter of a synthesized Objective-C property accessor. | |
| static llvm::dwarf::SourceLanguage | GetSourceLanguage (const CodeGenModule &CGM) |
| static llvm::DISourceLanguageName | GetDISourceLanguageName (const CodeGenModule &CGM) |
| static void | stripUnusedQualifiers (Qualifiers &Q) |
| static llvm::dwarf::Tag | getNextQualifier (Qualifiers &Q) |
| static bool | hasCXXMangling (llvm::dwarf::SourceLanguage Lang, bool IsTagDecl) |
| static bool | hasCXXMangling (llvm::dwarf::SourceLanguageName Lang, bool IsTagDecl) |
| static bool | hasCXXMangling (const TagDecl *TD, llvm::DICompileUnit *TheCU) |
| static bool | needsTypeIdentifier (const TagDecl *TD, CodeGenModule &CGM, llvm::DICompileUnit *TheCU) |
| static SmallString< 256 > | getTypeIdentifier (const TagType *Ty, CodeGenModule &CGM, llvm::DICompileUnit *TheCU) |
| static llvm::dwarf::Tag | getTagForRecord (const RecordDecl *RD) |
| static llvm::SmallVector< TemplateArgument > | GetTemplateArgs (const TemplateDecl *TD, const TemplateSpecializationType *Ty) |
| static llvm::DINode::DIFlags | getAccessFlag (AccessSpecifier Access, const RecordDecl *RD) |
| Convert an AccessSpecifier into the corresponding DINode flag. | |
| static unsigned | getDwarfCC (CallingConv CC) |
| static llvm::DINode::DIFlags | getRefFlags (const FunctionProtoType *Func) |
| template<typename T> | |
| static llvm::Constant * | buildConstantDataArrayFromElements (llvm::LLVMContext &Ctx, const APValue &Arr) |
| Build an llvm::ConstantDataArray from the initialized elements of an APValue array, using the narrowest integer type that fits the element width. | |
| static llvm::Constant * | tryEmitConstexprArrayAsConstant (CodeGenModule &CGM, const VarDecl *Var, const APValue *Value) |
| Try to create an llvm::Constant for a constexpr array of integer elements. | |
| static bool | isFunctionLocalClass (const CXXRecordDecl *RD) |
| isFunctionLocalClass - Return true if CXXRecordDecl is defined inside a function. | |
| static bool | isClassOrMethodDLLImport (const CXXRecordDecl *RD) |
| Return true if the class or any of its methods are marked dllimport. | |
| static bool | isDefinedInClangModule (const RecordDecl *RD) |
| Does a type definition exist in an imported clang module? | |
| static bool | hasExplicitMemberDefinition (CXXRecordDecl::method_iterator I, CXXRecordDecl::method_iterator End) |
| static bool | canUseCtorHoming (const CXXRecordDecl *RD) |
| static bool | shouldOmitDefinition (llvm::codegenoptions::DebugInfoKind DebugKind, bool DebugTypeExtRefs, const RecordDecl *RD, const LangOptions &LangOpts) |
| static bool | hasDefaultGetterName (const ObjCPropertyDecl *PD, const ObjCMethodDecl *Getter) |
| static bool | hasDefaultSetterName (const ObjCPropertyDecl *PD, const ObjCMethodDecl *Setter) |
| static auto | getEnumInfo (CodeGenModule &CGM, llvm::DICompileUnit *TheCU, const EnumType *Ty) |
| static QualType | UnwrapTypeForDebugInfo (QualType T, const ASTContext &C) |
| static bool | ReferencesAnonymousEntity (ArrayRef< TemplateArgument > Args) |
| static bool | ReferencesAnonymousEntity (RecordType *RT) |
| static bool | IsReconstitutableType (QualType QT) |
| static std::string | SanitizerHandlerToCheckLabel (SanitizerHandler Handler) |
| static std::string | SanitizerOrdinalToCheckLabel (SanitizerKind::SanitizerOrdinal Ordinal) |
| #define ABSTRACT_TYPE | ( | Class, | |
| Base ) |
| #define AMDGPU_FEATURE_PREDICATE_TYPE | ( | Name, | |
| Id, | |||
| SingletonId, | |||
| Width, | |||
| Align ) |
| #define AMDGPU_NAMED_BARRIER_TYPE | ( | Name, | |
| Id, | |||
| SingletonId, | |||
| Width, | |||
| Align, | |||
| Scope ) |
| #define AMDGPU_OPAQUE_PTR_TYPE | ( | Name, | |
| Id, | |||
| SingletonId, | |||
| Width, | |||
| Align, | |||
| AS ) |
| #define BUILTIN_TYPE | ( | Id, | |
| SingletonId ) |
| #define CC_VLS_CASE | ( | ABI_VLEN | ) |
| #define DEPENDENT_TYPE | ( | Class, | |
| Base ) |
| #define EXT_OPAQUE_TYPE | ( | ExtType, | |
| Id, | |||
| Ext ) |
| #define HLSL_INTANGIBLE_TYPE | ( | Name, | |
| Id, | |||
| SingletonId ) |
| #define IMAGE_TYPE | ( | ImgType, | |
| Id, | |||
| SingletonId, | |||
| Access, | |||
| Suffix ) |
| #define NON_CANONICAL_TYPE | ( | Class, | |
| Base ) |
| #define PLACEHOLDER_TYPE | ( | Id, | |
| SingletonId ) |
| #define PPC_VECTOR_TYPE | ( | Name, | |
| Id, | |||
| size ) |
| #define RVV_TYPE | ( | Name, | |
| Id, | |||
| SingletonId ) |
| #define SANITIZER | ( | NAME, | |
| ID ) |
| #define SANITIZER_CHECK | ( | Enum, | |
| Name, | |||
| Version, | |||
| Msg ) |
| #define SVE_TYPE | ( | Name, | |
| Id, | |||
| SingletonId ) |
| #define TYPE | ( | Class, | |
| Base ) |
| #define WASM_REF_TYPE | ( | Name, | |
| MangledName, | |||
| Id, | |||
| SingletonId, | |||
| AS ) |
|
static |
Build an llvm::ConstantDataArray from the initialized elements of an APValue array, using the narrowest integer type that fits the element width.
Definition at line 2121 of file CGDebugInfo.cpp.
References clang::APValue::getArrayFiller(), clang::APValue::getArrayInitializedElt(), clang::APValue::getArrayInitializedElts(), clang::APValue::getArraySize(), clang::APValue::getInt(), and clang::APValue::hasArrayFiller().
Referenced by tryEmitConstexprArrayAsConstant().
|
static |
Definition at line 3196 of file CGDebugInfo.cpp.
References clang::CXXRecordDecl::ctors(), clang::CXXRecordDecl::hasConstexprNonCopyMoveConstructor(), clang::CXXRecordDecl::hasTrivialDefaultConstructor(), clang::CXXRecordDecl::isAggregate(), isClassOrMethodDLLImport(), and clang::CXXRecordDecl::isLambda().
Referenced by shouldOmitDefinition().
|
static |
Convert an AccessSpecifier into the corresponding DINode flag.
As an optimization, return 0 if the access specifier equals the default for the containing type.
Definition at line 1744 of file CGDebugInfo.cpp.
References clang::AS_none, clang::AS_private, clang::AS_protected, clang::AS_public, clang::Default, clang::TagDecl::isClass(), clang::TagDecl::isStruct(), and clang::TagDecl::isUnion().
Referenced by clang::CodeGen::CGDebugInfo::emitVTableSymbol().
|
static |
Definition at line 87 of file CGDebugInfo.cpp.
References clang::Decl::getMaxAlignment(), and clang::Decl::hasAttr().
Referenced by clang::CodeGen::CGDebugInfo::EmitDeclareOfBlockDeclRefVariable(), clang::CodeGen::CGDebugInfo::EmitDeclareOfBlockLiteralArgVariable(), clang::CodeGen::CGDebugInfo::EmitExternalVariable(), clang::CodeGen::CGDebugInfo::EmitGlobalVariable(), clang::CodeGen::CGDebugInfo::EmitGlobalVariable(), and getEnumInfo().
|
static |
Definition at line 749 of file CGDebugInfo.cpp.
References clang::LangOptions::getCLangStd(), clang::CodeGen::CodeGenModule::getCodeGenOpts(), clang::LangOptions::getCPlusPlusLangStd(), clang::CodeGen::CodeGenModule::getLangOpts(), and GetSourceLanguage().
|
static |
Definition at line 1795 of file CGDebugInfo.cpp.
References clang::CC_AAPCS, clang::CC_AAPCS_VFP, clang::CC_AArch64SVEPCS, clang::CC_AArch64VectorCall, clang::CC_C, clang::CC_DeviceKernel, clang::CC_IntelOclBicc, clang::CC_M68kRTD, clang::CC_PreserveAll, clang::CC_PreserveMost, clang::CC_PreserveNone, clang::CC_RISCVVectorCall, clang::CC_SpirFunction, clang::CC_Swift, clang::CC_SwiftAsync, CC_VLS_CASE, clang::CC_Win64, clang::CC_X86_64SysV, clang::CC_X86FastCall, clang::CC_X86Pascal, clang::CC_X86RegCall, clang::CC_X86StdCall, clang::CC_X86ThisCall, and clang::CC_X86VectorCall.
|
static |
Definition at line 3961 of file CGDebugInfo.cpp.
References clang::CodeGen::CodeGenModule::getContext(), getDeclAlignIfRequired(), clang::EnumDecl::getDefinitionOrSelf(), getTypeIdentifier(), clang::ASTContext::getTypeSize(), and clang::EnumDecl::isComplete().
|
static |
Definition at line 62 of file CGDebugInfo.cpp.
References clang::CodeGen::CodeGenModule::getCodeGenOpts(), clang::CodeGen::CodeGenModule::getContext(), clang::SourceManager::getFileLoc(), and clang::ASTContext::getSourceManager().
Referenced by clang::CodeGen::CGDebugInfo::AddStringLiteralDebugInfo(), and clang::CodeGen::CGDebugInfo::setLocation().
|
static |
Definition at line 1261 of file CGDebugInfo.cpp.
References clang::Qualifiers::hasConst(), clang::Qualifiers::hasRestrict(), clang::Qualifiers::hasVolatile(), clang::Qualifiers::removeConst(), clang::Qualifiers::removeRestrict(), and clang::Qualifiers::removeVolatile().
|
static |
Definition at line 1862 of file CGDebugInfo.cpp.
References clang::Func, clang::RQ_LValue, and clang::RQ_RValue.
|
static |
Definition at line 711 of file CGDebugInfo.cpp.
References clang::CodeGen::CodeGenModule::getCodeGenOpts(), and clang::CodeGen::CodeGenModule::getLangOpts().
Referenced by GetDISourceLanguageName().
|
static |
Definition at line 1459 of file CGDebugInfo.cpp.
References clang::TagDecl::isClass(), clang::TagDecl::isInterface(), clang::TagDecl::isStruct(), and clang::TagDecl::isUnion().
|
static |
Definition at line 1653 of file CGDebugInfo.cpp.
References clang::TemplateParameterList::asArray(), and clang::TemplateDecl::getTemplateParameters().
|
static |
Definition at line 69 of file CGDebugInfo.cpp.
References clang::TypeInfo::Align, clang::Type::getAsRecordDecl(), clang::ASTContext::getTypeInfo(), and clang::Decl::hasAttr().
Referenced by getTypeAlignIfRequired().
|
static |
Definition at line 83 of file CGDebugInfo.cpp.
References getTypeAlignIfRequired(), and clang::QualType::getTypePtr().
|
static |
Definition at line 1438 of file CGDebugInfo.cpp.
References clang::CodeGen::CodeGenModule::getCXXABI(), clang::RecordDecl::getDefinition(), clang::TagDecl::getDefinitionOrSelf(), clang::CodeGen::CGCXXABI::getMangleContext(), clang::CodeGen::CodeGenModule::getVTableLinkage(), clang::MangleContext::mangleCXXRTTIName(), and needsTypeIdentifier().
Referenced by getEnumInfo().
Definition at line 1385 of file CGDebugInfo.cpp.
References hasCXXMangling(), and clang::isa().
Definition at line 1357 of file CGDebugInfo.cpp.
Referenced by hasCXXMangling(), and needsTypeIdentifier().
Definition at line 1371 of file CGDebugInfo.cpp.
|
static |
Definition at line 3401 of file CGDebugInfo.cpp.
References clang::NamedDecl::getDeclName(), clang::NamedDecl::getName(), clang::Selector::getNameForSlot(), clang::DeclarationName::getObjCSelector(), and clang::DeclarationName::isObjCZeroArgSelector().
|
static |
Definition at line 3413 of file CGDebugInfo.cpp.
References clang::SelectorTable::constructSetterName(), clang::NamedDecl::getDeclName(), clang::NamedDecl::getName(), clang::Selector::getNameForSlot(), clang::DeclarationName::getObjCSelector(), and clang::DeclarationName::isObjCOneArgSelector().
|
static |
Definition at line 3186 of file CGDebugInfo.cpp.
References clang::FunctionDecl::getInstantiatedFromMemberFunction().
Referenced by shouldOmitDefinition().
Returns true if VD is a compiler-generated variable and should be treated as artificial for the purposes of debug-info generation.
Definition at line 109 of file CGDebugInfo.cpp.
References clang::cast(), clang::Decl::getDeclContext(), clang::isa(), IsDecomposedVarDecl(), and clang::Decl::isImplicit().
|
static |
Return true if the class or any of its methods are marked dllimport.
Definition at line 3114 of file CGDebugInfo.cpp.
References clang::Decl::hasAttr(), and clang::CXXRecordDecl::methods().
Referenced by canUseCtorHoming(), clang::CodeGen::CGDebugInfo::completeClassData(), and shouldOmitDefinition().
Returns true if VD is a a holding variable (aka a VarDecl retrieved using BindingDecl::getHoldingVar).
Definition at line 93 of file CGDebugInfo.cpp.
References clang::VarDecl::getInit(), and clang::Init.
Referenced by IsArtificial().
|
static |
Does a type definition exist in an imported clang module?
Definition at line 3124 of file CGDebugInfo.cpp.
References clang::Explicit, clang::RecordDecl::field_begin(), clang::RecordDecl::fields(), clang::DeclContext::getEnclosingNamespaceContext(), clang::NamedDecl::getName(), clang::CXXRecordDecl::getTemplateSpecializationKind(), clang::TagDecl::isCompleteDefinition(), clang::NamedDecl::isExternallyVisible(), clang::Decl::isFromASTFile(), clang::TSK_ExplicitInstantiationDeclaration, and clang::TSK_Undeclared.
Referenced by clang::CodeGen::CGDebugInfo::completeClassData(), and shouldOmitDefinition().
|
static |
isFunctionLocalClass - Return true if CXXRecordDecl is defined inside a function.
Definition at line 2392 of file CGDebugInfo.cpp.
References clang::Decl::getDeclContext(), clang::isa(), and isFunctionLocalClass().
Referenced by isFunctionLocalClass().
Returns true if the specified variable VD is an explicit parameter of a synthesized Objective-C property accessor.
E.g., a synthesized property setter method will have a single explicit parameter which is the property to set.
Definition at line 124 of file CGDebugInfo.cpp.
References clang::Decl::getDeclContext(), and clang::Decl::isImplicit().
Definition at line 6052 of file CGDebugInfo.cpp.
|
static |
Definition at line 1420 of file CGDebugInfo.cpp.
References clang::CodeGen::CodeGenModule::getCodeGenOpts(), hasCXXMangling(), and clang::NamedDecl::isExternallyVisible().
Referenced by getTypeIdentifier().
|
static |
Definition at line 5981 of file CGDebugInfo.cpp.
References clang::TemplateArgument::getAsType(), clang::TemplateArgument::getKind(), clang::TemplateArgument::getPackAsArray(), clang::TemplateArgument::Pack, ReferencesAnonymousEntity(), and clang::TemplateArgument::Type.
Referenced by ReferencesAnonymousEntity(), and ReferencesAnonymousEntity().
|
static |
Definition at line 5965 of file CGDebugInfo.cpp.
References clang::NamedDecl::getIdentifier(), and ReferencesAnonymousEntity().
|
static |
Definition at line 6747 of file CGDebugInfo.cpp.
References LIST_SANITIZER_CHECKS.
Referenced by clang::CodeGen::CodeGenFunction::SanitizerAnnotateDebugInfo().
|
static |
Definition at line 6764 of file CGDebugInfo.cpp.
Referenced by clang::CodeGen::CodeGenFunction::SanitizerAnnotateDebugInfo().
|
static |
Definition at line 3222 of file CGDebugInfo.cpp.
References canUseCtorHoming(), clang::ExternalASTSource::EK_Always, clang::Decl::getASTContext(), clang::RecordDecl::getDefinition(), clang::ASTContext::getExternalSource(), clang::Decl::hasAttr(), clang::CXXRecordDecl::hasDefinition(), hasExplicitMemberDefinition(), isClassOrMethodDLLImport(), clang::TagDecl::isCompleteDefinitionRequired(), isDefinedInClangModule(), clang::CXXRecordDecl::isDynamicClass(), clang::CXXRecordDecl::method_begin(), clang::CXXRecordDecl::method_end(), clang::TSK_ExplicitInstantiationDeclaration, and clang::TSK_Undeclared.
Referenced by clang::CodeGen::CGDebugInfo::completeRequiredType().
|
static |
Definition at line 1253 of file CGDebugInfo.cpp.
References clang::Qualifiers::removeAddressSpace(), clang::Qualifiers::removeObjCGCAttr(), clang::Qualifiers::removeObjCLifetime(), and clang::Qualifiers::removeUnaligned().
|
static |
Try to create an llvm::Constant for a constexpr array of integer elements.
Handles arrays of char, short, int, long with element width up to 64 bits. Returns nullptr if the array cannot be represented.
Definition at line 2137 of file CGDebugInfo.cpp.
References buildConstantDataArrayFromElements(), clang::ASTContext::getAsConstantArrayType(), clang::CodeGen::CodeGenModule::getContext(), clang::CodeGen::CodeGenModule::getLLVMContext(), clang::ValueDecl::getType(), clang::ASTContext::getTypeSize(), clang::Type::isIntegerType(), and clang::QualType::isNull().
|
static |
Definition at line 4081 of file CGDebugInfo.cpp.
References clang::C, clang::cast(), clang::QualType::isNull(), and clang::Qualifiers::removeCommonQualifiers().