diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-02-14 01:44:41 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-02-14 01:44:41 +0000 |
commit | 70eb9c5ae59b739b31245ef18f84eeb2a4a68ffa (patch) | |
tree | 00274d081bd5648a5a741143aafb74ed583b601f /llvm/lib/CodeGen/StackProtector.cpp | |
parent | bb755d614ab587019545d2dc3aa687788c90a90e (diff) | |
download | bcm5719-llvm-70eb9c5ae59b739b31245ef18f84eeb2a4a68ffa.tar.gz bcm5719-llvm-70eb9c5ae59b739b31245ef18f84eeb2a4a68ffa.zip |
CodeGen: Canonicalize access to function attributes, NFC
Canonicalize access to function attributes to use the simpler API.
getAttributes().getAttribute(AttributeSet::FunctionIndex, Kind)
=> getFnAttribute(Kind)
getAttributes().hasAttribute(AttributeSet::FunctionIndex, Kind)
=> hasFnAttribute(Kind)
Also, add `Function::getFnStackAlignment()`, and canonicalize:
getAttributes().getStackAlignment(AttributeSet::FunctionIndex)
=> getFnStackAlignment()
llvm-svn: 229208
Diffstat (limited to 'llvm/lib/CodeGen/StackProtector.cpp')
-rw-r--r-- | llvm/lib/CodeGen/StackProtector.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/llvm/lib/CodeGen/StackProtector.cpp b/llvm/lib/CodeGen/StackProtector.cpp index 2663fecf4ae..d1fae9558b2 100644 --- a/llvm/lib/CodeGen/StackProtector.cpp +++ b/llvm/lib/CodeGen/StackProtector.cpp @@ -90,8 +90,7 @@ bool StackProtector::runOnFunction(Function &Fn) { DT = DTWP ? &DTWP->getDomTree() : nullptr; TLI = TM->getSubtargetImpl(Fn)->getTargetLowering(); - Attribute Attr = Fn.getAttributes().getAttribute( - AttributeSet::FunctionIndex, "stack-protector-buffer-size"); + Attribute Attr = Fn.getFnAttribute("stack-protector-buffer-size"); if (Attr.isStringAttribute() && Attr.getValueAsString().getAsInteger(10, SSPBufferSize)) return false; // Invalid integer string @@ -201,15 +200,12 @@ bool StackProtector::HasAddressTaken(const Instruction *AI) { bool StackProtector::RequiresStackProtector() { bool Strong = false; bool NeedsProtector = false; - if (F->getAttributes().hasAttribute(AttributeSet::FunctionIndex, - Attribute::StackProtectReq)) { + if (F->hasFnAttribute(Attribute::StackProtectReq)) { NeedsProtector = true; Strong = true; // Use the same heuristic as strong to determine SSPLayout - } else if (F->getAttributes().hasAttribute(AttributeSet::FunctionIndex, - Attribute::StackProtectStrong)) + } else if (F->hasFnAttribute(Attribute::StackProtectStrong)) Strong = true; - else if (!F->getAttributes().hasAttribute(AttributeSet::FunctionIndex, - Attribute::StackProtect)) + else if (!F->hasFnAttribute(Attribute::StackProtect)) return false; for (const BasicBlock &BB : *F) { |