[llvm-commits] [llvm-gcc-4.2] r110133 - in /llvm-gcc-4.2/trunk/gcc: llvm-debug.cpp llvm-debug.h
Devang Patel
dpatel at apple.com
Tue Aug 3 13:00:53 PDT 2010
Author: dpatel
Date: Tue Aug 3 15:00:53 2010
New Revision: 110133
URL: http://llvm.org/viewvc/llvm-project?rev=110133&view=rev
Log:
Revert 109536 and 109522. They causes gdb testsuite regressions (file-statics.exp).
Modified:
llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp
llvm-gcc-4.2/trunk/gcc/llvm-debug.h
Modified: llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp?rev=110133&r1=110132&r2=110133&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp Tue Aug 3 15:00:53 2010
@@ -57,16 +57,28 @@
#endif
-/// DirectoryAndFile - If Filename is absolute then directory name is empty.
-/// Otherwise directory name is current working directory.
+/// DirectoryAndFile - Extract the directory and file name from a path. If no
+/// directory is specified, then use the source working directory.
static void DirectoryAndFile(const std::string &FullPath,
std::string &Directory, std::string &FileName) {
- FileName = FullPath;
-
- if (FullPath[0] != '/')
- Directory = std::string(get_src_pwd());
- else
+ // Look for the directory slash.
+ size_t Slash = FullPath.rfind('/');
+
+ // If no slash
+ if (Slash == std::string::npos) {
+ // The entire path is the file name.
Directory = "";
+ FileName = FullPath;
+ } else {
+ // Separate the directory from the file name.
+ Directory = FullPath.substr(0, Slash);
+ FileName = FullPath.substr(Slash + 1);
+ }
+
+ // If no directory present then use source working directory.
+ if (Directory.empty() || Directory[0] != '/') {
+ Directory = std::string(get_src_pwd()) + "/" + Directory;
+ }
}
/// NodeSizeInBits - Returns the size in bits stored in a tree node regardless
@@ -1381,6 +1393,11 @@
FullPath = main_input_filename;
}
+ // Get source file information.
+ std::string Directory;
+ std::string FileName;
+ DirectoryAndFile(FullPath, Directory, FileName);
+
// Set up Language number.
unsigned LangTag;
const std::string LanguageName(lang_hooks.name);
@@ -1415,8 +1432,8 @@
unsigned ObjcRunTimeVer = 0;
if (flag_objc_abi != 0 && flag_objc_abi != -1)
ObjcRunTimeVer = flag_objc_abi;
- return DebugFactory.CreateCompileUnit(LangTag, FullPath,
- get_src_pwd(),
+ return DebugFactory.CreateCompileUnit(LangTag, FileName.c_str(),
+ Directory.c_str(),
version_string, isMain,
optimize, Flags,
ObjcRunTimeVer);
@@ -1431,7 +1448,11 @@
FullPath = main_input_filename;
}
- return DebugFactory.CreateFile(FullPath, get_src_pwd(), TheCU);
+ // Get source file information.
+ std::string Directory;
+ std::string FileName;
+ DirectoryAndFile(FullPath, Directory, FileName);
+ return DebugFactory.CreateFile(FileName, Directory, TheCU);
}
/* LLVM LOCAL end (ENTIRE FILE!) */
Modified: llvm-gcc-4.2/trunk/gcc/llvm-debug.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-debug.h?rev=110133&r1=110132&r2=110133&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-debug.h (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-debug.h Tue Aug 3 15:00:53 2010
@@ -63,7 +63,6 @@
int PrevLineNo; // Previous location line# encountered.
BasicBlock *PrevBB; // Last basic block encountered.
DICompileUnit TheCU; // The compile unit.
- std::string CWD; // Current working directory.
// Current GCC lexical block (or enclosing FUNCTION_DECL).
tree_node *CurrentGCCLexicalBlock;
More information about the llvm-commits
mailing list