diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/clang/Basic/DiagnosticSemaKinds.td | 3 | ||||
-rw-r--r-- | include/clang/Parse/Parser.h | 3 | ||||
-rw-r--r-- | include/clang/Sema/DeclSpec.h | 30 | ||||
-rw-r--r-- | include/clang/Sema/Sema.h | 6 |
4 files changed, 24 insertions, 18 deletions
diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index 7e26387cc8..2a71b17293 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -1166,8 +1166,7 @@ def warn_cxx98_compat_static_data_member_in_union : Warning< def err_union_member_of_reference_type : Error< "union member %0 has reference type %1">; def ext_anonymous_struct_union_qualified : Extension< - "anonymous %select{struct|union}0 cannot be '%select{const|volatile|" - "restrict}1'">; + "anonymous %select{struct|union}0 cannot be '%1'">; def err_different_return_type_for_overriding_virtual_function : Error< "virtual function %0 has a different return type " "%diff{($) than the function it overrides (which has return type $)|" diff --git a/include/clang/Parse/Parser.h b/include/clang/Parse/Parser.h index 1ac0f3be5e..11a3bdbd50 100644 --- a/include/clang/Parse/Parser.h +++ b/include/clang/Parse/Parser.h @@ -1999,7 +1999,8 @@ private: DirectDeclParseFunction DirectDeclParser); void ParseTypeQualifierListOpt(DeclSpec &DS, bool GNUAttributesAllowed = true, - bool CXX11AttributesAllowed = true); + bool CXX11AttributesAllowed = true, + bool AtomicAllowed = true); void ParseDirectDeclarator(Declarator &D); void ParseParenDeclarator(Declarator &D); void ParseFunctionDeclarator(Declarator &D, diff --git a/include/clang/Sema/DeclSpec.h b/include/clang/Sema/DeclSpec.h index 0c734216b1..48cd4d14f8 100644 --- a/include/clang/Sema/DeclSpec.h +++ b/include/clang/Sema/DeclSpec.h @@ -291,7 +291,10 @@ public: TQ_unspecified = 0, TQ_const = 1, TQ_restrict = 2, - TQ_volatile = 4 + TQ_volatile = 4, + // This has no corresponding Qualifiers::TQ value, because it's not treated + // as a qualifier in our type system. + TQ_atomic = 8 }; /// ParsedSpecifiers - Flags to query which specifiers were applied. This is @@ -321,7 +324,7 @@ private: unsigned TypeSpecOwned : 1; // type-qualifiers - unsigned TypeQualifiers : 3; // Bitwise OR of TQ. + unsigned TypeQualifiers : 4; // Bitwise OR of TQ. // function-specifier unsigned FS_inline_specified : 1; @@ -369,7 +372,7 @@ private: /// TSTNameLoc provides source range info for tag types. SourceLocation TSTNameLoc; SourceRange TypeofParensRange; - SourceLocation TQ_constLoc, TQ_restrictLoc, TQ_volatileLoc; + SourceLocation TQ_constLoc, TQ_restrictLoc, TQ_volatileLoc, TQ_atomicLoc; SourceLocation FS_inlineLoc, FS_virtualLoc, FS_explicitLoc, FS_noreturnLoc; SourceLocation FriendLoc, ModulePrivateLoc, ConstexprLoc; @@ -503,6 +506,7 @@ public: SourceLocation getConstSpecLoc() const { return TQ_constLoc; } SourceLocation getRestrictSpecLoc() const { return TQ_restrictLoc; } SourceLocation getVolatileSpecLoc() const { return TQ_volatileLoc; } + SourceLocation getAtomicSpecLoc() const { return TQ_atomicLoc; } /// \brief Clear out all of the type qualifiers. void ClearTypeQualifiers() { @@ -510,6 +514,7 @@ public: TQ_constLoc = SourceLocation(); TQ_restrictLoc = SourceLocation(); TQ_volatileLoc = SourceLocation(); + TQ_atomicLoc = SourceLocation(); } // function-specifier @@ -1025,8 +1030,8 @@ struct DeclaratorChunk { }; struct PointerTypeInfo : TypeInfoCommon { - /// The type qualifiers: const/volatile/restrict. - unsigned TypeQuals : 3; + /// The type qualifiers: const/volatile/restrict/atomic. + unsigned TypeQuals : 4; /// The location of the const-qualifier, if any. unsigned ConstQualLoc; @@ -1037,6 +1042,9 @@ struct DeclaratorChunk { /// The location of the restrict-qualifier, if any. unsigned RestrictQualLoc; + /// The location of the _Atomic-qualifier, if any. + unsigned AtomicQualLoc; + void destroy() { } }; @@ -1051,8 +1059,8 @@ struct DeclaratorChunk { }; struct ArrayTypeInfo : TypeInfoCommon { - /// The type qualifiers for the array: const/volatile/restrict. - unsigned TypeQuals : 3; + /// The type qualifiers for the array: const/volatile/restrict/_Atomic. + unsigned TypeQuals : 4; /// True if this dimension included the 'static' keyword. bool hasStatic : 1; @@ -1274,16 +1282,16 @@ struct DeclaratorChunk { struct BlockPointerTypeInfo : TypeInfoCommon { /// For now, sema will catch these as invalid. - /// The type qualifiers: const/volatile/restrict. - unsigned TypeQuals : 3; + /// The type qualifiers: const/volatile/restrict/_Atomic. + unsigned TypeQuals : 4; void destroy() { } }; struct MemberPointerTypeInfo : TypeInfoCommon { - /// The type qualifiers: const/volatile/restrict. - unsigned TypeQuals : 3; + /// The type qualifiers: const/volatile/restrict/_Atomic. + unsigned TypeQuals : 4; // CXXScopeSpec has a constructor, so it can't be a direct member. // So we need some pointer-aligned storage and a bit of trickery. union { diff --git a/include/clang/Sema/Sema.h b/include/clang/Sema/Sema.h index 4259bb88ed..049290b5bb 100644 --- a/include/clang/Sema/Sema.h +++ b/include/clang/Sema/Sema.h @@ -936,10 +936,8 @@ public: QualType BuildQualifiedType(QualType T, SourceLocation Loc, Qualifiers Qs, const DeclSpec *DS = 0); - QualType BuildQualifiedType(QualType T, SourceLocation Loc, unsigned CVR, - const DeclSpec *DS = 0) { - return BuildQualifiedType(T, Loc, Qualifiers::fromCVRMask(CVR), DS); - } + QualType BuildQualifiedType(QualType T, SourceLocation Loc, unsigned CVRA, + const DeclSpec *DS = 0); QualType BuildPointerType(QualType T, SourceLocation Loc, DeclarationName Entity); QualType BuildReferenceType(QualType T, bool LValueRef, |