summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2010-01-16 00:43:13 +0000
committerEli Friedman <eli.friedman@gmail.com>2010-01-16 00:43:13 +0000
commit8fdc2cb46ab9c15fd02a9a77a908c0e820e5cb37 (patch)
tree7fb1657a781137c33ddbd893dd4568d767e1d518
parent97598f0cba4bec357d62f7ab33986d10fb0d3ae3 (diff)
downloadbcm5719-llvm-8fdc2cb46ab9c15fd02a9a77a908c0e820e5cb37.tar.gz
bcm5719-llvm-8fdc2cb46ab9c15fd02a9a77a908c0e820e5cb37.zip
Fix crash generating debug info for constructor for anonymous struct.
llvm-svn: 93601
-rw-r--r--clang/lib/CodeGen/CGDebugInfo.cpp2
-rw-r--r--clang/test/CodeGenCXX/debug-info.cpp6
2 files changed, 7 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index ab8f6637d6c..cc97d19a5a0 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -1001,7 +1001,7 @@ void CGDebugInfo::EmitFunctionStart(GlobalDecl GD, QualType FnType,
const Decl *D = GD.getDecl();
if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
Name = getFunctionName(FD);
- if (Name[0] == '\01')
+ if (!Name.empty() && Name[0] == '\01')
Name = Name.substr(1);
// Use mangled name as linkage name for c/c++ functions.
LinkageName = CGM.getMangledName(GD);
diff --git a/clang/test/CodeGenCXX/debug-info.cpp b/clang/test/CodeGenCXX/debug-info.cpp
index 705491e3a9b..cb6e830a49e 100644
--- a/clang/test/CodeGenCXX/debug-info.cpp
+++ b/clang/test/CodeGenCXX/debug-info.cpp
@@ -18,3 +18,9 @@ void f() {
int B::*a = 0;
void (B::*b)() = 0;
}
+
+namespace EmptyNameCrash {
+ struct A { A(); };
+ typedef struct { A x; } B;
+ B x;
+}
OpenPOWER on IntegriCloud