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 14 #include "llvm/IR/DebugInfoMetadata.h" 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 MDLocation::MDLocation(LLVMContext &C, StorageType Storage, unsigned Line, 23 unsigned Column, ArrayRef<Metadata *> MDs) 24 : MDNode(C, MDLocationKind, 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 MDLocation *MDLocation::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->MDLocations, 52 MDLocationInfo::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 60 SmallVector<Metadata *, 2> Ops; 61 Ops.push_back(Scope); 62 if (InlinedAt) 63 Ops.push_back(InlinedAt); 64 return storeImpl(new (Ops.size()) 65 MDLocation(Context, Storage, Line, Column, Ops), 66 Storage, Context.pImpl->MDLocations); 67 } 68 69 unsigned DebugNode::getFlag(StringRef Flag) { 70 return StringSwitch<unsigned>(Flag) 71 #define HANDLE_DI_FLAG(ID, NAME) .Case("DIFlag" #NAME, Flag##NAME) 72 #include "llvm/IR/DebugInfoFlags.def" 73 .Default(0); 74 } 75 76 const char *DebugNode::getFlagString(unsigned Flag) { 77 switch (Flag) { 78 default: 79 return ""; 80 #define HANDLE_DI_FLAG(ID, NAME) \ 81 case Flag##NAME: \ 82 return "DIFlag" #NAME; 83 #include "llvm/IR/DebugInfoFlags.def" 84 } 85 } 86 87 unsigned DebugNode::splitFlags(unsigned Flags, 88 SmallVectorImpl<unsigned> &SplitFlags) { 89 // Accessibility flags need to be specially handled, since they're packed 90 // together. 91 if (unsigned A = Flags & FlagAccessibility) { 92 if (A == FlagPrivate) 93 SplitFlags.push_back(FlagPrivate); 94 else if (A == FlagProtected) 95 SplitFlags.push_back(FlagProtected); 96 else 97 SplitFlags.push_back(FlagPublic); 98 Flags &= ~A; 99 } 100 101 #define HANDLE_DI_FLAG(ID, NAME) \ 102 if (unsigned Bit = Flags & ID) { \ 103 SplitFlags.push_back(Bit); \ 104 Flags &= ~Bit; \ 105 } 106 #include "llvm/IR/DebugInfoFlags.def" 107 108 return Flags; 109 } 110 111 MDScopeRef MDScope::getScope() const { 112 if (auto *T = dyn_cast<MDType>(this)) 113 return T->getScope(); 114 115 if (auto *SP = dyn_cast<MDSubprogram>(this)) 116 return SP->getScope(); 117 118 if (auto *LB = dyn_cast<MDLexicalBlockBase>(this)) 119 return MDScopeRef(LB->getScope()); 120 121 if (auto *NS = dyn_cast<MDNamespace>(this)) 122 return MDScopeRef(NS->getScope()); 123 124 assert((isa<MDFile>(this) || isa<MDCompileUnit>(this)) && 125 "Unhandled type of scope."); 126 return nullptr; 127 } 128 129 StringRef MDScope::getName() const { 130 if (auto *T = dyn_cast<MDType>(this)) 131 return T->getName(); 132 if (auto *SP = dyn_cast<MDSubprogram>(this)) 133 return SP->getName(); 134 if (auto *NS = dyn_cast<MDNamespace>(this)) 135 return NS->getName(); 136 assert((isa<MDLexicalBlockBase>(this) || isa<MDFile>(this) || 137 isa<MDCompileUnit>(this)) && 138 "Unhandled type of scope."); 139 return ""; 140 } 141 142 static StringRef getString(const MDString *S) { 143 if (S) 144 return S->getString(); 145 return StringRef(); 146 } 147 148 #ifndef NDEBUG 149 static bool isCanonical(const MDString *S) { 150 return !S || !S->getString().empty(); 151 } 152 #endif 153 154 GenericDebugNode *GenericDebugNode::getImpl(LLVMContext &Context, unsigned Tag, 155 MDString *Header, 156 ArrayRef<Metadata *> DwarfOps, 157 StorageType Storage, 158 bool ShouldCreate) { 159 unsigned Hash = 0; 160 if (Storage == Uniqued) { 161 GenericDebugNodeInfo::KeyTy Key(Tag, getString(Header), DwarfOps); 162 if (auto *N = getUniqued(Context.pImpl->GenericDebugNodes, Key)) 163 return N; 164 if (!ShouldCreate) 165 return nullptr; 166 Hash = Key.getHash(); 167 } else { 168 assert(ShouldCreate && "Expected non-uniqued nodes to always be created"); 169 } 170 171 // Use a nullptr for empty headers. 172 assert(isCanonical(Header) && "Expected canonical MDString"); 173 Metadata *PreOps[] = {Header}; 174 return storeImpl(new (DwarfOps.size() + 1) GenericDebugNode( 175 Context, Storage, Hash, Tag, PreOps, DwarfOps), 176 Storage, Context.pImpl->GenericDebugNodes); 177 } 178 179 void GenericDebugNode::recalculateHash() { 180 setHash(GenericDebugNodeInfo::KeyTy::calculateHash(this)); 181 } 182 183 #define UNWRAP_ARGS_IMPL(...) __VA_ARGS__ 184 #define UNWRAP_ARGS(ARGS) UNWRAP_ARGS_IMPL ARGS 185 #define DEFINE_GETIMPL_LOOKUP(CLASS, ARGS) \ 186 do { \ 187 if (Storage == Uniqued) { \ 188 if (auto *N = getUniqued(Context.pImpl->CLASS##s, \ 189 CLASS##Info::KeyTy(UNWRAP_ARGS(ARGS)))) \ 190 return N; \ 191 if (!ShouldCreate) \ 192 return nullptr; \ 193 } else { \ 194 assert(ShouldCreate && \ 195 "Expected non-uniqued nodes to always be created"); \ 196 } \ 197 } while (false) 198 #define DEFINE_GETIMPL_STORE(CLASS, ARGS, OPS) \ 199 return storeImpl(new (ArrayRef<Metadata *>(OPS).size()) \ 200 CLASS(Context, Storage, UNWRAP_ARGS(ARGS), OPS), \ 201 Storage, Context.pImpl->CLASS##s) 202 #define DEFINE_GETIMPL_STORE_NO_OPS(CLASS, ARGS) \ 203 return storeImpl(new (0u) CLASS(Context, Storage, UNWRAP_ARGS(ARGS)), \ 204 Storage, Context.pImpl->CLASS##s) 205 #define DEFINE_GETIMPL_STORE_NO_CONSTRUCTOR_ARGS(CLASS, OPS) \ 206 return storeImpl(new (ArrayRef<Metadata *>(OPS).size()) \ 207 CLASS(Context, Storage, OPS), \ 208 Storage, Context.pImpl->CLASS##s) 209 210 MDSubrange *MDSubrange::getImpl(LLVMContext &Context, int64_t Count, int64_t Lo, 211 StorageType Storage, bool ShouldCreate) { 212 DEFINE_GETIMPL_LOOKUP(MDSubrange, (Count, Lo)); 213 DEFINE_GETIMPL_STORE_NO_OPS(MDSubrange, (Count, Lo)); 214 } 215 216 MDEnumerator *MDEnumerator::getImpl(LLVMContext &Context, int64_t Value, 217 MDString *Name, StorageType Storage, 218 bool ShouldCreate) { 219 assert(isCanonical(Name) && "Expected canonical MDString"); 220 DEFINE_GETIMPL_LOOKUP(MDEnumerator, (Value, getString(Name))); 221 Metadata *Ops[] = {Name}; 222 DEFINE_GETIMPL_STORE(MDEnumerator, (Value), Ops); 223 } 224 225 MDBasicType *MDBasicType::getImpl(LLVMContext &Context, unsigned Tag, 226 MDString *Name, uint64_t SizeInBits, 227 uint64_t AlignInBits, unsigned Encoding, 228 StorageType Storage, bool ShouldCreate) { 229 assert(isCanonical(Name) && "Expected canonical MDString"); 230 DEFINE_GETIMPL_LOOKUP( 231 MDBasicType, (Tag, getString(Name), SizeInBits, AlignInBits, Encoding)); 232 Metadata *Ops[] = {nullptr, nullptr, Name}; 233 DEFINE_GETIMPL_STORE(MDBasicType, (Tag, SizeInBits, AlignInBits, Encoding), 234 Ops); 235 } 236 237 MDDerivedType *MDDerivedType::getImpl( 238 LLVMContext &Context, unsigned Tag, MDString *Name, Metadata *File, 239 unsigned Line, Metadata *Scope, Metadata *BaseType, uint64_t SizeInBits, 240 uint64_t AlignInBits, uint64_t OffsetInBits, unsigned Flags, 241 Metadata *ExtraData, StorageType Storage, bool ShouldCreate) { 242 assert(isCanonical(Name) && "Expected canonical MDString"); 243 DEFINE_GETIMPL_LOOKUP(MDDerivedType, (Tag, getString(Name), File, Line, Scope, 244 BaseType, SizeInBits, AlignInBits, 245 OffsetInBits, Flags, ExtraData)); 246 Metadata *Ops[] = {File, Scope, Name, BaseType, ExtraData}; 247 DEFINE_GETIMPL_STORE( 248 MDDerivedType, (Tag, Line, SizeInBits, AlignInBits, OffsetInBits, Flags), 249 Ops); 250 } 251 252 MDCompositeType *MDCompositeType::getImpl( 253 LLVMContext &Context, unsigned Tag, MDString *Name, Metadata *File, 254 unsigned Line, Metadata *Scope, Metadata *BaseType, uint64_t SizeInBits, 255 uint64_t AlignInBits, uint64_t OffsetInBits, unsigned Flags, 256 Metadata *Elements, unsigned RuntimeLang, Metadata *VTableHolder, 257 Metadata *TemplateParams, MDString *Identifier, StorageType Storage, 258 bool ShouldCreate) { 259 assert(isCanonical(Name) && "Expected canonical MDString"); 260 DEFINE_GETIMPL_LOOKUP(MDCompositeType, 261 (Tag, getString(Name), File, Line, Scope, BaseType, 262 SizeInBits, AlignInBits, OffsetInBits, Flags, Elements, 263 RuntimeLang, VTableHolder, TemplateParams, 264 getString(Identifier))); 265 Metadata *Ops[] = {File, Scope, Name, BaseType, 266 Elements, VTableHolder, TemplateParams, Identifier}; 267 DEFINE_GETIMPL_STORE(MDCompositeType, (Tag, Line, RuntimeLang, SizeInBits, 268 AlignInBits, OffsetInBits, Flags), 269 Ops); 270 } 271 272 MDSubroutineType *MDSubroutineType::getImpl(LLVMContext &Context, 273 unsigned Flags, Metadata *TypeArray, 274 StorageType Storage, 275 bool ShouldCreate) { 276 DEFINE_GETIMPL_LOOKUP(MDSubroutineType, (Flags, TypeArray)); 277 Metadata *Ops[] = {nullptr, nullptr, nullptr, nullptr, 278 TypeArray, nullptr, nullptr, nullptr}; 279 DEFINE_GETIMPL_STORE(MDSubroutineType, (Flags), Ops); 280 } 281 282 MDFile *MDFile::getImpl(LLVMContext &Context, MDString *Filename, 283 MDString *Directory, StorageType Storage, 284 bool ShouldCreate) { 285 assert(isCanonical(Filename) && "Expected canonical MDString"); 286 assert(isCanonical(Directory) && "Expected canonical MDString"); 287 DEFINE_GETIMPL_LOOKUP(MDFile, (getString(Filename), getString(Directory))); 288 Metadata *Ops[] = {Filename, Directory}; 289 DEFINE_GETIMPL_STORE_NO_CONSTRUCTOR_ARGS(MDFile, Ops); 290 } 291 292 MDCompileUnit *MDCompileUnit::getImpl( 293 LLVMContext &Context, unsigned SourceLanguage, Metadata *File, 294 MDString *Producer, bool IsOptimized, MDString *Flags, 295 unsigned RuntimeVersion, MDString *SplitDebugFilename, 296 unsigned EmissionKind, Metadata *EnumTypes, Metadata *RetainedTypes, 297 Metadata *Subprograms, Metadata *GlobalVariables, 298 Metadata *ImportedEntities, StorageType Storage, bool ShouldCreate) { 299 assert(isCanonical(Producer) && "Expected canonical MDString"); 300 assert(isCanonical(Flags) && "Expected canonical MDString"); 301 assert(isCanonical(SplitDebugFilename) && "Expected canonical MDString"); 302 DEFINE_GETIMPL_LOOKUP( 303 MDCompileUnit, 304 (SourceLanguage, File, getString(Producer), IsOptimized, getString(Flags), 305 RuntimeVersion, getString(SplitDebugFilename), EmissionKind, EnumTypes, 306 RetainedTypes, Subprograms, GlobalVariables, ImportedEntities)); 307 Metadata *Ops[] = {File, Producer, Flags, SplitDebugFilename, EnumTypes, 308 RetainedTypes, Subprograms, GlobalVariables, 309 ImportedEntities}; 310 DEFINE_GETIMPL_STORE( 311 MDCompileUnit, 312 (SourceLanguage, IsOptimized, RuntimeVersion, EmissionKind), Ops); 313 } 314 315 MDSubprogram *MDLocalScope::getSubprogram() const { 316 if (auto *Block = dyn_cast<MDLexicalBlockBase>(this)) 317 return Block->getScope()->getSubprogram(); 318 return const_cast<MDSubprogram *>(cast<MDSubprogram>(this)); 319 } 320 321 MDSubprogram *MDSubprogram::getImpl( 322 LLVMContext &Context, Metadata *Scope, MDString *Name, 323 MDString *LinkageName, Metadata *File, unsigned Line, Metadata *Type, 324 bool IsLocalToUnit, bool IsDefinition, unsigned ScopeLine, 325 Metadata *ContainingType, unsigned Virtuality, unsigned VirtualIndex, 326 unsigned Flags, bool IsOptimized, Metadata *Function, 327 Metadata *TemplateParams, Metadata *Declaration, Metadata *Variables, 328 StorageType Storage, bool ShouldCreate) { 329 assert(isCanonical(Name) && "Expected canonical MDString"); 330 assert(isCanonical(LinkageName) && "Expected canonical MDString"); 331 DEFINE_GETIMPL_LOOKUP(MDSubprogram, 332 (Scope, getString(Name), getString(LinkageName), File, 333 Line, Type, IsLocalToUnit, IsDefinition, ScopeLine, 334 ContainingType, Virtuality, VirtualIndex, Flags, 335 IsOptimized, Function, TemplateParams, Declaration, 336 Variables)); 337 Metadata *Ops[] = {File, Scope, Name, Name, 338 LinkageName, Type, ContainingType, Function, 339 TemplateParams, Declaration, Variables}; 340 DEFINE_GETIMPL_STORE(MDSubprogram, 341 (Line, ScopeLine, Virtuality, VirtualIndex, Flags, 342 IsLocalToUnit, IsDefinition, IsOptimized), 343 Ops); 344 } 345 346 Function *MDSubprogram::getFunction() const { 347 // FIXME: Should this be looking through bitcasts? 348 return dyn_cast_or_null<Function>(getFunctionConstant()); 349 } 350 351 void MDSubprogram::replaceFunction(Function *F) { 352 replaceFunction(F ? ConstantAsMetadata::get(F) 353 : static_cast<ConstantAsMetadata *>(nullptr)); 354 } 355 356 MDLexicalBlock *MDLexicalBlock::getImpl(LLVMContext &Context, Metadata *Scope, 357 Metadata *File, unsigned Line, 358 unsigned Column, StorageType Storage, 359 bool ShouldCreate) { 360 assert(Scope && "Expected scope"); 361 DEFINE_GETIMPL_LOOKUP(MDLexicalBlock, (Scope, File, Line, Column)); 362 Metadata *Ops[] = {File, Scope}; 363 DEFINE_GETIMPL_STORE(MDLexicalBlock, (Line, Column), Ops); 364 } 365 366 MDLexicalBlockFile *MDLexicalBlockFile::getImpl(LLVMContext &Context, 367 Metadata *Scope, Metadata *File, 368 unsigned Discriminator, 369 StorageType Storage, 370 bool ShouldCreate) { 371 assert(Scope && "Expected scope"); 372 DEFINE_GETIMPL_LOOKUP(MDLexicalBlockFile, (Scope, File, Discriminator)); 373 Metadata *Ops[] = {File, Scope}; 374 DEFINE_GETIMPL_STORE(MDLexicalBlockFile, (Discriminator), Ops); 375 } 376 377 MDNamespace *MDNamespace::getImpl(LLVMContext &Context, Metadata *Scope, 378 Metadata *File, MDString *Name, unsigned Line, 379 StorageType Storage, bool ShouldCreate) { 380 assert(isCanonical(Name) && "Expected canonical MDString"); 381 DEFINE_GETIMPL_LOOKUP(MDNamespace, (Scope, File, getString(Name), Line)); 382 Metadata *Ops[] = {File, Scope, Name}; 383 DEFINE_GETIMPL_STORE(MDNamespace, (Line), Ops); 384 } 385 386 MDTemplateTypeParameter *MDTemplateTypeParameter::getImpl(LLVMContext &Context, 387 MDString *Name, 388 Metadata *Type, 389 StorageType Storage, 390 bool ShouldCreate) { 391 assert(isCanonical(Name) && "Expected canonical MDString"); 392 DEFINE_GETIMPL_LOOKUP(MDTemplateTypeParameter, (getString(Name), Type)); 393 Metadata *Ops[] = {Name, Type}; 394 DEFINE_GETIMPL_STORE_NO_CONSTRUCTOR_ARGS(MDTemplateTypeParameter, Ops); 395 } 396 397 MDTemplateValueParameter *MDTemplateValueParameter::getImpl( 398 LLVMContext &Context, unsigned Tag, MDString *Name, Metadata *Type, 399 Metadata *Value, StorageType Storage, bool ShouldCreate) { 400 assert(isCanonical(Name) && "Expected canonical MDString"); 401 DEFINE_GETIMPL_LOOKUP(MDTemplateValueParameter, 402 (Tag, getString(Name), Type, Value)); 403 Metadata *Ops[] = {Name, Type, Value}; 404 DEFINE_GETIMPL_STORE(MDTemplateValueParameter, (Tag), Ops); 405 } 406 407 MDGlobalVariable * 408 MDGlobalVariable::getImpl(LLVMContext &Context, Metadata *Scope, MDString *Name, 409 MDString *LinkageName, Metadata *File, unsigned Line, 410 Metadata *Type, bool IsLocalToUnit, bool IsDefinition, 411 Metadata *Variable, 412 Metadata *StaticDataMemberDeclaration, 413 StorageType Storage, bool ShouldCreate) { 414 assert(isCanonical(Name) && "Expected canonical MDString"); 415 assert(isCanonical(LinkageName) && "Expected canonical MDString"); 416 DEFINE_GETIMPL_LOOKUP(MDGlobalVariable, 417 (Scope, getString(Name), getString(LinkageName), File, 418 Line, Type, IsLocalToUnit, IsDefinition, Variable, 419 StaticDataMemberDeclaration)); 420 Metadata *Ops[] = {Scope, Name, File, Type, 421 Name, LinkageName, Variable, StaticDataMemberDeclaration}; 422 DEFINE_GETIMPL_STORE(MDGlobalVariable, (Line, IsLocalToUnit, IsDefinition), 423 Ops); 424 } 425 426 MDLocalVariable *MDLocalVariable::getImpl( 427 LLVMContext &Context, unsigned Tag, Metadata *Scope, MDString *Name, 428 Metadata *File, unsigned Line, Metadata *Type, unsigned Arg, unsigned Flags, 429 Metadata *InlinedAt, StorageType Storage, bool ShouldCreate) { 430 // Truncate Arg to 8 bits. 431 // 432 // FIXME: This is gross (and should be changed to an assert or removed), but 433 // it matches historical behaviour for now. 434 Arg &= (1u << 8) - 1; 435 436 assert(Scope && "Expected scope"); 437 assert(isCanonical(Name) && "Expected canonical MDString"); 438 DEFINE_GETIMPL_LOOKUP(MDLocalVariable, (Tag, Scope, getString(Name), File, 439 Line, Type, Arg, Flags, InlinedAt)); 440 Metadata *Ops[] = {Scope, Name, File, Type, InlinedAt}; 441 DEFINE_GETIMPL_STORE(MDLocalVariable, (Tag, Line, Arg, Flags), Ops); 442 } 443 444 MDExpression *MDExpression::getImpl(LLVMContext &Context, 445 ArrayRef<uint64_t> Elements, 446 StorageType Storage, bool ShouldCreate) { 447 DEFINE_GETIMPL_LOOKUP(MDExpression, (Elements)); 448 DEFINE_GETIMPL_STORE_NO_OPS(MDExpression, (Elements)); 449 } 450 451 unsigned MDExpression::ExprOperand::getSize() const { 452 switch (getOp()) { 453 case dwarf::DW_OP_bit_piece: 454 return 3; 455 case dwarf::DW_OP_plus: 456 return 2; 457 default: 458 return 1; 459 } 460 } 461 462 bool MDExpression::isValid() const { 463 for (auto I = expr_op_begin(), E = expr_op_end(); I != E; ++I) { 464 // Check that there's space for the operand. 465 if (I->get() + I->getSize() > E->get()) 466 return false; 467 468 // Check that the operand is valid. 469 switch (I->getOp()) { 470 default: 471 return false; 472 case dwarf::DW_OP_bit_piece: 473 // Piece expressions must be at the end. 474 return I->get() + I->getSize() == E->get(); 475 case dwarf::DW_OP_plus: 476 case dwarf::DW_OP_deref: 477 break; 478 } 479 } 480 return true; 481 } 482 483 bool MDExpression::isBitPiece() const { 484 assert(isValid() && "Expected valid expression"); 485 if (unsigned N = getNumElements()) 486 if (N >= 3) 487 return getElement(N - 3) == dwarf::DW_OP_bit_piece; 488 return false; 489 } 490 491 uint64_t MDExpression::getBitPieceOffset() const { 492 assert(isBitPiece() && "Expected bit piece"); 493 return getElement(getNumElements() - 2); 494 } 495 496 uint64_t MDExpression::getBitPieceSize() const { 497 assert(isBitPiece() && "Expected bit piece"); 498 return getElement(getNumElements() - 1); 499 } 500 501 MDObjCProperty *MDObjCProperty::getImpl( 502 LLVMContext &Context, MDString *Name, Metadata *File, unsigned Line, 503 MDString *GetterName, MDString *SetterName, unsigned Attributes, 504 Metadata *Type, StorageType Storage, bool ShouldCreate) { 505 assert(isCanonical(Name) && "Expected canonical MDString"); 506 assert(isCanonical(GetterName) && "Expected canonical MDString"); 507 assert(isCanonical(SetterName) && "Expected canonical MDString"); 508 DEFINE_GETIMPL_LOOKUP(MDObjCProperty, 509 (getString(Name), File, Line, getString(GetterName), 510 getString(SetterName), Attributes, Type)); 511 Metadata *Ops[] = {Name, File, GetterName, SetterName, Type}; 512 DEFINE_GETIMPL_STORE(MDObjCProperty, (Line, Attributes), Ops); 513 } 514 515 MDImportedEntity *MDImportedEntity::getImpl(LLVMContext &Context, unsigned Tag, 516 Metadata *Scope, Metadata *Entity, 517 unsigned Line, MDString *Name, 518 StorageType Storage, 519 bool ShouldCreate) { 520 assert(isCanonical(Name) && "Expected canonical MDString"); 521 DEFINE_GETIMPL_LOOKUP(MDImportedEntity, 522 (Tag, Scope, Entity, Line, getString(Name))); 523 Metadata *Ops[] = {Scope, Entity, Name}; 524 DEFINE_GETIMPL_STORE(MDImportedEntity, (Tag, Line), Ops); 525 } 526