diff options
Diffstat (limited to 'include/clang')
-rw-r--r-- | include/clang/Lex/HeaderSearch.h | 12 | ||||
-rw-r--r-- | include/clang/Lex/PPCallbacks.h | 23 | ||||
-rw-r--r-- | include/clang/Lex/Preprocessor.h | 3 |
3 files changed, 36 insertions, 2 deletions
diff --git a/include/clang/Lex/HeaderSearch.h b/include/clang/Lex/HeaderSearch.h index b56fba538a..a6d7520f29 100644 --- a/include/clang/Lex/HeaderSearch.h +++ b/include/clang/Lex/HeaderSearch.h @@ -207,6 +207,15 @@ public: //LookupFileCache.clear(); } + /// AddSearchPath - Add an additional search path. + void AddSearchPath(const DirectoryLookup &dir, bool isAngled) { + unsigned idx = isAngled ? SystemDirIdx : AngledDirIdx; + SearchDirs.insert(SearchDirs.begin() + idx, dir); + if (!isAngled) + AngledDirIdx++; + SystemDirIdx++; + } + /// \brief Set the path to the module cache and the name of the module /// we're building void configureModules(StringRef CachePath, StringRef BuildingModule) { @@ -266,7 +275,8 @@ public: const FileEntry *CurFileEnt, SmallVectorImpl<char> *SearchPath, SmallVectorImpl<char> *RelativePath, - ModuleMap::Module **SuggestedModule); + ModuleMap::Module **SuggestedModule, + bool SkipCache = false); /// LookupSubframeworkHeader - Look up a subframework for the specified /// #include file. For example, if #include'ing <HIToolbox/HIToolbox.h> from diff --git a/include/clang/Lex/PPCallbacks.h b/include/clang/Lex/PPCallbacks.h index 1fc1a05db6..0c783d474d 100644 --- a/include/clang/Lex/PPCallbacks.h +++ b/include/clang/Lex/PPCallbacks.h @@ -58,6 +58,23 @@ public: SrcMgr::CharacteristicKind FileType) { } + /// FileNotFound - This callback is invoked whenever an inclusion directive + /// results in a file-not-found error. + /// + /// \param FileName The name of the file being included, as written in the + /// source code. + /// + /// \param RecoveryPath If this client indicates that it can recover from + /// this missing file, the client should set this as an additional header + /// search patch. + /// + /// \returns true to indicate that the preprocessor should attempt to recover + /// by adding \p RecoveryPath as a header search path. + virtual bool FileNotFound(StringRef FileName, + SmallVectorImpl<char> &RecoveryPath) { + return false; + } + /// \brief This callback is invoked whenever an inclusion directive of /// any kind (\c #include, \c #import, etc.) has been processed, regardless /// of whether the inclusion will actually result in an inclusion. @@ -231,6 +248,12 @@ public: Second->FileSkipped(ParentFile, FilenameTok, FileType); } + virtual bool FileNotFound(StringRef FileName, + SmallVectorImpl<char> &RecoveryPath) { + return First->FileNotFound(FileName, RecoveryPath) || + Second->FileNotFound(FileName, RecoveryPath); + } + virtual void InclusionDirective(SourceLocation HashLoc, const Token &IncludeTok, StringRef FileName, diff --git a/include/clang/Lex/Preprocessor.h b/include/clang/Lex/Preprocessor.h index 90f64c4554..cf77824120 100644 --- a/include/clang/Lex/Preprocessor.h +++ b/include/clang/Lex/Preprocessor.h @@ -1008,7 +1008,8 @@ public: const DirectoryLookup *&CurDir, SmallVectorImpl<char> *SearchPath, SmallVectorImpl<char> *RelativePath, - ModuleMap::Module **SuggestedModule); + ModuleMap::Module **SuggestedModule, + bool SkipCache = false); /// GetCurLookup - The DirectoryLookup structure used to find the current /// FileEntry, if CurLexer is non-null and if applicable. This allows us to |