[clang] 628556b - [Checkers] Use std::optional in UnixAPIChecker.cpp (NFC)

Kazu Hirata via cfe-commits cfe-commits at lists.llvm.org
Sat Dec 10 08:10:29 PST 2022


Author: Kazu Hirata
Date: 2022-12-10T08:10:24-08:00
New Revision: 628556b1c53b53946ae0ee39a7a090e5bbdd6aec

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

LOG: [Checkers] Use std::optional in UnixAPIChecker.cpp (NFC)

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

Added: 
    

Modified: 
    clang/lib/StaticAnalyzer/Checkers/UnixAPIChecker.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/StaticAnalyzer/Checkers/UnixAPIChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/UnixAPIChecker.cpp
index aa3f4524798a..c7a64f391516 100644
--- a/clang/lib/StaticAnalyzer/Checkers/UnixAPIChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/UnixAPIChecker.cpp
@@ -22,6 +22,7 @@
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/Support/raw_ostream.h"
+#include <optional>
 
 using namespace clang;
 using namespace ento;
@@ -40,7 +41,7 @@ namespace {
 
 class UnixAPIMisuseChecker : public Checker< check::PreStmt<CallExpr> > {
   mutable std::unique_ptr<BugType> BT_open, BT_pthreadOnce;
-  mutable Optional<uint64_t> Val_O_CREAT;
+  mutable std::optional<uint64_t> Val_O_CREAT;
 
 public:
   void checkPreStmt(const CallExpr *CE, CheckerContext &C) const;


        


More information about the cfe-commits mailing list