blob: 754740a34ee8fb6932ae993939ee1d4ef77c07a9 [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
Duncan P. N. Exon Smithe2c61d92015-03-27 17:56:39 +000047 assert(Scope && "Expected scope");
Duncan P. N. Exon Smithd9901ff2015-02-02 18:53:21 +000048 if (Storage == Uniqued) {
49 if (auto *N =
50 getUniqued(Context.pImpl->MDLocations,
51 MDLocationInfo::KeyTy(Line, Column, Scope, InlinedAt)))
52 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())
64 MDLocation(Context, Storage, Line, Column, Ops),
65 Storage, Context.pImpl->MDLocations);
66}
67
Duncan P. N. Exon Smith9146fc82015-02-02 20:01:03 +000068static StringRef getString(const MDString *S) {
69 if (S)
70 return S->getString();
71 return StringRef();
72}
73
Duncan P. N. Exon Smithc7e08132015-02-02 20:20:56 +000074#ifndef NDEBUG
Duncan P. N. Exon Smith9146fc82015-02-02 20:01:03 +000075static bool isCanonical(const MDString *S) {
76 return !S || !S->getString().empty();
Duncan P. N. Exon Smith442ec022015-02-02 19:54:05 +000077}
Duncan P. N. Exon Smithc7e08132015-02-02 20:20:56 +000078#endif
Duncan P. N. Exon Smith442ec022015-02-02 19:54:05 +000079
Duncan P. N. Exon Smithd9901ff2015-02-02 18:53:21 +000080GenericDebugNode *GenericDebugNode::getImpl(LLVMContext &Context, unsigned Tag,
Duncan P. N. Exon Smith9146fc82015-02-02 20:01:03 +000081 MDString *Header,
Duncan P. N. Exon Smithd9901ff2015-02-02 18:53:21 +000082 ArrayRef<Metadata *> DwarfOps,
83 StorageType Storage,
84 bool ShouldCreate) {
85 unsigned Hash = 0;
86 if (Storage == Uniqued) {
Duncan P. N. Exon Smith9146fc82015-02-02 20:01:03 +000087 GenericDebugNodeInfo::KeyTy Key(Tag, getString(Header), DwarfOps);
Duncan P. N. Exon Smithd9901ff2015-02-02 18:53:21 +000088 if (auto *N = getUniqued(Context.pImpl->GenericDebugNodes, Key))
89 return N;
90 if (!ShouldCreate)
91 return nullptr;
92 Hash = Key.getHash();
93 } else {
94 assert(ShouldCreate && "Expected non-uniqued nodes to always be created");
95 }
96
97 // Use a nullptr for empty headers.
Duncan P. N. Exon Smith9146fc82015-02-02 20:01:03 +000098 assert(isCanonical(Header) && "Expected canonical MDString");
99 Metadata *PreOps[] = {Header};
Duncan P. N. Exon Smithd9901ff2015-02-02 18:53:21 +0000100 return storeImpl(new (DwarfOps.size() + 1) GenericDebugNode(
101 Context, Storage, Hash, Tag, PreOps, DwarfOps),
102 Storage, Context.pImpl->GenericDebugNodes);
103}
104
105void GenericDebugNode::recalculateHash() {
106 setHash(GenericDebugNodeInfo::KeyTy::calculateHash(this));
107}
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000108
109#define UNWRAP_ARGS_IMPL(...) __VA_ARGS__
110#define UNWRAP_ARGS(ARGS) UNWRAP_ARGS_IMPL ARGS
111#define DEFINE_GETIMPL_LOOKUP(CLASS, ARGS) \
112 do { \
113 if (Storage == Uniqued) { \
114 if (auto *N = getUniqued(Context.pImpl->CLASS##s, \
115 CLASS##Info::KeyTy(UNWRAP_ARGS(ARGS)))) \
116 return N; \
117 if (!ShouldCreate) \
118 return nullptr; \
119 } else { \
120 assert(ShouldCreate && \
121 "Expected non-uniqued nodes to always be created"); \
122 } \
123 } while (false)
124#define DEFINE_GETIMPL_STORE(CLASS, ARGS, OPS) \
125 return storeImpl(new (ArrayRef<Metadata *>(OPS).size()) \
126 CLASS(Context, Storage, UNWRAP_ARGS(ARGS), OPS), \
127 Storage, Context.pImpl->CLASS##s)
128#define DEFINE_GETIMPL_STORE_NO_OPS(CLASS, ARGS) \
129 return storeImpl(new (0u) CLASS(Context, Storage, UNWRAP_ARGS(ARGS)), \
130 Storage, Context.pImpl->CLASS##s)
Duncan P. N. Exon Smithbd33d372015-02-10 01:59:57 +0000131#define DEFINE_GETIMPL_STORE_NO_CONSTRUCTOR_ARGS(CLASS, OPS) \
132 return storeImpl(new (ArrayRef<Metadata *>(OPS).size()) \
133 CLASS(Context, Storage, OPS), \
134 Storage, Context.pImpl->CLASS##s)
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000135
136MDSubrange *MDSubrange::getImpl(LLVMContext &Context, int64_t Count, int64_t Lo,
137 StorageType Storage, bool ShouldCreate) {
138 DEFINE_GETIMPL_LOOKUP(MDSubrange, (Count, Lo));
139 DEFINE_GETIMPL_STORE_NO_OPS(MDSubrange, (Count, Lo));
140}
141
142MDEnumerator *MDEnumerator::getImpl(LLVMContext &Context, int64_t Value,
143 MDString *Name, StorageType Storage,
144 bool ShouldCreate) {
145 assert(isCanonical(Name) && "Expected canonical MDString");
146 DEFINE_GETIMPL_LOOKUP(MDEnumerator, (Value, getString(Name)));
147 Metadata *Ops[] = {Name};
148 DEFINE_GETIMPL_STORE(MDEnumerator, (Value), Ops);
149}
150
151MDBasicType *MDBasicType::getImpl(LLVMContext &Context, unsigned Tag,
Duncan P. N. Exon Smithd34db172015-02-19 23:56:07 +0000152 MDString *Name, uint64_t SizeInBits,
153 uint64_t AlignInBits, unsigned Encoding,
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000154 StorageType Storage, bool ShouldCreate) {
155 assert(isCanonical(Name) && "Expected canonical MDString");
156 DEFINE_GETIMPL_LOOKUP(
157 MDBasicType, (Tag, getString(Name), SizeInBits, AlignInBits, Encoding));
158 Metadata *Ops[] = {nullptr, nullptr, Name};
159 DEFINE_GETIMPL_STORE(MDBasicType, (Tag, SizeInBits, AlignInBits, Encoding),
160 Ops);
161}
162
163MDDerivedType *MDDerivedType::getImpl(
164 LLVMContext &Context, unsigned Tag, MDString *Name, Metadata *File,
Duncan P. N. Exon Smithd34db172015-02-19 23:56:07 +0000165 unsigned Line, Metadata *Scope, Metadata *BaseType, uint64_t SizeInBits,
166 uint64_t AlignInBits, uint64_t OffsetInBits, unsigned Flags,
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000167 Metadata *ExtraData, StorageType Storage, bool ShouldCreate) {
168 assert(isCanonical(Name) && "Expected canonical MDString");
169 DEFINE_GETIMPL_LOOKUP(MDDerivedType, (Tag, getString(Name), File, Line, Scope,
170 BaseType, SizeInBits, AlignInBits,
171 OffsetInBits, Flags, ExtraData));
172 Metadata *Ops[] = {File, Scope, Name, BaseType, ExtraData};
173 DEFINE_GETIMPL_STORE(
174 MDDerivedType, (Tag, Line, SizeInBits, AlignInBits, OffsetInBits, Flags),
175 Ops);
176}
177
178MDCompositeType *MDCompositeType::getImpl(
179 LLVMContext &Context, unsigned Tag, MDString *Name, Metadata *File,
Duncan P. N. Exon Smithd34db172015-02-19 23:56:07 +0000180 unsigned Line, Metadata *Scope, Metadata *BaseType, uint64_t SizeInBits,
181 uint64_t AlignInBits, uint64_t OffsetInBits, unsigned Flags,
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000182 Metadata *Elements, unsigned RuntimeLang, Metadata *VTableHolder,
183 Metadata *TemplateParams, MDString *Identifier, StorageType Storage,
184 bool ShouldCreate) {
185 assert(isCanonical(Name) && "Expected canonical MDString");
186 DEFINE_GETIMPL_LOOKUP(MDCompositeType,
187 (Tag, getString(Name), File, Line, Scope, BaseType,
188 SizeInBits, AlignInBits, OffsetInBits, Flags, Elements,
189 RuntimeLang, VTableHolder, TemplateParams,
190 getString(Identifier)));
191 Metadata *Ops[] = {File, Scope, Name, BaseType,
192 Elements, VTableHolder, TemplateParams, Identifier};
193 DEFINE_GETIMPL_STORE(MDCompositeType, (Tag, Line, RuntimeLang, SizeInBits,
194 AlignInBits, OffsetInBits, Flags),
195 Ops);
196}
197
198MDSubroutineType *MDSubroutineType::getImpl(LLVMContext &Context,
199 unsigned Flags, Metadata *TypeArray,
200 StorageType Storage,
201 bool ShouldCreate) {
202 DEFINE_GETIMPL_LOOKUP(MDSubroutineType, (Flags, TypeArray));
203 Metadata *Ops[] = {nullptr, nullptr, nullptr, nullptr,
Duncan P. N. Exon Smitha9f0a8d2015-02-19 23:25:21 +0000204 TypeArray, nullptr, nullptr, nullptr};
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000205 DEFINE_GETIMPL_STORE(MDSubroutineType, (Flags), Ops);
206}
207
208MDFile *MDFile::getImpl(LLVMContext &Context, MDString *Filename,
209 MDString *Directory, StorageType Storage,
210 bool ShouldCreate) {
211 assert(isCanonical(Filename) && "Expected canonical MDString");
212 assert(isCanonical(Directory) && "Expected canonical MDString");
213 DEFINE_GETIMPL_LOOKUP(MDFile, (getString(Filename), getString(Directory)));
Duncan P. N. Exon Smitha5c57cc2015-02-20 20:35:17 +0000214 Metadata *Ops[] = {Filename, Directory};
215 DEFINE_GETIMPL_STORE_NO_CONSTRUCTOR_ARGS(MDFile, Ops);
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000216}
217
218MDCompileUnit *MDCompileUnit::getImpl(
219 LLVMContext &Context, unsigned SourceLanguage, Metadata *File,
220 MDString *Producer, bool IsOptimized, MDString *Flags,
221 unsigned RuntimeVersion, MDString *SplitDebugFilename,
222 unsigned EmissionKind, Metadata *EnumTypes, Metadata *RetainedTypes,
223 Metadata *Subprograms, Metadata *GlobalVariables,
224 Metadata *ImportedEntities, StorageType Storage, bool ShouldCreate) {
225 assert(isCanonical(Producer) && "Expected canonical MDString");
226 assert(isCanonical(Flags) && "Expected canonical MDString");
227 assert(isCanonical(SplitDebugFilename) && "Expected canonical MDString");
228 DEFINE_GETIMPL_LOOKUP(
229 MDCompileUnit,
230 (SourceLanguage, File, getString(Producer), IsOptimized, getString(Flags),
231 RuntimeVersion, getString(SplitDebugFilename), EmissionKind, EnumTypes,
232 RetainedTypes, Subprograms, GlobalVariables, ImportedEntities));
233 Metadata *Ops[] = {File, Producer, Flags, SplitDebugFilename, EnumTypes,
234 RetainedTypes, Subprograms, GlobalVariables,
235 ImportedEntities};
236 DEFINE_GETIMPL_STORE(
237 MDCompileUnit,
238 (SourceLanguage, IsOptimized, RuntimeVersion, EmissionKind), Ops);
239}
240
241MDSubprogram *MDSubprogram::getImpl(
242 LLVMContext &Context, Metadata *Scope, MDString *Name,
243 MDString *LinkageName, Metadata *File, unsigned Line, Metadata *Type,
244 bool IsLocalToUnit, bool IsDefinition, unsigned ScopeLine,
245 Metadata *ContainingType, unsigned Virtuality, unsigned VirtualIndex,
246 unsigned Flags, bool IsOptimized, Metadata *Function,
247 Metadata *TemplateParams, Metadata *Declaration, Metadata *Variables,
248 StorageType Storage, bool ShouldCreate) {
249 assert(isCanonical(Name) && "Expected canonical MDString");
250 assert(isCanonical(LinkageName) && "Expected canonical MDString");
251 DEFINE_GETIMPL_LOOKUP(MDSubprogram,
252 (Scope, getString(Name), getString(LinkageName), File,
253 Line, Type, IsLocalToUnit, IsDefinition, ScopeLine,
254 ContainingType, Virtuality, VirtualIndex, Flags,
255 IsOptimized, Function, TemplateParams, Declaration,
256 Variables));
257 Metadata *Ops[] = {File, Scope, Name, Name,
258 LinkageName, Type, ContainingType, Function,
259 TemplateParams, Declaration, Variables};
260 DEFINE_GETIMPL_STORE(MDSubprogram,
261 (Line, ScopeLine, Virtuality, VirtualIndex, Flags,
262 IsLocalToUnit, IsDefinition, IsOptimized),
263 Ops);
264}
265
Duncan P. N. Exon Smithdf523492015-02-18 20:32:57 +0000266void MDSubprogram::replaceFunction(Function *F) {
267 replaceFunction(F ? ConstantAsMetadata::get(F)
268 : static_cast<ConstantAsMetadata *>(nullptr));
269}
270
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000271MDLexicalBlock *MDLexicalBlock::getImpl(LLVMContext &Context, Metadata *Scope,
272 Metadata *File, unsigned Line,
273 unsigned Column, StorageType Storage,
274 bool ShouldCreate) {
Duncan P. N. Exon Smith0e202b92015-03-30 16:37:48 +0000275 assert(Scope && "Expected scope");
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000276 DEFINE_GETIMPL_LOOKUP(MDLexicalBlock, (Scope, File, Line, Column));
277 Metadata *Ops[] = {File, Scope};
278 DEFINE_GETIMPL_STORE(MDLexicalBlock, (Line, Column), Ops);
279}
280
281MDLexicalBlockFile *MDLexicalBlockFile::getImpl(LLVMContext &Context,
282 Metadata *Scope, Metadata *File,
283 unsigned Discriminator,
284 StorageType Storage,
285 bool ShouldCreate) {
Duncan P. N. Exon Smith0e202b92015-03-30 16:37:48 +0000286 assert(Scope && "Expected scope");
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000287 DEFINE_GETIMPL_LOOKUP(MDLexicalBlockFile, (Scope, File, Discriminator));
288 Metadata *Ops[] = {File, Scope};
289 DEFINE_GETIMPL_STORE(MDLexicalBlockFile, (Discriminator), Ops);
290}
291
292MDNamespace *MDNamespace::getImpl(LLVMContext &Context, Metadata *Scope,
293 Metadata *File, MDString *Name, unsigned Line,
294 StorageType Storage, bool ShouldCreate) {
295 assert(isCanonical(Name) && "Expected canonical MDString");
296 DEFINE_GETIMPL_LOOKUP(MDNamespace, (Scope, File, getString(Name), Line));
297 Metadata *Ops[] = {File, Scope, Name};
298 DEFINE_GETIMPL_STORE(MDNamespace, (Line), Ops);
299}
300
Duncan P. N. Exon Smith3d62bba2015-02-19 00:37:21 +0000301MDTemplateTypeParameter *MDTemplateTypeParameter::getImpl(LLVMContext &Context,
302 MDString *Name,
303 Metadata *Type,
304 StorageType Storage,
305 bool ShouldCreate) {
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000306 assert(isCanonical(Name) && "Expected canonical MDString");
Duncan P. N. Exon Smith3d62bba2015-02-19 00:37:21 +0000307 DEFINE_GETIMPL_LOOKUP(MDTemplateTypeParameter, (getString(Name), Type));
308 Metadata *Ops[] = {Name, Type};
Duncan P. N. Exon Smithbd33d372015-02-10 01:59:57 +0000309 DEFINE_GETIMPL_STORE_NO_CONSTRUCTOR_ARGS(MDTemplateTypeParameter, Ops);
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000310}
311
312MDTemplateValueParameter *MDTemplateValueParameter::getImpl(
Duncan P. N. Exon Smith3d62bba2015-02-19 00:37:21 +0000313 LLVMContext &Context, unsigned Tag, MDString *Name, Metadata *Type,
314 Metadata *Value, StorageType Storage, bool ShouldCreate) {
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000315 assert(isCanonical(Name) && "Expected canonical MDString");
Duncan P. N. Exon Smithbd33d372015-02-10 01:59:57 +0000316 DEFINE_GETIMPL_LOOKUP(MDTemplateValueParameter,
Duncan P. N. Exon Smith3d62bba2015-02-19 00:37:21 +0000317 (Tag, getString(Name), Type, Value));
318 Metadata *Ops[] = {Name, Type, Value};
Duncan P. N. Exon Smithbd33d372015-02-10 01:59:57 +0000319 DEFINE_GETIMPL_STORE(MDTemplateValueParameter, (Tag), Ops);
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000320}
321
322MDGlobalVariable *
323MDGlobalVariable::getImpl(LLVMContext &Context, Metadata *Scope, MDString *Name,
324 MDString *LinkageName, Metadata *File, unsigned Line,
325 Metadata *Type, bool IsLocalToUnit, bool IsDefinition,
326 Metadata *Variable,
327 Metadata *StaticDataMemberDeclaration,
328 StorageType Storage, bool ShouldCreate) {
329 assert(isCanonical(Name) && "Expected canonical MDString");
330 assert(isCanonical(LinkageName) && "Expected canonical MDString");
331 DEFINE_GETIMPL_LOOKUP(MDGlobalVariable,
332 (Scope, getString(Name), getString(LinkageName), File,
333 Line, Type, IsLocalToUnit, IsDefinition, Variable,
334 StaticDataMemberDeclaration));
335 Metadata *Ops[] = {Scope, Name, File, Type,
336 Name, LinkageName, Variable, StaticDataMemberDeclaration};
337 DEFINE_GETIMPL_STORE(MDGlobalVariable, (Line, IsLocalToUnit, IsDefinition),
338 Ops);
339}
340
341MDLocalVariable *MDLocalVariable::getImpl(
342 LLVMContext &Context, unsigned Tag, Metadata *Scope, MDString *Name,
343 Metadata *File, unsigned Line, Metadata *Type, unsigned Arg, unsigned Flags,
344 Metadata *InlinedAt, StorageType Storage, bool ShouldCreate) {
Duncan P. N. Exon Smith72fe2d02015-02-13 01:39:44 +0000345 // Truncate Arg to 8 bits.
346 //
347 // FIXME: This is gross (and should be changed to an assert or removed), but
348 // it matches historical behaviour for now.
349 Arg &= (1u << 8) - 1;
350
Duncan P. N. Exon Smithe2c61d92015-03-27 17:56:39 +0000351 assert(Scope && "Expected scope");
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000352 assert(isCanonical(Name) && "Expected canonical MDString");
353 DEFINE_GETIMPL_LOOKUP(MDLocalVariable, (Tag, Scope, getString(Name), File,
354 Line, Type, Arg, Flags, InlinedAt));
355 Metadata *Ops[] = {Scope, Name, File, Type, InlinedAt};
356 DEFINE_GETIMPL_STORE(MDLocalVariable, (Tag, Line, Arg, Flags), Ops);
357}
358
359MDExpression *MDExpression::getImpl(LLVMContext &Context,
360 ArrayRef<uint64_t> Elements,
361 StorageType Storage, bool ShouldCreate) {
362 DEFINE_GETIMPL_LOOKUP(MDExpression, (Elements));
363 DEFINE_GETIMPL_STORE_NO_OPS(MDExpression, (Elements));
364}
365
Duncan P. N. Exon Smith193a4fd2015-02-13 01:07:46 +0000366unsigned MDExpression::ExprOperand::getSize() const {
367 switch (getOp()) {
368 case dwarf::DW_OP_bit_piece:
369 return 3;
370 case dwarf::DW_OP_plus:
371 return 2;
372 default:
373 return 1;
374 }
375}
376
377bool MDExpression::isValid() const {
378 for (auto I = expr_op_begin(), E = expr_op_end(); I != E; ++I) {
379 // Check that there's space for the operand.
380 if (I->get() + I->getSize() > E->get())
381 return false;
382
383 // Check that the operand is valid.
384 switch (I->getOp()) {
385 default:
386 return false;
387 case dwarf::DW_OP_bit_piece:
388 // Piece expressions must be at the end.
389 return I->get() + I->getSize() == E->get();
390 case dwarf::DW_OP_plus:
391 case dwarf::DW_OP_deref:
392 break;
393 }
394 }
395 return true;
396}
397
Duncan P. N. Exon Smith01fc1762015-02-10 00:52:32 +0000398MDObjCProperty *MDObjCProperty::getImpl(
399 LLVMContext &Context, MDString *Name, Metadata *File, unsigned Line,
400 MDString *GetterName, MDString *SetterName, unsigned Attributes,
401 Metadata *Type, StorageType Storage, bool ShouldCreate) {
402 assert(isCanonical(Name) && "Expected canonical MDString");
403 assert(isCanonical(GetterName) && "Expected canonical MDString");
404 assert(isCanonical(SetterName) && "Expected canonical MDString");
405 DEFINE_GETIMPL_LOOKUP(MDObjCProperty,
406 (getString(Name), File, Line, getString(GetterName),
407 getString(SetterName), Attributes, Type));
408 Metadata *Ops[] = {Name, File, GetterName, SetterName, Type};
409 DEFINE_GETIMPL_STORE(MDObjCProperty, (Line, Attributes), Ops);
410}
411
412MDImportedEntity *MDImportedEntity::getImpl(LLVMContext &Context, unsigned Tag,
413 Metadata *Scope, Metadata *Entity,
414 unsigned Line, MDString *Name,
415 StorageType Storage,
416 bool ShouldCreate) {
417 assert(isCanonical(Name) && "Expected canonical MDString");
418 DEFINE_GETIMPL_LOOKUP(MDImportedEntity,
419 (Tag, Scope, Entity, Line, getString(Name)));
420 Metadata *Ops[] = {Scope, Entity, Name};
421 DEFINE_GETIMPL_STORE(MDImportedEntity, (Tag, Line), Ops);
422}