1 //===- PrettyDeclStackTrace.h - Stack trace for decl processing -*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 // This file defines an llvm::PrettyStackTraceEntry object for showing
10 // that a particular declaration was being processed when a crash
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_CLANG_AST_PRETTYDECLSTACKTRACE_H
16 #define LLVM_CLANG_AST_PRETTYDECLSTACKTRACE_H
18 #include "clang/Basic/SourceLocation.h"
19 #include "llvm/Support/PrettyStackTrace.h"
26 /// PrettyDeclStackTraceEntry - If a crash occurs in the parser while
27 /// parsing something related to a declaration, include that
28 /// declaration in the stack trace.
29 class PrettyDeclStackTraceEntry : public llvm::PrettyStackTraceEntry {
36 PrettyDeclStackTraceEntry(ASTContext &Ctx, Decl *D, SourceLocation Loc,
38 : Context(Ctx), TheDecl(D), Loc(Loc), Message(Msg) {}
40 void print(raw_ostream &OS) const override;