xref: /aosp_15_r20/external/clang/include/clang/Lex/ExternalPreprocessorSource.h (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li //===- ExternalPreprocessorSource.h - Abstract Macro Interface --*- C++ -*-===//
2*67e74705SXin Li //
3*67e74705SXin Li //                     The LLVM Compiler Infrastructure
4*67e74705SXin Li //
5*67e74705SXin Li // This file is distributed under the University of Illinois Open Source
6*67e74705SXin Li // License. See LICENSE.TXT for details.
7*67e74705SXin Li //
8*67e74705SXin Li //===----------------------------------------------------------------------===//
9*67e74705SXin Li //
10*67e74705SXin Li //  This file defines the ExternalPreprocessorSource interface, which enables
11*67e74705SXin Li //  construction of macro definitions from some external source.
12*67e74705SXin Li //
13*67e74705SXin Li //===----------------------------------------------------------------------===//
14*67e74705SXin Li #ifndef LLVM_CLANG_LEX_EXTERNALPREPROCESSORSOURCE_H
15*67e74705SXin Li #define LLVM_CLANG_LEX_EXTERNALPREPROCESSORSOURCE_H
16*67e74705SXin Li 
17*67e74705SXin Li namespace clang {
18*67e74705SXin Li 
19*67e74705SXin Li class IdentifierInfo;
20*67e74705SXin Li class Module;
21*67e74705SXin Li 
22*67e74705SXin Li /// \brief Abstract interface for external sources of preprocessor
23*67e74705SXin Li /// information.
24*67e74705SXin Li ///
25*67e74705SXin Li /// This abstract class allows an external sources (such as the \c ASTReader)
26*67e74705SXin Li /// to provide additional preprocessing information.
27*67e74705SXin Li class ExternalPreprocessorSource {
28*67e74705SXin Li public:
29*67e74705SXin Li   virtual ~ExternalPreprocessorSource();
30*67e74705SXin Li 
31*67e74705SXin Li   /// \brief Read the set of macros defined by this external macro source.
32*67e74705SXin Li   virtual void ReadDefinedMacros() = 0;
33*67e74705SXin Li 
34*67e74705SXin Li   /// \brief Update an out-of-date identifier.
35*67e74705SXin Li   virtual void updateOutOfDateIdentifier(IdentifierInfo &II) = 0;
36*67e74705SXin Li 
37*67e74705SXin Li   /// \brief Return the identifier associated with the given ID number.
38*67e74705SXin Li   ///
39*67e74705SXin Li   /// The ID 0 is associated with the NULL identifier.
40*67e74705SXin Li   virtual IdentifierInfo *GetIdentifier(unsigned ID) = 0;
41*67e74705SXin Li 
42*67e74705SXin Li   /// \brief Map a module ID to a module.
43*67e74705SXin Li   virtual Module *getModule(unsigned ModuleID) = 0;
44*67e74705SXin Li };
45*67e74705SXin Li 
46*67e74705SXin Li }
47*67e74705SXin Li 
48*67e74705SXin Li #endif
49