Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:36:40

0001 //===- PrettyDeclStackTrace.h - Stack trace for decl processing -*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 //
0009 // This file defines an llvm::PrettyStackTraceEntry object for showing
0010 // that a particular declaration was being processed when a crash
0011 // occurred.
0012 //
0013 //===----------------------------------------------------------------------===//
0014 
0015 #ifndef LLVM_CLANG_AST_PRETTYDECLSTACKTRACE_H
0016 #define LLVM_CLANG_AST_PRETTYDECLSTACKTRACE_H
0017 
0018 #include "clang/Basic/SourceLocation.h"
0019 #include "llvm/Support/PrettyStackTrace.h"
0020 
0021 namespace clang {
0022 
0023 class ASTContext;
0024 class Decl;
0025 
0026 /// PrettyDeclStackTraceEntry - If a crash occurs in the parser while
0027 /// parsing something related to a declaration, include that
0028 /// declaration in the stack trace.
0029 class PrettyDeclStackTraceEntry : public llvm::PrettyStackTraceEntry {
0030   ASTContext &Context;
0031   Decl *TheDecl;
0032   SourceLocation Loc;
0033   const char *Message;
0034 
0035 public:
0036   PrettyDeclStackTraceEntry(ASTContext &Ctx, Decl *D, SourceLocation Loc,
0037                             const char *Msg)
0038     : Context(Ctx), TheDecl(D), Loc(Loc), Message(Msg) {}
0039 
0040   void print(raw_ostream &OS) const override;
0041 };
0042 
0043 }
0044 
0045 #endif