[clang] 67c8b0e - [clang][NFC] Remove an unnecessary variable in CheckExprLifetime.cpp

Haojian Wu via cfe-commits cfe-commits at lists.llvm.org
Sat Nov 2 04:00:47 PDT 2024


Author: Haojian Wu
Date: 2024-11-02T12:00:18+01:00
New Revision: 67c8b0efbe5c783f39556be2ee841441b50600b5

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

LOG: [clang][NFC] Remove an unnecessary variable in CheckExprLifetime.cpp

Added: 
    

Modified: 
    clang/lib/Sema/CheckExprLifetime.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Sema/CheckExprLifetime.cpp b/clang/lib/Sema/CheckExprLifetime.cpp
index 7f9b484ef6c05d..3baa8cb3394092 100644
--- a/clang/lib/Sema/CheckExprLifetime.cpp
+++ b/clang/lib/Sema/CheckExprLifetime.cpp
@@ -1132,7 +1132,6 @@ static void checkExprLifetimeImpl(Sema &SemaRef,
     auto *MTE = dyn_cast<MaterializeTemporaryExpr>(L);
 
     bool IsGslPtrValueFromGslTempOwner = false;
-    bool IsLocalGslOwner = false;
     if (pathOnlyHandlesGslPointer(Path)) {
       if (isa<DeclRefExpr>(L)) {
         // We do not want to follow the references when returning a pointer
@@ -1140,8 +1139,8 @@ static void checkExprLifetimeImpl(Sema &SemaRef,
         //   int &p = *localUniquePtr;
         //   someContainer.add(std::move(localUniquePtr));
         //   return p;
-        IsLocalGslOwner = isRecordWithAttr<OwnerAttr>(L->getType());
-        if (pathContainsInit(Path) || !IsLocalGslOwner)
+        if (pathContainsInit(Path) ||
+            !isRecordWithAttr<OwnerAttr>(L->getType()))
           return false;
       } else {
         IsGslPtrValueFromGslTempOwner =


        


More information about the cfe-commits mailing list