[PATCH] D14304: [IR] Restrain paramHasAttr: disallow function attrs
Sanjoy Das via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 3 14:06:03 PST 2015
sanjoy created this revision.
sanjoy added a reviewer: reames.
sanjoy added a subscriber: llvm-commits.
It does not look like anyone was using paramHasAttr to query
AttributeSet::FunctionIndex, and this change formalizes that
restriction. This is intended to make later changes simpler and
supposed to be an NFC.
http://reviews.llvm.org/D14304
Files:
lib/IR/Instructions.cpp
Index: lib/IR/Instructions.cpp
===================================================================
--- lib/IR/Instructions.cpp
+++ lib/IR/Instructions.cpp
@@ -331,6 +331,8 @@
}
bool CallInst::paramHasAttr(unsigned i, Attribute::AttrKind A) const {
+ assert(i != AttributeSet::FunctionIndex && "Use hasFnAttr instead!");
+
if (AttributeList.hasAttribute(i, A))
return true;
if (const Function *F = getCalledFunction())
@@ -575,6 +577,8 @@
}
bool InvokeInst::paramHasAttr(unsigned i, Attribute::AttrKind A) const {
+ assert(i != AttributeSet::FunctionIndex && "Use hasFnAttr instead!");
+
if (AttributeList.hasAttribute(i, A))
return true;
if (const Function *F = getCalledFunction())
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14304.39116.patch
Type: text/x-patch
Size: 715 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151103/6bb14196/attachment.bin>
More information about the llvm-commits
mailing list