aboutsummaryrefslogtreecommitdiff
path: root/lib/Target/PIC16/PIC16DebugInfo.cpp
diff options
context:
space:
mode:
authorSanjiv Gupta <sanjiv.gupta@microchip.com>2009-06-03 16:27:49 +0000
committerSanjiv Gupta <sanjiv.gupta@microchip.com>2009-06-03 16:27:49 +0000
commit3fc7e532aa18b6ee8958c53bc053b781f83f5833 (patch)
treef64731ab48ae8072ac9a6d43d547b7dd8c33b8f8 /lib/Target/PIC16/PIC16DebugInfo.cpp
parent4734ed8b876b3d3d60df5e03b3b45164f0a1c5c7 (diff)
Emit file directives correctly in case of a .bc is generated by llvm-ld after linking in several .bc files.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72781 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/PIC16/PIC16DebugInfo.cpp')
-rw-r--r--lib/Target/PIC16/PIC16DebugInfo.cpp26
1 files changed, 24 insertions, 2 deletions
diff --git a/lib/Target/PIC16/PIC16DebugInfo.cpp b/lib/Target/PIC16/PIC16DebugInfo.cpp
index 4d43811f24..faf4590b43 100644
--- a/lib/Target/PIC16/PIC16DebugInfo.cpp
+++ b/lib/Target/PIC16/PIC16DebugInfo.cpp
@@ -264,7 +264,29 @@ void PIC16DbgInfo::EmitFileDirective(Module &M) {
if (CU) {
DICompileUnit DIUnit(CU);
std::string Dir, FN;
- O << "\n\t.file\t\"" << DIUnit.getDirectory(Dir) <<"/"
- << DIUnit.getFilename(FN) << "\"" ;
+ std::string File = DIUnit.getDirectory(Dir) + "/" + DIUnit.getFilename(FN);
+ O << "\n\t.file\t\"" << File << "\"\n" ;
+ CurFile = File;
}
}
+
+void PIC16DbgInfo::EmitFileDirective(const Function *F) {
+ std::string FunctName = F->getName();
+ DISubprogram *SP = getFunctDI(FunctName);
+ if (SP) {
+ std::string Dir, FN;
+ DICompileUnit CU = SP->getCompileUnit();
+ std::string File = CU.getDirectory(Dir) + "/" + CU.getFilename(FN);
+ if ( File != CurFile) {
+ EmitEOF();
+ O << "\n\t.file\t\"" << File << "\"\n" ;
+ CurFile = File;
+ }
+ }
+}
+
+void PIC16DbgInfo::EmitEOF() {
+ if (CurFile != "")
+ O << "\n\t.EOF";
+}
+