Skip to content

Commit

Permalink
revert try to fix ubuntu link
Browse files Browse the repository at this point in the history
  • Loading branch information
KomiMoe committed Sep 24, 2024
1 parent 21b93e2 commit 4335dba
Showing 1 changed file with 1 addition and 22 deletions.
23 changes: 1 addition & 22 deletions llvm/lib/Transforms/Obfuscation/StringEncryption.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,27 +72,6 @@ struct StringEncryption : public ModulePass {
return false;
}

static bool isSafeToDelete(const Constant *C) {
SmallVector<const Constant *, 8> Worklist;
SmallPtrSet<const Constant *, 8> Visited;
Worklist.push_back(C);
while (!Worklist.empty()) {
const Constant *C = Worklist.pop_back_val();
if (!Visited.insert(C).second)
continue;
if (isa<GlobalValue>(C) || isa<ConstantData>(C))
return false;

for (const User *U : C->users()) {
if (const Constant *CU = dyn_cast<Constant>(U))
Worklist.push_back(CU);
else
return false;
}
}
return true;
}

StringRef getPassName() const override { return {"StringEncryption"}; }

bool runOnModule(Module &M) override;
Expand Down Expand Up @@ -530,7 +509,7 @@ void StringEncryption::deleteUnusedGlobalVariable() {
if (GV->hasInitializer()) {
Constant *Init = GV->getInitializer();
GV->setInitializer(nullptr);
if (isSafeToDelete(Init))
if (isSafeToDestroyConstant(Init))
Init->destroyConstant();
}
Iter = MaybeDeadGlobalVars.erase(Iter);
Expand Down

0 comments on commit 4335dba

Please sign in to comment.