aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/StaticAnalyzer/Core
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2022-07-14 18:50:02 +0000
committerDimitry Andric <dim@FreeBSD.org>2022-07-14 18:50:02 +0000
commit1f917f69ff07f09b6dbb670971f57f8efe718b84 (patch)
tree99293cbc1411737cd995dac10a99b2c40ef0944c /clang/lib/StaticAnalyzer/Core
parent145449b1e420787bb99721a429341fa6be3adfb6 (diff)
Diffstat (limited to 'clang/lib/StaticAnalyzer/Core')
-rw-r--r--clang/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp6
-rw-r--r--clang/lib/StaticAnalyzer/Core/BugReporter.cpp6
-rw-r--r--clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp8
-rw-r--r--clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp2
-rw-r--r--clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp4
-rw-r--r--clang/lib/StaticAnalyzer/Core/SValBuilder.cpp6
6 files changed, 19 insertions, 13 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp b/clang/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
index 79d19a3b99f2..009cbd4559b5 100644
--- a/clang/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
+++ b/clang/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
@@ -78,7 +78,7 @@ AnalyzerOptions::getExplorationStrategy() const {
ExplorationStrategyKind::BFSBlockDFSContents)
.Default(None);
assert(K && "User mode is invalid.");
- return K.getValue();
+ return K.value();
}
CTUPhase1InliningKind AnalyzerOptions::getCTUPhase1Inlining() const {
@@ -89,7 +89,7 @@ CTUPhase1InliningKind AnalyzerOptions::getCTUPhase1Inlining() const {
.Case("all", CTUPhase1InliningKind::All)
.Default(None);
assert(K && "CTU inlining mode is invalid.");
- return K.getValue();
+ return K.value();
}
IPAKind AnalyzerOptions::getIPAMode() const {
@@ -102,7 +102,7 @@ IPAKind AnalyzerOptions::getIPAMode() const {
.Default(None);
assert(K && "IPA Mode is invalid.");
- return K.getValue();
+ return K.value();
}
bool
diff --git a/clang/lib/StaticAnalyzer/Core/BugReporter.cpp b/clang/lib/StaticAnalyzer/Core/BugReporter.cpp
index a2efe14f1045..4d6b82e63f6a 100644
--- a/clang/lib/StaticAnalyzer/Core/BugReporter.cpp
+++ b/clang/lib/StaticAnalyzer/Core/BugReporter.cpp
@@ -2363,15 +2363,15 @@ PathSensitiveBugReport::getInterestingnessKind(const MemRegion *R) const {
}
bool PathSensitiveBugReport::isInteresting(SVal V) const {
- return getInterestingnessKind(V).hasValue();
+ return getInterestingnessKind(V).has_value();
}
bool PathSensitiveBugReport::isInteresting(SymbolRef sym) const {
- return getInterestingnessKind(sym).hasValue();
+ return getInterestingnessKind(sym).has_value();
}
bool PathSensitiveBugReport::isInteresting(const MemRegion *R) const {
- return getInterestingnessKind(R).hasValue();
+ return getInterestingnessKind(R).has_value();
}
bool PathSensitiveBugReport::isInteresting(const LocationContext *LC) const {
diff --git a/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp b/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
index 5b72c91ccd74..2caa5bbc16df 100644
--- a/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
+++ b/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
@@ -2950,7 +2950,7 @@ PathDiagnosticPieceRef ConditionBRVisitor::VisitTrueTest(
PathDiagnosticLocation Loc(Cond, SM, LCtx);
auto event = std::make_shared<PathDiagnosticEventPiece>(Loc, Message);
if (shouldPrune)
- event->setPrunable(shouldPrune.getValue());
+ event->setPrunable(shouldPrune.value());
return event;
}
@@ -3084,9 +3084,9 @@ bool ConditionBRVisitor::printValue(const Expr *CondVarExpr, raw_ostream &Out,
Out << (TookTrue ? "not equal to 0" : "0");
} else {
if (Ty->isBooleanType())
- Out << (IntValue.getValue()->getBoolValue() ? "true" : "false");
+ Out << (IntValue.value()->getBoolValue() ? "true" : "false");
else
- Out << *IntValue.getValue();
+ Out << *IntValue.value();
}
return true;
@@ -3282,7 +3282,7 @@ void FalsePositiveRefutationBRVisitor::finalizeVisitor(
if (!IsSAT)
return;
- if (!IsSAT.getValue())
+ if (!IsSAT.value())
BR.markInvalid("Infeasible constraints", EndPathNode->getLocationContext());
}
diff --git a/clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp b/clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
index 5f8a84591b2a..e1649f0b3df6 100644
--- a/clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
+++ b/clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
@@ -1016,7 +1016,7 @@ bool ExprEngine::shouldInlineCall(const CallEvent &Call, const Decl *D,
// Check if this function has been marked as non-inlinable.
Optional<bool> MayInline = Engine.FunctionSummaries->mayInline(D);
if (MayInline) {
- if (!MayInline.getValue())
+ if (!MayInline.value())
return false;
} else {
diff --git a/clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp b/clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
index 93c19a688b9a..d35646bfba91 100644
--- a/clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
+++ b/clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
@@ -407,11 +407,11 @@ void PlistPrinter::ReportMacroExpansions(raw_ostream &o, unsigned indent) {
// Output the macro name.
Indent(o, indent) << "<key>name</key>";
- EmitString(o, MacroName.getValue()) << '\n';
+ EmitString(o, MacroName.value()) << '\n';
// Output what it expands into.
Indent(o, indent) << "<key>expansion</key>";
- EmitString(o, ExpansionText.getValue()) << '\n';
+ EmitString(o, ExpansionText.value()) << '\n';
// Finish up.
--indent;
diff --git a/clang/lib/StaticAnalyzer/Core/SValBuilder.cpp b/clang/lib/StaticAnalyzer/Core/SValBuilder.cpp
index 13fac37899cd..cf3d13ffb7ba 100644
--- a/clang/lib/StaticAnalyzer/Core/SValBuilder.cpp
+++ b/clang/lib/StaticAnalyzer/Core/SValBuilder.cpp
@@ -113,6 +113,8 @@ nonloc::SymbolVal SValBuilder::makeNonLoc(const SymExpr *operand,
QualType fromTy, QualType toTy) {
assert(operand);
assert(!Loc::isLocType(toTy));
+ if (fromTy == toTy)
+ return operand;
return nonloc::SymbolVal(SymMgr.getCastSymbol(operand, fromTy, toTy));
}
@@ -1101,6 +1103,10 @@ nonloc::SymbolVal SValBuilder::simplifySymbolCast(nonloc::SymbolVal V,
SymbolRef RootSym = cast<SymbolCast>(SE)->getOperand();
QualType RT = RootSym->getType().getCanonicalType();
+ // FIXME support simplification from non-integers.
+ if (!RT->isIntegralOrEnumerationType())
+ return makeNonLoc(SE, T, CastTy);
+
BasicValueFactory &BVF = getBasicValueFactory();
APSIntType CTy = BVF.getAPSIntType(CastTy);
APSIntType TTy = BVF.getAPSIntType(T);