aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Bendersky <eliben@chromium.org>2013-07-18 09:38:12 -0700
committerEli Bendersky <eliben@chromium.org>2013-07-18 09:38:12 -0700
commita481fd78c6e3226e1de78c25e63265a9ebab8b22 (patch)
treed7c4b5aa340e386a02d04155aeee743ebc826dbf
parent0592f0ef8bbc825243cb1860b09468a7605f8716 (diff)
Adding checks for isEnumAttribute because getKindAsEnum now asserts
-rw-r--r--lib/Transforms/NaCl/ExpandByVal.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/Transforms/NaCl/ExpandByVal.cpp b/lib/Transforms/NaCl/ExpandByVal.cpp
index 7227f3e501..0220cafb88 100644
--- a/lib/Transforms/NaCl/ExpandByVal.cpp
+++ b/lib/Transforms/NaCl/ExpandByVal.cpp
@@ -78,6 +78,7 @@ AttributeSet RemoveAttrs(LLVMContext &Context, AttributeSet Attrs) {
for (AttributeSet::iterator Attr = Attrs.begin(Slot), E = Attrs.end(Slot);
Attr != E; ++Attr) {
if (!Attr->isAlignAttribute() &&
+ Attr->isEnumAttribute() &&
Attr->getKindAsEnum() != Attribute::ByVal &&
Attr->getKindAsEnum() != Attribute::StructRet) {
AB.addAttribute(*Attr);
@@ -87,7 +88,8 @@ AttributeSet RemoveAttrs(LLVMContext &Context, AttributeSet Attrs) {
// example, a global variable address can be passed as a
// StructRet argument, although Clang does not do so and Clang
// explicitly adds NoAlias to StructRet arguments.
- if (Attr->getKindAsEnum() == Attribute::ByVal) {
+ if (Attr->isEnumAttribute() &&
+ Attr->getKindAsEnum() == Attribute::ByVal) {
AB.addAttribute(Attribute::get(Context, Attribute::NoAlias));
}
}