aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2022-12-10 08:09:00 -0800
committerKazu Hirata <kazu@google.com>2022-12-10 08:09:00 -0800
commitb5fdd533e5c8ed9726bfaaf961272010cbde6c75 (patch)
tree3f16983369b2e979af2ac8cab335a8e1115a47b8 /clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
parentb5716decbd4a4be3dba2318799871b062f3859d2 (diff)
downloadllvm-b5fdd533e5c8ed9726bfaaf961272010cbde6c75.zip
llvm-b5fdd533e5c8ed9726bfaaf961272010cbde6c75.tar.gz
llvm-b5fdd533e5c8ed9726bfaaf961272010cbde6c75.tar.bz2
[Checkers] Use std::optional in StdLibraryFunctionsChecker.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
Diffstat (limited to 'clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp')
-rw-r--r--clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
index d7befdc..2535bf5 100644
--- a/clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
@@ -52,6 +52,7 @@
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringExtras.h"
+#include <optional>
#include <string>
using namespace clang;
@@ -296,13 +297,13 @@ class StdLibraryFunctionsChecker
// // Here, ptr is the buffer, and its minimum size is `size * nmemb`.
class BufferSizeConstraint : public ValueConstraint {
// The concrete value which is the minimum size for the buffer.
- llvm::Optional<llvm::APSInt> ConcreteSize;
+ std::optional<llvm::APSInt> ConcreteSize;
// The argument which holds the size of the buffer.
- llvm::Optional<ArgNo> SizeArgN;
+ std::optional<ArgNo> SizeArgN;
// The argument which is a multiplier to size. This is set in case of
// `fread` like functions where the size is computed as a multiplication of
// two arguments.
- llvm::Optional<ArgNo> SizeMultiplierArgN;
+ std::optional<ArgNo> SizeMultiplierArgN;
// The operator we use in apply. This is negated in negate().
BinaryOperator::Opcode Op = BO_LE;