[clang] abbe9c5 - [clang] Use x.empty() instead of llvm::empty(x) (NFC)

Kazu Hirata via cfe-commits cfe-commits at lists.llvm.org
Sun Sep 18 11:08:00 PDT 2022


Author: Kazu Hirata
Date: 2022-09-18T11:07:50-07:00
New Revision: abbe9c561db3abccd00936f6b2fc5a8b7b5486bb

URL: https://github.com/llvm/llvm-project/commit/abbe9c561db3abccd00936f6b2fc5a8b7b5486bb
DIFF: https://github.com/llvm/llvm-project/commit/abbe9c561db3abccd00936f6b2fc5a8b7b5486bb.diff

LOG: [clang] Use x.empty() instead of llvm::empty(x) (NFC)

I'm planning to deprecate and eventually remove llvm::empty.

Note that no use of llvm::empty requires the ability of llvm::empty to
determine the emptiness from begin/end only.

Added: 
    

Modified: 
    clang/lib/Sema/SemaCodeComplete.cpp
    clang/lib/Sema/SemaStmt.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Sema/SemaCodeComplete.cpp b/clang/lib/Sema/SemaCodeComplete.cpp
index c80605ba7f5a7..c8eac7b06b652 100644
--- a/clang/lib/Sema/SemaCodeComplete.cpp
+++ b/clang/lib/Sema/SemaCodeComplete.cpp
@@ -1231,8 +1231,8 @@ static OverloadCompare compareOverloads(const CXXMethodDecl &Candidate,
     if (Candidate.parameters()[I]->getType().getCanonicalType() !=
         Incumbent.parameters()[I]->getType().getCanonicalType())
       return OverloadCompare::BothViable;
-  if (!llvm::empty(Candidate.specific_attrs<EnableIfAttr>()) ||
-      !llvm::empty(Incumbent.specific_attrs<EnableIfAttr>()))
+  if (!Candidate.specific_attrs<EnableIfAttr>().empty() ||
+      !Incumbent.specific_attrs<EnableIfAttr>().empty())
     return OverloadCompare::BothViable;
   // At this point, we know calls can't pick one or the other based on
   // arguments, so one of the two must win. (Or both fail, handled elsewhere).

diff  --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp
index 802e9cd8f364a..9d1f506ef5847 100644
--- a/clang/lib/Sema/SemaStmt.cpp
+++ b/clang/lib/Sema/SemaStmt.cpp
@@ -1499,7 +1499,7 @@ Sema::ActOnFinishSwitchStmt(SourceLocation SwitchLoc, Stmt *Switch,
     // If switch has default case, then ignore it.
     if (!CaseListIsErroneous && !CaseListIsIncomplete && !HasConstantCond &&
         ET && ET->getDecl()->isCompleteDefinition() &&
-        !empty(ET->getDecl()->enumerators())) {
+        !ET->getDecl()->enumerators().empty()) {
       const EnumDecl *ED = ET->getDecl();
       EnumValsTy EnumVals;
 


        


More information about the cfe-commits mailing list