clang  14.0.0git
PrettyStackTraceLocationContext.h
Go to the documentation of this file.
1 //==- PrettyStackTraceLocationContext.h - show analysis backtrace --*- C++ -*-//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLVM_CLANG_LIB_STATICANALYZER_CORE_PRETTYSTACKTRACELOCATIONCONTEXT_H
10 #define LLVM_CLANG_LIB_STATICANALYZER_CORE_PRETTYSTACKTRACELOCATIONCONTEXT_H
11 
13 
14 namespace clang {
15 namespace ento {
16 
17 /// While alive, includes the current analysis stack in a crash trace.
18 ///
19 /// Example:
20 /// \code
21 /// 0. Program arguments: ...
22 /// 1. <eof> parser at end of file
23 /// 2. While analyzing stack:
24 /// #0 void inlined()
25 /// #1 void test()
26 /// 3. crash-trace.c:6:3: Error evaluating statement
27 /// \endcode
28 class PrettyStackTraceLocationContext : public llvm::PrettyStackTraceEntry {
29  const LocationContext *LCtx;
30 public:
32  assert(LCtx);
33  }
34 
35  void print(raw_ostream &Out) const override {
36  Out << "While analyzing stack: \n";
37  LCtx->dumpStack(Out);
38  }
39 };
40 
41 } // end ento namespace
42 } // end clang namespace
43 
44 #endif
clang::LocationContext
It wraps the AnalysisDeclContext to represent both the call stack with the help of StackFrameContext ...
Definition: AnalysisDeclContext.h:215
AnalysisDeclContext.h
clang::ento::PrettyStackTraceLocationContext::print
void print(raw_ostream &Out) const override
Definition: PrettyStackTraceLocationContext.h:35
clang::LocationContext::dumpStack
LLVM_DUMP_METHOD void dumpStack(raw_ostream &Out) const
Prints out the call stack.
Definition: AnalysisDeclContext.cpp:497
clang::ento::PrettyStackTraceLocationContext::PrettyStackTraceLocationContext
PrettyStackTraceLocationContext(const LocationContext *LC)
Definition: PrettyStackTraceLocationContext.h:31
clang
Definition: CalledOnceCheck.h:17
clang::ento::PrettyStackTraceLocationContext
While alive, includes the current analysis stack in a crash trace.
Definition: PrettyStackTraceLocationContext.h:28