Author: Samira Bakon Date: 2025-11-25T16:37:54Z New Revision: b93bb69dfad5f94565d90575a92203a1a2f3395b
URL: https://github.com/llvm/llvm-project/commit/b93bb69dfad5f94565d90575a92203a1a2f3395b DIFF: https://github.com/llvm/llvm-project/commit/b93bb69dfad5f94565d90575a92203a1a2f3395b.diff LOG: [clang][dataflow] Use containers with deterministic iteration order. (#169512) Added: Modified: clang/include/clang/Analysis/FlowSensitive/ASTOps.h clang/lib/Analysis/FlowSensitive/ASTOps.cpp Removed: ################################################################################ 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); } _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
