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 /// \file
00011 /// \brief Defines the PrettyStackTraceEntry class, which is used to make
00012 /// crashes give more contextual information about what the program was doing
00013 /// when it crashed.
00014 ///
00015 //===----------------------------------------------------------------------===//
00016 
00017 #ifndef LLVM_CLANG_BASIC_PRETTYSTACKTRACE_H
00018 #define LLVM_CLANG_BASIC_PRETTYSTACKTRACE_H
00019 
00020 #include "clang/Basic/SourceLocation.h"
00021 #include "llvm/Support/PrettyStackTrace.h"
00022 
00023 namespace clang {
00024 
00025   /// If a crash happens while one of these objects are live, the message
00026   /// is printed out along with the specified source location.
00027   class PrettyStackTraceLoc : public llvm::PrettyStackTraceEntry {
00028     SourceManager &SM;
00029     SourceLocation Loc;
00030     const char *Message;
00031   public:
00032     PrettyStackTraceLoc(SourceManager &sm, SourceLocation L, const char *Msg)
00033       : SM(sm), Loc(L), Message(Msg) {}
00034     void print(raw_ostream &OS) const override;
00035   };
00036 }
00037 
00038 #endif