1280297Sjkim//===- clang/Basic/PrettyStackTrace.h - Pretty Crash Handling --*- C++ -*-===// 2280297Sjkim// 3280297Sjkim// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4238384Sjkim// See https://llvm.org/LICENSE.txt for license information. 5238384Sjkim// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6238384Sjkim// 7238384Sjkim//===----------------------------------------------------------------------===// 8238384Sjkim/// 9238384Sjkim/// \file 10238384Sjkim/// Defines the PrettyStackTraceEntry class, which is used to make 11238384Sjkim/// crashes give more contextual information about what the program was doing 12238384Sjkim/// when it crashed. 13280297Sjkim/// 14238384Sjkim//===----------------------------------------------------------------------===// 15238384Sjkim 16238384Sjkim#ifndef LLVM_CLANG_BASIC_PRETTYSTACKTRACE_H 17238384Sjkim#define LLVM_CLANG_BASIC_PRETTYSTACKTRACE_H 18238384Sjkim 19238384Sjkim#include "clang/Basic/SourceLocation.h" 20238384Sjkim#include "llvm/Support/PrettyStackTrace.h" 21238384Sjkim 22238384Sjkimnamespace clang { 23238384Sjkim 24238384Sjkim /// If a crash happens while one of these objects are live, the message 25238384Sjkim /// is printed out along with the specified source location. 26238384Sjkim class PrettyStackTraceLoc : public llvm::PrettyStackTraceEntry { 27238384Sjkim SourceManager &SM; 28238384Sjkim SourceLocation Loc; 29238384Sjkim const char *Message; 30238384Sjkim public: 31238384Sjkim PrettyStackTraceLoc(SourceManager &sm, SourceLocation L, const char *Msg) 32238384Sjkim : SM(sm), Loc(L), Message(Msg) {} 33238384Sjkim void print(raw_ostream &OS) const override; 34238384Sjkim }; 35238384Sjkim} 36238384Sjkim 37238384Sjkim#endif 38238384Sjkim