Commit Graph

11 Commits

Author SHA1 Message Date
Aaron Ballman db7467d886 Allow writing calling convention attributes on function types.
Calling convention attributes notionally appertain to the function type -- they modify the mangling of the function, change the behavior of assignment operations, etc. This commit allows the calling convention attributes to be written in the type position as well as the declaration position.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@331459 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-03 15:33:50 +00:00
John McCall ad080499c5 Improve some infrastructure for extended parameter infos and
fix a bug with the instantiation of ns_consumed parameter
attributes in ARC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@262551 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-03 00:10:03 +00:00
Alexander Musman 2358ff316c Fix assertion on C++ attributes in fillAttributedTypeLoc
this fixes http://llvm.org/PR17424
fillAttributedTypeLoc() function is only called with AttributeLists of either
DeclarationChunk (which is used for each type in a declarator being parsed) or
DeclSpec (which captures information about declaration specifiers).
As C++11 attributes actually appertain to declarators, they are moved straight
to the declarator’s attr list in distributeFunctionTypeAttrFromDeclSpec()
function.
'Put them wherever you like' semantics is not supported for C++11 attributes
(but is allowed for GNU attributes, for example). So when we meet an attribute
while parsing the declaration, we cannot be sure if it appertains to either
DeclarationChunk or DeclSpec.

This investigation correlates with the history of changes of SemaType.cpp:
• Asserts in fillAttributedTypeLoc() were added on 3 Mar 2011 in r126986
(http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-
        20110228/039638.html);
• Distributing C++11 attrs to the declarator was added on 14 Jan 2013
in r172504 (http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-
        20130114/071830.html).
Considering all written above I changed asserts in fillAttributedTypeLoc()
to nullptr checks.

This fixes PR17424 and related assertion on
[[gnu::fastcall]] void __stdcall foo();

Author: Alexey Frolov

Differential Revision: http://reviews.llvm.org/D9288



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@238550 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-29 11:24:32 +00:00
David Majnemer 33947ed22c Sema: Don't give attribute alias vars with struct type an init expr
We'd give the VarDecl a CXXConstructExpr even though it is annotated
with an alias attribute.  This would make us trip over sanity checking
asserts.

This fixes PR22493.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@228523 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-08 10:55:14 +00:00
Aaron Ballman c047507a9a Removing the alloc_size attribute. The attribute was semantically handled, but silently ignored. Most of this feature was already reverted in June 2012 (r159016), this just cleans up the pieces left over.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@197866 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-21 17:15:13 +00:00
Alp Toker bb17ff90d9 Switch %clang -cc1 tests to %clang_cc1
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193561 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-28 23:47:09 +00:00
Rafael Espindola 7e66ed34c3 Extend test to show an alias can be before a definition.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193099 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-21 18:24:30 +00:00
Richard Smith d03de6aaa3 Downgrade 'attribute ignored when parsing type' from error to warning, to match
the diagnostic's warn_ name. Switch some places (notably C++11 attributes)
which really wanted an error over to a different diagnostic. Finally, suppress
the diagnostic entirely for __ptr32, __ptr64 and __w64, to avoid producing
diagnostics in important system headers.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173788 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-29 10:02:16 +00:00
Richard Smith 5c52166525 Fix behavior of [[gnu::]] function attributes. Per g++'s behavior, these
attributes appertain to a declaration, even though they would be much more
naturally modelled as appertaining to a function type. Previously, we would
try to distribute them from the declarator to the function type, then
reject them for being at an incorrect location. Now, we just distribute them
as far as the declarator; the existing attribute handling code can actually
apply them there just fine.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172504 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-15 02:48:13 +00:00
NAKAMURA Takumi fe1d594c39 clang/test/SemaCXX/cxx11-gnu-attrs.cpp: Add explicit -triple x86_64-unknown-unknown, or it doesn't work for targetting win32.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172404 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-14 13:16:02 +00:00
Richard Smith d6e7fae82b Add extra tests for [[gnu::...]] attributes, missed from r172382.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172391 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-14 08:57:42 +00:00