aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Analysis
diff options
context:
space:
mode:
authormartinboehme <mboehme@google.com>2024-05-06 14:21:15 +0200
committerGitHub <noreply@github.com>2024-05-06 14:21:15 +0200
commit4d839d8f18e41bd97e1c5e82d53ad5687c07e586 (patch)
tree658579a0f30c5413310e321c53dbc1c5f4764aa2 /clang/lib/Analysis
parent5f73d29cb74abf5b4eca113386b18110a53b1b6a (diff)
downloadllvm-4d839d8f18e41bd97e1c5e82d53ad5687c07e586.zip
llvm-4d839d8f18e41bd97e1c5e82d53ad5687c07e586.tar.gz
llvm-4d839d8f18e41bd97e1c5e82d53ad5687c07e586.tar.bz2
[clang][dataflow] Don't propagate result objects in unevaluated contexts (reland #90438) (#91172)
This relands #90348 with a fix for a [buildbot failure](https://lab.llvm.org/buildbot/#/builders/216/builds/38446) caused by the test being run with `-fno-rtti`.
Diffstat (limited to 'clang/lib/Analysis')
-rw-r--r--clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp b/clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp
index d79e734..cb6c8b2 100644
--- a/clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp
+++ b/clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp
@@ -350,6 +350,17 @@ public:
return RecursiveASTVisitor<ResultObjectVisitor>::TraverseDecl(D);
}
+ // Don't traverse expressions in unevaluated contexts, as we don't model
+ // fields that are only used in these.
+ // Note: The operand of the `noexcept` operator is an unevaluated operand, but
+ // nevertheless it appears in the Clang CFG, so we don't exclude it here.
+ bool TraverseDecltypeTypeLoc(DecltypeTypeLoc) { return true; }
+ bool TraverseTypeOfExprTypeLoc(TypeOfExprTypeLoc) { return true; }
+ bool TraverseCXXTypeidExpr(CXXTypeidExpr *) { return true; }
+ bool TraverseUnaryExprOrTypeTraitExpr(UnaryExprOrTypeTraitExpr *) {
+ return true;
+ }
+
bool TraverseBindingDecl(BindingDecl *BD) {
// `RecursiveASTVisitor` doesn't traverse holding variables for
// `BindingDecl`s by itself, so we need to tell it to.