[clang] [clang][dataflow] Use containers with deterministic iteration order. (PR #169512)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 25 08:17:40 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang-analysis
Author: Samira Bakon (bazuzi)
<details>
<summary>Changes</summary>
---
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
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);
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/169512
More information about the cfe-commits
mailing list