mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-27 16:17:17 +00:00
CodeGen: constify and use range loop for SSP
Use range-based for loop and constify the iterators. NFC. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224683 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -212,20 +212,16 @@ bool StackProtector::RequiresStackProtector() {
|
|||||||
Attribute::StackProtect))
|
Attribute::StackProtect))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for (Function::iterator I = F->begin(), E = F->end(); I != E; ++I) {
|
for (const BasicBlock &BB : *F) {
|
||||||
BasicBlock *BB = I;
|
for (const Instruction &I : BB) {
|
||||||
|
if (const AllocaInst *AI = dyn_cast<AllocaInst>(&I)) {
|
||||||
for (BasicBlock::iterator II = BB->begin(), IE = BB->end(); II != IE;
|
|
||||||
++II) {
|
|
||||||
if (AllocaInst *AI = dyn_cast<AllocaInst>(II)) {
|
|
||||||
if (AI->isArrayAllocation()) {
|
if (AI->isArrayAllocation()) {
|
||||||
// SSP-Strong: Enable protectors for any call to alloca, regardless
|
// SSP-Strong: Enable protectors for any call to alloca, regardless
|
||||||
// of size.
|
// of size.
|
||||||
if (Strong)
|
if (Strong)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (const ConstantInt *CI =
|
if (const auto *CI = dyn_cast<ConstantInt>(AI->getArraySize())) {
|
||||||
dyn_cast<ConstantInt>(AI->getArraySize())) {
|
|
||||||
if (CI->getLimitedValue(SSPBufferSize) >= SSPBufferSize) {
|
if (CI->getLimitedValue(SSPBufferSize) >= SSPBufferSize) {
|
||||||
// A call to alloca with size >= SSPBufferSize requires
|
// A call to alloca with size >= SSPBufferSize requires
|
||||||
// stack protectors.
|
// stack protectors.
|
||||||
|
Reference in New Issue
Block a user