r287892 - [Format] Avoid copying std::sets and simplify code a bit.

Benjamin Kramer via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 24 07:42:30 PST 2016


Author: d0k
Date: Thu Nov 24 09:42:29 2016
New Revision: 287892

URL: http://llvm.org/viewvc/llvm-project?rev=287892&view=rev
Log:
[Format] Avoid copying std::sets and simplify code a bit.

No functional change.

Modified:
    cfe/trunk/lib/Format/Format.cpp

Modified: cfe/trunk/lib/Format/Format.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=287892&r1=287891&r2=287892&view=diff
==============================================================================
--- cfe/trunk/lib/Format/Format.cpp (original)
+++ cfe/trunk/lib/Format/Format.cpp Thu Nov 24 09:42:29 2016
@@ -1555,9 +1555,9 @@ unsigned getOffsetAfterHeaderGuardsAndCo
 }
 
 bool isDeletedHeader(llvm::StringRef HeaderName,
-                     const std::set<llvm::StringRef> HeadersToDelete) {
-  return HeadersToDelete.find(HeaderName) != HeadersToDelete.end() ||
-         HeadersToDelete.find(HeaderName.trim("\"<>")) != HeadersToDelete.end();
+                     const std::set<llvm::StringRef> &HeadersToDelete) {
+  return HeadersToDelete.count(HeaderName) ||
+         HeadersToDelete.count(HeaderName.trim("\"<>"));
 }
 
 // FIXME: we also need to insert a '\n' at the end of the code if we have an




More information about the cfe-commits mailing list