clang 17.0.0git
CGDebugInfo.h
Go to the documentation of this file.
1//===--- CGDebugInfo.h - DebugInfo for LLVM CodeGen -------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This is the source-level debug info generator for llvm translation.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_CLANG_LIB_CODEGEN_CGDEBUGINFO_H
14#define LLVM_CLANG_LIB_CODEGEN_CGDEBUGINFO_H
15
16#include "CGBuilder.h"
17#include "clang/AST/DeclCXX.h"
18#include "clang/AST/Expr.h"
21#include "clang/AST/Type.h"
24#include "clang/Basic/Module.h"
26#include "llvm/ADT/DenseMap.h"
27#include "llvm/ADT/DenseSet.h"
28#include "llvm/IR/DIBuilder.h"
29#include "llvm/IR/DebugInfo.h"
30#include "llvm/IR/ValueHandle.h"
31#include "llvm/Support/Allocator.h"
32#include <optional>
33
34namespace llvm {
35class MDNode;
36}
37
38namespace clang {
39class ClassTemplateSpecializationDecl;
40class GlobalDecl;
41class ModuleMap;
42class ObjCInterfaceDecl;
43class UsingDecl;
44class VarDecl;
45enum class DynamicInitKind : unsigned;
46
47namespace CodeGen {
48class CodeGenModule;
49class CodeGenFunction;
50class CGBlockInfo;
51
52/// This class gathers all debug information during compilation and is
53/// responsible for emitting to llvm globals or pass directly to the
54/// backend.
56 friend class ApplyDebugLocation;
58 CodeGenModule &CGM;
59 const codegenoptions::DebugInfoKind DebugKind;
60 bool DebugTypeExtRefs;
61 llvm::DIBuilder DBuilder;
62 llvm::DICompileUnit *TheCU = nullptr;
63 ModuleMap *ClangModuleMap = nullptr;
64 ASTSourceDescriptor PCHDescriptor;
65 SourceLocation CurLoc;
66 llvm::MDNode *CurInlinedAt = nullptr;
67 llvm::DIType *VTablePtrType = nullptr;
68 llvm::DIType *ClassTy = nullptr;
69 llvm::DICompositeType *ObjTy = nullptr;
70 llvm::DIType *SelTy = nullptr;
71#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
72 llvm::DIType *SingletonId = nullptr;
73#include "clang/Basic/OpenCLImageTypes.def"
74 llvm::DIType *OCLSamplerDITy = nullptr;
75 llvm::DIType *OCLEventDITy = nullptr;
76 llvm::DIType *OCLClkEventDITy = nullptr;
77 llvm::DIType *OCLQueueDITy = nullptr;
78 llvm::DIType *OCLNDRangeDITy = nullptr;
79 llvm::DIType *OCLReserveIDDITy = nullptr;
80#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
81 llvm::DIType *Id##Ty = nullptr;
82#include "clang/Basic/OpenCLExtensionTypes.def"
83#define WASM_TYPE(Name, Id, SingletonId) llvm::DIType *SingletonId = nullptr;
84#include "clang/Basic/WebAssemblyReferenceTypes.def"
85
86 /// Cache of previously constructed Types.
87 llvm::DenseMap<const void *, llvm::TrackingMDRef> TypeCache;
88
89 std::map<llvm::StringRef, llvm::StringRef, std::greater<llvm::StringRef>>
90 DebugPrefixMap;
91
92 /// Cache that maps VLA types to size expressions for that type,
93 /// represented by instantiated Metadata nodes.
94 llvm::SmallDenseMap<QualType, llvm::Metadata *> SizeExprCache;
95
96 /// Callbacks to use when printing names and types.
97 class PrintingCallbacks final : public clang::PrintingCallbacks {
98 const CGDebugInfo &Self;
99
100 public:
101 PrintingCallbacks(const CGDebugInfo &Self) : Self(Self) {}
102 std::string remapPath(StringRef Path) const override {
103 return Self.remapDIPath(Path);
104 }
105 };
106 PrintingCallbacks PrintCB = {*this};
107
108 struct ObjCInterfaceCacheEntry {
109 const ObjCInterfaceType *Type;
110 llvm::DIType *Decl;
111 llvm::DIFile *Unit;
112 ObjCInterfaceCacheEntry(const ObjCInterfaceType *Type, llvm::DIType *Decl,
113 llvm::DIFile *Unit)
114 : Type(Type), Decl(Decl), Unit(Unit) {}
115 };
116
117 /// Cache of previously constructed interfaces which may change.
119
120 /// Cache of forward declarations for methods belonging to the interface.
121 /// The extra bit on the DISubprogram specifies whether a method is
122 /// "objc_direct".
123 llvm::DenseMap<const ObjCInterfaceDecl *,
124 std::vector<llvm::PointerIntPair<llvm::DISubprogram *, 1>>>
125 ObjCMethodCache;
126
127 /// Cache of references to clang modules and precompiled headers.
128 llvm::DenseMap<const Module *, llvm::TrackingMDRef> ModuleCache;
129
130 /// List of interfaces we want to keep even if orphaned.
131 std::vector<void *> RetainedTypes;
132
133 /// Cache of forward declared types to RAUW at the end of compilation.
134 std::vector<std::pair<const TagType *, llvm::TrackingMDRef>> ReplaceMap;
135
136 /// Cache of replaceable forward declarations (functions and
137 /// variables) to RAUW at the end of compilation.
138 std::vector<std::pair<const DeclaratorDecl *, llvm::TrackingMDRef>>
139 FwdDeclReplaceMap;
140
141 /// Keep track of our current nested lexical block.
142 std::vector<llvm::TypedTrackingMDRef<llvm::DIScope>> LexicalBlockStack;
143 llvm::DenseMap<const Decl *, llvm::TrackingMDRef> RegionMap;
144 /// Keep track of LexicalBlockStack counter at the beginning of a
145 /// function. This is used to pop unbalanced regions at the end of a
146 /// function.
147 std::vector<unsigned> FnBeginRegionCount;
148
149 /// This is a storage for names that are constructed on demand. For
150 /// example, C++ destructors, C++ operators etc..
151 llvm::BumpPtrAllocator DebugInfoNames;
152 StringRef CWDName;
153
154 llvm::DenseMap<const char *, llvm::TrackingMDRef> DIFileCache;
155 llvm::DenseMap<const FunctionDecl *, llvm::TrackingMDRef> SPCache;
156 /// Cache declarations relevant to DW_TAG_imported_declarations (C++
157 /// using declarations and global alias variables) that aren't covered
158 /// by other more specific caches.
159 llvm::DenseMap<const Decl *, llvm::TrackingMDRef> DeclCache;
160 llvm::DenseMap<const Decl *, llvm::TrackingMDRef> ImportedDeclCache;
161 llvm::DenseMap<const NamespaceDecl *, llvm::TrackingMDRef> NamespaceCache;
162 llvm::DenseMap<const NamespaceAliasDecl *, llvm::TrackingMDRef>
163 NamespaceAliasCache;
164 llvm::DenseMap<const Decl *, llvm::TypedTrackingMDRef<llvm::DIDerivedType>>
165 StaticDataMemberCache;
166
167 using ParamDecl2StmtTy = llvm::DenseMap<const ParmVarDecl *, const Stmt *>;
168 using Param2DILocTy =
169 llvm::DenseMap<const ParmVarDecl *, llvm::DILocalVariable *>;
170
171 /// The key is coroutine real parameters, value is coroutine move parameters.
172 ParamDecl2StmtTy CoroutineParameterMappings;
173 /// The key is coroutine real parameters, value is DIVariable in LLVM IR.
174 Param2DILocTy ParamDbgMappings;
175
176 /// Helper functions for getOrCreateType.
177 /// @{
178 /// Currently the checksum of an interface includes the number of
179 /// ivars and property accessors.
180 llvm::DIType *CreateType(const BuiltinType *Ty);
181 llvm::DIType *CreateType(const ComplexType *Ty);
182 llvm::DIType *CreateType(const BitIntType *Ty);
183 llvm::DIType *CreateQualifiedType(QualType Ty, llvm::DIFile *Fg);
184 llvm::DIType *CreateQualifiedType(const FunctionProtoType *Ty,
185 llvm::DIFile *Fg);
186 llvm::DIType *CreateType(const TypedefType *Ty, llvm::DIFile *Fg);
187 llvm::DIType *CreateType(const TemplateSpecializationType *Ty,
188 llvm::DIFile *Fg);
189 llvm::DIType *CreateType(const ObjCObjectPointerType *Ty, llvm::DIFile *F);
190 llvm::DIType *CreateType(const PointerType *Ty, llvm::DIFile *F);
191 llvm::DIType *CreateType(const BlockPointerType *Ty, llvm::DIFile *F);
192 llvm::DIType *CreateType(const FunctionType *Ty, llvm::DIFile *F);
193 /// Get structure or union type.
194 llvm::DIType *CreateType(const RecordType *Tyg);
195 llvm::DIType *CreateTypeDefinition(const RecordType *Ty);
196 llvm::DICompositeType *CreateLimitedType(const RecordType *Ty);
197 void CollectContainingType(const CXXRecordDecl *RD,
198 llvm::DICompositeType *CT);
199 /// Get Objective-C interface type.
200 llvm::DIType *CreateType(const ObjCInterfaceType *Ty, llvm::DIFile *F);
201 llvm::DIType *CreateTypeDefinition(const ObjCInterfaceType *Ty,
202 llvm::DIFile *F);
203 /// Get Objective-C object type.
204 llvm::DIType *CreateType(const ObjCObjectType *Ty, llvm::DIFile *F);
205 llvm::DIType *CreateType(const ObjCTypeParamType *Ty, llvm::DIFile *Unit);
206
207 llvm::DIType *CreateType(const VectorType *Ty, llvm::DIFile *F);
208 llvm::DIType *CreateType(const ConstantMatrixType *Ty, llvm::DIFile *F);
209 llvm::DIType *CreateType(const ArrayType *Ty, llvm::DIFile *F);
210 llvm::DIType *CreateType(const LValueReferenceType *Ty, llvm::DIFile *F);
211 llvm::DIType *CreateType(const RValueReferenceType *Ty, llvm::DIFile *Unit);
212 llvm::DIType *CreateType(const MemberPointerType *Ty, llvm::DIFile *F);
213 llvm::DIType *CreateType(const AtomicType *Ty, llvm::DIFile *F);
214 llvm::DIType *CreateType(const PipeType *Ty, llvm::DIFile *F);
215 /// Get enumeration type.
216 llvm::DIType *CreateEnumType(const EnumType *Ty);
217 llvm::DIType *CreateTypeDefinition(const EnumType *Ty);
218 /// Look up the completed type for a self pointer in the TypeCache and
219 /// create a copy of it with the ObjectPointer and Artificial flags
220 /// set. If the type is not cached, a new one is created. This should
221 /// never happen though, since creating a type for the implicit self
222 /// argument implies that we already parsed the interface definition
223 /// and the ivar declarations in the implementation.
224 llvm::DIType *CreateSelfType(const QualType &QualTy, llvm::DIType *Ty);
225 /// @}
226
227 /// Get the type from the cache or return null type if it doesn't
228 /// exist.
229 llvm::DIType *getTypeOrNull(const QualType);
230 /// Return the debug type for a C++ method.
231 /// \arg CXXMethodDecl is of FunctionType. This function type is
232 /// not updated to include implicit \c this pointer. Use this routine
233 /// to get a method type which includes \c this pointer.
234 llvm::DISubroutineType *getOrCreateMethodType(const CXXMethodDecl *Method,
235 llvm::DIFile *F);
236 llvm::DISubroutineType *
237 getOrCreateInstanceMethodType(QualType ThisPtr, const FunctionProtoType *Func,
238 llvm::DIFile *Unit);
239 llvm::DISubroutineType *
240 getOrCreateFunctionType(const Decl *D, QualType FnType, llvm::DIFile *F);
241 /// \return debug info descriptor for vtable.
242 llvm::DIType *getOrCreateVTablePtrType(llvm::DIFile *F);
243
244 /// \return namespace descriptor for the given namespace decl.
245 llvm::DINamespace *getOrCreateNamespace(const NamespaceDecl *N);
246 llvm::DIType *CreatePointerLikeType(llvm::dwarf::Tag Tag, const Type *Ty,
247 QualType PointeeTy, llvm::DIFile *F);
248 llvm::DIType *getOrCreateStructPtrType(StringRef Name, llvm::DIType *&Cache);
249
250 /// A helper function to create a subprogram for a single member
251 /// function GlobalDecl.
252 llvm::DISubprogram *CreateCXXMemberFunction(const CXXMethodDecl *Method,
253 llvm::DIFile *F,
254 llvm::DIType *RecordTy);
255
256 /// A helper function to collect debug info for C++ member
257 /// functions. This is used while creating debug info entry for a
258 /// Record.
259 void CollectCXXMemberFunctions(const CXXRecordDecl *Decl, llvm::DIFile *F,
260 SmallVectorImpl<llvm::Metadata *> &E,
261 llvm::DIType *T);
262
263 /// A helper function to collect debug info for C++ base
264 /// classes. This is used while creating debug info entry for a
265 /// Record.
266 void CollectCXXBases(const CXXRecordDecl *Decl, llvm::DIFile *F,
267 SmallVectorImpl<llvm::Metadata *> &EltTys,
268 llvm::DIType *RecordTy);
269
270 /// Helper function for CollectCXXBases.
271 /// Adds debug info entries for types in Bases that are not in SeenTypes.
272 void CollectCXXBasesAux(
273 const CXXRecordDecl *RD, llvm::DIFile *Unit,
274 SmallVectorImpl<llvm::Metadata *> &EltTys, llvm::DIType *RecordTy,
276 llvm::DenseSet<CanonicalDeclPtr<const CXXRecordDecl>> &SeenTypes,
277 llvm::DINode::DIFlags StartingFlags);
278
279 struct TemplateArgs {
280 const TemplateParameterList *TList;
282 };
283 /// A helper function to collect template parameters.
284 llvm::DINodeArray CollectTemplateParams(std::optional<TemplateArgs> Args,
285 llvm::DIFile *Unit);
286 /// A helper function to collect debug info for function template
287 /// parameters.
288 llvm::DINodeArray CollectFunctionTemplateParams(const FunctionDecl *FD,
289 llvm::DIFile *Unit);
290
291 /// A helper function to collect debug info for function template
292 /// parameters.
293 llvm::DINodeArray CollectVarTemplateParams(const VarDecl *VD,
294 llvm::DIFile *Unit);
295
296 std::optional<TemplateArgs> GetTemplateArgs(const VarDecl *) const;
297 std::optional<TemplateArgs> GetTemplateArgs(const RecordDecl *) const;
298 std::optional<TemplateArgs> GetTemplateArgs(const FunctionDecl *) const;
299
300 /// A helper function to collect debug info for template
301 /// parameters.
302 llvm::DINodeArray CollectCXXTemplateParams(const RecordDecl *TS,
303 llvm::DIFile *F);
304
305 /// A helper function to collect debug info for btf_decl_tag annotations.
306 llvm::DINodeArray CollectBTFDeclTagAnnotations(const Decl *D);
307
308 llvm::DIType *createFieldType(StringRef name, QualType type,
309 SourceLocation loc, AccessSpecifier AS,
310 uint64_t offsetInBits, uint32_t AlignInBits,
311 llvm::DIFile *tunit, llvm::DIScope *scope,
312 const RecordDecl *RD = nullptr,
313 llvm::DINodeArray Annotations = nullptr);
314
315 llvm::DIType *createFieldType(StringRef name, QualType type,
316 SourceLocation loc, AccessSpecifier AS,
317 uint64_t offsetInBits, llvm::DIFile *tunit,
318 llvm::DIScope *scope,
319 const RecordDecl *RD = nullptr) {
320 return createFieldType(name, type, loc, AS, offsetInBits, 0, tunit, scope,
321 RD);
322 }
323
324 /// Create new bit field member.
325 llvm::DIType *createBitFieldType(const FieldDecl *BitFieldDecl,
326 llvm::DIScope *RecordTy,
327 const RecordDecl *RD);
328
329 /// Helpers for collecting fields of a record.
330 /// @{
331 void CollectRecordLambdaFields(const CXXRecordDecl *CXXDecl,
332 SmallVectorImpl<llvm::Metadata *> &E,
333 llvm::DIType *RecordTy);
334 llvm::DIDerivedType *CreateRecordStaticField(const VarDecl *Var,
335 llvm::DIType *RecordTy,
336 const RecordDecl *RD);
337 void CollectRecordNormalField(const FieldDecl *Field, uint64_t OffsetInBits,
338 llvm::DIFile *F,
339 SmallVectorImpl<llvm::Metadata *> &E,
340 llvm::DIType *RecordTy, const RecordDecl *RD);
341 void CollectRecordNestedType(const TypeDecl *RD,
342 SmallVectorImpl<llvm::Metadata *> &E);
343 void CollectRecordFields(const RecordDecl *Decl, llvm::DIFile *F,
344 SmallVectorImpl<llvm::Metadata *> &E,
345 llvm::DICompositeType *RecordTy);
346
347 /// If the C++ class has vtable info then insert appropriate debug
348 /// info entry in EltTys vector.
349 void CollectVTableInfo(const CXXRecordDecl *Decl, llvm::DIFile *F,
350 SmallVectorImpl<llvm::Metadata *> &EltTys);
351 /// @}
352
353 /// Create a new lexical block node and push it on the stack.
354 void CreateLexicalBlock(SourceLocation Loc);
355
356 /// If target-specific LLVM \p AddressSpace directly maps to target-specific
357 /// DWARF address space, appends extended dereferencing mechanism to complex
358 /// expression \p Expr. Otherwise, does nothing.
359 ///
360 /// Extended dereferencing mechanism is has the following format:
361 /// DW_OP_constu <DWARF Address Space> DW_OP_swap DW_OP_xderef
362 void AppendAddressSpaceXDeref(unsigned AddressSpace,
363 SmallVectorImpl<uint64_t> &Expr) const;
364
365 /// A helper function to collect debug info for the default elements of a
366 /// block.
367 ///
368 /// \returns The next available field offset after the default elements.
369 uint64_t collectDefaultElementTypesForBlockPointer(
370 const BlockPointerType *Ty, llvm::DIFile *Unit,
371 llvm::DIDerivedType *DescTy, unsigned LineNo,
372 SmallVectorImpl<llvm::Metadata *> &EltTys);
373
374 /// A helper function to collect debug info for the default fields of a
375 /// block.
376 void collectDefaultFieldsForBlockLiteralDeclare(
377 const CGBlockInfo &Block, const ASTContext &Context, SourceLocation Loc,
378 const llvm::StructLayout &BlockLayout, llvm::DIFile *Unit,
379 SmallVectorImpl<llvm::Metadata *> &Fields);
380
381public:
382 CGDebugInfo(CodeGenModule &CGM);
383 ~CGDebugInfo();
384
385 void finalize();
386
387 /// Remap a given path with the current debug prefix map
388 std::string remapDIPath(StringRef) const;
389
390 /// Register VLA size expression debug node with the qualified type.
391 void registerVLASizeExpression(QualType Ty, llvm::Metadata *SizeExpr) {
392 SizeExprCache[Ty] = SizeExpr;
393 }
394
395 /// Module debugging: Support for building PCMs.
396 /// @{
397 /// Set the main CU's DwoId field to \p Signature.
398 void setDwoId(uint64_t Signature);
399
400 /// When generating debug information for a clang module or
401 /// precompiled header, this module map will be used to determine
402 /// the module of origin of each Decl.
403 void setModuleMap(ModuleMap &MMap) { ClangModuleMap = &MMap; }
404
405 /// When generating debug information for a clang module or
406 /// precompiled header, this module map will be used to determine
407 /// the module of origin of each Decl.
408 void setPCHDescriptor(ASTSourceDescriptor PCH) { PCHDescriptor = PCH; }
409 /// @}
410
411 /// Update the current source location. If \arg loc is invalid it is
412 /// ignored.
413 void setLocation(SourceLocation Loc);
414
415 /// Return the current source location. This does not necessarily correspond
416 /// to the IRBuilder's current DebugLoc.
417 SourceLocation getLocation() const { return CurLoc; }
418
419 /// Update the current inline scope. All subsequent calls to \p EmitLocation
420 /// will create a location with this inlinedAt field.
421 void setInlinedAt(llvm::MDNode *InlinedAt) { CurInlinedAt = InlinedAt; }
422
423 /// \return the current inline scope.
424 llvm::MDNode *getInlinedAt() const { return CurInlinedAt; }
425
426 // Converts a SourceLocation to a DebugLoc
427 llvm::DebugLoc SourceLocToDebugLoc(SourceLocation Loc);
428
429 /// Emit metadata to indicate a change in line/column information in
430 /// the source file. If the location is invalid, the previous
431 /// location will be reused.
432 void EmitLocation(CGBuilderTy &Builder, SourceLocation Loc);
433
436
437 /// Emit a call to llvm.dbg.function.start to indicate
438 /// start of a new function.
439 /// \param Loc The location of the function header.
440 /// \param ScopeLoc The location of the function body.
442 SourceLocation ScopeLoc, QualType FnType,
443 llvm::Function *Fn, bool CurFnIsThunk);
444
445 /// Start a new scope for an inlined function.
447 /// End an inlined function scope.
448 void EmitInlineFunctionEnd(CGBuilderTy &Builder);
449
450 /// Emit debug info for a function declaration.
451 /// \p Fn is set only when a declaration for a debug call site gets created.
453 QualType FnType, llvm::Function *Fn = nullptr);
454
455 /// Emit debug info for an extern function being called.
456 /// This is needed for call site debug info.
457 void EmitFuncDeclForCallSite(llvm::CallBase *CallOrInvoke,
458 QualType CalleeType,
459 const FunctionDecl *CalleeDecl);
460
461 /// Constructs the debug code for exiting a function.
462 void EmitFunctionEnd(CGBuilderTy &Builder, llvm::Function *Fn);
463
464 /// Emit metadata to indicate the beginning of a new lexical block
465 /// and push the block onto the stack.
467
468 /// Emit metadata to indicate the end of a new lexical block and pop
469 /// the current block.
471
472 /// Emit call to \c llvm.dbg.declare for an automatic variable
473 /// declaration.
474 /// Returns a pointer to the DILocalVariable associated with the
475 /// llvm.dbg.declare, or nullptr otherwise.
476 llvm::DILocalVariable *
477 EmitDeclareOfAutoVariable(const VarDecl *Decl, llvm::Value *AI,
478 CGBuilderTy &Builder,
479 const bool UsePointerValue = false);
480
481 /// Emit call to \c llvm.dbg.label for an label.
482 void EmitLabel(const LabelDecl *D, CGBuilderTy &Builder);
483
484 /// Emit call to \c llvm.dbg.declare for an imported variable
485 /// declaration in a block.
487 const VarDecl *variable, llvm::Value *storage, CGBuilderTy &Builder,
488 const CGBlockInfo &blockInfo, llvm::Instruction *InsertPoint = nullptr);
489
490 /// Emit call to \c llvm.dbg.declare for an argument variable
491 /// declaration.
492 llvm::DILocalVariable *
493 EmitDeclareOfArgVariable(const VarDecl *Decl, llvm::Value *AI, unsigned ArgNo,
494 CGBuilderTy &Builder, bool UsePointerValue = false);
495
496 /// Emit call to \c llvm.dbg.declare for the block-literal argument
497 /// to a block invocation function.
499 StringRef Name, unsigned ArgNo,
500 llvm::AllocaInst *LocalAddr,
501 CGBuilderTy &Builder);
502
503 /// Emit information about a global variable.
504 void EmitGlobalVariable(llvm::GlobalVariable *GV, const VarDecl *Decl);
505
506 /// Emit a constant global variable's debug info.
507 void EmitGlobalVariable(const ValueDecl *VD, const APValue &Init);
508
509 /// Emit information about an external variable.
510 void EmitExternalVariable(llvm::GlobalVariable *GV, const VarDecl *Decl);
511
512 /// Emit information about global variable alias.
513 void EmitGlobalAlias(const llvm::GlobalValue *GV, const GlobalDecl Decl);
514
515 /// Emit C++ using directive.
517
518 /// Emit the type explicitly casted to.
520
521 /// Emit the type even if it might not be used.
523
524 /// Emit a shadow decl brought in by a using or using-enum
525 void EmitUsingShadowDecl(const UsingShadowDecl &USD);
526
527 /// Emit C++ using declaration.
528 void EmitUsingDecl(const UsingDecl &UD);
529
530 /// Emit C++ using-enum declaration.
531 void EmitUsingEnumDecl(const UsingEnumDecl &UD);
532
533 /// Emit an @import declaration.
534 void EmitImportDecl(const ImportDecl &ID);
535
536 /// DebugInfo isn't attached to string literals by default. While certain
537 /// aspects of debuginfo aren't useful for string literals (like a name), it's
538 /// nice to be able to symbolize the line and column information. This is
539 /// especially useful for sanitizers, as it allows symbolization of
540 /// heap-buffer-overflows on constant strings.
541 void AddStringLiteralDebugInfo(llvm::GlobalVariable *GV,
542 const StringLiteral *S);
543
544 /// Emit C++ namespace alias.
545 llvm::DIImportedEntity *EmitNamespaceAlias(const NamespaceAliasDecl &NA);
546
547 /// Emit record type's standalone debug info.
548 llvm::DIType *getOrCreateRecordType(QualType Ty, SourceLocation L);
549
550 /// Emit an Objective-C interface type standalone debug info.
551 llvm::DIType *getOrCreateInterfaceType(QualType Ty, SourceLocation Loc);
552
553 /// Emit standalone debug info for a type.
555
556 /// Add heapallocsite metadata for MSAllocator calls.
557 void addHeapAllocSiteMetadata(llvm::CallBase *CallSite, QualType AllocatedTy,
558 SourceLocation Loc);
559
560 void completeType(const EnumDecl *ED);
561 void completeType(const RecordDecl *RD);
562 void completeRequiredType(const RecordDecl *RD);
563 void completeClassData(const RecordDecl *RD);
564 void completeClass(const RecordDecl *RD);
565
567 void completeUnusedClass(const CXXRecordDecl &D);
568
569 /// Create debug info for a macro defined by a #define directive or a macro
570 /// undefined by a #undef directive.
571 llvm::DIMacro *CreateMacro(llvm::DIMacroFile *Parent, unsigned MType,
572 SourceLocation LineLoc, StringRef Name,
573 StringRef Value);
574
575 /// Create debug info for a file referenced by an #include directive.
576 llvm::DIMacroFile *CreateTempMacroFile(llvm::DIMacroFile *Parent,
577 SourceLocation LineLoc,
578 SourceLocation FileLoc);
579
580 Param2DILocTy &getParamDbgMappings() { return ParamDbgMappings; }
581 ParamDecl2StmtTy &getCoroutineParameterMappings() {
582 return CoroutineParameterMappings;
583 }
584
585private:
586 /// Emit call to llvm.dbg.declare for a variable declaration.
587 /// Returns a pointer to the DILocalVariable associated with the
588 /// llvm.dbg.declare, or nullptr otherwise.
589 llvm::DILocalVariable *EmitDeclare(const VarDecl *decl, llvm::Value *AI,
590 std::optional<unsigned> ArgNo,
591 CGBuilderTy &Builder,
592 const bool UsePointerValue = false);
593
594 /// Emit call to llvm.dbg.declare for a binding declaration.
595 /// Returns a pointer to the DILocalVariable associated with the
596 /// llvm.dbg.declare, or nullptr otherwise.
597 llvm::DILocalVariable *EmitDeclare(const BindingDecl *decl, llvm::Value *AI,
598 std::optional<unsigned> ArgNo,
599 CGBuilderTy &Builder,
600 const bool UsePointerValue = false);
601
602 struct BlockByRefType {
603 /// The wrapper struct used inside the __block_literal struct.
604 llvm::DIType *BlockByRefWrapper;
605 /// The type as it appears in the source code.
606 llvm::DIType *WrappedType;
607 };
608
609 std::string GetName(const Decl*, bool Qualified = false) const;
610
611 /// Build up structure info for the byref. See \a BuildByRefType.
612 BlockByRefType EmitTypeForVarWithBlocksAttr(const VarDecl *VD,
613 uint64_t *OffSet);
614
615 /// Get context info for the DeclContext of \p Decl.
616 llvm::DIScope *getDeclContextDescriptor(const Decl *D);
617 /// Get context info for a given DeclContext \p Decl.
618 llvm::DIScope *getContextDescriptor(const Decl *Context,
619 llvm::DIScope *Default);
620
621 llvm::DIScope *getCurrentContextDescriptor(const Decl *Decl);
622
623 /// Create a forward decl for a RecordType in a given context.
624 llvm::DICompositeType *getOrCreateRecordFwdDecl(const RecordType *,
625 llvm::DIScope *);
626
627 /// Return current directory name.
628 StringRef getCurrentDirname();
629
630 /// Create new compile unit.
631 void CreateCompileUnit();
632
633 /// Compute the file checksum debug info for input file ID.
634 std::optional<llvm::DIFile::ChecksumKind>
635 computeChecksum(FileID FID, SmallString<64> &Checksum) const;
636
637 /// Get the source of the given file ID.
638 std::optional<StringRef> getSource(const SourceManager &SM, FileID FID);
639
640 /// Convenience function to get the file debug info descriptor for the input
641 /// location.
642 llvm::DIFile *getOrCreateFile(SourceLocation Loc);
643
644 /// Create a file debug info descriptor for a source file.
645 llvm::DIFile *
646 createFile(StringRef FileName,
647 std::optional<llvm::DIFile::ChecksumInfo<StringRef>> CSInfo,
648 std::optional<StringRef> Source);
649
650 /// Get the type from the cache or create a new type if necessary.
651 llvm::DIType *getOrCreateType(QualType Ty, llvm::DIFile *Fg);
652
653 /// Get a reference to a clang module. If \p CreateSkeletonCU is true,
654 /// this also creates a split dwarf skeleton compile unit.
655 llvm::DIModule *getOrCreateModuleRef(ASTSourceDescriptor Mod,
656 bool CreateSkeletonCU);
657
658 /// DebugTypeExtRefs: If \p D originated in a clang module, return it.
659 llvm::DIModule *getParentModuleOrNull(const Decl *D);
660
661 /// Get the type from the cache or create a new partial type if
662 /// necessary.
663 llvm::DICompositeType *getOrCreateLimitedType(const RecordType *Ty);
664
665 /// Create type metadata for a source language type.
666 llvm::DIType *CreateTypeNode(QualType Ty, llvm::DIFile *Fg);
667
668 /// Create new member and increase Offset by FType's size.
669 llvm::DIType *CreateMemberType(llvm::DIFile *Unit, QualType FType,
670 StringRef Name, uint64_t *Offset);
671
672 /// Retrieve the DIDescriptor, if any, for the canonical form of this
673 /// declaration.
674 llvm::DINode *getDeclarationOrDefinition(const Decl *D);
675
676 /// \return debug info descriptor to describe method
677 /// declaration for the given method definition.
678 llvm::DISubprogram *getFunctionDeclaration(const Decl *D);
679
680 /// \return debug info descriptor to the describe method declaration
681 /// for the given method definition.
682 /// \param FnType For Objective-C methods, their type.
683 /// \param LineNo The declaration's line number.
684 /// \param Flags The DIFlags for the method declaration.
685 /// \param SPFlags The subprogram-spcific flags for the method declaration.
686 llvm::DISubprogram *
687 getObjCMethodDeclaration(const Decl *D, llvm::DISubroutineType *FnType,
688 unsigned LineNo, llvm::DINode::DIFlags Flags,
689 llvm::DISubprogram::DISPFlags SPFlags);
690
691 /// \return debug info descriptor to describe in-class static data
692 /// member declaration for the given out-of-class definition. If D
693 /// is an out-of-class definition of a static data member of a
694 /// class, find its corresponding in-class declaration.
695 llvm::DIDerivedType *
696 getOrCreateStaticDataMemberDeclarationOrNull(const VarDecl *D);
697
698 /// Helper that either creates a forward declaration or a stub.
699 llvm::DISubprogram *getFunctionFwdDeclOrStub(GlobalDecl GD, bool Stub);
700
701 /// Create a subprogram describing the forward declaration
702 /// represented in the given FunctionDecl wrapped in a GlobalDecl.
703 llvm::DISubprogram *getFunctionForwardDeclaration(GlobalDecl GD);
704
705 /// Create a DISubprogram describing the function
706 /// represented in the given FunctionDecl wrapped in a GlobalDecl.
707 llvm::DISubprogram *getFunctionStub(GlobalDecl GD);
708
709 /// Create a global variable describing the forward declaration
710 /// represented in the given VarDecl.
711 llvm::DIGlobalVariable *
712 getGlobalVariableForwardDeclaration(const VarDecl *VD);
713
714 /// Return a global variable that represents one of the collection of global
715 /// variables created for an anonmyous union.
716 ///
717 /// Recursively collect all of the member fields of a global
718 /// anonymous decl and create static variables for them. The first
719 /// time this is called it needs to be on a union and then from
720 /// there we can have additional unnamed fields.
721 llvm::DIGlobalVariableExpression *
722 CollectAnonRecordDecls(const RecordDecl *RD, llvm::DIFile *Unit,
723 unsigned LineNo, StringRef LinkageName,
724 llvm::GlobalVariable *Var, llvm::DIScope *DContext);
725
726
727 /// Return flags which enable debug info emission for call sites, provided
728 /// that it is supported and enabled.
729 llvm::DINode::DIFlags getCallSiteRelatedAttrs() const;
730
731 /// Get the printing policy for producing names for debug info.
732 PrintingPolicy getPrintingPolicy() const;
733
734 /// Get function name for the given FunctionDecl. If the name is
735 /// constructed on demand (e.g., C++ destructor) then the name is
736 /// stored on the side.
737 StringRef getFunctionName(const FunctionDecl *FD);
738
739 /// Returns the unmangled name of an Objective-C method.
740 /// This is the display name for the debugging info.
741 StringRef getObjCMethodName(const ObjCMethodDecl *FD);
742
743 /// Return selector name. This is used for debugging
744 /// info.
745 StringRef getSelectorName(Selector S);
746
747 /// Get class name including template argument list.
748 StringRef getClassName(const RecordDecl *RD);
749
750 /// Get the vtable name for the given class.
751 StringRef getVTableName(const CXXRecordDecl *Decl);
752
753 /// Get the name to use in the debug info for a dynamic initializer or atexit
754 /// stub function.
755 StringRef getDynamicInitializerName(const VarDecl *VD,
756 DynamicInitKind StubKind,
757 llvm::Function *InitFn);
758
759 /// Get line number for the location. If location is invalid
760 /// then use current location.
761 unsigned getLineNumber(SourceLocation Loc);
762
763 /// Get column number for the location. If location is
764 /// invalid then use current location.
765 /// \param Force Assume DebugColumnInfo option is true.
766 unsigned getColumnNumber(SourceLocation Loc, bool Force = false);
767
768 /// Collect various properties of a FunctionDecl.
769 /// \param GD A GlobalDecl whose getDecl() must return a FunctionDecl.
770 void collectFunctionDeclProps(GlobalDecl GD, llvm::DIFile *Unit,
771 StringRef &Name, StringRef &LinkageName,
772 llvm::DIScope *&FDContext,
773 llvm::DINodeArray &TParamsArray,
774 llvm::DINode::DIFlags &Flags);
775
776 /// Collect various properties of a VarDecl.
777 void collectVarDeclProps(const VarDecl *VD, llvm::DIFile *&Unit,
778 unsigned &LineNo, QualType &T, StringRef &Name,
779 StringRef &LinkageName,
780 llvm::MDTuple *&TemplateParameters,
781 llvm::DIScope *&VDContext);
782
783 /// Allocate a copy of \p A using the DebugInfoNames allocator
784 /// and return a reference to it. If multiple arguments are given the strings
785 /// are concatenated.
786 StringRef internString(StringRef A, StringRef B = StringRef()) {
787 char *Data = DebugInfoNames.Allocate<char>(A.size() + B.size());
788 if (!A.empty())
789 std::memcpy(Data, A.data(), A.size());
790 if (!B.empty())
791 std::memcpy(Data + A.size(), B.data(), B.size());
792 return StringRef(Data, A.size() + B.size());
793 }
794};
795
796/// A scoped helper to set the current debug location to the specified
797/// location or preferred location of the specified Expr.
799private:
800 void init(SourceLocation TemporaryLocation, bool DefaultToEmpty = false);
801 ApplyDebugLocation(CodeGenFunction &CGF, bool DefaultToEmpty,
802 SourceLocation TemporaryLocation);
803
804 llvm::DebugLoc OriginalLocation;
805 CodeGenFunction *CGF;
806
807public:
808 /// Set the location to the (valid) TemporaryLocation.
809 ApplyDebugLocation(CodeGenFunction &CGF, SourceLocation TemporaryLocation);
811 ApplyDebugLocation(CodeGenFunction &CGF, llvm::DebugLoc Loc);
812 ApplyDebugLocation(ApplyDebugLocation &&Other) : CGF(Other.CGF) {
813 Other.CGF = nullptr;
814 }
816
818
819 /// Apply TemporaryLocation if it is valid. Otherwise switch
820 /// to an artificial debug location that has a valid scope, but no
821 /// line information.
822 ///
823 /// Artificial locations are useful when emitting compiler-generated
824 /// helper functions that have no source location associated with
825 /// them. The DWARF specification allows the compiler to use the
826 /// special line number 0 to indicate code that can not be
827 /// attributed to any source location. Note that passing an empty
828 /// SourceLocation to CGDebugInfo::setLocation() will result in the
829 /// last valid location being reused.
831 return ApplyDebugLocation(CGF, false, SourceLocation());
832 }
833 /// Apply TemporaryLocation if it is valid. Otherwise switch
834 /// to an artificial debug location that has a valid scope, but no
835 /// line information.
836 static ApplyDebugLocation
838 SourceLocation TemporaryLocation) {
839 return ApplyDebugLocation(CGF, false, TemporaryLocation);
840 }
841
842 /// Set the IRBuilder to not attach debug locations. Note that
843 /// passing an empty SourceLocation to \a CGDebugInfo::setLocation()
844 /// will result in the last valid location being reused. Note that
845 /// all instructions that do not have a location at the beginning of
846 /// a function are counted towards to function prologue.
848 return ApplyDebugLocation(CGF, true, SourceLocation());
849 }
850};
851
852/// A scoped helper to set the current debug location to an inlined location.
854 SourceLocation SavedLocation;
855 CodeGenFunction *CGF;
856
857public:
858 /// Set up the CodeGenFunction's DebugInfo to produce inline locations for the
859 /// function \p InlinedFn. The current debug location becomes the inlined call
860 /// site of the inlined function.
862 /// Restore everything back to the original state.
864};
865
866} // namespace CodeGen
867} // namespace clang
868
869#endif // LLVM_CLANG_LIB_CODEGEN_CGDEBUGINFO_H
NodeId Parent
Definition: ASTDiff.cpp:191
MatchType Type
#define SM(sm)
Definition: Cuda.cpp:78
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
unsigned Offset
Definition: Format.cpp:2776
Defines the clang::Module class, which describes a module in the source code.
Defines the clang::SourceLocation class and associated facilities.
const char * Data
Allows QualTypes to be sorted and hence used in maps and sets.
TypePropertyCache< Private > Cache
Definition: Type.cpp:4013
C Language Family Type Representation.
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat],...
Definition: APValue.h:122
Abstracts clang modules and precompiled header files and holds everything needed to generate debug in...
Definition: Module.h:841
A binding in a decomposition declaration.
Definition: DeclCXX.h:4043
Represents a C++ struct/union/class.
Definition: DeclCXX.h:254
llvm::iterator_range< base_class_const_iterator > base_class_const_range
Definition: DeclCXX.h:600
Represents a class template specialization, which refers to a class template with a given set of temp...
A scoped helper to set the current debug location to the specified location or preferred location of ...
Definition: CGDebugInfo.h:798
static ApplyDebugLocation CreateArtificial(CodeGenFunction &CGF)
Apply TemporaryLocation if it is valid.
Definition: CGDebugInfo.h:830
static ApplyDebugLocation CreateDefaultArtificial(CodeGenFunction &CGF, SourceLocation TemporaryLocation)
Apply TemporaryLocation if it is valid.
Definition: CGDebugInfo.h:837
ApplyDebugLocation & operator=(ApplyDebugLocation &&)=default
ApplyDebugLocation(ApplyDebugLocation &&Other)
Definition: CGDebugInfo.h:812
static ApplyDebugLocation CreateEmpty(CodeGenFunction &CGF)
Set the IRBuilder to not attach debug locations.
Definition: CGDebugInfo.h:847
A scoped helper to set the current debug location to an inlined location.
Definition: CGDebugInfo.h:853
~ApplyInlineDebugLocation()
Restore everything back to the original state.
CGBlockInfo - Information to generate a block literal.
Definition: CGBlocks.h:156
This class gathers all debug information during compilation and is responsible for emitting to llvm g...
Definition: CGDebugInfo.h:55
llvm::MDNode * getInlinedAt() const
Definition: CGDebugInfo.h:424
llvm::DIType * getOrCreateStandaloneType(QualType Ty, SourceLocation Loc)
Emit standalone debug info for a type.
void EmitLocation(CGBuilderTy &Builder, SourceLocation Loc)
Emit metadata to indicate a change in line/column information in the source file.
void EmitGlobalAlias(const llvm::GlobalValue *GV, const GlobalDecl Decl)
Emit information about global variable alias.
void EmitLabel(const LabelDecl *D, CGBuilderTy &Builder)
Emit call to llvm.dbg.label for an label.
void EmitGlobalVariable(llvm::GlobalVariable *GV, const VarDecl *Decl)
Emit information about a global variable.
void setInlinedAt(llvm::MDNode *InlinedAt)
Update the current inline scope.
Definition: CGDebugInfo.h:421
void completeUnusedClass(const CXXRecordDecl &D)
SourceLocation getLocation() const
Return the current source location.
Definition: CGDebugInfo.h:417
void EmitUsingShadowDecl(const UsingShadowDecl &USD)
Emit a shadow decl brought in by a using or using-enum.
void EmitUsingEnumDecl(const UsingEnumDecl &UD)
Emit C++ using-enum declaration.
void EmitFunctionEnd(CGBuilderTy &Builder, llvm::Function *Fn)
Constructs the debug code for exiting a function.
void EmitFuncDeclForCallSite(llvm::CallBase *CallOrInvoke, QualType CalleeType, const FunctionDecl *CalleeDecl)
Emit debug info for an extern function being called.
void EmitUsingDecl(const UsingDecl &UD)
Emit C++ using declaration.
llvm::DIMacroFile * CreateTempMacroFile(llvm::DIMacroFile *Parent, SourceLocation LineLoc, SourceLocation FileLoc)
Create debug info for a file referenced by an #include directive.
void completeTemplateDefinition(const ClassTemplateSpecializationDecl &SD)
void EmitExternalVariable(llvm::GlobalVariable *GV, const VarDecl *Decl)
Emit information about an external variable.
Param2DILocTy & getParamDbgMappings()
Definition: CGDebugInfo.h:580
void emitFunctionStart(GlobalDecl GD, SourceLocation Loc, SourceLocation ScopeLoc, QualType FnType, llvm::Function *Fn, bool CurFnIsThunk)
Emit a call to llvm.dbg.function.start to indicate start of a new function.
llvm::DILocalVariable * EmitDeclareOfArgVariable(const VarDecl *Decl, llvm::Value *AI, unsigned ArgNo, CGBuilderTy &Builder, bool UsePointerValue=false)
Emit call to llvm.dbg.declare for an argument variable declaration.
void EmitLexicalBlockEnd(CGBuilderTy &Builder, SourceLocation Loc)
Emit metadata to indicate the end of a new lexical block and pop the current block.
void EmitUsingDirective(const UsingDirectiveDecl &UD)
Emit C++ using directive.
void completeRequiredType(const RecordDecl *RD)
void EmitAndRetainType(QualType Ty)
Emit the type even if it might not be used.
void EmitInlineFunctionEnd(CGBuilderTy &Builder)
End an inlined function scope.
ParamDecl2StmtTy & getCoroutineParameterMappings()
Definition: CGDebugInfo.h:581
void EmitFunctionDecl(GlobalDecl GD, SourceLocation Loc, QualType FnType, llvm::Function *Fn=nullptr)
Emit debug info for a function declaration.
void AddStringLiteralDebugInfo(llvm::GlobalVariable *GV, const StringLiteral *S)
DebugInfo isn't attached to string literals by default.
llvm::DILocalVariable * EmitDeclareOfAutoVariable(const VarDecl *Decl, llvm::Value *AI, CGBuilderTy &Builder, const bool UsePointerValue=false)
Emit call to llvm.dbg.declare for an automatic variable declaration.
void completeClassData(const RecordDecl *RD)
void EmitInlineFunctionStart(CGBuilderTy &Builder, GlobalDecl GD)
Start a new scope for an inlined function.
void setModuleMap(ModuleMap &MMap)
When generating debug information for a clang module or precompiled header, this module map will be u...
Definition: CGDebugInfo.h:403
void EmitImportDecl(const ImportDecl &ID)
Emit an @import declaration.
void EmitDeclareOfBlockLiteralArgVariable(const CGBlockInfo &block, StringRef Name, unsigned ArgNo, llvm::AllocaInst *LocalAddr, CGBuilderTy &Builder)
Emit call to llvm.dbg.declare for the block-literal argument to a block invocation function.
llvm::DebugLoc SourceLocToDebugLoc(SourceLocation Loc)
CGDebugInfo(CodeGenModule &CGM)
Definition: CGDebugInfo.cpp:71
void completeClass(const RecordDecl *RD)
void EmitLexicalBlockStart(CGBuilderTy &Builder, SourceLocation Loc)
Emit metadata to indicate the beginning of a new lexical block and push the block onto the stack.
friend class SaveAndRestoreLocation
Definition: CGDebugInfo.h:57
void setLocation(SourceLocation Loc)
Update the current source location.
llvm::DIMacro * CreateMacro(llvm::DIMacroFile *Parent, unsigned MType, SourceLocation LineLoc, StringRef Name, StringRef Value)
Create debug info for a macro defined by a #define directive or a macro undefined by a #undef directi...
llvm::DIType * getOrCreateRecordType(QualType Ty, SourceLocation L)
Emit record type's standalone debug info.
std::string remapDIPath(StringRef) const
Remap a given path with the current debug prefix map.
void EmitExplicitCastType(QualType Ty)
Emit the type explicitly casted to.
void addHeapAllocSiteMetadata(llvm::CallBase *CallSite, QualType AllocatedTy, SourceLocation Loc)
Add heapallocsite metadata for MSAllocator calls.
void setDwoId(uint64_t Signature)
Module debugging: Support for building PCMs.
QualType getFunctionType(const FunctionDecl *FD, QualType RetTy, const SmallVectorImpl< const VarDecl * > &Args)
llvm::DIType * getOrCreateInterfaceType(QualType Ty, SourceLocation Loc)
Emit an Objective-C interface type standalone debug info.
void setPCHDescriptor(ASTSourceDescriptor PCH)
When generating debug information for a clang module or precompiled header, this module map will be u...
Definition: CGDebugInfo.h:408
void completeType(const EnumDecl *ED)
void registerVLASizeExpression(QualType Ty, llvm::Metadata *SizeExpr)
Register VLA size expression debug node with the qualified type.
Definition: CGDebugInfo.h:391
void EmitDeclareOfBlockDeclRefVariable(const VarDecl *variable, llvm::Value *storage, CGBuilderTy &Builder, const CGBlockInfo &blockInfo, llvm::Instruction *InsertPoint=nullptr)
Emit call to llvm.dbg.declare for an imported variable declaration in a block.
llvm::DIImportedEntity * EmitNamespaceAlias(const NamespaceAliasDecl &NA)
Emit C++ namespace alias.
CodeGenFunction - This class organizes the per-function state that is used while generating LLVM code...
This class organizes the cross-function state that is used while generating LLVM code.
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:83
Represents an enum.
Definition: Decl.h:3720
This represents one expression.
Definition: Expr.h:110
An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...
Represents a function declaration or definition.
Definition: Decl.h:1917
GlobalDecl - represents a global declaration.
Definition: GlobalDecl.h:56
Describes a module import declaration, which makes the contents of the named module visible in the cu...
Definition: Decl.h:4639
Represents the declaration of a label.
Definition: Decl.h:494
Represents a C++ namespace alias.
Definition: DeclCXX.h:3057
ObjCMethodDecl - Represents an instance or class method declaration.
Definition: DeclObjC.h:138
Callbacks to use to customize the behavior of the pretty-printer.
Definition: PrettyPrinter.h:32
A (possibly-)qualified type.
Definition: Type.h:736
Represents a struct/union/class.
Definition: Decl.h:3998
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
Definition: Type.h:4835
Smart pointer class that efficiently represents Objective-C method names.
Encodes a location in the source.
This class handles loading and caching of source files into memory.
StringLiteral - This represents a string literal expression, e.g.
Definition: Expr.h:1781
Represents a C++ using-declaration.
Definition: DeclCXX.h:3449
Represents C++ using-directive.
Definition: DeclCXX.h:2952
Represents a C++ using-enum-declaration.
Definition: DeclCXX.h:3649
Represents a shadow declaration implicitly introduced into a scope by a (resolved) using-declaration ...
Definition: DeclCXX.h:3257
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Definition: Decl.h:701
Represents a variable declaration or definition.
Definition: Decl.h:913
@ Type
The l-value was considered opaque, so the alignment was determined from a type.
@ Decl
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
const internal::VariadicAllOfMatcher< Decl > decl
Matches declarations.
DynamicInitKind
Definition: GlobalDecl.h:32
@ PCH
Disable validation for a precompiled header and the modules it depends on.
AccessSpecifier
A C++ access specifier (public, private, protected), plus the special value "none" which means differ...
Definition: Specifiers.h:111
unsigned long uint64_t
YAML serialization mapping.
Definition: Dominators.h:30
Describes how types, statements, expressions, and declarations should be printed.
Definition: PrettyPrinter.h:57