diff options
author | Chris Lattner <sabre@nondot.org> | 2009-03-05 01:25:28 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-03-05 01:25:28 +0000 |
commit | 03b5394da7a8c75c9007568a7c32f4bd65efcb95 (patch) | |
tree | b1578eb7ab0d1350eb4a630a8947e2c9c758b3d7 /clang/lib/Sema/SemaDecl.cpp | |
parent | 626aecc4be4432d642cc5bb098e33a85539c77ee (diff) | |
download | bcm5719-llvm-03b5394da7a8c75c9007568a7c32f4bd65efcb95.tar.gz bcm5719-llvm-03b5394da7a8c75c9007568a7c32f4bd65efcb95.zip |
When parsing a function body, add it to the crash stack, giving us something
like:
Stack dump:
0. t.c:5:10: in compound statement ('{}')
1. t.c:3:12: in compound statement ('{}')
2. t.c:3:12: parsing function body 'foo'
3. clang t.c
Abort
llvm-svn: 66118
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index e1b27c64a4d..97002ef02f0 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -30,6 +30,15 @@ #include <functional> using namespace clang; +/// getDeclName - Return a pretty name for the specified decl if possible, or +/// an empty string if not. This is used for pretty crash reporting. +std::string Sema::getDeclName(DeclTy *d) { + Decl *D = static_cast<Decl *>(d); + if (NamedDecl *DN = dyn_cast_or_null<NamedDecl>(D)) + return DN->getQualifiedNameAsString(); + return ""; +} + /// \brief If the identifier refers to a type name within this scope, /// return the declaration of that type. /// |