forked from OSchip/llvm-project
[DWARF] Don't keep a ref to possibly stack allocated data.
llvm-svn: 335146
This commit is contained in:
parent
34b9112216
commit
8e3e374e5f
|
@ -213,7 +213,7 @@ struct MCDwarfLineTableHeader {
|
|||
SmallVector<std::string, 3> MCDwarfDirs;
|
||||
SmallVector<MCDwarfFile, 3> MCDwarfFiles;
|
||||
StringMap<unsigned> SourceIdMap;
|
||||
StringRef CompilationDir;
|
||||
std::string CompilationDir;
|
||||
MCDwarfFile RootFile;
|
||||
bool HasSource = false;
|
||||
private:
|
||||
|
|
|
@ -389,8 +389,8 @@ void MCDwarfLineTableHeader::emitV5FileDirTables(
|
|||
: dwarf::DW_FORM_string);
|
||||
MCOS->EmitULEB128IntValue(MCDwarfDirs.size() + 1);
|
||||
// Try not to emit an empty compilation directory.
|
||||
const StringRef &CompDir =
|
||||
CompilationDir.empty() ? CtxCompilationDir : CompilationDir;
|
||||
const StringRef CompDir =
|
||||
CompilationDir.empty() ? CtxCompilationDir : StringRef(CompilationDir);
|
||||
if (LineStr) {
|
||||
// Record path strings, emit references here.
|
||||
LineStr->emitRef(MCOS, CompDir);
|
||||
|
|
|
@ -3,18 +3,20 @@
|
|||
# REQUIRES: default_triple
|
||||
# Darwin is stuck on DWARF v2.
|
||||
# XFAIL: darwin
|
||||
.file 0 "root.cpp"
|
||||
.file 1 "header.h"
|
||||
.file 2 "root.cpp"
|
||||
# CHECK-5: include_directories[ 0] = "{{.+}}"
|
||||
# CHECK-4-NOT: include_directories
|
||||
.file 0 "/test" "root.cpp"
|
||||
.file 1 "/include" "header.h"
|
||||
.file 2 "/test" "root.cpp"
|
||||
# CHECK-5: include_directories[ 0] = "/test"
|
||||
# CHECK-4-NOT: include_directories[ 0]
|
||||
# CHECK: include_directories[ 1] = "/include"
|
||||
# CHECK-NOT: include_directories
|
||||
# CHECK-4-NOT: file_names[ 0]
|
||||
# CHECK-5: file_names[ 0]:
|
||||
# CHECK-5-NEXT: name: "root.cpp"
|
||||
# CHECK-5-NEXT: dir_index: 0
|
||||
# CHECK: file_names[ 1]:
|
||||
# CHECK-NEXT: name: "header.h"
|
||||
# CHECK-NEXT: dir_index: 0
|
||||
# CHECK-NEXT: dir_index: 1
|
||||
# CHECK: file_names[ 2]:
|
||||
# CHECK-NEXT: name: "root.cpp"
|
||||
# CHECK-NEXT: dir_index: 0
|
||||
|
|
Loading…
Reference in New Issue