xref: /freebsd/contrib/llvm-project/clang/include/clang/Serialization/ASTDeserializationListener.h (revision 0fca6ea1d4eea4c934cfff25ac9ee8ad6fe95583)
1 //===- ASTDeserializationListener.h - Decl/Type PCH Read Events -*- 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 //  This file defines the ASTDeserializationListener class, which is notified
10 //  by the ASTReader whenever a type or declaration is deserialized.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_CLANG_SERIALIZATION_ASTDESERIALIZATIONLISTENER_H
15 #define LLVM_CLANG_SERIALIZATION_ASTDESERIALIZATIONLISTENER_H
16 
17 #include "clang/Basic/IdentifierTable.h"
18 #include "clang/Serialization/ASTBitCodes.h"
19 
20 namespace clang {
21 
22 class Decl;
23 class ASTReader;
24 class QualType;
25 class MacroDefinitionRecord;
26 class MacroInfo;
27 class Module;
28 class SourceLocation;
29 
30 class ASTDeserializationListener {
31 public:
32   virtual ~ASTDeserializationListener();
33 
34   /// The ASTReader was initialized.
ReaderInitialized(ASTReader * Reader)35   virtual void ReaderInitialized(ASTReader *Reader) { }
36 
37   /// An identifier was deserialized from the AST file.
IdentifierRead(serialization::IdentifierID ID,IdentifierInfo * II)38   virtual void IdentifierRead(serialization::IdentifierID ID,
39                               IdentifierInfo *II) { }
40   /// A macro was read from the AST file.
MacroRead(serialization::MacroID ID,MacroInfo * MI)41   virtual void MacroRead(serialization::MacroID ID, MacroInfo *MI) { }
42   /// A type was deserialized from the AST file. The ID here has the
43   ///        qualifier bits already removed, and T is guaranteed to be locally
44   ///        unqualified.
TypeRead(serialization::TypeIdx Idx,QualType T)45   virtual void TypeRead(serialization::TypeIdx Idx, QualType T) { }
46   /// A decl was deserialized from the AST file.
DeclRead(GlobalDeclID ID,const Decl * D)47   virtual void DeclRead(GlobalDeclID ID, const Decl *D) {}
48   /// A selector was read from the AST file.
SelectorRead(serialization::SelectorID iD,Selector Sel)49   virtual void SelectorRead(serialization::SelectorID iD, Selector Sel) {}
50   /// A macro definition was read from the AST file.
MacroDefinitionRead(serialization::PreprocessedEntityID,MacroDefinitionRecord * MD)51   virtual void MacroDefinitionRead(serialization::PreprocessedEntityID,
52                                    MacroDefinitionRecord *MD) {}
53   /// A module definition was read from the AST file.
ModuleRead(serialization::SubmoduleID ID,Module * Mod)54   virtual void ModuleRead(serialization::SubmoduleID ID, Module *Mod) {}
55   /// A module import was read from the AST file.
ModuleImportRead(serialization::SubmoduleID ID,SourceLocation ImportLoc)56   virtual void ModuleImportRead(serialization::SubmoduleID ID,
57                                 SourceLocation ImportLoc) {}
58 };
59 }
60 
61 #endif
62