]> granicus.if.org Git - clang/commitdiff
[Format] Avoid copying std::sets and simplify code a bit.
authorBenjamin Kramer <benny.kra@googlemail.com>
Thu, 24 Nov 2016 15:42:29 +0000 (15:42 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Thu, 24 Nov 2016 15:42:29 +0000 (15:42 +0000)
No functional change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@287892 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Format/Format.cpp

index e1f991a9bf645ee36046de0adc1e948053a39781..98565e9834eb8c95d32ac3fd451bad2695d3a2e2 100644 (file)
@@ -1555,9 +1555,9 @@ unsigned getOffsetAfterHeaderGuardsAndComments(StringRef FileName,
 }
 
 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