clang  14.0.0git
PrettyStackTrace.h
Go to the documentation of this file.
1 //===- clang/Basic/PrettyStackTrace.h - Pretty Crash Handling --*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 ///
9 /// \file
10 /// 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 LLVM_CLANG_BASIC_PRETTYSTACKTRACE_H
17 #define LLVM_CLANG_BASIC_PRETTYSTACKTRACE_H
18 
20 #include "llvm/Support/PrettyStackTrace.h"
21 
22 namespace clang {
23 
24  /// If a crash happens while one of these objects are live, the message
25  /// 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:
32  : SM(sm), Loc(L), Message(Msg) {}
33  void print(raw_ostream &OS) const override;
34  };
35 }
36 
37 #endif
clang::SourceLocation
Encodes a location in the source.
Definition: SourceLocation.h:88
clang::SourceManager
This class handles loading and caching of source files into memory.
Definition: SourceManager.h:626
clang::PrettyStackTraceLoc::PrettyStackTraceLoc
PrettyStackTraceLoc(SourceManager &sm, SourceLocation L, const char *Msg)
Definition: PrettyStackTrace.h:31
SourceLocation.h
clang::PrettyStackTraceLoc
If a crash happens while one of these objects are live, the message is printed out along with the spe...
Definition: PrettyStackTrace.h:26
clang
Definition: CalledOnceCheck.h:17
clang::PrettyStackTraceLoc::print
void print(raw_ostream &OS) const override
Definition: SourceLocation.cpp:33
SM
#define SM(sm)
Definition: Cuda.cpp:78