diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2013-07-06 00:29:58 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2013-07-06 00:29:58 +0000 |
commit | dc89737bcdbb8f69d8ae7578bdfa904cabcfc5ed (patch) | |
tree | 1838b5d8368383a083fad1cdca2fe777528e5a69 /lib/AsmParser/LLParser.cpp | |
parent | 202eb7b18e220205ec86a03ddf18f2066c70ab15 (diff) | |
download | external_llvm-dc89737bcdbb8f69d8ae7578bdfa904cabcfc5ed.zip external_llvm-dc89737bcdbb8f69d8ae7578bdfa904cabcfc5ed.tar.gz external_llvm-dc89737bcdbb8f69d8ae7578bdfa904cabcfc5ed.tar.bz2 |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185735 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AsmParser/LLParser.cpp')
-rw-r--r-- | lib/AsmParser/LLParser.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/AsmParser/LLParser.cpp b/lib/AsmParser/LLParser.cpp index 9349007..941a371 100644 --- a/lib/AsmParser/LLParser.cpp +++ b/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(); |