diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2014-03-01 14:48:57 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2014-03-01 14:48:57 +0000 |
commit | bbdd7640e885ce3a72bba05e0aaf2361751b9142 (patch) | |
tree | 7c5060b7cd327781f5d3c73b1f49592c6cb84395 /clang/lib/Frontend/CompilerInstance.cpp | |
parent | 390ad0db26065532b138488fe94acbd0d27426e1 (diff) | |
download | bcm5719-llvm-bbdd7640e885ce3a72bba05e0aaf2361751b9142.tar.gz bcm5719-llvm-bbdd7640e885ce3a72bba05e0aaf2361751b9142.zip |
[C++11] Replace verbose functors with succinct lambdas
No functionality change.
llvm-svn: 202590
Diffstat (limited to 'clang/lib/Frontend/CompilerInstance.cpp')
-rw-r--r-- | clang/lib/Frontend/CompilerInstance.cpp | 28 |
1 files changed, 7 insertions, 21 deletions
diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp index a2b321ff6c9..4ab7f00e5aa 100644 --- a/clang/lib/Frontend/CompilerInstance.cpp +++ b/clang/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(); |