clang API Documentation
00001 //==- PrettyStackTraceLocationContext.h - show analysis backtrace --*- 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 #ifndef LLVM_CLANG_LIB_STATICANALYZER_CORE_PRETTYSTACKTRACELOCATIONCONTEXT_H 00011 #define LLVM_CLANG_LIB_STATICANALYZER_CORE_PRETTYSTACKTRACELOCATIONCONTEXT_H 00012 00013 #include "clang/Analysis/AnalysisContext.h" 00014 00015 namespace clang { 00016 namespace ento { 00017 00018 /// While alive, includes the current analysis stack in a crash trace. 00019 /// 00020 /// Example: 00021 /// \code 00022 /// 0. Program arguments: ... 00023 /// 1. <eof> parser at end of file 00024 /// 2. While analyzing stack: 00025 /// #0 void inlined() 00026 /// #1 void test() 00027 /// 3. crash-trace.c:6:3: Error evaluating statement 00028 /// \endcode 00029 class PrettyStackTraceLocationContext : public llvm::PrettyStackTraceEntry { 00030 const LocationContext *LCtx; 00031 public: 00032 PrettyStackTraceLocationContext(const LocationContext *LC) : LCtx(LC) { 00033 assert(LCtx); 00034 } 00035 00036 void print(raw_ostream &OS) const override { 00037 OS << "While analyzing stack: \n"; 00038 LCtx->dumpStack(OS, "\t"); 00039 } 00040 }; 00041 00042 } // end ento namespace 00043 } // end clang namespace 00044 00045 #endif