diff options
| author | Fariborz Jahanian <fjahanian@apple.com> | 2009-12-07 18:08:58 +0000 |
|---|---|---|
| committer | Fariborz Jahanian <fjahanian@apple.com> | 2009-12-07 18:08:58 +0000 |
| commit | 1b31c37922c767242f42de177b8f11d593693750 (patch) | |
| tree | 6ba8e20395ebff8cf890bde1118cbe5bb7f6d97b /clang/lib/Sema | |
| parent | c4413fbb8819ebf5fb8be2d3e949828fa758e6cf (diff) | |
| download | bcm5719-llvm-1b31c37922c767242f42de177b8f11d593693750.tar.gz bcm5719-llvm-1b31c37922c767242f42de177b8f11d593693750.zip | |
Patch to allow restrict applied to id/Class types.
(fixes radar 7442244).
llvm-svn: 90773
Diffstat (limited to 'clang/lib/Sema')
| -rw-r--r-- | clang/lib/Sema/SemaType.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp index e79d9ab721b..c52ac753328 100644 --- a/clang/lib/Sema/SemaType.cpp +++ b/clang/lib/Sema/SemaType.cpp @@ -356,10 +356,14 @@ static QualType ConvertDeclSpecToType(Declarator &TheDeclarator, Sema &TheSema){ // or incomplete types shall not be restrict-qualified." C++ also allows // restrict-qualified references. if (TypeQuals & DeclSpec::TQ_restrict) { - if (Result->isPointerType() || Result->isReferenceType()) { - QualType EltTy = Result->isPointerType() ? - Result->getAs<PointerType>()->getPointeeType() : - Result->getAs<ReferenceType>()->getPointeeType(); + if (Result->isAnyPointerType() || Result->isReferenceType()) { + QualType EltTy; + if (Result->isObjCObjectPointerType()) + EltTy = Result; + else + EltTy = Result->isPointerType() ? + Result->getAs<PointerType>()->getPointeeType() : + Result->getAs<ReferenceType>()->getPointeeType(); // If we have a pointer or reference, the pointee must have an object // incomplete type. |

