r364165 - PR42362: Fix auto deduction of template parameter packs from

2019-06-23 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Sun Jun 23 22:53:11 2019
New Revision: 364165

URL: http://llvm.org/viewvc/llvm-project?rev=364165=rev
Log:
PR42362: Fix auto deduction of template parameter packs from
type-dependent argument packs.

We need to strip off the PackExpansionExpr to get the real (dependent)
type rather than an opaque DependentTy.

Modified:
cfe/trunk/lib/Sema/SemaTemplate.cpp
cfe/trunk/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp

Modified: cfe/trunk/lib/Sema/SemaTemplate.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplate.cpp?rev=364165=364164=364165=diff
==
--- cfe/trunk/lib/Sema/SemaTemplate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplate.cpp Sun Jun 23 22:53:11 2019
@@ -6323,9 +6323,12 @@ ExprResult Sema::CheckTemplateArgument(N
 // the type is dependent, in order to check the types of non-type template
 // arguments line up properly in partial ordering.
 Optional Depth = Param->getDepth() + 1;
+Expr *DeductionArg = Arg;
+if (auto *PE = dyn_cast(DeductionArg))
+  DeductionArg = PE->getPattern();
 if (DeduceAutoType(
 Context.getTrivialTypeSourceInfo(ParamType, Param->getLocation()),
-Arg, ParamType, Depth) == DAR_Failed) {
+DeductionArg, ParamType, Depth) == DAR_Failed) {
   Diag(Arg->getExprLoc(),
diag::err_non_type_template_parm_type_deduction_failure)
 << Param->getDeclName() << Param->getType() << Arg->getType()

Modified: cfe/trunk/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp?rev=364165=364164=364165=diff
==
--- cfe/trunk/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp (original)
+++ cfe/trunk/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp Sun Jun 23 22:53:11 
2019
@@ -378,3 +378,18 @@ template  struct M {
   }
 };
 }
+
+namespace PR42362 {
+  template struct X { struct Y; void f(int...[A]); };
+  template struct X::Y {};
+  template void X::f(int...[A]) {}
+  void f() { X<1, 2>::Y y; X<1, 2>().f(0, 0); }
+
+  template struct Y;
+  template struct Y {};
+  Y y;
+
+  template struct Z { struct Q; };
+  template struct Z::Q {};
+  Z::Q q;
+}


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D62373: [ASTImporter] Store import errors for Decls

2019-06-23 Thread Aleksei Sidorin via Phabricator via cfe-commits
a_sidorin accepted this revision.
a_sidorin added inline comments.
This revision is now accepted and ready to land.



Comment at: clang/unittests/AST/ASTImporterTest.cpp:4697
+DefaultTestValuesForRunOptions, );
+
 INSTANTIATE_TEST_CASE_P(ParameterizedTests, ASTImporterLookupTableTest,

#undef ERRONEOUSSTMT?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62373/new/

https://reviews.llvm.org/D62373



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r364080 - [OPENMP]Fix PR42068: Vla type is not captured.

2019-06-23 Thread Yvan Roux via cfe-commits
Hi Alexey,

This commit broke ARM bots, logs are availabale here:

http://lab.llvm.org:8011/builders/clang-cmake-armv8-quick/builds/13627/steps/ninja%20check%201/logs/FAIL%3A%20Clang%3A%3Aparallel_codegen.cpp

Thanks,
Yvan

On Fri, 21 Jun 2019 at 19:25, Alexey Bataev via cfe-commits
 wrote:
>
> Author: abataev
> Date: Fri Jun 21 10:28:41 2019
> New Revision: 364080
>
> URL: http://llvm.org/viewvc/llvm-project?rev=364080=rev
> Log:
> [OPENMP]Fix PR42068: Vla type is not captured.
>
> If the variably modified type is declared outside of the captured region
> and then used in the cast expression along with array subscript
> expression, the type is not captured and it leads to the compiler crash.
>
> Modified:
> cfe/trunk/lib/Sema/SemaExpr.cpp
> cfe/trunk/test/OpenMP/parallel_codegen.cpp
>
> Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=364080=364079=364080=diff
> ==
> --- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaExpr.cpp Fri Jun 21 10:28:41 2019
> @@ -4737,6 +4737,33 @@ Sema::CreateBuiltinArraySubscriptExpr(Ex
>assert(VK == VK_RValue || LangOpts.CPlusPlus ||
>   !ResultType.isCForbiddenLValueType());
>
> +  if (LHSExp->IgnoreParenImpCasts()->getType()->isVariablyModifiedType() &&
> +  FunctionScopes.size() > 1) {
> +if (auto *TT =
> +LHSExp->IgnoreParenImpCasts()->getType()->getAs()) {
> +  for (auto I = FunctionScopes.rbegin(),
> +E = std::prev(FunctionScopes.rend());
> +   I != E; ++I) {
> +auto *CSI = dyn_cast(*I);
> +if (CSI == nullptr)
> +  break;
> +DeclContext *DC = nullptr;
> +if (auto *LSI = dyn_cast(CSI))
> +  DC = LSI->CallOperator;
> +else if (auto *CRSI = dyn_cast(CSI))
> +  DC = CRSI->TheCapturedDecl;
> +else if (auto *BSI = dyn_cast(CSI))
> +  DC = BSI->TheDecl;
> +if (DC) {
> +  if (DC->containsDecl(TT->getDecl()))
> +break;
> +  captureVariablyModifiedType(
> +  Context, LHSExp->IgnoreParenImpCasts()->getType(), CSI);
> +}
> +  }
> +}
> +  }
> +
>return new (Context)
>ArraySubscriptExpr(LHSExp, RHSExp, ResultType, VK, OK, RLoc);
>  }
>
> Modified: cfe/trunk/test/OpenMP/parallel_codegen.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/parallel_codegen.cpp?rev=364080=364079=364080=diff
> ==
> --- cfe/trunk/test/OpenMP/parallel_codegen.cpp (original)
> +++ cfe/trunk/test/OpenMP/parallel_codegen.cpp Fri Jun 21 10:28:41 2019
> @@ -15,16 +15,20 @@
>  // CHECK-DEBUG-DAG: %struct.ident_t = type { i32, i32, i32, i32, i8* }
>  // CHECK-DEBUG-DAG: [[STR:@.+]] = private unnamed_addr constant [23 x i8] 
> c";unknown;unknown;0;0;;\00"
>  // CHECK-DEBUG-DAG: [[DEF_LOC_2:@.+]] = private unnamed_addr global 
> %struct.ident_t { i32 0, i32 2, i32 0, i32 0, i8* getelementptr inbounds ([23 
> x i8], [23 x i8]* [[STR]], i32 0, i32 0) }
> -// CHECK-DEBUG-DAG: [[LOC1:@.+]] = private unnamed_addr constant [{{.+}} x 
> i8] c";{{.*}}parallel_codegen.cpp;main;[[@LINE+15]];1;;\00"
> -// CHECK-DEBUG-DAG: [[LOC2:@.+]] = private unnamed_addr constant [{{.+}} x 
> i8] c";{{.*}}parallel_codegen.cpp;tmain;[[@LINE+7]];1;;\00"
> +// CHECK-DEBUG-DAG: [[LOC1:@.+]] = private unnamed_addr constant [{{.+}} x 
> i8] c";{{.*}}parallel_codegen.cpp;main;[[@LINE+19]];1;;\00"
> +// CHECK-DEBUG-DAG: [[LOC2:@.+]] = private unnamed_addr constant [{{.+}} x 
> i8] c";{{.*}}parallel_codegen.cpp;tmain;[[@LINE+8]];1;;\00"
>
>  template 
>  void foo(T argc) {}
>
>  template 
>  int tmain(T argc) {
> +  typedef double (*chunk_t)[argc[0][0]];
>  #pragma omp parallel
> +  {
>foo(argc);
> +  chunk_t var;(void)var[0][0];
> +  }
>return 0;
>  }
>
> @@ -90,7 +94,7 @@ int main (int argc, char **argv) {
>
>  // CHECK:   define linkonce_odr {{[a-z\_\b]*[ ]?i32}} [[TMAIN]](i8** 
> %argc)
>  // CHECK:   store i8** %argc, i8*** [[ARGC_ADDR:%.+]],
> -// CHECK-NEXT:  call {{.*}}void (%struct.ident_t*, i32, void (i32*, i32*, 
> ...)*, ...) @__kmpc_fork_call(%struct.ident_t* [[DEF_LOC_2]], i32 1, void 
> (i32*, i32*, ...)* bitcast (void (i32*, i32*, i8***)* [[OMP_OUTLINED:@.+]] to 
> void (i32*, i32*, ...)*), i8*** [[ARGC_ADDR]])
> +// CHECK:   call {{.*}}void (%struct.ident_t*, i32, void (i32*, i32*, 
> ...)*, ...) @__kmpc_fork_call(%struct.ident_t* [[DEF_LOC_2]], i32 2, void 
> (i32*, i32*, ...)* bitcast (void (i32*, i32*, i8***, i64)* 
> [[OMP_OUTLINED:@.+]] to void (i32*, i32*, ...)*), i8*** [[ARGC_ADDR]], i64 
> %{{.+}})
>  // CHECK-NEXT:  ret i32 0
>  // CHECK-NEXT:  }
>  // CHECK-DEBUG:   define linkonce_odr i32 [[TMAIN]](i8** %argc)
> @@ -101,23 +105,23 @@ int main (int argc, char **argv) {
>  // CHECK-DEBUG-NEXT:  store i8** %argc, 

Re: [PATCH] D63451: P0840R2: support for [[no_unique_address]] attribute

2019-06-23 Thread Yvan Roux via cfe-commits
On Fri, 21 Jun 2019 at 19:38, Richard Smith  wrote:
>
> Thanks, should hopefully be fixed by r364081.

Problem fixed, Thanks richard.

> On Fri, 21 Jun 2019 at 01:12, Yvan Roux via cfe-commits 
>  wrote:
>>
>> Hi Richard,
>>
>> This commit broke ARM bots, logs are available here:
>>
>> http://lab.llvm.org:8011/builders/clang-cmake-armv8-quick/builds/13576/steps/ninja%20check%201/logs/FAIL%3A%20Clang%3A%3Atail-padding.cpp
>>
>> Thanks,
>> Yvan
>>
>> On Thu, 20 Jun 2019 at 23:06, John McCall via Phabricator via
>> llvm-commits  wrote:
>> >
>> > rjmccall added a comment.
>> >
>> > In D63451#1552609 , @rsmith wrote:
>> >
>> > > In D63451#1549563 , @rjmccall 
>> > > wrote:
>> > >
>> > > > Can this attribute not be applied to a base class, or to a type?
>> > >
>> > >
>> > > The standard attribute forbids that right now. We could add a custom 
>> > > attribute that permits it, but we're required to diagnose application of 
>> > > the standard attribute to a type -- though a warning would suffice to 
>> > > satisfy that requirement. (Because this gives "same as a base class" 
>> > > layout, adding it to a base class wouldn't have any effect right now, 
>> > > but we could certainly say that the attribute on a class type also 
>> > > implies the class is not POD for the purpose of layout, to permit tail 
>> > > padding reuse.)
>> >
>> >
>> > I think we're talking about slightly different things.
>> >
>> > You're trying to make sure that fields can take advantage of the layout 
>> > optimizations available to base classes so that library code doesn't need 
>> > to contort to e.g. use the empty-base-class optimization just to avoid 
>> > wasting an entire pointer to store an empty allocator.  This attribute 
>> > seems well-targeted for that.
>> >
>> > Totally separately from that — but perhaps better-related to the name of 
>> > the attribute — I know that some projects have, in the past, had 
>> > surprising problems with the rule that class layout can't place empty base 
>> > classes at the same offset as other objects of the same type.  For 
>> > example, IIRC WebKit used to have a `Noncopyable` class that deleted its 
>> > copy constructor and copy-assignment operators, and there was an idiom to 
>> > inherit from this in order to disable copying, and at one point they 
>> > discovered that some fairly important class was quite a bit larger than 
>> > expected because of this rule — I think they were also using the base 
>> > class redundantly throughout the hierarchy because they didn't expect 
>> > there to be any harm to doing so.  They would've no doubt appreciated the 
>> > ability to just put the attribute on `Noncopyable`.  But of course they 
>> > fixed that years ago, so I can't say that it's a serious issue for them 
>> > now.
>> >
>> >
>> > Repository:
>> >   rL LLVM
>> >
>> > CHANGES SINCE LAST ACTION
>> >   https://reviews.llvm.org/D63451/new/
>> >
>> > https://reviews.llvm.org/D63451
>> >
>> >
>> >
>> > ___
>> > llvm-commits mailing list
>> > llvm-comm...@lists.llvm.org
>> > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>> ___
>> cfe-commits mailing list
>> cfe-commits@lists.llvm.org
>> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D63697: clang-format: Fix error return when using inplace with stdin

2019-06-23 Thread William Woodruff via Phabricator via cfe-commits
woodruffw created this revision.
woodruffw added reviewers: clang, thakis.
woodruffw added a project: clang.
Herald added a subscriber: cfe-commits.

Causes clang-format to exit with an appropriate error code
when the invalid combination of -i and stdin is provided.


Repository:
  rC Clang

https://reviews.llvm.org/D63697

Files:
  tools/clang-format/ClangFormat.cpp


Index: tools/clang-format/ClangFormat.cpp
===
--- tools/clang-format/ClangFormat.cpp
+++ tools/clang-format/ClangFormat.cpp
@@ -243,7 +243,7 @@
 static bool format(StringRef FileName) {
   if (!OutputXML && Inplace && FileName == "-") {
 errs() << "error: cannot use -i when reading from stdin.\n";
-return false;
+return true;
   }
   // On Windows, overwriting a file with an open file mapping doesn't work,
   // so read the whole file into memory when formatting in-place.


Index: tools/clang-format/ClangFormat.cpp
===
--- tools/clang-format/ClangFormat.cpp
+++ tools/clang-format/ClangFormat.cpp
@@ -243,7 +243,7 @@
 static bool format(StringRef FileName) {
   if (!OutputXML && Inplace && FileName == "-") {
 errs() << "error: cannot use -i when reading from stdin.\n";
-return false;
+return true;
   }
   // On Windows, overwriting a file with an open file mapping doesn't work,
   // so read the whole file into memory when formatting in-place.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D62738: [HIP] Support device_shadow variable

2019-06-23 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl marked an inline comment as done.
yaxunl added inline comments.



Comment at: lib/CodeGen/CodeGenModule.cpp:3775
+  // left undefined.
+  bool IsHIPDeviceShadowVar = getLangOpts().HIP && getLangOpts().CUDAIsDevice 
&&
+  D->hasAttr();

tra wrote:
> `IsDeviceShadowVar`. We may want to rename `IsCUDAShadowVar` to 
> `IsHostShadowVar` to be consistent.
> 
> This got me thinking. Conceptually we have two different things going on here.
> * where do we place the real variable
> * whether we need to create a shadow on the other end.
> 
> Currently `__device__`, `__constant__` and `__shared__` act as both.
> This patch implements the same `make a shadow on the other side`, only in the 
> opposite direction.
> 
> Perhaps the right thing to do is to push the patch even further and make it 
> into a `__shadow_variable__` which will be responsible for creating the other 
> side shadow and would work in both directions.
> 
> We can then assign implicit `__shadow_variable__` attribute to the 
> device-side vars to preserve current behavior and it will work for your 
> purposes two. We will also gain ability to create device-side variables w/o 
> host-side shadows, if we need to.
> 
> I guess in the end it would be this patch + a bit of refactoring/collapsing 
> of `IsCUDAShadowVar` logic.
Do we really want to introduce a generic `__shadow_variable__` for device 
variables? It has little use but complicates AST of device variables 
unnecessarily. First it bring no new functionality since device variables are 
already shadowed by default. Second since unused shadow variable is eliminated 
automatically due to their internal linkage, disable shadowing will not save 
memory in host binary.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62738/new/

https://reviews.llvm.org/D62738



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D62375: [ASTImporter] Mark erroneous nodes in from ctx

2019-06-23 Thread Aleksei Sidorin via Phabricator via cfe-commits
a_sidorin accepted this revision.
a_sidorin added a comment.
This revision is now accepted and ready to land.

Thanks!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62375/new/

https://reviews.llvm.org/D62375



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D49466: Initial implementation of -fmacro-prefix-map and -ffile-prefix-map

2019-06-23 Thread Peter Wu via Phabricator via cfe-commits
Lekensteyn added a comment.

Hi @dankm, any progress on this feature? The proposed branch off date for Clang 
9.0.0 is 18 July 2019: 
https://lists.llvm.org/pipermail/cfe-dev/2019-June/062628.html


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D49466/new/

https://reviews.llvm.org/D49466



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D61838: [Sema] Suppress additional warnings for C's zero initializer

2019-06-23 Thread Peter Wu via Phabricator via cfe-commits
Lekensteyn added a comment.

@rsmith The latest patch version has addressed your feedback, can you confirm 
that this is ready to be merged?


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61838/new/

https://reviews.llvm.org/D61838



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r364157 - Fix test for 32-bit targets.

2019-06-23 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Sun Jun 23 10:42:18 2019
New Revision: 364157

URL: http://llvm.org/viewvc/llvm-project?rev=364157=rev
Log:
Fix test for 32-bit targets.

Modified:
cfe/trunk/test/CodeGenCXX/tail-padding.cpp

Modified: cfe/trunk/test/CodeGenCXX/tail-padding.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/tail-padding.cpp?rev=364157=364156=364157=diff
==
--- cfe/trunk/test/CodeGenCXX/tail-padding.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/tail-padding.cpp Sun Jun 23 10:42:18 2019
@@ -47,14 +47,14 @@ namespace NoUniqueAddr {
   // CHECK: call {{.*}} @_ZN12NoUniqueAddr1AC2ERKS0_(
   // CHECK: store i32 {{.*}} @_ZTVN12NoUniqueAddr1CE
   // Copy the full size of B.
-  // CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* {{.*}}, i8* {{.*}}, i64 
8, i1 false)
+  // CHECK: call void @llvm.memcpy.p0i8.p0i8.i{{32|64}}(i8* {{.*}}, i8* 
{{.*}}, i{{32|64}} 8, i1 false)
   C f(C c) { return c; }
 
   // CHECK: define {{.*}} @_ZN12NoUniqueAddr1DC1EOS0_
   // CHECK: call {{.*}} @_ZN12NoUniqueAddr1AC2ERKS0_(
   // CHECK: store i32 {{.*}} @_ZTVN12NoUniqueAddr1DE
   // Copy just the data size of B, to avoid overwriting the A base class.
-  // CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* {{.*}}, i8* {{.*}}, i64 
7, i1 false)
+  // CHECK: call void @llvm.memcpy.p0i8.p0i8.i{{32|64}}(i8* {{.*}}, i8* 
{{.*}}, i{{32|64}} 7, i1 false)
   D f(D d) { return d; }
 
   // CHECK: define {{.*}} @_ZN12NoUniqueAddr1EC1EOS0_
@@ -62,7 +62,7 @@ namespace NoUniqueAddr {
   // CHECK: store i32 {{.*}} @_ZTVN12NoUniqueAddr1EE
   // We can copy the full size of B here. (As it happens, we fold the copy of 
'x' into
   // this memcpy, so we're copying 8 bytes either way.)
-  // CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* {{.*}}, i8* {{.*}}, i64 
8, i1 false)
+  // CHECK: call void @llvm.memcpy.p0i8.p0i8.i{{32|64}}(i8* {{.*}}, i8* 
{{.*}}, i{{32|64}} 8, i1 false)
   E f(E e) { return e; }
 
   struct F : virtual A {
@@ -73,6 +73,6 @@ namespace NoUniqueAddr {
   // CHECK: define {{.*}} @_ZN12NoUniqueAddr1FC1ERKS0_
   // CHECK: call {{.*}} @_ZN12NoUniqueAddr1AC2ERKS0_(
   // CHECK: store i32 {{.*}} @_ZTVN12NoUniqueAddr1FE
-  // CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* {{.*}}, i8* {{.*}}, i64 
7, i1 false)
+  // CHECK: call void @llvm.memcpy.p0i8.p0i8.i{{32|64}}(i8* {{.*}}, i8* 
{{.*}}, i{{32|64}} 7, i1 false)
   F f(F x) { return x; }
 }


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D35388: [libc++] Give extern templates default visibility on gcc

2019-06-23 Thread Nico Weber via Phabricator via cfe-commits
thakis added a comment.
Herald added a subscriber: dexonsmith.

> I would think that both this change and https://reviews.llvm.org/D35326 are 
> good.

What's the status here and in D35326 ? We 
still have a workaround in chromium's build files pointing at these two changes.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D35388/new/

https://reviews.llvm.org/D35388



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits