[llvm-branch-commits] [clang] [clang] add fallback to expr in the template differ when comparing ValueDecl (PR #93266)

2024-05-24 Thread Erich Keane via llvm-branch-commits

https://github.com/erichkeane approved this pull request.

Fine other than the release note not being clear enough

https://github.com/llvm/llvm-project/pull/93266
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] [clang] add fallback to expr in the template differ when comparing ValueDecl (PR #93266)

2024-05-24 Thread Erich Keane via llvm-branch-commits


@@ -784,6 +784,7 @@ Miscellaneous Bug Fixes
 - Fixed an infinite recursion in ASTImporter, on return type declared inside
   body of C++11 lambda without trailing return (#GH68775).
 - Fixed declaration name source location of instantiated function definitions 
(GH71161).
+- Missing fallback to expression in the template differ when comparing 
ValueDecls.

erichkeane wrote:

```suggestion
- Improve diagnostic output to print an expression instead of 'no argument` 
when comparing Values as template arguments.
```

Or something like this?

https://github.com/llvm/llvm-project/pull/93266
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] [clang-tools-extra] [clang] NFCI: use TemplateArgumentLoc for type-param DefaultArgument (PR #92854)

2024-05-21 Thread Erich Keane via llvm-branch-commits

https://github.com/erichkeane approved this pull request.

I don't quite get the justification for this, but also don't see any downside 
for it, so I think this is acceptable.

https://github.com/llvm/llvm-project/pull/92854
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] [clang] Implement CWG2398 provisional TTP matching to class templates (PR #92855)

2024-05-21 Thread Erich Keane via llvm-branch-commits

https://github.com/erichkeane approved this pull request.

Seems reasonable, lgtm.

https://github.com/llvm/llvm-project/pull/92855
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] release/18.x: [Clang][Sema] Revise the transformation of CTAD parameters of nested class templates (#91628) (PR #91890)

2024-05-13 Thread Erich Keane via llvm-branch-commits

https://github.com/erichkeane approved this pull request.

This seems useful enough with little enough impact to add to the release 
branch.  If we've got another one coming, I see no reason not to.

https://github.com/llvm/llvm-project/pull/91890
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] [clang] CTAD alias: fix the transformation for the require-clause expr (PR #90961)

2024-05-03 Thread Erich Keane via llvm-branch-commits

https://github.com/erichkeane approved this pull request.

I think this makes sense, 2 nits, else LGTM.

https://github.com/llvm/llvm-project/pull/90961
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] [clang] CTAD alias: fix the transformation for the require-clause expr (PR #90961)

2024-05-03 Thread Erich Keane via llvm-branch-commits


@@ -2744,31 +2744,155 @@ bool hasDeclaredDeductionGuides(DeclarationName Name, 
DeclContext *DC) {
   return false;
 }
 
+unsigned getTemplateDepth(NamedDecl *TemplateParam) {
+  if (auto *TTP = dyn_cast(TemplateParam))
+return TTP->getDepth();
+  if (auto *TTP = dyn_cast(TemplateParam))
+return TTP->getDepth();
+  if (auto *NTTP = dyn_cast(TemplateParam))
+return NTTP->getDepth();
+  llvm_unreachable("Unhandled template parameter types");
+}
+
 NamedDecl *transformTemplateParameter(Sema , DeclContext *DC,
   NamedDecl *TemplateParam,
   MultiLevelTemplateArgumentList ,
-  unsigned NewIndex) {
+  unsigned NewIndex, unsigned NewDepth) {
   if (auto *TTP = dyn_cast(TemplateParam))
-return transformTemplateTypeParam(SemaRef, DC, TTP, Args, TTP->getDepth(),
+return transformTemplateTypeParam(SemaRef, DC, TTP, Args, NewDepth,
   NewIndex);
   if (auto *TTP = dyn_cast(TemplateParam))
 return transformTemplateParam(SemaRef, DC, TTP, Args, NewIndex,
-  TTP->getDepth());
+  NewDepth);
   if (auto *NTTP = dyn_cast(TemplateParam))
 return transformTemplateParam(SemaRef, DC, NTTP, Args, NewIndex,
-  NTTP->getDepth());
+  NewDepth);
   llvm_unreachable("Unhandled template parameter types");
 }
 
-Expr *transformRequireClause(Sema , FunctionTemplateDecl *FTD,
- llvm::ArrayRef TransformedArgs) 
{
-  Expr *RC = FTD->getTemplateParameters()->getRequiresClause();
+// Transform the require-clause of F if any.
+// The return result is expected to be the require-clause for the synthesized
+// alias deduction guide.
+Expr *transformRequireClause(

erichkeane wrote:

Same question/etc here.

https://github.com/llvm/llvm-project/pull/90961
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] [clang] CTAD alias: fix the transformation for the require-clause expr (PR #90961)

2024-05-03 Thread Erich Keane via llvm-branch-commits


@@ -2744,31 +2744,155 @@ bool hasDeclaredDeductionGuides(DeclarationName Name, 
DeclContext *DC) {
   return false;
 }
 
+unsigned getTemplateDepth(NamedDecl *TemplateParam) {

erichkeane wrote:

are we in an anonymous namespace?  Else this should be 'static'.

https://github.com/llvm/llvm-project/pull/90961
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] [clang] CTAD alias: fix the transformation for the require-clause expr (PR #90961)

2024-05-03 Thread Erich Keane via llvm-branch-commits

https://github.com/erichkeane edited 
https://github.com/llvm/llvm-project/pull/90961
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] [CIR] Add options to emit ClangIR and enable the ClangIR pipeline (PR #89030)

2024-04-29 Thread Erich Keane via llvm-branch-commits

https://github.com/erichkeane approved this pull request.


https://github.com/llvm/llvm-project/pull/89030
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] [CIR] Add options to emit ClangIR and enable the ClangIR pipeline (PR #89030)

2024-04-25 Thread Erich Keane via llvm-branch-commits


@@ -2876,6 +2876,15 @@ def flax_vector_conversions : Flag<["-"], 
"flax-vector-conversions">, Group, Group,
   HelpText<"Force linking the clang builtins runtime library">;
+
+/// ClangIR-specific options - BEGIN
+def fclangir_enable : Flag<["-"], "fclangir-enable">, Visibility<[ClangOption, 
CC1Option]>,
+  Group, HelpText<"Use ClangIR pipeline to compile">,
+  MarshallingInfoFlag>;
+def emit_cir : Flag<["-"], "emit-cir">, Visibility<[ClangOption, CC1Option]>,

erichkeane wrote:

IMO, there is no good reason for `-emit-llvm` to be a driver option, other than 
for historical reasons.  That is, if we were putting it in today, we'd probably 
not expose it that way.  Because of that, I'd like to not repeat that mistake 
with `emit-cir`.

https://github.com/llvm/llvm-project/pull/89030
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] [CIR][NFC] Add scaffolding for the CIR dialect and CIROps.td (PR #86080)

2024-04-17 Thread Erich Keane via llvm-branch-commits

https://github.com/erichkeane approved this pull request.


https://github.com/llvm/llvm-project/pull/86080
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] [CIR][NFC] Add scaffolding for the CIR dialect and CIROps.td (PR #86080)

2024-04-17 Thread Erich Keane via llvm-branch-commits




erichkeane wrote:

I see this is irrelevant now, but noticed I had a pair of pending comments and 
wanted the other one.

https://github.com/llvm/llvm-project/pull/86080
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] [CIR][NFC] Add scaffolding for the CIR dialect and CIROps.td (PR #86080)

2024-04-17 Thread Erich Keane via llvm-branch-commits


@@ -0,0 +1,11 @@
+//===- CIRDialect.cpp - MLIR CIR ops implementation 
---===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+//
+// This file implements the CIR dialect and its operations.
+//
+//===--===//

erichkeane wrote:

As a nit, it would be nice to #include the .h file for this.

https://github.com/llvm/llvm-project/pull/86080
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] [CIR][NFC] Add scaffolding for the CIR dialect and CIROps.td (PR #86080)

2024-04-17 Thread Erich Keane via llvm-branch-commits




erichkeane wrote:

we should probably still create this file with the comment header and include 
guards at this point.

https://github.com/llvm/llvm-project/pull/86080
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] [CIR] Add options to emit ClangIR and enable the ClangIR pipeline (PR #89030)

2024-04-17 Thread Erich Keane via llvm-branch-commits


@@ -590,7 +596,7 @@ class FrontendOptions {
 EmitSymbolGraph(false), EmitExtensionSymbolGraphs(false),
 EmitSymbolGraphSymbolLabelsForTesting(false),
 EmitPrettySymbolGraphs(false), GenReducedBMI(false),
-TimeTraceGranularity(500) {}
+UseClangIRPipeline(), TimeTraceGranularity(500) {}

erichkeane wrote:

Why isn't this initializing this to a value? I would expect it to have  'false' 
here.
```suggestion
UseClangIRPipeline(false), TimeTraceGranularity(500) {}
```

https://github.com/llvm/llvm-project/pull/89030
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] [CIR] Add options to emit ClangIR and enable the ClangIR pipeline (PR #89030)

2024-04-17 Thread Erich Keane via llvm-branch-commits


@@ -2876,6 +2876,15 @@ def flax_vector_conversions : Flag<["-"], 
"flax-vector-conversions">, Group, Group,
   HelpText<"Force linking the clang builtins runtime library">;
+
+/// ClangIR-specific options - BEGIN
+def fclangir_enable : Flag<["-"], "fclangir-enable">, Visibility<[ClangOption, 
CC1Option]>,
+  Group, HelpText<"Use ClangIR pipeline to compile">,
+  MarshallingInfoFlag>;
+def emit_cir : Flag<["-"], "emit-cir">, Visibility<[ClangOption, CC1Option]>,
+  Group, HelpText<"Build ASTs and then lower to ClangIR, emit 
the .cir file">;

erichkeane wrote:

The 'help' text says this outputs to a file: Does this actually, or does it 
work more like -emit-llvm, which outputs to whatever the 'out' file is?

https://github.com/llvm/llvm-project/pull/89030
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] Fix override keyword being print to the left side (PR #88453)

2024-04-12 Thread Erich Keane via llvm-branch-commits

https://github.com/erichkeane approved this pull request.


https://github.com/llvm/llvm-project/pull/88453
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] release/18x: [clang] Avoid -Wshadow warning when init-capture named same as class … (PR #84912)

2024-04-01 Thread Erich Keane via llvm-branch-commits

erichkeane wrote:

Just got back from WG21, so sorry for the delay.  While we don't USUALLY do 
backports like this that fix something that was present in the last release, I 
think this ends up being reasonably low risk, we haven't seen any bugs 
regarding this SINCE, and worst-case it breaks `-Wshadow`.  So I am OK with 
this, so approve.

https://github.com/llvm/llvm-project/pull/84912
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] release/18x: [clang] Avoid -Wshadow warning when init-capture named same as class … (PR #84912)

2024-03-12 Thread Erich Keane via llvm-branch-commits

erichkeane wrote:

As far as I can tell, this isn't fixing a regression in Clang17, and thus isn't 
really a candidate for inclusion into the 18.x branches.

https://github.com/llvm/llvm-project/pull/84912
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] PR for llvm/llvm-project#79568 (PR #80120)

2024-01-31 Thread Erich Keane via llvm-branch-commits

https://github.com/erichkeane approved this pull request.


https://github.com/llvm/llvm-project/pull/80120
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] PR for llvm/llvm-project#79568 (PR #80120)

2024-01-31 Thread Erich Keane via llvm-branch-commits

erichkeane wrote:

Does this fix a regression against 17?  I didn't think it did?

https://github.com/llvm/llvm-project/pull/80120
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] PR for llvm/llvm-project#79992 (PR #79997)

2024-01-30 Thread Erich Keane via llvm-branch-commits

https://github.com/erichkeane approved this pull request.


https://github.com/llvm/llvm-project/pull/79997
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] PR for llvm/llvm-project#79992 (PR #79997)

2024-01-30 Thread Erich Keane via llvm-branch-commits

erichkeane wrote:

> @erichkeane What do you think about merging this PR to the release branch?

We absolutely should!  Please do.

https://github.com/llvm/llvm-project/pull/79997
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] [libcxx] Revert "[SemaCXX] Implement CWG2137 (list-initialization from objects of the same type) (#77768)" in release/18.x (PR #79400)

2024-01-26 Thread Erich Keane via llvm-branch-commits

https://github.com/erichkeane approved this pull request.


https://github.com/llvm/llvm-project/pull/79400
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] [libcxx] Revert "[SemaCXX] Implement CWG2137 (list-initialization from objects of the same type) (#77768)" in release/18.x (PR #79400)

2024-01-26 Thread Erich Keane via llvm-branch-commits

erichkeane wrote:

Author seems to have disappeared, so approving.

https://github.com/llvm/llvm-project/pull/79400
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [libcxx] [clang] Revert "[SemaCXX] Implement CWG2137 (list-initialization from objects of the same type) (#77768)" in release/18.x (PR #79400)

2024-01-25 Thread Erich Keane via llvm-branch-commits

erichkeane wrote:

I'd like us to give the author a chance to fix the original so that this 
feature can get into 18, but this being here will be helpful in case he is 
unable to.

https://github.com/llvm/llvm-project/pull/79400
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [clang] [TySan] A Type Sanitizer (Clang) (PR #76260)

2024-01-03 Thread Erich Keane via llvm-branch-commits

https://github.com/erichkeane commented:

The clang changes are ok, but this needs some level of documentation/release 
notes, which I don't see in the clang release.  As this is a part of a larger 
feature, do we intend to push that later?

Also, the clang-format suggestion makes sense.

https://github.com/llvm/llvm-project/pull/76260
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] a9e129e - Update release notes for revert in D145605

2023-03-10 Thread Erich Keane via llvm-branch-commits

Author: Erich Keane
Date: 2023-03-10T06:04:27-08:00
New Revision: a9e129ed8806cc313fcda5017f25206cf73c42ea

URL: 
https://github.com/llvm/llvm-project/commit/a9e129ed8806cc313fcda5017f25206cf73c42ea
DIFF: 
https://github.com/llvm/llvm-project/commit/a9e129ed8806cc313fcda5017f25206cf73c42ea.diff

LOG: Update release notes for revert in D145605

D145605 reverted two patches to fix a regression, this patch removes
them from the 16.x release notes.

Added: 


Modified: 
clang/docs/ReleaseNotes.rst

Removed: 




diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index e11b7a79a22f0..ce7e3ec6f191a 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -593,9 +593,6 @@ Improvements to Clang's diagnostics
   language version and specifies in which version it will be a keyword. This
   supports both C and C++.
 
-- When diagnosing multi-level pack expansions of mismatched lengths, Clang will
-  now, in most cases, be able to point to the relevant outer parameter.
-
 - ``no_sanitize("...")`` on a global variable for known but not relevant
   sanitizers is now just a warning. It now says that this will be ignored
   instead of incorrectly saying no_sanitize only applies to functions and
@@ -781,9 +778,6 @@ Bug Fixes to Attribute Support
 
 Bug Fixes to C++ Support
 
-- Fix multi-level pack expansion of undeclared function parameters.
-  (`#56094 `_)
-
 - Address the thread identification problems in coroutines.
   (`#47177 `_,
   `#47179 `_)



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


[llvm-branch-commits] [clang] 8776e3f - [EXTINT][OMP] Fix _ExtInt type checking in device code

2021-01-20 Thread Erich Keane via llvm-branch-commits

Author: Erich Keane
Date: 2021-01-20T11:35:52-08:00
New Revision: 8776e3f289c19ee2e85c593792806e6503408d59

URL: 
https://github.com/llvm/llvm-project/commit/8776e3f289c19ee2e85c593792806e6503408d59
DIFF: 
https://github.com/llvm/llvm-project/commit/8776e3f289c19ee2e85c593792806e6503408d59.diff

LOG: [EXTINT][OMP] Fix _ExtInt type checking in device code

_ExtInt gets stuck in the device-type-checking for __int128 if it is
between 65 and 128 bits inclusive.  Anything larger or smaller was
permitted despite this, so this is simply enabling 65-128 bit _ExtInts.
_ExtInt is supported on all our current ABIs, but we stil use the
hasExtIntType in the target info to differentiate here so that it can be
disabled.

Added: 


Modified: 
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/lib/Sema/Sema.cpp
clang/test/OpenMP/nvptx_unsupported_type_messages.cpp

Removed: 




diff  --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td 
b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index e93657898f58..758b2ed3e90b 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -10468,8 +10468,9 @@ def err_omp_invariant_or_linear_dependency : Error<
   "expected loop invariant expression or ' * %0 + ' 
kind of expression">;
 def err_omp_wrong_dependency_iterator_type : Error<
   "expected an integer or a pointer type of the outer loop counter '%0' for 
non-rectangular nests">;
-def err_device_unsupported_type : Error <
-  "%0 requires %1 bit size %2 type support, but device '%3' does not support 
it">;
+def err_device_unsupported_type
+: Error<"%0 requires %select{|%2 bit size}1 %3 type support, but device "
+"'%4' does not support it">;
 def err_omp_lambda_capture_in_declare_target_not_to : Error<
   "variable captured in declare target region must appear in a to clause">;
 def err_omp_device_type_mismatch : Error<

diff  --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp
index cca82fb3bf48..23dba75f03c6 100644
--- a/clang/lib/Sema/Sema.cpp
+++ b/clang/lib/Sema/Sema.cpp
@@ -1795,6 +1795,15 @@ void Sema::checkDeviceDecl(const ValueDecl *D, 
SourceLocation Loc) {
 if (Ty->isDependentType())
   return;
 
+if (Ty->isExtIntType()) {
+  if (!Context.getTargetInfo().hasExtIntType()) {
+targetDiag(Loc, diag::err_device_unsupported_type)
+<< D << false /*show bit size*/ << 0 /*bitsize*/
+<< Ty << Context.getTargetInfo().getTriple().str();
+  }
+  return;
+}
+
 if ((Ty->isFloat16Type() && !Context.getTargetInfo().hasFloat16Type()) ||
 ((Ty->isFloat128Type() ||
   (Ty->isRealFloatingType() && Context.getTypeSize(Ty) == 128)) &&
@@ -1802,7 +1811,8 @@ void Sema::checkDeviceDecl(const ValueDecl *D, 
SourceLocation Loc) {
 (Ty->isIntegerType() && Context.getTypeSize(Ty) == 128 &&
  !Context.getTargetInfo().hasInt128Type())) {
   targetDiag(Loc, diag::err_device_unsupported_type)
-  << D << static_cast(Context.getTypeSize(Ty)) << Ty
+  << D << true /*show bit size*/
+  << static_cast(Context.getTypeSize(Ty)) << Ty
   << Context.getTargetInfo().getTriple().str();
   targetDiag(D->getLocation(), diag::note_defined_here) << D;
 }

diff  --git a/clang/test/OpenMP/nvptx_unsupported_type_messages.cpp 
b/clang/test/OpenMP/nvptx_unsupported_type_messages.cpp
index e56105adeb83..814a4756c01b 100644
--- a/clang/test/OpenMP/nvptx_unsupported_type_messages.cpp
+++ b/clang/test/OpenMP/nvptx_unsupported_type_messages.cpp
@@ -131,3 +131,7 @@ struct B {
   enum { value = bool(Sp::value) || bool(Tp::value) };
   typedef typename A_type::type type;
 };
+
+void bar(_ExtInt(66) a) {
+  auto b = a;
+}



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


[llvm-branch-commits] [clang] 9e53c94 - [NFC] Update test to not check for 'opaque' in the file name.

2021-01-14 Thread Erich Keane via llvm-branch-commits

Author: Erich Keane
Date: 2021-01-14T11:24:06-08:00
New Revision: 9e53c94d8dd737fcedb543d6ac687ea9696db8a6

URL: 
https://github.com/llvm/llvm-project/commit/9e53c94d8dd737fcedb543d6ac687ea9696db8a6
DIFF: 
https://github.com/llvm/llvm-project/commit/9e53c94d8dd737fcedb543d6ac687ea9696db8a6.diff

LOG: [NFC] Update test to not check for 'opaque' in the file name.

The intent presumably is to avoid generating 'opaque' in the IR, but the
header contains the filename. Thus, having the workspace in a directory
with opaque in it causes this test to fail.

This just adds a 'CHECK' line on target-triple, which is the last line
of the IR-header.

Added: 


Modified: 
clang/test/CodeGen/incomplete-function-type.c

Removed: 




diff  --git a/clang/test/CodeGen/incomplete-function-type.c 
b/clang/test/CodeGen/incomplete-function-type.c
index b5b864bb11af..0ec1cf871391 100644
--- a/clang/test/CodeGen/incomplete-function-type.c
+++ b/clang/test/CodeGen/incomplete-function-type.c
@@ -1,5 +1,6 @@
 // RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm -o - %s | FileCheck 
%s
 // CHECK: ModuleID
+// CHECK: target triple = "
 // CHECK-NOT: opaque
 // CHECK-LABEL: define{{.*}} void @f0
 



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


[llvm-branch-commits] [clang] 43043ad - Add element-type to the Vector TypeLoc types.

2021-01-07 Thread Erich Keane via llvm-branch-commits

Author: Erich Keane
Date: 2021-01-07T09:14:36-08:00
New Revision: 43043adcfbc60945646b791d7162e5a1307a5318

URL: 
https://github.com/llvm/llvm-project/commit/43043adcfbc60945646b791d7162e5a1307a5318
DIFF: 
https://github.com/llvm/llvm-project/commit/43043adcfbc60945646b791d7162e5a1307a5318.diff

LOG: Add element-type to the Vector TypeLoc types.

As shown by bug 48540, GCC vector types would cause a crash when the
declaration hada ParenType. This was because the walking of the
declaration would try to expand the 'inner' type, but there was no
ability to get it from the vector type.  This patch adds that element
type access to the vector type loc objects.

Differential Revision: https://reviews.llvm.org/D93483

Added: 


Modified: 
clang/include/clang/AST/TypeLoc.h
clang/lib/Sema/SemaType.cpp
clang/lib/Sema/TreeTransform.h
clang/test/SemaCXX/vector.cpp

Removed: 




diff  --git a/clang/include/clang/AST/TypeLoc.h 
b/clang/include/clang/AST/TypeLoc.h
index 4c320ce26e4f..65e95d52c303 100644
--- a/clang/include/clang/AST/TypeLoc.h
+++ b/clang/include/clang/AST/TypeLoc.h
@@ -1749,30 +1749,79 @@ class DependentAddressSpaceTypeLoc
 
 // FIXME: size expression and attribute locations (or keyword if we
 // ever fully support altivec syntax).
-class VectorTypeLoc : public InheritingConcreteTypeLoc {
+struct VectorTypeLocInfo {
+  SourceLocation NameLoc;
+};
+
+class VectorTypeLoc : public ConcreteTypeLoc {
+public:
+  SourceLocation getNameLoc() const { return this->getLocalData()->NameLoc; }
+
+  void setNameLoc(SourceLocation Loc) { this->getLocalData()->NameLoc = Loc; }
+
+  SourceRange getLocalSourceRange() const {
+return SourceRange(getNameLoc(), getNameLoc());
+  }
+
+  void initializeLocal(ASTContext , SourceLocation Loc) {
+setNameLoc(Loc);
+  }
+
+  TypeLoc getElementLoc() const { return getInnerTypeLoc(); }
+
+  QualType getInnerType() const { return this->getTypePtr()->getElementType(); 
}
 };
 
 // FIXME: size expression and attribute locations (or keyword if we
 // ever fully support altivec syntax).
 class DependentVectorTypeLoc
-: public InheritingConcreteTypeLoc {};
+: public ConcreteTypeLoc {
+public:
+  SourceLocation getNameLoc() const { return this->getLocalData()->NameLoc; }
 
-// FIXME: size expression and attribute locations.
-class ExtVectorTypeLoc : public InheritingConcreteTypeLoc {
+  void setNameLoc(SourceLocation Loc) { this->getLocalData()->NameLoc = Loc; }
+
+  SourceRange getLocalSourceRange() const {
+return SourceRange(getNameLoc(), getNameLoc());
+  }
+
+  void initializeLocal(ASTContext , SourceLocation Loc) {
+setNameLoc(Loc);
+  }
+
+  TypeLoc getElementLoc() const { return getInnerTypeLoc(); }
+
+  QualType getInnerType() const { return this->getTypePtr()->getElementType(); 
}
 };
 
+// FIXME: size expression and attribute locations.
+class ExtVectorTypeLoc
+: public InheritingConcreteTypeLoc {};
+
 // FIXME: attribute locations.
 // For some reason, this isn't a subtype of VectorType.
-class DependentSizedExtVectorTypeLoc :
-public InheritingConcreteTypeLoc {
+class DependentSizedExtVectorTypeLoc
+: public ConcreteTypeLoc {
+public:
+  SourceLocation getNameLoc() const { return this->getLocalData()->NameLoc; }
+
+  void setNameLoc(SourceLocation Loc) { this->getLocalData()->NameLoc = Loc; }
+
+  SourceRange getLocalSourceRange() const {
+return SourceRange(getNameLoc(), getNameLoc());
+  }
+
+  void initializeLocal(ASTContext , SourceLocation Loc) {
+setNameLoc(Loc);
+  }
+
+  TypeLoc getElementLoc() const { return getInnerTypeLoc(); }
+
+  QualType getInnerType() const { return this->getTypePtr()->getElementType(); 
}
 };
 
 struct MatrixTypeLocInfo {

diff  --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp
index f51c616169f5..fe775b82a1d6 100644
--- a/clang/lib/Sema/SemaType.cpp
+++ b/clang/lib/Sema/SemaType.cpp
@@ -6135,6 +6135,17 @@ namespace {
 void VisitMacroQualifiedTypeLoc(MacroQualifiedTypeLoc TL) {
   TL.setExpansionLoc(Chunk.Loc);
 }
+void VisitVectorTypeLoc(VectorTypeLoc TL) { TL.setNameLoc(Chunk.Loc); }
+void VisitDependentVectorTypeLoc(DependentVectorTypeLoc TL) {
+  TL.setNameLoc(Chunk.Loc);
+}
+void VisitExtVectorTypeLoc(ExtVectorTypeLoc TL) {
+  TL.setNameLoc(Chunk.Loc);
+}
+void
+VisitDependentSizedExtVectorTypeLoc(DependentSizedExtVectorTypeLoc TL) {
+  TL.setNameLoc(Chunk.Loc);
+}
 
 void VisitTypeLoc(TypeLoc TL) {
   llvm_unreachable("unsupported TypeLoc kind in declarator!");

diff  --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h
index 2cc8b9c8324f..0a596e50658b 100644
--- a/clang/lib/Sema/TreeTransform.h
+++ b/clang/lib/Sema/TreeTransform.h
@@ -5178,7 +5178,7 @@ template 
 QualType TreeTransform::TransformDependentVectorType(
 TypeLocBuilder , DependentVectorTypeLoc TL) {
   const 

[llvm-branch-commits] [clang] 3fa6ced - Fix MaterializeTemporaryExpr's type when its an incomplete array.

2021-01-06 Thread Erich Keane via llvm-branch-commits

Author: Erich Keane
Date: 2021-01-06T07:17:12-08:00
New Revision: 3fa6cedb6be809092f8a8b27e63bd4f6dc526a08

URL: 
https://github.com/llvm/llvm-project/commit/3fa6cedb6be809092f8a8b27e63bd4f6dc526a08
DIFF: 
https://github.com/llvm/llvm-project/commit/3fa6cedb6be809092f8a8b27e63bd4f6dc526a08.diff

LOG: Fix MaterializeTemporaryExpr's type when its an incomplete array.

Like the VarDecl that gets its type updated based on an init-list, this
patch corrects the MaterializeTemporaryExpr's type to make sure it isn't
creating an incomplete type, which leads to a handful of CodeGen crashes
(see PR 47636).

Based on @rsmith 's comments on D88236

Differential Revision: https://reviews.llvm.org/D88298

Added: 
clang/test/AST/pr47636.cpp

Modified: 
clang/lib/Sema/SemaInit.cpp
clang/test/CodeGenCXX/pr47636.cpp

Removed: 




diff  --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp
index b5f31bf403d4..38f6a5975ea3 100644
--- a/clang/lib/Sema/SemaInit.cpp
+++ b/clang/lib/Sema/SemaInit.cpp
@@ -8200,9 +8200,21 @@ ExprResult InitializationSequence::Perform(Sema ,
   if (S.CheckExceptionSpecCompatibility(CurInit.get(), DestType))
 return ExprError();
 
+  QualType MTETy = Step->Type;
+
+  // When this is an incomplete array type (such as when this is
+  // initializing an array of unknown bounds from an init list), use THAT
+  // type instead so that we propogate the array bounds.
+  if (MTETy->isIncompleteArrayType() &&
+  !CurInit.get()->getType()->isIncompleteArrayType() &&
+  S.Context.hasSameType(
+  MTETy->getPointeeOrArrayElementType(),
+  CurInit.get()->getType()->getPointeeOrArrayElementType()))
+MTETy = CurInit.get()->getType();
+
   // Materialize the temporary into memory.
   MaterializeTemporaryExpr *MTE = S.CreateMaterializeTemporaryExpr(
-  Step->Type, CurInit.get(), 
Entity.getType()->isLValueReferenceType());
+  MTETy, CurInit.get(), Entity.getType()->isLValueReferenceType());
   CurInit = MTE;
 
   // If we're extending this temporary to automatic storage duration -- we

diff  --git a/clang/test/AST/pr47636.cpp b/clang/test/AST/pr47636.cpp
new file mode 100644
index ..29d2a0a06e79
--- /dev/null
+++ b/clang/test/AST/pr47636.cpp
@@ -0,0 +1,26 @@
+// RUN: %clang_cc1 -fsyntax-only %s -ast-dump | FileCheck %s
+
+int(&_rvref)[] {1,2,3,4};
+// CHECK: VarDecl 0x[[GLOB_ADDR:[0-9a-f]+]] {{.*}} intu_rvref 'int (&&)[4]' 
listinit
+// CHECK-NEXT: ExprWithCleanups {{.*}} 'int [4]' xvalue
+// CHECK-NEXT: MaterializeTemporaryExpr {{.*}} 'int [4]' xvalue extended by 
Var 0x[[GLOB_ADDR]] 'intu_rvref' 'int (&&)[4]'
+// CHECK-NEXT: InitListExpr {{.*}} 'int [4]'
+
+// CHECK: FunctionDecl {{.*}} static_const
+void static_const() {
+  static const int(&_rvref)[] {1,2,3,4};
+  // CHECK: VarDecl 0x[[STATIC_ADDR:[0-9a-f]+]] {{.*}} intu_rvref 'const int 
(&&)[4]' static listinit
+  // CHECK-NEXT: ExprWithCleanups {{.*}} 'const int [4]' xvalue
+  // CHECK-NEXT: MaterializeTemporaryExpr {{.*}} 'const int [4]' xvalue 
extended by Var 0x[[STATIC_ADDR]] 'intu_rvref' 'const int (&&)[4]'
+  // CHECK-NEXT: InitListExpr {{.*}} 'const int [4]'
+}
+
+// CHECK: FunctionDecl {{.*}} const_expr
+constexpr int const_expr() {
+  int(&_rvref)[]{1, 2, 3, 4};
+  // CHECK: VarDecl 0x[[CE_ADDR:[0-9a-f]+]] {{.*}} intu_rvref 'int (&&)[4]' 
listinit
+  // CHECK-NEXT: ExprWithCleanups {{.*}} 'int [4]' xvalue
+  // CHECK-NEXT: MaterializeTemporaryExpr {{.*}} 'int [4]' xvalue extended by 
Var 0x[[CE_ADDR]] 'intu_rvref' 'int (&&)[4]'
+  // CHECK-NEXT: InitListExpr {{.*}} 'int [4]'
+  return intu_rvref[0];
+}

diff  --git a/clang/test/CodeGenCXX/pr47636.cpp 
b/clang/test/CodeGenCXX/pr47636.cpp
index 64fb44114bd2..b6b31d623761 100644
--- a/clang/test/CodeGenCXX/pr47636.cpp
+++ b/clang/test/CodeGenCXX/pr47636.cpp
@@ -8,3 +8,15 @@ void foo() {
   // CHECK: @_ZZ3foovE10intu_rvref = internal constant [4 x i32]* 
@_ZGRZ3foovE10intu_rvref_
   // CHECK: @_ZGRZ3foovE10intu_rvref_ = internal constant [4 x i32] [i32 1, 
i32 2, i32 3, i32 4]
 }
+
+// Example given on review, ensure this doesn't crash as well.
+constexpr int f() {
+  // CHECK: i32 @_Z1fv()
+  int(&_rvref)[]{1, 2, 3, 4};
+  // CHECK: %{{.*}} = alloca [4 x i32]*
+  return intu_rvref[2];
+}
+
+void use_f() {
+  int i = f();
+}



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


[llvm-branch-commits] [clang] 1c98f98 - Stop ExtractTypeForDeductionGuide from recursing on TypeSourceInfo

2020-12-07 Thread Erich Keane via llvm-branch-commits

Author: Erich Keane
Date: 2020-12-07T11:29:57-08:00
New Revision: 1c98f984105e552daa83ed8e92c61fba0e401410

URL: 
https://github.com/llvm/llvm-project/commit/1c98f984105e552daa83ed8e92c61fba0e401410
DIFF: 
https://github.com/llvm/llvm-project/commit/1c98f984105e552daa83ed8e92c61fba0e401410.diff

LOG: Stop ExtractTypeForDeductionGuide from recursing on TypeSourceInfo

As reported in PR48177, the type-deduction extraction ends up going into
an infinite loop when the type referred to has a recursive definition.
This stops recursing and just substitutes the type-source-info the
TypeLocBuilder identified when transforming the base.

Added: 


Modified: 
clang/lib/Sema/SemaTemplate.cpp
clang/test/AST/deduction-guides.cpp

Removed: 




diff  --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp
index a465c6594851..03715ef600bc 100644
--- a/clang/lib/Sema/SemaTemplate.cpp
+++ b/clang/lib/Sema/SemaTemplate.cpp
@@ -2084,8 +2084,7 @@ class ExtractTypeForDeductionGuide
   TypeLocBuilder InnerTLB;
   QualType Transformed =
   TransformType(InnerTLB, OrigDecl->getTypeSourceInfo()->getTypeLoc());
-  TypeSourceInfo *TSI =
-  TransformType(InnerTLB.getTypeSourceInfo(Context, Transformed));
+  TypeSourceInfo *TSI = InnerTLB.getTypeSourceInfo(Context, Transformed);
   if (isa(OrigDecl))
 Decl = TypeAliasDecl::Create(
 Context, Context.getTranslationUnitDecl(), OrigDecl->getBeginLoc(),

diff  --git a/clang/test/AST/deduction-guides.cpp 
b/clang/test/AST/deduction-guides.cpp
index 0f5293bc063d..3a7f0bf4699e 100644
--- a/clang/test/AST/deduction-guides.cpp
+++ b/clang/test/AST/deduction-guides.cpp
@@ -37,3 +37,43 @@ 
HasDeductionGuideTypeAlias()->HasDeductionGuideTypeAlias;
 // CHECK: CXXDeductionGuideDecl {{.*}} implicit  'auto (HasDeductionGuideTypeAlias) -> 
HasDeductionGuideTypeAlias'
 // CHECK: CXXDeductionGuideDecl {{.*}}  'auto () -> HasDeductionGuideTypeAlias'
 } // namespace PR46111
+
+
+namespace PR48177 {
+  template  struct Base {
+using type_alias = A;
+  };
+  template
+  struct Derived : Base {
+using type_alias = typename Derived::type_alias;
+Derived(Derived &&, typename Derived::type_alias const&);
+Derived(T);
+  };
+
+  template
+  Derived(T, A) -> Derived;
+
+  void init() {
+Derived d {1,2};
+  }
+} // namespace PR48177
+
+// CHECK: CXXRecordDecl {{.*}} struct Derived
+// CHECK: TypeAliasDecl {{.*}} type_alias 'typename Derived::type_alias'
+// CHECK-NEXT: DependentNameType {{.*}} 'typename Derived::type_alias' dependent
+
+// CHECK: CXXRecordDecl {{.*}} struct Derived
+// CHECK: TypeAliasDecl {{.*}} type_alias 'typename Derived::type_alias':'int'
+// CHECK-NEXT: ElaboratedType {{.*}} 'typename Derived::type_alias' sugar
+// CHECK-NEXT: TypedefType {{.*}} 'PR48177::Base::type_alias' sugar
+// CHECK-NEXT: TypeAlias {{.*}} 'type_alias'
+// CHECK-NEXT: SubstTemplateTypeParmType {{.*}} 'int' sugar
+// CHECK-NEXT: TemplateTypeParmType {{.*}} 'A'
+// CHECK-NEXT: TemplateTypeParm {{.*}} 'A'
+// CHECK-NEXT: BuiltinType {{.*}} 'int'
+
+// CHECK: CXXDeductionGuideDecl {{.*}} implicit  
'auto (Derived &&, const typename Derived::type_alias &) -> 
Derived'
+// CHECK: CXXDeductionGuideDecl {{.*}} implicit  
'auto (T) -> Derived'
+// CHECK: CXXDeductionGuideDecl {{.*}} implicit  
'auto (Derived) -> Derived'
+// CHECK: CXXDeductionGuideDecl {{.*}}  'auto (T, 
A) -> Derived'
+// CHECK: CXXDeductionGuideDecl {{.*}}  'auto 
(int, int) -> Derived'



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