aboutsummaryrefslogtreecommitdiff
path: root/Driver/clang.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-12-17 06:44:29 +0000
committerChris Lattner <sabre@nondot.org>2007-12-17 06:44:29 +0000
commitb94c707350ee2099996a80c8d97f28b61ff98c7b (patch)
tree2708c797d30d80476e55cecf762349f849a86e7b /Driver/clang.cpp
parent822da61b74ce14e89b3fa8774db18c833aa5748b (diff)
teach RemoveDuplicates about header maps.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45090 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Driver/clang.cpp')
-rw-r--r--Driver/clang.cpp23
1 files changed, 19 insertions, 4 deletions
diff --git a/Driver/clang.cpp b/Driver/clang.cpp
index 4f6ea926d2..5e102b9edf 100644
--- a/Driver/clang.cpp
+++ b/Driver/clang.cpp
@@ -676,15 +676,30 @@ static void AddPath(const std::string &Path, IncludeDirGroup Group,
/// search list, remove the later (dead) ones.
static void RemoveDuplicates(std::vector<DirectoryLookup> &SearchList) {
llvm::SmallPtrSet<const DirectoryEntry *, 8> SeenDirs;
+ llvm::SmallPtrSet<const HeaderMap *, 8> SeenHeaderMaps;
for (unsigned i = 0; i != SearchList.size(); ++i) {
- // If this isn't the first time we've seen this dir, remove it.
- if (!SeenDirs.insert(SearchList[i].getDir())) {
+ if (SearchList[i].isNormalDir()) {
+ // If this isn't the first time we've seen this dir, remove it.
+ if (SeenDirs.insert(SearchList[i].getDir()))
+ continue;
+
+ if (Verbose)
+ fprintf(stderr, "ignoring duplicate directory \"%s\"\n",
+ SearchList[i].getDir()->getName());
+ } else {
+ assert(SearchList[i].isHeaderMap() && "Not a headermap or normal dir?");
+ // If this isn't the first time we've seen this headermap, remove it.
+ if (SeenHeaderMaps.insert(SearchList[i].getHeaderMap()))
+ continue;
+
if (Verbose)
fprintf(stderr, "ignoring duplicate directory \"%s\"\n",
SearchList[i].getDir()->getName());
- SearchList.erase(SearchList.begin()+i);
- --i;
}
+
+ // This is reached if the current entry is a duplicate.
+ SearchList.erase(SearchList.begin()+i);
+ --i;
}
}