clang 8.0.0

PrettyStackTraceLocationContext.h
Go to the documentation of this file.
1 //==- PrettyStackTraceLocationContext.h - show analysis backtrace --*- C++ -*-//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #ifndef LLVM_CLANG_LIB_STATICANALYZER_CORE_PRETTYSTACKTRACELOCATIONCONTEXT_H
11 #define LLVM_CLANG_LIB_STATICANALYZER_CORE_PRETTYSTACKTRACELOCATIONCONTEXT_H
12
13 #include "clang/Analysis/AnalysisDeclContext.h"
14
15 namespace clang {
16 namespace ento {
17
18 /// While alive, includes the current analysis stack in a crash trace.
19 ///
20 /// Example:
21 /// \code
22 /// 0. Program arguments: ...
23 /// 1. <eof> parser at end of file
24 /// 2. While analyzing stack:
25 /// #0 void inlined()
26 /// #1 void test()
27 /// 3. crash-trace.c:6:3: Error evaluating statement
28 /// \endcode
29 class PrettyStackTraceLocationContext : public llvm::PrettyStackTraceEntry {
30 const LocationContext *LCtx;
31 public:
32 PrettyStackTraceLocationContext(const LocationContext *LC) : LCtx(LC) {
33 assert(LCtx);
34 }
35
36 void print(raw_ostream &OS) const override {
37 OS << "While analyzing stack: \n";
38 LCtx->dumpStack(OS, "\t");
39 }
40 };
41
42 } // end ento namespace
43 } // end clang namespace
44
45 #endif
ento
clang::LocationContext
Definition: AnalysisDeclContext.h:218
clang::LocationContext::dumpStack
void dumpStack(raw_ostream &OS, StringRef Indent={}, const char *NL="\, const char *Sep="", std::function< void(const LocationContext *)> printMoreInfoPerContext=[](const LocationContext *) {}) const
Definition: AnalysisDeclContext.cpp:474
clang::ento::PrettyStackTraceLocationContext::PrettyStackTraceLocationContext
PrettyStackTraceLocationContext(const LocationContext *LC)
Definition: PrettyStackTraceLocationContext.h:32
clang::ento::PrettyStackTraceLocationContext::print
void print(raw_ostream &OS) const override
Definition: PrettyStackTraceLocationContext.h:36
AnalysisDeclContext.h
clang::ento::PrettyStackTraceLocationContext
While alive, includes the current analysis stack in a crash trace.
Definition: PrettyStackTraceLocationContext.h:29
clang
Dataflow Directional Tag Classes.
Definition: CFGReachabilityAnalysis.h:22
clang::ento::ObjKind::OS
Indicates that the tracking object is a descendant of a referenced-counted OSObject, used in the Darwin kernel.