1f312b1ea179f1c44371f9ee0cd0bc006f612de11John McCall//===- PrettyDeclStackTrace.h - Stack trace for decl processing -*- C++ -*-===// 2f312b1ea179f1c44371f9ee0cd0bc006f612de11John McCall// 3f312b1ea179f1c44371f9ee0cd0bc006f612de11John McCall// The LLVM Compiler Infrastructure 4f312b1ea179f1c44371f9ee0cd0bc006f612de11John McCall// 5f312b1ea179f1c44371f9ee0cd0bc006f612de11John McCall// This file is distributed under the University of Illinois Open Source 6f312b1ea179f1c44371f9ee0cd0bc006f612de11John McCall// License. See LICENSE.TXT for details. 7f312b1ea179f1c44371f9ee0cd0bc006f612de11John McCall// 8f312b1ea179f1c44371f9ee0cd0bc006f612de11John McCall//===----------------------------------------------------------------------===// 9f312b1ea179f1c44371f9ee0cd0bc006f612de11John McCall// 10f312b1ea179f1c44371f9ee0cd0bc006f612de11John McCall// This file defines an llvm::PrettyStackTraceEntry object for showing 11f312b1ea179f1c44371f9ee0cd0bc006f612de11John McCall// that a particular declaration was being processed when a crash 12f312b1ea179f1c44371f9ee0cd0bc006f612de11John McCall// occurred. 13f312b1ea179f1c44371f9ee0cd0bc006f612de11John McCall// 14f312b1ea179f1c44371f9ee0cd0bc006f612de11John McCall//===----------------------------------------------------------------------===// 15f312b1ea179f1c44371f9ee0cd0bc006f612de11John McCall 16f312b1ea179f1c44371f9ee0cd0bc006f612de11John McCall#ifndef LLVM_CLANG_SEMA_PRETTY_DECL_STACK_TRACE_H 17f312b1ea179f1c44371f9ee0cd0bc006f612de11John McCall#define LLVM_CLANG_SEMA_PRETTY_DECL_STACK_TRACE_H 18f312b1ea179f1c44371f9ee0cd0bc006f612de11John McCall 19f312b1ea179f1c44371f9ee0cd0bc006f612de11John McCall#include "clang/Basic/SourceLocation.h" 20f312b1ea179f1c44371f9ee0cd0bc006f612de11John McCall#include "llvm/Support/PrettyStackTrace.h" 21f312b1ea179f1c44371f9ee0cd0bc006f612de11John McCall 22f312b1ea179f1c44371f9ee0cd0bc006f612de11John McCallnamespace clang { 23f312b1ea179f1c44371f9ee0cd0bc006f612de11John McCall 24f312b1ea179f1c44371f9ee0cd0bc006f612de11John McCallclass Decl; 25f312b1ea179f1c44371f9ee0cd0bc006f612de11John McCallclass Sema; 26f312b1ea179f1c44371f9ee0cd0bc006f612de11John McCallclass SourceManager; 27f312b1ea179f1c44371f9ee0cd0bc006f612de11John McCall 28f312b1ea179f1c44371f9ee0cd0bc006f612de11John McCall/// PrettyDeclStackTraceEntry - If a crash occurs in the parser while 29f312b1ea179f1c44371f9ee0cd0bc006f612de11John McCall/// parsing something related to a declaration, include that 30f312b1ea179f1c44371f9ee0cd0bc006f612de11John McCall/// declaration in the stack trace. 31f312b1ea179f1c44371f9ee0cd0bc006f612de11John McCallclass PrettyDeclStackTraceEntry : public llvm::PrettyStackTraceEntry { 32f312b1ea179f1c44371f9ee0cd0bc006f612de11John McCall Sema &S; 33f312b1ea179f1c44371f9ee0cd0bc006f612de11John McCall Decl *TheDecl; 34f312b1ea179f1c44371f9ee0cd0bc006f612de11John McCall SourceLocation Loc; 35f312b1ea179f1c44371f9ee0cd0bc006f612de11John McCall const char *Message; 36b5adc4636f653b37891792d2a279e889dab0935fDavid Blaikie 37f312b1ea179f1c44371f9ee0cd0bc006f612de11John McCallpublic: 38b5adc4636f653b37891792d2a279e889dab0935fDavid Blaikie PrettyDeclStackTraceEntry(Sema &S, Decl *D, SourceLocation Loc, 39b5adc4636f653b37891792d2a279e889dab0935fDavid Blaikie const char *Msg) 40f312b1ea179f1c44371f9ee0cd0bc006f612de11John McCall : S(S), TheDecl(D), Loc(Loc), Message(Msg) {} 41f312b1ea179f1c44371f9ee0cd0bc006f612de11John McCall 42651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines void print(raw_ostream &OS) const override; 43f312b1ea179f1c44371f9ee0cd0bc006f612de11John McCall}; 44f312b1ea179f1c44371f9ee0cd0bc006f612de11John McCall 45f312b1ea179f1c44371f9ee0cd0bc006f612de11John McCall} 46f312b1ea179f1c44371f9ee0cd0bc006f612de11John McCall 47f312b1ea179f1c44371f9ee0cd0bc006f612de11John McCall#endif 48