Skip to content

Conversation

@bazuzi
Copy link
Contributor

@bazuzi bazuzi commented Nov 25, 2025

No description provided.

@llvmbot llvmbot added clang Clang issues not falling into any other category clang:dataflow Clang Dataflow Analysis framework - https://clang.llvm.org/docs/DataFlowAnalysisIntro.html clang:analysis labels Nov 25, 2025
@bazuzi bazuzi requested a review from jvoung November 25, 2025 16:17
@llvmbot
Copy link
Member

llvmbot commented Nov 25, 2025

@llvm/pr-subscribers-clang

@llvm/pr-subscribers-clang-analysis

Author: Samira Bakon (bazuzi)

Changes

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

2 Files Affected:

  • (modified) clang/include/clang/Analysis/FlowSensitive/ASTOps.h (+4-5)
  • (modified) clang/lib/Analysis/FlowSensitive/ASTOps.cpp (+4-4)
diff --git a/clang/include/clang/Analysis/FlowSensitive/ASTOps.h b/clang/include/clang/Analysis/FlowSensitive/ASTOps.h
index a404b06cd62ca..3e57f30dd2053 100644
--- a/clang/include/clang/Analysis/FlowSensitive/ASTOps.h
+++ b/clang/include/clang/Analysis/FlowSensitive/ASTOps.h
@@ -19,7 +19,6 @@
 #include "clang/AST/ExprCXX.h"
 #include "clang/AST/Type.h"
 #include "clang/Analysis/FlowSensitive/StorageLocation.h"
-#include "llvm/ADT/DenseSet.h"
 #include "llvm/ADT/SetVector.h"
 
 namespace clang {
@@ -145,17 +144,17 @@ struct ReferencedDecls {
   FieldSet Fields;
   /// All variables with static storage duration, notably including static
   /// member variables and static variables declared within a function.
-  llvm::DenseSet<const VarDecl *> Globals;
+  llvm::SetVector<const VarDecl *> Globals;
   /// Local variables, not including parameters or static variables declared
   /// within a function.
-  llvm::DenseSet<const VarDecl *> Locals;
+  llvm::SetVector<const VarDecl *> Locals;
   /// Free functions and member functions which are referenced (but not
   /// necessarily called).
-  llvm::DenseSet<const FunctionDecl *> Functions;
+  llvm::SetVector<const FunctionDecl *> Functions;
   /// When analyzing a lambda's call operator, the set of all parameters (from
   /// the surrounding function) that the lambda captures. Captured local
   /// variables are already included in `Locals` above.
-  llvm::DenseSet<const ParmVarDecl *> LambdaCapturedParams;
+  llvm::SetVector<const ParmVarDecl *> LambdaCapturedParams;
 };
 
 /// Returns declarations that are declared in or referenced from `FD`.
diff --git a/clang/lib/Analysis/FlowSensitive/ASTOps.cpp b/clang/lib/Analysis/FlowSensitive/ASTOps.cpp
index 7ce6b03fc0e71..e8113fc094037 100644
--- a/clang/lib/Analysis/FlowSensitive/ASTOps.cpp
+++ b/clang/lib/Analysis/FlowSensitive/ASTOps.cpp
@@ -22,8 +22,8 @@
 #include "clang/AST/Type.h"
 #include "clang/Analysis/FlowSensitive/StorageLocation.h"
 #include "clang/Basic/LLVM.h"
-#include "llvm/ADT/DenseSet.h"
 #include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/SetVector.h"
 #include <cassert>
 #include <iterator>
 #include <vector>
@@ -164,21 +164,21 @@ RecordInitListHelper::RecordInitListHelper(
 }
 
 static void insertIfGlobal(const Decl &D,
-                           llvm::DenseSet<const VarDecl *> &Globals) {
+                           llvm::SetVector<const VarDecl *> &Globals) {
   if (auto *V = dyn_cast<VarDecl>(&D))
     if (V->hasGlobalStorage())
       Globals.insert(V);
 }
 
 static void insertIfLocal(const Decl &D,
-                          llvm::DenseSet<const VarDecl *> &Locals) {
+                          llvm::SetVector<const VarDecl *> &Locals) {
   if (auto *V = dyn_cast<VarDecl>(&D))
     if (V->hasLocalStorage() && !isa<ParmVarDecl>(V))
       Locals.insert(V);
 }
 
 static void insertIfFunction(const Decl &D,
-                             llvm::DenseSet<const FunctionDecl *> &Funcs) {
+                             llvm::SetVector<const FunctionDecl *> &Funcs) {
   if (auto *FD = dyn_cast<FunctionDecl>(&D))
     Funcs.insert(FD);
 }

Copy link
Contributor

@jvoung jvoung left a comment

Choose a reason for hiding this comment

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

Thanks!

@bazuzi bazuzi enabled auto-merge (squash) November 25, 2025 16:33
@bazuzi bazuzi merged commit b93bb69 into llvm:main Nov 25, 2025
13 of 14 checks passed
@bazuzi bazuzi deleted the piper_export_cl_836334012 branch November 25, 2025 16:39
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants