summaryrefslogtreecommitdiffstats
path: root/llvm/lib/AsmParser
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2013-07-06 00:29:58 +0000
committerNick Lewycky <nicholas@mxc.ca>2013-07-06 00:29:58 +0000
commitc2ec0725cedceb851858c3991fbdd36ee9ac85dd (patch)
tree841ddf4ab15a0d446543803d7124a7716619cb04 /llvm/lib/AsmParser
parente8545dde7be8fe78e64bf4d9578c25368243c274 (diff)
downloadbcm5719-llvm-c2ec0725cedceb851858c3991fbdd36ee9ac85dd.tar.gz
bcm5719-llvm-c2ec0725cedceb851858c3991fbdd36ee9ac85dd.zip
Extend 'readonly' and 'readnone' to work on function arguments as well as
functions. Make the function attributes pass add it to known library functions and when it can deduce it. llvm-svn: 185735
Diffstat (limited to 'llvm/lib/AsmParser')
-rw-r--r--llvm/lib/AsmParser/LLParser.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp
index 9349007bbb5..941a371819e 100644
--- a/llvm/lib/AsmParser/LLParser.cpp
+++ b/llvm/lib/AsmParser/LLParser.cpp
@@ -1159,6 +1159,8 @@ bool LLParser::ParseOptionalParamAttrs(AttrBuilder &B) {
case lltok::kw_nest: B.addAttribute(Attribute::Nest); break;
case lltok::kw_noalias: B.addAttribute(Attribute::NoAlias); break;
case lltok::kw_nocapture: B.addAttribute(Attribute::NoCapture); break;
+ case lltok::kw_readnone: B.addAttribute(Attribute::ReadNone); break;
+ case lltok::kw_readonly: B.addAttribute(Attribute::ReadOnly); break;
case lltok::kw_returned: B.addAttribute(Attribute::Returned); break;
case lltok::kw_signext: B.addAttribute(Attribute::SExt); break;
case lltok::kw_sret: B.addAttribute(Attribute::StructRet); break;
@@ -1179,8 +1181,6 @@ bool LLParser::ParseOptionalParamAttrs(AttrBuilder &B) {
case lltok::kw_noreturn:
case lltok::kw_nounwind:
case lltok::kw_optsize:
- case lltok::kw_readnone:
- case lltok::kw_readonly:
case lltok::kw_returns_twice:
case lltok::kw_sanitize_address:
case lltok::kw_sanitize_memory:
@@ -1239,8 +1239,6 @@ bool LLParser::ParseOptionalReturnAttrs(AttrBuilder &B) {
case lltok::kw_noreturn:
case lltok::kw_nounwind:
case lltok::kw_optsize:
- case lltok::kw_readnone:
- case lltok::kw_readonly:
case lltok::kw_returns_twice:
case lltok::kw_sanitize_address:
case lltok::kw_sanitize_memory:
@@ -1251,6 +1249,10 @@ bool LLParser::ParseOptionalReturnAttrs(AttrBuilder &B) {
case lltok::kw_uwtable:
HaveError |= Error(Lex.getLoc(), "invalid use of function-only attribute");
break;
+
+ case lltok::kw_readnone:
+ case lltok::kw_readonly:
+ HaveError |= Error(Lex.getLoc(), "invalid use of attribute on return type");
}
Lex.Lex();
OpenPOWER on IntegriCloud