Skip to content

Commit b1bb417

Browse files
author
Martin Mory
committed
Merge branch 'f-ClangTidyFixIDETSA' into f-ClangTidyFixIDESolver
2 parents 06fd7e3 + 6c90deb commit b1bb417

4 files changed

Lines changed: 10 additions & 17 deletions

File tree

include/phasar/PhasarLLVM/ControlFlow/LLVMBasedICFG.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,13 +321,13 @@ class LLVMBasedICFG
321321

322322
template <typename Fn> void forEachGlobalCtor(Fn &&F) const {
323323
for (auto [Prio, Fun] : GlobalCtors) {
324-
F(static_cast<const llvm::Function *>(Fun));
324+
std::invoke(F, static_cast<const llvm::Function *>(Fun));
325325
}
326326
}
327327

328328
template <typename Fn> void forEachGlobalDtor(Fn &&F) const {
329329
for (auto [Prio, Fun] : GlobalDtors) {
330-
F(static_cast<const llvm::Function *>(Fun));
330+
std::invoke(F, static_cast<const llvm::Function *>(Fun));
331331
}
332332
}
333333

include/phasar/PhasarLLVM/DataFlowSolver/IfdsIde/FlowFunctions.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ class GenIf : public FlowFunction<D, Container> {
185185
: GenValues({GenValue}), Predicate(std::move(Predicate)) {}
186186

187187
GenIf(container_type GenValues, std::function<bool(D)> Predicate)
188-
: GenValues(std::move(GenValues)), Predicate(Predicate) {}
188+
: GenValues(std::move(GenValues)), Predicate(std::move(Predicate)) {}
189189

190190
~GenIf() override = default;
191191

@@ -274,7 +274,7 @@ class KillMultiple : public FlowFunction<D, Container> {
274274
KillMultiple(std::set<D> KillValues) : KillValues(std::move(KillValues)) {}
275275
~KillMultiple() override = default;
276276
container_type computeTargets(D Source) override {
277-
if (KillValues.find(Source) != KillValues.end()) {
277+
if (KillValues.count(Source)) {
278278
return {};
279279
}
280280
return {Source};

include/phasar/PhasarLLVM/DataFlowSolver/IfdsIde/LLVMZeroValue.h

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,8 @@ class LLVMZeroValue : public llvm::GlobalVariable {
6868
return LLVMZeroValueInternalName;
6969
}
7070

71-
bool isLLVMZeroValue(const llvm::Value *V) const {
72-
if (V && V->hasName()) {
73-
// checks if V's name start with "zero_value"
74-
return V->getName().find(LLVMZeroValueInternalName) !=
75-
llvm::StringRef::npos;
76-
}
77-
return false;
71+
static bool isLLVMZeroValue(const llvm::Value *V) {
72+
return V == getInstance();
7873
}
7974

8075
// Do not specify a destructor (at all)!

lib/PhasarLLVM/ControlFlow/LLVMBasedICFG.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -444,15 +444,13 @@ const llvm::Function *LLVMBasedICFG::getFunction(const string &Fun) const {
444444
}
445445

446446
const llvm::Function *LLVMBasedICFG::getFirstGlobalCtorOrNull() const {
447-
auto It = GlobalCtors.begin();
448-
if (It != GlobalCtors.end()) {
447+
if (auto It = GlobalCtors.begin(); It != GlobalCtors.end()) {
449448
return It->second;
450449
}
451450
return nullptr;
452451
}
453452
const llvm::Function *LLVMBasedICFG::getLastGlobalDtorOrNull() const {
454-
auto It = GlobalDtors.rbegin();
455-
if (It != GlobalDtors.rend()) {
453+
if (auto It = GlobalDtors.rbegin(); It != GlobalDtors.rend()) {
456454
return It->second;
457455
}
458456
return nullptr;
@@ -1273,8 +1271,8 @@ unsigned LLVMBasedICFG::getNumOfEdges() const {
12731271

12741272
const llvm::Function *
12751273
LLVMBasedICFG::getRegisteredDtorsCallerOrNull(const llvm::Module *Mod) {
1276-
auto It = GlobalRegisteredDtorsCaller.find(Mod);
1277-
if (It != GlobalRegisteredDtorsCaller.end()) {
1274+
if (auto It = GlobalRegisteredDtorsCaller.find(Mod);
1275+
It != GlobalRegisteredDtorsCaller.end()) {
12781276
return It->second;
12791277
}
12801278

0 commit comments

Comments
 (0)