[dragonegg] r177230 - Fix assertion failure when compiling stdin with debug info.
Peter Collingbourne
peter at pcc.me.uk
Sat Mar 16 16:07:22 PDT 2013
Author: pcc
Date: Sat Mar 16 18:07:22 2013
New Revision: 177230
URL: http://llvm.org/viewvc/llvm-project?rev=177230&view=rev
Log:
Fix assertion failure when compiling stdin with debug info.
(The important change is in DebugInfo::getOrCreateFile; the other
changes are just consistency/cleanup.)
Added:
dragonegg/trunk/test/validator/c/stdin.c
Modified:
dragonegg/trunk/src/Debug.cpp
Modified: dragonegg/trunk/src/Debug.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Debug.cpp?rev=177230&r1=177229&r2=177230&view=diff
==============================================================================
--- dragonegg/trunk/src/Debug.cpp (original)
+++ dragonegg/trunk/src/Debug.cpp Sat Mar 16 18:07:22 2013
@@ -993,21 +993,16 @@ void DebugInfo::Initialize() {
// code generator accepts maximum one main compile unit per module. If a
// module does not contain any main compile unit then the code generator
// will emit multiple compile units in the output object file.
- if (!strcmp(main_input_filename, ""))
- getOrCreateCompileUnit("<stdin>", true);
- else
- getOrCreateCompileUnit(main_input_filename, true);
+ getOrCreateCompileUnit(main_input_filename, true);
}
/// getOrCreateCompileUnit - Get the compile unit from the cache or
/// create a new one if necessary.
void DebugInfo::getOrCreateCompileUnit(const char *FullPath, bool isMain) {
- if (!FullPath) {
- if (!strcmp(main_input_filename, ""))
- FullPath = "<stdin>";
- else
- FullPath = main_input_filename;
- }
+ if (!FullPath)
+ FullPath = main_input_filename;
+ if (!strcmp(FullPath, ""))
+ FullPath = "<stdin>";
// Get source file information.
std::string Directory;
@@ -1049,12 +1044,10 @@ void DebugInfo::getOrCreateCompileUnit(c
/// getOrCreateFile - Get DIFile descriptor.
DIFile DebugInfo::getOrCreateFile(const char *FullPath) {
- if (!FullPath) {
- if (!strcmp(main_input_filename, ""))
- FullPath = "<stdin>";
- else
- FullPath = main_input_filename;
- }
+ if (!FullPath)
+ FullPath = main_input_filename;
+ if (!strcmp(FullPath, ""))
+ FullPath = "<stdin>";
// Get source file information.
std::string Directory;
Added: dragonegg/trunk/test/validator/c/stdin.c
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/test/validator/c/stdin.c?rev=177230&view=auto
==============================================================================
--- dragonegg/trunk/test/validator/c/stdin.c (added)
+++ dragonegg/trunk/test/validator/c/stdin.c Sat Mar 16 18:07:22 2013
@@ -0,0 +1,3 @@
+// RUN: %dragonegg -g -x c -S -o /dev/null - < %s
+
+void dummy() {}
More information about the llvm-commits
mailing list