diff options
author | Andrey Bokhanko <andreybokhanko@gmail.com> | 2016-04-15 08:03:51 +0000 |
---|---|---|
committer | Andrey Bokhanko <andreybokhanko@gmail.com> | 2016-04-15 08:03:51 +0000 |
commit | f7fa634887cf327ebca2a71327631ee00f0057a8 (patch) | |
tree | 6115bdd74d32215b36ca02a348f2eb780a95b716 /clang/lib/Parse/ParseDecl.cpp | |
parent | 18e69f4f635434eefadb35caffef71d2b429933c (diff) | |
download | bcm5719-llvm-f7fa634887cf327ebca2a71327631ee00f0057a8.tar.gz bcm5719-llvm-f7fa634887cf327ebca2a71327631ee00f0057a8.zip |
[MSVC Compat] Implementation of __unaligned (MS extension) as a type qualifier
This patch implements __unaligned as a type qualifier; before that, it was
modeled as an attribute. Proper mangling of __unaligned is implemented as well.
Some OpenCL code/tests are tangenially affected, as they relied on existing
number and sizes of type qualifiers.
Differential Revision: http://reviews.llvm.org/D18596
llvm-svn: 266415
Diffstat (limited to 'clang/lib/Parse/ParseDecl.cpp')
-rw-r--r-- | clang/lib/Parse/ParseDecl.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp index ebe26cfb2dd..b26139089fb 100644 --- a/clang/lib/Parse/ParseDecl.cpp +++ b/clang/lib/Parse/ParseDecl.cpp @@ -609,7 +609,6 @@ void Parser::ParseMicrosoftTypeAttributes(ParsedAttributes &attrs) { case tok::kw___ptr64: case tok::kw___w64: case tok::kw___ptr32: - case tok::kw___unaligned: case tok::kw___sptr: case tok::kw___uptr: { IdentifierInfo *AttrName = Tok.getIdentifierInfo(); @@ -3087,6 +3086,11 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS, break; } + case tok::kw___unaligned: + isInvalid = DS.SetTypeQual(DeclSpec::TQ_unaligned, Loc, PrevSpec, DiagID, + getLangOpts()); + break; + case tok::kw___sptr: case tok::kw___uptr: case tok::kw___ptr64: @@ -3097,7 +3101,6 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS, case tok::kw___fastcall: case tok::kw___thiscall: case tok::kw___vectorcall: - case tok::kw___unaligned: ParseMicrosoftTypeAttributes(DS.getAttributes()); continue; @@ -4819,6 +4822,10 @@ void Parser::ParseTypeQualifierListOpt(DeclSpec &DS, unsigned AttrReqs, ParseOpenCLQualifiers(DS.getAttributes()); break; + case tok::kw___unaligned: + isInvalid = DS.SetTypeQual(DeclSpec::TQ_unaligned, Loc, PrevSpec, DiagID, + getLangOpts()); + break; case tok::kw___uptr: // GNU libc headers in C mode use '__uptr' as an identifer which conflicts // with the MS modifier keyword. @@ -4836,7 +4843,6 @@ void Parser::ParseTypeQualifierListOpt(DeclSpec &DS, unsigned AttrReqs, case tok::kw___fastcall: case tok::kw___thiscall: case tok::kw___vectorcall: - case tok::kw___unaligned: if (AttrReqs & AR_DeclspecAttributesParsed) { ParseMicrosoftTypeAttributes(DS.getAttributes()); continue; @@ -5059,7 +5065,8 @@ void Parser::ParseDeclaratorInternal(Declarator &D, DS.getConstSpecLoc(), DS.getVolatileSpecLoc(), DS.getRestrictSpecLoc(), - DS.getAtomicSpecLoc()), + DS.getAtomicSpecLoc(), + DS.getUnalignedSpecLoc()), DS.getAttributes(), SourceLocation()); else |