Skip to content

Conversation

@ilovepi
Copy link
Contributor

@ilovepi ilovepi commented Nov 10, 2025

The order of these items may not be the same if reverse iteration is
enabled. From what I can tell this is related to visitation order, and I
don't see an easy way to handle that using the typical solutions, like
MapVector, etc. For now, just use CHECK-DAG to get the test into a
passing state.

Fixes #167057

Copy link
Contributor Author

ilovepi commented Nov 10, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

@ilovepi ilovepi requested a review from steakhal November 10, 2025 21:32
@ilovepi ilovepi marked this pull request as ready for review November 10, 2025 21:32
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:static analyzer labels Nov 10, 2025
@llvmbot
Copy link
Member

llvmbot commented Nov 10, 2025

@llvm/pr-subscribers-clang

Author: Paul Kirth (ilovepi)

Changes

The order of these items may not be the same if reverse iteration is
enabled. From what I can tell this is related to visitation order, and I
don't see an easy way to handle that using the typical solutions, like
MapVector, etc. For now, just use CHECK-DAG to get the test into a
passing state.

Fixes #167057


Full diff: https://github.com/llvm/llvm-project/pull/167394.diff

1 Files Affected:

  • (modified) clang/test/Analysis/analyzeOneFunction.cpp (+3-3)
diff --git a/clang/test/Analysis/analyzeOneFunction.cpp b/clang/test/Analysis/analyzeOneFunction.cpp
index 3a362dfd9a08c..9b752e29320a4 100644
--- a/clang/test/Analysis/analyzeOneFunction.cpp
+++ b/clang/test/Analysis/analyzeOneFunction.cpp
@@ -5,9 +5,9 @@
 // RUN:   -analyze-function="c:@S@Window@F@overloaded#I#"
 
 // RUN: %clang_extdef_map %s | FileCheck %s
-// CHECK:      27:c:@S@Window@F@overloaded#I#
-// CHECK-NEXT: 27:c:@S@Window@F@overloaded#C#
-// CHECK-NEXT: 27:c:@S@Window@F@overloaded#d#
+// CHECK-DAG:      27:c:@S@Window@F@overloaded#I#
+// CHECK-DAG: 27:c:@S@Window@F@overloaded#C#
+// CHECK-DAG: 27:c:@S@Window@F@overloaded#d#
 
 void clang_analyzer_warnIfReached();
 

@llvmbot
Copy link
Member

llvmbot commented Nov 10, 2025

@llvm/pr-subscribers-clang-static-analyzer-1

Author: Paul Kirth (ilovepi)

Changes

The order of these items may not be the same if reverse iteration is
enabled. From what I can tell this is related to visitation order, and I
don't see an easy way to handle that using the typical solutions, like
MapVector, etc. For now, just use CHECK-DAG to get the test into a
passing state.

Fixes #167057


Full diff: https://github.com/llvm/llvm-project/pull/167394.diff

1 Files Affected:

  • (modified) clang/test/Analysis/analyzeOneFunction.cpp (+3-3)
diff --git a/clang/test/Analysis/analyzeOneFunction.cpp b/clang/test/Analysis/analyzeOneFunction.cpp
index 3a362dfd9a08c..9b752e29320a4 100644
--- a/clang/test/Analysis/analyzeOneFunction.cpp
+++ b/clang/test/Analysis/analyzeOneFunction.cpp
@@ -5,9 +5,9 @@
 // RUN:   -analyze-function="c:@S@Window@F@overloaded#I#"
 
 // RUN: %clang_extdef_map %s | FileCheck %s
-// CHECK:      27:c:@S@Window@F@overloaded#I#
-// CHECK-NEXT: 27:c:@S@Window@F@overloaded#C#
-// CHECK-NEXT: 27:c:@S@Window@F@overloaded#d#
+// CHECK-DAG:      27:c:@S@Window@F@overloaded#I#
+// CHECK-DAG: 27:c:@S@Window@F@overloaded#C#
+// CHECK-DAG: 27:c:@S@Window@F@overloaded#d#
 
 void clang_analyzer_warnIfReached();
 

The order of these items may not be the same if reverse iteration is
enabled. From what I can tell this is related to visitation order, and I
don't see an easy way to handle that using the typical solutions, like
MapVector, etc. For now, just use CHECK-DAG to get the test into a
passing state.

Fixes #167057
Copy link
Contributor

@necto necto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix makes sense.
The order in which functions are analyzed does not matter for this test.

P.S. I was not aware of LLVM_REVERSE_ITERATION, seems like a great tool!

@necto
Copy link
Contributor

necto commented Nov 11, 2025

FYI, CSA analyzes entry points in a reverse topological order of the call graph. There is a minimal, but nonzero number of dependencies between entry points. One notable example is the inline limit. If a callee was inlined when analyzing entry_point_a() it might no longer be inlined when analyzing subsequent entry_point_b(). So theoretically some other tests that are sensitive to a callee being inlined could start failing with LLVM_REVERSE_ITERATION=ON, but apparently that didn't happen so far.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang:static analyzer clang Clang issues not falling into any other category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[clang] Analysis/analyzeOneFunction.cpp test fails under reverse iteration

4 participants