summaryrefslogtreecommitdiff
path: root/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorJustin Lebar <jlebar@google.com>2016-10-21 21:45:01 +0000
committerJustin Lebar <jlebar@google.com>2016-10-21 21:45:01 +0000
commita663b0aee8fef8552996f03415d3e48ee72e838f (patch)
tree59951dbf7f3e01d930d7e1a14dac87cd40e40870 /lib/Frontend/CompilerInvocation.cpp
parentd18ea6642f4cf9ef2e0836355aab5f54a23863df (diff)
downloadclang-a663b0aee8fef8552996f03415d3e48ee72e838f.tar.gz
Switch SmallSetVector to use DenseSet when it overflows its inline space.
Summary: SetVector already used DenseSet, but SmallSetVector used std::set. This leads to surprising performance differences. Moreover, it means that the set of key types accepted by SetVector and SmallSetVector are quite different! In order to make this change, we had to convert some callsites that used SmallSetVector<std::string, N> to use SmallSetVector<CachedHashString, N> instead. Reviewers: timshen Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D25648 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@284887 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/CompilerInvocation.cpp')
-rw-r--r--lib/Frontend/CompilerInvocation.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp
index 03d400b9ca..3f2e303b5c 100644
--- a/lib/Frontend/CompilerInvocation.cpp
+++ b/lib/Frontend/CompilerInvocation.cpp
@@ -1432,7 +1432,8 @@ static void ParseHeaderSearchArgs(HeaderSearchOptions &Opts, ArgList &Args) {
for (const Arg *A : Args.filtered(OPT_fmodules_ignore_macro)) {
StringRef MacroDef = A->getValue();
- Opts.ModulesIgnoreMacros.insert(MacroDef.split('=').first);
+ Opts.ModulesIgnoreMacros.insert(
+ llvm::CachedHashString(MacroDef.split('=').first));
}
// Add -I..., -F..., and -index-header-map options in order.
@@ -2519,7 +2520,8 @@ std::string CompilerInvocation::getModuleHash() const {
if (!hsOpts.ModulesIgnoreMacros.empty()) {
// Check whether we're ignoring this macro.
StringRef MacroDef = I->first;
- if (hsOpts.ModulesIgnoreMacros.count(MacroDef.split('=').first))
+ if (hsOpts.ModulesIgnoreMacros.count(
+ llvm::CachedHashString(MacroDef.split('=').first)))
continue;
}