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 "SanitizerHandler.h"
18#include "clang/AST/DeclCXX.h"
19#include "clang/AST/Expr.h"
20#include "clang/AST/ExternalASTSource.h"
21#include "clang/AST/PrettyPrinter.h"
22#include "clang/AST/Type.h"
23#include "clang/AST/TypeOrdering.h"
24#include "clang/Basic/ASTSourceDescriptor.h"
25#include "clang/Basic/CodeGenOptions.h"
26#include "clang/Basic/SourceLocation.h"
27#include "llvm/ADT/DenseMap.h"
28#include "llvm/ADT/DenseSet.h"
29#include "llvm/IR/DIBuilder.h"
30#include "llvm/IR/DebugInfo.h"
31#include "llvm/IR/ValueHandle.h"
32#include "llvm/Support/Allocator.h"
33#include <map>
34#include <optional>
35#include <string>
36
37namespace llvm {
38class MDNode;
39}
40
41namespace clang {
42class ClassTemplateSpecializationDecl;
43class GlobalDecl;
44class Module;
45class ModuleMap;
46class ObjCInterfaceDecl;
47class UsingDecl;
48class VarDecl;
49enum class DynamicInitKind : unsigned;
50
51namespace CodeGen {
52class CodeGenModule;
53class CodeGenFunction;
54class CGBlockInfo;
55
56/// This class gathers all debug information during compilation and is
57/// responsible for emitting to llvm globals or pass directly to the
58/// backend.
59class CGDebugInfo {
60 friend class ApplyDebugLocation;
61 friend class SaveAndRestoreLocation;
62 friend class ApplyAtomGroup;
63
64 CodeGenModule &CGM;
65 const llvm::codegenoptions::DebugInfoKind DebugKind;
66 bool DebugTypeExtRefs;
67 llvm::DIBuilder DBuilder;
68 llvm::DICompileUnit *TheCU = nullptr;
69 ModuleMap *ClangModuleMap = nullptr;
70 ASTSourceDescriptor PCHDescriptor;
71 SourceLocation CurLoc;
72 llvm::DIFile *CurLocFile = nullptr;
73 unsigned CurLocLine = 0;
74 unsigned CurLocColumn = 0;
75 llvm::DILocation *CurInlinedAt = nullptr;
76 llvm::DIType *VTablePtrType = nullptr;
77 llvm::DIType *ClassTy = nullptr;
78 llvm::DICompositeType *ObjTy = nullptr;
79 llvm::DIType *SelTy = nullptr;
80#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
81 llvm::DIType *SingletonId = nullptr;
82#include "clang/Basic/OpenCLImageTypes.def"
83 llvm::DIType *OCLSamplerDITy = nullptr;
84 llvm::DIType *OCLEventDITy = nullptr;
85 llvm::DIType *OCLClkEventDITy = nullptr;
86 llvm::DIType *OCLQueueDITy = nullptr;
87 llvm::DIType *OCLNDRangeDITy = nullptr;
88 llvm::DIType *OCLReserveIDDITy = nullptr;
89#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
90 llvm::DIType *Id##Ty = nullptr;
91#include "clang/Basic/OpenCLExtensionTypes.def"
92#define WASM_TYPE(Name, Id, SingletonId) llvm::DIType *SingletonId = nullptr;
93#include "clang/Basic/WebAssemblyReferenceTypes.def"
94#define AMDGPU_TYPE(Name, Id, SingletonId, Width, Align) \
95 llvm::DIType *SingletonId = nullptr;
96#include "clang/Basic/AMDGPUTypes.def"
97#define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) \
98 llvm::DIType *SingletonId = nullptr;
99#include "clang/Basic/HLSLIntangibleTypes.def"
100
101 /// Cache of previously constructed Types.
102 llvm::DenseMap<const void *, llvm::TrackingMDRef> TypeCache;
103
104 /// Cache that maps VLA types to size expressions for that type,
105 /// represented by instantiated Metadata nodes.
106 llvm::SmallDenseMap<QualType, llvm::Metadata *> SizeExprCache;
107
108 /// Callbacks to use when printing names and types.
109 class PrintingCallbacks final : public clang::PrintingCallbacks {
110 const CGDebugInfo &Self;
111
112 public:
113 PrintingCallbacks(const CGDebugInfo &Self) : Self(Self) {}
114 std::string remapPath(StringRef Path) const override {
115 return Self.remapDIPath(Path);
116 }
117 };
118 PrintingCallbacks PrintCB = {*this};
119
120 struct ObjCInterfaceCacheEntry {
121 const ObjCInterfaceType *Type;
122 llvm::DIType *Decl;
123 llvm::DIFile *Unit;
124 ObjCInterfaceCacheEntry(const ObjCInterfaceType *Type, llvm::DIType *Decl,
125 llvm::DIFile *Unit)
126 : Type(Type), Decl(Decl), Unit(Unit) {}
127 };
128
129 /// Cache of previously constructed interfaces which may change.
130 llvm::SmallVector<ObjCInterfaceCacheEntry, 32> ObjCInterfaceCache;
131
132 /// Cache of forward declarations for methods belonging to the interface.
133 /// The extra bit on the DISubprogram specifies whether a method is
134 /// "objc_direct".
135 llvm::DenseMap<const ObjCInterfaceDecl *,
136 std::vector<llvm::PointerIntPair<llvm::DISubprogram *, 1>>>
137 ObjCMethodCache;
138
139 /// Cache of references to clang modules and precompiled headers.
140 llvm::DenseMap<const Module *, llvm::TrackingMDRef> ModuleCache;
141
142 /// List of interfaces we want to keep even if orphaned.
143 std::vector<void *> RetainedTypes;
144
145 /// Cache of forward declared types to RAUW at the end of compilation.
146 std::vector<std::pair<const TagType *, llvm::TrackingMDRef>> ReplaceMap;
147
148 /// Cache of replaceable forward declarations (functions and
149 /// variables) to RAUW at the end of compilation.
150 std::vector<std::pair<const DeclaratorDecl *, llvm::TrackingMDRef>>
151 FwdDeclReplaceMap;
152
153 /// Keep track of our current nested lexical block.
154 std::vector<llvm::TypedTrackingMDRef<llvm::DIScope>> LexicalBlockStack;
155 llvm::DenseMap<const Decl *, llvm::TrackingMDRef> RegionMap;
156 /// Keep track of LexicalBlockStack counter at the beginning of a
157 /// function. This is used to pop unbalanced regions at the end of a
158 /// function.
159 std::vector<unsigned> FnBeginRegionCount;
160
161 /// This is a storage for names that are constructed on demand. For
162 /// example, C++ destructors, C++ operators etc..
163 llvm::BumpPtrAllocator DebugInfoNames;
164
165 llvm::DenseMap<const char *, llvm::TrackingMDRef> DIFileCache;
166 llvm::DenseMap<const FunctionDecl *, llvm::TrackingMDRef> SPCache;
167 /// Cache declarations relevant to DW_TAG_imported_declarations (C++
168 /// using declarations and global alias variables) that aren't covered
169 /// by other more specific caches.
170 llvm::DenseMap<const Decl *, llvm::TrackingMDRef> DeclCache;
171 llvm::DenseMap<const Decl *, llvm::TrackingMDRef> ImportedDeclCache;
172 llvm::DenseMap<const NamespaceDecl *, llvm::TrackingMDRef> NamespaceCache;
173 llvm::DenseMap<const NamespaceAliasDecl *, llvm::TrackingMDRef>
174 NamespaceAliasCache;
175 llvm::DenseMap<const Decl *, llvm::TypedTrackingMDRef<llvm::DIDerivedType>>
176 StaticDataMemberCache;
177
178 using ParamDecl2StmtTy = llvm::DenseMap<const ParmVarDecl *, const Stmt *>;
179 using Param2DILocTy =
180 llvm::DenseMap<const ParmVarDecl *, llvm::DILocalVariable *>;
181
182 /// The key is coroutine real parameters, value is coroutine move parameters.
183 ParamDecl2StmtTy CoroutineParameterMappings;
184 /// The key is coroutine real parameters, value is DIVariable in LLVM IR.
185 Param2DILocTy ParamDbgMappings;
186
187 /// Key Instructions bookkeeping.
188 /// Source atoms are identified by a {AtomGroup, InlinedAt} pair, meaning
189 /// AtomGroup numbers can be repeated across different functions.
190 struct {
191 uint64_t NextAtom = 1;
192 uint64_t HighestEmittedAtom = 0;
193 uint64_t CurrentAtom = 0;
194 } KeyInstructionsInfo;
195
196private:
197 /// Helper functions for getOrCreateType.
198 /// @{
199 /// Currently the checksum of an interface includes the number of
200 /// ivars and property accessors.
201 llvm::DIType *CreateType(const BuiltinType *Ty);
202 llvm::DIType *CreateType(const ComplexType *Ty);
203 llvm::DIType *CreateType(const BitIntType *Ty);
204 llvm::DIType *CreateType(const OverflowBehaviorType *Ty, llvm::DIFile *U);
205 llvm::DIType *CreateQualifiedType(QualType Ty, llvm::DIFile *Fg);
206 llvm::DIType *CreateQualifiedType(const FunctionProtoType *Ty,
207 llvm::DIFile *Fg);
208 llvm::DIType *CreateType(const TypedefType *Ty, llvm::DIFile *Fg);
209 llvm::DIType *CreateType(const TemplateSpecializationType *Ty,
210 llvm::DIFile *Fg);
211 llvm::DIType *CreateType(const ObjCObjectPointerType *Ty, llvm::DIFile *F);
212 llvm::DIType *CreateType(const PointerType *Ty, llvm::DIFile *F);
213 llvm::DIType *CreateType(const BlockPointerType *Ty, llvm::DIFile *F);
214 llvm::DIType *CreateType(const FunctionType *Ty, llvm::DIFile *F);
215 llvm::DIType *CreateType(const HLSLAttributedResourceType *Ty,
216 llvm::DIFile *F);
217 llvm::DIType *CreateType(const HLSLInlineSpirvType *Ty, llvm::DIFile *F);
218 /// Get structure or union type.
219 llvm::DIType *CreateType(const RecordType *Tyg);
220
221 /// Create definition for the specified 'Ty'.
222 ///
223 /// \returns A pair of 'llvm::DIType's. The first is the definition
224 /// of the 'Ty'. The second is the type specified by the preferred_name
225 /// attribute on 'Ty', which can be a nullptr if no such attribute
226 /// exists.
227 std::pair<llvm::DIType *, llvm::DIType *>
228 CreateTypeDefinition(const RecordType *Ty);
229 llvm::DICompositeType *CreateLimitedType(const RecordType *Ty);
230 void CollectContainingType(const CXXRecordDecl *RD,
231 llvm::DICompositeType *CT);
232 /// Get Objective-C interface type.
233 llvm::DIType *CreateType(const ObjCInterfaceType *Ty, llvm::DIFile *F);
234 llvm::DIType *CreateTypeDefinition(const ObjCInterfaceType *Ty,
235 llvm::DIFile *F);
236 /// Get Objective-C object type.
237 llvm::DIType *CreateType(const ObjCObjectType *Ty, llvm::DIFile *F);
238 llvm::DIType *CreateType(const ObjCTypeParamType *Ty, llvm::DIFile *Unit);
239
240 llvm::DIType *CreateType(const VectorType *Ty, llvm::DIFile *F);
241 llvm::DIType *CreateType(const ConstantMatrixType *Ty, llvm::DIFile *F);
242 llvm::DIType *CreateType(const ArrayType *Ty, llvm::DIFile *F);
243 llvm::DIType *CreateType(const LValueReferenceType *Ty, llvm::DIFile *F);
244 llvm::DIType *CreateType(const RValueReferenceType *Ty, llvm::DIFile *Unit);
245 llvm::DIType *CreateType(const MemberPointerType *Ty, llvm::DIFile *F);
246 llvm::DIType *CreateType(const AtomicType *Ty, llvm::DIFile *F);
247 llvm::DIType *CreateType(const PipeType *Ty, llvm::DIFile *F);
248 /// Get enumeration type.
249 llvm::DIType *CreateEnumType(const EnumType *Ty);
250 llvm::DIType *CreateTypeDefinition(const EnumType *Ty);
251 /// Look up the completed type for a self pointer in the TypeCache and
252 /// create a copy of it with the ObjectPointer and Artificial flags
253 /// set. If the type is not cached, a new one is created. This should
254 /// never happen though, since creating a type for the implicit self
255 /// argument implies that we already parsed the interface definition
256 /// and the ivar declarations in the implementation.
257 llvm::DIType *CreateSelfType(const QualType &QualTy, llvm::DIType *Ty);
258 /// @}
259
260 /// Get the type from the cache or return null type if it doesn't
261 /// exist.
262 llvm::DIType *getTypeOrNull(const QualType);
263 /// Return the debug type for a C++ method.
264 /// \arg CXXMethodDecl is of FunctionType. This function type is
265 /// not updated to include implicit \c this pointer. Use this routine
266 /// to get a method type which includes \c this pointer.
267 llvm::DISubroutineType *getOrCreateMethodType(const CXXMethodDecl *Method,
268 llvm::DIFile *F);
269
270 llvm::DISubroutineType *
271 getOrCreateMethodTypeForDestructor(const CXXMethodDecl *Method,
272 llvm::DIFile *F, QualType FNType);
273
274 llvm::DISubroutineType *
275 getOrCreateInstanceMethodType(QualType ThisPtr, const FunctionProtoType *Func,
276 llvm::DIFile *Unit, bool SkipFirst = false);
277 llvm::DISubroutineType *
278 getOrCreateFunctionType(const Decl *D, QualType FnType, llvm::DIFile *F);
279 /// \return debug info descriptor for vtable.
280 llvm::DIType *getOrCreateVTablePtrType(llvm::DIFile *F);
281
282 /// \return namespace descriptor for the given namespace decl.
283 llvm::DINamespace *getOrCreateNamespace(const NamespaceDecl *N);
284 llvm::DIType *CreatePointerLikeType(llvm::dwarf::Tag Tag, const Type *Ty,
285 QualType PointeeTy, llvm::DIFile *F);
286 llvm::DIType *getOrCreateStructPtrType(StringRef Name, llvm::DIType *&Cache);
287
288 /// A helper function to create a subprogram for a single member
289 /// function GlobalDecl.
290 llvm::DISubprogram *CreateCXXMemberFunction(const CXXMethodDecl *Method,
291 llvm::DIFile *F,
292 llvm::DIType *RecordTy);
293
294 /// A helper function to collect debug info for C++ member
295 /// functions. This is used while creating debug info entry for a
296 /// Record.
297 void CollectCXXMemberFunctions(const CXXRecordDecl *Decl, llvm::DIFile *F,
298 SmallVectorImpl<llvm::Metadata *> &E,
299 llvm::DIType *T);
300
301 /// A helper function to collect debug info for C++ base
302 /// classes. This is used while creating debug info entry for a
303 /// Record.
304 void CollectCXXBases(const CXXRecordDecl *Decl, llvm::DIFile *F,
305 SmallVectorImpl<llvm::Metadata *> &EltTys,
306 llvm::DIType *RecordTy);
307
308 /// Helper function for CollectCXXBases.
309 /// Adds debug info entries for types in Bases that are not in SeenTypes.
310 void CollectCXXBasesAux(
311 const CXXRecordDecl *RD, llvm::DIFile *Unit,
312 SmallVectorImpl<llvm::Metadata *> &EltTys, llvm::DIType *RecordTy,
313 const CXXRecordDecl::base_class_const_range &Bases,
314 llvm::DenseSet<CanonicalDeclPtr<const CXXRecordDecl>> &SeenTypes,
315 llvm::DINode::DIFlags StartingFlags);
316
317 /// Helper function that returns the llvm::DIType that the
318 /// PreferredNameAttr attribute on \ref RD refers to. If no such
319 /// attribute exists, returns nullptr.
320 llvm::DIType *GetPreferredNameType(const CXXRecordDecl *RD,
321 llvm::DIFile *Unit);
322
323 struct TemplateArgs {
324 const TemplateParameterList *TList;
325 llvm::ArrayRef<TemplateArgument> Args;
326 };
327 /// A helper function to collect template parameters.
328 llvm::DINodeArray CollectTemplateParams(std::optional<TemplateArgs> Args,
329 llvm::DIFile *Unit);
330 /// A helper function to collect debug info for function template
331 /// parameters.
332 llvm::DINodeArray CollectFunctionTemplateParams(const FunctionDecl *FD,
333 llvm::DIFile *Unit);
334
335 /// A helper function to collect debug info for function template
336 /// parameters.
337 llvm::DINodeArray CollectVarTemplateParams(const VarDecl *VD,
338 llvm::DIFile *Unit);
339
340 std::optional<TemplateArgs> GetTemplateArgs(const VarDecl *) const;
341 std::optional<TemplateArgs> GetTemplateArgs(const RecordDecl *) const;
342 std::optional<TemplateArgs> GetTemplateArgs(const FunctionDecl *) const;
343
344 /// A helper function to collect debug info for template
345 /// parameters.
346 llvm::DINodeArray CollectCXXTemplateParams(const RecordDecl *TS,
347 llvm::DIFile *F);
348
349 /// A helper function to collect debug info for btf_decl_tag annotations.
350 llvm::DINodeArray CollectBTFDeclTagAnnotations(const Decl *D);
351
352 /// A helper function to collect debug info for btf_decl_tag annotations and
353 /// append them to Annotations.
354 void
355 CollectBTFDeclTagAnnotations(const Decl *D,
356 SmallVectorImpl<llvm::Metadata *> &Annotations);
357
358 /// A helper function to collect debug info for btf_type_tag annotations and
359 /// append them to Annotations.
360 void
361 CollectBTFTypeTagAnnotations(QualType Ty,
362 SmallVectorImpl<llvm::Metadata *> &Annotations);
363
364 llvm::DIType *createFieldType(StringRef name, QualType type,
365 SourceLocation loc, AccessSpecifier AS,
366 uint64_t offsetInBits, uint32_t AlignInBits,
367 llvm::DIFile *tunit, llvm::DIScope *scope,
368 const RecordDecl *RD = nullptr,
369 llvm::DINodeArray Annotations = nullptr);
370
371 llvm::DIType *createFieldType(StringRef name, QualType type,
372 SourceLocation loc, AccessSpecifier AS,
373 uint64_t offsetInBits, llvm::DIFile *tunit,
374 llvm::DIScope *scope,
375 const RecordDecl *RD = nullptr) {
376 return createFieldType(name, type, loc, AS, offsetInBits, AlignInBits: 0, tunit, scope,
377 RD);
378 }
379
380 /// Create new bit field member.
381 llvm::DIDerivedType *createBitFieldType(const FieldDecl *BitFieldDecl,
382 llvm::DIScope *RecordTy,
383 const RecordDecl *RD);
384
385 /// Create an anonnymous zero-size separator for bit-field-decl if needed on
386 /// the target.
387 llvm::DIDerivedType *createBitFieldSeparatorIfNeeded(
388 const FieldDecl *BitFieldDecl, const llvm::DIDerivedType *BitFieldDI,
389 llvm::ArrayRef<llvm::Metadata *> PreviousFieldsDI, const RecordDecl *RD);
390
391 /// A cache that maps names of artificial inlined functions to subprograms.
392 llvm::StringMap<llvm::DISubprogram *> InlinedSubprogramMap;
393
394 /// A function that returns the subprogram corresponding to the artificial
395 /// inlined function for traps.
396 llvm::DISubprogram *createInlinedSubprogram(StringRef FuncName,
397 llvm::DIFile *FileScope);
398
399 /// Helpers for collecting fields of a record.
400 /// @{
401 void CollectRecordLambdaFields(const CXXRecordDecl *CXXDecl,
402 SmallVectorImpl<llvm::Metadata *> &E,
403 llvm::DIType *RecordTy);
404 llvm::DIDerivedType *CreateRecordStaticField(const VarDecl *Var,
405 llvm::DIType *RecordTy,
406 const RecordDecl *RD);
407 void CollectRecordNormalField(const FieldDecl *Field, uint64_t OffsetInBits,
408 llvm::DIFile *F,
409 SmallVectorImpl<llvm::Metadata *> &E,
410 llvm::DIType *RecordTy, const RecordDecl *RD);
411 void CollectRecordNestedType(const TypeDecl *RD,
412 SmallVectorImpl<llvm::Metadata *> &E);
413 void CollectRecordFields(const RecordDecl *Decl, llvm::DIFile *F,
414 SmallVectorImpl<llvm::Metadata *> &E,
415 llvm::DICompositeType *RecordTy);
416 llvm::StringRef GetLambdaCaptureName(const LambdaCapture &Capture);
417
418 /// If the C++ class has vtable info then insert appropriate debug
419 /// info entry in EltTys vector.
420 void CollectVTableInfo(const CXXRecordDecl *Decl, llvm::DIFile *F,
421 SmallVectorImpl<llvm::Metadata *> &EltTys);
422 /// @}
423
424 /// Create a new lexical block node and push it on the stack.
425 void CreateLexicalBlock(SourceLocation Loc);
426
427 /// If target-specific LLVM \p AddressSpace directly maps to target-specific
428 /// DWARF address space, appends extended dereferencing mechanism to complex
429 /// expression \p Expr. Otherwise, does nothing.
430 ///
431 /// Extended dereferencing mechanism is has the following format:
432 /// DW_OP_constu <DWARF Address Space> DW_OP_swap DW_OP_xderef
433 void AppendAddressSpaceXDeref(unsigned AddressSpace,
434 SmallVectorImpl<uint64_t> &Expr) const;
435
436 /// A helper function to collect debug info for the default elements of a
437 /// block.
438 ///
439 /// \returns The next available field offset after the default elements.
440 uint64_t collectDefaultElementTypesForBlockPointer(
441 const BlockPointerType *Ty, llvm::DIFile *Unit,
442 llvm::DIDerivedType *DescTy, unsigned LineNo,
443 SmallVectorImpl<llvm::Metadata *> &EltTys);
444
445 /// A helper function to collect debug info for the default fields of a
446 /// block.
447 void collectDefaultFieldsForBlockLiteralDeclare(
448 const CGBlockInfo &Block, const ASTContext &Context, SourceLocation Loc,
449 const llvm::StructLayout &BlockLayout, llvm::DIFile *Unit,
450 SmallVectorImpl<llvm::Metadata *> &Fields);
451
452public:
453 CGDebugInfo(CodeGenModule &CGM);
454 ~CGDebugInfo();
455
456 void finalize();
457
458 /// Remap a given path with the current debug prefix map
459 std::string remapDIPath(StringRef) const;
460
461 /// Register VLA size expression debug node with the qualified type.
462 void registerVLASizeExpression(QualType Ty, llvm::Metadata *SizeExpr) {
463 SizeExprCache[Ty] = SizeExpr;
464 }
465
466 /// Module debugging: Support for building PCMs.
467 /// @{
468 /// Set the main CU's DwoId field to \p Signature.
469 void setDwoId(uint64_t Signature);
470
471 /// When generating debug information for a clang module or
472 /// precompiled header, this module map will be used to determine
473 /// the module of origin of each Decl.
474 void setModuleMap(ModuleMap &MMap) { ClangModuleMap = &MMap; }
475
476 /// When generating debug information for a clang module or
477 /// precompiled header, this module map will be used to determine
478 /// the module of origin of each Decl.
479 void setPCHDescriptor(ASTSourceDescriptor PCH) { PCHDescriptor = PCH; }
480 /// @}
481
482 /// Update the current source location. If \arg loc is invalid it is
483 /// ignored.
484 void setLocation(SourceLocation Loc);
485
486 /// Return the current source location. This does not necessarily correspond
487 /// to the IRBuilder's current DebugLoc.
488 SourceLocation getLocation() const { return CurLoc; }
489
490 /// Update the current inline scope. All subsequent calls to \p EmitLocation
491 /// will create a location with this inlinedAt field.
492 void setInlinedAt(llvm::DILocation *InlinedAt) { CurInlinedAt = InlinedAt; }
493
494 /// \return the current inline scope.
495 llvm::DILocation *getInlinedAt() const { return CurInlinedAt; }
496
497 // Converts a SourceLocation to a DebugLoc
498 llvm::DebugLoc SourceLocToDebugLoc(SourceLocation Loc);
499
500 /// Emit metadata to indicate a change in line/column information in
501 /// the source file. If the location is invalid, the previous
502 /// location will be reused.
503 void EmitLocation(CGBuilderTy &Builder, SourceLocation Loc);
504
505 QualType getFunctionType(const FunctionDecl *FD, QualType RetTy,
506 const SmallVectorImpl<const VarDecl *> &Args);
507
508 /// Emit a call to llvm.dbg.function.start to indicate
509 /// start of a new function.
510 /// \param Loc The location of the function header.
511 /// \param ScopeLoc The location of the function body.
512 void emitFunctionStart(GlobalDecl GD, SourceLocation Loc,
513 SourceLocation ScopeLoc, QualType FnType,
514 llvm::Function *Fn, bool CurFnIsThunk);
515
516 /// Start a new scope for an inlined function.
517 void EmitInlineFunctionStart(CGBuilderTy &Builder, GlobalDecl GD);
518 /// End an inlined function scope.
519 void EmitInlineFunctionEnd(CGBuilderTy &Builder);
520
521 /// Emit debug info for a function declaration.
522 /// \p Fn is set only when a declaration for a debug call site gets created.
523 void EmitFunctionDecl(GlobalDecl GD, SourceLocation Loc,
524 QualType FnType, llvm::Function *Fn = nullptr);
525
526 /// Emit debug info for an extern function being called.
527 /// This is needed for call site debug info.
528 void EmitFuncDeclForCallSite(llvm::CallBase *CallOrInvoke,
529 QualType CalleeType,
530 GlobalDecl CalleeGlobalDecl);
531
532 /// Constructs the debug code for exiting a function.
533 void EmitFunctionEnd(CGBuilderTy &Builder, llvm::Function *Fn);
534
535 /// Emit metadata to indicate the beginning of a new lexical block
536 /// and push the block onto the stack.
537 void EmitLexicalBlockStart(CGBuilderTy &Builder, SourceLocation Loc);
538
539 /// Emit metadata to indicate the end of a new lexical block and pop
540 /// the current block.
541 void EmitLexicalBlockEnd(CGBuilderTy &Builder, SourceLocation Loc);
542
543 /// Emit call to \c llvm.dbg.declare for an automatic variable
544 /// declaration.
545 /// Returns a pointer to the DILocalVariable associated with the
546 /// llvm.dbg.declare, or nullptr otherwise.
547 llvm::DILocalVariable *
548 EmitDeclareOfAutoVariable(const VarDecl *Decl, llvm::Value *AI,
549 CGBuilderTy &Builder,
550 const bool UsePointerValue = false);
551
552 /// Emit call to \c llvm.dbg.label for an label.
553 void EmitLabel(const LabelDecl *D, CGBuilderTy &Builder);
554
555 /// Emit call to \c llvm.dbg.declare for an imported variable
556 /// declaration in a block.
557 void EmitDeclareOfBlockDeclRefVariable(
558 const VarDecl *variable, llvm::Value *storage, CGBuilderTy &Builder,
559 const CGBlockInfo &blockInfo, llvm::Instruction *InsertPoint = nullptr);
560
561 /// Emit call to \c llvm.dbg.declare for an argument variable
562 /// declaration.
563 llvm::DILocalVariable *
564 EmitDeclareOfArgVariable(const VarDecl *Decl, llvm::Value *AI, unsigned ArgNo,
565 CGBuilderTy &Builder, bool UsePointerValue = false);
566
567 /// Emit call to \c llvm.dbg.declare for the block-literal argument
568 /// to a block invocation function.
569 void EmitDeclareOfBlockLiteralArgVariable(const CGBlockInfo &block,
570 StringRef Name, unsigned ArgNo,
571 llvm::AllocaInst *LocalAddr,
572 CGBuilderTy &Builder);
573
574 /// Emit information about a global variable.
575 void EmitGlobalVariable(llvm::GlobalVariable *GV, const VarDecl *Decl);
576
577 /// Emit a constant global variable's debug info.
578 void EmitGlobalVariable(const ValueDecl *VD, const APValue &Init);
579
580 /// Emit information about an external variable.
581 void EmitExternalVariable(llvm::GlobalVariable *GV, const VarDecl *Decl);
582
583 /// Emit a pseudo variable and debug info for an intermediate value if it does
584 /// not correspond to a variable in the source code, so that a profiler can
585 /// track more accurate usage of certain instructions of interest.
586 void EmitPseudoVariable(CGBuilderTy &Builder, llvm::Instruction *Value,
587 QualType Ty);
588
589 /// Emit information about global variable alias.
590 void EmitGlobalAlias(const llvm::GlobalValue *GV, const GlobalDecl Decl);
591
592 /// Emit C++ using directive.
593 void EmitUsingDirective(const UsingDirectiveDecl &UD);
594
595 /// Emit the type explicitly casted to.
596 void EmitExplicitCastType(QualType Ty);
597
598 /// Emit the type even if it might not be used.
599 void EmitAndRetainType(QualType Ty);
600
601 /// Emit a shadow decl brought in by a using or using-enum
602 void EmitUsingShadowDecl(const UsingShadowDecl &USD);
603
604 /// Emit C++ using declaration.
605 void EmitUsingDecl(const UsingDecl &UD);
606
607 /// Emit C++ using-enum declaration.
608 void EmitUsingEnumDecl(const UsingEnumDecl &UD);
609
610 /// Emit an @import declaration.
611 void EmitImportDecl(const ImportDecl &ID);
612
613 /// DebugInfo isn't attached to string literals by default. While certain
614 /// aspects of debuginfo aren't useful for string literals (like a name), it's
615 /// nice to be able to symbolize the line and column information. This is
616 /// especially useful for sanitizers, as it allows symbolization of
617 /// heap-buffer-overflows on constant strings.
618 void AddStringLiteralDebugInfo(llvm::GlobalVariable *GV,
619 const StringLiteral *S);
620
621 /// Emit C++ namespace alias.
622 llvm::DIImportedEntity *EmitNamespaceAlias(const NamespaceAliasDecl &NA);
623
624 /// Emit record type's standalone debug info.
625 llvm::DIType *getOrCreateRecordType(QualType Ty, SourceLocation L);
626
627 /// Emit an Objective-C interface type standalone debug info.
628 llvm::DIType *getOrCreateInterfaceType(QualType Ty, SourceLocation Loc);
629
630 /// Emit standalone debug info for a type.
631 llvm::DIType *getOrCreateStandaloneType(QualType Ty, SourceLocation Loc);
632
633 /// Add heapallocsite metadata for MSAllocator calls.
634 void addHeapAllocSiteMetadata(llvm::CallBase *CallSite, QualType AllocatedTy,
635 SourceLocation Loc);
636
637 void completeType(const EnumDecl *ED);
638 void completeType(const RecordDecl *RD);
639 void completeRequiredType(const RecordDecl *RD);
640 void completeClassData(const RecordDecl *RD);
641 void completeClass(const RecordDecl *RD);
642
643 void completeTemplateDefinition(const ClassTemplateSpecializationDecl &SD);
644 void completeUnusedClass(const CXXRecordDecl &D);
645
646 /// Create debug info for a macro defined by a #define directive or a macro
647 /// undefined by a #undef directive.
648 llvm::DIMacro *CreateMacro(llvm::DIMacroFile *Parent, unsigned MType,
649 SourceLocation LineLoc, StringRef Name,
650 StringRef Value);
651
652 /// Create debug info for a file referenced by an #include directive.
653 llvm::DIMacroFile *CreateTempMacroFile(llvm::DIMacroFile *Parent,
654 SourceLocation LineLoc,
655 SourceLocation FileLoc);
656
657 Param2DILocTy &getParamDbgMappings() { return ParamDbgMappings; }
658 ParamDecl2StmtTy &getCoroutineParameterMappings() {
659 return CoroutineParameterMappings;
660 }
661
662 /// Create a debug location from `TrapLocation` that adds an artificial inline
663 /// frame where the frame name is
664 ///
665 /// * `<Prefix>:<Category>:<FailureMsg>`
666 ///
667 /// `<Prefix>` is "__clang_trap_msg".
668 ///
669 /// This is used to store failure reasons for traps.
670 llvm::DILocation *CreateTrapFailureMessageFor(llvm::DebugLoc TrapLocation,
671 StringRef Category,
672 StringRef FailureMsg);
673 /// Create a debug location from `Location` that adds an artificial inline
674 /// frame where the frame name is FuncName
675 ///
676 /// This is used to indiciate instructions that come from compiler
677 /// instrumentation.
678 llvm::DILocation *
679 CreateSyntheticInlineAt(llvm::DebugLoc ParentLocation,
680 llvm::DISubprogram *SynthSubprogram);
681 llvm::DILocation *CreateSyntheticInlineAt(llvm::DebugLoc ParentLocation,
682 StringRef SynthFuncName,
683 llvm::DIFile *SynthFile);
684
685 /// Reset internal state.
686 void completeFunction();
687
688 /// Add \p KeyInstruction and an optional \p Backup instruction to the
689 /// current atom group, created using ApplyAtomGroup.
690 void addInstToCurrentSourceAtom(llvm::Instruction *KeyInstruction,
691 llvm::Value *Backup);
692
693 /// Add \p KeyInstruction and an optional \p Backup instruction to the atom
694 /// group \p Atom.
695 void addInstToSpecificSourceAtom(llvm::Instruction *KeyInstruction,
696 llvm::Value *Backup, uint64_t Atom);
697
698 /// Emit symbol for debugger that holds the pointer to the vtable.
699 void emitVTableSymbol(llvm::GlobalVariable *VTable, const CXXRecordDecl *RD);
700
701 /// Return flags which enable debug info emission for call sites, provided
702 /// that it is supported and enabled.
703 llvm::DINode::DIFlags getCallSiteRelatedAttrs() const;
704
705 /// Add call target information.
706 void addCallTargetIfVirtual(const FunctionDecl *FD, llvm::CallBase *CI);
707
708private:
709 /// Amend \p I's DebugLoc with \p Group (its source atom group) and \p
710 /// Rank (lower nonzero rank is higher precedence). Does nothing if \p I
711 /// has no DebugLoc, and chooses the atom group in which the instruction
712 /// has the highest precedence if it's already in one.
713 void addInstSourceAtomMetadata(llvm::Instruction *I, uint64_t Group,
714 uint8_t Rank);
715
716 /// Emit call to llvm.dbg.declare for a variable declaration.
717 /// Returns a pointer to the DILocalVariable associated with the
718 /// llvm.dbg.declare, or nullptr otherwise.
719 llvm::DILocalVariable *EmitDeclare(const VarDecl *decl, llvm::Value *AI,
720 std::optional<unsigned> ArgNo,
721 CGBuilderTy &Builder,
722 const bool UsePointerValue = false);
723
724 /// Emit call to llvm.dbg.declare for a binding declaration.
725 /// Returns a pointer to the DILocalVariable associated with the
726 /// llvm.dbg.declare, or nullptr otherwise.
727 llvm::DILocalVariable *EmitDeclare(const BindingDecl *decl, llvm::Value *AI,
728 std::optional<unsigned> ArgNo,
729 CGBuilderTy &Builder,
730 const bool UsePointerValue = false);
731
732 struct BlockByRefType {
733 /// The wrapper struct used inside the __block_literal struct.
734 llvm::DIType *BlockByRefWrapper;
735 /// The type as it appears in the source code.
736 llvm::DIType *WrappedType;
737 };
738
739 bool HasReconstitutableArgs(ArrayRef<TemplateArgument> Args) const;
740 std::string GetName(const Decl *, bool Qualified = false,
741 bool *NameIsSimplified = nullptr) const;
742
743 /// Build up structure info for the byref. See \a BuildByRefType.
744 BlockByRefType EmitTypeForVarWithBlocksAttr(const VarDecl *VD,
745 uint64_t *OffSet);
746
747 /// Get context info for the DeclContext of \p Decl.
748 llvm::DIScope *getDeclContextDescriptor(const Decl *D);
749 /// Get context info for a given DeclContext \p Decl.
750 llvm::DIScope *getContextDescriptor(const Decl *Context,
751 llvm::DIScope *Default);
752
753 llvm::DIScope *getCurrentContextDescriptor(const Decl *Decl);
754
755 /// Create a forward decl for a RecordType in a given context.
756 llvm::DICompositeType *getOrCreateRecordFwdDecl(const RecordType *,
757 llvm::DIScope *);
758
759 /// Return current directory name.
760 StringRef getCurrentDirname();
761
762 /// Create new compile unit.
763 void CreateCompileUnit();
764
765 /// Compute the file checksum debug info for input file ID.
766 std::optional<llvm::DIFile::ChecksumKind>
767 computeChecksum(FileID FID, SmallString<64> &Checksum) const;
768
769 /// Get the source of the given file ID.
770 std::optional<StringRef> getSource(const SourceManager &SM, FileID FID);
771
772 /// Convenience function to get the file debug info descriptor for the input
773 /// location.
774 llvm::DIFile *getOrCreateFile(SourceLocation Loc);
775
776 /// Create a file debug info descriptor for a source file.
777 llvm::DIFile *
778 createFile(StringRef FileName,
779 std::optional<llvm::DIFile::ChecksumInfo<StringRef>> CSInfo,
780 std::optional<StringRef> Source);
781
782 /// Get the type from the cache or create a new type if necessary.
783 llvm::DIType *getOrCreateType(QualType Ty, llvm::DIFile *Fg);
784
785 /// Get a reference to a clang module. If \p CreateSkeletonCU is true,
786 /// this also creates a split dwarf skeleton compile unit.
787 llvm::DIModule *getOrCreateModuleRef(ASTSourceDescriptor Mod,
788 bool CreateSkeletonCU);
789
790 /// DebugTypeExtRefs: If \p D originated in a clang module, return it.
791 llvm::DIModule *getParentModuleOrNull(const Decl *D);
792
793 /// Get the type from the cache or create a new partial type if
794 /// necessary.
795 llvm::DICompositeType *getOrCreateLimitedType(const RecordType *Ty);
796
797 /// Create type metadata for a source language type.
798 llvm::DIType *CreateTypeNode(QualType Ty, llvm::DIFile *Fg);
799
800 /// Create new member and increase Offset by FType's size.
801 llvm::DIType *CreateMemberType(llvm::DIFile *Unit, QualType FType,
802 StringRef Name, uint64_t *Offset);
803
804 /// Retrieve the DIDescriptor, if any, for the canonical form of this
805 /// declaration.
806 llvm::DINode *getDeclarationOrDefinition(const Decl *D);
807
808 /// \return debug info descriptor to describe method
809 /// declaration for the given method definition.
810 llvm::DISubprogram *getFunctionDeclaration(const Decl *D);
811
812 /// \return debug info descriptor to the describe method declaration
813 /// for the given method definition.
814 /// \param FnType For Objective-C methods, their type.
815 /// \param LineNo The declaration's line number.
816 /// \param Flags The DIFlags for the method declaration.
817 /// \param SPFlags The subprogram-spcific flags for the method declaration.
818 llvm::DISubprogram *
819 getObjCMethodDeclaration(const Decl *D, llvm::DISubroutineType *FnType,
820 unsigned LineNo, llvm::DINode::DIFlags Flags,
821 llvm::DISubprogram::DISPFlags SPFlags);
822
823 /// \return debug info descriptor to describe in-class static data
824 /// member declaration for the given out-of-class definition. If D
825 /// is an out-of-class definition of a static data member of a
826 /// class, find its corresponding in-class declaration.
827 llvm::DIDerivedType *
828 getOrCreateStaticDataMemberDeclarationOrNull(const VarDecl *D);
829
830 /// Helper that either creates a forward declaration or a stub.
831 llvm::DISubprogram *getFunctionFwdDeclOrStub(GlobalDecl GD, bool Stub);
832
833 /// Create a subprogram describing the forward declaration
834 /// represented in the given FunctionDecl wrapped in a GlobalDecl.
835 llvm::DISubprogram *getFunctionForwardDeclaration(GlobalDecl GD);
836
837 /// Create a DISubprogram describing the function
838 /// represented in the given FunctionDecl wrapped in a GlobalDecl.
839 llvm::DISubprogram *getFunctionStub(GlobalDecl GD);
840
841 /// Create a global variable describing the forward declaration
842 /// represented in the given VarDecl.
843 llvm::DIGlobalVariable *
844 getGlobalVariableForwardDeclaration(const VarDecl *VD);
845
846 /// Return a global variable that represents one of the collection of global
847 /// variables created for an anonmyous union.
848 ///
849 /// Recursively collect all of the member fields of a global
850 /// anonymous decl and create static variables for them. The first
851 /// time this is called it needs to be on a union and then from
852 /// there we can have additional unnamed fields.
853 llvm::DIGlobalVariableExpression *
854 CollectAnonRecordDecls(const RecordDecl *RD, llvm::DIFile *Unit,
855 unsigned LineNo, StringRef LinkageName,
856 llvm::GlobalVariable *Var, llvm::DIScope *DContext);
857
858 /// Get the printing policy for producing names for debug info.
859 PrintingPolicy getPrintingPolicy() const;
860
861 /// Get function name for the given FunctionDecl. If the name is
862 /// constructed on demand (e.g., C++ destructor) then the name is
863 /// stored on the side.
864 StringRef getFunctionName(const FunctionDecl *FD,
865 bool *NameIsSimplified = nullptr);
866
867 /// Returns the unmangled name of an Objective-C method.
868 /// This is the display name for the debugging info.
869 StringRef getObjCMethodName(const ObjCMethodDecl *FD);
870
871 /// Return selector name. This is used for debugging
872 /// info.
873 StringRef getSelectorName(Selector S);
874
875 /// Get class name including template argument list.
876 StringRef getClassName(const RecordDecl *RD,
877 bool *NameIsSimplified = nullptr);
878
879 /// Get the vtable name for the given class.
880 StringRef getVTableName(const CXXRecordDecl *Decl);
881
882 /// Get the name to use in the debug info for a dynamic initializer or atexit
883 /// stub function.
884 StringRef getDynamicInitializerName(const VarDecl *VD,
885 DynamicInitKind StubKind,
886 llvm::Function *InitFn);
887
888 /// Get line number for the location. If location is invalid
889 /// then use current location.
890 unsigned getLineNumber(SourceLocation Loc);
891
892 /// Get column number for the location. If location is
893 /// invalid then use current location.
894 unsigned getColumnNumber(SourceLocation Loc);
895
896 /// Clear the current location and its derived metadata.
897 void clearCurLoc() {
898 CurLoc = SourceLocation();
899 CurLocFile = nullptr;
900 CurLocLine = 0;
901 CurLocColumn = 0;
902 }
903
904 /// Collect various properties of a FunctionDecl.
905 /// \param GD A GlobalDecl whose getDecl() must return a FunctionDecl.
906 void collectFunctionDeclProps(GlobalDecl GD, llvm::DIFile *Unit,
907 StringRef &Name, StringRef &LinkageName,
908 llvm::DIScope *&FDContext,
909 llvm::DINodeArray &TParamsArray,
910 llvm::DINode::DIFlags &Flags);
911
912 /// Collect various properties of a VarDecl.
913 void collectVarDeclProps(const VarDecl *VD, llvm::DIFile *&Unit,
914 unsigned &LineNo, QualType &T, StringRef &Name,
915 StringRef &LinkageName,
916 llvm::MDTuple *&TemplateParameters,
917 llvm::DIScope *&VDContext);
918
919 /// Create a DIExpression representing the constant corresponding
920 /// to the specified 'Val'. Returns nullptr on failure.
921 llvm::DIExpression *createConstantValueExpression(const clang::ValueDecl *VD,
922 const APValue &Val);
923
924 /// Allocate a copy of \p A using the DebugInfoNames allocator
925 /// and return a reference to it. If multiple arguments are given the strings
926 /// are concatenated.
927 StringRef internString(StringRef A, StringRef B = StringRef()) {
928 char *Data = DebugInfoNames.Allocate<char>(Num: A.size() + B.size());
929 if (!A.empty())
930 std::memcpy(dest: Data, src: A.data(), n: A.size());
931 if (!B.empty())
932 std::memcpy(dest: Data + A.size(), src: B.data(), n: B.size());
933 return StringRef(Data, A.size() + B.size());
934 }
935
936 /// If one exists, returns the linkage name of the specified \
937 /// (non-null) \c Method. Returns empty string otherwise.
938 llvm::StringRef GetMethodLinkageName(const CXXMethodDecl *Method) const;
939
940 /// Returns true if we should generate call target information.
941 bool shouldGenerateVirtualCallSite() const;
942};
943
944/// A scoped helper to set the current debug location to the specified
945/// location or preferred location of the specified Expr.
946class ApplyDebugLocation {
947private:
948 void init(SourceLocation TemporaryLocation, bool DefaultToEmpty = false);
949 ApplyDebugLocation(CodeGenFunction &CGF, bool DefaultToEmpty,
950 SourceLocation TemporaryLocation);
951
952 llvm::DebugLoc OriginalLocation;
953 CodeGenFunction *CGF;
954
955public:
956 /// Set the location to the (valid) TemporaryLocation.
957 ApplyDebugLocation(CodeGenFunction &CGF, SourceLocation TemporaryLocation);
958 ApplyDebugLocation(CodeGenFunction &CGF, const Expr *E);
959 ApplyDebugLocation(CodeGenFunction &CGF, llvm::DebugLoc Loc);
960 ApplyDebugLocation(ApplyDebugLocation &&Other) : CGF(Other.CGF) {
961 Other.CGF = nullptr;
962 }
963
964 // Define move assignment operator.
965 ApplyDebugLocation &operator=(ApplyDebugLocation &&Other) {
966 if (this != &Other) {
967 CGF = Other.CGF;
968 Other.CGF = nullptr;
969 }
970 return *this;
971 }
972
973 ~ApplyDebugLocation();
974
975 /// Apply TemporaryLocation if it is valid. Otherwise switch
976 /// to an artificial debug location that has a valid scope, but no
977 /// line information.
978 ///
979 /// Artificial locations are useful when emitting compiler-generated
980 /// helper functions that have no source location associated with
981 /// them. The DWARF specification allows the compiler to use the
982 /// special line number 0 to indicate code that can not be
983 /// attributed to any source location. Note that passing an empty
984 /// SourceLocation to CGDebugInfo::setLocation() will result in the
985 /// last valid location being reused.
986 static ApplyDebugLocation CreateArtificial(CodeGenFunction &CGF) {
987 return ApplyDebugLocation(CGF, false, SourceLocation());
988 }
989 /// Apply TemporaryLocation if it is valid. Otherwise switch
990 /// to an artificial debug location that has a valid scope, but no
991 /// line information.
992 static ApplyDebugLocation
993 CreateDefaultArtificial(CodeGenFunction &CGF,
994 SourceLocation TemporaryLocation) {
995 return ApplyDebugLocation(CGF, false, TemporaryLocation);
996 }
997
998 /// Set the IRBuilder to not attach debug locations. Note that
999 /// passing an empty SourceLocation to \a CGDebugInfo::setLocation()
1000 /// will result in the last valid location being reused. Note that
1001 /// all instructions that do not have a location at the beginning of
1002 /// a function are counted towards to function prologue.
1003 static ApplyDebugLocation CreateEmpty(CodeGenFunction &CGF) {
1004 return ApplyDebugLocation(CGF, true, SourceLocation());
1005 }
1006};
1007
1008/// A scoped helper to set the current debug location to an inlined location.
1009class ApplyInlineDebugLocation {
1010 SourceLocation SavedLocation;
1011 CodeGenFunction *CGF;
1012
1013public:
1014 /// Set up the CodeGenFunction's DebugInfo to produce inline locations for the
1015 /// function \p InlinedFn. The current debug location becomes the inlined call
1016 /// site of the inlined function.
1017 ApplyInlineDebugLocation(CodeGenFunction &CGF, GlobalDecl InlinedFn);
1018 /// Restore everything back to the original state.
1019 ~ApplyInlineDebugLocation();
1020 ApplyInlineDebugLocation(const ApplyInlineDebugLocation &) = delete;
1021 ApplyInlineDebugLocation &operator=(ApplyInlineDebugLocation &) = delete;
1022};
1023
1024class SanitizerDebugLocation {
1025 CodeGenFunction *CGF;
1026 ApplyDebugLocation Apply;
1027
1028public:
1029 SanitizerDebugLocation(CodeGenFunction *CGF,
1030 ArrayRef<SanitizerKind::SanitizerOrdinal> Ordinals,
1031 SanitizerHandler Handler);
1032 ~SanitizerDebugLocation();
1033 SanitizerDebugLocation(const SanitizerDebugLocation &) = delete;
1034 SanitizerDebugLocation &operator=(SanitizerDebugLocation &) = delete;
1035};
1036
1037} // namespace CodeGen
1038} // namespace clang
1039
1040#endif // LLVM_CLANG_LIB_CODEGEN_CGDEBUGINFO_H
1041