[cfe-dev] Fwd: r253904 - Replace loop with std::any_of, NFC.
Yaron Keren via cfe-dev
cfe-dev at lists.llvm.org
Tue Nov 24 11:39:27 PST 2015
Hi,
Should the [=] capture be replaced here with [&] ?
The original reasoning was it's more efficient to capture DeclModule by
value rather than by reference.
Yaron
---------- Forwarded message ----------
From: Yaron Keren via cfe-commits <cfe-commits at lists.llvm.org>
Date: 2015-11-23 21:28 GMT+02:00
Subject: r253904 - Replace loop with std::any_of, NFC.
To: cfe-commits at lists.llvm.org
Author: yrnkrn
Date: Mon Nov 23 13:28:42 2015
New Revision: 253904
URL: http://llvm.org/viewvc/llvm-project?rev=253904&view=rev
Log:
Replace loop with std::any_of, NFC.
Inspired by similar commits from Craig Topper.
Modified:
cfe/trunk/lib/Sema/SemaLookup.cpp
Modified: cfe/trunk/lib/Sema/SemaLookup.cpp
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLookup.cpp?rev=253904&r1=253903&r2=253904&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaLookup.cpp (original)
+++ cfe/trunk/lib/Sema/SemaLookup.cpp Mon Nov 23 13:28:42 2015
@@ -1535,12 +1535,8 @@ bool LookupResult::isVisibleSlow(Sema &S
// Check whether DeclModule is transitively exported to an import of
// the lookup set.
- for (llvm::DenseSet<Module *>::iterator I = LookupModules.begin(),
- E = LookupModules.end();
- I != E; ++I)
- if ((*I)->isModuleVisible(DeclModule))
- return true;
- return false;
+ return std::any_of(LookupModules.begin(), LookupModules.end(),
+ [=](Module *M) { return
M->isModuleVisible(DeclModule); });
}
bool Sema::isVisibleSlow(const NamedDecl *D) {
_______________________________________________
cfe-commits mailing list
cfe-commits at lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20151124/0dc5fabf/attachment.html>
More information about the cfe-dev
mailing list