summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/HeaderSearch.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2012-04-05 17:09:40 +0000
committerDaniel Dunbar <daniel@zuster.org>2012-04-05 17:09:40 +0000
commit17138613b135d124eccc85fb7a2920784e8af766 (patch)
tree169c6b8d9f900a0a84da3f19641a8371a56a5b5b /clang/lib/Lex/HeaderSearch.cpp
parent328001a14a888e1277d76434618fe22375f99aa7 (diff)
downloadbcm5719-llvm-17138613b135d124eccc85fb7a2920784e8af766.tar.gz
bcm5719-llvm-17138613b135d124eccc85fb7a2920784e8af766.zip
[Lex] HeaderSearch: Introduce a FrameworkCacheEntry structure to hold the FrameworkMap items.
- No functionality change. llvm-svn: 154104
Diffstat (limited to 'clang/lib/Lex/HeaderSearch.cpp')
-rw-r--r--clang/lib/Lex/HeaderSearch.cpp24
1 files changed, 11 insertions, 13 deletions
diff --git a/clang/lib/Lex/HeaderSearch.cpp b/clang/lib/Lex/HeaderSearch.cpp
index 383d9b47823..fe4257a6dd5 100644
--- a/clang/lib/Lex/HeaderSearch.cpp
+++ b/clang/lib/Lex/HeaderSearch.cpp
@@ -275,12 +275,12 @@ const FileEntry *DirectoryLookup::DoFrameworkLookup(
if (SlashPos == StringRef::npos) return 0;
// Find out if this is the home for the specified framework, by checking
- // HeaderSearch. Possible answer are yes/no and unknown.
- const DirectoryEntry *&FrameworkDirCache =
+ // HeaderSearch. Possible answers are yes/no and unknown.
+ HeaderSearch::FrameworkCacheEntry &CacheEntry =
HS.LookupFrameworkCache(Filename.substr(0, SlashPos));
// If it is known and in some other directory, fail.
- if (FrameworkDirCache && FrameworkDirCache != getFrameworkDir())
+ if (CacheEntry.Directory && CacheEntry.Directory != getFrameworkDir())
return 0;
// Otherwise, construct the path to this framework dir.
@@ -298,9 +298,8 @@ const FileEntry *DirectoryLookup::DoFrameworkLookup(
// FrameworkName = "/System/Library/Frameworks/Cocoa.framework/"
FrameworkName += ".framework/";
- // If the cache entry is still unresolved, query to see if the cache entry is
- // still unresolved. If so, check its existence now.
- if (FrameworkDirCache == 0) {
+ // If the cache entry was unresolved, populate it now.
+ if (CacheEntry.Directory == 0) {
HS.IncrementFrameworkLookupCount();
// If the framework dir doesn't exist, we fail.
@@ -310,7 +309,7 @@ const FileEntry *DirectoryLookup::DoFrameworkLookup(
// Otherwise, if it does, remember that this is the right direntry for this
// framework.
- FrameworkDirCache = getFrameworkDir();
+ CacheEntry.Directory = getFrameworkDir();
}
if (RelativePath != NULL) {
@@ -561,26 +560,25 @@ LookupSubframeworkHeader(StringRef Filename,
FrameworkPos[DotFrameworkLen] != '\\'))
return 0;
- SmallString<1024> FrameworkName(ContextName,
- FrameworkPos+DotFrameworkLen+1);
+ SmallString<1024> FrameworkName(ContextName, FrameworkPos+DotFrameworkLen+1);
// Append Frameworks/HIToolbox.framework/
FrameworkName += "Frameworks/";
FrameworkName.append(Filename.begin(), Filename.begin()+SlashPos);
FrameworkName += ".framework/";
- llvm::StringMapEntry<const DirectoryEntry *> &CacheLookup =
+ llvm::StringMapEntry<FrameworkCacheEntry> &CacheLookup =
FrameworkMap.GetOrCreateValue(Filename.substr(0, SlashPos));
// Some other location?
- if (CacheLookup.getValue() &&
+ if (CacheLookup.getValue().Directory &&
CacheLookup.getKeyLength() == FrameworkName.size() &&
memcmp(CacheLookup.getKeyData(), &FrameworkName[0],
CacheLookup.getKeyLength()) != 0)
return 0;
// Cache subframework.
- if (CacheLookup.getValue() == 0) {
+ if (CacheLookup.getValue().Directory == 0) {
++NumSubFrameworkLookups;
// If the framework dir doesn't exist, we fail.
@@ -589,7 +587,7 @@ LookupSubframeworkHeader(StringRef Filename,
// Otherwise, if it does, remember that this is the right direntry for this
// framework.
- CacheLookup.setValue(Dir);
+ CacheLookup.getValue().Directory = Dir;
}
const FileEntry *FE = 0;
OpenPOWER on IntegriCloud