Re: [clang] c411c1b - Fix missing qualifier in template type diffing

2021-08-17 Thread Richard Trieu via cfe-commits
Thanks for the simplified test case.  I've pushed it at 02e73d4

On Mon, Aug 16, 2021 at 10:31 PM David Blaikie  wrote:

> Perhaps the test case could be stripped down a bit?
>
> template 
> class Array {};
>
> template 
> class S {};
>
> template 
> Array Make();
>
> void Call() {
> Array> v = Make>();
> }
>
> Seems to exhibit the same issue, by the looks of it.
>
> On Mon, Aug 16, 2021 at 6:38 PM via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>>
>> Author: Weverything
>> Date: 2021-08-16T18:34:18-07:00
>> New Revision: c411c1bd7f7d3550d24333f80980c0be6481d34a
>>
>> URL:
>> https://github.com/llvm/llvm-project/commit/c411c1bd7f7d3550d24333f80980c0be6481d34a
>> DIFF:
>> https://github.com/llvm/llvm-project/commit/c411c1bd7f7d3550d24333f80980c0be6481d34a.diff
>>
>> LOG: Fix missing qualifier in template type diffing
>>
>> Handle SubstTemplateTypeParmType so qualifiers do not get dropped from
>> the diagnostic message.
>>
>> Added:
>>
>>
>> Modified:
>> clang/lib/AST/ASTDiagnostic.cpp
>> clang/test/Misc/diag-template-diffing.cpp
>>
>> Removed:
>>
>>
>>
>>
>> 
>> diff  --git a/clang/lib/AST/ASTDiagnostic.cpp
>> b/clang/lib/AST/ASTDiagnostic.cpp
>> index dc22481d0a84c..7e435e8b35b80 100644
>> --- a/clang/lib/AST/ASTDiagnostic.cpp
>> +++ b/clang/lib/AST/ASTDiagnostic.cpp
>> @@ -1088,6 +1088,9 @@ class TemplateDiff {
>>  Ty->getAs())
>>return TST;
>>
>> +if (const auto* SubstType = Ty->getAs())
>> +  Ty = SubstType->getReplacementType();
>> +
>>  const RecordType *RT = Ty->getAs();
>>
>>  if (!RT)
>>
>> diff  --git a/clang/test/Misc/diag-template-
>> diff ing.cpp b/clang/test/Misc/diag-template-
>> diff ing.cpp
>> index cc1cc9ca70679..6bf6e2de4277c 100644
>> --- a/clang/test/Misc/diag-template-
>> diff ing.cpp
>> +++ b/clang/test/Misc/diag-template-
>> diff ing.cpp
>> @@ -1488,6 +1488,43 @@ void run(A_reg reg, A_ptr ptr,
>> A_ref ref) {
>>  }
>>  }
>>
>> +namespace SubstTemplateTypeParmType {
>> +template 
>> +class Array {
>> +};
>> +
>> +template 
>> +class S{};
>> +
>> +template 
>> +Array Make(T ()[num]);
>> +
>> +void Run(int, Array>) {}
>> +
>> +Array> Make();
>> +void Call() {
>> +  const S s1[5];
>> +  S s2[5];
>> +
>> +  Run(0, Make(s1));   // Error
>> +  Run(0, Make(s2));   // Okay
>> +}
>> +
>> +// CHECK-ELIDE-NOTREE: no matching function for call to 'Run'
>> +// CHECK-ELIDE-NOTREE: no known conversion from 'Array>' to
>> 'Array>' for 2nd argument
>> +// CHECK-NOELIDE-NOTREE: no matching function for call to 'Run'
>> +// CHECK-NOELIDE-NOTREE: no known conversion from 'Array>'
>> to 'Array>' for 2nd argument
>> +// CHECK-ELIDE-TREE: no matching function for call to 'Run'
>> +// CHECK-ELIDE-TREE: no known conversion from argument type to parameter
>> type for 2nd argument
>> +// CHECK-ELIDE-TREE:   Array<
>> +// CHECK-ELIDE-TREE: [const != (no qualifiers)] S<...>>
>> +// CHECK-NOELIDE-TREE: no matching function for call to 'Run'
>> +// CHECK-NOELIDE-TREE: no known conversion from argument type to
>> parameter type for 2nd argument
>> +// CHECK-NOELIDE-TREE:   Array<
>> +// CHECK-NOELIDE-TREE: [const != (no qualifiers)] S<
>> +// CHECK-NOELIDE-TREE:   int>>
>> +}
>> +
>>  // CHECK-ELIDE-NOTREE: {{[0-9]*}} errors generated.
>>  // CHECK-NOELIDE-NOTREE: {{[0-9]*}} errors generated.
>>  // CHECK-ELIDE-TREE: {{[0-9]*}} errors generated.
>>
>>
>>
>> ___
>> 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


Re: [clang] c411c1b - Fix missing qualifier in template type diffing

2021-08-16 Thread David Blaikie via cfe-commits
Perhaps the test case could be stripped down a bit?

template 
class Array {};

template 
class S {};

template 
Array Make();

void Call() {
Array> v = Make>();
}

Seems to exhibit the same issue, by the looks of it.

On Mon, Aug 16, 2021 at 6:38 PM via cfe-commits 
wrote:

>
> Author: Weverything
> Date: 2021-08-16T18:34:18-07:00
> New Revision: c411c1bd7f7d3550d24333f80980c0be6481d34a
>
> URL:
> https://github.com/llvm/llvm-project/commit/c411c1bd7f7d3550d24333f80980c0be6481d34a
> DIFF:
> https://github.com/llvm/llvm-project/commit/c411c1bd7f7d3550d24333f80980c0be6481d34a.diff
>
> LOG: Fix missing qualifier in template type diffing
>
> Handle SubstTemplateTypeParmType so qualifiers do not get dropped from
> the diagnostic message.
>
> Added:
>
>
> Modified:
> clang/lib/AST/ASTDiagnostic.cpp
> clang/test/Misc/diag-template-diffing.cpp
>
> Removed:
>
>
>
>
> 
> diff  --git a/clang/lib/AST/ASTDiagnostic.cpp
> b/clang/lib/AST/ASTDiagnostic.cpp
> index dc22481d0a84c..7e435e8b35b80 100644
> --- a/clang/lib/AST/ASTDiagnostic.cpp
> +++ b/clang/lib/AST/ASTDiagnostic.cpp
> @@ -1088,6 +1088,9 @@ class TemplateDiff {
>  Ty->getAs())
>return TST;
>
> +if (const auto* SubstType = Ty->getAs())
> +  Ty = SubstType->getReplacementType();
> +
>  const RecordType *RT = Ty->getAs();
>
>  if (!RT)
>
> diff  --git a/clang/test/Misc/diag-template-
> diff ing.cpp b/clang/test/Misc/diag-template-
> diff ing.cpp
> index cc1cc9ca70679..6bf6e2de4277c 100644
> --- a/clang/test/Misc/diag-template-
> diff ing.cpp
> +++ b/clang/test/Misc/diag-template-
> diff ing.cpp
> @@ -1488,6 +1488,43 @@ void run(A_reg reg, A_ptr ptr,
> A_ref ref) {
>  }
>  }
>
> +namespace SubstTemplateTypeParmType {
> +template 
> +class Array {
> +};
> +
> +template 
> +class S{};
> +
> +template 
> +Array Make(T ()[num]);
> +
> +void Run(int, Array>) {}
> +
> +Array> Make();
> +void Call() {
> +  const S s1[5];
> +  S s2[5];
> +
> +  Run(0, Make(s1));   // Error
> +  Run(0, Make(s2));   // Okay
> +}
> +
> +// CHECK-ELIDE-NOTREE: no matching function for call to 'Run'
> +// CHECK-ELIDE-NOTREE: no known conversion from 'Array>' to
> 'Array>' for 2nd argument
> +// CHECK-NOELIDE-NOTREE: no matching function for call to 'Run'
> +// CHECK-NOELIDE-NOTREE: no known conversion from 'Array>'
> to 'Array>' for 2nd argument
> +// CHECK-ELIDE-TREE: no matching function for call to 'Run'
> +// CHECK-ELIDE-TREE: no known conversion from argument type to parameter
> type for 2nd argument
> +// CHECK-ELIDE-TREE:   Array<
> +// CHECK-ELIDE-TREE: [const != (no qualifiers)] S<...>>
> +// CHECK-NOELIDE-TREE: no matching function for call to 'Run'
> +// CHECK-NOELIDE-TREE: no known conversion from argument type to
> parameter type for 2nd argument
> +// CHECK-NOELIDE-TREE:   Array<
> +// CHECK-NOELIDE-TREE: [const != (no qualifiers)] S<
> +// CHECK-NOELIDE-TREE:   int>>
> +}
> +
>  // CHECK-ELIDE-NOTREE: {{[0-9]*}} errors generated.
>  // CHECK-NOELIDE-NOTREE: {{[0-9]*}} errors generated.
>  // CHECK-ELIDE-TREE: {{[0-9]*}} errors generated.
>
>
>
> ___
> 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


[clang] c411c1b - Fix missing qualifier in template type diffing

2021-08-16 Thread via cfe-commits

Author: Weverything
Date: 2021-08-16T18:34:18-07:00
New Revision: c411c1bd7f7d3550d24333f80980c0be6481d34a

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

LOG: Fix missing qualifier in template type diffing

Handle SubstTemplateTypeParmType so qualifiers do not get dropped from
the diagnostic message.

Added: 


Modified: 
clang/lib/AST/ASTDiagnostic.cpp
clang/test/Misc/diag-template-diffing.cpp

Removed: 




diff  --git a/clang/lib/AST/ASTDiagnostic.cpp b/clang/lib/AST/ASTDiagnostic.cpp
index dc22481d0a84c..7e435e8b35b80 100644
--- a/clang/lib/AST/ASTDiagnostic.cpp
+++ b/clang/lib/AST/ASTDiagnostic.cpp
@@ -1088,6 +1088,9 @@ class TemplateDiff {
 Ty->getAs())
   return TST;
 
+if (const auto* SubstType = Ty->getAs())
+  Ty = SubstType->getReplacementType();
+
 const RecordType *RT = Ty->getAs();
 
 if (!RT)

diff  --git a/clang/test/Misc/diag-template-
diff ing.cpp b/clang/test/Misc/diag-template-
diff ing.cpp
index cc1cc9ca70679..6bf6e2de4277c 100644
--- a/clang/test/Misc/diag-template-
diff ing.cpp
+++ b/clang/test/Misc/diag-template-
diff ing.cpp
@@ -1488,6 +1488,43 @@ void run(A_reg reg, A_ptr ptr, 
A_ref ref) {
 }
 }
 
+namespace SubstTemplateTypeParmType {
+template 
+class Array {
+};
+
+template 
+class S{};
+
+template 
+Array Make(T ()[num]);
+
+void Run(int, Array>) {}
+
+Array> Make();
+void Call() {
+  const S s1[5];
+  S s2[5];
+
+  Run(0, Make(s1));   // Error
+  Run(0, Make(s2));   // Okay
+}
+
+// CHECK-ELIDE-NOTREE: no matching function for call to 'Run'
+// CHECK-ELIDE-NOTREE: no known conversion from 'Array>' to 
'Array>' for 2nd argument
+// CHECK-NOELIDE-NOTREE: no matching function for call to 'Run'
+// CHECK-NOELIDE-NOTREE: no known conversion from 'Array>' to 
'Array>' for 2nd argument
+// CHECK-ELIDE-TREE: no matching function for call to 'Run'
+// CHECK-ELIDE-TREE: no known conversion from argument type to parameter type 
for 2nd argument
+// CHECK-ELIDE-TREE:   Array<
+// CHECK-ELIDE-TREE: [const != (no qualifiers)] S<...>>
+// CHECK-NOELIDE-TREE: no matching function for call to 'Run'
+// CHECK-NOELIDE-TREE: no known conversion from argument type to parameter 
type for 2nd argument
+// CHECK-NOELIDE-TREE:   Array<
+// CHECK-NOELIDE-TREE: [const != (no qualifiers)] S<
+// CHECK-NOELIDE-TREE:   int>>
+}
+
 // CHECK-ELIDE-NOTREE: {{[0-9]*}} errors generated.
 // CHECK-NOELIDE-NOTREE: {{[0-9]*}} errors generated.
 // CHECK-ELIDE-TREE: {{[0-9]*}} errors generated.



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