blob: 81e20f4e1b962ce4b37895f3c4e89270c37a95b5 [file] [log] [blame]
Duncan P. N. Exon Smithd9901ff2015-02-02 18:53:21 +00001//===- 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
14#include "llvm/IR/DebugInfoMetadata.h"
15#include "LLVMContextImpl.h"
16#include "MetadataImpl.h"
Duncan P. N. Exon Smith5261e4b2015-04-07 01:21:40 +000017#include "llvm/ADT/StringSwitch.h"
Duncan P. N. Exon Smithdf523492015-02-18 20:32:57 +000018#include "llvm/IR/Function.h"
Duncan P. N. Exon Smithd9901ff2015-02-02 18:53:21 +000019
20using namespace llvm;
21
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +000022DILocation::DILocation(LLVMContext &C, StorageType Storage, unsigned Line,
Duncan P. N. Exon Smithd9901ff2015-02-02 18:53:21 +000023 unsigned Column, ArrayRef<Metadata *> MDs)
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +000024 : MDNode(C, DILocationKind, Storage, MDs) {
Duncan P. N. Exon Smithd9901ff2015-02-02 18:53:21 +000025 assert((MDs.size() == 1 || MDs.size() == 2) &&
26 "Expected a scope and optional inlined-at");
27
28 // Set line and column.
Duncan P. N. Exon Smithd9901ff2015-02-02 18:53:21 +000029 assert(Column < (1u << 16) && "Expected 16-bit column");
30
31 SubclassData32 = Line;
32 SubclassData16 = Column;
33}
34
Duncan P. N. Exon Smithd9901ff2015-02-02 18:53:21 +000035static 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
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +000041DILocation *DILocation::getImpl(LLVMContext &Context, unsigned Line,
Duncan P. N. Exon Smithd9901ff2015-02-02 18:53:21 +000042 unsigned Column, Metadata *Scope,
43 Metadata *InlinedAt, StorageType Storage,
44 bool ShouldCreate) {
Duncan P. N. Exon Smithaf677eb2015-02-06 22:50:13 +000045 // Fixup column.
Duncan P. N. Exon Smithd9901ff2015-02-02 18:53:21 +000046 adjustColumn(Column);
47
48 if (Storage == Uniqued) {
49 if (auto *N =
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +000050 getUniqued(Context.pImpl->DILocations,
51 DILocationInfo::KeyTy(Line, Column, Scope, InlinedAt)))
Duncan P. N. Exon Smithd9901ff2015-02-02 18:53:21 +000052 return N;
53 if (!ShouldCreate)
54 return nullptr;
55 } else {
56 assert(ShouldCreate && "Expected non-uniqued nodes to always be created");
57 }
58
59 SmallVector<Metadata *, 2> Ops;
60 Ops.push_back(Scope);
61 if (InlinedAt)
62 Ops.push_back(InlinedAt);
63 return storeImpl(new (Ops.size())
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +000064 DILocation(Context, Storage, Line, Column, Ops),
65 Storage, Context.pImpl->DILocations);
Duncan P. N. Exon Smithd9901ff2015-02-02 18:53:21 +000066}
67
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +000068unsigned DINode::getFlag(StringRef Flag) {
Duncan P. N. Exon Smith5261e4b2015-04-07 01:21:40 +000069 return StringSwitch<unsigned>(Flag)
70#define HANDLE_DI_FLAG(ID, NAME) .Case("DIFlag" #NAME, Flag##NAME)
71#include "llvm/IR/DebugInfoFlags.def"
72 .Default(0);
73}
74
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +000075const char *DINode::getFlagString(unsigned Flag) {
Duncan P. N. Exon Smith5261e4b2015-04-07 01:21:40 +000076 switch (Flag) {
77 default:
78 return "";
79#define HANDLE_DI_FLAG(ID, NAME) \
80 case Flag##NAME: \
81 return "DIFlag" #NAME;
82#include "llvm/IR/DebugInfoFlags.def"
83 }
84}
85
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +000086unsigned DINode::splitFlags(unsigned Flags,
87 SmallVectorImpl<unsigned> &SplitFlags) {
Duncan P. N. Exon Smith5261e4b2015-04-07 01:21:40 +000088 // Accessibility flags need to be specially handled, since they're packed
89 // together.
90 if (unsigned A = Flags & FlagAccessibility) {
91 if (A == FlagPrivate)
92 SplitFlags.push_back(FlagPrivate);
93 else if (A == FlagProtected)
94 SplitFlags.push_back(FlagProtected);
95 else
96 SplitFlags.push_back(FlagPublic);
97 Flags &= ~A;
98 }
99
100#define HANDLE_DI_FLAG(ID, NAME) \
101 if (unsigned Bit = Flags & ID) { \
102 SplitFlags.push_back(Bit); \
103 Flags &= ~Bit; \
104 }
105#include "llvm/IR/DebugInfoFlags.def"
106
107 return Flags;
108}
109
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000110DIScopeRef DIScope::getScope() const {
111 if (auto *T = dyn_cast<DIType>(this))
Duncan P. N. Exon Smithf0d81a52015-04-11 17:37:23 +0000112 return T->getScope();
113
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000114 if (auto *SP = dyn_cast<DISubprogram>(this))
Duncan P. N. Exon Smithf0d81a52015-04-11 17:37:23 +0000115 return SP->getScope();
116
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000117 if (auto *LB = dyn_cast<DILexicalBlockBase>(this))
Duncan P. N. Exon Smitha59d3e52016-04-23 21:08:00 +0000118 return LB->getScope();
Duncan P. N. Exon Smithf0d81a52015-04-11 17:37:23 +0000119
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000120 if (auto *NS = dyn_cast<DINamespace>(this))
Duncan P. N. Exon Smitha59d3e52016-04-23 21:08:00 +0000121 return NS->getScope();
Duncan P. N. Exon Smithf0d81a52015-04-11 17:37:23 +0000122
Adrian Prantlab1243f2015-06-29 23:03:47 +0000123 if (auto *M = dyn_cast<DIModule>(this))
Duncan P. N. Exon Smitha59d3e52016-04-23 21:08:00 +0000124 return M->getScope();
Adrian Prantlab1243f2015-06-29 23:03:47 +0000125
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000126 assert((isa<DIFile>(this) || isa<DICompileUnit>(this)) &&
Duncan P. N. Exon Smithf0d81a52015-04-11 17:37:23 +0000127 "Unhandled type of scope.");
128 return nullptr;
129}
130
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000131StringRef DIScope::getName() const {
132 if (auto *T = dyn_cast<DIType>(this))
Duncan P. N. Exon Smithf0d81a52015-04-11 17:37:23 +0000133 return T->getName();
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000134 if (auto *SP = dyn_cast<DISubprogram>(this))
Duncan P. N. Exon Smithf0d81a52015-04-11 17:37:23 +0000135 return SP->getName();
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000136 if (auto *NS = dyn_cast<DINamespace>(this))
Duncan P. N. Exon Smithf0d81a52015-04-11 17:37:23 +0000137 return NS->getName();
Adrian Prantlab1243f2015-06-29 23:03:47 +0000138 if (auto *M = dyn_cast<DIModule>(this))
139 return M->getName();
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000140 assert((isa<DILexicalBlockBase>(this) || isa<DIFile>(this) ||
141 isa<DICompileUnit>(this)) &&
Duncan P. N. Exon Smithf0d81a52015-04-11 17:37:23 +0000142 "Unhandled type of scope.");
143 return "";
144}
Duncan P. N. Exon Smith5261e4b2015-04-07 01:21:40 +0000145
Duncan P. N. Exon Smithc7e08132015-02-02 20:20:56 +0000146#ifndef NDEBUG
Duncan P. N. Exon Smith9146fc82015-02-02 20:01:03 +0000147static bool isCanonical(const MDString *S) {
148 return !S || !S->getString().empty();
Duncan P. N. Exon Smith442ec022015-02-02 19:54:05 +0000149}
Duncan P. N. Exon Smithc7e08132015-02-02 20:20:56 +0000150#endif
Duncan P. N. Exon Smith442ec022015-02-02 19:54:05 +0000151
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000152GenericDINode *GenericDINode::getImpl(LLVMContext &Context, unsigned Tag,
153 MDString *Header,
154 ArrayRef<Metadata *> DwarfOps,
155 StorageType Storage, bool ShouldCreate) {
Duncan P. N. Exon Smithd9901ff2015-02-02 18:53:21 +0000156 unsigned Hash = 0;
157 if (Storage == Uniqued) {
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000158 GenericDINodeInfo::KeyTy Key(Tag, Header, DwarfOps);
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000159 if (auto *N = getUniqued(Context.pImpl->GenericDINodes, Key))
Duncan P. N. Exon Smithd9901ff2015-02-02 18:53:21 +0000160 return N;
161 if (!ShouldCreate)
162 return nullptr;
163 Hash = Key.getHash();
164 } else {
165 assert(ShouldCreate && "Expected non-uniqued nodes to always be created");
166 }
167
168 // Use a nullptr for empty headers.
Duncan P. N. Exon Smith9146fc82015-02-02 20:01:03 +0000169 assert(isCanonical(Header) && "Expected canonical MDString");
170 Metadata *PreOps[] = {Header};
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000171 return storeImpl(new (DwarfOps.size() + 1) GenericDINode(
Duncan P. N. Exon Smithd9901ff2015-02-02 18:53:21 +0000172 Context, Storage, Hash, Tag, PreOps, DwarfOps),
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000173 Storage, Context.pImpl->GenericDINodes);
Duncan P. N. Exon Smithd9901ff2015-02-02 18:53:21 +0000174}
175
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000176void GenericDINode::recalculateHash() {
177 setHash(GenericDINodeInfo::KeyTy::calculateHash(this));
Duncan P. N. Exon Smithd9901ff2015-02-02 18:53:21 +0000178}
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000179
180#define UNWRAP_ARGS_IMPL(...) __VA_ARGS__
181#define UNWRAP_ARGS(ARGS) UNWRAP_ARGS_IMPL ARGS
182#define DEFINE_GETIMPL_LOOKUP(CLASS, ARGS) \
183 do { \
184 if (Storage == Uniqued) { \
185 if (auto *N = getUniqued(Context.pImpl->CLASS##s, \
186 CLASS##Info::KeyTy(UNWRAP_ARGS(ARGS)))) \
187 return N; \
188 if (!ShouldCreate) \
189 return nullptr; \
190 } else { \
191 assert(ShouldCreate && \
192 "Expected non-uniqued nodes to always be created"); \
193 } \
194 } while (false)
195#define DEFINE_GETIMPL_STORE(CLASS, ARGS, OPS) \
David Blaikie6662d6a2016-04-13 17:42:56 +0000196 return storeImpl(new (array_lengthof(OPS)) \
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000197 CLASS(Context, Storage, UNWRAP_ARGS(ARGS), OPS), \
198 Storage, Context.pImpl->CLASS##s)
199#define DEFINE_GETIMPL_STORE_NO_OPS(CLASS, ARGS) \
200 return storeImpl(new (0u) CLASS(Context, Storage, UNWRAP_ARGS(ARGS)), \
201 Storage, Context.pImpl->CLASS##s)
Duncan P. N. Exon Smithbd33d372015-02-10 01:59:57 +0000202#define DEFINE_GETIMPL_STORE_NO_CONSTRUCTOR_ARGS(CLASS, OPS) \
David Blaikie6662d6a2016-04-13 17:42:56 +0000203 return storeImpl(new (array_lengthof(OPS)) CLASS(Context, Storage, OPS), \
Duncan P. N. Exon Smithbd33d372015-02-10 01:59:57 +0000204 Storage, Context.pImpl->CLASS##s)
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000205
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000206DISubrange *DISubrange::getImpl(LLVMContext &Context, int64_t Count, int64_t Lo,
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000207 StorageType Storage, bool ShouldCreate) {
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000208 DEFINE_GETIMPL_LOOKUP(DISubrange, (Count, Lo));
209 DEFINE_GETIMPL_STORE_NO_OPS(DISubrange, (Count, Lo));
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000210}
211
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000212DIEnumerator *DIEnumerator::getImpl(LLVMContext &Context, int64_t Value,
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000213 MDString *Name, StorageType Storage,
214 bool ShouldCreate) {
215 assert(isCanonical(Name) && "Expected canonical MDString");
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000216 DEFINE_GETIMPL_LOOKUP(DIEnumerator, (Value, Name));
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000217 Metadata *Ops[] = {Name};
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000218 DEFINE_GETIMPL_STORE(DIEnumerator, (Value), Ops);
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000219}
220
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000221DIBasicType *DIBasicType::getImpl(LLVMContext &Context, unsigned Tag,
Duncan P. N. Exon Smithd34db172015-02-19 23:56:07 +0000222 MDString *Name, uint64_t SizeInBits,
223 uint64_t AlignInBits, unsigned Encoding,
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000224 StorageType Storage, bool ShouldCreate) {
225 assert(isCanonical(Name) && "Expected canonical MDString");
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000226 DEFINE_GETIMPL_LOOKUP(DIBasicType,
227 (Tag, Name, SizeInBits, AlignInBits, Encoding));
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000228 Metadata *Ops[] = {nullptr, nullptr, Name};
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000229 DEFINE_GETIMPL_STORE(DIBasicType, (Tag, SizeInBits, AlignInBits, Encoding),
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000230 Ops);
231}
232
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000233DIDerivedType *DIDerivedType::getImpl(
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000234 LLVMContext &Context, unsigned Tag, MDString *Name, Metadata *File,
Duncan P. N. Exon Smithd34db172015-02-19 23:56:07 +0000235 unsigned Line, Metadata *Scope, Metadata *BaseType, uint64_t SizeInBits,
236 uint64_t AlignInBits, uint64_t OffsetInBits, unsigned Flags,
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000237 Metadata *ExtraData, StorageType Storage, bool ShouldCreate) {
238 assert(isCanonical(Name) && "Expected canonical MDString");
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000239 DEFINE_GETIMPL_LOOKUP(DIDerivedType,
240 (Tag, Name, File, Line, Scope, BaseType, SizeInBits,
241 AlignInBits, OffsetInBits, Flags, ExtraData));
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000242 Metadata *Ops[] = {File, Scope, Name, BaseType, ExtraData};
243 DEFINE_GETIMPL_STORE(
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000244 DIDerivedType, (Tag, Line, SizeInBits, AlignInBits, OffsetInBits, Flags),
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000245 Ops);
246}
247
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000248DICompositeType *DICompositeType::getImpl(
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000249 LLVMContext &Context, unsigned Tag, MDString *Name, Metadata *File,
Duncan P. N. Exon Smithd34db172015-02-19 23:56:07 +0000250 unsigned Line, Metadata *Scope, Metadata *BaseType, uint64_t SizeInBits,
251 uint64_t AlignInBits, uint64_t OffsetInBits, unsigned Flags,
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000252 Metadata *Elements, unsigned RuntimeLang, Metadata *VTableHolder,
253 Metadata *TemplateParams, MDString *Identifier, StorageType Storage,
254 bool ShouldCreate) {
255 assert(isCanonical(Name) && "Expected canonical MDString");
Duncan P. N. Exon Smith5ab2be02016-04-17 03:58:21 +0000256
Duncan P. N. Exon Smith97386022016-04-19 18:00:19 +0000257 // Keep this in sync with buildODRType.
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000258 DEFINE_GETIMPL_LOOKUP(
259 DICompositeType, (Tag, Name, File, Line, Scope, BaseType, SizeInBits,
260 AlignInBits, OffsetInBits, Flags, Elements, RuntimeLang,
261 VTableHolder, TemplateParams, Identifier));
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000262 Metadata *Ops[] = {File, Scope, Name, BaseType,
263 Elements, VTableHolder, TemplateParams, Identifier};
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000264 DEFINE_GETIMPL_STORE(DICompositeType, (Tag, Line, RuntimeLang, SizeInBits,
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000265 AlignInBits, OffsetInBits, Flags),
266 Ops);
267}
268
Duncan P. N. Exon Smith97386022016-04-19 18:00:19 +0000269DICompositeType *DICompositeType::buildODRType(
270 LLVMContext &Context, MDString &Identifier, unsigned Tag, MDString *Name,
271 Metadata *File, unsigned Line, Metadata *Scope, Metadata *BaseType,
272 uint64_t SizeInBits, uint64_t AlignInBits, uint64_t OffsetInBits,
273 unsigned Flags, Metadata *Elements, unsigned RuntimeLang,
274 Metadata *VTableHolder, Metadata *TemplateParams) {
275 assert(!Identifier.getString().empty() && "Expected valid identifier");
276 if (!Context.isODRUniquingDebugTypes())
277 return nullptr;
278 auto *&CT = (*Context.pImpl->DITypeMap)[&Identifier];
279 if (!CT)
280 return CT = DICompositeType::getDistinct(
281 Context, Tag, Name, File, Line, Scope, BaseType, SizeInBits,
282 AlignInBits, OffsetInBits, Flags, Elements, RuntimeLang,
283 VTableHolder, TemplateParams, &Identifier);
284
285 // Only mutate CT if it's a forward declaration and the new operands aren't.
286 assert(CT->getRawIdentifier() == &Identifier && "Wrong ODR identifier?");
287 if (!CT->isForwardDecl() || (Flags & DINode::FlagFwdDecl))
288 return CT;
289
290 // Mutate CT in place. Keep this in sync with getImpl.
291 CT->mutate(Tag, Line, RuntimeLang, SizeInBits, AlignInBits, OffsetInBits,
292 Flags);
293 Metadata *Ops[] = {File, Scope, Name, BaseType,
294 Elements, VTableHolder, TemplateParams, &Identifier};
Simon Pilgrim1ec7dc72016-05-02 16:45:02 +0000295 assert((std::end(Ops) - std::begin(Ops)) == (int)CT->getNumOperands() &&
Duncan P. N. Exon Smith97386022016-04-19 18:00:19 +0000296 "Mismatched number of operands");
297 for (unsigned I = 0, E = CT->getNumOperands(); I != E; ++I)
298 if (Ops[I] != CT->getOperand(I))
299 CT->setOperand(I, Ops[I]);
300 return CT;
301}
302
Duncan P. N. Exon Smith0b0271e2016-04-19 14:55:09 +0000303DICompositeType *DICompositeType::getODRType(
304 LLVMContext &Context, MDString &Identifier, unsigned Tag, MDString *Name,
305 Metadata *File, unsigned Line, Metadata *Scope, Metadata *BaseType,
306 uint64_t SizeInBits, uint64_t AlignInBits, uint64_t OffsetInBits,
307 unsigned Flags, Metadata *Elements, unsigned RuntimeLang,
308 Metadata *VTableHolder, Metadata *TemplateParams) {
309 assert(!Identifier.getString().empty() && "Expected valid identifier");
310 if (!Context.isODRUniquingDebugTypes())
311 return nullptr;
312 auto *&CT = (*Context.pImpl->DITypeMap)[&Identifier];
313 if (!CT)
314 CT = DICompositeType::getDistinct(
315 Context, Tag, Name, File, Line, Scope, BaseType, SizeInBits,
316 AlignInBits, OffsetInBits, Flags, Elements, RuntimeLang, VTableHolder,
317 TemplateParams, &Identifier);
318 return CT;
319}
320
321DICompositeType *DICompositeType::getODRTypeIfExists(LLVMContext &Context,
322 MDString &Identifier) {
323 assert(!Identifier.getString().empty() && "Expected valid identifier");
324 if (!Context.isODRUniquingDebugTypes())
325 return nullptr;
326 return Context.pImpl->DITypeMap->lookup(&Identifier);
327}
328
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000329DISubroutineType *DISubroutineType::getImpl(LLVMContext &Context,
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000330 unsigned Flags, Metadata *TypeArray,
331 StorageType Storage,
332 bool ShouldCreate) {
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000333 DEFINE_GETIMPL_LOOKUP(DISubroutineType, (Flags, TypeArray));
Duncan P. N. Exon Smithb9e045a2015-07-24 20:56:36 +0000334 Metadata *Ops[] = {nullptr, nullptr, nullptr, TypeArray};
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000335 DEFINE_GETIMPL_STORE(DISubroutineType, (Flags), Ops);
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000336}
337
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000338DIFile *DIFile::getImpl(LLVMContext &Context, MDString *Filename,
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000339 MDString *Directory, StorageType Storage,
340 bool ShouldCreate) {
341 assert(isCanonical(Filename) && "Expected canonical MDString");
342 assert(isCanonical(Directory) && "Expected canonical MDString");
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000343 DEFINE_GETIMPL_LOOKUP(DIFile, (Filename, Directory));
Duncan P. N. Exon Smitha5c57cc2015-02-20 20:35:17 +0000344 Metadata *Ops[] = {Filename, Directory};
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000345 DEFINE_GETIMPL_STORE_NO_CONSTRUCTOR_ARGS(DIFile, Ops);
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000346}
347
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000348DICompileUnit *DICompileUnit::getImpl(
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000349 LLVMContext &Context, unsigned SourceLanguage, Metadata *File,
350 MDString *Producer, bool IsOptimized, MDString *Flags,
351 unsigned RuntimeVersion, MDString *SplitDebugFilename,
352 unsigned EmissionKind, Metadata *EnumTypes, Metadata *RetainedTypes,
Adrian Prantl75819ae2016-04-15 15:57:41 +0000353 Metadata *GlobalVariables, Metadata *ImportedEntities, Metadata *Macros,
354 uint64_t DWOId, StorageType Storage, bool ShouldCreate) {
Duncan P. N. Exon Smith55ca9642015-08-03 17:26:41 +0000355 assert(Storage != Uniqued && "Cannot unique DICompileUnit");
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000356 assert(isCanonical(Producer) && "Expected canonical MDString");
357 assert(isCanonical(Flags) && "Expected canonical MDString");
358 assert(isCanonical(SplitDebugFilename) && "Expected canonical MDString");
Duncan P. N. Exon Smith55ca9642015-08-03 17:26:41 +0000359
Adrian Prantl75819ae2016-04-15 15:57:41 +0000360 Metadata *Ops[] = {
361 File, Producer, Flags, SplitDebugFilename,
362 EnumTypes, RetainedTypes, GlobalVariables, ImportedEntities,
363 Macros};
David Blaikie6662d6a2016-04-13 17:42:56 +0000364 return storeImpl(new (array_lengthof(Ops)) DICompileUnit(
Duncan P. N. Exon Smith55ca9642015-08-03 17:26:41 +0000365 Context, Storage, SourceLanguage, IsOptimized,
366 RuntimeVersion, EmissionKind, DWOId, Ops),
367 Storage);
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000368}
369
Adrian Prantlb939a252016-03-31 23:56:58 +0000370Optional<DICompileUnit::DebugEmissionKind>
371DICompileUnit::getEmissionKind(StringRef Str) {
372 return StringSwitch<Optional<DebugEmissionKind>>(Str)
373 .Case("NoDebug", NoDebug)
374 .Case("FullDebug", FullDebug)
375 .Case("LineTablesOnly", LineTablesOnly)
376 .Default(None);
377}
378
379const char *DICompileUnit::EmissionKindString(DebugEmissionKind EK) {
380 switch (EK) {
381 case NoDebug: return "NoDebug";
382 case FullDebug: return "FullDebug";
383 case LineTablesOnly: return "LineTablesOnly";
384 }
385 return nullptr;
386}
387
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000388DISubprogram *DILocalScope::getSubprogram() const {
389 if (auto *Block = dyn_cast<DILexicalBlockBase>(this))
Duncan P. N. Exon Smithfd07a2a2015-03-30 21:32:28 +0000390 return Block->getScope()->getSubprogram();
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000391 return const_cast<DISubprogram *>(cast<DISubprogram>(this));
Duncan P. N. Exon Smithfd07a2a2015-03-30 21:32:28 +0000392}
393
Amjad Abouda5ba9912016-04-21 16:58:49 +0000394DILocalScope *DILocalScope::getNonLexicalBlockFileScope() const {
395 if (auto *File = dyn_cast<DILexicalBlockFile>(this))
396 return File->getScope()->getNonLexicalBlockFileScope();
397 return const_cast<DILocalScope *>(this);
398}
399
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000400DISubprogram *DISubprogram::getImpl(
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000401 LLVMContext &Context, Metadata *Scope, MDString *Name,
402 MDString *LinkageName, Metadata *File, unsigned Line, Metadata *Type,
403 bool IsLocalToUnit, bool IsDefinition, unsigned ScopeLine,
404 Metadata *ContainingType, unsigned Virtuality, unsigned VirtualIndex,
Adrian Prantl75819ae2016-04-15 15:57:41 +0000405 unsigned Flags, bool IsOptimized, Metadata *Unit, Metadata *TemplateParams,
Peter Collingbourned4bff302015-11-05 22:03:56 +0000406 Metadata *Declaration, Metadata *Variables, StorageType Storage,
407 bool ShouldCreate) {
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000408 assert(isCanonical(Name) && "Expected canonical MDString");
409 assert(isCanonical(LinkageName) && "Expected canonical MDString");
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000410 DEFINE_GETIMPL_LOOKUP(DISubprogram,
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000411 (Scope, Name, LinkageName, File, Line, Type,
412 IsLocalToUnit, IsDefinition, ScopeLine, ContainingType,
Adrian Prantl75819ae2016-04-15 15:57:41 +0000413 Virtuality, VirtualIndex, Flags, IsOptimized, Unit,
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000414 TemplateParams, Declaration, Variables));
Adrian Prantl75819ae2016-04-15 15:57:41 +0000415 Metadata *Ops[] = {File, Scope, Name, Name,
416 LinkageName, Type, ContainingType, Unit,
417 TemplateParams, Declaration, Variables};
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000418 DEFINE_GETIMPL_STORE(DISubprogram,
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000419 (Line, ScopeLine, Virtuality, VirtualIndex, Flags,
420 IsLocalToUnit, IsDefinition, IsOptimized),
421 Ops);
422}
423
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000424bool DISubprogram::describes(const Function *F) const {
Duncan P. N. Exon Smith3c2d7042015-04-13 19:07:27 +0000425 assert(F && "Invalid function");
Peter Collingbourned4bff302015-11-05 22:03:56 +0000426 if (F->getSubprogram() == this)
Duncan P. N. Exon Smith3c2d7042015-04-13 19:07:27 +0000427 return true;
428 StringRef Name = getLinkageName();
429 if (Name.empty())
430 Name = getName();
431 return F->getName() == Name;
432}
433
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000434DILexicalBlock *DILexicalBlock::getImpl(LLVMContext &Context, Metadata *Scope,
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000435 Metadata *File, unsigned Line,
436 unsigned Column, StorageType Storage,
437 bool ShouldCreate) {
Duncan P. N. Exon Smithb09eb9f2015-08-28 22:58:50 +0000438 // Fixup column.
439 adjustColumn(Column);
440
Duncan P. N. Exon Smith0e202b92015-03-30 16:37:48 +0000441 assert(Scope && "Expected scope");
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000442 DEFINE_GETIMPL_LOOKUP(DILexicalBlock, (Scope, File, Line, Column));
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000443 Metadata *Ops[] = {File, Scope};
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000444 DEFINE_GETIMPL_STORE(DILexicalBlock, (Line, Column), Ops);
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000445}
446
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000447DILexicalBlockFile *DILexicalBlockFile::getImpl(LLVMContext &Context,
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000448 Metadata *Scope, Metadata *File,
449 unsigned Discriminator,
450 StorageType Storage,
451 bool ShouldCreate) {
Duncan P. N. Exon Smith0e202b92015-03-30 16:37:48 +0000452 assert(Scope && "Expected scope");
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000453 DEFINE_GETIMPL_LOOKUP(DILexicalBlockFile, (Scope, File, Discriminator));
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000454 Metadata *Ops[] = {File, Scope};
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000455 DEFINE_GETIMPL_STORE(DILexicalBlockFile, (Discriminator), Ops);
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000456}
457
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000458DINamespace *DINamespace::getImpl(LLVMContext &Context, Metadata *Scope,
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000459 Metadata *File, MDString *Name, unsigned Line,
460 StorageType Storage, bool ShouldCreate) {
461 assert(isCanonical(Name) && "Expected canonical MDString");
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000462 DEFINE_GETIMPL_LOOKUP(DINamespace, (Scope, File, Name, Line));
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000463 Metadata *Ops[] = {File, Scope, Name};
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000464 DEFINE_GETIMPL_STORE(DINamespace, (Line), Ops);
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000465}
466
Adrian Prantlab1243f2015-06-29 23:03:47 +0000467DIModule *DIModule::getImpl(LLVMContext &Context, Metadata *Scope,
468 MDString *Name, MDString *ConfigurationMacros,
469 MDString *IncludePath, MDString *ISysRoot,
470 StorageType Storage, bool ShouldCreate) {
471 assert(isCanonical(Name) && "Expected canonical MDString");
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000472 DEFINE_GETIMPL_LOOKUP(
473 DIModule, (Scope, Name, ConfigurationMacros, IncludePath, ISysRoot));
Adrian Prantlab1243f2015-06-29 23:03:47 +0000474 Metadata *Ops[] = {Scope, Name, ConfigurationMacros, IncludePath, ISysRoot};
475 DEFINE_GETIMPL_STORE_NO_CONSTRUCTOR_ARGS(DIModule, Ops);
476}
477
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000478DITemplateTypeParameter *DITemplateTypeParameter::getImpl(LLVMContext &Context,
Duncan P. N. Exon Smith3d62bba2015-02-19 00:37:21 +0000479 MDString *Name,
480 Metadata *Type,
481 StorageType Storage,
482 bool ShouldCreate) {
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000483 assert(isCanonical(Name) && "Expected canonical MDString");
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000484 DEFINE_GETIMPL_LOOKUP(DITemplateTypeParameter, (Name, Type));
Duncan P. N. Exon Smith3d62bba2015-02-19 00:37:21 +0000485 Metadata *Ops[] = {Name, Type};
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000486 DEFINE_GETIMPL_STORE_NO_CONSTRUCTOR_ARGS(DITemplateTypeParameter, Ops);
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000487}
488
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000489DITemplateValueParameter *DITemplateValueParameter::getImpl(
Duncan P. N. Exon Smith3d62bba2015-02-19 00:37:21 +0000490 LLVMContext &Context, unsigned Tag, MDString *Name, Metadata *Type,
491 Metadata *Value, StorageType Storage, bool ShouldCreate) {
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000492 assert(isCanonical(Name) && "Expected canonical MDString");
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000493 DEFINE_GETIMPL_LOOKUP(DITemplateValueParameter, (Tag, Name, Type, Value));
Duncan P. N. Exon Smith3d62bba2015-02-19 00:37:21 +0000494 Metadata *Ops[] = {Name, Type, Value};
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000495 DEFINE_GETIMPL_STORE(DITemplateValueParameter, (Tag), Ops);
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000496}
497
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000498DIGlobalVariable *
499DIGlobalVariable::getImpl(LLVMContext &Context, Metadata *Scope, MDString *Name,
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000500 MDString *LinkageName, Metadata *File, unsigned Line,
501 Metadata *Type, bool IsLocalToUnit, bool IsDefinition,
502 Metadata *Variable,
503 Metadata *StaticDataMemberDeclaration,
504 StorageType Storage, bool ShouldCreate) {
505 assert(isCanonical(Name) && "Expected canonical MDString");
506 assert(isCanonical(LinkageName) && "Expected canonical MDString");
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000507 DEFINE_GETIMPL_LOOKUP(DIGlobalVariable,
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000508 (Scope, Name, LinkageName, File, Line, Type,
509 IsLocalToUnit, IsDefinition, Variable,
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000510 StaticDataMemberDeclaration));
511 Metadata *Ops[] = {Scope, Name, File, Type,
512 Name, LinkageName, Variable, StaticDataMemberDeclaration};
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000513 DEFINE_GETIMPL_STORE(DIGlobalVariable, (Line, IsLocalToUnit, IsDefinition),
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000514 Ops);
515}
516
Duncan P. N. Exon Smithed013cd2015-07-31 18:58:39 +0000517DILocalVariable *DILocalVariable::getImpl(LLVMContext &Context, Metadata *Scope,
518 MDString *Name, Metadata *File,
519 unsigned Line, Metadata *Type,
520 unsigned Arg, unsigned Flags,
521 StorageType Storage,
Duncan P. N. Exon Smith62e0f452015-04-15 22:29:27 +0000522 bool ShouldCreate) {
Duncan P. N. Exon Smith1ec75ae2015-04-28 01:07:33 +0000523 // 64K ought to be enough for any frontend.
524 assert(Arg <= UINT16_MAX && "Expected argument number to fit in 16-bits");
Duncan P. N. Exon Smith72fe2d02015-02-13 01:39:44 +0000525
Duncan P. N. Exon Smithe2c61d92015-03-27 17:56:39 +0000526 assert(Scope && "Expected scope");
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000527 assert(isCanonical(Name) && "Expected canonical MDString");
Duncan P. N. Exon Smithed013cd2015-07-31 18:58:39 +0000528 DEFINE_GETIMPL_LOOKUP(DILocalVariable,
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000529 (Scope, Name, File, Line, Type, Arg, Flags));
Duncan P. N. Exon Smith62e0f452015-04-15 22:29:27 +0000530 Metadata *Ops[] = {Scope, Name, File, Type};
Duncan P. N. Exon Smithed013cd2015-07-31 18:58:39 +0000531 DEFINE_GETIMPL_STORE(DILocalVariable, (Line, Arg, Flags), Ops);
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000532}
533
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000534DIExpression *DIExpression::getImpl(LLVMContext &Context,
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000535 ArrayRef<uint64_t> Elements,
536 StorageType Storage, bool ShouldCreate) {
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000537 DEFINE_GETIMPL_LOOKUP(DIExpression, (Elements));
538 DEFINE_GETIMPL_STORE_NO_OPS(DIExpression, (Elements));
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000539}
540
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000541unsigned DIExpression::ExprOperand::getSize() const {
Duncan P. N. Exon Smith193a4fd2015-02-13 01:07:46 +0000542 switch (getOp()) {
543 case dwarf::DW_OP_bit_piece:
544 return 3;
545 case dwarf::DW_OP_plus:
Evgeniy Stepanovf6081112015-09-30 19:55:43 +0000546 case dwarf::DW_OP_minus:
Duncan P. N. Exon Smith193a4fd2015-02-13 01:07:46 +0000547 return 2;
548 default:
549 return 1;
550 }
551}
552
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000553bool DIExpression::isValid() const {
Duncan P. N. Exon Smith193a4fd2015-02-13 01:07:46 +0000554 for (auto I = expr_op_begin(), E = expr_op_end(); I != E; ++I) {
555 // Check that there's space for the operand.
556 if (I->get() + I->getSize() > E->get())
557 return false;
558
559 // Check that the operand is valid.
560 switch (I->getOp()) {
561 default:
562 return false;
563 case dwarf::DW_OP_bit_piece:
564 // Piece expressions must be at the end.
565 return I->get() + I->getSize() == E->get();
566 case dwarf::DW_OP_plus:
Evgeniy Stepanovf6081112015-09-30 19:55:43 +0000567 case dwarf::DW_OP_minus:
Duncan P. N. Exon Smith193a4fd2015-02-13 01:07:46 +0000568 case dwarf::DW_OP_deref:
569 break;
570 }
571 }
572 return true;
573}
574
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000575bool DIExpression::isBitPiece() const {
Duncan P. N. Exon Smith86cc3322015-04-07 03:49:59 +0000576 assert(isValid() && "Expected valid expression");
577 if (unsigned N = getNumElements())
578 if (N >= 3)
579 return getElement(N - 3) == dwarf::DW_OP_bit_piece;
580 return false;
581}
582
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000583uint64_t DIExpression::getBitPieceOffset() const {
Duncan P. N. Exon Smith86cc3322015-04-07 03:49:59 +0000584 assert(isBitPiece() && "Expected bit piece");
585 return getElement(getNumElements() - 2);
586}
587
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000588uint64_t DIExpression::getBitPieceSize() const {
Duncan P. N. Exon Smith86cc3322015-04-07 03:49:59 +0000589 assert(isBitPiece() && "Expected bit piece");
590 return getElement(getNumElements() - 1);
591}
592
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000593DIObjCProperty *DIObjCProperty::getImpl(
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000594 LLVMContext &Context, MDString *Name, Metadata *File, unsigned Line,
595 MDString *GetterName, MDString *SetterName, unsigned Attributes,
596 Metadata *Type, StorageType Storage, bool ShouldCreate) {
597 assert(isCanonical(Name) && "Expected canonical MDString");
598 assert(isCanonical(GetterName) && "Expected canonical MDString");
599 assert(isCanonical(SetterName) && "Expected canonical MDString");
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000600 DEFINE_GETIMPL_LOOKUP(DIObjCProperty, (Name, File, Line, GetterName,
601 SetterName, Attributes, Type));
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000602 Metadata *Ops[] = {Name, File, GetterName, SetterName, Type};
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000603 DEFINE_GETIMPL_STORE(DIObjCProperty, (Line, Attributes), Ops);
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000604}
605
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000606DIImportedEntity *DIImportedEntity::getImpl(LLVMContext &Context, unsigned Tag,
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000607 Metadata *Scope, Metadata *Entity,
608 unsigned Line, MDString *Name,
609 StorageType Storage,
610 bool ShouldCreate) {
611 assert(isCanonical(Name) && "Expected canonical MDString");
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000612 DEFINE_GETIMPL_LOOKUP(DIImportedEntity, (Tag, Scope, Entity, Line, Name));
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000613 Metadata *Ops[] = {Scope, Entity, Name};
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000614 DEFINE_GETIMPL_STORE(DIImportedEntity, (Tag, Line), Ops);
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000615}
Amjad Abouda9bcf162015-12-10 12:56:35 +0000616
617DIMacro *DIMacro::getImpl(LLVMContext &Context, unsigned MIType,
618 unsigned Line, MDString *Name, MDString *Value,
619 StorageType Storage, bool ShouldCreate) {
620 assert(isCanonical(Name) && "Expected canonical MDString");
Mehdi Amini5d99c4e2016-03-19 01:02:34 +0000621 DEFINE_GETIMPL_LOOKUP(DIMacro, (MIType, Line, Name, Value));
Amjad Abouda9bcf162015-12-10 12:56:35 +0000622 Metadata *Ops[] = { Name, Value };
623 DEFINE_GETIMPL_STORE(DIMacro, (MIType, Line), Ops);
624}
625
626DIMacroFile *DIMacroFile::getImpl(LLVMContext &Context, unsigned MIType,
627 unsigned Line, Metadata *File,
628 Metadata *Elements, StorageType Storage,
629 bool ShouldCreate) {
630 DEFINE_GETIMPL_LOOKUP(DIMacroFile,
631 (MIType, Line, File, Elements));
632 Metadata *Ops[] = { File, Elements };
633 DEFINE_GETIMPL_STORE(DIMacroFile, (MIType, Line), Ops);
634}
635