[clang] 843ff75 - [clang][Interp][NFC] Return std::nullopt explicitly

Timm Bäder via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 4 07:17:07 PDT 2023


Author: Timm Bäder
Date: 2023-07-04T16:16:18+02:00
New Revision: 843ff7581408a02e852c0f1f7ebf176cabbc7527

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

LOG: [clang][Interp][NFC] Return std::nullopt explicitly

Added: 
    

Modified: 
    clang/lib/AST/Interp/Program.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/Interp/Program.cpp b/clang/lib/AST/Interp/Program.cpp
index f6f378dd49f167..a9749022ee677b 100644
--- a/clang/lib/AST/Interp/Program.cpp
+++ b/clang/lib/AST/Interp/Program.cpp
@@ -120,7 +120,7 @@ std::optional<unsigned> Program::getGlobal(const ValueDecl *VD) {
   // Map the decl to the existing index.
   if (Index) {
     GlobalIndices[VD] = *Index;
-    return {};
+    return std::nullopt;
   }
 
   return Index;
@@ -135,7 +135,7 @@ std::optional<unsigned> Program::getOrCreateGlobal(const ValueDecl *VD,
     GlobalIndices[VD] = *Idx;
     return Idx;
   }
-  return {};
+  return std::nullopt;
 }
 
 std::optional<unsigned> Program::getOrCreateDummy(const ParmVarDecl *PD) {
@@ -154,7 +154,7 @@ std::optional<unsigned> Program::getOrCreateDummy(const ParmVarDecl *PD) {
     DummyParams[PD] = *Idx;
     return Idx;
   }
-  return {};
+  return std::nullopt;
 }
 
 std::optional<unsigned> Program::createGlobal(const ValueDecl *VD,
@@ -173,7 +173,7 @@ std::optional<unsigned> Program::createGlobal(const ValueDecl *VD,
       GlobalIndices[P] = *Idx;
     return *Idx;
   }
-  return {};
+  return std::nullopt;
 }
 
 std::optional<unsigned> Program::createGlobal(const Expr *E) {
@@ -194,7 +194,7 @@ std::optional<unsigned> Program::createGlobal(const DeclTy &D, QualType Ty,
                             IsTemporary);
   }
   if (!Desc)
-    return {};
+    return std::nullopt;
 
   // Allocate a block for storage.
   unsigned I = Globals.size();


        


More information about the cfe-commits mailing list