[cfe-commits] r90773 - in /cfe/trunk: lib/Sema/SemaType.cpp test/SemaObjC/restrict-id-type.m
Fariborz Jahanian
fjahanian at apple.com
Mon Dec 7 10:08:58 PST 2009
Author: fjahanian
Date: Mon Dec 7 12:08:58 2009
New Revision: 90773
URL: http://llvm.org/viewvc/llvm-project?rev=90773&view=rev
Log:
Patch to allow restrict applied to id/Class types.
(fixes radar 7442244).
Added:
cfe/trunk/test/SemaObjC/restrict-id-type.m
Modified:
cfe/trunk/lib/Sema/SemaType.cpp
Modified: cfe/trunk/lib/Sema/SemaType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=90773&r1=90772&r2=90773&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaType.cpp (original)
+++ cfe/trunk/lib/Sema/SemaType.cpp Mon Dec 7 12:08:58 2009
@@ -356,10 +356,14 @@
// 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.
Added: cfe/trunk/test/SemaObjC/restrict-id-type.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/restrict-id-type.m?rev=90773&view=auto
==============================================================================
--- cfe/trunk/test/SemaObjC/restrict-id-type.m (added)
+++ cfe/trunk/test/SemaObjC/restrict-id-type.m Mon Dec 7 12:08:58 2009
@@ -0,0 +1,9 @@
+// RUN: clang-cc -std=gnu99 -fsyntax-only -verify %s
+
+void f0(restrict id a0) {}
+
+void f1(restrict id *a0) {}
+
+void f2(restrict Class a0) {}
+
+void f3(restrict Class *a0) {}
More information about the cfe-commits
mailing list