diff options
| author | Dan Gohman <gohman@apple.com> | 2007-10-01 22:40:20 +0000 |
|---|---|---|
| committer | Dan Gohman <gohman@apple.com> | 2007-10-01 22:40:20 +0000 |
| commit | 9765cc3bbb1cdb93272e762f7c7bc6911b5b92d4 (patch) | |
| tree | b20a67155e4b4d0c41ce7abc58619c30f8bfa11e /llvm/lib/CodeGen/DwarfWriter.cpp | |
| parent | 89ca5b091f9f64655b1f00b0794d719736312225 (diff) | |
| download | bcm5719-llvm-9765cc3bbb1cdb93272e762f7c7bc6911b5b92d4.tar.gz bcm5719-llvm-9765cc3bbb1cdb93272e762f7c7bc6911b5b92d4.zip | |
Move the code that emits the .file directives so that it runs after the
SourceFiles list is fully filled in so that it sees all of the files.
llvm-svn: 42506
Diffstat (limited to 'llvm/lib/CodeGen/DwarfWriter.cpp')
| -rw-r--r-- | llvm/lib/CodeGen/DwarfWriter.cpp | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/llvm/lib/CodeGen/DwarfWriter.cpp b/llvm/lib/CodeGen/DwarfWriter.cpp index e6ed8f0bffa..e6ec43eed3d 100644 --- a/llvm/lib/CodeGen/DwarfWriter.cpp +++ b/llvm/lib/CodeGen/DwarfWriter.cpp @@ -1971,19 +1971,6 @@ private: if (didInitial) return; didInitial = true; - // Print out .file directives to specify files for .loc directives. - if (TAI->hasDotLocAndDotFile()) { - const UniqueVector<SourceFileInfo> &SourceFiles = MMI->getSourceFiles(); - const UniqueVector<std::string> &Directories = MMI->getDirectories(); - for (unsigned i = 1, e = SourceFiles.size(); i <= e; ++i) { - sys::Path FullPath(Directories[SourceFiles[i].getDirectoryID()]); - bool AppendOk = FullPath.appendComponent(SourceFiles[i].getName()); - assert(AppendOk && "Could not append filename to directory!"); - Asm->EmitFile(i, FullPath.toString()); - Asm->EOL(); - } - } - // Dwarf sections base addresses. if (TAI->doesDwarfRequireFrameSection()) { Asm->SwitchToDataSection(TAI->getDwarfFrameSection()); @@ -2626,9 +2613,6 @@ public: MMI = mmi; shouldEmit = true; - // Emit initial sections - EmitInitial(); - // Create all the compile unit DIEs. ConstructCompileUnitDIEs(); @@ -2640,6 +2624,23 @@ public: // Prime section data. SectionMap.insert(TAI->getTextSection()); + + // Print out .file directives to specify files for .loc directives. These + // are printed out early so that they precede any .loc directives. + if (TAI->hasDotLocAndDotFile()) { + const UniqueVector<SourceFileInfo> &SourceFiles = MMI->getSourceFiles(); + const UniqueVector<std::string> &Directories = MMI->getDirectories(); + for (unsigned i = 1, e = SourceFiles.size(); i <= e; ++i) { + sys::Path FullPath(Directories[SourceFiles[i].getDirectoryID()]); + bool AppendOk = FullPath.appendComponent(SourceFiles[i].getName()); + assert(AppendOk && "Could not append filename to directory!"); + Asm->EmitFile(i, FullPath.toString()); + Asm->EOL(); + } + } + + // Emit initial sections + EmitInitial(); } } |

