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
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66118 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Parse/MinimalAction.cpp b/lib/Parse/MinimalAction.cpp
index 9cd5b97..5238a89 100644
--- a/lib/Parse/MinimalAction.cpp
+++ b/lib/Parse/MinimalAction.cpp
@@ -16,8 +16,23 @@
#include "clang/Parse/Scope.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/RecyclingAllocator.h"
+#include "llvm/Support/raw_ostream.h"
using namespace clang;
+void PrettyStackTraceDecl::print(llvm::raw_ostream &OS) const {
+ if (Loc.isValid()) {
+ Loc.print(OS, SM);
+ OS << ": ";
+ }
+ OS << Message;
+
+ std::string Name = Actions.getDeclName(TheDecl);
+ if (!Name.empty())
+ OS << " '" << Name << '\'';
+
+ OS << '\n';
+}
+
/// TypeNameInfo - A link exists here for each scope that an identifier is
/// defined.
namespace {