diff options
author | Matt Arsenault <Matthew.Arsenault@amd.com> | 2022-12-08 10:53:17 -0500 |
---|---|---|
committer | Matt Arsenault <Matthew.Arsenault@amd.com> | 2022-12-14 13:12:35 -0500 |
commit | c16a58b36caebbc34dfa0f788a019d041e5484df (patch) | |
tree | f414679a49d47918a19469a1b1d23d5c95f24185 /llvm/lib/CodeGen/StackProtector.cpp | |
parent | 547e40a91b1e8e92add955a95a286999107c9196 (diff) | |
download | llvm-c16a58b36caebbc34dfa0f788a019d041e5484df.zip llvm-c16a58b36caebbc34dfa0f788a019d041e5484df.tar.gz llvm-c16a58b36caebbc34dfa0f788a019d041e5484df.tar.bz2 |
Attributes: Add function getter to parse integer string attributes
The most common case for string attributes parses them as integers. We
don't have a convenient way to do this, and as a result we have
inconsistent missing attribute and invalid attribute handling
scattered around. We also have inconsistent radix usage to
getAsInteger; some places use the default 0 and others use base 10.
Update a few of the uses, but there are quite a lot of these.
Diffstat (limited to 'llvm/lib/CodeGen/StackProtector.cpp')
-rw-r--r-- | llvm/lib/CodeGen/StackProtector.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/StackProtector.cpp b/llvm/lib/CodeGen/StackProtector.cpp index c7731a7..f76877f 100644 --- a/llvm/lib/CodeGen/StackProtector.cpp +++ b/llvm/lib/CodeGen/StackProtector.cpp @@ -63,7 +63,7 @@ static cl::opt<bool> EnableSelectionDAGSP("enable-selectiondag-sp", char StackProtector::ID = 0; -StackProtector::StackProtector() : FunctionPass(ID), SSPBufferSize(8) { +StackProtector::StackProtector() : FunctionPass(ID) { initializeStackProtectorPass(*PassRegistry::getPassRegistry()); } @@ -92,11 +92,8 @@ bool StackProtector::runOnFunction(Function &Fn) { HasPrologue = false; HasIRCheck = false; - Attribute Attr = Fn.getFnAttribute("stack-protector-buffer-size"); - if (Attr.isStringAttribute() && - Attr.getValueAsString().getAsInteger(10, SSPBufferSize)) - return false; // Invalid integer string - + SSPBufferSize = Fn.getFnAttributeAsParsedInteger( + "stack-protector-buffer-size", DefaultSSPBufferSize); if (!RequiresStackProtector()) return false; |