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