[cfe-commits] r70104 - in /cfe/trunk: lib/Sema/SemaDeclAttr.cpp test/Sema/attr-cleanup.c

Eli Friedman eli.friedman at gmail.com
Sat Apr 25 18:30:08 PDT 2009


Author: efriedma
Date: Sat Apr 25 20:30:08 2009
New Revision: 70104

URL: http://llvm.org/viewvc/llvm-project?rev=70104&view=rev
Log:
Correct the order of the parameters to CheckAssignmentConstraints in 
cleanup attribute checking.  The difference isn't normally visible, but it
can make a difference...


Modified:
    cfe/trunk/lib/Sema/SemaDeclAttr.cpp
    cfe/trunk/test/Sema/attr-cleanup.c

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

==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Sat Apr 25 20:30:08 2009
@@ -1013,7 +1013,7 @@
   // If this ever proves to be a problem it should be easy to fix.
   QualType Ty = S.Context.getPointerType(VD->getType());
   QualType ParamTy = FD->getParamDecl(0)->getType();
-  if (S.CheckAssignmentConstraints(Ty, ParamTy) != Sema::Compatible) {
+  if (S.CheckAssignmentConstraints(ParamTy, Ty) != Sema::Compatible) {
     S.Diag(Attr.getLoc(), 
            diag::err_attribute_cleanup_func_arg_incompatible_type) <<
       Attr.getParameterName() << ParamTy << Ty;

Modified: cfe/trunk/test/Sema/attr-cleanup.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/attr-cleanup.c?rev=70104&r1=70103&r2=70104&view=diff

==============================================================================
--- cfe/trunk/test/Sema/attr-cleanup.c (original)
+++ cfe/trunk/test/Sema/attr-cleanup.c Sat Apr 25 20:30:08 2009
@@ -31,3 +31,10 @@
     int v1 __attribute__((cleanup(c2))); // expected-error {{'cleanup' function 'c2' must take 1 parameter}}
     int v2 __attribute__((cleanup(c3))); // expected-error {{'cleanup' function 'c3' parameter has type 'struct s' which is incompatible with type 'int *'}}
 }
+
+// This is a manufactured testcase, but gcc accepts it...
+void c4(_Bool a);
+void t4() {
+  __attribute((cleanup(c4))) void* g;
+}
+





More information about the cfe-commits mailing list