aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/Lint.cpp
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2022-12-02 19:43:04 -0800
committerKazu Hirata <kazu@google.com>2022-12-02 19:43:04 -0800
commit19aff0f37dd68ee51e78b764c0ce629ae73d1eef (patch)
tree07403086631814ae1ff7742c8c6dac4fb67b5088 /llvm/lib/Analysis/Lint.cpp
parentfef3a16aeab660d0789c592985993bd68b51f517 (diff)
downloadllvm-19aff0f37dd68ee51e78b764c0ce629ae73d1eef.zip
llvm-19aff0f37dd68ee51e78b764c0ce629ae73d1eef.tar.gz
llvm-19aff0f37dd68ee51e78b764c0ce629ae73d1eef.tar.bz2
[Analysis] Use std::nullopt instead of None (NFC)
This patch mechanically replaces None with std::nullopt where the compiler would warn if None were deprecated. The intent is to reduce the amount of manual work required in migrating from Optional to std::optional. 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 'llvm/lib/Analysis/Lint.cpp')
-rw-r--r--llvm/lib/Analysis/Lint.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/llvm/lib/Analysis/Lint.cpp b/llvm/lib/Analysis/Lint.cpp
index 8b0f2a8..d3120a41 100644
--- a/llvm/lib/Analysis/Lint.cpp
+++ b/llvm/lib/Analysis/Lint.cpp
@@ -187,8 +187,8 @@ void Lint::visitFunction(Function &F) {
void Lint::visitCallBase(CallBase &I) {
Value *Callee = I.getCalledOperand();
- visitMemoryReference(I, MemoryLocation::getAfter(Callee), None, nullptr,
- MemRef::Callee);
+ visitMemoryReference(I, MemoryLocation::getAfter(Callee), std::nullopt,
+ nullptr, MemRef::Callee);
if (Function *F = dyn_cast<Function>(findValue(Callee,
/*OffsetOk=*/false))) {
@@ -347,26 +347,26 @@ void Lint::visitCallBase(CallBase &I) {
"Undefined behavior: va_start called in a non-varargs function",
&I);
- visitMemoryReference(I, MemoryLocation::getForArgument(&I, 0, TLI), None,
- nullptr, MemRef::Read | MemRef::Write);
+ visitMemoryReference(I, MemoryLocation::getForArgument(&I, 0, TLI),
+ std::nullopt, nullptr, MemRef::Read | MemRef::Write);
break;
case Intrinsic::vacopy:
- visitMemoryReference(I, MemoryLocation::getForArgument(&I, 0, TLI), None,
- nullptr, MemRef::Write);
- visitMemoryReference(I, MemoryLocation::getForArgument(&I, 1, TLI), None,
- nullptr, MemRef::Read);
+ visitMemoryReference(I, MemoryLocation::getForArgument(&I, 0, TLI),
+ std::nullopt, nullptr, MemRef::Write);
+ visitMemoryReference(I, MemoryLocation::getForArgument(&I, 1, TLI),
+ std::nullopt, nullptr, MemRef::Read);
break;
case Intrinsic::vaend:
- visitMemoryReference(I, MemoryLocation::getForArgument(&I, 0, TLI), None,
- nullptr, MemRef::Read | MemRef::Write);
+ visitMemoryReference(I, MemoryLocation::getForArgument(&I, 0, TLI),
+ std::nullopt, nullptr, MemRef::Read | MemRef::Write);
break;
case Intrinsic::stackrestore:
// Stackrestore doesn't read or write memory, but it sets the
// stack pointer, which the compiler may read from or write to
// at any time, so check it for both readability and writeability.
- visitMemoryReference(I, MemoryLocation::getForArgument(&I, 0, TLI), None,
- nullptr, MemRef::Read | MemRef::Write);
+ visitMemoryReference(I, MemoryLocation::getForArgument(&I, 0, TLI),
+ std::nullopt, nullptr, MemRef::Read | MemRef::Write);
break;
case Intrinsic::get_active_lane_mask:
if (auto *TripCount = dyn_cast<ConstantInt>(I.getArgOperand(1)))
@@ -588,13 +588,13 @@ void Lint::visitAllocaInst(AllocaInst &I) {
}
void Lint::visitVAArgInst(VAArgInst &I) {
- visitMemoryReference(I, MemoryLocation::get(&I), None, nullptr,
+ visitMemoryReference(I, MemoryLocation::get(&I), std::nullopt, nullptr,
MemRef::Read | MemRef::Write);
}
void Lint::visitIndirectBrInst(IndirectBrInst &I) {
- visitMemoryReference(I, MemoryLocation::getAfter(I.getAddress()), None,
- nullptr, MemRef::Branchee);
+ visitMemoryReference(I, MemoryLocation::getAfter(I.getAddress()),
+ std::nullopt, nullptr, MemRef::Branchee);
Check(I.getNumDestinations() != 0,
"Undefined behavior: indirectbr with no destinations", &I);