[cfe-commits] r59499 - /cfe/trunk/lib/Sema/SemaDeclAttr.cpp

Ted Kremenek kremenek at apple.com
Mon Nov 17 22:52:58 PST 2008


Author: kremenek
Date: Tue Nov 18 00:52:58 2008
New Revision: 59499

URL: http://llvm.org/viewvc/llvm-project?rev=59499&view=rev
Log:
Attribute nonnull can be applied to block pointers.

Modified:
    cfe/trunk/lib/Sema/SemaDeclAttr.cpp

Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=59499&r1=59498&r2=59499&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Tue Nov 18 00:52:58 2008
@@ -341,7 +341,8 @@
     --x;
 
     // Is the function argument a pointer type?
-    if (!getFunctionOrMethodArgType(d, x)->isPointerType()) {
+    QualType T = getFunctionOrMethodArgType(d, x);    
+    if (!T->isPointerType() && !T->isBlockPointerType()) {
       // FIXME: Should also highlight argument in decl.
       S.Diag(Attr.getLoc(), diag::err_nonnull_pointers_only,
              "nonnull", Ex->getSourceRange());
@@ -354,9 +355,11 @@
   // If no arguments were specified to __attribute__((nonnull)) then all
   // pointer arguments have a nonnull attribute.
   if (NonNullArgs.empty()) {
-    for (unsigned I = 0, E = getFunctionOrMethodNumArgs(d); I != E; ++I)
-      if (getFunctionOrMethodArgType(d, I)->isPointerType())
+    for (unsigned I = 0, E = getFunctionOrMethodNumArgs(d); I != E; ++I) {
+      QualType T = getFunctionOrMethodArgType(d, I);
+      if (T->isPointerType() || T->isBlockPointerType())
         NonNullArgs.push_back(I);
+    }
     
     if (NonNullArgs.empty()) {
       S.Diag(Attr.getLoc(), diag::warn_attribute_nonnull_no_pointers);





More information about the cfe-commits mailing list