-
Notifications
You must be signed in to change notification settings - Fork 14.3k
Revert "[clang][dataflow] Teach AnalysisASTVisitor
that typeid()
can be evaluated."
#96766
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…can be e…" This reverts commit dfe80a7.
@llvm/pr-subscribers-clang-analysis @llvm/pr-subscribers-clang Author: None (martinboehme) ChangesReverts llvm/llvm-project#96731 It causes CI failures. Full diff: https://github.com/llvm/llvm-project/pull/96766.diff 2 Files Affected:
diff --git a/clang/include/clang/Analysis/FlowSensitive/ASTOps.h b/clang/include/clang/Analysis/FlowSensitive/ASTOps.h
index f9c923a36ad22..925b99af9141a 100644
--- a/clang/include/clang/Analysis/FlowSensitive/ASTOps.h
+++ b/clang/include/clang/Analysis/FlowSensitive/ASTOps.h
@@ -113,11 +113,7 @@ class AnalysisASTVisitor : public RecursiveASTVisitor<Derived> {
// 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 *TIE) {
- if (TIE->isPotentiallyEvaluated())
- return RecursiveASTVisitor<Derived>::TraverseCXXTypeidExpr(TIE);
- return true;
- }
+ bool TraverseCXXTypeidExpr(CXXTypeidExpr *) { return true; }
bool TraverseUnaryExprOrTypeTraitExpr(UnaryExprOrTypeTraitExpr *) {
return true;
}
diff --git a/clang/unittests/Analysis/FlowSensitive/TransferTest.cpp b/clang/unittests/Analysis/FlowSensitive/TransferTest.cpp
index 39e7001393e5e..e743eefa5d458 100644
--- a/clang/unittests/Analysis/FlowSensitive/TransferTest.cpp
+++ b/clang/unittests/Analysis/FlowSensitive/TransferTest.cpp
@@ -1637,49 +1637,6 @@ TEST(TransferTest, StructModeledFieldsWithAccessor) {
});
}
-TEST(TransferTest, StructModeledFieldsInTypeid) {
- // Test that we model fields mentioned inside a `typeid()` expression only if
- // that expression is potentially evaluated -- i.e. if the expression inside
- // `typeid()` is a glvalue of polymorphic type (see
- // `CXXTypeidExpr::isPotentiallyEvaluated()` and [expr.typeid]p3).
- std::string Code = R"(
- // Definitions needed for `typeid`.
- namespace std {
- class type_info {};
- class bad_typeid {};
- } // namespace std
-
- struct NonPolymorphic {};
-
- struct Polymorphic {
- virtual ~Polymorphic() = default;
- };
-
- struct S {
- NonPolymorphic *NonPoly;
- Polymorphic *Poly;
- };
-
- void target(S &s) {
- typeid(*s.NonPoly);
- typeid(*s.Poly);
- // [[p]]
- }
- )";
- runDataflow(
- Code,
- [](const llvm::StringMap<DataflowAnalysisState<NoopLattice>> &Results,
- ASTContext &ASTCtx) {
- const Environment &Env = getEnvironmentAtAnnotation(Results, "p");
- auto &SLoc = getLocForDecl<RecordStorageLocation>(ASTCtx, Env, "s");
- std::vector<const ValueDecl *> Fields;
- for (auto [Field, _] : SLoc.children())
- Fields.push_back(Field);
- EXPECT_THAT(Fields,
- UnorderedElementsAre(findValueDecl(ASTCtx, "Poly")));
- });
-}
-
TEST(TransferTest, StructModeledFieldsWithComplicatedInheritance) {
std::string Code = R"(
struct Base1 {
|
lravenclaw
pushed a commit
to lravenclaw/llvm-project
that referenced
this pull request
Jul 3, 2024
…can be evaluated." (llvm#96766) Reverts llvm#96731 It causes CI failures.
AlexisPerry
pushed a commit
to llvm-project-tlp/llvm-project
that referenced
this pull request
Jul 9, 2024
…can be evaluated." (llvm#96766) Reverts llvm#96731 It causes CI failures.
martinboehme
added a commit
that referenced
this pull request
Jul 16, 2024
- **Reapply "[clang][dataflow] Teach `AnalysisASTVisitor` that `typeid()` can be evaluated." (#96766)** - **Turn on RTTI explicitly in `checkDataflowWithNoopAnalysis()`.**
yuxuanchen1997
pushed a commit
that referenced
this pull request
Jul 25, 2024
Summary: - **Reapply "[clang][dataflow] Teach `AnalysisASTVisitor` that `typeid()` can be evaluated." (#96766)** - **Turn on RTTI explicitly in `checkDataflowWithNoopAnalysis()`.** Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: https://phabricator.intern.facebook.com/D60251696
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
clang:analysis
clang:dataflow
Clang Dataflow Analysis framework - https://clang.llvm.org/docs/DataFlowAnalysisIntro.html
clang
Clang issues not falling into any other category
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Reverts #96731
It causes CI failures.