Skip to content

Commit 3293c08

Browse files
committed
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.
1 parent 6a1badf commit 3293c08

File tree

3 files changed

+10
-15
lines changed

3 files changed

+10
-15
lines changed

clang/include/clang/Lex/HeaderSearch.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -247,16 +247,13 @@ class HeaderSearch {
247247
/// \#include search path information. Requests for \#include "x" search the
248248
/// directory of the \#including file first, then each directory in SearchDirs
249249
/// consecutively. Requests for <x> search the current dir first, then each
250-
/// directory in SearchDirs, starting at AngledDirIdx, consecutively. If
251-
/// NoCurDirSearch is true, then the check for the file in the current
252-
/// directory is suppressed.
250+
/// directory in SearchDirs, starting at AngledDirIdx, consecutively.
253251
std::vector<DirectoryLookup> SearchDirs;
254252
/// Whether the DirectoryLookup at the corresponding index in SearchDirs has
255253
/// been successfully used to lookup a file.
256254
std::vector<bool> SearchDirsUsage;
257255
unsigned AngledDirIdx = 0;
258256
unsigned SystemDirIdx = 0;
259-
bool NoCurDirSearch = false;
260257

261258
/// Maps HeaderMap keys to SearchDir indices. When HeaderMaps are used
262259
/// heavily, SearchDirs can start with thousands of HeaderMaps, so this Index
@@ -373,7 +370,7 @@ class HeaderSearch {
373370

374371
/// Interface for setting the file search paths.
375372
void SetSearchPaths(std::vector<DirectoryLookup> dirs, unsigned angledDirIdx,
376-
unsigned systemDirIdx, bool noCurDirSearch,
373+
unsigned systemDirIdx,
377374
llvm::DenseMap<unsigned, unsigned> searchDirToHSEntry);
378375

379376
/// Add an additional search path.

clang/lib/Lex/HeaderSearch.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,15 +105,14 @@ void HeaderSearch::PrintStats() {
105105

106106
void HeaderSearch::SetSearchPaths(
107107
std::vector<DirectoryLookup> dirs, unsigned int angledDirIdx,
108-
unsigned int systemDirIdx, bool noCurDirSearch,
108+
unsigned int systemDirIdx,
109109
llvm::DenseMap<unsigned int, unsigned int> searchDirToHSEntry) {
110110
assert(angledDirIdx <= systemDirIdx && systemDirIdx <= dirs.size() &&
111111
"Directory indices are unordered");
112112
SearchDirs = std::move(dirs);
113113
SearchDirsUsage.assign(SearchDirs.size(), false);
114114
AngledDirIdx = angledDirIdx;
115115
SystemDirIdx = systemDirIdx;
116-
NoCurDirSearch = noCurDirSearch;
117116
SearchDirToHSEntry = std::move(searchDirToHSEntry);
118117
//LookupFileCache.clear();
119118
indexInitialHeaderMaps();
@@ -904,12 +903,12 @@ OptionalFileEntryRef HeaderSearch::LookupFile(
904903
ModuleMap::KnownHeader MSSuggestedModule;
905904
OptionalFileEntryRef MSFE;
906905

907-
// Unless disabled, check to see if the file is in the #includer's
908-
// directory. This cannot be based on CurDir, because each includer could be
909-
// a #include of a subdirectory (#include "foo/bar.h") and a subsequent
910-
// include of "baz.h" should resolve to "whatever/foo/baz.h".
911-
// This search is not done for <> headers.
912-
if (!Includers.empty() && !isAngled && !NoCurDirSearch) {
906+
// Check to see if the file is in the #includer's directory. This cannot be
907+
// based on CurDir, because each includer could be a #include of a
908+
// subdirectory (#include "foo/bar.h") and a subsequent include of "baz.h"
909+
// should resolve to "whatever/foo/baz.h". This search is not done for <>
910+
// headers.
911+
if (!Includers.empty() && !isAngled) {
913912
SmallString<1024> TmpDir;
914913
bool First = true;
915914
for (const auto &IncluderAndDir : Includers) {

clang/lib/Lex/InitHeaderSearch.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -513,9 +513,8 @@ void InitHeaderSearch::Realize(const LangOptions &Lang) {
513513
unsigned NonSystemRemoved = RemoveDuplicates(SearchList, NumQuoted, Verbose);
514514
NumAngled -= NonSystemRemoved;
515515

516-
bool DontSearchCurDir = false; // TODO: set to true if -I- is set?
517516
Headers.SetSearchPaths(extractLookups(SearchList), NumQuoted, NumAngled,
518-
DontSearchCurDir, mapToUserEntries(SearchList));
517+
mapToUserEntries(SearchList));
519518

520519
Headers.SetSystemHeaderPrefixes(SystemHeaderPrefixes);
521520

0 commit comments

Comments
 (0)