[PATCH] D25866: [Sema] Support implicit scalar to vector conversions

Bruno Cardoso Lopes via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 4 10:15:20 PDT 2017


bruno added inline comments.


================
Comment at: lib/Sema/SemaExpr.cpp:8032
+
+  return InvalidOperands(Loc, LHS, RHS);
+}
----------------
Double checking here: are there tests for the `InvalidOperands` case above?


================
Comment at: lib/Sema/SemaExpr.cpp:8163
+/// type without causing truncation of Scalar.
+static bool tryGCCVectorConvertAndSpalt(Sema &S, ExprResult *Scalar,
+                                        ExprResult *Vector) {
----------------
`Spalt` -> `Splat`


================
Comment at: lib/Sema/SemaExpr.cpp:8188
+  //        type and then perform the rest of the checks here. GCC as of
+  //        pre-release 7.0 does not accept this though.
+  if (VectorEltTy->isIntegralType(S.Context) &&
----------------
Is this something that GCC is going to support at some point? Regardless of GCC, do we want this behavior?


================
Comment at: lib/Sema/SemaExpr.cpp:10019
       isa<ExtVectorType>(vType->getAs<VectorType>()) || getLangOpts().OpenCL;
+  if ((!getLangOpts().CPlusPlus && !getLangOpts().OpenCL) && !isExtVectorType)
+    return InvalidVectorOperands(Loc, LHS, RHS);
----------------
Why `!getLangOpts().CPlusPlus` is a requirement here?


================
Comment at: test/Sema/vector-g++-compat.cpp:1
+// RUN: %clang_cc1 %s -verify -fsyntax-only -Weverything -std=c++11
+
----------------
Can you rename this file to `vector-gcc-compat.cpp` instead?


================
Comment at: test/Sema/vector-g++-compat.cpp:155
+                           unsigned long long d) { // expected-warning {{'long long' is incompatible with C++98}}
+
+  v4f32 v4f32_a = {0.4f, 0.4f, 0.4f, 0.4f};
----------------
Remove all these extra new lines after the function signature here, in the functions below and in the other added test file for c++.


https://reviews.llvm.org/D25866





More information about the cfe-commits mailing list