[llvm-commits] [llvm] r42275 - /llvm/trunk/lib/CodeGen/DwarfWriter.cpp
Dan Gohman
djg at cray.com
Mon Sep 24 14:32:19 PDT 2007
Author: djg
Date: Mon Sep 24 16:32:18 2007
New Revision: 42275
URL: http://llvm.org/viewvc/llvm-project?rev=42275&view=rev
Log:
Add support for emitting .file directives to set up file numbers for
use with .loc directives.
Modified:
llvm/trunk/lib/CodeGen/DwarfWriter.cpp
Modified: llvm/trunk/lib/CodeGen/DwarfWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/DwarfWriter.cpp?rev=42275&r1=42274&r2=42275&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/DwarfWriter.cpp (original)
+++ llvm/trunk/lib/CodeGen/DwarfWriter.cpp Mon Sep 24 16:32:18 2007
@@ -28,6 +28,7 @@
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/DataTypes.h"
#include "llvm/Support/Mangler.h"
+#include "llvm/System/Path.h"
#include "llvm/Target/TargetAsmInfo.h"
#include "llvm/Target/MRegisterInfo.h"
#include "llvm/Target/TargetData.h"
@@ -1967,6 +1968,19 @@
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());
More information about the llvm-commits
mailing list