1 //===- ExternalPreprocessorSource.h - Abstract Macro Interface --*- 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 ExternalPreprocessorSource interface, which enables 10 // construction of macro definitions from some external source. 11 // 12 //===----------------------------------------------------------------------===// 13 #ifndef LLVM_CLANG_LEX_EXTERNALPREPROCESSORSOURCE_H 14 #define LLVM_CLANG_LEX_EXTERNALPREPROCESSORSOURCE_H 15 16 namespace clang { 17 18 class IdentifierInfo; 19 class Module; 20 21 /// Abstract interface for external sources of preprocessor 22 /// information. 23 /// 24 /// This abstract class allows an external sources (such as the \c ASTReader) 25 /// to provide additional preprocessing information. 26 class ExternalPreprocessorSource { 27 public: 28 virtual ~ExternalPreprocessorSource(); 29 30 /// Read the set of macros defined by this external macro source. 31 virtual void ReadDefinedMacros() = 0; 32 33 /// Update an out-of-date identifier. 34 virtual void updateOutOfDateIdentifier(IdentifierInfo &II) = 0; 35 36 /// Return the identifier associated with the given ID number. 37 /// 38 /// The ID 0 is associated with the NULL identifier. 39 virtual IdentifierInfo *GetIdentifier(unsigned ID) = 0; 40 41 /// Map a module ID to a module. 42 virtual Module *getModule(unsigned ModuleID) = 0; 43 }; 44 45 } 46 47 #endif 48