summaryrefslogtreecommitdiffstats
path: root/include/clang/Basic/PrettyStackTrace.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-03-05 00:00:31 +0000
committerChris Lattner <sabre@nondot.org>2009-03-05 00:00:31 +0000
commitae50fa0a9e7217b043ed4ffe175af4b26dc90f34 (patch)
tree3de1dcb2640d415b118d0b3f51e5a97d8fbb0550 /include/clang/Basic/PrettyStackTrace.h
parent3aa7ecd53f8e4965188fbbf33a82380c798f309c (diff)
Include information about compound statements when crashing in sema or the
parser. For example, we now print out: 0. t.c:5:10: in compound statement {} 1. t.c:3:12: in compound statement {} 2. clang t.c -fsyntax-only git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66108 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Basic/PrettyStackTrace.h')
-rw-r--r--include/clang/Basic/PrettyStackTrace.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/include/clang/Basic/PrettyStackTrace.h b/include/clang/Basic/PrettyStackTrace.h
new file mode 100644
index 0000000000..8ee833bf67
--- /dev/null
+++ b/include/clang/Basic/PrettyStackTrace.h
@@ -0,0 +1,37 @@
+//===- clang/Basic/PrettyStackTrace.h - Pretty Crash Handling --*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file defines the PrettyStackTraceEntry class, which is used to make
+// crashes give more contextual information about what the program was doing
+// when it crashed.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef CLANG_BASIC_PRETTYSTACKTRACE_H
+#define CLANG_BASIC_PRETTYSTACKTRACE_H
+
+#include "clang/Basic/SourceLocation.h"
+#include "llvm/Support/PrettyStackTrace.h"
+
+namespace clang {
+
+ /// PrettyStackTraceLoc - If a crash happens while one of these objects are
+ /// live, .
+ class PrettyStackTraceLoc : public llvm::PrettyStackTraceEntry {
+ SourceManager &SM;
+ SourceLocation Loc;
+ const char *Message;
+ public:
+ PrettyStackTraceLoc(SourceManager &sm, SourceLocation L, const char *Msg)
+ : SM(sm), Loc(L), Message(Msg) {}
+ virtual void print(llvm::raw_ostream &OS) const;
+ };
+}
+
+#endif