Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions clang/include/clang/Analysis/FlowSensitive/ASTOps.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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`.
Expand Down
8 changes: 4 additions & 4 deletions clang/lib/Analysis/FlowSensitive/ASTOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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);
}
Expand Down
Loading