LLVM  3.7.0
DebugInfoMetadata.cpp
Go to the documentation of this file.
1 //===- DebugInfoMetadata.cpp - Implement debug info metadata --------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file implements the debug info Metadata classes.
11 //
12 //===----------------------------------------------------------------------===//
13 
15 #include "LLVMContextImpl.h"
16 #include "MetadataImpl.h"
17 #include "llvm/ADT/StringSwitch.h"
18 #include "llvm/IR/Function.h"
19 
20 using namespace llvm;
21 
22 DILocation::DILocation(LLVMContext &C, StorageType Storage, unsigned Line,
23  unsigned Column, ArrayRef<Metadata *> MDs)
24  : MDNode(C, DILocationKind, Storage, MDs) {
25  assert((MDs.size() == 1 || MDs.size() == 2) &&
26  "Expected a scope and optional inlined-at");
27 
28  // Set line and column.
29  assert(Column < (1u << 16) && "Expected 16-bit column");
30 
31  SubclassData32 = Line;
32  SubclassData16 = Column;
33 }
34 
35 static void adjustColumn(unsigned &Column) {
36  // Set to unknown on overflow. We only have 16 bits to play with here.
37  if (Column >= (1u << 16))
38  Column = 0;
39 }
40 
41 DILocation *DILocation::getImpl(LLVMContext &Context, unsigned Line,
42  unsigned Column, Metadata *Scope,
43  Metadata *InlinedAt, StorageType Storage,
44  bool ShouldCreate) {
45  // Fixup column.
46  adjustColumn(Column);
47 
48  assert(Scope && "Expected scope");
49  if (Storage == Uniqued) {
50  if (auto *N =
51  getUniqued(Context.pImpl->DILocations,
52  DILocationInfo::KeyTy(Line, Column, Scope, InlinedAt)))
53  return N;
54  if (!ShouldCreate)
55  return nullptr;
56  } else {
57  assert(ShouldCreate && "Expected non-uniqued nodes to always be created");
58  }
59 
61  Ops.push_back(Scope);
62  if (InlinedAt)
63  Ops.push_back(InlinedAt);
64  return storeImpl(new (Ops.size())
65  DILocation(Context, Storage, Line, Column, Ops),
66  Storage, Context.pImpl->DILocations);
67 }
68 
70  // FIXME: This seems completely wrong.
71  //
72  // 1. If two modules are generated in the same context, then the second
73  // Module will get different discriminators than it would have if it were
74  // generated in its own context.
75  // 2. If this function is called after round-tripping to bitcode instead of
76  // before, it will give a different (and potentially incorrect!) return.
77  //
78  // The discriminator should instead be calculated from local information
79  // where it's actually needed. This logic should be moved to
80  // AddDiscriminators::runOnFunction(), where it doesn't pollute the
81  // LLVMContext.
82  std::pair<const char *, unsigned> Key(getFilename().data(), getLine());
83  return ++getContext().pImpl->DiscriminatorTable[Key];
84 }
85 
88 #define HANDLE_DI_FLAG(ID, NAME) .Case("DIFlag" #NAME, Flag##NAME)
89 #include "llvm/IR/DebugInfoFlags.def"
90  .Default(0);
91 }
92 
93 const char *DINode::getFlagString(unsigned Flag) {
94  switch (Flag) {
95  default:
96  return "";
97 #define HANDLE_DI_FLAG(ID, NAME) \
98  case Flag##NAME: \
99  return "DIFlag" #NAME;
100 #include "llvm/IR/DebugInfoFlags.def"
101  }
102 }
103 
104 unsigned DINode::splitFlags(unsigned Flags,
105  SmallVectorImpl<unsigned> &SplitFlags) {
106  // Accessibility flags need to be specially handled, since they're packed
107  // together.
108  if (unsigned A = Flags & FlagAccessibility) {
109  if (A == FlagPrivate)
110  SplitFlags.push_back(FlagPrivate);
111  else if (A == FlagProtected)
112  SplitFlags.push_back(FlagProtected);
113  else
114  SplitFlags.push_back(FlagPublic);
115  Flags &= ~A;
116  }
117 
118 #define HANDLE_DI_FLAG(ID, NAME) \
119  if (unsigned Bit = Flags & ID) { \
120  SplitFlags.push_back(Bit); \
121  Flags &= ~Bit; \
122  }
123 #include "llvm/IR/DebugInfoFlags.def"
124 
125  return Flags;
126 }
127 
129  if (auto *T = dyn_cast<DIType>(this))
130  return T->getScope();
131 
132  if (auto *SP = dyn_cast<DISubprogram>(this))
133  return SP->getScope();
134 
135  if (auto *LB = dyn_cast<DILexicalBlockBase>(this))
136  return DIScopeRef(LB->getScope());
137 
138  if (auto *NS = dyn_cast<DINamespace>(this))
139  return DIScopeRef(NS->getScope());
140 
141  if (auto *M = dyn_cast<DIModule>(this))
142  return DIScopeRef(M->getScope());
143 
144  assert((isa<DIFile>(this) || isa<DICompileUnit>(this)) &&
145  "Unhandled type of scope.");
146  return nullptr;
147 }
148 
150  if (auto *T = dyn_cast<DIType>(this))
151  return T->getName();
152  if (auto *SP = dyn_cast<DISubprogram>(this))
153  return SP->getName();
154  if (auto *NS = dyn_cast<DINamespace>(this))
155  return NS->getName();
156  if (auto *M = dyn_cast<DIModule>(this))
157  return M->getName();
158  assert((isa<DILexicalBlockBase>(this) || isa<DIFile>(this) ||
159  isa<DICompileUnit>(this)) &&
160  "Unhandled type of scope.");
161  return "";
162 }
163 
164 static StringRef getString(const MDString *S) {
165  if (S)
166  return S->getString();
167  return StringRef();
168 }
169 
170 #ifndef NDEBUG
171 static bool isCanonical(const MDString *S) {
172  return !S || !S->getString().empty();
173 }
174 #endif
175 
176 GenericDINode *GenericDINode::getImpl(LLVMContext &Context, unsigned Tag,
177  MDString *Header,
178  ArrayRef<Metadata *> DwarfOps,
179  StorageType Storage, bool ShouldCreate) {
180  unsigned Hash = 0;
181  if (Storage == Uniqued) {
182  GenericDINodeInfo::KeyTy Key(Tag, getString(Header), DwarfOps);
183  if (auto *N = getUniqued(Context.pImpl->GenericDINodes, Key))
184  return N;
185  if (!ShouldCreate)
186  return nullptr;
187  Hash = Key.getHash();
188  } else {
189  assert(ShouldCreate && "Expected non-uniqued nodes to always be created");
190  }
191 
192  // Use a nullptr for empty headers.
193  assert(isCanonical(Header) && "Expected canonical MDString");
194  Metadata *PreOps[] = {Header};
195  return storeImpl(new (DwarfOps.size() + 1) GenericDINode(
196  Context, Storage, Hash, Tag, PreOps, DwarfOps),
197  Storage, Context.pImpl->GenericDINodes);
198 }
199 
200 void GenericDINode::recalculateHash() {
201  setHash(GenericDINodeInfo::KeyTy::calculateHash(this));
202 }
203 
204 #define UNWRAP_ARGS_IMPL(...) __VA_ARGS__
205 #define UNWRAP_ARGS(ARGS) UNWRAP_ARGS_IMPL ARGS
206 #define DEFINE_GETIMPL_LOOKUP(CLASS, ARGS) \
207  do { \
208  if (Storage == Uniqued) { \
209  if (auto *N = getUniqued(Context.pImpl->CLASS##s, \
210  CLASS##Info::KeyTy(UNWRAP_ARGS(ARGS)))) \
211  return N; \
212  if (!ShouldCreate) \
213  return nullptr; \
214  } else { \
215  assert(ShouldCreate && \
216  "Expected non-uniqued nodes to always be created"); \
217  } \
218  } while (false)
219 #define DEFINE_GETIMPL_STORE(CLASS, ARGS, OPS) \
220  return storeImpl(new (ArrayRef<Metadata *>(OPS).size()) \
221  CLASS(Context, Storage, UNWRAP_ARGS(ARGS), OPS), \
222  Storage, Context.pImpl->CLASS##s)
223 #define DEFINE_GETIMPL_STORE_NO_OPS(CLASS, ARGS) \
224  return storeImpl(new (0u) CLASS(Context, Storage, UNWRAP_ARGS(ARGS)), \
225  Storage, Context.pImpl->CLASS##s)
226 #define DEFINE_GETIMPL_STORE_NO_CONSTRUCTOR_ARGS(CLASS, OPS) \
227  return storeImpl(new (ArrayRef<Metadata *>(OPS).size()) \
228  CLASS(Context, Storage, OPS), \
229  Storage, Context.pImpl->CLASS##s)
230 
231 DISubrange *DISubrange::getImpl(LLVMContext &Context, int64_t Count, int64_t Lo,
232  StorageType Storage, bool ShouldCreate) {
233  DEFINE_GETIMPL_LOOKUP(DISubrange, (Count, Lo));
235 }
236 
237 DIEnumerator *DIEnumerator::getImpl(LLVMContext &Context, int64_t Value,
238  MDString *Name, StorageType Storage,
239  bool ShouldCreate) {
240  assert(isCanonical(Name) && "Expected canonical MDString");
242  Metadata *Ops[] = {Name};
243  DEFINE_GETIMPL_STORE(DIEnumerator, (Value), Ops);
244 }
245 
246 DIBasicType *DIBasicType::getImpl(LLVMContext &Context, unsigned Tag,
247  MDString *Name, uint64_t SizeInBits,
248  uint64_t AlignInBits, unsigned Encoding,
249  StorageType Storage, bool ShouldCreate) {
250  assert(isCanonical(Name) && "Expected canonical MDString");
252  DIBasicType, (Tag, getString(Name), SizeInBits, AlignInBits, Encoding));
253  Metadata *Ops[] = {nullptr, nullptr, Name};
254  DEFINE_GETIMPL_STORE(DIBasicType, (Tag, SizeInBits, AlignInBits, Encoding),
255  Ops);
256 }
257 
258 DIDerivedType *DIDerivedType::getImpl(
259  LLVMContext &Context, unsigned Tag, MDString *Name, Metadata *File,
260  unsigned Line, Metadata *Scope, Metadata *BaseType, uint64_t SizeInBits,
261  uint64_t AlignInBits, uint64_t OffsetInBits, unsigned Flags,
262  Metadata *ExtraData, StorageType Storage, bool ShouldCreate) {
263  assert(isCanonical(Name) && "Expected canonical MDString");
264  DEFINE_GETIMPL_LOOKUP(DIDerivedType, (Tag, getString(Name), File, Line, Scope,
265  BaseType, SizeInBits, AlignInBits,
266  OffsetInBits, Flags, ExtraData));
267  Metadata *Ops[] = {File, Scope, Name, BaseType, ExtraData};
269  DIDerivedType, (Tag, Line, SizeInBits, AlignInBits, OffsetInBits, Flags),
270  Ops);
271 }
272 
273 DICompositeType *DICompositeType::getImpl(
274  LLVMContext &Context, unsigned Tag, MDString *Name, Metadata *File,
275  unsigned Line, Metadata *Scope, Metadata *BaseType, uint64_t SizeInBits,
276  uint64_t AlignInBits, uint64_t OffsetInBits, unsigned Flags,
277  Metadata *Elements, unsigned RuntimeLang, Metadata *VTableHolder,
278  Metadata *TemplateParams, MDString *Identifier, StorageType Storage,
279  bool ShouldCreate) {
280  assert(isCanonical(Name) && "Expected canonical MDString");
282  (Tag, getString(Name), File, Line, Scope, BaseType,
283  SizeInBits, AlignInBits, OffsetInBits, Flags, Elements,
284  RuntimeLang, VTableHolder, TemplateParams,
285  getString(Identifier)));
286  Metadata *Ops[] = {File, Scope, Name, BaseType,
287  Elements, VTableHolder, TemplateParams, Identifier};
288  DEFINE_GETIMPL_STORE(DICompositeType, (Tag, Line, RuntimeLang, SizeInBits,
289  AlignInBits, OffsetInBits, Flags),
290  Ops);
291 }
292 
293 DISubroutineType *DISubroutineType::getImpl(LLVMContext &Context,
294  unsigned Flags, Metadata *TypeArray,
295  StorageType Storage,
296  bool ShouldCreate) {
297  DEFINE_GETIMPL_LOOKUP(DISubroutineType, (Flags, TypeArray));
298  Metadata *Ops[] = {nullptr, nullptr, nullptr, nullptr,
299  TypeArray, nullptr, nullptr, nullptr};
300  DEFINE_GETIMPL_STORE(DISubroutineType, (Flags), Ops);
301 }
302 
303 DIFile *DIFile::getImpl(LLVMContext &Context, MDString *Filename,
304  MDString *Directory, StorageType Storage,
305  bool ShouldCreate) {
306  assert(isCanonical(Filename) && "Expected canonical MDString");
307  assert(isCanonical(Directory) && "Expected canonical MDString");
308  DEFINE_GETIMPL_LOOKUP(DIFile, (getString(Filename), getString(Directory)));
309  Metadata *Ops[] = {Filename, Directory};
311 }
312 
313 DICompileUnit *DICompileUnit::getImpl(
314  LLVMContext &Context, unsigned SourceLanguage, Metadata *File,
315  MDString *Producer, bool IsOptimized, MDString *Flags,
316  unsigned RuntimeVersion, MDString *SplitDebugFilename,
317  unsigned EmissionKind, Metadata *EnumTypes, Metadata *RetainedTypes,
318  Metadata *Subprograms, Metadata *GlobalVariables,
319  Metadata *ImportedEntities, uint64_t DWOId,
320  StorageType Storage, bool ShouldCreate) {
321  assert(isCanonical(Producer) && "Expected canonical MDString");
322  assert(isCanonical(Flags) && "Expected canonical MDString");
323  assert(isCanonical(SplitDebugFilename) && "Expected canonical MDString");
326  (SourceLanguage, File, getString(Producer), IsOptimized, getString(Flags),
327  RuntimeVersion, getString(SplitDebugFilename), EmissionKind, EnumTypes,
328  RetainedTypes, Subprograms, GlobalVariables, ImportedEntities, DWOId));
331  ImportedEntities};
334  (SourceLanguage, IsOptimized, RuntimeVersion, EmissionKind, DWOId), Ops);
335 }
336 
338  if (auto *Block = dyn_cast<DILexicalBlockBase>(this))
339  return Block->getScope()->getSubprogram();
340  return const_cast<DISubprogram *>(cast<DISubprogram>(this));
341 }
342 
343 DISubprogram *DISubprogram::getImpl(
344  LLVMContext &Context, Metadata *Scope, MDString *Name,
345  MDString *LinkageName, Metadata *File, unsigned Line, Metadata *Type,
346  bool IsLocalToUnit, bool IsDefinition, unsigned ScopeLine,
347  Metadata *ContainingType, unsigned Virtuality, unsigned VirtualIndex,
348  unsigned Flags, bool IsOptimized, Metadata *Function,
349  Metadata *TemplateParams, Metadata *Declaration, Metadata *Variables,
350  StorageType Storage, bool ShouldCreate) {
351  assert(isCanonical(Name) && "Expected canonical MDString");
352  assert(isCanonical(LinkageName) && "Expected canonical MDString");
354  (Scope, getString(Name), getString(LinkageName), File,
355  Line, Type, IsLocalToUnit, IsDefinition, ScopeLine,
356  ContainingType, Virtuality, VirtualIndex, Flags,
357  IsOptimized, Function, TemplateParams, Declaration,
358  Variables));
359  Metadata *Ops[] = {File, Scope, Name, Name,
361  TemplateParams, Declaration, Variables};
363  (Line, ScopeLine, Virtuality, VirtualIndex, Flags,
364  IsLocalToUnit, IsDefinition, IsOptimized),
365  Ops);
366 }
367 
368 Function *DISubprogram::getFunction() const {
369  // FIXME: Should this be looking through bitcasts?
370  return dyn_cast_or_null<Function>(getFunctionConstant());
371 }
372 
373 bool DISubprogram::describes(const Function *F) const {
374  assert(F && "Invalid function");
375  if (F == getFunction())
376  return true;
377  StringRef Name = getLinkageName();
378  if (Name.empty())
379  Name = getName();
380  return F->getName() == Name;
381 }
382 
385  : static_cast<ConstantAsMetadata *>(nullptr));
386 }
387 
388 DILexicalBlock *DILexicalBlock::getImpl(LLVMContext &Context, Metadata *Scope,
389  Metadata *File, unsigned Line,
390  unsigned Column, StorageType Storage,
391  bool ShouldCreate) {
392  assert(Scope && "Expected scope");
393  DEFINE_GETIMPL_LOOKUP(DILexicalBlock, (Scope, File, Line, Column));
394  Metadata *Ops[] = {File, Scope};
395  DEFINE_GETIMPL_STORE(DILexicalBlock, (Line, Column), Ops);
396 }
397 
398 DILexicalBlockFile *DILexicalBlockFile::getImpl(LLVMContext &Context,
399  Metadata *Scope, Metadata *File,
400  unsigned Discriminator,
401  StorageType Storage,
402  bool ShouldCreate) {
403  assert(Scope && "Expected scope");
404  DEFINE_GETIMPL_LOOKUP(DILexicalBlockFile, (Scope, File, Discriminator));
405  Metadata *Ops[] = {File, Scope};
406  DEFINE_GETIMPL_STORE(DILexicalBlockFile, (Discriminator), Ops);
407 }
408 
409 DINamespace *DINamespace::getImpl(LLVMContext &Context, Metadata *Scope,
410  Metadata *File, MDString *Name, unsigned Line,
411  StorageType Storage, bool ShouldCreate) {
412  assert(isCanonical(Name) && "Expected canonical MDString");
413  DEFINE_GETIMPL_LOOKUP(DINamespace, (Scope, File, getString(Name), Line));
414  Metadata *Ops[] = {File, Scope, Name};
415  DEFINE_GETIMPL_STORE(DINamespace, (Line), Ops);
416 }
417 
418 DIModule *DIModule::getImpl(LLVMContext &Context, Metadata *Scope,
419  MDString *Name, MDString *ConfigurationMacros,
420  MDString *IncludePath, MDString *ISysRoot,
421  StorageType Storage, bool ShouldCreate) {
422  assert(isCanonical(Name) && "Expected canonical MDString");
424  (Scope, getString(Name), getString(ConfigurationMacros),
425  getString(IncludePath), getString(ISysRoot)));
426  Metadata *Ops[] = {Scope, Name, ConfigurationMacros, IncludePath, ISysRoot};
428 }
429 
430 DITemplateTypeParameter *DITemplateTypeParameter::getImpl(LLVMContext &Context,
431  MDString *Name,
432  Metadata *Type,
433  StorageType Storage,
434  bool ShouldCreate) {
435  assert(isCanonical(Name) && "Expected canonical MDString");
437  Metadata *Ops[] = {Name, Type};
439 }
440 
441 DITemplateValueParameter *DITemplateValueParameter::getImpl(
442  LLVMContext &Context, unsigned Tag, MDString *Name, Metadata *Type,
443  Metadata *Value, StorageType Storage, bool ShouldCreate) {
444  assert(isCanonical(Name) && "Expected canonical MDString");
446  (Tag, getString(Name), Type, Value));
447  Metadata *Ops[] = {Name, Type, Value};
449 }
450 
452 DIGlobalVariable::getImpl(LLVMContext &Context, Metadata *Scope, MDString *Name,
453  MDString *LinkageName, Metadata *File, unsigned Line,
454  Metadata *Type, bool IsLocalToUnit, bool IsDefinition,
455  Metadata *Variable,
456  Metadata *StaticDataMemberDeclaration,
457  StorageType Storage, bool ShouldCreate) {
458  assert(isCanonical(Name) && "Expected canonical MDString");
459  assert(isCanonical(LinkageName) && "Expected canonical MDString");
461  (Scope, getString(Name), getString(LinkageName), File,
462  Line, Type, IsLocalToUnit, IsDefinition, Variable,
463  StaticDataMemberDeclaration));
464  Metadata *Ops[] = {Scope, Name, File, Type,
465  Name, LinkageName, Variable, StaticDataMemberDeclaration};
466  DEFINE_GETIMPL_STORE(DIGlobalVariable, (Line, IsLocalToUnit, IsDefinition),
467  Ops);
468 }
469 
470 DILocalVariable *DILocalVariable::getImpl(LLVMContext &Context, unsigned Tag,
471  Metadata *Scope, MDString *Name,
472  Metadata *File, unsigned Line,
473  Metadata *Type, unsigned Arg,
474  unsigned Flags, StorageType Storage,
475  bool ShouldCreate) {
476  // 64K ought to be enough for any frontend.
477  assert(Arg <= UINT16_MAX && "Expected argument number to fit in 16-bits");
478 
479  assert(Scope && "Expected scope");
480  assert(isCanonical(Name) && "Expected canonical MDString");
481  DEFINE_GETIMPL_LOOKUP(DILocalVariable, (Tag, Scope, getString(Name), File,
482  Line, Type, Arg, Flags));
483  Metadata *Ops[] = {Scope, Name, File, Type};
484  DEFINE_GETIMPL_STORE(DILocalVariable, (Tag, Line, Arg, Flags), Ops);
485 }
486 
487 DIExpression *DIExpression::getImpl(LLVMContext &Context,
488  ArrayRef<uint64_t> Elements,
489  StorageType Storage, bool ShouldCreate) {
490  DEFINE_GETIMPL_LOOKUP(DIExpression, (Elements));
492 }
493 
495  switch (getOp()) {
496  case dwarf::DW_OP_bit_piece:
497  return 3;
498  case dwarf::DW_OP_plus:
499  return 2;
500  default:
501  return 1;
502  }
503 }
504 
505 bool DIExpression::isValid() const {
506  for (auto I = expr_op_begin(), E = expr_op_end(); I != E; ++I) {
507  // Check that there's space for the operand.
508  if (I->get() + I->getSize() > E->get())
509  return false;
510 
511  // Check that the operand is valid.
512  switch (I->getOp()) {
513  default:
514  return false;
515  case dwarf::DW_OP_bit_piece:
516  // Piece expressions must be at the end.
517  return I->get() + I->getSize() == E->get();
518  case dwarf::DW_OP_plus:
519  case dwarf::DW_OP_deref:
520  break;
521  }
522  }
523  return true;
524 }
525 
527  assert(isValid() && "Expected valid expression");
528  if (unsigned N = getNumElements())
529  if (N >= 3)
530  return getElement(N - 3) == dwarf::DW_OP_bit_piece;
531  return false;
532 }
533 
535  assert(isBitPiece() && "Expected bit piece");
536  return getElement(getNumElements() - 2);
537 }
538 
540  assert(isBitPiece() && "Expected bit piece");
541  return getElement(getNumElements() - 1);
542 }
543 
544 DIObjCProperty *DIObjCProperty::getImpl(
545  LLVMContext &Context, MDString *Name, Metadata *File, unsigned Line,
546  MDString *GetterName, MDString *SetterName, unsigned Attributes,
547  Metadata *Type, StorageType Storage, bool ShouldCreate) {
548  assert(isCanonical(Name) && "Expected canonical MDString");
549  assert(isCanonical(GetterName) && "Expected canonical MDString");
550  assert(isCanonical(SetterName) && "Expected canonical MDString");
552  (getString(Name), File, Line, getString(GetterName),
553  getString(SetterName), Attributes, Type));
554  Metadata *Ops[] = {Name, File, GetterName, SetterName, Type};
555  DEFINE_GETIMPL_STORE(DIObjCProperty, (Line, Attributes), Ops);
556 }
557 
558 DIImportedEntity *DIImportedEntity::getImpl(LLVMContext &Context, unsigned Tag,
559  Metadata *Scope, Metadata *Entity,
560  unsigned Line, MDString *Name,
561  StorageType Storage,
562  bool ShouldCreate) {
563  assert(isCanonical(Name) && "Expected canonical MDString");
565  (Tag, Scope, Entity, Line, getString(Name)));
566  Metadata *Ops[] = {Scope, Entity, Name};
567  DEFINE_GETIMPL_STORE(DIImportedEntity, (Tag, Line), Ops);
568 }
unsigned MDString Metadata unsigned Metadata Metadata uint64_t uint64_t uint64_t unsigned Metadata unsigned Metadata * VTableHolder
bool describes(const Function *F) const
Check if this subprogram decribes the given function.
Metadata MDString MDString * ConfigurationMacros
unsigned MDString Metadata unsigned Metadata Metadata uint64_t uint64_t uint64_t unsigned Metadata * Elements
unsigned MDString Metadata unsigned Metadata Metadata * BaseType
uint64_t getElement(unsigned I) const
static bool isCanonical(const MDString *S)
Metadata node.
Definition: Metadata.h:740
static StringRef getString(const MDString *S)
F(f)
void replaceFunction(Function *F)
Replace the function.
unsigned Metadata * Scope
static T * storeImpl(T *N, StorageType Storage, StoreT &Store)
Definition: MetadataImpl.h:30
unsigned Metadata MDString bool MDString * Flags
unsigned MDString Metadata * Type
#define DEFINE_GETIMPL_LOOKUP(CLASS, ARGS)
Metadata MDString MDString Metadata unsigned Metadata * Type
StringRef getName() const
Return a constant reference to the value's name.
Definition: Value.cpp:188
Metadata MDString MDString Metadata unsigned Metadata bool bool unsigned Metadata unsigned unsigned unsigned bool Metadata Metadata Metadata * Declaration
Metadata MDString MDString Metadata unsigned Metadata bool bool Metadata * Variable
Array subrange.
unsigned Metadata MDString * Producer
MDString * Filename
unsigned Metadata MDString bool MDString unsigned MDString * SplitDebugFilename
Pointer union between a subclass of DINode and MDString.
Subprogram description.
Metadata MDString MDString Metadata unsigned Metadata bool bool unsigned Metadata unsigned unsigned unsigned bool Metadata Metadata * TemplateParams
unsigned StringRef DIFile unsigned DIScopeRef DITypeRef BaseType
unsigned StringRef DIFile * File
expr_op_iterator expr_op_begin() const
Visit the elements via ExprOperand wrappers.
Enumeration value.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
Definition: ArrayRef.h:31
Metadata MDString * Name
DIScopeRef getScope() const
Debug location.
static ConstantAsMetadata * get(Constant *C)
Definition: Metadata.h:318
size_t size() const
size - Get the array size.
Definition: ArrayRef.h:134
Flag
These should be considered private to the implementation of the MCInstrDesc class.
Definition: MCInstrDesc.h:97
unsigned MDString Metadata unsigned Metadata Metadata uint64_t uint64_t uint64_t unsigned Metadata unsigned Metadata Metadata * TemplateParams
Metadata MDString MDString Metadata * File
A switch()-like statement whose cases are string literals.
Definition: StringSwitch.h:42
static T * getUniqued(DenseSet< T *, InfoT > &Store, const typename InfoT::KeyTy &Key)
Definition: MetadataImpl.h:23
unsigned computeNewDiscriminator() const
Compute new discriminator in the given context.
unsigned getNumElements() const
unsigned StringRef Name
StringRef getName() const
unsigned MDString * Name
The instances of the Type class are immutable: once they are created, they are never changed...
Definition: Type.h:45
This is an important class for using LLVM in a threaded context.
Definition: LLVMContext.h:41
Metadata Metadata * File
#define DEFINE_GETIMPL_STORE(CLASS, ARGS, OPS)
static void adjustColumn(unsigned &Column)
SourceLanguage
Definition: Dwarf.h:352
unsigned getSize() const
Return the size of the operand.
unsigned StringRef DIFile unsigned DIScopeRef Scope
Metadata Metadata * File
unsigned Metadata * File
StorageType
Active type of storage.
Definition: Metadata.h:53
unsigned Metadata * TypeArray
Metadata MDString MDString * LinkageName
Metadata Metadata * File
unsigned Metadata MDString bool MDString unsigned MDString unsigned Metadata Metadata * RetainedTypes
LLVMContextImpl *const pImpl
Definition: LLVMContext.h:43
An imported module (C++ using directive or similar).
TypedDINodeRef< DIScope > DIScopeRef
#define DEFINE_GETIMPL_STORE_NO_OPS(CLASS, ARGS)
StringRef getString() const
Definition: Metadata.cpp:375
static const char * getFlagString(unsigned Flag)
unsigned Storage
Storage flag for non-uniqued, otherwise unowned, metadata.
Definition: Metadata.h:56
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
Definition: SmallVector.h:861
Metadata MDString MDString * LinkageName
DWARF expression.
Metadata MDString MDString Metadata unsigned Metadata bool bool unsigned Metadata * ContainingType
A (clang) module that has been imported by the compile unit.
unsigned Metadata MDString bool MDString unsigned MDString unsigned Metadata * EnumTypes
Generic tagged DWARF-like metadata node.
Metadata MDString MDString Metadata unsigned Metadata bool bool unsigned Metadata unsigned unsigned unsigned bool Metadata * Function
#define HANDLE_DI_FLAG(ID, NAME)
static unsigned getFlag(StringRef Flag)
Type array for a subprogram.
static unsigned splitFlags(unsigned Flags, SmallVectorImpl< unsigned > &SplitFlags)
Split up a flags bitfield.
DenseMap< std::pair< const char *, unsigned >, unsigned > DiscriminatorTable
DiscriminatorTable - This table maps file:line locations to an integer representing the next DWARF pa...
Metadata MDString MDString Metadata * File
unsigned Metadata MDString Metadata * File
#define I(x, y, z)
Definition: MD5.cpp:54
#define N
Metadata MDString * Name
Metadata MDString MDString MDString * IncludePath
LLVMContext & getContext() const
Definition: Metadata.h:799
unsigned MDString Metadata unsigned Metadata * Scope
bool isBitPiece() const
Return whether this is a piece of an aggregate variable.
LLVM Value Representation.
Definition: Value.h:69
#define DEFINE_GETIMPL_STORE_NO_CONSTRUCTOR_ARGS(CLASS, OPS)
Metadata MDString MDString Metadata unsigned Metadata * Type
uint64_t getBitPieceSize() const
Return the size of this piece in bits.
unsigned Metadata MDString bool MDString unsigned MDString unsigned Metadata Metadata Metadata * Subprograms
uint64_t getBitPieceOffset() const
Return the offset of this piece in bits.
uint64_t getOp() const
Get the operand code.
unsigned Metadata MDString * Name
std::string Hash(const Unit &U)
Definition: FuzzerUtil.cpp:39
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:40
A single uniqued string.
Definition: Metadata.h:508
DISubprogram * getSubprogram() const
Get the subprogram for this scope.
expr_op_iterator expr_op_end() const
Root of the metadata hierarchy.
Definition: Metadata.h:45
Metadata MDString * Name
unsigned MDString Metadata * File
unsigned Metadata MDString bool MDString unsigned MDString unsigned Metadata Metadata Metadata Metadata * GlobalVariables
bool empty() const
empty - Check if the string is empty.
Definition: StringRef.h:110
Basic type, like 'int' or 'float'.