<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Jun 15, 2013 at 2:20 PM, Renato Golin <span dir="ltr"><<a href="mailto:renato.golin@linaro.org" target="_blank">renato.golin@linaro.org</a>></span> wrote:<br>



<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">Hi Larisse,<div><br></div><div>Seems this commit broke lots of buildbots... ;)</div>


</div></blockquote><div>
<br></div><div>Yeah. That's weird. I am not exactly sure how the specific changes I made could cause that kind of damage, especially when I successfully ran all the regression tests before commiting...</div><div>I was informed that buildbots haven't been the most reliable lately(?) However, I'm still not quite sure how to tell "flakes" from non-"flakes". Any idea?</div>

<div style>I just noticed that a couple of the failures have to do with a test case's expected warning message not matching some architecture-specific data. I have fixed the test case in question, and did some code-base resetting (directly mirroring the repository) over here. Hopefully that will fix at least a few of these...</div>


<div><br></div><div style>Thanks,</div><div style>-- Larisse.</div><div style><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">


<div dir="ltr"><div><br></div><div>cheers,</div><div>-renato</div></div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">
On 15 June 2013 21:17, Larisse Voufo <span dir="ltr"><<a href="mailto:lvoufo@google.com" target="_blank">lvoufo@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">




Author: lvoufo<br>
Date: Sat Jun 15 15:17:46 2013<br>
New Revision: 184048<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=184048&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=184048&view=rev</a><br>
Log:<br>
Updated the support for contextual conversion tweaks (n3323) with a previously overlooked part: implicitly converting array sizes to size_t, rather than contextually converting them to some unique type.<br>
<br>
Modified:<br>
    cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td<br>
    cfe/trunk/include/clang/Sema/Sema.h<br>
    cfe/trunk/lib/Sema/SemaExprCXX.cpp<br>
    cfe/trunk/test/SemaCXX/cxx98-compat-pedantic.cpp<br>
<br>
Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=184048&r1=184047&r2=184048&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=184048&r1=184047&r2=184048&view=diff</a><br>





==============================================================================<br>
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)<br>
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Sat Jun 15 15:17:46 2013<br>
@@ -36,15 +36,15 @@ def err_typecheck_converted_constant_exp<br>
 def err_typecheck_converted_constant_expression_disallowed : Error<<br>
   "conversion from %0 to %1 is not allowed in a converted constant expression">;<br>
 def err_expr_not_cce : Error<<br>
-  "%select{case value|enumerator value|non-type template argument}0 "<br>
+  "%select{case value|enumerator value|non-type template argument|array size}0 "<br>
   "is not a constant expression">;<br>
 def err_cce_narrowing : ExtWarn<<br>
-  "%select{case value|enumerator value|non-type template argument}0 "<br>
+  "%select{case value|enumerator value|non-type template argument|array size}0 "<br>
   "%select{cannot be narrowed from type %2 to %3|"<br>
   "evaluates to %2, which cannot be narrowed to type %3}1">,<br>
   InGroup<CXX11Narrowing>, DefaultError;<br>
 def err_cce_narrowing_sfinae : Error<<br>
-  "%select{case value|enumerator value|non-type template argument}0 "<br>
+  "%select{case value|enumerator value|non-type template argument|array size}0 "<br>
   "%select{cannot be narrowed from type %2 to %3|"<br>
   "evaluates to %2, which cannot be narrowed to type %3}1">;<br>
 def err_ice_not_integral : Error<<br>
<br>
Modified: cfe/trunk/include/clang/Sema/Sema.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=184048&r1=184047&r2=184048&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=184048&r1=184047&r2=184048&view=diff</a><br>





==============================================================================<br>
--- cfe/trunk/include/clang/Sema/Sema.h (original)<br>
+++ cfe/trunk/include/clang/Sema/Sema.h Sat Jun 15 15:17:46 2013<br>
@@ -1938,9 +1938,10 @@ public:<br>
<br>
   /// Contexts in which a converted constant expression is required.<br>
   enum CCEKind {<br>
-    CCEK_CaseValue,  ///< Expression in a case label.<br>
-    CCEK_Enumerator, ///< Enumerator value with fixed underlying type.<br>
-    CCEK_TemplateArg ///< Value of a non-type template parameter.<br>
+    CCEK_CaseValue,   ///< Expression in a case label.<br>
+    CCEK_Enumerator,  ///< Enumerator value with fixed underlying type.<br>
+    CCEK_TemplateArg, ///< Value of a non-type template parameter.<br>
+    CCEK_NewExpr      ///< Constant expression in a noptr-new-declarator.<br>
   };<br>
   ExprResult CheckConvertedConstantExpression(Expr *From, QualType T,<br>
                                               llvm::APSInt &Value, CCEKind CCE);<br>
<br>
Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=184048&r1=184047&r2=184048&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=184048&r1=184047&r2=184048&view=diff</a><br>





==============================================================================<br>
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)<br>
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Sat Jun 15 15:17:46 2013<br>
@@ -1017,10 +1017,23 @@ Sema::ActOnCXXNew(SourceLocation StartLo<br>
       DeclaratorChunk::ArrayTypeInfo &Array = D.getTypeObject(I).Arr;<br>
       if (Expr *NumElts = (Expr *)Array.NumElts) {<br>
         if (!NumElts->isTypeDependent() && !NumElts->isValueDependent()) {<br>
-          Array.NumElts<br>
-            = VerifyIntegerConstantExpression(NumElts, 0,<br>
-                                              diag::err_new_array_nonconst)<br>
-                .take();<br>
+          if (getLangOpts().CPlusPlus1y) {<br>
+           // C++1y [expr.new]p6: Every constant-expression in a noptr-new-declarator<br>
+           //   shall be a converted constant expression (5.19) of type std::size_t<br>
+           //   and shall evaluate to a strictly positive value.<br>
+            unsigned IntWidth = Context.getTargetInfo().getIntWidth();<br>
+            assert(IntWidth && "Builtin type of size 0?");<br>
+            llvm::APSInt Value(IntWidth);<br>
+            Array.NumElts<br>
+             = CheckConvertedConstantExpression(NumElts, Context.getSizeType(), Value,<br>
+                                                CCEK_NewExpr)<br>
+                 .take();<br>
+          } else {<br>
+            Array.NumElts<br>
+              = VerifyIntegerConstantExpression(NumElts, 0,<br>
+                                                diag::err_new_array_nonconst)<br>
+                  .take();<br>
+          }<br>
           if (!Array.NumElts)<br>
             return ExprError();<br>
         }<br>
@@ -1183,65 +1196,81 @@ Sema::BuildCXXNew(SourceRange Range, boo<br>
   // C++1y [expr.new]p6: The expression [...] is implicitly converted to<br>
   //   std::size_t. (FIXME)<br>
   if (ArraySize && !ArraySize->isTypeDependent()) {<br>
-    class SizeConvertDiagnoser : public ICEConvertDiagnoser {<br>
-      Expr *ArraySize;<br>
-<br>
-    public:<br>
-      SizeConvertDiagnoser(Expr *ArraySize)<br>
-          : ICEConvertDiagnoser(/*AllowScopedEnumerations*/false, false, false),<br>
-            ArraySize(ArraySize) {}<br>
-<br>
-      virtual SemaDiagnosticBuilder diagnoseNotInt(Sema &S, SourceLocation Loc,<br>
-                                                   QualType T) {<br>
-        return S.Diag(Loc, diag::err_array_size_not_integral)<br>
-                 << S.getLangOpts().CPlusPlus11 << T;<br>
-      }<br>
-<br>
-      virtual SemaDiagnosticBuilder diagnoseIncomplete(<br>
-          Sema &S, SourceLocation Loc, QualType T) {<br>
-        return S.Diag(Loc, diag::err_array_size_incomplete_type)<br>
-                 << T << ArraySize->getSourceRange();<br>
-      }<br>
-<br>
-      virtual SemaDiagnosticBuilder diagnoseExplicitConv(<br>
-          Sema &S, SourceLocation Loc, QualType T, QualType ConvTy) {<br>
-        return S.Diag(Loc, diag::err_array_size_explicit_conversion) << T << ConvTy;<br>
-      }<br>
-<br>
-      virtual SemaDiagnosticBuilder noteExplicitConv(<br>
-          Sema &S, CXXConversionDecl *Conv, QualType ConvTy) {<br>
-        return S.Diag(Conv->getLocation(), diag::note_array_size_conversion)<br>
-                 << ConvTy->isEnumeralType() << ConvTy;<br>
-      }<br>
-<br>
-      virtual SemaDiagnosticBuilder diagnoseAmbiguous(<br>
-          Sema &S, SourceLocation Loc, QualType T) {<br>
-        return S.Diag(Loc, diag::err_array_size_ambiguous_conversion) << T;<br>
-      }<br>
-<br>
-      virtual SemaDiagnosticBuilder noteAmbiguous(<br>
-          Sema &S, CXXConversionDecl *Conv, QualType ConvTy) {<br>
-        return S.Diag(Conv->getLocation(), diag::note_array_size_conversion)<br>
-                 << ConvTy->isEnumeralType() << ConvTy;<br>
-      }<br>
+    ExprResult ConvertedSize;<br>
+    if (getLangOpts().CPlusPlus1y) {<br>
+      unsigned IntWidth = Context.getTargetInfo().getIntWidth();<br>
+      assert(IntWidth && "Builtin type of size 0?");<br>
+      llvm::APSInt Value(IntWidth);<br>
+      ConvertedSize = PerformImplicitConversion(ArraySize, Context.getSizeType(),<br>
+                                               AA_Converting);<br>
+<br>
+      if (!isSFINAEContext())<br>
+       // Diagnose the compatibility of this conversion.<br>
+       Diag(StartLoc, diag::warn_cxx98_compat_array_size_conversion)<br>
+         << ArraySize->getType() << 0 << Context.getSizeType();<br>
+    } else {<br>
+      class SizeConvertDiagnoser : public ICEConvertDiagnoser {<br>
+      protected:<br>
+        Expr *ArraySize;<br>
+<br>
+      public:<br>
+        SizeConvertDiagnoser(Expr *ArraySize)<br>
+            : ICEConvertDiagnoser(/*AllowScopedEnumerations*/false, false, false),<br>
+              ArraySize(ArraySize) {}<br>
+<br>
+        virtual SemaDiagnosticBuilder diagnoseNotInt(Sema &S, SourceLocation Loc,<br>
+                                                     QualType T) {<br>
+          return S.Diag(Loc, diag::err_array_size_not_integral)<br>
+                   << S.getLangOpts().CPlusPlus11 << T;<br>
+        }<br>
+<br>
+        virtual SemaDiagnosticBuilder diagnoseIncomplete(<br>
+            Sema &S, SourceLocation Loc, QualType T) {<br>
+          return S.Diag(Loc, diag::err_array_size_incomplete_type)<br>
+                   << T << ArraySize->getSourceRange();<br>
+        }<br>
+<br>
+        virtual SemaDiagnosticBuilder diagnoseExplicitConv(<br>
+            Sema &S, SourceLocation Loc, QualType T, QualType ConvTy) {<br>
+          return S.Diag(Loc, diag::err_array_size_explicit_conversion) << T << ConvTy;<br>
+        }<br>
+<br>
+        virtual SemaDiagnosticBuilder noteExplicitConv(<br>
+            Sema &S, CXXConversionDecl *Conv, QualType ConvTy) {<br>
+          return S.Diag(Conv->getLocation(), diag::note_array_size_conversion)<br>
+                   << ConvTy->isEnumeralType() << ConvTy;<br>
+        }<br>
+<br>
+        virtual SemaDiagnosticBuilder diagnoseAmbiguous(<br>
+            Sema &S, SourceLocation Loc, QualType T) {<br>
+          return S.Diag(Loc, diag::err_array_size_ambiguous_conversion) << T;<br>
+        }<br>
+<br>
+        virtual SemaDiagnosticBuilder noteAmbiguous(<br>
+            Sema &S, CXXConversionDecl *Conv, QualType ConvTy) {<br>
+          return S.Diag(Conv->getLocation(), diag::note_array_size_conversion)<br>
+                   << ConvTy->isEnumeralType() << ConvTy;<br>
+        }<br>
<br>
-      virtual SemaDiagnosticBuilder diagnoseConversion(<br>
-          Sema &S, SourceLocation Loc, QualType T, QualType ConvTy) {<br>
-        return S.Diag(Loc,<br>
-                      S.getLangOpts().CPlusPlus11<br>
-                        ? diag::warn_cxx98_compat_array_size_conversion<br>
-                        : diag::ext_array_size_conversion)<br>
-                 << T << ConvTy->isEnumeralType() << ConvTy;<br>
-      }<br>
-    } SizeDiagnoser(ArraySize);<br>
+        virtual SemaDiagnosticBuilder diagnoseConversion(<br>
+            Sema &S, SourceLocation Loc, QualType T, QualType ConvTy) {<br>
+          return S.Diag(Loc,<br>
+                        S.getLangOpts().CPlusPlus11<br>
+                          ? diag::warn_cxx98_compat_array_size_conversion<br>
+                          : diag::ext_array_size_conversion)<br>
+                   << T << ConvTy->isEnumeralType() << ConvTy;<br>
+        }<br>
+      } SizeDiagnoser(ArraySize);<br>
<br>
-    ExprResult ConvertedSize<br>
-      = PerformContextualImplicitConversion(StartLoc, ArraySize, SizeDiagnoser);<br>
+      ConvertedSize = PerformContextualImplicitConversion(StartLoc, ArraySize,<br>
+                                                          SizeDiagnoser);<br>
+    }<br>
     if (ConvertedSize.isInvalid())<br>
       return ExprError();<br>
<br>
     ArraySize = ConvertedSize.take();<br>
     QualType SizeType = ArraySize->getType();<br>
+<br>
     if (!SizeType->isIntegralOrUnscopedEnumerationType())<br>
       return ExprError();<br>
<br>
<br>
Modified: cfe/trunk/test/SemaCXX/cxx98-compat-pedantic.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/cxx98-compat-pedantic.cpp?rev=184048&r1=184047&r2=184048&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/cxx98-compat-pedantic.cpp?rev=184048&r1=184047&r2=184048&view=diff</a><br>





==============================================================================<br>
--- cfe/trunk/test/SemaCXX/cxx98-compat-pedantic.cpp (original)<br>
+++ cfe/trunk/test/SemaCXX/cxx98-compat-pedantic.cpp Sat Jun 15 15:17:46 2013<br>
@@ -1,10 +1,10 @@<br>
-// RUN: %clang_cc1 -fsyntax-only -std=c++1y -DCXX1Y -Wc++98-compat-pedantic -verify %s<br>
-// RUN: %clang_cc1 -fsyntax-only -std=c++1y -DCXX1Y -Wc++98-compat -Werror %s<br>
+// RUN: %clang_cc1 -fsyntax-only -std=c++1y -DCXX1Y -Wc++98-compat-pedantic -verify %s -DCXX1Y2<br>
+// RUN: %clang_cc1 -fsyntax-only -std=c++1y -DCXX1Y -Wc++98-compat -Werror %s -DCXX1Y2<br>
 // RUN: %clang_cc1 -fsyntax-only -std=c++11 -Wc++98-compat-pedantic -verify %s<br>
 // RUN: %clang_cc1 -fsyntax-only -std=c++11 -Wc++98-compat -Werror %s<br>
 // RUN: %clang_cc1 -fsyntax-only -std=c++98 -Werror %s<br>
<br>
-// RUN: %clang_cc1 -fsyntax-only -std=c++1y -Wc++98-compat-pedantic -verify %s -Wno-c++98-c++11-compat-pedantic<br>
+// RUN: %clang_cc1 -fsyntax-only -std=c++1y -Wc++98-compat-pedantic -verify %s -Wno-c++98-c++11-compat-pedantic -DCXX1Y2<br>
<br>
 // -Wc++98-compat-pedantic warns on C++11 features which we accept without a<br>
 // warning in C++98 mode.<br>
@@ -32,7 +32,12 @@ void *FnVoidPtr = (void*)&dlsym; // expe<br>
 struct ConvertToInt {<br>
   operator int();<br>
 };<br>
-int *ArraySizeConversion = new int[ConvertToInt()]; // expected-warning {{implicit conversion from array size expression of type 'ConvertToInt' to integral type 'int' is incompatible with C++98}}<br>
+int *ArraySizeConversion = new int[ConvertToInt()];<br>
+#ifdef CXX1Y2<br>
+// expected-warning@-2 {{implicit conversion from array size expression of type 'ConvertToInt' to integral type 'unsigned long' is incompatible with C++98}}<br>
+#else<br>
+// expected-warning@-4 {{implicit conversion from array size expression of type 'ConvertToInt' to integral type 'int' is incompatible with C++98}}<br>
+#endif<br>
<br>
 template<typename T> class ExternTemplate {};<br>
 extern template class ExternTemplate<int>; // expected-warning {{extern templates are incompatible with C++98}}<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu" target="_blank">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div></div>