clang API Documentation
00001 //===- PrettyDeclStackTrace.h - Stack trace for decl processing -*- 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 // This file defines an llvm::PrettyStackTraceEntry object for showing 00011 // that a particular declaration was being processed when a crash 00012 // occurred. 00013 // 00014 //===----------------------------------------------------------------------===// 00015 00016 #ifndef LLVM_CLANG_SEMA_PRETTYDECLSTACKTRACE_H 00017 #define LLVM_CLANG_SEMA_PRETTYDECLSTACKTRACE_H 00018 00019 #include "clang/Basic/SourceLocation.h" 00020 #include "llvm/Support/PrettyStackTrace.h" 00021 00022 namespace clang { 00023 00024 class Decl; 00025 class Sema; 00026 class SourceManager; 00027 00028 /// PrettyDeclStackTraceEntry - If a crash occurs in the parser while 00029 /// parsing something related to a declaration, include that 00030 /// declaration in the stack trace. 00031 class PrettyDeclStackTraceEntry : public llvm::PrettyStackTraceEntry { 00032 Sema &S; 00033 Decl *TheDecl; 00034 SourceLocation Loc; 00035 const char *Message; 00036 00037 public: 00038 PrettyDeclStackTraceEntry(Sema &S, Decl *D, SourceLocation Loc, 00039 const char *Msg) 00040 : S(S), TheDecl(D), Loc(Loc), Message(Msg) {} 00041 00042 void print(raw_ostream &OS) const override; 00043 }; 00044 00045 } 00046 00047 #endif