if (auto *NS = dyn_cast<DINamespace>(this))
return DIScopeRef(NS->getScope());
+ if (auto *M = dyn_cast<DIModule>(this))
+ return DIScopeRef(M->getScope());
+
assert((isa<DIFile>(this) || isa<DICompileUnit>(this)) &&
"Unhandled type of scope.");
return nullptr;
return SP->getName();
if (auto *NS = dyn_cast<DINamespace>(this))
return NS->getName();
+ if (auto *M = dyn_cast<DIModule>(this))
+ return M->getName();
assert((isa<DILexicalBlockBase>(this) || isa<DIFile>(this) ||
isa<DICompileUnit>(this)) &&
"Unhandled type of scope.");
StorageType Storage,
bool ShouldCreate) {
DEFINE_GETIMPL_LOOKUP(DISubroutineType, (Flags, TypeArray));
- Metadata *Ops[] = {nullptr, nullptr, nullptr, nullptr,
- TypeArray, nullptr, nullptr, nullptr};
+ Metadata *Ops[] = {nullptr, nullptr, nullptr, TypeArray};
DEFINE_GETIMPL_STORE(DISubroutineType, (Flags), Ops);
}
Metadata *Subprograms, Metadata *GlobalVariables,
Metadata *ImportedEntities, uint64_t DWOId,
StorageType Storage, bool ShouldCreate) {
+ assert(Storage != Uniqued && "Cannot unique DICompileUnit");
assert(isCanonical(Producer) && "Expected canonical MDString");
assert(isCanonical(Flags) && "Expected canonical MDString");
assert(isCanonical(SplitDebugFilename) && "Expected canonical MDString");
- DEFINE_GETIMPL_LOOKUP(
- DICompileUnit,
- (SourceLanguage, File, getString(Producer), IsOptimized, getString(Flags),
- RuntimeVersion, getString(SplitDebugFilename), EmissionKind, EnumTypes,
- RetainedTypes, Subprograms, GlobalVariables, ImportedEntities, DWOId));
+
Metadata *Ops[] = {File, Producer, Flags, SplitDebugFilename, EnumTypes,
RetainedTypes, Subprograms, GlobalVariables,
ImportedEntities};
- DEFINE_GETIMPL_STORE(
- DICompileUnit,
- (SourceLanguage, IsOptimized, RuntimeVersion, EmissionKind, DWOId), Ops);
+ return storeImpl(new (ArrayRef<Metadata *>(Ops).size()) DICompileUnit(
+ Context, Storage, SourceLanguage, IsOptimized,
+ RuntimeVersion, EmissionKind, DWOId, Ops),
+ Storage);
}
DISubprogram *DILocalScope::getSubprogram() const {
Metadata *File, unsigned Line,
unsigned Column, StorageType Storage,
bool ShouldCreate) {
+ // Fixup column.
+ adjustColumn(Column);
+
assert(Scope && "Expected scope");
DEFINE_GETIMPL_LOOKUP(DILexicalBlock, (Scope, File, Line, Column));
Metadata *Ops[] = {File, Scope};
DEFINE_GETIMPL_STORE(DINamespace, (Line), Ops);
}
+DIModule *DIModule::getImpl(LLVMContext &Context, Metadata *Scope,
+ MDString *Name, MDString *ConfigurationMacros,
+ MDString *IncludePath, MDString *ISysRoot,
+ StorageType Storage, bool ShouldCreate) {
+ assert(isCanonical(Name) && "Expected canonical MDString");
+ DEFINE_GETIMPL_LOOKUP(DIModule,
+ (Scope, getString(Name), getString(ConfigurationMacros),
+ getString(IncludePath), getString(ISysRoot)));
+ Metadata *Ops[] = {Scope, Name, ConfigurationMacros, IncludePath, ISysRoot};
+ DEFINE_GETIMPL_STORE_NO_CONSTRUCTOR_ARGS(DIModule, Ops);
+}
+
DITemplateTypeParameter *DITemplateTypeParameter::getImpl(LLVMContext &Context,
MDString *Name,
Metadata *Type,
Ops);
}
-DILocalVariable *DILocalVariable::getImpl(LLVMContext &Context, unsigned Tag,
- Metadata *Scope, MDString *Name,
- Metadata *File, unsigned Line,
- Metadata *Type, unsigned Arg,
- unsigned Flags, StorageType Storage,
+DILocalVariable *DILocalVariable::getImpl(LLVMContext &Context, Metadata *Scope,
+ MDString *Name, Metadata *File,
+ unsigned Line, Metadata *Type,
+ unsigned Arg, unsigned Flags,
+ StorageType Storage,
bool ShouldCreate) {
// 64K ought to be enough for any frontend.
assert(Arg <= UINT16_MAX && "Expected argument number to fit in 16-bits");
assert(Scope && "Expected scope");
assert(isCanonical(Name) && "Expected canonical MDString");
- DEFINE_GETIMPL_LOOKUP(DILocalVariable, (Tag, Scope, getString(Name), File,
- Line, Type, Arg, Flags));
+ DEFINE_GETIMPL_LOOKUP(DILocalVariable,
+ (Scope, getString(Name), File, Line, Type, Arg, Flags));
Metadata *Ops[] = {Scope, Name, File, Type};
- DEFINE_GETIMPL_STORE(DILocalVariable, (Tag, Line, Arg, Flags), Ops);
+ DEFINE_GETIMPL_STORE(DILocalVariable, (Line, Arg, Flags), Ops);
}
DIExpression *DIExpression::getImpl(LLVMContext &Context,
case dwarf::DW_OP_bit_piece:
return 3;
case dwarf::DW_OP_plus:
+ case dwarf::DW_OP_minus:
return 2;
default:
return 1;
// Piece expressions must be at the end.
return I->get() + I->getSize() == E->get();
case dwarf::DW_OP_plus:
+ case dwarf::DW_OP_minus:
case dwarf::DW_OP_deref:
break;
}