Home | History | Annotate | Download | only in Basic
      1 //===- clang/Basic/PrettyStackTrace.h - Pretty Crash Handling --*- C++ -*-===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is distributed under the University of Illinois Open Source
      6 // License. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 //
     10 // This file defines the PrettyStackTraceEntry class, which is used to make
     11 // crashes give more contextual information about what the program was doing
     12 // when it crashed.
     13 //
     14 //===----------------------------------------------------------------------===//
     15 
     16 #ifndef CLANG_BASIC_PRETTYSTACKTRACE_H
     17 #define CLANG_BASIC_PRETTYSTACKTRACE_H
     18 
     19 #include "clang/Basic/SourceLocation.h"
     20 #include "llvm/Support/PrettyStackTrace.h"
     21 
     22 namespace clang {
     23 
     24   /// PrettyStackTraceLoc - If a crash happens while one of these objects are
     25   /// live, the message is printed out along with the specified source location.
     26   class PrettyStackTraceLoc : public llvm::PrettyStackTraceEntry {
     27     SourceManager &SM;
     28     SourceLocation Loc;
     29     const char *Message;
     30   public:
     31     PrettyStackTraceLoc(SourceManager &sm, SourceLocation L, const char *Msg)
     32       : SM(sm), Loc(L), Message(Msg) {}
     33     virtual void print(raw_ostream &OS) const;
     34   };
     35 }
     36 
     37 #endif
     38