PrettyStackTrace.h revision 280031
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/// \file
11/// \brief Defines the PrettyStackTraceEntry class, which is used to make
12/// crashes give more contextual information about what the program was doing
13/// when it crashed.
14///
15//===----------------------------------------------------------------------===//
16
17#ifndef LLVM_CLANG_BASIC_PRETTYSTACKTRACE_H
18#define LLVM_CLANG_BASIC_PRETTYSTACKTRACE_H
19
20#include "clang/Basic/SourceLocation.h"
21#include "llvm/Support/PrettyStackTrace.h"
22
23namespace clang {
24
25  /// If a crash happens while one of these objects are live, the message
26  /// is printed out along with the specified source location.
27  class PrettyStackTraceLoc : public llvm::PrettyStackTraceEntry {
28    SourceManager &SM;
29    SourceLocation Loc;
30    const char *Message;
31  public:
32    PrettyStackTraceLoc(SourceManager &sm, SourceLocation L, const char *Msg)
33      : SM(sm), Loc(L), Message(Msg) {}
34    void print(raw_ostream &OS) const override;
35  };
36}
37
38#endif
39