clang API Documentation

PrettyStackTrace.h
Go to the documentation of this file.
00001 //===- clang/Basic/PrettyStackTrace.h - Pretty Crash Handling --*- C++ -*-===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 // This file defines the PrettyStackTraceEntry class, which is used to make
00011 // crashes give more contextual information about what the program was doing
00012 // when it crashed.
00013 //
00014 //===----------------------------------------------------------------------===//
00015 
00016 #ifndef CLANG_BASIC_PRETTYSTACKTRACE_H
00017 #define CLANG_BASIC_PRETTYSTACKTRACE_H
00018 
00019 #include "clang/Basic/SourceLocation.h"
00020 #include "llvm/Support/PrettyStackTrace.h"
00021 
00022 namespace clang {
00023 
00024   /// PrettyStackTraceLoc - If a crash happens while one of these objects are
00025   /// live, the message is printed out along with the specified source location.
00026   class PrettyStackTraceLoc : public llvm::PrettyStackTraceEntry {
00027     SourceManager &SM;
00028     SourceLocation Loc;
00029     const char *Message;
00030   public:
00031     PrettyStackTraceLoc(SourceManager &sm, SourceLocation L, const char *Msg)
00032       : SM(sm), Loc(L), Message(Msg) {}
00033     virtual void print(raw_ostream &OS) const;
00034   };
00035 }
00036 
00037 #endif