[llvm] b109bec - [NFC] Add and use AttributeList::removeFnAttributes()
Arthur Eubanks via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 24 09:54:08 PDT 2021
Author: Arthur Eubanks
Date: 2021-08-24T09:53:39-07:00
New Revision: b109becdce12b353e09dab3995408ddfa1e30bd7
URL: https://github.com/llvm/llvm-project/commit/b109becdce12b353e09dab3995408ddfa1e30bd7
DIFF: https://github.com/llvm/llvm-project/commit/b109becdce12b353e09dab3995408ddfa1e30bd7.diff
LOG: [NFC] Add and use AttributeList::removeFnAttributes()
Added:
Modified:
llvm/include/llvm/IR/Attributes.h
llvm/lib/AsmParser/LLParser.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/IR/Attributes.h b/llvm/include/llvm/IR/Attributes.h
index d6237e3450f41..0c77110b33560 100644
--- a/llvm/include/llvm/IR/Attributes.h
+++ b/llvm/include/llvm/IR/Attributes.h
@@ -594,6 +594,12 @@ class AttributeList {
return removeAttributes(C, FunctionIndex, AttrsToRemove);
}
+ /// Remove the attributes at the function index from this
+ /// attribute list. Returns a new list because attribute lists are immutable.
+ LLVM_NODISCARD AttributeList removeFnAttributes(LLVMContext &C) const {
+ return removeAttributes(C, FunctionIndex);
+ }
+
/// Remove the specified attribute at the return value index from this
/// attribute list. Returns a new list because attribute lists are immutable.
LLVM_NODISCARD AttributeList
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp
index c24917cd7879e..d9af4ca843be4 100644
--- a/llvm/lib/AsmParser/LLParser.cpp
+++ b/llvm/lib/AsmParser/LLParser.cpp
@@ -141,7 +141,7 @@ bool LLParser::validateEndOfModule(bool UpgradeDebugInfo) {
if (Function *Fn = dyn_cast<Function>(V)) {
AttributeList AS = Fn->getAttributes();
AttrBuilder FnAttrs(AS.getFnAttrs());
- AS = AS.removeAttributes(Context, AttributeList::FunctionIndex);
+ AS = AS.removeFnAttributes(Context);
FnAttrs.merge(B);
@@ -157,21 +157,21 @@ bool LLParser::validateEndOfModule(bool UpgradeDebugInfo) {
} else if (CallInst *CI = dyn_cast<CallInst>(V)) {
AttributeList AS = CI->getAttributes();
AttrBuilder FnAttrs(AS.getFnAttrs());
- AS = AS.removeAttributes(Context, AttributeList::FunctionIndex);
+ AS = AS.removeFnAttributes(Context);
FnAttrs.merge(B);
AS = AS.addFnAttributes(Context, AttributeSet::get(Context, FnAttrs));
CI->setAttributes(AS);
} else if (InvokeInst *II = dyn_cast<InvokeInst>(V)) {
AttributeList AS = II->getAttributes();
AttrBuilder FnAttrs(AS.getFnAttrs());
- AS = AS.removeAttributes(Context, AttributeList::FunctionIndex);
+ AS = AS.removeFnAttributes(Context);
FnAttrs.merge(B);
AS = AS.addFnAttributes(Context, AttributeSet::get(Context, FnAttrs));
II->setAttributes(AS);
} else if (CallBrInst *CBI = dyn_cast<CallBrInst>(V)) {
AttributeList AS = CBI->getAttributes();
AttrBuilder FnAttrs(AS.getFnAttrs());
- AS = AS.removeAttributes(Context, AttributeList::FunctionIndex);
+ AS = AS.removeFnAttributes(Context);
FnAttrs.merge(B);
AS = AS.addFnAttributes(Context, AttributeSet::get(Context, FnAttrs));
CBI->setAttributes(AS);
More information about the llvm-commits
mailing list