diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-09-29 01:06:10 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-09-29 01:06:10 +0000 |
commit | f8afcffe6a0213760b64c211812b1750e1e1e967 (patch) | |
tree | 99f6628e78560ada79e11bbe7af546b3e5cac8b3 /include/clang/Lex/PPCallbacks.h | |
parent | e2ac16b09ea66ad955752381b82fb8719d003e5e (diff) |
For PPCallbacks::InclusionDirective() add a parameter for the module, whenever
an inclusion directive was automatically turned into a module import, and
PPCallbacks::moduleImport() for an explicit module import.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164874 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Lex/PPCallbacks.h')
-rw-r--r-- | include/clang/Lex/PPCallbacks.h | 42 |
1 files changed, 35 insertions, 7 deletions
diff --git a/include/clang/Lex/PPCallbacks.h b/include/clang/Lex/PPCallbacks.h index ec63ff3d03..8ba02cc4ea 100644 --- a/include/clang/Lex/PPCallbacks.h +++ b/include/clang/Lex/PPCallbacks.h @@ -16,6 +16,7 @@ #define LLVM_CLANG_LEX_PPCALLBACKS_H #include "clang/Lex/DirectoryLookup.h" +#include "clang/Lex/ModuleLoader.h" #include "clang/Basic/SourceLocation.h" #include "clang/Basic/DiagnosticIDs.h" #include "llvm/ADT/StringRef.h" @@ -99,9 +100,6 @@ public: /// \param File The actual file that may be included by this inclusion /// directive. /// - /// \param EndLoc The location of the last token within the inclusion - /// directive. - /// /// \param SearchPath Contains the search path which was used to find the file /// in the file system. If the file was found via an absolute include path, /// SearchPath will be empty. For framework includes, the SearchPath and @@ -113,6 +111,10 @@ public: /// /// \param RelativePath The path relative to SearchPath, at which the include /// file was found. This is equal to FileName except for framework includes. + /// + /// \param Imported The module, whenever an inclusion directive was + /// automatically turned into a module import or null otherwise. + /// virtual void InclusionDirective(SourceLocation HashLoc, const Token &IncludeTok, StringRef FileName, @@ -120,7 +122,23 @@ public: CharSourceRange FilenameRange, const FileEntry *File, StringRef SearchPath, - StringRef RelativePath) { + StringRef RelativePath, + const Module *Imported) { + } + + /// \brief Callback invoked whenever there was an explicit module-import + /// syntax. + /// + /// \param ImportLoc The location of import directive token. + /// + /// \param Path The identifiers (and their locations) of the module + /// "path", e.g., "std.vector" would be split into "std" and "vector". + /// + /// \param Imported The imported module; can be null if importing failed. + /// + virtual void moduleImport(SourceLocation ImportLoc, + ModuleIdPath Path, + const Module *Imported) { } /// \brief Callback invoked when the end of the main file is reached. @@ -272,11 +290,21 @@ public: CharSourceRange FilenameRange, const FileEntry *File, StringRef SearchPath, - StringRef RelativePath) { + StringRef RelativePath, + const Module *Imported) { First->InclusionDirective(HashLoc, IncludeTok, FileName, IsAngled, - FilenameRange, File, SearchPath, RelativePath); + FilenameRange, File, SearchPath, RelativePath, + Imported); Second->InclusionDirective(HashLoc, IncludeTok, FileName, IsAngled, - FilenameRange, File, SearchPath, RelativePath); + FilenameRange, File, SearchPath, RelativePath, + Imported); + } + + virtual void moduleImport(SourceLocation ImportLoc, + ModuleIdPath Path, + const Module *Imported) { + First->moduleImport(ImportLoc, Path, Imported); + Second->moduleImport(ImportLoc, Path, Imported); } virtual void EndOfMainFile() { |