[clang] 3e07090 - Fix llvm-else-after-return clang-tidy warning in CheckExprLifetime.cpp, NFC

Haojian Wu via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 5 04:26:32 PDT 2024


Author: Haojian Wu
Date: 2024-09-05T13:24:38+02:00
New Revision: 3e070906eff720dc44aee86e533e12aafc8bb14b

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

LOG: Fix llvm-else-after-return clang-tidy warning in CheckExprLifetime.cpp, NFC

Added: 
    

Modified: 
    clang/lib/Sema/CheckExprLifetime.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Sema/CheckExprLifetime.cpp b/clang/lib/Sema/CheckExprLifetime.cpp
index 6ed6b8aaa70400..8f4d5d50669f14 100644
--- a/clang/lib/Sema/CheckExprLifetime.cpp
+++ b/clang/lib/Sema/CheckExprLifetime.cpp
@@ -288,7 +288,8 @@ static bool shouldTrackImplicitObjectArg(const CXXMethodDecl *Callee) {
         // Map and set types.
         .Cases("find", "equal_range", "lower_bound", "upper_bound", true)
         .Default(false);
-  } else if (Callee->getReturnType()->isReferenceType()) {
+  }
+  if (Callee->getReturnType()->isReferenceType()) {
     if (!Callee->getIdentifier()) {
       auto OO = Callee->getOverloadedOperator();
       return OO == OverloadedOperatorKind::OO_Subscript ||
@@ -316,7 +317,8 @@ static bool shouldTrackFirstArgument(const FunctionDecl *FD) {
         .Cases("end", "rend", "cend", "crend", true)
         .Case("data", true)
         .Default(false);
-  } else if (FD->getReturnType()->isReferenceType()) {
+  }
+  if (FD->getReturnType()->isReferenceType()) {
     return llvm::StringSwitch<bool>(FD->getName())
         .Cases("get", "any_cast", true)
         .Default(false);


        


More information about the cfe-commits mailing list