summaryrefslogtreecommitdiff
path: root/lib/Frontend/CompilerInstance.cpp
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2014-03-01 14:48:57 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2014-03-01 14:48:57 +0000
commit802ac72495558ab109f0ce407383ef3547d4ca59 (patch)
tree9efacbc8b40e26410c630b6980071598275405aa /lib/Frontend/CompilerInstance.cpp
parentedea9113ff3b36fe7939ab054e0db9ed9a3b9c3b (diff)
downloadclang-802ac72495558ab109f0ce407383ef3547d4ca59.tar.gz
clang-802ac72495558ab109f0ce407383ef3547d4ca59.tar.bz2
clang-802ac72495558ab109f0ce407383ef3547d4ca59.tar.xz
[C++11] Replace verbose functors with succinct lambdas
No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202590 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/CompilerInstance.cpp')
-rw-r--r--lib/Frontend/CompilerInstance.cpp28
1 files changed, 7 insertions, 21 deletions
diff --git a/lib/Frontend/CompilerInstance.cpp b/lib/Frontend/CompilerInstance.cpp
index a2b321ff6c..4ab7f00e5a 100644
--- a/lib/Frontend/CompilerInstance.cpp
+++ b/lib/Frontend/CompilerInstance.cpp
@@ -778,23 +778,6 @@ static void doCompileMapModule(void *UserData) {
Data.Instance.ExecuteAction(Data.CreateModuleAction);
}
-namespace {
- /// \brief Function object that checks with the given macro definition should
- /// be removed, because it is one of the ignored macros.
- class RemoveIgnoredMacro {
- const HeaderSearchOptions &HSOpts;
-
- public:
- explicit RemoveIgnoredMacro(const HeaderSearchOptions &HSOpts)
- : HSOpts(HSOpts) { }
-
- bool operator()(const std::pair<std::string, bool> &def) const {
- StringRef MacroDef = def.first;
- return HSOpts.ModulesIgnoreMacros.count(MacroDef.split('=').first) > 0;
- }
- };
-}
-
/// \brief Compile a module file for the given module, using the options
/// provided by the importing compiler instance.
static void compileModule(CompilerInstance &ImportingInstance,
@@ -839,10 +822,13 @@ static void compileModule(CompilerInstance &ImportingInstance,
// Remove any macro definitions that are explicitly ignored by the module.
// They aren't supposed to affect how the module is built anyway.
const HeaderSearchOptions &HSOpts = Invocation->getHeaderSearchOpts();
- PPOpts.Macros.erase(std::remove_if(PPOpts.Macros.begin(), PPOpts.Macros.end(),
- RemoveIgnoredMacro(HSOpts)),
- PPOpts.Macros.end());
-
+ PPOpts.Macros.erase(
+ std::remove_if(PPOpts.Macros.begin(), PPOpts.Macros.end(),
+ [&HSOpts](const std::pair<std::string, bool> &def) {
+ StringRef MacroDef = def.first;
+ return HSOpts.ModulesIgnoreMacros.count(MacroDef.split('=').first) > 0;
+ }),
+ PPOpts.Macros.end());
// Note the name of the module we're building.
Invocation->getLangOpts()->CurrentModule = Module->getTopLevelModuleName();