From 75762ded3bb25b2b3ffcdd94efca1fd25c39582d Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Fri, 6 May 2016 14:34:29 +0000 Subject: [PATCH] Revert r268727, it caused PR27666. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@268736 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/AST/Type.h | 42 +++++---------- include/clang/Basic/AddressSpaces.h | 2 +- include/clang/Basic/Attr.td | 4 ++ include/clang/Sema/DeclSpec.h | 23 +++----- include/clang/Sema/Sema.h | 3 +- lib/AST/MicrosoftMangle.cpp | 5 -- lib/AST/TypePrinter.cpp | 6 --- lib/Parse/ParseDecl.cpp | 15 ++---- lib/Parse/ParseTentative.cpp | 2 +- lib/Sema/DeclSpec.cpp | 6 +-- lib/Sema/SemaCodeComplete.cpp | 3 -- lib/Sema/SemaDecl.cpp | 7 --- lib/Sema/SemaDeclObjC.cpp | 1 - lib/Sema/SemaExpr.cpp | 2 +- lib/Sema/SemaOverload.cpp | 4 -- lib/Sema/SemaType.cpp | 31 +++++------ test/CodeGenCXX/mangle-ms-cxx11.cpp | 16 ------ test/CodeGenCXX/mangle-ms-cxx14.cpp | 5 -- test/Sema/MicrosoftExtensions.c | 8 --- test/Sema/address_spaces.c | 4 +- ...nvalid-assignment-constant-address-space.c | 2 +- test/SemaCXX/MicrosoftExtensions.cpp | 53 +------------------ 22 files changed, 48 insertions(+), 196 deletions(-) diff --git a/include/clang/AST/Type.h b/include/clang/AST/Type.h index 701d57095b..4f64d4cf86 100644 --- a/include/clang/AST/Type.h +++ b/include/clang/AST/Type.h @@ -152,8 +152,8 @@ public: enum { /// The maximum supported address space number. - /// 23 bits should be enough for anyone. - MaxAddressSpace = 0x7fffffu, + /// 24 bits should be enough for anyone. + MaxAddressSpace = 0xffffffu, /// The width of the "fast" qualifier mask. FastWidth = 3, @@ -265,13 +265,6 @@ public: Mask |= mask; } - bool hasUnaligned() const { return Mask & UMask; } - void setUnaligned(bool flag) { - Mask = (Mask & ~UMask) | (flag ? UMask : 0); - } - void removeUnaligned() { Mask &= ~UMask; } - void addUnaligned() { Mask |= UMask; } - bool hasObjCGCAttr() const { return Mask & GCAttrMask; } GC getObjCGCAttr() const { return GC((Mask & GCAttrMask) >> GCAttrShift); } void setObjCGCAttr(GC type) { @@ -440,9 +433,7 @@ public: // ObjC lifetime qualifiers must match exactly. getObjCLifetime() == other.getObjCLifetime() && // CVR qualifiers may subset. - (((Mask & CVRMask) | (other.Mask & CVRMask)) == (Mask & CVRMask)) && - // U qualifier may superset. - (!(other.Mask & UMask) || (Mask & UMask)); + (((Mask & CVRMask) | (other.Mask & CVRMask)) == (Mask & CVRMask)); } /// \brief Determines if these qualifiers compatibly include another set of @@ -510,19 +501,16 @@ public: private: - // bits: |0 1 2|3|4 .. 5|6 .. 8|9 ... 31| - // |C R V|U|GCAttr|Lifetime|AddressSpace| + // bits: |0 1 2|3 .. 4|5 .. 7|8 ... 31| + // |C R V|GCAttr|Lifetime|AddressSpace| uint32_t Mask; - static const uint32_t UMask = 0x8; - static const uint32_t UShift = 3; - static const uint32_t GCAttrMask = 0x30; - static const uint32_t GCAttrShift = 4; - static const uint32_t LifetimeMask = 0x1C0; - static const uint32_t LifetimeShift = 6; - static const uint32_t AddressSpaceMask = - ~(CVRMask | UMask | GCAttrMask | LifetimeMask); - static const uint32_t AddressSpaceShift = 9; + static const uint32_t GCAttrMask = 0x18; + static const uint32_t GCAttrShift = 3; + static const uint32_t LifetimeMask = 0xE0; + static const uint32_t LifetimeShift = 5; + static const uint32_t AddressSpaceMask = ~(CVRMask|GCAttrMask|LifetimeMask); + static const uint32_t AddressSpaceShift = 8; }; /// A std::pair-like structure for storing a qualified type split @@ -5389,13 +5377,7 @@ inline bool QualType::isMoreQualifiedThan(QualType other) const { /// int" is at least as qualified as "const int", "volatile int", /// "int", and "const volatile int". inline bool QualType::isAtLeastAsQualifiedAs(QualType other) const { - Qualifiers otherQuals = other.getQualifiers(); - - // Ignore __unaligned qualifier if this type is a void. - if (getUnqualifiedType()->isVoidType()) - otherQuals.removeUnaligned(); - - return getQualifiers().compatiblyIncludes(otherQuals); + return getQualifiers().compatiblyIncludes(other.getQualifiers()); } /// If Type is a reference type (e.g., const diff --git a/include/clang/Basic/AddressSpaces.h b/include/clang/Basic/AddressSpaces.h index 63df61bedb..8dd75660c6 100644 --- a/include/clang/Basic/AddressSpaces.h +++ b/include/clang/Basic/AddressSpaces.h @@ -25,7 +25,7 @@ namespace LangAS { /// This uses a high starting offset so as not to conflict with any address /// space used by a target. enum ID { - Offset = 0x7FFF00, + Offset = 0xFFFF00, opencl_global = Offset, opencl_local, diff --git a/include/clang/Basic/Attr.td b/include/clang/Basic/Attr.td index 2dea7c73c0..df41aebf45 100644 --- a/include/clang/Basic/Attr.td +++ b/include/clang/Basic/Attr.td @@ -2157,6 +2157,10 @@ def InitSeg : Attr { }]; } +def Unaligned : IgnoredAttr { + let Spellings = [Keyword<"__unaligned">]; +} + def LoopHint : Attr { /// #pragma clang loop