Skip to content

Commit c17aee6

Browse files
committed
Revert "Rename DW_AT_LLVM_isysroot to DW_AT_LLVM_sysroot"
This reverts commit 12e4794. I accidentally landed this patch with the wrong commit message ...
1 parent 94dd096 commit c17aee6

File tree

29 files changed

+147
-192
lines changed

29 files changed

+147
-192
lines changed

clang/lib/CodeGen/CGDebugInfo.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -610,10 +610,6 @@ void CGDebugInfo::CreateCompileUnit() {
610610
remapDIPath(MainFileName), remapDIPath(getCurrentDirname()), CSInfo,
611611
getSource(SM, SM.getMainFileID()));
612612

613-
StringRef Sysroot;
614-
if (CGM.getCodeGenOpts().getDebuggerTuning() == llvm::DebuggerKind::LLDB)
615-
Sysroot = CGM.getHeaderSearchOpts().Sysroot;
616-
617613
// Create new compile unit.
618614
TheCU = DBuilder.createCompileUnit(
619615
LangTag, CUFile, CGOpts.EmitVersionIdentMetadata ? Producer : "",
@@ -624,7 +620,7 @@ void CGDebugInfo::CreateCompileUnit() {
624620
? llvm::DICompileUnit::DebugNameTableKind::None
625621
: static_cast<llvm::DICompileUnit::DebugNameTableKind>(
626622
CGOpts.DebugNameTable),
627-
CGOpts.DebugRangesBaseAddress, Sysroot);
623+
CGOpts.DebugRangesBaseAddress);
628624
}
629625

630626
llvm::DIType *CGDebugInfo::CreateType(const BuiltinType *BT) {
@@ -2475,7 +2471,7 @@ CGDebugInfo::getOrCreateModuleRef(ExternalASTSource::ASTSourceDescriptor Mod,
24752471
CreateSkeletonCU);
24762472
llvm::DIModule *DIMod =
24772473
DBuilder.createModule(Parent, Mod.getModuleName(), ConfigMacros,
2478-
Mod.getPath());
2474+
Mod.getPath(), CGM.getHeaderSearchOpts().Sysroot);
24792475
ModuleCache[M].reset(DIMod);
24802476
return DIMod;
24812477
}

clang/test/CodeGen/debug-info-sysroot.c

Lines changed: 0 additions & 15 deletions
This file was deleted.

clang/test/CodeGen/debug-nvptx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %clang_cc1 -triple nvptx-unknown-unknown -S -o - -debug-info-kind=limited %s -emit-llvm | FileCheck %s
22

3-
// CHECK: DICompileUnit({{.*}}, nameTableKind: None
3+
// CHECK: DICompileUnit({{.*}}, nameTableKind: None)
44

55
void f1(void) {
66
}

clang/test/Modules/debug-info-moduleimport.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
// RUN: %clang_cc1 -debug-info-kind=limited -fmodules -DGREETING="Hello World" -UNDEBUG -fimplicit-module-maps -fmodules-cache-path=%t %s -I %S/Inputs -isysroot /tmp/.. -I %t -emit-llvm -debugger-tuning=lldb -o - | FileCheck %s
99

1010
// CHECK: ![[CU:.*]] = distinct !DICompileUnit
11-
// CHECK-SAME: sysroot: "/tmp/..")
1211
@import DebugObjC;
1312
// CHECK: !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: ![[CU]],
1413
// CHECK-SAME: entity: ![[MODULE:.*]], file: ![[F:[0-9]+]],
1514
// CHECK-SAME: line: [[@LINE-3]])
1615
// CHECK: ![[MODULE]] = !DIModule(scope: null, name: "DebugObjC",
1716
// CHECK-SAME: configMacros: "\22-DGREETING=Hello World\22 \22-UNDEBUG\22",
18-
// CHECK-SAME: includePath: "{{.*}}test{{.*}}Modules{{.*}}Inputs"
17+
// CHECK-SAME: includePath: "{{.*}}test{{.*}}Modules{{.*}}Inputs",
18+
// CHECK-SAME: sysroot: "/tmp/..")
1919
// CHECK: ![[F]] = !DIFile(filename: {{.*}}debug-info-moduleimport.m
2020

2121
// RUN: %clang_cc1 -debug-info-kind=limited -fmodules -fimplicit-module-maps -fmodules-cache-path=%t \

lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -970,7 +970,7 @@ bool SymbolFileDWARF::ParseImportedModules(
970970
if (const char *include_path = module_die.GetAttributeValueAsString(
971971
DW_AT_LLVM_include_path, nullptr))
972972
module.search_path = ConstString(include_path);
973-
if (const char *sysroot = dwarf_cu->DIE().GetAttributeValueAsString(
973+
if (const char *sysroot = module_die.GetAttributeValueAsString(
974974
DW_AT_LLVM_sysroot, nullptr))
975975
module.sysroot = ConstString(sysroot);
976976
imported_modules.push_back(module);

llvm/bindings/go/llvm/dibuilder.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ type DICompileUnit struct {
117117
Optimized bool
118118
Flags string
119119
RuntimeVersion int
120-
SysRoot string
121120
}
122121

123122
// CreateCompileUnit creates compile unit debug metadata.
@@ -130,8 +129,6 @@ func (d *DIBuilder) CreateCompileUnit(cu DICompileUnit) Metadata {
130129
defer C.free(unsafe.Pointer(producer))
131130
flags := C.CString(cu.Flags)
132131
defer C.free(unsafe.Pointer(flags))
133-
sysroot := C.CString(cu.SysRoot)
134-
defer C.free(unsafe.Pointer(sysroot))
135132
result := C.LLVMDIBuilderCreateCompileUnit(
136133
d.ref,
137134
C.LLVMDWARFSourceLanguage(cu.Language),
@@ -145,7 +142,6 @@ func (d *DIBuilder) CreateCompileUnit(cu DICompileUnit) Metadata {
145142
/*DWOId=*/ 0,
146143
/*SplitDebugInlining*/ C.LLVMBool(boolToCInt(true)),
147144
/*DebugInfoForProfiling*/ C.LLVMBool(boolToCInt(false)),
148-
sysroot
149145
)
150146
return Metadata{C: result}
151147
}

llvm/include/llvm-c/DebugInfo.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -250,16 +250,14 @@ void LLVMDIBuilderFinalize(LLVMDIBuilderRef Builder);
250250
* \param SplitDebugInlining Whether to emit inline debug info.
251251
* \param DebugInfoForProfiling Whether to emit extra debug info for
252252
* profile collection.
253-
* \param SysRoot The Clang system root (value of -isysroot).
254-
* \param SysRootLen The length of the C string passed to \c SysRoot.
255253
*/
256254
LLVMMetadataRef LLVMDIBuilderCreateCompileUnit(
257255
LLVMDIBuilderRef Builder, LLVMDWARFSourceLanguage Lang,
258256
LLVMMetadataRef FileRef, const char *Producer, size_t ProducerLen,
259257
LLVMBool isOptimized, const char *Flags, size_t FlagsLen,
260258
unsigned RuntimeVer, const char *SplitName, size_t SplitNameLen,
261259
LLVMDWARFEmissionKind Kind, unsigned DWOId, LLVMBool SplitDebugInlining,
262-
LLVMBool DebugInfoForProfiling, const char *SysRoot, size_t SysRootLen);
260+
LLVMBool DebugInfoForProfiling);
263261

264262
/**
265263
* Create a file descriptor to hold debugging information for a file.
@@ -285,12 +283,15 @@ LLVMDIBuilderCreateFile(LLVMDIBuilderRef Builder, const char *Filename,
285283
* \param ConfigMacrosLen The length of the C string passed to \c ConfigMacros.
286284
* \param IncludePath The path to the module map file.
287285
* \param IncludePathLen The length of the C string passed to \c IncludePath.
286+
* \param SysRoot The Clang system root (value of -isysroot).
287+
* \param SysRootLen The length of the C string passed to \c SysRoot.
288288
*/
289289
LLVMMetadataRef
290290
LLVMDIBuilderCreateModule(LLVMDIBuilderRef Builder, LLVMMetadataRef ParentScope,
291291
const char *Name, size_t NameLen,
292292
const char *ConfigMacros, size_t ConfigMacrosLen,
293-
const char *IncludePath, size_t IncludePathLen);
293+
const char *IncludePath, size_t IncludePathLen,
294+
const char *SysRoot, size_t SysRootLen);
294295

295296
/**
296297
* Creates a new descriptor for a namespace with the specified parent scope.

llvm/include/llvm/IR/DIBuilder.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ namespace llvm {
135135
/// profile collection.
136136
/// \param NameTableKind Whether to emit .debug_gnu_pubnames,
137137
/// .debug_pubnames, or no pubnames at all.
138-
/// \param SysRoot The clang system root (value of -isysroot).
139138
DICompileUnit *
140139
createCompileUnit(unsigned Lang, DIFile *File, StringRef Producer,
141140
bool isOptimized, StringRef Flags, unsigned RV,
@@ -146,7 +145,7 @@ namespace llvm {
146145
bool DebugInfoForProfiling = false,
147146
DICompileUnit::DebugNameTableKind NameTableKind =
148147
DICompileUnit::DebugNameTableKind::Default,
149-
bool RangesBaseAddress = false, StringRef SysRoot = {});
148+
bool RangesBaseAddress = false);
150149

151150
/// Create a file descriptor to hold debugging information for a file.
152151
/// \param Filename File name.
@@ -735,9 +734,11 @@ namespace llvm {
735734
/// A space-separated shell-quoted list of -D macro
736735
/// definitions as they would appear on a command line.
737736
/// \param IncludePath The path to the module map file.
737+
/// \param SysRoot The clang system root (value of -isysroot).
738738
DIModule *createModule(DIScope *Scope, StringRef Name,
739739
StringRef ConfigurationMacros,
740-
StringRef IncludePath);
740+
StringRef IncludePath,
741+
StringRef SysRoot);
741742

742743
/// This creates a descriptor for a lexical block with a new file
743744
/// attached. This merely extends the existing

llvm/include/llvm/IR/DebugInfoMetadata.h

Lines changed: 40 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1172,16 +1172,16 @@ class DICompileUnit : public DIScope {
11721172
DIGlobalVariableExpressionArray GlobalVariables,
11731173
DIImportedEntityArray ImportedEntities, DIMacroNodeArray Macros,
11741174
uint64_t DWOId, bool SplitDebugInlining, bool DebugInfoForProfiling,
1175-
unsigned NameTableKind, bool RangesBaseAddress, StringRef SysRoot,
1176-
StorageType Storage, bool ShouldCreate = true) {
1177-
return getImpl(
1178-
Context, SourceLanguage, File, getCanonicalMDString(Context, Producer),
1179-
IsOptimized, getCanonicalMDString(Context, Flags), RuntimeVersion,
1180-
getCanonicalMDString(Context, SplitDebugFilename), EmissionKind,
1181-
EnumTypes.get(), RetainedTypes.get(), GlobalVariables.get(),
1182-
ImportedEntities.get(), Macros.get(), DWOId, SplitDebugInlining,
1183-
DebugInfoForProfiling, NameTableKind, RangesBaseAddress,
1184-
getCanonicalMDString(Context, SysRoot), Storage, ShouldCreate);
1175+
unsigned NameTableKind, bool RangesBaseAddress, StorageType Storage,
1176+
bool ShouldCreate = true) {
1177+
return getImpl(Context, SourceLanguage, File,
1178+
getCanonicalMDString(Context, Producer), IsOptimized,
1179+
getCanonicalMDString(Context, Flags), RuntimeVersion,
1180+
getCanonicalMDString(Context, SplitDebugFilename),
1181+
EmissionKind, EnumTypes.get(), RetainedTypes.get(),
1182+
GlobalVariables.get(), ImportedEntities.get(), Macros.get(),
1183+
DWOId, SplitDebugInlining, DebugInfoForProfiling,
1184+
NameTableKind, RangesBaseAddress, Storage, ShouldCreate);
11851185
}
11861186
static DICompileUnit *
11871187
getImpl(LLVMContext &Context, unsigned SourceLanguage, Metadata *File,
@@ -1191,8 +1191,7 @@ class DICompileUnit : public DIScope {
11911191
Metadata *GlobalVariables, Metadata *ImportedEntities,
11921192
Metadata *Macros, uint64_t DWOId, bool SplitDebugInlining,
11931193
bool DebugInfoForProfiling, unsigned NameTableKind,
1194-
bool RangesBaseAddress, MDString *SysRoot, StorageType Storage,
1195-
bool ShouldCreate = true);
1194+
bool RangesBaseAddress, StorageType Storage, bool ShouldCreate = true);
11961195

11971196
TempDICompileUnit cloneImpl() const {
11981197
return getTemporary(
@@ -1201,7 +1200,7 @@ class DICompileUnit : public DIScope {
12011200
getEmissionKind(), getEnumTypes(), getRetainedTypes(),
12021201
getGlobalVariables(), getImportedEntities(), getMacros(), DWOId,
12031202
getSplitDebugInlining(), getDebugInfoForProfiling(), getNameTableKind(),
1204-
getRangesBaseAddress(), getSysRoot());
1203+
getRangesBaseAddress());
12051204
}
12061205

12071206
public:
@@ -1217,13 +1216,11 @@ class DICompileUnit : public DIScope {
12171216
DIGlobalVariableExpressionArray GlobalVariables,
12181217
DIImportedEntityArray ImportedEntities, DIMacroNodeArray Macros,
12191218
uint64_t DWOId, bool SplitDebugInlining, bool DebugInfoForProfiling,
1220-
DebugNameTableKind NameTableKind, bool RangesBaseAddress,
1221-
StringRef SysRoot),
1219+
DebugNameTableKind NameTableKind, bool RangesBaseAddress),
12221220
(SourceLanguage, File, Producer, IsOptimized, Flags, RuntimeVersion,
12231221
SplitDebugFilename, EmissionKind, EnumTypes, RetainedTypes,
12241222
GlobalVariables, ImportedEntities, Macros, DWOId, SplitDebugInlining,
1225-
DebugInfoForProfiling, (unsigned)NameTableKind, RangesBaseAddress,
1226-
SysRoot))
1223+
DebugInfoForProfiling, (unsigned)NameTableKind, RangesBaseAddress))
12271224
DEFINE_MDNODE_GET_DISTINCT_TEMPORARY(
12281225
DICompileUnit,
12291226
(unsigned SourceLanguage, Metadata *File, MDString *Producer,
@@ -1232,11 +1229,11 @@ class DICompileUnit : public DIScope {
12321229
Metadata *RetainedTypes, Metadata *GlobalVariables,
12331230
Metadata *ImportedEntities, Metadata *Macros, uint64_t DWOId,
12341231
bool SplitDebugInlining, bool DebugInfoForProfiling,
1235-
unsigned NameTableKind, bool RangesBaseAddress, MDString *SysRoot),
1232+
unsigned NameTableKind, bool RangesBaseAddress),
12361233
(SourceLanguage, File, Producer, IsOptimized, Flags, RuntimeVersion,
12371234
SplitDebugFilename, EmissionKind, EnumTypes, RetainedTypes,
12381235
GlobalVariables, ImportedEntities, Macros, DWOId, SplitDebugInlining,
1239-
DebugInfoForProfiling, NameTableKind, RangesBaseAddress, SysRoot))
1236+
DebugInfoForProfiling, NameTableKind, RangesBaseAddress))
12401237

12411238
TempDICompileUnit clone() const { return cloneImpl(); }
12421239

@@ -1253,10 +1250,14 @@ class DICompileUnit : public DIScope {
12531250
DebugNameTableKind getNameTableKind() const {
12541251
return (DebugNameTableKind)NameTableKind;
12551252
}
1256-
bool getRangesBaseAddress() const { return RangesBaseAddress; }
1257-
StringRef getProducer() const { return getStringOperand(1); }
1258-
StringRef getFlags() const { return getStringOperand(2); }
1259-
StringRef getSplitDebugFilename() const { return getStringOperand(3); }
1253+
bool getRangesBaseAddress() const {
1254+
return RangesBaseAddress; }
1255+
StringRef getProducer() const {
1256+
return getStringOperand(1); }
1257+
StringRef getFlags() const {
1258+
return getStringOperand(2); }
1259+
StringRef getSplitDebugFilename() const {
1260+
return getStringOperand(3); }
12601261
DICompositeTypeArray getEnumTypes() const {
12611262
return cast_or_null<MDTuple>(getRawEnumTypes());
12621263
}
@@ -1278,7 +1279,6 @@ class DICompileUnit : public DIScope {
12781279
void setSplitDebugInlining(bool SplitDebugInlining) {
12791280
this->SplitDebugInlining = SplitDebugInlining;
12801281
}
1281-
StringRef getSysRoot() const { return getStringOperand(9); }
12821282

12831283
MDString *getRawProducer() const { return getOperandAs<MDString>(1); }
12841284
MDString *getRawFlags() const { return getOperandAs<MDString>(2); }
@@ -1290,7 +1290,6 @@ class DICompileUnit : public DIScope {
12901290
Metadata *getRawGlobalVariables() const { return getOperand(6); }
12911291
Metadata *getRawImportedEntities() const { return getOperand(7); }
12921292
Metadata *getRawMacros() const { return getOperand(8); }
1293-
MDString *getRawSysRoot() const { return getOperandAs<MDString>(9); }
12941293

12951294
/// Replace arrays.
12961295
///
@@ -2083,45 +2082,50 @@ class DIModule : public DIScope {
20832082
: DIScope(Context, DIModuleKind, Storage, dwarf::DW_TAG_module, Ops) {}
20842083
~DIModule() = default;
20852084

2086-
static DIModule *getImpl(LLVMContext &Context, DIScope *Scope, StringRef Name,
2087-
StringRef ConfigurationMacros, StringRef IncludePath,
2085+
static DIModule *getImpl(LLVMContext &Context, DIScope *Scope,
2086+
StringRef Name, StringRef ConfigurationMacros,
2087+
StringRef IncludePath, StringRef SysRoot,
20882088
StorageType Storage, bool ShouldCreate = true) {
20892089
return getImpl(Context, Scope, getCanonicalMDString(Context, Name),
20902090
getCanonicalMDString(Context, ConfigurationMacros),
20912091
getCanonicalMDString(Context, IncludePath),
2092+
getCanonicalMDString(Context, SysRoot),
20922093
Storage, ShouldCreate);
20932094
}
20942095
static DIModule *getImpl(LLVMContext &Context, Metadata *Scope,
20952096
MDString *Name, MDString *ConfigurationMacros,
2096-
MDString *IncludePath, StorageType Storage,
2097-
bool ShouldCreate = true);
2097+
MDString *IncludePath, MDString *SysRoot,
2098+
StorageType Storage, bool ShouldCreate = true);
20982099

20992100
TempDIModule cloneImpl() const {
21002101
return getTemporary(getContext(), getScope(), getName(),
2101-
getConfigurationMacros(), getIncludePath());
2102+
getConfigurationMacros(), getIncludePath(),
2103+
getSysRoot());
21022104
}
21032105

21042106
public:
2105-
DEFINE_MDNODE_GET(DIModule,
2106-
(DIScope * Scope, StringRef Name,
2107-
StringRef ConfigurationMacros, StringRef IncludePath),
2108-
(Scope, Name, ConfigurationMacros, IncludePath))
2107+
DEFINE_MDNODE_GET(DIModule, (DIScope *Scope, StringRef Name,
2108+
StringRef ConfigurationMacros, StringRef IncludePath,
2109+
StringRef SysRoot),
2110+
(Scope, Name, ConfigurationMacros, IncludePath, SysRoot))
21092111
DEFINE_MDNODE_GET(DIModule,
21102112
(Metadata *Scope, MDString *Name, MDString *ConfigurationMacros,
2111-
MDString *IncludePath),
2112-
(Scope, Name, ConfigurationMacros, IncludePath))
2113+
MDString *IncludePath, MDString *SysRoot),
2114+
(Scope, Name, ConfigurationMacros, IncludePath, SysRoot))
21132115

21142116
TempDIModule clone() const { return cloneImpl(); }
21152117

21162118
DIScope *getScope() const { return cast_or_null<DIScope>(getRawScope()); }
21172119
StringRef getName() const { return getStringOperand(1); }
21182120
StringRef getConfigurationMacros() const { return getStringOperand(2); }
21192121
StringRef getIncludePath() const { return getStringOperand(3); }
2122+
StringRef getSysRoot() const { return getStringOperand(4); }
21202123

21212124
Metadata *getRawScope() const { return getOperand(0); }
21222125
MDString *getRawName() const { return getOperandAs<MDString>(1); }
21232126
MDString *getRawConfigurationMacros() const { return getOperandAs<MDString>(2); }
21242127
MDString *getRawIncludePath() const { return getOperandAs<MDString>(3); }
2128+
MDString *getRawSysRoot() const { return getOperandAs<MDString>(4); }
21252129

21262130
static bool classof(const Metadata *MD) {
21272131
return MD->getMetadataID() == DIModuleKind;

0 commit comments

Comments
 (0)