aboutsummaryrefslogtreecommitdiff
path: root/Driver/clang.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-12-17 07:52:39 +0000
committerChris Lattner <sabre@nondot.org>2007-12-17 07:52:39 +0000
commitdf772336655fd84ee2c0ce514c93cef0b29d60d4 (patch)
tree8a6eb621eb6b0da0226e1a82f0720213618408b7 /Driver/clang.cpp
parent60e4e2b7d125b735bd1f8b5b065dde5663641c43 (diff)
as it turns out, frameworks and headermaps are orthogonal. Make this so in
the internal representation. This also fixes a bug where -I foo -F foo would not search foo as both a normal and framework include dir. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45092 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Driver/clang.cpp')
-rw-r--r--Driver/clang.cpp44
1 files changed, 28 insertions, 16 deletions
diff --git a/Driver/clang.cpp b/Driver/clang.cpp
index 28659dd84a..08299b16ae 100644
--- a/Driver/clang.cpp
+++ b/Driver/clang.cpp
@@ -651,22 +651,24 @@ static void AddPath(const std::string &Path, IncludeDirGroup Group,
return;
}
- // Check to see if this is an apple-style headermap.
- if (const FileEntry *FE = FM.getFile(&MappedPath[0],
- &MappedPath[0]+MappedPath.size())) {
- std::string ErrorInfo;
- const HeaderMap *HM = HS.CreateHeaderMap(FE, ErrorInfo);
- if (HM) {
- IncludeGroup[Group].push_back(DirectoryLookup(HM, Type, isUserSupplied,
- isFramework));
- return;
- }
-
- // If this looked like a headermap but was corrupted, emit that error,
- // otherwise treat it as a missing directory.
- if (!ErrorInfo.empty()) {
- fprintf(stderr, "%s\n", ErrorInfo.c_str());
- return;
+ // Check to see if this is an apple-style headermap (which are not allowed to
+ // be frameworks).
+ if (!isFramework) {
+ if (const FileEntry *FE = FM.getFile(&MappedPath[0],
+ &MappedPath[0]+MappedPath.size())) {
+ std::string ErrorInfo;
+ const HeaderMap *HM = HS.CreateHeaderMap(FE, ErrorInfo);
+ if (HM) {
+ IncludeGroup[Group].push_back(DirectoryLookup(HM, Type,isUserSupplied));
+ return;
+ }
+
+ // If this looked like a headermap but was corrupted, emit that error,
+ // otherwise treat it as a missing directory.
+ if (!ErrorInfo.empty()) {
+ fprintf(stderr, "%s\n", ErrorInfo.c_str());
+ return;
+ }
}
}
@@ -678,6 +680,7 @@ 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 DirectoryEntry *, 8> SeenFrameworkDirs;
llvm::SmallPtrSet<const HeaderMap *, 8> SeenHeaderMaps;
for (unsigned i = 0; i != SearchList.size(); ++i) {
if (SearchList[i].isNormalDir()) {
@@ -688,6 +691,15 @@ static void RemoveDuplicates(std::vector<DirectoryLookup> &SearchList) {
if (Verbose)
fprintf(stderr, "ignoring duplicate directory \"%s\"\n",
SearchList[i].getDir()->getName());
+ } else if (SearchList[i].isFramework()) {
+ // If this isn't the first time we've seen this framework dir, remove it.
+ if (SeenFrameworkDirs.insert(SearchList[i].getFrameworkDir()))
+ continue;
+
+ if (Verbose)
+ fprintf(stderr, "ignoring duplicate framework \"%s\"\n",
+ SearchList[i].getFrameworkDir()->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.