Author: Aaron Ballman Date: 2023-12-07T08:26:33-05:00 New Revision: 3293c088c25db5be6042d20bd95c80a0863a88d0
URL: https://github.com/llvm/llvm-project/commit/3293c088c25db5be6042d20bd95c80a0863a88d0 DIFF: https://github.com/llvm/llvm-project/commit/3293c088c25db5be6042d20bd95c80a0863a88d0.diff LOG: Remove dead code; NFC This code was added 17 years ago but never enabled or tested. GCC warns that -I- is deprecated for them, and Clang gives an error when passed -I-, so we may as well remove this code rather than hook it up to the driver and maintain it. Added: Modified: clang/include/clang/Lex/HeaderSearch.h clang/lib/Lex/HeaderSearch.cpp clang/lib/Lex/InitHeaderSearch.cpp Removed: ################################################################################ diff --git a/clang/include/clang/Lex/HeaderSearch.h b/clang/include/clang/Lex/HeaderSearch.h index a100598c80155..a2c33842924b1 100644 --- a/clang/include/clang/Lex/HeaderSearch.h +++ b/clang/include/clang/Lex/HeaderSearch.h @@ -247,16 +247,13 @@ class HeaderSearch { /// \#include search path information. Requests for \#include "x" search the /// directory of the \#including file first, then each directory in SearchDirs /// consecutively. Requests for <x> search the current dir first, then each - /// directory in SearchDirs, starting at AngledDirIdx, consecutively. If - /// NoCurDirSearch is true, then the check for the file in the current - /// directory is suppressed. + /// directory in SearchDirs, starting at AngledDirIdx, consecutively. std::vector<DirectoryLookup> SearchDirs; /// Whether the DirectoryLookup at the corresponding index in SearchDirs has /// been successfully used to lookup a file. std::vector<bool> SearchDirsUsage; unsigned AngledDirIdx = 0; unsigned SystemDirIdx = 0; - bool NoCurDirSearch = false; /// Maps HeaderMap keys to SearchDir indices. When HeaderMaps are used /// heavily, SearchDirs can start with thousands of HeaderMaps, so this Index @@ -373,7 +370,7 @@ class HeaderSearch { /// Interface for setting the file search paths. void SetSearchPaths(std::vector<DirectoryLookup> dirs, unsigned angledDirIdx, - unsigned systemDirIdx, bool noCurDirSearch, + unsigned systemDirIdx, llvm::DenseMap<unsigned, unsigned> searchDirToHSEntry); /// Add an additional search path. diff --git a/clang/lib/Lex/HeaderSearch.cpp b/clang/lib/Lex/HeaderSearch.cpp index cf1c0cc5284f3..c03cf19688d96 100644 --- a/clang/lib/Lex/HeaderSearch.cpp +++ b/clang/lib/Lex/HeaderSearch.cpp @@ -105,7 +105,7 @@ void HeaderSearch::PrintStats() { void HeaderSearch::SetSearchPaths( std::vector<DirectoryLookup> dirs, unsigned int angledDirIdx, - unsigned int systemDirIdx, bool noCurDirSearch, + unsigned int systemDirIdx, llvm::DenseMap<unsigned int, unsigned int> searchDirToHSEntry) { assert(angledDirIdx <= systemDirIdx && systemDirIdx <= dirs.size() && "Directory indices are unordered"); @@ -113,7 +113,6 @@ void HeaderSearch::SetSearchPaths( SearchDirsUsage.assign(SearchDirs.size(), false); AngledDirIdx = angledDirIdx; SystemDirIdx = systemDirIdx; - NoCurDirSearch = noCurDirSearch; SearchDirToHSEntry = std::move(searchDirToHSEntry); //LookupFileCache.clear(); indexInitialHeaderMaps(); @@ -904,12 +903,12 @@ OptionalFileEntryRef HeaderSearch::LookupFile( ModuleMap::KnownHeader MSSuggestedModule; OptionalFileEntryRef MSFE; - // Unless disabled, check to see if the file is in the #includer's - // directory. This cannot be based on CurDir, because each includer could be - // a #include of a subdirectory (#include "foo/bar.h") and a subsequent - // include of "baz.h" should resolve to "whatever/foo/baz.h". - // This search is not done for <> headers. - if (!Includers.empty() && !isAngled && !NoCurDirSearch) { + // Check to see if the file is in the #includer's directory. This cannot be + // based on CurDir, because each includer could be a #include of a + // subdirectory (#include "foo/bar.h") and a subsequent include of "baz.h" + // should resolve to "whatever/foo/baz.h". This search is not done for <> + // headers. + if (!Includers.empty() && !isAngled) { SmallString<1024> TmpDir; bool First = true; for (const auto &IncluderAndDir : Includers) { diff --git a/clang/lib/Lex/InitHeaderSearch.cpp b/clang/lib/Lex/InitHeaderSearch.cpp index 1f4c7a6d67b7f..5b1b7c859c85d 100644 --- a/clang/lib/Lex/InitHeaderSearch.cpp +++ b/clang/lib/Lex/InitHeaderSearch.cpp @@ -513,9 +513,8 @@ void InitHeaderSearch::Realize(const LangOptions &Lang) { unsigned NonSystemRemoved = RemoveDuplicates(SearchList, NumQuoted, Verbose); NumAngled -= NonSystemRemoved; - bool DontSearchCurDir = false; // TODO: set to true if -I- is set? Headers.SetSearchPaths(extractLookups(SearchList), NumQuoted, NumAngled, - DontSearchCurDir, mapToUserEntries(SearchList)); + mapToUserEntries(SearchList)); Headers.SetSystemHeaderPrefixes(SystemHeaderPrefixes); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits