1193326Sed//===- clang/Basic/PrettyStackTrace.h - Pretty Crash Handling --*- C++ -*-===// 2193326Sed// 3193326Sed// The LLVM Compiler Infrastructure 4193326Sed// 5193326Sed// This file is distributed under the University of Illinois Open Source 6193326Sed// License. See LICENSE.TXT for details. 7193326Sed// 8193326Sed//===----------------------------------------------------------------------===// 9239462Sdim/// 10239462Sdim/// \file 11239462Sdim/// \brief Defines the PrettyStackTraceEntry class, which is used to make 12239462Sdim/// crashes give more contextual information about what the program was doing 13239462Sdim/// when it crashed. 14239462Sdim/// 15193326Sed//===----------------------------------------------------------------------===// 16193326Sed 17193326Sed#ifndef CLANG_BASIC_PRETTYSTACKTRACE_H 18193326Sed#define CLANG_BASIC_PRETTYSTACKTRACE_H 19193326Sed 20193326Sed#include "clang/Basic/SourceLocation.h" 21193326Sed#include "llvm/Support/PrettyStackTrace.h" 22193326Sed 23193326Sednamespace clang { 24193326Sed 25239462Sdim /// If a crash happens while one of these objects are live, the message 26239462Sdim /// is printed out along with the specified source location. 27193326Sed class PrettyStackTraceLoc : public llvm::PrettyStackTraceEntry { 28193326Sed SourceManager &SM; 29193326Sed SourceLocation Loc; 30193326Sed const char *Message; 31193326Sed public: 32193326Sed PrettyStackTraceLoc(SourceManager &sm, SourceLocation L, const char *Msg) 33193326Sed : SM(sm), Loc(L), Message(Msg) {} 34226633Sdim virtual void print(raw_ostream &OS) const; 35193326Sed }; 36193326Sed} 37193326Sed 38193326Sed#endif 39