summaryrefslogtreecommitdiffstats
path: root/llvm/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
commit215921ef94e05672d151c2619f7c52656f69a861 (patch)
tree8cb91809dcd860545a360e94f2a2606de7d80f40 /llvm/lib/Target/PIC16/PIC16DebugInfo.cpp
parent877b30f83c15d31eacd02637a315e4be42a4d179 (diff)
downloadbcm5719-llvm-215921ef94e05672d151c2619f7c52656f69a861.tar.gz
bcm5719-llvm-215921ef94e05672d151c2619f7c52656f69a861.zip
Emit file directives correctly in case of a .bc is generated by llvm-ld after linking in several .bc files.
llvm-svn: 72781
Diffstat (limited to 'llvm/lib/Target/PIC16/PIC16DebugInfo.cpp')
-rw-r--r--llvm/lib/Target/PIC16/PIC16DebugInfo.cpp26
1 files changed, 24 insertions, 2 deletions
diff --git a/llvm/lib/Target/PIC16/PIC16DebugInfo.cpp b/llvm/lib/Target/PIC16/PIC16DebugInfo.cpp
index 4d43811f24a..faf4590b43e 100644
--- a/llvm/lib/Target/PIC16/PIC16DebugInfo.cpp
+++ b/llvm/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";
+}
+
OpenPOWER on IntegriCloud