[cfe-commits] r144355 - in /cfe/trunk: lib/Sema/SemaType.cpp test/Sema/function.c

Eli Friedman eli.friedman at gmail.com
Thu Nov 10 18:00:42 PST 2011


Author: efriedma
Date: Thu Nov 10 20:00:42 2011
New Revision: 144355

URL: http://llvm.org/viewvc/llvm-project?rev=144355&view=rev
Log:
Make sure that restrict-qualifying an array actually adds a restrict qualifier. PR11354.  (operator bool() is evil!)


Modified:
    cfe/trunk/lib/Sema/SemaType.cpp
    cfe/trunk/test/Sema/function.c

Modified: cfe/trunk/lib/Sema/SemaType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=144355&r1=144354&r2=144355&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaType.cpp (original)
+++ cfe/trunk/lib/Sema/SemaType.cpp Thu Nov 10 20:00:42 2011
@@ -2032,8 +2032,7 @@
         ASM = ArrayType::Normal;
         D.setInvalidType(true);
       }
-      T = S.BuildArrayType(T, ASM, ArraySize,
-                           Qualifiers::fromCVRMask(ATI.TypeQuals),
+      T = S.BuildArrayType(T, ASM, ArraySize, ATI.TypeQuals,
                            SourceRange(DeclType.Loc, DeclType.EndLoc), Name);
       break;
     }

Modified: cfe/trunk/test/Sema/function.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/function.c?rev=144355&r1=144354&r2=144355&view=diff
==============================================================================
--- cfe/trunk/test/Sema/function.c (original)
+++ cfe/trunk/test/Sema/function.c Thu Nov 10 20:00:42 2011
@@ -1,7 +1,7 @@
 // RUN: %clang_cc1 %s -fsyntax-only -verify -pedantic
-// PR1892
-void f(double a[restrict][5]);  // should promote to restrict ptr.
-void f(double (* restrict a)[5]);
+
+// PR1892, PR11354
+void f(double a[restrict][5]) { __typeof(a) x = 10; } // expected-warning {{(aka 'double (*restrict)[5]')}}
 
 int foo (__const char *__path);
 int foo(__const char *__restrict __file);





More information about the cfe-commits mailing list