Fix crash generating debug info for constructor for anonymous struct.

llvm-svn: 93601
This commit is contained in:
Eli Friedman 2010-01-16 00:43:13 +00:00
parent 97598f0cba
commit 8fdc2cb46a
2 changed files with 7 additions and 1 deletions

View File

@ -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);

View File

@ -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;
}