diff options
author | Sanjiv Gupta <sanjiv.gupta@microchip.com> | 2009-11-14 06:19:49 +0000 |
---|---|---|
committer | Sanjiv Gupta <sanjiv.gupta@microchip.com> | 2009-11-14 06:19:49 +0000 |
commit | 8f9c22646bfcbc311daf1cfcc82523af7f528ac2 (patch) | |
tree | 4af9d72662c600ac22d66e80658bfcacd0c44b90 /llvm/lib/Target/PIC16 | |
parent | c53e2ecf0296a55d3c33c19fb70a3aa7f81f2732 (diff) | |
download | bcm5719-llvm-8f9c22646bfcbc311daf1cfcc82523af7f528ac2.tar.gz bcm5719-llvm-8f9c22646bfcbc311daf1cfcc82523af7f528ac2.zip |
Fix debug info crashes for PIC16.
llvm-svn: 88761
Diffstat (limited to 'llvm/lib/Target/PIC16')
-rw-r--r-- | llvm/lib/Target/PIC16/PIC16DebugInfo.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/llvm/lib/Target/PIC16/PIC16DebugInfo.cpp b/llvm/lib/Target/PIC16/PIC16DebugInfo.cpp index 0ed44d21fc4..49df457af7e 100644 --- a/llvm/lib/Target/PIC16/PIC16DebugInfo.cpp +++ b/llvm/lib/Target/PIC16/PIC16DebugInfo.cpp @@ -467,12 +467,18 @@ void PIC16DbgInfo::EmitVarDebugInfo(Module &M) { void PIC16DbgInfo::SwitchToCU(MDNode *CU) { // Get the file path from CU. DICompileUnit cu(CU); - std::string DirName = cu.getDirectory(); - std::string FileName = cu.getFilename(); - std::string FilePath = DirName + "/" + FileName; + std::string FilePath = ""; + if (cu.getDirectory()) { + std::string DirName = cu.getDirectory(); + FilePath = FilePath + DirName + "/"; + } + if (cu.getFilename()) { + std::string FileName = cu.getFilename(); + FilePath = FilePath + FileName; + } - // Nothing to do if source file is still same. - if ( FilePath == CurFile ) return; + // Nothing to do if source file is still same or it is empty. + if ( FilePath == CurFile || FilePath == "") return; // Else, close the current one and start a new. if (CurFile != "") O << "\n\t.eof"; |