blob: 89ec1bc9a9f59da153d95243e2757873707530c7 [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 Smithdf523492015-02-18 20:32:57 +000017#include "llvm/IR/Function.h"
Duncan P. N. Exon Smithd9901ff2015-02-02 18:53:21 +000018
19using namespace llvm;
20
21MDLocation::MDLocation(LLVMContext &C, StorageType Storage, unsigned Line,
22 unsigned Column, ArrayRef<Metadata *> MDs)
23 : MDNode(C, MDLocationKind, Storage, MDs) {
24 assert((MDs.size() == 1 || MDs.size() == 2) &&
25 "Expected a scope and optional inlined-at");
26
27 // Set line and column.
Duncan P. N. Exon Smithd9901ff2015-02-02 18:53:21 +000028 assert(Column < (1u << 16) && "Expected 16-bit column");
29
30 SubclassData32 = Line;
31 SubclassData16 = Column;
32}
33
Duncan P. N. Exon Smithd9901ff2015-02-02 18:53:21 +000034static void adjustColumn(unsigned &Column) {
35 // Set to unknown on overflow. We only have 16 bits to play with here.
36 if (Column >= (1u << 16))
37 Column = 0;
38}
39
40MDLocation *MDLocation::getImpl(LLVMContext &Context, unsigned Line,
41 unsigned Column, Metadata *Scope,
42 Metadata *InlinedAt, StorageType Storage,
43 bool ShouldCreate) {
Duncan P. N. Exon Smithaf677eb2015-02-06 22:50:13 +000044 // Fixup column.
Duncan P. N. Exon Smithd9901ff2015-02-02 18:53:21 +000045 adjustColumn(Column);
46
47 if (Storage == Uniqued) {
48 if (auto *N =
49 getUniqued(Context.pImpl->MDLocations,
50 MDLocationInfo::KeyTy(Line, Column, Scope, InlinedAt)))
51 return N;
52 if (!ShouldCreate)
53 return nullptr;
54 } else {
55 assert(ShouldCreate && "Expected non-uniqued nodes to always be created");
56 }
57
58 SmallVector<Metadata *, 2> Ops;
59 Ops.push_back(Scope);
60 if (InlinedAt)
61 Ops.push_back(InlinedAt);
62 return storeImpl(new (Ops.size())
63 MDLocation(Context, Storage, Line, Column, Ops),
64 Storage, Context.pImpl->MDLocations);
65}
66
Duncan P. N. Exon Smith9146fc82015-02-02 20:01:03 +000067static StringRef getString(const MDString *S) {
68 if (S)
69 return S->getString();
70 return StringRef();
71}
72
Duncan P. N. Exon Smithc7e08132015-02-02 20:20:56 +000073#ifndef NDEBUG
Duncan P. N. Exon Smith9146fc82015-02-02 20:01:03 +000074static bool isCanonical(const MDString *S) {
75 return !S || !S->getString().empty();
Duncan P. N. Exon Smith442ec022015-02-02 19:54:05 +000076}
Duncan P. N. Exon Smithc7e08132015-02-02 20:20:56 +000077#endif
Duncan P. N. Exon Smith442ec022015-02-02 19:54:05 +000078
Duncan P. N. Exon Smithd9901ff2015-02-02 18:53:21 +000079GenericDebugNode *GenericDebugNode::getImpl(LLVMContext &Context, unsigned Tag,
Duncan P. N. Exon Smith9146fc82015-02-02 20:01:03 +000080 MDString *Header,
Duncan P. N. Exon Smithd9901ff2015-02-02 18:53:21 +000081 ArrayRef<Metadata *> DwarfOps,
82 StorageType Storage,
83 bool ShouldCreate) {
84 unsigned Hash = 0;
85 if (Storage == Uniqued) {
Duncan P. N. Exon Smith9146fc82015-02-02 20:01:03 +000086 GenericDebugNodeInfo::KeyTy Key(Tag, getString(Header), DwarfOps);
Duncan P. N. Exon Smithd9901ff2015-02-02 18:53:21 +000087 if (auto *N = getUniqued(Context.pImpl->GenericDebugNodes, Key))
88 return N;
89 if (!ShouldCreate)
90 return nullptr;
91 Hash = Key.getHash();
92 } else {
93 assert(ShouldCreate && "Expected non-uniqued nodes to always be created");
94 }
95
96 // Use a nullptr for empty headers.
Duncan P. N. Exon Smith9146fc82015-02-02 20:01:03 +000097 assert(isCanonical(Header) && "Expected canonical MDString");
98 Metadata *PreOps[] = {Header};
Duncan P. N. Exon Smithd9901ff2015-02-02 18:53:21 +000099 return storeImpl(new (DwarfOps.size() + 1) GenericDebugNode(
100 Context, Storage, Hash, Tag, PreOps, DwarfOps),
101 Storage, Context.pImpl->GenericDebugNodes);
102}
103
104void GenericDebugNode::recalculateHash() {
105 setHash(GenericDebugNodeInfo::KeyTy::calculateHash(this));
106}
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000107
108#define UNWRAP_ARGS_IMPL(...) __VA_ARGS__
109#define UNWRAP_ARGS(ARGS) UNWRAP_ARGS_IMPL ARGS
110#define DEFINE_GETIMPL_LOOKUP(CLASS, ARGS) \
111 do { \
112 if (Storage == Uniqued) { \
113 if (auto *N = getUniqued(Context.pImpl->CLASS##s, \
114 CLASS##Info::KeyTy(UNWRAP_ARGS(ARGS)))) \
115 return N; \
116 if (!ShouldCreate) \
117 return nullptr; \
118 } else { \
119 assert(ShouldCreate && \
120 "Expected non-uniqued nodes to always be created"); \
121 } \
122 } while (false)
123#define DEFINE_GETIMPL_STORE(CLASS, ARGS, OPS) \
124 return storeImpl(new (ArrayRef<Metadata *>(OPS).size()) \
125 CLASS(Context, Storage, UNWRAP_ARGS(ARGS), OPS), \
126 Storage, Context.pImpl->CLASS##s)
127#define DEFINE_GETIMPL_STORE_NO_OPS(CLASS, ARGS) \
128 return storeImpl(new (0u) CLASS(Context, Storage, UNWRAP_ARGS(ARGS)), \
129 Storage, Context.pImpl->CLASS##s)
Duncan P. N. Exon Smithbd33d372015-02-10 01:59:57 +0000130#define DEFINE_GETIMPL_STORE_NO_CONSTRUCTOR_ARGS(CLASS, OPS) \
131 return storeImpl(new (ArrayRef<Metadata *>(OPS).size()) \
132 CLASS(Context, Storage, OPS), \
133 Storage, Context.pImpl->CLASS##s)
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000134
135MDSubrange *MDSubrange::getImpl(LLVMContext &Context, int64_t Count, int64_t Lo,
136 StorageType Storage, bool ShouldCreate) {
137 DEFINE_GETIMPL_LOOKUP(MDSubrange, (Count, Lo));
138 DEFINE_GETIMPL_STORE_NO_OPS(MDSubrange, (Count, Lo));
139}
140
141MDEnumerator *MDEnumerator::getImpl(LLVMContext &Context, int64_t Value,
142 MDString *Name, StorageType Storage,
143 bool ShouldCreate) {
144 assert(isCanonical(Name) && "Expected canonical MDString");
145 DEFINE_GETIMPL_LOOKUP(MDEnumerator, (Value, getString(Name)));
146 Metadata *Ops[] = {Name};
147 DEFINE_GETIMPL_STORE(MDEnumerator, (Value), Ops);
148}
149
150MDBasicType *MDBasicType::getImpl(LLVMContext &Context, unsigned Tag,
Duncan P. N. Exon Smithd34db172015-02-19 23:56:07 +0000151 MDString *Name, uint64_t SizeInBits,
152 uint64_t AlignInBits, unsigned Encoding,
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000153 StorageType Storage, bool ShouldCreate) {
154 assert(isCanonical(Name) && "Expected canonical MDString");
155 DEFINE_GETIMPL_LOOKUP(
156 MDBasicType, (Tag, getString(Name), SizeInBits, AlignInBits, Encoding));
157 Metadata *Ops[] = {nullptr, nullptr, Name};
158 DEFINE_GETIMPL_STORE(MDBasicType, (Tag, SizeInBits, AlignInBits, Encoding),
159 Ops);
160}
161
162MDDerivedType *MDDerivedType::getImpl(
163 LLVMContext &Context, unsigned Tag, MDString *Name, Metadata *File,
Duncan P. N. Exon Smithd34db172015-02-19 23:56:07 +0000164 unsigned Line, Metadata *Scope, Metadata *BaseType, uint64_t SizeInBits,
165 uint64_t AlignInBits, uint64_t OffsetInBits, unsigned Flags,
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000166 Metadata *ExtraData, StorageType Storage, bool ShouldCreate) {
167 assert(isCanonical(Name) && "Expected canonical MDString");
168 DEFINE_GETIMPL_LOOKUP(MDDerivedType, (Tag, getString(Name), File, Line, Scope,
169 BaseType, SizeInBits, AlignInBits,
170 OffsetInBits, Flags, ExtraData));
171 Metadata *Ops[] = {File, Scope, Name, BaseType, ExtraData};
172 DEFINE_GETIMPL_STORE(
173 MDDerivedType, (Tag, Line, SizeInBits, AlignInBits, OffsetInBits, Flags),
174 Ops);
175}
176
177MDCompositeType *MDCompositeType::getImpl(
178 LLVMContext &Context, unsigned Tag, MDString *Name, Metadata *File,
Duncan P. N. Exon Smithd34db172015-02-19 23:56:07 +0000179 unsigned Line, Metadata *Scope, Metadata *BaseType, uint64_t SizeInBits,
180 uint64_t AlignInBits, uint64_t OffsetInBits, unsigned Flags,
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000181 Metadata *Elements, unsigned RuntimeLang, Metadata *VTableHolder,
182 Metadata *TemplateParams, MDString *Identifier, StorageType Storage,
183 bool ShouldCreate) {
184 assert(isCanonical(Name) && "Expected canonical MDString");
185 DEFINE_GETIMPL_LOOKUP(MDCompositeType,
186 (Tag, getString(Name), File, Line, Scope, BaseType,
187 SizeInBits, AlignInBits, OffsetInBits, Flags, Elements,
188 RuntimeLang, VTableHolder, TemplateParams,
189 getString(Identifier)));
190 Metadata *Ops[] = {File, Scope, Name, BaseType,
191 Elements, VTableHolder, TemplateParams, Identifier};
192 DEFINE_GETIMPL_STORE(MDCompositeType, (Tag, Line, RuntimeLang, SizeInBits,
193 AlignInBits, OffsetInBits, Flags),
194 Ops);
195}
196
197MDSubroutineType *MDSubroutineType::getImpl(LLVMContext &Context,
198 unsigned Flags, Metadata *TypeArray,
199 StorageType Storage,
200 bool ShouldCreate) {
201 DEFINE_GETIMPL_LOOKUP(MDSubroutineType, (Flags, TypeArray));
202 Metadata *Ops[] = {nullptr, nullptr, nullptr, nullptr,
Duncan P. N. Exon Smitha9f0a8d2015-02-19 23:25:21 +0000203 TypeArray, nullptr, nullptr, nullptr};
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000204 DEFINE_GETIMPL_STORE(MDSubroutineType, (Flags), Ops);
205}
206
207MDFile *MDFile::getImpl(LLVMContext &Context, MDString *Filename,
208 MDString *Directory, StorageType Storage,
209 bool ShouldCreate) {
210 assert(isCanonical(Filename) && "Expected canonical MDString");
211 assert(isCanonical(Directory) && "Expected canonical MDString");
212 DEFINE_GETIMPL_LOOKUP(MDFile, (getString(Filename), getString(Directory)));
Duncan P. N. Exon Smitha5c57cc2015-02-20 20:35:17 +0000213 Metadata *Ops[] = {Filename, Directory};
214 DEFINE_GETIMPL_STORE_NO_CONSTRUCTOR_ARGS(MDFile, Ops);
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000215}
216
217MDCompileUnit *MDCompileUnit::getImpl(
218 LLVMContext &Context, unsigned SourceLanguage, Metadata *File,
219 MDString *Producer, bool IsOptimized, MDString *Flags,
220 unsigned RuntimeVersion, MDString *SplitDebugFilename,
221 unsigned EmissionKind, Metadata *EnumTypes, Metadata *RetainedTypes,
222 Metadata *Subprograms, Metadata *GlobalVariables,
223 Metadata *ImportedEntities, StorageType Storage, bool ShouldCreate) {
224 assert(isCanonical(Producer) && "Expected canonical MDString");
225 assert(isCanonical(Flags) && "Expected canonical MDString");
226 assert(isCanonical(SplitDebugFilename) && "Expected canonical MDString");
227 DEFINE_GETIMPL_LOOKUP(
228 MDCompileUnit,
229 (SourceLanguage, File, getString(Producer), IsOptimized, getString(Flags),
230 RuntimeVersion, getString(SplitDebugFilename), EmissionKind, EnumTypes,
231 RetainedTypes, Subprograms, GlobalVariables, ImportedEntities));
232 Metadata *Ops[] = {File, Producer, Flags, SplitDebugFilename, EnumTypes,
233 RetainedTypes, Subprograms, GlobalVariables,
234 ImportedEntities};
235 DEFINE_GETIMPL_STORE(
236 MDCompileUnit,
237 (SourceLanguage, IsOptimized, RuntimeVersion, EmissionKind), Ops);
238}
239
240MDSubprogram *MDSubprogram::getImpl(
241 LLVMContext &Context, Metadata *Scope, MDString *Name,
242 MDString *LinkageName, Metadata *File, unsigned Line, Metadata *Type,
243 bool IsLocalToUnit, bool IsDefinition, unsigned ScopeLine,
244 Metadata *ContainingType, unsigned Virtuality, unsigned VirtualIndex,
245 unsigned Flags, bool IsOptimized, Metadata *Function,
246 Metadata *TemplateParams, Metadata *Declaration, Metadata *Variables,
247 StorageType Storage, bool ShouldCreate) {
248 assert(isCanonical(Name) && "Expected canonical MDString");
249 assert(isCanonical(LinkageName) && "Expected canonical MDString");
250 DEFINE_GETIMPL_LOOKUP(MDSubprogram,
251 (Scope, getString(Name), getString(LinkageName), File,
252 Line, Type, IsLocalToUnit, IsDefinition, ScopeLine,
253 ContainingType, Virtuality, VirtualIndex, Flags,
254 IsOptimized, Function, TemplateParams, Declaration,
255 Variables));
256 Metadata *Ops[] = {File, Scope, Name, Name,
257 LinkageName, Type, ContainingType, Function,
258 TemplateParams, Declaration, Variables};
259 DEFINE_GETIMPL_STORE(MDSubprogram,
260 (Line, ScopeLine, Virtuality, VirtualIndex, Flags,
261 IsLocalToUnit, IsDefinition, IsOptimized),
262 Ops);
263}
264
Duncan P. N. Exon Smithdf523492015-02-18 20:32:57 +0000265void MDSubprogram::replaceFunction(Function *F) {
266 replaceFunction(F ? ConstantAsMetadata::get(F)
267 : static_cast<ConstantAsMetadata *>(nullptr));
268}
269
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000270MDLexicalBlock *MDLexicalBlock::getImpl(LLVMContext &Context, Metadata *Scope,
271 Metadata *File, unsigned Line,
272 unsigned Column, StorageType Storage,
273 bool ShouldCreate) {
274 DEFINE_GETIMPL_LOOKUP(MDLexicalBlock, (Scope, File, Line, Column));
275 Metadata *Ops[] = {File, Scope};
276 DEFINE_GETIMPL_STORE(MDLexicalBlock, (Line, Column), Ops);
277}
278
279MDLexicalBlockFile *MDLexicalBlockFile::getImpl(LLVMContext &Context,
280 Metadata *Scope, Metadata *File,
281 unsigned Discriminator,
282 StorageType Storage,
283 bool ShouldCreate) {
284 DEFINE_GETIMPL_LOOKUP(MDLexicalBlockFile, (Scope, File, Discriminator));
285 Metadata *Ops[] = {File, Scope};
286 DEFINE_GETIMPL_STORE(MDLexicalBlockFile, (Discriminator), Ops);
287}
288
289MDNamespace *MDNamespace::getImpl(LLVMContext &Context, Metadata *Scope,
290 Metadata *File, MDString *Name, unsigned Line,
291 StorageType Storage, bool ShouldCreate) {
292 assert(isCanonical(Name) && "Expected canonical MDString");
293 DEFINE_GETIMPL_LOOKUP(MDNamespace, (Scope, File, getString(Name), Line));
294 Metadata *Ops[] = {File, Scope, Name};
295 DEFINE_GETIMPL_STORE(MDNamespace, (Line), Ops);
296}
297
Duncan P. N. Exon Smith3d62bba2015-02-19 00:37:21 +0000298MDTemplateTypeParameter *MDTemplateTypeParameter::getImpl(LLVMContext &Context,
299 MDString *Name,
300 Metadata *Type,
301 StorageType Storage,
302 bool ShouldCreate) {
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000303 assert(isCanonical(Name) && "Expected canonical MDString");
Duncan P. N. Exon Smith3d62bba2015-02-19 00:37:21 +0000304 DEFINE_GETIMPL_LOOKUP(MDTemplateTypeParameter, (getString(Name), Type));
305 Metadata *Ops[] = {Name, Type};
Duncan P. N. Exon Smithbd33d372015-02-10 01:59:57 +0000306 DEFINE_GETIMPL_STORE_NO_CONSTRUCTOR_ARGS(MDTemplateTypeParameter, Ops);
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000307}
308
309MDTemplateValueParameter *MDTemplateValueParameter::getImpl(
Duncan P. N. Exon Smith3d62bba2015-02-19 00:37:21 +0000310 LLVMContext &Context, unsigned Tag, MDString *Name, Metadata *Type,
311 Metadata *Value, StorageType Storage, bool ShouldCreate) {
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000312 assert(isCanonical(Name) && "Expected canonical MDString");
Duncan P. N. Exon Smithbd33d372015-02-10 01:59:57 +0000313 DEFINE_GETIMPL_LOOKUP(MDTemplateValueParameter,
Duncan P. N. Exon Smith3d62bba2015-02-19 00:37:21 +0000314 (Tag, getString(Name), Type, Value));
315 Metadata *Ops[] = {Name, Type, Value};
Duncan P. N. Exon Smithbd33d372015-02-10 01:59:57 +0000316 DEFINE_GETIMPL_STORE(MDTemplateValueParameter, (Tag), Ops);
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000317}
318
319MDGlobalVariable *
320MDGlobalVariable::getImpl(LLVMContext &Context, Metadata *Scope, MDString *Name,
321 MDString *LinkageName, Metadata *File, unsigned Line,
322 Metadata *Type, bool IsLocalToUnit, bool IsDefinition,
323 Metadata *Variable,
324 Metadata *StaticDataMemberDeclaration,
325 StorageType Storage, bool ShouldCreate) {
326 assert(isCanonical(Name) && "Expected canonical MDString");
327 assert(isCanonical(LinkageName) && "Expected canonical MDString");
328 DEFINE_GETIMPL_LOOKUP(MDGlobalVariable,
329 (Scope, getString(Name), getString(LinkageName), File,
330 Line, Type, IsLocalToUnit, IsDefinition, Variable,
331 StaticDataMemberDeclaration));
332 Metadata *Ops[] = {Scope, Name, File, Type,
333 Name, LinkageName, Variable, StaticDataMemberDeclaration};
334 DEFINE_GETIMPL_STORE(MDGlobalVariable, (Line, IsLocalToUnit, IsDefinition),
335 Ops);
336}
337
338MDLocalVariable *MDLocalVariable::getImpl(
339 LLVMContext &Context, unsigned Tag, Metadata *Scope, MDString *Name,
340 Metadata *File, unsigned Line, Metadata *Type, unsigned Arg, unsigned Flags,
341 Metadata *InlinedAt, StorageType Storage, bool ShouldCreate) {
Duncan P. N. Exon Smith72fe2d02015-02-13 01:39:44 +0000342 // Truncate Arg to 8 bits.
343 //
344 // FIXME: This is gross (and should be changed to an assert or removed), but
345 // it matches historical behaviour for now.
346 Arg &= (1u << 8) - 1;
347
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000348 assert(isCanonical(Name) && "Expected canonical MDString");
349 DEFINE_GETIMPL_LOOKUP(MDLocalVariable, (Tag, Scope, getString(Name), File,
350 Line, Type, Arg, Flags, InlinedAt));
351 Metadata *Ops[] = {Scope, Name, File, Type, InlinedAt};
352 DEFINE_GETIMPL_STORE(MDLocalVariable, (Tag, Line, Arg, Flags), Ops);
353}
354
355MDExpression *MDExpression::getImpl(LLVMContext &Context,
356 ArrayRef<uint64_t> Elements,
357 StorageType Storage, bool ShouldCreate) {
358 DEFINE_GETIMPL_LOOKUP(MDExpression, (Elements));
359 DEFINE_GETIMPL_STORE_NO_OPS(MDExpression, (Elements));
360}
361
Duncan P. N. Exon Smith193a4fd2015-02-13 01:07:46 +0000362unsigned MDExpression::ExprOperand::getSize() const {
363 switch (getOp()) {
364 case dwarf::DW_OP_bit_piece:
365 return 3;
366 case dwarf::DW_OP_plus:
367 return 2;
368 default:
369 return 1;
370 }
371}
372
373bool MDExpression::isValid() const {
374 for (auto I = expr_op_begin(), E = expr_op_end(); I != E; ++I) {
375 // Check that there's space for the operand.
376 if (I->get() + I->getSize() > E->get())
377 return false;
378
379 // Check that the operand is valid.
380 switch (I->getOp()) {
381 default:
382 return false;
383 case dwarf::DW_OP_bit_piece:
384 // Piece expressions must be at the end.
385 return I->get() + I->getSize() == E->get();
386 case dwarf::DW_OP_plus:
387 case dwarf::DW_OP_deref:
388 break;
389 }
390 }
391 return true;
392}
393
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000394MDObjCProperty *MDObjCProperty::getImpl(
395 LLVMContext &Context, MDString *Name, Metadata *File, unsigned Line,
396 MDString *GetterName, MDString *SetterName, unsigned Attributes,
397 Metadata *Type, StorageType Storage, bool ShouldCreate) {
398 assert(isCanonical(Name) && "Expected canonical MDString");
399 assert(isCanonical(GetterName) && "Expected canonical MDString");
400 assert(isCanonical(SetterName) && "Expected canonical MDString");
401 DEFINE_GETIMPL_LOOKUP(MDObjCProperty,
402 (getString(Name), File, Line, getString(GetterName),
403 getString(SetterName), Attributes, Type));
404 Metadata *Ops[] = {Name, File, GetterName, SetterName, Type};
405 DEFINE_GETIMPL_STORE(MDObjCProperty, (Line, Attributes), Ops);
406}
407
408MDImportedEntity *MDImportedEntity::getImpl(LLVMContext &Context, unsigned Tag,
409 Metadata *Scope, Metadata *Entity,
410 unsigned Line, MDString *Name,
411 StorageType Storage,
412 bool ShouldCreate) {
413 assert(isCanonical(Name) && "Expected canonical MDString");
414 DEFINE_GETIMPL_LOOKUP(MDImportedEntity,
415 (Tag, Scope, Entity, Line, getString(Name)));
416 Metadata *Ops[] = {Scope, Entity, Name};
417 DEFINE_GETIMPL_STORE(MDImportedEntity, (Tag, Line), Ops);
418}