[PATCH] D104044: [clang-format] Fix the issue that empty lines being removed at the beginning of namespace

2021-06-26 Thread Darwin Xu via Phabricator via cfe-commits
darwin added a comment.

In D104044#2842757 , 
@HazardyKnusperkeks wrote:

> In D104044#2842726 , @darwin wrote:
>
>> And can someone commit it for me? I don't have the right to push it yet. Or 
>> let me know how to apply? Thank you very much.
>
> https://llvm.org/docs/DeveloperPolicy.html?highlight=chris#obtaining-commit-access

Thanks, guess I still need you to commit it for me (User: Darwin Xu, Email: 
darwin...@icloud.com), I cannot get the access any time soon. Thank you.


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

https://reviews.llvm.org/D104044

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


[PATCH] D104044: [clang-format] Fix the issue that empty lines being removed at the beginning of namespace

2021-06-26 Thread Björn Schäpers via Phabricator via cfe-commits
HazardyKnusperkeks added a comment.

In D104044#2842726 , @darwin wrote:

> And can someone commit it for me? I don't have the right to push it yet. Or 
> let me know how to apply? Thank you very much.

https://llvm.org/docs/DeveloperPolicy.html?highlight=chris#obtaining-commit-access


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

https://reviews.llvm.org/D104044

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


[PATCH] D104900: [clang-format] PR50525 doesn't handle AlignConsecutiveAssignments correctly in some situations

2021-06-26 Thread Björn Schäpers via Phabricator via cfe-commits
HazardyKnusperkeks added a comment.

In D104900#2842540 , @darwin wrote:

> Sorry I haven't had a chance to look at this bug before it has closed. But I 
> do have a question:
>
> I observed that this code are formatted incorrectly by the same config:
>
>   llvm::Optional CurrentCode = None;
>   autoEnv = std::make_unique(Code,
>FileName,
>Ranges,
>FirstStartColumn,
>NextStartColumn,
>LastStartColumn);
>
> Can this solution solve this issue? I am afraid not.
>
> If no, should I open a new bug for it?

No it doesn't, this change is only about designated initializers.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104900

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


[PATCH] D104044: [clang-format] Fix the issue that empty lines being removed at the beginning of namespace

2021-06-26 Thread Darwin Xu via Phabricator via cfe-commits
darwin added a comment.

And can someone commit it for me? I don't have the right to push it yet. Or let 
me know how to apply? Thank you very much.


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

https://reviews.llvm.org/D104044

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


[clang] 7a11235 - [X86] Correct the conversion of VALIGND/Q intrinsics to shufflevector.

2021-06-26 Thread Craig Topper via cfe-commits

Author: Craig Topper
Date: 2021-06-26T19:06:00-07:00
New Revision: 7a112356e4a19c0e63f533548fa95a03a5537fb9

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

LOG: [X86] Correct the conversion of VALIGND/Q intrinsics to shufflevector.

We need to mask the immediate to the width of a single vector
rather than 2 vectors. If we use the width of 2 vectors then
any shift larger than the length of 1 vector is going to overflow
the shuffle indices.

Fixes PR50895.

Added: 


Modified: 
clang/lib/CodeGen/CGBuiltin.cpp
clang/test/CodeGen/X86/avx512vl-builtins.c

Removed: 




diff  --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index e8ad4e009bfb2..97f2db9bec2c8 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -13376,8 +13376,8 @@ Value *CodeGenFunction::EmitX86BuiltinExpr(unsigned 
BuiltinID,
 cast(Ops[0]->getType())->getNumElements();
 unsigned ShiftVal = cast(Ops[2])->getZExtValue() & 0xff;
 
-// Mask the shift amount to width of two vectors.
-ShiftVal &= (2 * NumElts) - 1;
+// Mask the shift amount to width of a vector.
+ShiftVal &= NumElts - 1;
 
 int Indices[16];
 for (unsigned i = 0; i != NumElts; ++i)

diff  --git a/clang/test/CodeGen/X86/avx512vl-builtins.c 
b/clang/test/CodeGen/X86/avx512vl-builtins.c
index ef27542876a43..4a7226489f573 100644
--- a/clang/test/CodeGen/X86/avx512vl-builtins.c
+++ b/clang/test/CodeGen/X86/avx512vl-builtins.c
@@ -9426,7 +9426,7 @@ __m128i test_mm_mask_alignr_epi32(__m128i __W, __mmask8 
__U, __m128i __A, __m128
   // CHECK-LABEL: @test_mm_mask_alignr_epi32
   // CHECK: shufflevector <4 x i32> %{{.*}}, <4 x i32> %{{.*}}, <4 x i32> 
   // CHECK: select <4 x i1> %{{.*}}, <4 x i32> %{{.*}}, <4 x i32> %{{.*}}
-  return _mm_mask_alignr_epi32(__W, __U, __A, __B, 1);
+  return _mm_mask_alignr_epi32(__W, __U, __A, __B, 5);
 }
 
 __m128i test_mm_maskz_alignr_epi32(__mmask8 __U, __m128i __A, __m128i __B) {
@@ -9446,7 +9446,7 @@ __m256i test_mm256_mask_alignr_epi32(__m256i __W, 
__mmask8 __U, __m256i __A, __m
   // CHECK-LABEL: @test_mm256_mask_alignr_epi32
   // CHECK: shufflevector <8 x i32> %{{.*}}, <8 x i32> %{{.*}}, <8 x i32> 
   // CHECK: select <8 x i1> %{{.*}}, <8 x i32> %{{.*}}, <8 x i32> %{{.*}}
-  return _mm256_mask_alignr_epi32(__W, __U, __A, __B, 1);
+  return _mm256_mask_alignr_epi32(__W, __U, __A, __B, 9);
 }
 
 __m256i test_mm256_maskz_alignr_epi32(__mmask8 __U, __m256i __A, __m256i __B) {
@@ -9466,7 +9466,7 @@ __m128i test_mm_mask_alignr_epi64(__m128i __W, __mmask8 
__U, __m128i __A, __m128
   // CHECK-LABEL: @test_mm_mask_alignr_epi64
   // CHECK: shufflevector <2 x i64> %{{.*}}, <2 x i64> %{{.*}}, <2 x i32> 
   // CHECK: select <2 x i1> %{{.*}}, <2 x i64> %{{.*}}, <2 x i64> %{{.*}}
-  return _mm_mask_alignr_epi64(__W, __U, __A, __B, 1);
+  return _mm_mask_alignr_epi64(__W, __U, __A, __B, 3);
 }
 
 __m128i test_mm_maskz_alignr_epi64(__mmask8 __U, __m128i __A, __m128i __B) {
@@ -9486,7 +9486,7 @@ __m256i test_mm256_mask_alignr_epi64(__m256i __W, 
__mmask8 __U, __m256i __A, __m
   // CHECK-LABEL: @test_mm256_mask_alignr_epi64
   // CHECK: shufflevector <4 x i64> %{{.*}}, <4 x i64> %{{.*}}, <4 x i32> 
   // CHECK: select <4 x i1> %{{.*}}, <4 x i64> %{{.*}}, <4 x i64> %{{.*}}
-  return _mm256_mask_alignr_epi64(__W, __U, __A, __B, 1);
+  return _mm256_mask_alignr_epi64(__W, __U, __A, __B, 5);
 }
 
 __m256i test_mm256_maskz_alignr_epi64(__mmask8 __U, __m256i __A, __m256i __B) {



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


[PATCH] D104500: [clang] Apply P1825 as Defect Report from C++11 up to C++20.

2021-06-26 Thread Matheus Izvekov via Phabricator via cfe-commits
mizvekov added inline comments.



Comment at: clang/lib/Sema/SemaStmt.cpp:3478-3481
+// Check that overload resolution selected a conversion operator
+// taking an rvalue reference.
+if (cast(FD)->getRefQualifier() != RQ_RValue)
+  break;

rsmith wrote:
> Is the removal of this check for an rvalue ref qualifier a bugfix? If so, 
> please add a test. I suppose it would look something like this:
> ```
> struct B;
> struct A { A(B&) = delete; };
> struct B { operator A(); };
> A f() { B b; return b; }
> ```
> ... which would be ambiguous if we don't implicitly convert to xvalue, but if 
> we do, it selects a conversion function that is not rvalue-ref-qualified.
Yeah you are right. I was reading that section of the standard again in bed to 
try to get some sleep, and it suddenly clicked me that we were just supposed to 
be doing that first overload resolution with the expression as an xvalue and 
that is it. There was no reason to be anything else in there.
I just could not resist the urge to get up and fix it thought :)
I'll leave the test case for tomorrow though!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104500

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


[PATCH] D104500: [clang] Apply P1825 as Defect Report from C++11 up to C++20.

2021-06-26 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added inline comments.



Comment at: clang/lib/Sema/SemaStmt.cpp:3469
+if (Res == OR_Success || Res == OR_Deleted) {
+  // Promote "AsRvalue" to the heap, since we now need
+  // expression node to persist.

Looks like you lost a word in this comment.



Comment at: clang/lib/Sema/SemaStmt.cpp:3478-3481
+// Check that overload resolution selected a conversion operator
+// taking an rvalue reference.
+if (cast(FD)->getRefQualifier() != RQ_RValue)
+  break;

Is the removal of this check for an rvalue ref qualifier a bugfix? If so, 
please add a test. I suppose it would look something like this:
```
struct B;
struct A { A(B&) = delete; };
struct B { operator A(); };
A f() { B b; return b; }
```
... which would be ambiguous if we don't implicitly convert to xvalue, but if 
we do, it selects a conversion function that is not rvalue-ref-qualified.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104500

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


[PATCH] D104500: [clang] Apply P1825 as Defect Report from C++11 up to C++20.

2021-06-26 Thread Matheus Izvekov via Phabricator via cfe-commits
mizvekov updated this revision to Diff 354715.
mizvekov added a comment.

Simplify checking first overload reslution result.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104500

Files:
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Sema/Sema.h
  clang/lib/Sema/SemaStmt.cpp
  clang/test/CXX/class/class.init/class.copy.elision/p3.cpp
  clang/test/SemaCXX/P1155.cpp
  clang/test/SemaCXX/conversion-function.cpp
  clang/test/SemaCXX/warn-return-std-move.cpp
  clang/test/SemaObjCXX/block-capture.mm

Index: clang/test/SemaObjCXX/block-capture.mm
===
--- clang/test/SemaObjCXX/block-capture.mm
+++ clang/test/SemaObjCXX/block-capture.mm
@@ -1,7 +1,7 @@
-// RUN: %clang_cc1 -std=c++2b -fsyntax-only -fobjc-arc -fblocks   -verify=cxx98_2b,cxx20_2b,cxx2b %s
-// RUN: %clang_cc1 -std=c++20 -fsyntax-only -fobjc-arc -fblocks   -verify=cxx98_2b,cxx20_2b   %s
-// RUN: %clang_cc1 -std=c++11 -fsyntax-only -fobjc-arc -fblocks   -verify=cxx98_2b,cxx98_11   %s
-// RUN: %clang_cc1 -std=c++98 -fsyntax-only -fobjc-arc -fblocks -Wno-c++11-extensions -verify=cxx98_2b,cxx98_11   %s
+// RUN: %clang_cc1 -std=c++2b -fsyntax-only -fobjc-arc -fblocks   -verify=cxx98_2b,cxx11_2b,cxx2b %s
+// RUN: %clang_cc1 -std=c++20 -fsyntax-only -fobjc-arc -fblocks   -verify=cxx98_2b,cxx11_2b   %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -fobjc-arc -fblocks   -verify=cxx98_2b,cxx11_2b   %s
+// RUN: %clang_cc1 -std=c++98 -fsyntax-only -fobjc-arc -fblocks -Wno-c++11-extensions -verify=cxx98_2b,cxx98  %s
 
 #define TEST(T) void test_##T() { \
   __block T x;\
@@ -14,54 +14,68 @@
 };
 TEST(CopyOnly); // cxx2b-error {{no matching constructor}}
 
+struct ConstCopyOnly {
+  ConstCopyOnly();
+  ConstCopyOnly(ConstCopyOnly &) = delete; // cxx98-note {{marked deleted here}}
+  ConstCopyOnly(const ConstCopyOnly &);
+};
+TEST(ConstCopyOnly); // cxx98-error {{call to deleted constructor}}
+
+struct NonConstCopyOnly {
+  NonConstCopyOnly();
+  NonConstCopyOnly(NonConstCopyOnly &);
+  NonConstCopyOnly(const NonConstCopyOnly &) = delete; // cxx11_2b-note {{marked deleted here}}
+};
+TEST(NonConstCopyOnly); // cxx11_2b-error {{call to deleted constructor}}
+
 struct CopyNoMove {
   CopyNoMove();
   CopyNoMove(CopyNoMove &);
-  CopyNoMove(CopyNoMove &&) = delete; // cxx98_2b-note {{marked deleted here}}
+  CopyNoMove(CopyNoMove &&) = delete; // cxx11_2b-note {{marked deleted here}}
 };
-TEST(CopyNoMove); // cxx98_2b-error {{call to deleted constructor}}
+TEST(CopyNoMove); // cxx11_2b-error {{call to deleted constructor}}
 
 struct MoveOnly {
   MoveOnly();
-  MoveOnly(MoveOnly &) = delete;
+  MoveOnly(MoveOnly &) = delete; // cxx98-note {{marked deleted here}}
   MoveOnly(MoveOnly &&);
 };
-TEST(MoveOnly);
+TEST(MoveOnly); // cxx98-error {{call to deleted constructor}}
 
 struct NoCopyNoMove {
   NoCopyNoMove();
-  NoCopyNoMove(NoCopyNoMove &) = delete;
-  NoCopyNoMove(NoCopyNoMove &&) = delete; // cxx98_2b-note {{marked deleted here}}
+  NoCopyNoMove(NoCopyNoMove &) = delete;  // cxx98-note {{marked deleted here}}
+  NoCopyNoMove(NoCopyNoMove &&) = delete; // cxx11_2b-note {{marked deleted here}}
 };
 TEST(NoCopyNoMove); // cxx98_2b-error {{call to deleted constructor}}
 
 struct ConvertingRVRef {
   ConvertingRVRef();
-  ConvertingRVRef(ConvertingRVRef &) = delete; // cxx98_11-note {{marked deleted here}}
+  ConvertingRVRef(ConvertingRVRef &) = delete; // cxx98-note {{marked deleted here}}
 
   struct X {};
   ConvertingRVRef(X &&);
   operator X() const & = delete;
   operator X() &&;
 };
-TEST(ConvertingRVRef); // cxx98_11-error {{call to deleted constructor}}
+TEST(ConvertingRVRef); // cxx98-error {{call to deleted constructor}}
 
 struct ConvertingCLVRef {
   ConvertingCLVRef();
   ConvertingCLVRef(ConvertingCLVRef &);
 
   struct X {};
-  ConvertingCLVRef(X &&); // cxx20_2b-note {{passing argument to parameter here}}
+  ConvertingCLVRef(X &&); // cxx11_2b-note {{passing argument to parameter here}}
   operator X() const &;
-  operator X() && = delete; // cxx20_2b-note {{marked deleted here}}
+  operator X() && = delete; // cxx11_2b-note {{marked deleted here}}
 };
-TEST(ConvertingCLVRef); // cxx20_2b-error {{invokes a deleted function}}
+TEST(ConvertingCLVRef); // cxx11_2b-error {{invokes a deleted function}}
 
 struct SubSubMove {};
 struct SubMove : SubSubMove {
   SubMove();
-  SubMove(SubMove &) = delete; // cxx98_11-note {{marked deleted here}}
+  SubMove(SubMove &) = delete; // cxx98-note {{marked deleted here}}
 
   SubMove(SubSubMove &&);
 };
-TEST(SubMove); // cxx98_11-error {{call to deleted constructor}}
+TEST(SubMove); // cxx98-error {{call to deleted constructor}}
Index: 

[PATCH] D104753: [Driver] Stop linking _p libs for -pg on FreeBSD 14

2021-06-26 Thread Ed Maste via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG699d47472c3f: [Driver] do not link _p libs for -pg on 
FreeBSD 14 and later (authored by emaste).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104753

Files:
  clang/lib/Driver/ToolChains/FreeBSD.cpp
  clang/test/Driver/freebsd.cpp


Index: clang/test/Driver/freebsd.cpp
===
--- clang/test/Driver/freebsd.cpp
+++ clang/test/Driver/freebsd.cpp
@@ -5,9 +5,12 @@
 // CHECK-TEN: "-lc++" "-lm"
 // CHECK-NINE: "-lstdc++" "-lm"
 
+// RUN: %clangxx %s -### -pg -o %t.o -target amd64-unknown-freebsd40.0 
-stdlib=platform 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-PG-FOURTEEN %s
 // RUN: %clangxx %s -### -pg -o %t.o -target amd64-unknown-freebsd10.0 
-stdlib=platform 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-PG-TEN %s
 // RUN: %clangxx %s -### -pg -o %t.o -target amd64-unknown-freebsd9.2 
-stdlib=platform 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-PG-NINE %s
+// CHECK-PG-FOURTEEN: "-lc++" "-lm"
 // CHECK-PG-TEN: "-lc++_p" "-lm_p"
 // CHECK-PG-NINE: "-lstdc++_p" "-lm_p"
Index: clang/lib/Driver/ToolChains/FreeBSD.cpp
===
--- clang/lib/Driver/ToolChains/FreeBSD.cpp
+++ clang/lib/Driver/ToolChains/FreeBSD.cpp
@@ -293,6 +293,8 @@
   addLinkerCompressDebugSectionsOption(ToolChain, Args, CmdArgs);
   AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs, JA);
 
+  bool Profiling = Args.hasArg(options::OPT_pg) &&
+   ToolChain.getTriple().getOSMajorVersion() < 14;
   if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) {
 // Use the static OpenMP runtime with -static-openmp
 bool StaticOpenMP = Args.hasArg(options::OPT_static_openmp) &&
@@ -302,7 +304,7 @@
 if (D.CCCIsCXX()) {
   if (ToolChain.ShouldLinkCXXStdlib(Args))
 ToolChain.AddCXXStdlibLibArgs(Args, CmdArgs);
-  if (Args.hasArg(options::OPT_pg))
+  if (Profiling)
 CmdArgs.push_back("-lm_p");
   else
 CmdArgs.push_back("-lm");
@@ -313,13 +315,13 @@
   linkXRayRuntimeDeps(ToolChain, CmdArgs);
 // FIXME: For some reason GCC passes -lgcc and -lgcc_s before adding
 // the default system libraries. Just mimic this for now.
-if (Args.hasArg(options::OPT_pg))
+if (Profiling)
   CmdArgs.push_back("-lgcc_p");
 else
   CmdArgs.push_back("-lgcc");
 if (Args.hasArg(options::OPT_static)) {
   CmdArgs.push_back("-lgcc_eh");
-} else if (Args.hasArg(options::OPT_pg)) {
+} else if (Profiling) {
   CmdArgs.push_back("-lgcc_eh_p");
 } else {
   CmdArgs.push_back("--as-needed");
@@ -328,13 +330,13 @@
 }
 
 if (Args.hasArg(options::OPT_pthread)) {
-  if (Args.hasArg(options::OPT_pg))
+  if (Profiling)
 CmdArgs.push_back("-lpthread_p");
   else
 CmdArgs.push_back("-lpthread");
 }
 
-if (Args.hasArg(options::OPT_pg)) {
+if (Profiling) {
   if (Args.hasArg(options::OPT_shared))
 CmdArgs.push_back("-lc");
   else
@@ -347,7 +349,7 @@
 
 if (Args.hasArg(options::OPT_static)) {
   CmdArgs.push_back("-lgcc_eh");
-} else if (Args.hasArg(options::OPT_pg)) {
+} else if (Profiling) {
   CmdArgs.push_back("-lgcc_eh_p");
 } else {
   CmdArgs.push_back("--as-needed");
@@ -416,7 +418,8 @@
 void FreeBSD::AddCXXStdlibLibArgs(const ArgList ,
   ArgStringList ) const {
   CXXStdlibType Type = GetCXXStdlibType(Args);
-  bool Profiling = Args.hasArg(options::OPT_pg);
+  bool Profiling =
+  Args.hasArg(options::OPT_pg) && getTriple().getOSMajorVersion() < 14;
 
   switch (Type) {
   case ToolChain::CST_Libcxx:


Index: clang/test/Driver/freebsd.cpp
===
--- clang/test/Driver/freebsd.cpp
+++ clang/test/Driver/freebsd.cpp
@@ -5,9 +5,12 @@
 // CHECK-TEN: "-lc++" "-lm"
 // CHECK-NINE: "-lstdc++" "-lm"
 
+// RUN: %clangxx %s -### -pg -o %t.o -target amd64-unknown-freebsd40.0 -stdlib=platform 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-PG-FOURTEEN %s
 // RUN: %clangxx %s -### -pg -o %t.o -target amd64-unknown-freebsd10.0 -stdlib=platform 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-PG-TEN %s
 // RUN: %clangxx %s -### -pg -o %t.o -target amd64-unknown-freebsd9.2 -stdlib=platform 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-PG-NINE %s
+// CHECK-PG-FOURTEEN: "-lc++" "-lm"
 // CHECK-PG-TEN: "-lc++_p" "-lm_p"
 // CHECK-PG-NINE: "-lstdc++_p" "-lm_p"
Index: clang/lib/Driver/ToolChains/FreeBSD.cpp
===
--- clang/lib/Driver/ToolChains/FreeBSD.cpp
+++ clang/lib/Driver/ToolChains/FreeBSD.cpp
@@ -293,6 +293,8 @@
   

[clang] 699d474 - [Driver] do not link _p libs for -pg on FreeBSD 14 and later

2021-06-26 Thread Ed Maste via cfe-commits

Author: Ed Maste
Date: 2021-06-26T17:47:54-04:00
New Revision: 699d47472c3f7c5799fe75486689545179cfba03

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

LOG: [Driver] do not link _p libs for -pg on FreeBSD 14 and later

In FreeBSD 14 the project will deprecate the _p special profiling
libraries.

Support for -pg (i.e., mcount) still exists but libraries compiled
with -pg will not be built by default, so stop linking against them.

Reviewed by:Dimitry Andric
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.llvm.org/D104753

Added: 


Modified: 
clang/lib/Driver/ToolChains/FreeBSD.cpp
clang/test/Driver/freebsd.cpp

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/FreeBSD.cpp 
b/clang/lib/Driver/ToolChains/FreeBSD.cpp
index f8c6a81bf3bc0..5dcf74dabf4fc 100644
--- a/clang/lib/Driver/ToolChains/FreeBSD.cpp
+++ b/clang/lib/Driver/ToolChains/FreeBSD.cpp
@@ -293,6 +293,8 @@ void freebsd::Linker::ConstructJob(Compilation , const 
JobAction ,
   addLinkerCompressDebugSectionsOption(ToolChain, Args, CmdArgs);
   AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs, JA);
 
+  bool Profiling = Args.hasArg(options::OPT_pg) &&
+   ToolChain.getTriple().getOSMajorVersion() < 14;
   if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) {
 // Use the static OpenMP runtime with -static-openmp
 bool StaticOpenMP = Args.hasArg(options::OPT_static_openmp) &&
@@ -302,7 +304,7 @@ void freebsd::Linker::ConstructJob(Compilation , const 
JobAction ,
 if (D.CCCIsCXX()) {
   if (ToolChain.ShouldLinkCXXStdlib(Args))
 ToolChain.AddCXXStdlibLibArgs(Args, CmdArgs);
-  if (Args.hasArg(options::OPT_pg))
+  if (Profiling)
 CmdArgs.push_back("-lm_p");
   else
 CmdArgs.push_back("-lm");
@@ -313,13 +315,13 @@ void freebsd::Linker::ConstructJob(Compilation , const 
JobAction ,
   linkXRayRuntimeDeps(ToolChain, CmdArgs);
 // FIXME: For some reason GCC passes -lgcc and -lgcc_s before adding
 // the default system libraries. Just mimic this for now.
-if (Args.hasArg(options::OPT_pg))
+if (Profiling)
   CmdArgs.push_back("-lgcc_p");
 else
   CmdArgs.push_back("-lgcc");
 if (Args.hasArg(options::OPT_static)) {
   CmdArgs.push_back("-lgcc_eh");
-} else if (Args.hasArg(options::OPT_pg)) {
+} else if (Profiling) {
   CmdArgs.push_back("-lgcc_eh_p");
 } else {
   CmdArgs.push_back("--as-needed");
@@ -328,13 +330,13 @@ void freebsd::Linker::ConstructJob(Compilation , const 
JobAction ,
 }
 
 if (Args.hasArg(options::OPT_pthread)) {
-  if (Args.hasArg(options::OPT_pg))
+  if (Profiling)
 CmdArgs.push_back("-lpthread_p");
   else
 CmdArgs.push_back("-lpthread");
 }
 
-if (Args.hasArg(options::OPT_pg)) {
+if (Profiling) {
   if (Args.hasArg(options::OPT_shared))
 CmdArgs.push_back("-lc");
   else
@@ -347,7 +349,7 @@ void freebsd::Linker::ConstructJob(Compilation , const 
JobAction ,
 
 if (Args.hasArg(options::OPT_static)) {
   CmdArgs.push_back("-lgcc_eh");
-} else if (Args.hasArg(options::OPT_pg)) {
+} else if (Profiling) {
   CmdArgs.push_back("-lgcc_eh_p");
 } else {
   CmdArgs.push_back("--as-needed");
@@ -416,7 +418,8 @@ void FreeBSD::addLibStdCxxIncludePaths(
 void FreeBSD::AddCXXStdlibLibArgs(const ArgList ,
   ArgStringList ) const {
   CXXStdlibType Type = GetCXXStdlibType(Args);
-  bool Profiling = Args.hasArg(options::OPT_pg);
+  bool Profiling =
+  Args.hasArg(options::OPT_pg) && getTriple().getOSMajorVersion() < 14;
 
   switch (Type) {
   case ToolChain::CST_Libcxx:

diff  --git a/clang/test/Driver/freebsd.cpp b/clang/test/Driver/freebsd.cpp
index baf52f77dd07f..fde888902e12c 100644
--- a/clang/test/Driver/freebsd.cpp
+++ b/clang/test/Driver/freebsd.cpp
@@ -5,9 +5,12 @@
 // CHECK-TEN: "-lc++" "-lm"
 // CHECK-NINE: "-lstdc++" "-lm"
 
+// RUN: %clangxx %s -### -pg -o %t.o -target amd64-unknown-freebsd40.0 
-stdlib=platform 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-PG-FOURTEEN %s
 // RUN: %clangxx %s -### -pg -o %t.o -target amd64-unknown-freebsd10.0 
-stdlib=platform 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-PG-TEN %s
 // RUN: %clangxx %s -### -pg -o %t.o -target amd64-unknown-freebsd9.2 
-stdlib=platform 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-PG-NINE %s
+// CHECK-PG-FOURTEEN: "-lc++" "-lm"
 // CHECK-PG-TEN: "-lc++_p" "-lm_p"
 // CHECK-PG-NINE: "-lstdc++_p" "-lm_p"



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


[PATCH] D104601: [Preprocessor] Implement -fnormalize-whitespace.

2021-06-26 Thread David Blaikie via Phabricator via cfe-commits
dblaikie added a comment.

> Admittedly, I focused on changes (of Clang and Polly) like refactoring, 
> improving comments, minimize difference to upstream (clang-)formatting etc. 
> during the testing.

Yeah, I was more curious about general purpose/average changes, but anyway.

> In D104601#2831951 , @dblaikie 
> wrote:
>
>> One of the concerns I'd have, for instance (have you done some broad testing 
>> of these patches on sizable code bases?) is that it wouldn't surprise me if 
>> clang had some scalability bugs/issues with very long source lines - so it 
>> might be necessary to introduce some (arbitrary?) newlines to break up the 
>> code. Though I'm not sure - no need to do that pre-emptively, but might be 
>> good to have some data that indicates whether this might be a problem or not.
>
> I found no such issues during my trials. However, I think the request is 
> understandable an I would implement it on request. It introduces a new 
> problem having to determine where no newlines mat be introduced (e.g. within 
> a #pragma).

Yeah, no need to get ahead of that - just something to be aware of/on the look 
out if this feature ends up in use.

One other thing: This wouldn't be usable when using debug info, presumably, 
because it'd refer to the wrong lines, etc.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104601

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


[PATCH] D104984: [clang] add C++ feature test macro for P2266 simpler implicit move

2021-06-26 Thread Matheus Izvekov via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGd6144c30fb6a: [clang] add C++ feature test macro for P2266 
simpler implicit move (authored by mizvekov).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104984

Files:
  clang/lib/Frontend/InitPreprocessor.cpp
  clang/test/Lexer/cxx-features.cpp


Index: clang/test/Lexer/cxx-features.cpp
===
--- clang/test/Lexer/cxx-features.cpp
+++ clang/test/Lexer/cxx-features.cpp
@@ -31,6 +31,10 @@
 
 // --- C++2b features ---
 
+#if check(implicit_move, 0, 0, 0, 0, 0, 202011)
+#error "wrong value for __cpp_implicit_move"
+#endif
+
 #if check(size_t_suffix, 0, 0, 0, 0, 0, 202011)
 #error "wrong value for __cpp_size_t_suffix"
 #endif
Index: clang/lib/Frontend/InitPreprocessor.cpp
===
--- clang/lib/Frontend/InitPreprocessor.cpp
+++ clang/lib/Frontend/InitPreprocessor.cpp
@@ -597,8 +597,10 @@
 Builder.defineMacro("__cpp_using_enum", "201907L");
   }
   // C++2b features.
-  if (LangOpts.CPlusPlus2b)
+  if (LangOpts.CPlusPlus2b) {
+Builder.defineMacro("__cpp_implicit_move", "202011L");
 Builder.defineMacro("__cpp_size_t_suffix", "202011L");
+  }
   if (LangOpts.Char8)
 Builder.defineMacro("__cpp_char8_t", "201811L");
   Builder.defineMacro("__cpp_impl_destroying_delete", "201806L");


Index: clang/test/Lexer/cxx-features.cpp
===
--- clang/test/Lexer/cxx-features.cpp
+++ clang/test/Lexer/cxx-features.cpp
@@ -31,6 +31,10 @@
 
 // --- C++2b features ---
 
+#if check(implicit_move, 0, 0, 0, 0, 0, 202011)
+#error "wrong value for __cpp_implicit_move"
+#endif
+
 #if check(size_t_suffix, 0, 0, 0, 0, 0, 202011)
 #error "wrong value for __cpp_size_t_suffix"
 #endif
Index: clang/lib/Frontend/InitPreprocessor.cpp
===
--- clang/lib/Frontend/InitPreprocessor.cpp
+++ clang/lib/Frontend/InitPreprocessor.cpp
@@ -597,8 +597,10 @@
 Builder.defineMacro("__cpp_using_enum", "201907L");
   }
   // C++2b features.
-  if (LangOpts.CPlusPlus2b)
+  if (LangOpts.CPlusPlus2b) {
+Builder.defineMacro("__cpp_implicit_move", "202011L");
 Builder.defineMacro("__cpp_size_t_suffix", "202011L");
+  }
   if (LangOpts.Char8)
 Builder.defineMacro("__cpp_char8_t", "201811L");
   Builder.defineMacro("__cpp_impl_destroying_delete", "201806L");
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] d6144c3 - [clang] add C++ feature test macro for P2266 simpler implicit move

2021-06-26 Thread Matheus Izvekov via cfe-commits

Author: Matheus Izvekov
Date: 2021-06-26T23:05:23+02:00
New Revision: d6144c30fb6ae7ac15c82d512f8da7572577c2d2

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

LOG: [clang] add C++ feature test macro for P2266 simpler implicit move

The feature was implemented in D99005, but we forgot to add the test
macro.

Reviewed By: Quuxplusone

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

Added: 


Modified: 
clang/lib/Frontend/InitPreprocessor.cpp
clang/test/Lexer/cxx-features.cpp

Removed: 




diff  --git a/clang/lib/Frontend/InitPreprocessor.cpp 
b/clang/lib/Frontend/InitPreprocessor.cpp
index af1196f131925..bca0bb4ada672 100644
--- a/clang/lib/Frontend/InitPreprocessor.cpp
+++ b/clang/lib/Frontend/InitPreprocessor.cpp
@@ -597,8 +597,10 @@ static void InitializeCPlusPlusFeatureTestMacros(const 
LangOptions ,
 Builder.defineMacro("__cpp_using_enum", "201907L");
   }
   // C++2b features.
-  if (LangOpts.CPlusPlus2b)
+  if (LangOpts.CPlusPlus2b) {
+Builder.defineMacro("__cpp_implicit_move", "202011L");
 Builder.defineMacro("__cpp_size_t_suffix", "202011L");
+  }
   if (LangOpts.Char8)
 Builder.defineMacro("__cpp_char8_t", "201811L");
   Builder.defineMacro("__cpp_impl_destroying_delete", "201806L");

diff  --git a/clang/test/Lexer/cxx-features.cpp 
b/clang/test/Lexer/cxx-features.cpp
index 8f283dd8c8d9f..40c73f6019420 100644
--- a/clang/test/Lexer/cxx-features.cpp
+++ b/clang/test/Lexer/cxx-features.cpp
@@ -31,6 +31,10 @@
 
 // --- C++2b features ---
 
+#if check(implicit_move, 0, 0, 0, 0, 0, 202011)
+#error "wrong value for __cpp_implicit_move"
+#endif
+
 #if check(size_t_suffix, 0, 0, 0, 0, 0, 202011)
 #error "wrong value for __cpp_size_t_suffix"
 #endif



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


[PATCH] D104984: [clang] add C++ feature test macro for P2266 simpler implicit move

2021-06-26 Thread Matheus Izvekov via Phabricator via cfe-commits
mizvekov added a comment.

In D104984#2842656 , @Quuxplusone 
wrote:

> LGTM. I assume we pick the integer value `202011` for everything 
> C++2b-related until the standard ships with a real value in it, and then we 
> update our integer to match.

Yeah that is what I am going for here.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104984

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


[PATCH] D104984: [clang] add C++ feature test macro for P2266 simpler implicit move

2021-06-26 Thread Arthur O'Dwyer via Phabricator via cfe-commits
Quuxplusone accepted this revision.
Quuxplusone added a comment.
This revision is now accepted and ready to land.

LGTM. I assume we pick the integer value `202011` for everything C++2b-related 
until the standard ships with a real value in it, and then we update our 
integer to match.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104984

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


[PATCH] D104984: [clang] add C++ feature test macro for P2266 simpler implicit move

2021-06-26 Thread Matheus Izvekov via Phabricator via cfe-commits
mizvekov created this revision.
mizvekov requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

The feature was implemented in D99005 , but we 
forgot to add the test
macro.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D104984

Files:
  clang/lib/Frontend/InitPreprocessor.cpp
  clang/test/Lexer/cxx-features.cpp


Index: clang/test/Lexer/cxx-features.cpp
===
--- clang/test/Lexer/cxx-features.cpp
+++ clang/test/Lexer/cxx-features.cpp
@@ -31,6 +31,10 @@
 
 // --- C++2b features ---
 
+#if check(implicit_move, 0, 0, 0, 0, 0, 202011)
+#error "wrong value for __cpp_implicit_move"
+#endif
+
 #if check(size_t_suffix, 0, 0, 0, 0, 0, 202011)
 #error "wrong value for __cpp_size_t_suffix"
 #endif
Index: clang/lib/Frontend/InitPreprocessor.cpp
===
--- clang/lib/Frontend/InitPreprocessor.cpp
+++ clang/lib/Frontend/InitPreprocessor.cpp
@@ -597,8 +597,10 @@
 Builder.defineMacro("__cpp_using_enum", "201907L");
   }
   // C++2b features.
-  if (LangOpts.CPlusPlus2b)
+  if (LangOpts.CPlusPlus2b) {
+Builder.defineMacro("__cpp_implicit_move", "202011L");
 Builder.defineMacro("__cpp_size_t_suffix", "202011L");
+  }
   if (LangOpts.Char8)
 Builder.defineMacro("__cpp_char8_t", "201811L");
   Builder.defineMacro("__cpp_impl_destroying_delete", "201806L");


Index: clang/test/Lexer/cxx-features.cpp
===
--- clang/test/Lexer/cxx-features.cpp
+++ clang/test/Lexer/cxx-features.cpp
@@ -31,6 +31,10 @@
 
 // --- C++2b features ---
 
+#if check(implicit_move, 0, 0, 0, 0, 0, 202011)
+#error "wrong value for __cpp_implicit_move"
+#endif
+
 #if check(size_t_suffix, 0, 0, 0, 0, 0, 202011)
 #error "wrong value for __cpp_size_t_suffix"
 #endif
Index: clang/lib/Frontend/InitPreprocessor.cpp
===
--- clang/lib/Frontend/InitPreprocessor.cpp
+++ clang/lib/Frontend/InitPreprocessor.cpp
@@ -597,8 +597,10 @@
 Builder.defineMacro("__cpp_using_enum", "201907L");
   }
   // C++2b features.
-  if (LangOpts.CPlusPlus2b)
+  if (LangOpts.CPlusPlus2b) {
+Builder.defineMacro("__cpp_implicit_move", "202011L");
 Builder.defineMacro("__cpp_size_t_suffix", "202011L");
+  }
   if (LangOpts.Char8)
 Builder.defineMacro("__cpp_char8_t", "201811L");
   Builder.defineMacro("__cpp_impl_destroying_delete", "201806L");
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D104044: [clang-format] Fix the issue that empty lines being removed at the beginning of namespace

2021-06-26 Thread Darwin Xu via Phabricator via cfe-commits
darwin updated this revision to Diff 354696.
darwin marked an inline comment as done.
darwin added a comment.

Add new test cases according to the comments.


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

https://reviews.llvm.org/D104044

Files:
  clang/lib/Format/UnwrappedLineFormatter.cpp
  clang/lib/Format/UnwrappedLineFormatter.h
  clang/unittests/Format/FormatTest.cpp

Index: clang/unittests/Format/FormatTest.cpp
===
--- clang/unittests/Format/FormatTest.cpp
+++ clang/unittests/Format/FormatTest.cpp
@@ -262,6 +262,128 @@
"}",
getGoogleStyle()));
 
+  auto CustomStyle = clang::format::getLLVMStyle();
+  CustomStyle.BreakBeforeBraces = clang::format::FormatStyle::BS_Custom;
+  CustomStyle.BraceWrapping.AfterNamespace = true;
+  CustomStyle.KeepEmptyLinesAtTheStartOfBlocks = false;
+  EXPECT_EQ("namespace N\n"
+"{\n"
+"\n"
+"int i;\n"
+"}",
+format("namespace N\n"
+   "{\n"
+   "\n"
+   "\n"
+   "inti;\n"
+   "}",
+   CustomStyle));
+  EXPECT_EQ("/* something */ namespace N\n"
+"{\n"
+"\n"
+"int i;\n"
+"}",
+format("/* something */ namespace N {\n"
+   "\n"
+   "\n"
+   "inti;\n"
+   "}",
+   CustomStyle));
+  EXPECT_EQ("inline namespace N\n"
+"{\n"
+"\n"
+"int i;\n"
+"}",
+format("inline namespace N\n"
+   "{\n"
+   "\n"
+   "\n"
+   "inti;\n"
+   "}",
+   CustomStyle));
+  EXPECT_EQ("/* something */ inline namespace N\n"
+"{\n"
+"\n"
+"int i;\n"
+"}",
+format("/* something */ inline namespace N\n"
+   "{\n"
+   "\n"
+   "inti;\n"
+   "}",
+   CustomStyle));
+  EXPECT_EQ("export namespace N\n"
+"{\n"
+"\n"
+"int i;\n"
+"}",
+format("export namespace N\n"
+   "{\n"
+   "\n"
+   "inti;\n"
+   "}",
+   CustomStyle));
+  EXPECT_EQ("namespace a\n"
+"{\n"
+"namespace b\n"
+"{\n"
+"\n"
+"class AA {};\n"
+"\n"
+"} // namespace b\n"
+"} // namespace a\n",
+format("namespace a\n"
+   "{\n"
+   "namespace b\n"
+   "{\n"
+   "\n"
+   "\n"
+   "class AA {};\n"
+   "\n"
+   "\n"
+   "}\n"
+   "}\n",
+   CustomStyle));
+  EXPECT_EQ("namespace A /* comment */\n"
+"{\n"
+"class B {}\n"
+"} // namespace A",
+format("namespace A /* comment */ { class B {} }", CustomStyle));
+  EXPECT_EQ("namespace A\n"
+"{ /* comment */\n"
+"class B {}\n"
+"} // namespace A",
+format("namespace A {/* comment */ class B {} }", CustomStyle));
+  EXPECT_EQ("namespace A\n"
+"{ /* comment */\n"
+"\n"
+"class B {}\n"
+"\n"
+""
+"} // namespace A",
+format("namespace A { /* comment */\n"
+   "\n"
+   "\n"
+   "class B {}\n"
+   "\n"
+   "\n"
+   "}",
+   CustomStyle));
+  EXPECT_EQ("namespace A /* comment */\n"
+"{\n"
+"\n"
+"class B {}\n"
+"\n"
+"} // namespace A",
+format("namespace A/* comment */ {\n"
+   "\n"
+   "\n"
+   "class B {}\n"
+   "\n"
+   "\n"
+   "}",
+   CustomStyle));
+
   // ...but do keep inlining and removing empty lines for non-block extern "C"
   // functions.
   verifyFormat("extern \"C\" int f() { return 42; }", getGoogleStyle());
Index: clang/lib/Format/UnwrappedLineFormatter.h
===
--- clang/lib/Format/UnwrappedLineFormatter.h
+++ clang/lib/Format/UnwrappedLineFormatter.h
@@ -47,6 +47,7 @@
   /// of the \c UnwrappedLine if there was no structural parsing error.
   void formatFirstToken(const AnnotatedLine ,
 const AnnotatedLine *PreviousLine,
+const AnnotatedLine *PrevPrevLine,
 

[PATCH] D104616: [analyzer][WIP] Model comparision methods of std::unique_ptr

2021-06-26 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD updated this revision to Diff 354695.
RedDocMD added a comment.

First try at implementing conversion function from OverloadedOperatorKind to 
BinaryOperatorKind


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104616

Files:
  clang/lib/StaticAnalyzer/Checkers/SmartPtr.h
  clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp
  clang/test/Analysis/Inputs/system-header-simulator-cxx.h
  clang/test/Analysis/smart-ptr.cpp

Index: clang/test/Analysis/smart-ptr.cpp
===
--- clang/test/Analysis/smart-ptr.cpp
+++ clang/test/Analysis/smart-ptr.cpp
@@ -457,3 +457,32 @@
 P->foo(); // expected-warning {{Dereference of null smart pointer 'P' [alpha.cplusplus.SmartPtr]}}
   }
 }
+
+// The following is a silly function,
+// but serves to test if we are picking out
+// standard comparision functions from custom ones.
+template 
+bool operator<(std::unique_ptr , double d);
+
+void uniquePtrComparision(std::unique_ptr unknownPtr) {
+  auto ptr = std::unique_ptr(new int(13));
+  auto nullPtr = std::unique_ptr();
+  auto otherPtr = std::unique_ptr(new int(29));
+
+  clang_analyzer_eval(ptr == ptr); // expected-warning{{TRUE}}
+  clang_analyzer_eval(ptr > ptr);  // expected-warning{{FALSE}}
+  clang_analyzer_eval(ptr <= ptr); // expected-warning{{TRUE}}
+
+  clang_analyzer_eval(nullPtr <= unknownPtr); // expected-warning{{TRUE}}
+  clang_analyzer_eval(unknownPtr >= nullPtr); // expected-warning{{TRUE}}
+
+  clang_analyzer_eval(ptr != otherPtr); // expected-warning{{TRUE}}
+  clang_analyzer_eval(ptr > nullPtr);   // expected-warning{{TRUE}}
+
+  clang_analyzer_eval(ptr != nullptr);// expected-warning{{TRUE}}
+  clang_analyzer_eval(nullPtr != nullptr);// expected-warning{{FALSE}}
+  clang_analyzer_eval(nullptr <= unknownPtr); // expected-warning{{TRUE}}
+  clang_analyzer_eval(nullptr < unknownPtr);  // expected-warning{{UNKNOWN}}
+
+  clang_analyzer_eval(ptr < 2.0); // expected-warning{{UNKNOWN}}
+}
Index: clang/test/Analysis/Inputs/system-header-simulator-cxx.h
===
--- clang/test/Analysis/Inputs/system-header-simulator-cxx.h
+++ clang/test/Analysis/Inputs/system-header-simulator-cxx.h
@@ -978,6 +978,61 @@
 void swap(unique_ptr , unique_ptr ) noexcept {
   x.swap(y);
 }
+
+template 
+bool operator==(const unique_ptr , const unique_ptr );
+
+template 
+bool operator!=(const unique_ptr , const unique_ptr );
+
+template 
+bool operator<(const unique_ptr , const unique_ptr );
+
+template 
+bool operator>(const unique_ptr , const unique_ptr );
+
+template 
+bool operator<=(const unique_ptr , const unique_ptr );
+
+template 
+bool operator>=(const unique_ptr , const unique_ptr );
+
+template 
+bool operator==(const unique_ptr , nullptr_t y);
+
+template 
+bool operator!=(const unique_ptr , nullptr_t y);
+
+template 
+bool operator<(const unique_ptr , nullptr_t y);
+
+template 
+bool operator>(const unique_ptr , nullptr_t y);
+
+template 
+bool operator<=(const unique_ptr , nullptr_t y);
+
+template 
+bool operator>=(const unique_ptr , nullptr_t y);
+
+template 
+bool operator==(nullptr_t x, const unique_ptr );
+
+template 
+bool operator!=(nullptr_t x, const unique_ptr );
+
+template 
+bool operator>(nullptr_t x, const unique_ptr );
+
+template 
+bool operator<(nullptr_t x, const unique_ptr );
+
+template 
+bool operator>=(nullptr_t x, const unique_ptr );
+
+template 
+bool operator<=(nullptr_t x, const unique_ptr );
+
 } // namespace std
 #endif
 
Index: clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp
===
--- clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp
+++ clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp
@@ -29,7 +29,10 @@
 #include "clang/StaticAnalyzer/Core/PathSensitive/SVals.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/SymExpr.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h"
+#include "llvm/ADT/StringMap.h"
+#include "llvm/Support/ErrorHandling.h"
 #include 
+#include 
 
 using namespace clang;
 using namespace ento;
@@ -68,6 +71,7 @@
   bool updateMovedSmartPointers(CheckerContext , const MemRegion *ThisRegion,
 const MemRegion *OtherSmartPtrRegion) const;
   void handleBoolConversion(const CallEvent , CheckerContext ) const;
+  bool handleComparisionOp(const CallEvent , CheckerContext ) const;
 
   using SmartPtrMethodHandlerFn =
   void (SmartPtrModeling::*)(const CallEvent , CheckerContext &) const;
@@ -89,18 +93,24 @@
   const auto *MethodDecl = dyn_cast_or_null(Call.getDecl());
   if (!MethodDecl || !MethodDecl->getParent())
 return false;
+  return isStdSmartPtr(MethodDecl->getParent());
+}
 
-  const auto *RecordDecl = MethodDecl->getParent();
-  if (!RecordDecl || !RecordDecl->getDeclContext()->isStdNamespace())
+bool 

[PATCH] D104981: [clang-tidy] Add -line-filter to run-clang-tidy.py

2021-06-26 Thread Vincent LE GARREC via Phabricator via cfe-commits
bansan created this revision.
bansan added a reviewer: clang-tools-extra.
bansan added a project: clang-tools-extra.
Herald added a subscriber: xazax.hun.
bansan requested review of this revision.
Herald added a subscriber: cfe-commits.

This patch allows the use of --line-filter in clang-tidy.py from 
run-clang-tidy.py


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D104981

Files:
  clang-tools-extra/clang-tidy/tool/run-clang-tidy.py


Index: clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
===
--- clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
+++ clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
@@ -81,13 +81,16 @@
 
 def get_tidy_invocation(f, clang_tidy_binary, checks, tmpdir, build_path,
 header_filter, allow_enabling_alpha_checkers,
-extra_arg, extra_arg_before, quiet, config):
+extra_arg, extra_arg_before, quiet, config,
+line_filter):
   """Gets a command line for clang-tidy."""
   start = [clang_tidy_binary, '--use-color']
   if allow_enabling_alpha_checkers:
 start.append('-allow-enabling-analyzer-alpha-checkers')
   if header_filter is not None:
 start.append('-header-filter=' + header_filter)
+  if line_filter is not None:
+start.append('-line-filter=' + line_filter)
   if checks:
 start.append('-checks=' + checks)
   if tmpdir is not None:
@@ -165,7 +168,7 @@
  tmpdir, build_path, args.header_filter,
  args.allow_enabling_alpha_checkers,
  args.extra_arg, args.extra_arg_before,
- args.quiet, args.config)
+ args.quiet, args.config, args.line_filter)
 
 proc = subprocess.Popen(invocation, stdout=subprocess.PIPE, 
stderr=subprocess.PIPE)
 output, err = proc.communicate()
@@ -209,6 +212,9 @@
   'headers to output diagnostics from. Diagnostics from '
   'the main file of each translation unit are always '
   'displayed.')
+  parser.add_argument('-line-filter', default=None,
+  help='List of files with line ranges to filter the'
+  'warnings.')
   if yaml:
 parser.add_argument('-export-fixes', metavar='filename', 
dest='export_fixes',
 help='Create a yaml file to store suggested fixes in, '


Index: clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
===
--- clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
+++ clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
@@ -81,13 +81,16 @@
 
 def get_tidy_invocation(f, clang_tidy_binary, checks, tmpdir, build_path,
 header_filter, allow_enabling_alpha_checkers,
-extra_arg, extra_arg_before, quiet, config):
+extra_arg, extra_arg_before, quiet, config,
+line_filter):
   """Gets a command line for clang-tidy."""
   start = [clang_tidy_binary, '--use-color']
   if allow_enabling_alpha_checkers:
 start.append('-allow-enabling-analyzer-alpha-checkers')
   if header_filter is not None:
 start.append('-header-filter=' + header_filter)
+  if line_filter is not None:
+start.append('-line-filter=' + line_filter)
   if checks:
 start.append('-checks=' + checks)
   if tmpdir is not None:
@@ -165,7 +168,7 @@
  tmpdir, build_path, args.header_filter,
  args.allow_enabling_alpha_checkers,
  args.extra_arg, args.extra_arg_before,
- args.quiet, args.config)
+ args.quiet, args.config, args.line_filter)
 
 proc = subprocess.Popen(invocation, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
 output, err = proc.communicate()
@@ -209,6 +212,9 @@
   'headers to output diagnostics from. Diagnostics from '
   'the main file of each translation unit are always '
   'displayed.')
+  parser.add_argument('-line-filter', default=None,
+  help='List of files with line ranges to filter the'
+  'warnings.')
   if yaml:
 parser.add_argument('-export-fixes', metavar='filename', dest='export_fixes',
 help='Create a yaml file to store suggested fixes in, '
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D104900: [clang-format] PR50525 doesn't handle AlignConsecutiveAssignments correctly in some situations

2021-06-26 Thread Darwin Xu via Phabricator via cfe-commits
darwin added a comment.

Sorry I haven't had a chance to look at this bug before it has closed. But I do 
have question:

I observed that this code are formatted incorrectly by the same config:

  llvm::Optional CurrentCode = None;
  autoEnv = std::make_unique(Code,
   FileName,
   Ranges,
   FirstStartColumn,
   NextStartColumn,
   LastStartColumn);

Can this solution solve this issue? I am afraid not.

If no, should I open a new bug for it?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104900

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


[PATCH] D104790: [x86] fix mm*_undefined* intrinsics to use arbitrary frozen bit pattern

2021-06-26 Thread Nikita Popov via Phabricator via cfe-commits
nikic added a comment.

Is this actually better in any meaningful way? InstCombine will turn `freeze 
poison` into `zeroinitializer`, and until then this is just a completely opaque 
value.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104790

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


[PATCH] D104975: Implement P1949

2021-06-26 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin updated this revision to Diff 354684.
cor3ntin added a comment.

Missing EOF


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104975

Files:
  clang/include/clang/Basic/DiagnosticLexKinds.td
  clang/lib/Lex/Lexer.cpp
  clang/lib/Lex/UnicodeCharSets.h
  clang/test/CXX/drs/dr1xx.cpp
  clang/test/CXX/drs/dr2xx.cpp
  clang/test/CXX/drs/dr6xx.cpp
  clang/test/FixIt/fixit-unicode.c
  clang/test/Lexer/unicode.c
  clang/test/Parser/cxx11-user-defined-literals.cpp
  clang/test/Preprocessor/ucn-allowed-chars.c
  clang/test/Preprocessor/utf8-allowed-chars.c

Index: clang/test/Preprocessor/utf8-allowed-chars.c
===
--- clang/test/Preprocessor/utf8-allowed-chars.c
+++ clang/test/Preprocessor/utf8-allowed-chars.c
@@ -23,46 +23,30 @@
 
 
 
-
-
-
-
 #if __cplusplus
-# if __cplusplus >= 201103L
-// C++11
-// expected-warning@9 {{using this character in an identifier is incompatible with C++98}}
-// expected-warning@10 {{using this character in an identifier is incompatible with C++98}}
-// expected-error@13 {{non-ASCII characters are not allowed outside of literals and identifiers}}
-// expected-warning@14 {{using this character in an identifier is incompatible with C++98}}
+// expected-error@11 {{not allowed in identifiers}}
+// expected-error@13 {{not allowed in identifiers}}
+// expected-error@20 {{expected unqualified-id}}
 // expected-error@21 {{expected unqualified-id}}
 
-# else
-// C++03
-// expected-error@9 {{non-ASCII characters are not allowed outside of literals and identifiers}}
-// expected-error@10 {{non-ASCII characters are not allowed outside of literals and identifiers}}
-// expected-error@13 {{non-ASCII characters are not allowed outside of literals and identifiers}}
-// expected-error@14 {{non-ASCII characters are not allowed outside of literals and identifiers}}
-// expected-error@21 {{non-ASCII characters are not allowed outside of literals and identifiers}} expected-warning@21 {{declaration does not declare anything}}
-
-# endif
 #else
 # if __STDC_VERSION__ >= 201112L
 // C11
 // expected-warning@9 {{using this character in an identifier is incompatible with C99}}
 // expected-warning@11 {{using this character in an identifier is incompatible with C99}}
-// expected-error@13 {{non-ASCII characters are not allowed outside of literals and identifiers}}
+// expected-error@13 {{not allowed in identifiers}}
 // expected-warning@14 {{using this character in an identifier is incompatible with C99}}
 // expected-warning@20 {{starting an identifier with this character is incompatible with C99}}
 // expected-error@21 {{expected identifier}}
 
 # else
 // C99
-// expected-error@9 {{non-ASCII characters are not allowed outside of literals and identifiers}}
-// expected-error@11 {{non-ASCII characters are not allowed outside of literals and identifiers}}
-// expected-error@13 {{non-ASCII characters are not allowed outside of literals and identifiers}}
-// expected-error@14 {{non-ASCII characters are not allowed outside of literals and identifiers}}
+// expected-error@9 {{not allowed in identifiers}}
+// expected-error@11 {{not allowed in identifiers}}
+// expected-error@13 {{allowed in identifiers}}
+// expected-error@14 {{not allowed in identifiers}}
 // expected-error@20 {{expected identifier}}
-// expected-error@21 {{non-ASCII characters are not allowed outside of literals and identifiers}} expected-warning@21 {{declaration does not declare anything}}
+// expected-error@21 {{not allowed in identifiers}} expected-warning@21 {{declaration does not declare anything}}
 
 # endif
 #endif
Index: clang/test/Preprocessor/ucn-allowed-chars.c
===
--- clang/test/Preprocessor/ucn-allowed-chars.c
+++ clang/test/Preprocessor/ucn-allowed-chars.c
@@ -16,7 +16,7 @@
 
 // Identifier initial characters
 extern char \u0E50; // C++03, C11, C++11
-extern char \u0300; // disallowed initially in C11/C++11, always in C99/C++03
+extern char \u0300; // disallowed in C99/C++03
 extern char \u0D61; // C99, C11, C++03, C++11
 
 
@@ -38,19 +38,16 @@
 
 
 #if __cplusplus
+// expected-error@9 {{expected ';'}}
+// expected-error@11 {{expected ';'}}
+// expected-error@18 {{expected unqualified-id}}
 # if __cplusplus >= 201103L
 // C++11
-// expected-warning@7 {{using this character in an identifier is incompatible with C++98}}
-// expected-warning@8 {{using this character in an identifier is incompatible with C++98}}
-// expected-error@11 {{expected ';'}}
 // expected-error@19 {{expected unqualified-id}}
 // expected-error@33 {{invalid universal character}}
 
 # else
 // C++03
-// expected-error@7 {{expected ';'}}
-// expected-error@8 {{expected ';'}}
-// expected-error@11 {{expected ';'}}
 // expected-error@19 {{expected unqualified-id}}
 // expected-warning@33 {{universal character name refers to a surrogate character}}
 

[PATCH] D104975: Implement P1949

2021-06-26 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin updated this revision to Diff 354683.
cor3ntin added a comment.

Improve commit message


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104975

Files:
  clang/include/clang/Basic/DiagnosticLexKinds.td
  clang/lib/Lex/Lexer.cpp
  clang/lib/Lex/UnicodeCharSets.h
  clang/test/CXX/drs/dr1xx.cpp
  clang/test/CXX/drs/dr2xx.cpp
  clang/test/CXX/drs/dr6xx.cpp
  clang/test/FixIt/fixit-unicode.c
  clang/test/Lexer/unicode.c
  clang/test/Parser/cxx11-user-defined-literals.cpp
  clang/test/Preprocessor/ucn-allowed-chars.c
  clang/test/Preprocessor/utf8-allowed-chars.c

Index: clang/test/Preprocessor/utf8-allowed-chars.c
===
--- clang/test/Preprocessor/utf8-allowed-chars.c
+++ clang/test/Preprocessor/utf8-allowed-chars.c
@@ -23,46 +23,30 @@
 
 
 
-
-
-
-
 #if __cplusplus
-# if __cplusplus >= 201103L
-// C++11
-// expected-warning@9 {{using this character in an identifier is incompatible with C++98}}
-// expected-warning@10 {{using this character in an identifier is incompatible with C++98}}
-// expected-error@13 {{non-ASCII characters are not allowed outside of literals and identifiers}}
-// expected-warning@14 {{using this character in an identifier is incompatible with C++98}}
+// expected-error@11 {{not allowed in identifiers}}
+// expected-error@13 {{not allowed in identifiers}}
+// expected-error@20 {{expected unqualified-id}}
 // expected-error@21 {{expected unqualified-id}}
 
-# else
-// C++03
-// expected-error@9 {{non-ASCII characters are not allowed outside of literals and identifiers}}
-// expected-error@10 {{non-ASCII characters are not allowed outside of literals and identifiers}}
-// expected-error@13 {{non-ASCII characters are not allowed outside of literals and identifiers}}
-// expected-error@14 {{non-ASCII characters are not allowed outside of literals and identifiers}}
-// expected-error@21 {{non-ASCII characters are not allowed outside of literals and identifiers}} expected-warning@21 {{declaration does not declare anything}}
-
-# endif
 #else
 # if __STDC_VERSION__ >= 201112L
 // C11
 // expected-warning@9 {{using this character in an identifier is incompatible with C99}}
 // expected-warning@11 {{using this character in an identifier is incompatible with C99}}
-// expected-error@13 {{non-ASCII characters are not allowed outside of literals and identifiers}}
+// expected-error@13 {{not allowed in identifiers}}
 // expected-warning@14 {{using this character in an identifier is incompatible with C99}}
 // expected-warning@20 {{starting an identifier with this character is incompatible with C99}}
 // expected-error@21 {{expected identifier}}
 
 # else
 // C99
-// expected-error@9 {{non-ASCII characters are not allowed outside of literals and identifiers}}
-// expected-error@11 {{non-ASCII characters are not allowed outside of literals and identifiers}}
-// expected-error@13 {{non-ASCII characters are not allowed outside of literals and identifiers}}
-// expected-error@14 {{non-ASCII characters are not allowed outside of literals and identifiers}}
+// expected-error@9 {{not allowed in identifiers}}
+// expected-error@11 {{not allowed in identifiers}}
+// expected-error@13 {{allowed in identifiers}}
+// expected-error@14 {{not allowed in identifiers}}
 // expected-error@20 {{expected identifier}}
-// expected-error@21 {{non-ASCII characters are not allowed outside of literals and identifiers}} expected-warning@21 {{declaration does not declare anything}}
+// expected-error@21 {{not allowed in identifiers}} expected-warning@21 {{declaration does not declare anything}}
 
 # endif
 #endif
Index: clang/test/Preprocessor/ucn-allowed-chars.c
===
--- clang/test/Preprocessor/ucn-allowed-chars.c
+++ clang/test/Preprocessor/ucn-allowed-chars.c
@@ -16,7 +16,7 @@
 
 // Identifier initial characters
 extern char \u0E50; // C++03, C11, C++11
-extern char \u0300; // disallowed initially in C11/C++11, always in C99/C++03
+extern char \u0300; // disallowed in C99/C++03
 extern char \u0D61; // C99, C11, C++03, C++11
 
 
@@ -38,19 +38,16 @@
 
 
 #if __cplusplus
+// expected-error@9 {{expected ';'}}
+// expected-error@11 {{expected ';'}}
+// expected-error@18 {{expected unqualified-id}}
 # if __cplusplus >= 201103L
 // C++11
-// expected-warning@7 {{using this character in an identifier is incompatible with C++98}}
-// expected-warning@8 {{using this character in an identifier is incompatible with C++98}}
-// expected-error@11 {{expected ';'}}
 // expected-error@19 {{expected unqualified-id}}
 // expected-error@33 {{invalid universal character}}
 
 # else
 // C++03
-// expected-error@7 {{expected ';'}}
-// expected-error@8 {{expected ';'}}
-// expected-error@11 {{expected ';'}}
 // expected-error@19 {{expected unqualified-id}}
 // expected-warning@33 {{universal character name refers to a surrogate 

[PATCH] D104790: [x86] fix mm*_undefined* intrinsics to use arbitrary frozen bit pattern

2021-06-26 Thread Juneyoung Lee via Phabricator via cfe-commits
aqjune added a comment.

In D104790#2836463 , @craig.topper 
wrote:

> In D104790#2836253 , @aqjune wrote:
>
>> I couldn't find end-to-end tests for checking assembly generation.
>> To check whether this is working ok, which tests should I write and how 
>> would it look like?
>
> There are tests like test/CodeGen/X86/avx-intrinsics-fast-isel.ll that are 
> supposed to contain the IR the frontend generates. They mostly contain 
> optimized IR, but then run fast-isel in the backend. I don't think all 
> intrinsics are tested this way.

Thank you for the info. I updated three *-fast-isel.ll files to check this.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104790

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


[PATCH] D104790: [x86] fix mm*_undefined* intrinsics to use arbitrary frozen bit pattern

2021-06-26 Thread Juneyoung Lee via Phabricator via cfe-commits
aqjune updated this revision to Diff 354682.
aqjune added a comment.

- Update llvm/test/CodeGen/X86/sse-intrinsics-fast-isel.ll as well


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104790

Files:
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/test/CodeGen/X86/avx-builtins.c
  clang/test/CodeGen/X86/avx2-builtins.c
  clang/test/CodeGen/X86/avx512f-builtins.c
  clang/test/CodeGen/X86/sse-builtins.c
  clang/test/CodeGen/X86/sse2-builtins.c
  llvm/include/llvm/CodeGen/SelectionDAGNodes.h
  llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  llvm/lib/Target/X86/X86ISelLowering.cpp
  llvm/test/CodeGen/X86/avx-intrinsics-fast-isel.ll
  llvm/test/CodeGen/X86/sse-intrinsics-fast-isel.ll
  llvm/test/CodeGen/X86/sse2-intrinsics-fast-isel.ll

Index: llvm/test/CodeGen/X86/sse2-intrinsics-fast-isel.ll
===
--- llvm/test/CodeGen/X86/sse2-intrinsics-fast-isel.ll
+++ llvm/test/CodeGen/X86/sse2-intrinsics-fast-isel.ll
@@ -6390,14 +6390,17 @@
 ; CHECK-LABEL: test_mm_undefined_pd:
 ; CHECK:   # %bb.0:
 ; CHECK-NEXT:ret{{[l|q]}} # encoding: [0xc3]
-  ret <2 x double> undef
+  %v = freeze <2 x double> poison
+  ret <2 x double> %v
 }
 
 define <2 x i64> @test_mm_undefined_si128() {
 ; CHECK-LABEL: test_mm_undefined_si128:
 ; CHECK:   # %bb.0:
 ; CHECK-NEXT:ret{{[l|q]}} # encoding: [0xc3]
-  ret <2 x i64> undef
+  %v = freeze <2 x double> poison
+  %w = bitcast <2 x double> %v to <2 x i64>
+  ret <2 x i64> %w
 }
 
 define <2 x i64> @test_mm_unpackhi_epi8(<2 x i64> %a0, <2 x i64> %a1) {
Index: llvm/test/CodeGen/X86/sse-intrinsics-fast-isel.ll
===
--- llvm/test/CodeGen/X86/sse-intrinsics-fast-isel.ll
+++ llvm/test/CodeGen/X86/sse-intrinsics-fast-isel.ll
@@ -3513,7 +3513,9 @@
 ; CHECK-LABEL: test_mm_undefined_ps:
 ; CHECK:   # %bb.0:
 ; CHECK-NEXT:ret{{[l|q]}} # encoding: [0xc3]
-  ret <4 x float> undef
+  %v = freeze <2 x double> poison
+  %w = bitcast <2 x double> %v to <4 x float>
+  ret <4 x float> %w
 }
 
 define <4 x float> @test_mm_unpackhi_ps(<4 x float> %a0, <4 x float> %a1) nounwind {
Index: llvm/test/CodeGen/X86/avx-intrinsics-fast-isel.ll
===
--- llvm/test/CodeGen/X86/avx-intrinsics-fast-isel.ll
+++ llvm/test/CodeGen/X86/avx-intrinsics-fast-isel.ll
@@ -2965,32 +2965,55 @@
 }
 declare i32 @llvm.x86.avx.ptestz.256(<4 x i64>, <4 x i64>) nounwind readnone
 
-define <2 x double> @test_mm_undefined_pd() nounwind {
-; CHECK-LABEL: test_mm_undefined_pd:
-; CHECK:   # %bb.0:
-; CHECK-NEXT:ret{{[l|q]}}
-  ret <2 x double> undef
-}
-
 define <4 x double> @test_mm256_undefined_pd() nounwind {
 ; CHECK-LABEL: test_mm256_undefined_pd:
 ; CHECK:   # %bb.0:
 ; CHECK-NEXT:ret{{[l|q]}}
-  ret <4 x double> undef
+  %v = freeze <4 x double> poison
+  ret <4 x double> %v
 }
 
 define <8 x float> @test_mm256_undefined_ps() nounwind {
 ; CHECK-LABEL: test_mm256_undefined_ps:
 ; CHECK:   # %bb.0:
 ; CHECK-NEXT:ret{{[l|q]}}
-  ret <8 x float> undef
+  %v = freeze <4 x double> poison
+  %w = bitcast <4 x double> %v to <8 x float>
+  ret <8 x float> %w
 }
 
 define <4 x i64> @test_mm256_undefined_si256() nounwind {
 ; CHECK-LABEL: test_mm256_undefined_si256:
 ; CHECK:   # %bb.0:
 ; CHECK-NEXT:ret{{[l|q]}}
-  ret <4 x i64> undef
+  %v = freeze <4 x double> poison
+  %w = bitcast <4 x double> %v to <4 x i64>
+  ret <4 x i64> %w
+}
+
+define <16 x float> @test_mm512_undefined() nounwind {
+; CHECK-LABEL: test_mm512_undefined:
+; CHECK:   # %bb.0:
+; CHECK-NEXT:ret{{[l|q]}}
+  %v = freeze <8 x double> poison
+  %w = bitcast <8 x double> %v to <16 x float>
+  ret <16 x float> %w
+}
+
+define <8 x double> @test_mm512_undefined_pd() nounwind {
+; CHECK-LABEL: test_mm512_undefined_pd:
+; CHECK:   # %bb.0:
+; CHECK-NEXT:ret{{[l|q]}}
+  %v = freeze <8 x double> poison
+  ret <8 x double> %v
+}
+
+define <8 x i64> @test_mm512_undefined_epi32() nounwind {
+; CHECK-LABEL: test_mm512_undefined_epi32:
+; CHECK:   # %bb.0:
+; CHECK-NEXT:ret{{[l|q]}}
+  %v = freeze <8 x i64> poison
+  ret <8 x i64> %v
 }
 
 define <4 x double> @test_mm256_unpackhi_pd(<4 x double> %a0, <4 x double> %a1) nounwind {
Index: llvm/lib/Target/X86/X86ISelLowering.cpp
===
--- llvm/lib/Target/X86/X86ISelLowering.cpp
+++ llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -26011,10 +26011,11 @@
 TLI.getPointerTy(DAG.getDataLayout()));
   EVT MaskVT = Mask.getValueType().changeVectorElementTypeToInteger();
   SDVTList VTs = DAG.getVTList(Op.getValueType(), MVT::Other);
-  // If source is undef or we know it won't be used, use a zero vector
-  // to break register dependency.
+  // If source is undef, frozen undef with one use only, or we
+  // know it 

[PATCH] D104975: Implement P1949

2021-06-26 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin updated this revision to Diff 354681.
cor3ntin added a comment.

More code format


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104975

Files:
  clang/include/clang/Basic/DiagnosticLexKinds.td
  clang/lib/Lex/Lexer.cpp
  clang/lib/Lex/UnicodeCharSets.h
  clang/test/CXX/drs/dr1xx.cpp
  clang/test/CXX/drs/dr2xx.cpp
  clang/test/CXX/drs/dr6xx.cpp
  clang/test/FixIt/fixit-unicode.c
  clang/test/Lexer/unicode.c
  clang/test/Parser/cxx11-user-defined-literals.cpp
  clang/test/Preprocessor/ucn-allowed-chars.c
  clang/test/Preprocessor/utf8-allowed-chars.c

Index: clang/test/Preprocessor/utf8-allowed-chars.c
===
--- clang/test/Preprocessor/utf8-allowed-chars.c
+++ clang/test/Preprocessor/utf8-allowed-chars.c
@@ -23,46 +23,30 @@
 
 
 
-
-
-
-
 #if __cplusplus
-# if __cplusplus >= 201103L
-// C++11
-// expected-warning@9 {{using this character in an identifier is incompatible with C++98}}
-// expected-warning@10 {{using this character in an identifier is incompatible with C++98}}
-// expected-error@13 {{non-ASCII characters are not allowed outside of literals and identifiers}}
-// expected-warning@14 {{using this character in an identifier is incompatible with C++98}}
+// expected-error@11 {{not allowed in identifiers}}
+// expected-error@13 {{not allowed in identifiers}}
+// expected-error@20 {{expected unqualified-id}}
 // expected-error@21 {{expected unqualified-id}}
 
-# else
-// C++03
-// expected-error@9 {{non-ASCII characters are not allowed outside of literals and identifiers}}
-// expected-error@10 {{non-ASCII characters are not allowed outside of literals and identifiers}}
-// expected-error@13 {{non-ASCII characters are not allowed outside of literals and identifiers}}
-// expected-error@14 {{non-ASCII characters are not allowed outside of literals and identifiers}}
-// expected-error@21 {{non-ASCII characters are not allowed outside of literals and identifiers}} expected-warning@21 {{declaration does not declare anything}}
-
-# endif
 #else
 # if __STDC_VERSION__ >= 201112L
 // C11
 // expected-warning@9 {{using this character in an identifier is incompatible with C99}}
 // expected-warning@11 {{using this character in an identifier is incompatible with C99}}
-// expected-error@13 {{non-ASCII characters are not allowed outside of literals and identifiers}}
+// expected-error@13 {{not allowed in identifiers}}
 // expected-warning@14 {{using this character in an identifier is incompatible with C99}}
 // expected-warning@20 {{starting an identifier with this character is incompatible with C99}}
 // expected-error@21 {{expected identifier}}
 
 # else
 // C99
-// expected-error@9 {{non-ASCII characters are not allowed outside of literals and identifiers}}
-// expected-error@11 {{non-ASCII characters are not allowed outside of literals and identifiers}}
-// expected-error@13 {{non-ASCII characters are not allowed outside of literals and identifiers}}
-// expected-error@14 {{non-ASCII characters are not allowed outside of literals and identifiers}}
+// expected-error@9 {{not allowed in identifiers}}
+// expected-error@11 {{not allowed in identifiers}}
+// expected-error@13 {{allowed in identifiers}}
+// expected-error@14 {{not allowed in identifiers}}
 // expected-error@20 {{expected identifier}}
-// expected-error@21 {{non-ASCII characters are not allowed outside of literals and identifiers}} expected-warning@21 {{declaration does not declare anything}}
+// expected-error@21 {{not allowed in identifiers}} expected-warning@21 {{declaration does not declare anything}}
 
 # endif
 #endif
Index: clang/test/Preprocessor/ucn-allowed-chars.c
===
--- clang/test/Preprocessor/ucn-allowed-chars.c
+++ clang/test/Preprocessor/ucn-allowed-chars.c
@@ -16,7 +16,7 @@
 
 // Identifier initial characters
 extern char \u0E50; // C++03, C11, C++11
-extern char \u0300; // disallowed initially in C11/C++11, always in C99/C++03
+extern char \u0300; // disallowed in C99/C++03
 extern char \u0D61; // C99, C11, C++03, C++11
 
 
@@ -38,19 +38,16 @@
 
 
 #if __cplusplus
+// expected-error@9 {{expected ';'}}
+// expected-error@11 {{expected ';'}}
+// expected-error@18 {{expected unqualified-id}}
 # if __cplusplus >= 201103L
 // C++11
-// expected-warning@7 {{using this character in an identifier is incompatible with C++98}}
-// expected-warning@8 {{using this character in an identifier is incompatible with C++98}}
-// expected-error@11 {{expected ';'}}
 // expected-error@19 {{expected unqualified-id}}
 // expected-error@33 {{invalid universal character}}
 
 # else
 // C++03
-// expected-error@7 {{expected ';'}}
-// expected-error@8 {{expected ';'}}
-// expected-error@11 {{expected ';'}}
 // expected-error@19 {{expected unqualified-id}}
 // expected-warning@33 {{universal character name refers to a surrogate 

[PATCH] D104975: Implement P1949

2021-06-26 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin updated this revision to Diff 354679.
cor3ntin added a comment.

Clang format, cleanup and better diagnostics


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104975

Files:
  clang/include/clang/Basic/DiagnosticLexKinds.td
  clang/lib/Lex/Lexer.cpp
  clang/lib/Lex/UnicodeCharSets.h
  clang/test/CXX/drs/dr1xx.cpp
  clang/test/CXX/drs/dr2xx.cpp
  clang/test/CXX/drs/dr6xx.cpp
  clang/test/FixIt/fixit-unicode.c
  clang/test/Lexer/unicode.c
  clang/test/Parser/cxx11-user-defined-literals.cpp
  clang/test/Preprocessor/ucn-allowed-chars.c
  clang/test/Preprocessor/utf8-allowed-chars.c

Index: clang/test/Preprocessor/utf8-allowed-chars.c
===
--- clang/test/Preprocessor/utf8-allowed-chars.c
+++ clang/test/Preprocessor/utf8-allowed-chars.c
@@ -23,46 +23,30 @@
 
 
 
-
-
-
-
 #if __cplusplus
-# if __cplusplus >= 201103L
-// C++11
-// expected-warning@9 {{using this character in an identifier is incompatible with C++98}}
-// expected-warning@10 {{using this character in an identifier is incompatible with C++98}}
-// expected-error@13 {{non-ASCII characters are not allowed outside of literals and identifiers}}
-// expected-warning@14 {{using this character in an identifier is incompatible with C++98}}
+// expected-error@11 {{not allowed in identifiers}}
+// expected-error@13 {{not allowed in identifiers}}
+// expected-error@20 {{expected unqualified-id}}
 // expected-error@21 {{expected unqualified-id}}
 
-# else
-// C++03
-// expected-error@9 {{non-ASCII characters are not allowed outside of literals and identifiers}}
-// expected-error@10 {{non-ASCII characters are not allowed outside of literals and identifiers}}
-// expected-error@13 {{non-ASCII characters are not allowed outside of literals and identifiers}}
-// expected-error@14 {{non-ASCII characters are not allowed outside of literals and identifiers}}
-// expected-error@21 {{non-ASCII characters are not allowed outside of literals and identifiers}} expected-warning@21 {{declaration does not declare anything}}
-
-# endif
 #else
 # if __STDC_VERSION__ >= 201112L
 // C11
 // expected-warning@9 {{using this character in an identifier is incompatible with C99}}
 // expected-warning@11 {{using this character in an identifier is incompatible with C99}}
-// expected-error@13 {{non-ASCII characters are not allowed outside of literals and identifiers}}
+// expected-error@13 {{not allowed in identifiers}}
 // expected-warning@14 {{using this character in an identifier is incompatible with C99}}
 // expected-warning@20 {{starting an identifier with this character is incompatible with C99}}
 // expected-error@21 {{expected identifier}}
 
 # else
 // C99
-// expected-error@9 {{non-ASCII characters are not allowed outside of literals and identifiers}}
-// expected-error@11 {{non-ASCII characters are not allowed outside of literals and identifiers}}
-// expected-error@13 {{non-ASCII characters are not allowed outside of literals and identifiers}}
-// expected-error@14 {{non-ASCII characters are not allowed outside of literals and identifiers}}
+// expected-error@9 {{not allowed in identifiers}}
+// expected-error@11 {{not allowed in identifiers}}
+// expected-error@13 {{allowed in identifiers}}
+// expected-error@14 {{not allowed in identifiers}}
 // expected-error@20 {{expected identifier}}
-// expected-error@21 {{non-ASCII characters are not allowed outside of literals and identifiers}} expected-warning@21 {{declaration does not declare anything}}
+// expected-error@21 {{not allowed in identifiers}} expected-warning@21 {{declaration does not declare anything}}
 
 # endif
 #endif
Index: clang/test/Preprocessor/ucn-allowed-chars.c
===
--- clang/test/Preprocessor/ucn-allowed-chars.c
+++ clang/test/Preprocessor/ucn-allowed-chars.c
@@ -16,7 +16,7 @@
 
 // Identifier initial characters
 extern char \u0E50; // C++03, C11, C++11
-extern char \u0300; // disallowed initially in C11/C++11, always in C99/C++03
+extern char \u0300; // disallowed in C99/C++03
 extern char \u0D61; // C99, C11, C++03, C++11
 
 
@@ -38,19 +38,16 @@
 
 
 #if __cplusplus
+// expected-error@9 {{expected ';'}}
+// expected-error@11 {{expected ';'}}
+// expected-error@18 {{expected unqualified-id}}
 # if __cplusplus >= 201103L
 // C++11
-// expected-warning@7 {{using this character in an identifier is incompatible with C++98}}
-// expected-warning@8 {{using this character in an identifier is incompatible with C++98}}
-// expected-error@11 {{expected ';'}}
 // expected-error@19 {{expected unqualified-id}}
 // expected-error@33 {{invalid universal character}}
 
 # else
 // C++03
-// expected-error@7 {{expected ';'}}
-// expected-error@8 {{expected ';'}}
-// expected-error@11 {{expected ';'}}
 // expected-error@19 {{expected unqualified-id}}
 // expected-warning@33 {{universal character name 

[PATCH] D104790: [x86] fix mm*_undefined* intrinsics to use arbitrary frozen bit pattern

2021-06-26 Thread Juneyoung Lee via Phabricator via cfe-commits
aqjune updated this revision to Diff 354678.
aqjune added a comment.

Minor fixes


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104790

Files:
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/test/CodeGen/X86/avx-builtins.c
  clang/test/CodeGen/X86/avx2-builtins.c
  clang/test/CodeGen/X86/avx512f-builtins.c
  clang/test/CodeGen/X86/sse-builtins.c
  clang/test/CodeGen/X86/sse2-builtins.c
  llvm/include/llvm/CodeGen/SelectionDAGNodes.h
  llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  llvm/lib/Target/X86/X86ISelLowering.cpp
  llvm/test/CodeGen/X86/avx-intrinsics-fast-isel.ll
  llvm/test/CodeGen/X86/sse2-intrinsics-fast-isel.ll

Index: llvm/test/CodeGen/X86/sse2-intrinsics-fast-isel.ll
===
--- llvm/test/CodeGen/X86/sse2-intrinsics-fast-isel.ll
+++ llvm/test/CodeGen/X86/sse2-intrinsics-fast-isel.ll
@@ -6386,18 +6386,30 @@
 }
 declare i32 @llvm.x86.sse2.ucomineq.sd(<2 x double>, <2 x double>) nounwind readnone
 
+define <4 x float> @test_mm_undefined_ps() {
+; CHECK-LABEL: test_mm_undefined_ps:
+; CHECK:   # %bb.0:
+; CHECK-NEXT:ret{{[l|q]}} # encoding: [0xc3]
+  %v = freeze <2 x double> poison
+  %w = bitcast <2 x double> %v to <4 x float>
+  ret <4 x float> %w
+}
+
 define <2 x double> @test_mm_undefined_pd() {
 ; CHECK-LABEL: test_mm_undefined_pd:
 ; CHECK:   # %bb.0:
 ; CHECK-NEXT:ret{{[l|q]}} # encoding: [0xc3]
-  ret <2 x double> undef
+  %v = freeze <2 x double> poison
+  ret <2 x double> %v
 }
 
 define <2 x i64> @test_mm_undefined_si128() {
 ; CHECK-LABEL: test_mm_undefined_si128:
 ; CHECK:   # %bb.0:
 ; CHECK-NEXT:ret{{[l|q]}} # encoding: [0xc3]
-  ret <2 x i64> undef
+  %v = freeze <2 x double> poison
+  %w = bitcast <2 x double> %v to <2 x i64>
+  ret <2 x i64> %w
 }
 
 define <2 x i64> @test_mm_unpackhi_epi8(<2 x i64> %a0, <2 x i64> %a1) {
Index: llvm/test/CodeGen/X86/avx-intrinsics-fast-isel.ll
===
--- llvm/test/CodeGen/X86/avx-intrinsics-fast-isel.ll
+++ llvm/test/CodeGen/X86/avx-intrinsics-fast-isel.ll
@@ -2965,32 +2965,55 @@
 }
 declare i32 @llvm.x86.avx.ptestz.256(<4 x i64>, <4 x i64>) nounwind readnone
 
-define <2 x double> @test_mm_undefined_pd() nounwind {
-; CHECK-LABEL: test_mm_undefined_pd:
-; CHECK:   # %bb.0:
-; CHECK-NEXT:ret{{[l|q]}}
-  ret <2 x double> undef
-}
-
 define <4 x double> @test_mm256_undefined_pd() nounwind {
 ; CHECK-LABEL: test_mm256_undefined_pd:
 ; CHECK:   # %bb.0:
 ; CHECK-NEXT:ret{{[l|q]}}
-  ret <4 x double> undef
+  %v = freeze <4 x double> poison
+  ret <4 x double> %v
 }
 
 define <8 x float> @test_mm256_undefined_ps() nounwind {
 ; CHECK-LABEL: test_mm256_undefined_ps:
 ; CHECK:   # %bb.0:
 ; CHECK-NEXT:ret{{[l|q]}}
-  ret <8 x float> undef
+  %v = freeze <4 x double> poison
+  %w = bitcast <4 x double> %v to <8 x float>
+  ret <8 x float> %w
 }
 
 define <4 x i64> @test_mm256_undefined_si256() nounwind {
 ; CHECK-LABEL: test_mm256_undefined_si256:
 ; CHECK:   # %bb.0:
 ; CHECK-NEXT:ret{{[l|q]}}
-  ret <4 x i64> undef
+  %v = freeze <4 x double> poison
+  %w = bitcast <4 x double> %v to <4 x i64>
+  ret <4 x i64> %w
+}
+
+define <16 x float> @test_mm512_undefined() nounwind {
+; CHECK-LABEL: test_mm512_undefined:
+; CHECK:   # %bb.0:
+; CHECK-NEXT:ret{{[l|q]}}
+  %v = freeze <8 x double> poison
+  %w = bitcast <8 x double> %v to <16 x float>
+  ret <16 x float> %w
+}
+
+define <8 x double> @test_mm512_undefined_pd() nounwind {
+; CHECK-LABEL: test_mm512_undefined_pd:
+; CHECK:   # %bb.0:
+; CHECK-NEXT:ret{{[l|q]}}
+  %v = freeze <8 x double> poison
+  ret <8 x double> %v
+}
+
+define <8 x i64> @test_mm512_undefined_epi32() nounwind {
+; CHECK-LABEL: test_mm512_undefined_epi32:
+; CHECK:   # %bb.0:
+; CHECK-NEXT:ret{{[l|q]}}
+  %v = freeze <8 x i64> poison
+  ret <8 x i64> %v
 }
 
 define <4 x double> @test_mm256_unpackhi_pd(<4 x double> %a0, <4 x double> %a1) nounwind {
Index: llvm/lib/Target/X86/X86ISelLowering.cpp
===
--- llvm/lib/Target/X86/X86ISelLowering.cpp
+++ llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -26011,10 +26011,11 @@
 TLI.getPointerTy(DAG.getDataLayout()));
   EVT MaskVT = Mask.getValueType().changeVectorElementTypeToInteger();
   SDVTList VTs = DAG.getVTList(Op.getValueType(), MVT::Other);
-  // If source is undef or we know it won't be used, use a zero vector
-  // to break register dependency.
+  // If source is undef, frozen undef with one use only, or we
+  // know it won't be used, use a zero vector to break register dependency.
   // TODO: use undef instead and let BreakFalseDeps deal with it?
-  if (Src.isUndef() || ISD::isBuildVectorAllOnes(Mask.getNode()))
+  if (Src.isUndef() || (Src.isFreezeUndef() && Src.hasOneUse()) ||
+  

[PATCH] D104790: [x86] fix mm*_undefined* intrinsics to use arbitrary frozen bit pattern

2021-06-26 Thread Juneyoung Lee via Phabricator via cfe-commits
aqjune updated this revision to Diff 354675.
aqjune added a comment.
Herald added subscribers: llvm-commits, ecnelises, hiraditya.
Herald added a project: LLVM.

- Update llvm's fast-isels tests for undefined intrinsics to compile 
freeze(poison)
- Update X86ISelLowering's getAVX2GatherNode and getGatherNode to consider 
freeze(poison) as well
- Update DAGCombiner to fold bitcast(freeze(poison)) -> freeze(poison)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104790

Files:
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/test/CodeGen/X86/avx-builtins.c
  clang/test/CodeGen/X86/avx2-builtins.c
  clang/test/CodeGen/X86/avx512f-builtins.c
  clang/test/CodeGen/X86/sse-builtins.c
  clang/test/CodeGen/X86/sse2-builtins.c
  llvm/include/llvm/CodeGen/SelectionDAGNodes.h
  llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  llvm/lib/Target/X86/X86ISelLowering.cpp
  llvm/test/CodeGen/X86/avx-intrinsics-fast-isel.ll
  llvm/test/CodeGen/X86/sse2-intrinsics-fast-isel.ll

Index: llvm/test/CodeGen/X86/sse2-intrinsics-fast-isel.ll
===
--- llvm/test/CodeGen/X86/sse2-intrinsics-fast-isel.ll
+++ llvm/test/CodeGen/X86/sse2-intrinsics-fast-isel.ll
@@ -6386,18 +6386,30 @@
 }
 declare i32 @llvm.x86.sse2.ucomineq.sd(<2 x double>, <2 x double>) nounwind readnone
 
+define <4 x float> @test_mm_undefined_ps() {
+; CHECK-LABEL: test_mm_undefined_ps:
+; CHECK:   # %bb.0:
+; CHECK-NEXT:ret{{[l|q]}} # encoding: [0xc3]
+  %v = freeze <2 x double> poison
+  %w = bitcast <2 x double> %v to <4 x float>
+  ret <4 x float> %w
+}
+
 define <2 x double> @test_mm_undefined_pd() {
 ; CHECK-LABEL: test_mm_undefined_pd:
 ; CHECK:   # %bb.0:
 ; CHECK-NEXT:ret{{[l|q]}} # encoding: [0xc3]
-  ret <2 x double> undef
+  %v = freeze <2 x double> poison
+  ret <2 x double> %v
 }
 
 define <2 x i64> @test_mm_undefined_si128() {
 ; CHECK-LABEL: test_mm_undefined_si128:
 ; CHECK:   # %bb.0:
 ; CHECK-NEXT:ret{{[l|q]}} # encoding: [0xc3]
-  ret <2 x i64> undef
+  %v = freeze <2 x double> poison
+  %w = bitcast <2 x double> %v to <2 x i64>
+  ret <2 x i64> %w
 }
 
 define <2 x i64> @test_mm_unpackhi_epi8(<2 x i64> %a0, <2 x i64> %a1) {
Index: llvm/test/CodeGen/X86/avx-intrinsics-fast-isel.ll
===
--- llvm/test/CodeGen/X86/avx-intrinsics-fast-isel.ll
+++ llvm/test/CodeGen/X86/avx-intrinsics-fast-isel.ll
@@ -2965,32 +2965,55 @@
 }
 declare i32 @llvm.x86.avx.ptestz.256(<4 x i64>, <4 x i64>) nounwind readnone
 
-define <2 x double> @test_mm_undefined_pd() nounwind {
-; CHECK-LABEL: test_mm_undefined_pd:
-; CHECK:   # %bb.0:
-; CHECK-NEXT:ret{{[l|q]}}
-  ret <2 x double> undef
-}
-
 define <4 x double> @test_mm256_undefined_pd() nounwind {
 ; CHECK-LABEL: test_mm256_undefined_pd:
 ; CHECK:   # %bb.0:
 ; CHECK-NEXT:ret{{[l|q]}}
-  ret <4 x double> undef
+  %v = freeze <4 x double> poison
+  ret <4 x double> %v
 }
 
 define <8 x float> @test_mm256_undefined_ps() nounwind {
 ; CHECK-LABEL: test_mm256_undefined_ps:
 ; CHECK:   # %bb.0:
 ; CHECK-NEXT:ret{{[l|q]}}
-  ret <8 x float> undef
+  %v = freeze <4 x double> poison
+  %w = bitcast <4 x double> %v to <8 x float>
+  ret <8 x float> %w
 }
 
 define <4 x i64> @test_mm256_undefined_si256() nounwind {
 ; CHECK-LABEL: test_mm256_undefined_si256:
 ; CHECK:   # %bb.0:
 ; CHECK-NEXT:ret{{[l|q]}}
-  ret <4 x i64> undef
+  %v = freeze <4 x double> poison
+  %w = bitcast <4 x double> %v to <4 x i64>
+  ret <4 x i64> %w
+}
+
+define <16 x float> @test_mm512_undefined() nounwind {
+; CHECK-LABEL: test_mm512_undefined:
+; CHECK:   # %bb.0:
+; CHECK-NEXT:ret{{[l|q]}}
+  %v = freeze <8 x double> poison
+  %w = bitcast <8 x double> %v to <16 x float>
+  ret <16 x float> %w
+}
+
+define <8 x double> @test_mm512_undefined_pd() nounwind {
+; CHECK-LABEL: test_mm512_undefined_pd:
+; CHECK:   # %bb.0:
+; CHECK-NEXT:ret{{[l|q]}}
+  %v = freeze <8 x double> poison
+  ret <8 x double> %v
+}
+
+define <8 x i64> @test_mm512_undefined_epi32() nounwind {
+; CHECK-LABEL: test_mm512_undefined_epi32:
+; CHECK:   # %bb.0:
+; CHECK-NEXT:ret{{[l|q]}}
+  %v = freeze <8 x i64> poison
+  ret <8 x i64> %v
 }
 
 define <4 x double> @test_mm256_unpackhi_pd(<4 x double> %a0, <4 x double> %a1) nounwind {
Index: llvm/lib/Target/X86/X86ISelLowering.cpp
===
--- llvm/lib/Target/X86/X86ISelLowering.cpp
+++ llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -26011,10 +26011,11 @@
 TLI.getPointerTy(DAG.getDataLayout()));
   EVT MaskVT = Mask.getValueType().changeVectorElementTypeToInteger();
   SDVTList VTs = DAG.getVTList(Op.getValueType(), MVT::Other);
-  // If source is undef or we know it won't be used, use a zero vector
-  // to break register dependency.
+  // If source is undef or its 

[PATCH] D93528: [clang-format] Add basic support for formatting JSON

2021-06-26 Thread MyDeveloperDay via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG8b7881a084d0: [clang-format] Add basic support for 
formatting JSON (authored by MyDeveloperDay).

Changed prior to commit:
  https://reviews.llvm.org/D93528?vs=353570=354674#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93528

Files:
  clang/docs/ClangFormat.rst
  clang/docs/ClangFormatStyleOptions.rst
  clang/docs/ReleaseNotes.rst
  clang/include/clang/Format/Format.h
  clang/lib/Format/ContinuationIndenter.cpp
  clang/lib/Format/Format.cpp
  clang/lib/Format/TokenAnnotator.cpp
  clang/tools/clang-format/ClangFormat.cpp
  clang/tools/clang-format/clang-format-diff.py
  clang/tools/clang-format/git-clang-format
  clang/unittests/Format/CMakeLists.txt
  clang/unittests/Format/FormatTestJson.cpp

Index: clang/unittests/Format/FormatTestJson.cpp
===
--- /dev/null
+++ clang/unittests/Format/FormatTestJson.cpp
@@ -0,0 +1,197 @@
+//===- unittest/Format/FormatTestJson.cpp - Formatting tests for Json -===//
+//
+// 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
+//
+//===--===//
+
+#include "FormatTestUtils.h"
+#include "clang/Format/Format.h"
+#include "llvm/Support/Debug.h"
+#include "gtest/gtest.h"
+
+#define DEBUG_TYPE "format-test-json"
+
+namespace clang {
+namespace format {
+
+class FormatTestJson : public ::testing::Test {
+protected:
+  static std::string format(llvm::StringRef Code, unsigned Offset,
+unsigned Length, const FormatStyle ) {
+LLVM_DEBUG(llvm::errs() << "---\n");
+LLVM_DEBUG(llvm::errs() << Code << "\n\n");
+
+tooling::Replacements Replaces;
+
+// Mock up what ClangFormat.cpp will do for JSON by adding a variable
+// to trick JSON into being JavaScript
+if (Style.isJson()) {
+  auto Err = Replaces.add(
+  tooling::Replacement(tooling::Replacement("", 0, 0, "x = ")));
+  if (Err) {
+llvm::errs() << "Bad Json variable insertion\n";
+  }
+}
+auto ChangedCode = applyAllReplacements(Code, Replaces);
+if (!ChangedCode) {
+  llvm::errs() << "Bad Json varibale replacement\n";
+}
+StringRef NewCode = *ChangedCode;
+
+std::vector Ranges(1, tooling::Range(0, NewCode.size()));
+Replaces = reformat(Style, NewCode, Ranges);
+auto Result = applyAllReplacements(NewCode, Replaces);
+EXPECT_TRUE(static_cast(Result));
+LLVM_DEBUG(llvm::errs() << "\n" << *Result << "\n\n");
+return *Result;
+  }
+
+  static std::string
+  format(llvm::StringRef Code,
+ const FormatStyle  = getLLVMStyle(FormatStyle::LK_Json)) {
+return format(Code, 0, Code.size(), Style);
+  }
+
+  static FormatStyle getStyleWithColumns(unsigned ColumnLimit) {
+FormatStyle Style = getLLVMStyle(FormatStyle::LK_Json);
+Style.ColumnLimit = ColumnLimit;
+return Style;
+  }
+
+  static void
+  verifyFormat(llvm::StringRef Code,
+   const FormatStyle  = getLLVMStyle(FormatStyle::LK_Json)) {
+EXPECT_EQ(Code.str(), format(Code, Style)) << "Expected code is not stable";
+EXPECT_EQ(Code.str(), format(test::messUp(Code), Style));
+  }
+};
+
+TEST_F(FormatTestJson, JsonRecord) {
+  verifyFormat("{}");
+  verifyFormat("{\n"
+   "  \"name\": 1\n"
+   "}");
+  verifyFormat("{\n"
+   "  \"name\": \"Foo\"\n"
+   "}");
+  verifyFormat("{\n"
+   "  \"name\": {\n"
+   "\"value\": 1\n"
+   "  }\n"
+   "}");
+  verifyFormat("{\n"
+   "  \"name\": {\n"
+   "\"value\": 1\n"
+   "  },\n"
+   "  \"name\": {\n"
+   "\"value\": 2\n"
+   "  }\n"
+   "}");
+  verifyFormat("{\n"
+   "  \"name\": {\n"
+   "\"value\": [\n"
+   "  1,\n"
+   "  2,\n"
+   "]\n"
+   "  }\n"
+   "}");
+  verifyFormat("{\n"
+   "  \"name\": {\n"
+   "\"value\": [\n"
+   "  \"name\": {\n"
+   "\"value\": 1\n"
+   "  },\n"
+   "  \"name\": {\n"
+   "\"value\": 2\n"
+   "  }\n"
+   "]\n"
+   "  }\n"
+   "}");
+  verifyFormat(R"({
+  "firstName": "John",
+  "lastName": "Smith",
+  "isAlive": true,
+  "age": 27,
+  "address": {
+"streetAddress": "21 2nd Street",
+"city": "New York",
+"state": "NY",
+"postalCode": "10021-3100"
+  },
+  "phoneNumbers": [
+{
+  "type": "home",
+  "number": 

[clang] 8b7881a - [clang-format] Add basic support for formatting JSON

2021-06-26 Thread via cfe-commits

Author: mydeveloperday
Date: 2021-06-26T15:20:17+01:00
New Revision: 8b7881a084d0bc26499cf93e4ac45b59257a03b3

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

LOG: [clang-format] Add basic support for formatting JSON

I find as I develop I'm moving between many different languages 
C++,C#,JavaScript all the time. As I move between the file types I like to keep 
`clang-format` as my formatting tool of choice. (hence why I initially added C# 
support  in {D58404}) I know those other languages have their own tools but I 
have to learn them all, and I have to work out how to configure them, and they 
may or may not have integration into my IDE or my source code integration.

I am increasingly finding that I'm editing additional JSON files as part of my 
daily work and my editor and git commit hooks are just not setup to go and run 
[[ https://stedolan.github.io/jq/ | jq ]], So I tend to go to  [[ 
https://jsonformatter.curiousconcept.com/ | JSON Formatter ]] and copy and 
paste back and forth. To get nicely formatted JSON. This is a painful process 
and I'd like a new one that causes me much less friction.

This has come up from time to time:

{D10543}
https://stackoverflow.com/questions/35856565/clang-format-a-json-file
https://bugs.llvm.org/show_bug.cgi?id=18699

I would like to stop having to do that and have formatting JSON as a first 
class clang-format support `Language` (even if it has minimal style settings at 
present).

This revision adds support for formatting JSON using the inbuilt JSON 
serialization library of LLVM, With limited control at present only over the 
indentation level

This adds an additional Language into the .clang-format file to separate the 
settings from your other supported languages.

Reviewed By: HazardyKnusperkeks

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

Added: 
clang/unittests/Format/FormatTestJson.cpp

Modified: 
clang/docs/ClangFormat.rst
clang/docs/ClangFormatStyleOptions.rst
clang/docs/ReleaseNotes.rst
clang/include/clang/Format/Format.h
clang/lib/Format/ContinuationIndenter.cpp
clang/lib/Format/Format.cpp
clang/lib/Format/TokenAnnotator.cpp
clang/tools/clang-format/ClangFormat.cpp
clang/tools/clang-format/clang-format-diff.py
clang/tools/clang-format/git-clang-format
clang/unittests/Format/CMakeLists.txt

Removed: 




diff  --git a/clang/docs/ClangFormat.rst b/clang/docs/ClangFormat.rst
index d5333c0032b4..4a1422e85b06 100644
--- a/clang/docs/ClangFormat.rst
+++ b/clang/docs/ClangFormat.rst
@@ -11,12 +11,12 @@ Standalone Tool
 ===
 
 :program:`clang-format` is located in `clang/tools/clang-format` and can be 
used
-to format C/C++/Java/JavaScript/Objective-C/Protobuf/C# code.
+to format C/C++/Java/JavaScript/JSON/Objective-C/Protobuf/C# code.
 
 .. code-block:: console
 
   $ clang-format -help
-  OVERVIEW: A tool to format C/C++/Java/JavaScript/Objective-C/Protobuf/C# 
code.
+  OVERVIEW: A tool to format 
C/C++/Java/JavaScript/JSON/Objective-C/Protobuf/C# code.
 
   If no arguments are specified, it formats the code from standard input
   and writes the result to the standard output.

diff  --git a/clang/docs/ClangFormatStyleOptions.rst 
b/clang/docs/ClangFormatStyleOptions.rst
index fd19cdfc3e60..96d89db7a5cc 100644
--- a/clang/docs/ClangFormatStyleOptions.rst
+++ b/clang/docs/ClangFormatStyleOptions.rst
@@ -2919,6 +2919,9 @@ the configuration (without a prefix: ``Auto``).
   * ``LK_JavaScript`` (in configuration: ``JavaScript``)
 Should be used for JavaScript.
 
+  * ``LK_Json`` (in configuration: ``Json``)
+Should be used for JSON.
+
   * ``LK_ObjC`` (in configuration: ``ObjC``)
 Should be used for Objective-C, Objective-C++.
 

diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 7b23c1ef77af..f26c484c5bac 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -278,6 +278,8 @@ clang-format
 - Option ``AlignArrayOfStructure`` has been added to allow for ordering 
array-like
   initializers.
 
+- Support for formatting JSON file (\*.json) has been added to clang-format.
+
 libclang
 
 

diff  --git a/clang/include/clang/Format/Format.h 
b/clang/include/clang/Format/Format.h
index 515ac42d42f5..c424e79a971c 100644
--- a/clang/include/clang/Format/Format.h
+++ b/clang/include/clang/Format/Format.h
@@ -2493,6 +2493,8 @@ struct FormatStyle {
 LK_Java,
 /// Should be used for JavaScript.
 LK_JavaScript,
+/// Should be used for JSON.
+LK_Json,
 /// Should be used for Objective-C, Objective-C++.
 LK_ObjC,
 /// Should be used for Protocol Buffers
@@ -2506,6 +2508,7 @@ struct FormatStyle {
   };
   bool isCpp() const { return Language == LK_Cpp || Language == LK_ObjC; }
   bool 

[PATCH] D104975: Implement P1949

2021-06-26 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin added a comment.

In D104975#2842425 , @jfb wrote:

> It would be more user friendly to say which character is not allowed in the 
> diagnostic.

Agreed

> Do we need to have a backwards compatible flag to preserve the old behavior, 
> or do we believe that nobody will be affected by the change? We should make 
> this choice explicitly and state it in the patch description.

I have been wondering about that.
I came to the conclusion it would probably not be worth it. Until fairly 
recently Unicode identifiers in GCC were not really usable and therefore not 
used afaik.
I haven't seen people use emojis or other interesting symbol in non toy code.

I'll try to make that clearer in the commit message




Comment at: clang/lib/Lex/Lexer.cpp:1462
+  static const llvm::sys::UnicodeCharSet XIDStartChars(XIDStartRanges);
+  return C == '_' || XIDStartChars.contains(C);
+  } else if (LangOpts.C11) {

Quuxplusone wrote:
> This is overly indented (or your editor snuck in some hard tabs).
> Why is `'_'` treated specially, here and on line 1444 above? Shouldn't it 
> just be included in the `XIDStartChars` set?
This is intentional
C++ treats `_` as valid in identifiers, Unicode doesn't. Putting it in the 
array with the other characters is a sure-fire way to have someone drop it




Comment at: clang/lib/Lex/Lexer.cpp:1503-1511
-  // Check C++98 compatibility.
-  if (!Diags.isIgnored(diag::warn_cxx98_compat_unicode_id, Range.getBegin())) {
-static const llvm::sys::UnicodeCharSet CXX03AllowedIDChars(
-CXX03AllowedIDCharRanges);
-if (!CXX03AllowedIDChars.contains(C)) {
-  Diags.Report(Range.getBegin(), diag::warn_cxx98_compat_unicode_id)
-<< Range;

Quuxplusone wrote:
> Why remove this diagnostic? This looks unintentional.
> 
> But if it is intentional, then besides justifying it in the commit message 
> (and splitting out this removal into a separate PR), you should remove the 
> enumerator from `DiagnosticLexKinds.td`.
The diagnostic should be removed indeed.
Because the PR applies the paper as a DR to all versions of C++, it is no 
longer useful to diagnostic changes between c++ versions



Comment at: clang/test/Lexer/unicode.c:31
+extern int ; // expected-error {{character not allowed in identifier}} 
expected-warning {{declaration does not declare anything}}
+int v=[=](auto){return~x;}();;  // expected-error 12{{character not allowed in 
identifier}} expected-error {{expected ';'}}
+// expected-error@-1 {{expected unqualified-id}}

Quuxplusone wrote:
> Why 12 errors? Are these `{` `(` etc. characters not the ASCII versions? If 
> so, this test is needlessly confusing, and should be rewritten with one 
> character per test case, as in lines 43-53 below. (Except line 46, which is 
> also bad. :))
> 
> I don't understand why you're disabling the existing tests. In particular, 
> line 43 tests the error message for GREEK QUESTION MARK, which is important 
> to preserve.
Having 2 sets of completely different diagnostics (for C++ and C) proved a lot 
more complicated than doing two separate tests.
The `GREEK QUESTION MARK` is no longer important to preserve - it tests for 
confusing characters - which cannot happen in C++.
I agree that the test above is not super meaningful.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104975

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


[PATCH] D104975: Implement P1949

2021-06-26 Thread JF Bastien via Phabricator via cfe-commits
jfb added a comment.

It would be more user friendly to say which character is not allowed in the 
diagnostic.

Do we need to have a backwards compatible flag to preserve the old behavior, or 
do we believe that nobody will be affected by the change? We should make this 
choice explicitly and state it in the patch description.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104975

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


[PATCH] D104975: Implement P1949

2021-06-26 Thread Arthur O'Dwyer via Phabricator via cfe-commits
Quuxplusone added inline comments.



Comment at: clang/lib/Lex/Lexer.cpp:1462
+  static const llvm::sys::UnicodeCharSet XIDStartChars(XIDStartRanges);
+  return C == '_' || XIDStartChars.contains(C);
+  } else if (LangOpts.C11) {

This is overly indented (or your editor snuck in some hard tabs).
Why is `'_'` treated specially, here and on line 1444 above? Shouldn't it just 
be included in the `XIDStartChars` set?



Comment at: clang/lib/Lex/Lexer.cpp:1503-1511
-  // Check C++98 compatibility.
-  if (!Diags.isIgnored(diag::warn_cxx98_compat_unicode_id, Range.getBegin())) {
-static const llvm::sys::UnicodeCharSet CXX03AllowedIDChars(
-CXX03AllowedIDCharRanges);
-if (!CXX03AllowedIDChars.contains(C)) {
-  Diags.Report(Range.getBegin(), diag::warn_cxx98_compat_unicode_id)
-<< Range;

Why remove this diagnostic? This looks unintentional.

But if it is intentional, then besides justifying it in the commit message (and 
splitting out this removal into a separate PR), you should remove the 
enumerator from `DiagnosticLexKinds.td`.



Comment at: clang/lib/Lex/UnicodeCharSets.h:229
+static const llvm::sys::UnicodeCharRange XIDContinueRanges[] = {
+{0x0030, 0x0039},   {0x005F, 0x005F},   {0x00B7, 0x00B7},
+{0x0300, 0x036F},   {0x0387, 0x0387},   {0x0483, 0x0487},

Ah, here we go. `0x005F` is underscore. It should be in the XIDStart table 
instead.



Comment at: clang/test/Lexer/unicode.c:31
+extern int ; // expected-error {{character not allowed in identifier}} 
expected-warning {{declaration does not declare anything}}
+int v=[=](auto){return~x;}();;  // expected-error 12{{character not allowed in 
identifier}} expected-error {{expected ';'}}
+// expected-error@-1 {{expected unqualified-id}}

Why 12 errors? Are these `{` `(` etc. characters not the ASCII versions? If so, 
this test is needlessly confusing, and should be rewritten with one character 
per test case, as in lines 43-53 below. (Except line 46, which is also bad. :))

I don't understand why you're disabling the existing tests. In particular, line 
43 tests the error message for GREEK QUESTION MARK, which is important to 
preserve.



Comment at: clang/test/Preprocessor/ucn-pp-identifier.c:31
 
-#define a\u0024
+#define a\u00c0
 

This test shouldn't need tweaking, should it?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104975

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


[PATCH] D104975: Implement P1949

2021-06-26 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin created this revision.
cor3ntin requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This adds the Unicode 13 data for XID_Start and XID_Continue.
The definition of valid identifier is changed in all C++ modes
as P1949  was accepted by WG21 as a defect 
report.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D104975

Files:
  clang/include/clang/Basic/DiagnosticLexKinds.td
  clang/lib/Lex/Lexer.cpp
  clang/lib/Lex/UnicodeCharSets.h
  clang/test/CXX/drs/dr1xx.cpp
  clang/test/CXX/drs/dr2xx.cpp
  clang/test/CXX/drs/dr6xx.cpp
  clang/test/FixIt/fixit-unicode.c
  clang/test/Lexer/unicode.c
  clang/test/Parser/cxx11-user-defined-literals.cpp
  clang/test/Preprocessor/ucn-allowed-chars.c
  clang/test/Preprocessor/ucn-pp-identifier.c
  clang/test/Preprocessor/utf8-allowed-chars.c

Index: clang/test/Preprocessor/utf8-allowed-chars.c
===
--- clang/test/Preprocessor/utf8-allowed-chars.c
+++ clang/test/Preprocessor/utf8-allowed-chars.c
@@ -23,46 +23,30 @@
 
 
 
-
-
-
-
 #if __cplusplus
-# if __cplusplus >= 201103L
-// C++11
-// expected-warning@9 {{using this character in an identifier is incompatible with C++98}}
-// expected-warning@10 {{using this character in an identifier is incompatible with C++98}}
-// expected-error@13 {{non-ASCII characters are not allowed outside of literals and identifiers}}
-// expected-warning@14 {{using this character in an identifier is incompatible with C++98}}
+// expected-error@11 {{character not allowed in identifiers}}
+// expected-error@13 {{character not allowed in identifiers}}
+// expected-error@20 {{expected unqualified-id}}
 // expected-error@21 {{expected unqualified-id}}
 
-# else
-// C++03
-// expected-error@9 {{non-ASCII characters are not allowed outside of literals and identifiers}}
-// expected-error@10 {{non-ASCII characters are not allowed outside of literals and identifiers}}
-// expected-error@13 {{non-ASCII characters are not allowed outside of literals and identifiers}}
-// expected-error@14 {{non-ASCII characters are not allowed outside of literals and identifiers}}
-// expected-error@21 {{non-ASCII characters are not allowed outside of literals and identifiers}} expected-warning@21 {{declaration does not declare anything}}
-
-# endif
 #else
 # if __STDC_VERSION__ >= 201112L
 // C11
 // expected-warning@9 {{using this character in an identifier is incompatible with C99}}
 // expected-warning@11 {{using this character in an identifier is incompatible with C99}}
-// expected-error@13 {{non-ASCII characters are not allowed outside of literals and identifiers}}
+// expected-error@13 {{character not allowed in identifiers}}
 // expected-warning@14 {{using this character in an identifier is incompatible with C99}}
 // expected-warning@20 {{starting an identifier with this character is incompatible with C99}}
 // expected-error@21 {{expected identifier}}
 
 # else
 // C99
-// expected-error@9 {{non-ASCII characters are not allowed outside of literals and identifiers}}
-// expected-error@11 {{non-ASCII characters are not allowed outside of literals and identifiers}}
-// expected-error@13 {{non-ASCII characters are not allowed outside of literals and identifiers}}
-// expected-error@14 {{non-ASCII characters are not allowed outside of literals and identifiers}}
+// expected-error@9 {{character not allowed in identifiers}}
+// expected-error@11 {{character not allowed in identifiers}}
+// expected-error@13 {{character not allowed in identifiers}}
+// expected-error@14 {{character not allowed in identifiers}}
 // expected-error@20 {{expected identifier}}
-// expected-error@21 {{non-ASCII characters are not allowed outside of literals and identifiers}} expected-warning@21 {{declaration does not declare anything}}
+// expected-error@21 {{character not allowed in identifiers}} expected-warning@21 {{declaration does not declare anything}}
 
 # endif
 #endif
Index: clang/test/Preprocessor/ucn-pp-identifier.c
===
--- clang/test/Preprocessor/ucn-pp-identifier.c
+++ clang/test/Preprocessor/ucn-pp-identifier.c
@@ -28,7 +28,7 @@
 #define \U1000  // expected-error {{macro name must be an identifier}}
 #define \u0061  // expected-error {{character 'a' cannot be specified by a universal character name}} expected-error {{macro name must be an identifier}}
 
-#define a\u0024
+#define a\u00c0
 
 #if \u0110 // expected-warning {{is not defined, evaluates to 0}}
 #endif
Index: clang/test/Preprocessor/ucn-allowed-chars.c
===
--- clang/test/Preprocessor/ucn-allowed-chars.c
+++ clang/test/Preprocessor/ucn-allowed-chars.c
@@ -16,7 +16,7 @@
 
 // Identifier initial characters
 extern char \u0E50; // C++03, C11, C++11
-extern char \u0300; // disallowed initially in C11/C++11, always in 

[PATCH] D104222: [clang-format] [PR50702] Lamdba processing does not respect AfterClass and AfterNamespace

2021-06-26 Thread MyDeveloperDay via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG37c2233097ac: [clang-format] [PR50702] Lamdba processing 
does not respect AfterClass and… (authored by MyDeveloperDay).

Changed prior to commit:
  https://reviews.llvm.org/D104222?vs=352193=354671#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104222

Files:
  clang/lib/Format/TokenAnnotator.cpp
  clang/unittests/Format/FormatTest.cpp

Index: clang/unittests/Format/FormatTest.cpp
===
--- clang/unittests/Format/FormatTest.cpp
+++ clang/unittests/Format/FormatTest.cpp
@@ -19596,8 +19596,7 @@
"  });\n"
"});",
LLVMWithBeforeLambdaBody);
-  verifyFormat("void Fct()\n"
-   "{\n"
+  verifyFormat("void Fct() {\n"
"  return {[]()\n"
"  {\n"
"return 17;\n"
@@ -19802,6 +19801,35 @@
"});",
LLVMWithBeforeLambdaBody);
 
+  LLVMWithBeforeLambdaBody.AllowShortLambdasOnASingleLine =
+  FormatStyle::ShortLambdaStyle::SLS_None;
+
+  verifyFormat("auto select = [this]() -> const Library::Object *\n"
+   "{\n"
+   "  return MyAssignment::SelectFromList(this);\n"
+   "};\n",
+   LLVMWithBeforeLambdaBody);
+
+  verifyFormat("auto select = [this]() -> const Library::Object &\n"
+   "{\n"
+   "  return MyAssignment::SelectFromList(this);\n"
+   "};\n",
+   LLVMWithBeforeLambdaBody);
+
+  verifyFormat("auto select = [this]() -> std::unique_ptr\n"
+   "{\n"
+   "  return MyAssignment::SelectFromList(this);\n"
+   "};\n",
+   LLVMWithBeforeLambdaBody);
+
+  verifyFormat("namespace test {\n"
+   "class Test {\n"
+   "public:\n"
+   "  Test() = default;\n"
+   "};\n"
+   "} // namespace test",
+   LLVMWithBeforeLambdaBody);
+
   // Lambdas with different indentation styles.
   Style = getLLVMStyleWithColumns(100);
   EXPECT_EQ("SomeResult doSomething(SomeObject promise) {\n"
Index: clang/lib/Format/TokenAnnotator.cpp
===
--- clang/lib/Format/TokenAnnotator.cpp
+++ clang/lib/Format/TokenAnnotator.cpp
@@ -3579,42 +3579,11 @@
   return Tok.Children.empty() && ShortLambdaOption != FormatStyle::SLS_None;
 }
 
-static bool
-isItAInlineLambdaAllowed(const FormatToken ,
- FormatStyle::ShortLambdaStyle ShortLambdaOption) {
-  return (ShortLambdaOption == FormatStyle::SLS_Inline &&
-  IsFunctionArgument(Tok)) ||
- (ShortLambdaOption == FormatStyle::SLS_All);
-}
-
-static bool isOneChildWithoutMustBreakBefore(const FormatToken ) {
-  if (Tok.Children.size() != 1)
-return false;
-  FormatToken *curElt = Tok.Children[0]->First;
-  while (curElt) {
-if (curElt->MustBreakBefore)
-  return false;
-curElt = curElt->Next;
-  }
-  return true;
-}
 static bool isAllmanLambdaBrace(const FormatToken ) {
   return (Tok.is(tok::l_brace) && Tok.is(BK_Block) &&
   !Tok.isOneOf(TT_ObjCBlockLBrace, TT_DictLiteral));
 }
 
-static bool isAllmanBraceIncludedBreakableLambda(
-const FormatToken , FormatStyle::ShortLambdaStyle ShortLambdaOption) {
-  if (!isAllmanLambdaBrace(Tok))
-return false;
-
-  if (isItAnEmptyLambdaAllowed(Tok, ShortLambdaOption))
-return false;
-
-  return !isItAInlineLambdaAllowed(Tok, ShortLambdaOption) ||
- !isOneChildWithoutMustBreakBefore(Tok);
-}
-
 bool TokenAnnotator::mustBreakBefore(const AnnotatedLine ,
  const FormatToken ) {
   const FormatToken  = *Right.Previous;
@@ -3776,13 +3745,6 @@
   if (Right.is(TT_InlineASMBrace))
 return Right.HasUnescapedNewline;
 
-  auto ShortLambdaOption = Style.AllowShortLambdasOnASingleLine;
-  if (Style.BraceWrapping.BeforeLambdaBody &&
-  (isAllmanBraceIncludedBreakableLambda(Left, ShortLambdaOption) ||
-   isAllmanBraceIncludedBreakableLambda(Right, ShortLambdaOption))) {
-return true;
-  }
-
   if (isAllmanBrace(Left) || isAllmanBrace(Right))
 return (Line.startsWith(tok::kw_enum) && Style.BraceWrapping.AfterEnum) ||
(Line.startsWith(tok::kw_typedef, tok::kw_enum) &&
@@ -3805,6 +3767,11 @@
   return true;
   }
 
+  if (Style.BraceWrapping.BeforeLambdaBody && Right.is(TT_LambdaLBrace) &&
+  Left.isOneOf(tok::star, tok::amp, tok::ampamp, TT_TemplateCloser)) {
+return true;
+  }
+
   // Put multiple Java annotation on a new line.
   if ((Style.Language == FormatStyle::LK_Java ||
Style.Language == FormatStyle::LK_JavaScript) &&
@@ -4209,7 +4176,7 @@
 return false;
 
   auto ShortLambdaOption = Style.AllowShortLambdasOnASingleLine;
- 

[clang] 37c2233 - [clang-format] [PR50702] Lamdba processing does not respect AfterClass and AfterNamespace

2021-06-26 Thread via cfe-commits

Author: mydeveloperday
Date: 2021-06-26T13:34:07+01:00
New Revision: 37c2233097ac44697b87228d86eef1fce10ea5c1

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

LOG: [clang-format] [PR50702] Lamdba processing does not respect AfterClass and 
AfterNamespace

https://bugs.llvm.org/show_bug.cgi?id=50702

I believe {D44609} may be too aggressive with brace wrapping rules which 
doesn't always apply to Lamdbas

The introduction of BeforeLambdaBody and AllowShortLambdasOnASingleLine has 
impact on brace handling on other block types, which I suspect we didn't see 
before as people may not be using the BeforeLambdaBody  style

>From what I can tell this can be seen by the unit test I change as its not 
>honouring the orginal LLVM brace wrapping style for the `Fct()` function

I added a unit test from PR50702 and have removed some of the code (which has 
zero impact on the unit test, which kind of suggests its unnecessary), some 
additional attempt has been made to try and ensure we'll only break on what is 
actually a LamdbaLBrace

Reviewed By: HazardyKnusperkeks

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

Added: 


Modified: 
clang/lib/Format/TokenAnnotator.cpp
clang/unittests/Format/FormatTest.cpp

Removed: 




diff  --git a/clang/lib/Format/TokenAnnotator.cpp 
b/clang/lib/Format/TokenAnnotator.cpp
index bfa49de7d74f..5f973950b8d7 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -3579,42 +3579,11 @@ isItAnEmptyLambdaAllowed(const FormatToken ,
   return Tok.Children.empty() && ShortLambdaOption != FormatStyle::SLS_None;
 }
 
-static bool
-isItAInlineLambdaAllowed(const FormatToken ,
- FormatStyle::ShortLambdaStyle ShortLambdaOption) {
-  return (ShortLambdaOption == FormatStyle::SLS_Inline &&
-  IsFunctionArgument(Tok)) ||
- (ShortLambdaOption == FormatStyle::SLS_All);
-}
-
-static bool isOneChildWithoutMustBreakBefore(const FormatToken ) {
-  if (Tok.Children.size() != 1)
-return false;
-  FormatToken *curElt = Tok.Children[0]->First;
-  while (curElt) {
-if (curElt->MustBreakBefore)
-  return false;
-curElt = curElt->Next;
-  }
-  return true;
-}
 static bool isAllmanLambdaBrace(const FormatToken ) {
   return (Tok.is(tok::l_brace) && Tok.is(BK_Block) &&
   !Tok.isOneOf(TT_ObjCBlockLBrace, TT_DictLiteral));
 }
 
-static bool isAllmanBraceIncludedBreakableLambda(
-const FormatToken , FormatStyle::ShortLambdaStyle ShortLambdaOption) {
-  if (!isAllmanLambdaBrace(Tok))
-return false;
-
-  if (isItAnEmptyLambdaAllowed(Tok, ShortLambdaOption))
-return false;
-
-  return !isItAInlineLambdaAllowed(Tok, ShortLambdaOption) ||
- !isOneChildWithoutMustBreakBefore(Tok);
-}
-
 bool TokenAnnotator::mustBreakBefore(const AnnotatedLine ,
  const FormatToken ) {
   const FormatToken  = *Right.Previous;
@@ -3776,13 +3745,6 @@ bool TokenAnnotator::mustBreakBefore(const AnnotatedLine 
,
   if (Right.is(TT_InlineASMBrace))
 return Right.HasUnescapedNewline;
 
-  auto ShortLambdaOption = Style.AllowShortLambdasOnASingleLine;
-  if (Style.BraceWrapping.BeforeLambdaBody &&
-  (isAllmanBraceIncludedBreakableLambda(Left, ShortLambdaOption) ||
-   isAllmanBraceIncludedBreakableLambda(Right, ShortLambdaOption))) {
-return true;
-  }
-
   if (isAllmanBrace(Left) || isAllmanBrace(Right))
 return (Line.startsWith(tok::kw_enum) && Style.BraceWrapping.AfterEnum) ||
(Line.startsWith(tok::kw_typedef, tok::kw_enum) &&
@@ -3805,6 +3767,11 @@ bool TokenAnnotator::mustBreakBefore(const AnnotatedLine 
,
   return true;
   }
 
+  if (Style.BraceWrapping.BeforeLambdaBody && Right.is(TT_LambdaLBrace) &&
+  Left.isOneOf(tok::star, tok::amp, tok::ampamp, TT_TemplateCloser)) {
+return true;
+  }
+
   // Put multiple Java annotation on a new line.
   if ((Style.Language == FormatStyle::LK_Java ||
Style.Language == FormatStyle::LK_JavaScript) &&
@@ -4209,7 +4176,7 @@ bool TokenAnnotator::canBreakBefore(const AnnotatedLine 
,
 return false;
 
   auto ShortLambdaOption = Style.AllowShortLambdasOnASingleLine;
-  if (Style.BraceWrapping.BeforeLambdaBody) {
+  if (Style.BraceWrapping.BeforeLambdaBody && Right.is(TT_LambdaLBrace)) {
 if (isAllmanLambdaBrace(Left))
   return !isItAnEmptyLambdaAllowed(Left, ShortLambdaOption);
 if (isAllmanLambdaBrace(Right))
@@ -4221,7 +4188,6 @@ bool TokenAnnotator::canBreakBefore(const AnnotatedLine 
,
  Right.isMemberAccess() ||
  Right.isOneOf(TT_TrailingReturnArrow, TT_LambdaArrow, tok::lessless,
tok::colon, tok::l_square, tok::at) ||
- (Style.BraceWrapping.BeforeLambdaBody && 

[PATCH] D104900: [clang-format] PR50525 doesn't handle AlignConsecutiveAssignments correctly in some situations

2021-06-26 Thread MyDeveloperDay via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGee3b2c47ce41: [clang-format] PR50525 doesnt handle 
AlignConsecutiveAssignments correctly in… (authored by MyDeveloperDay).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104900

Files:
  clang/lib/Format/WhitespaceManager.cpp
  clang/unittests/Format/FormatTest.cpp


Index: clang/unittests/Format/FormatTest.cpp
===
--- clang/unittests/Format/FormatTest.cpp
+++ clang/unittests/Format/FormatTest.cpp
@@ -16272,6 +16272,52 @@
   // clang-format on
 }
 
+TEST_F(FormatTest, AlignWithInitializerPeriods) {
+  auto Style = getLLVMStyleWithColumns(60);
+
+  verifyFormat("void foo1(void) {\n"
+   "  BYTE p[1] = 1;\n"
+   "  A B = {.one_f = 2,\n"
+   " .two_fo = 3,\n"
+   " .three_fo = 4};\n"
+   "  BYTE payload = 2;\n"
+   "}",
+   Style);
+
+  Style.AlignConsecutiveAssignments = FormatStyle::ACS_Consecutive;
+  Style.AlignConsecutiveDeclarations = FormatStyle::ACS_None;
+  verifyFormat("void foo2(void) {\n"
+   "  BYTE p[1]= 1;\n"
+   "  A B  = {.one_f = 2,\n"
+   "  .two_fo= 3,\n"
+   "  .three_fo  = 4};\n"
+   "  BYTE payload = 2;\n"
+   "}",
+   Style);
+
+  Style.AlignConsecutiveAssignments = FormatStyle::ACS_None;
+  Style.AlignConsecutiveDeclarations = FormatStyle::ACS_Consecutive;
+  verifyFormat("void foo3(void) {\n"
+   "  BYTE p[1] = 1;\n"
+   "  AB = {.one_f = 2,\n"
+   ".two_fo = 3,\n"
+   ".three_fo = 4};\n"
+   "  BYTE payload = 2;\n"
+   "}",
+   Style);
+
+  Style.AlignConsecutiveAssignments = FormatStyle::ACS_Consecutive;
+  Style.AlignConsecutiveDeclarations = FormatStyle::ACS_Consecutive;
+  verifyFormat("void foo4(void) {\n"
+   "  BYTE p[1]= 1;\n"
+   "  AB   = {.one_f = 2,\n"
+   "  .two_fo= 3,\n"
+   "  .three_fo  = 4};\n"
+   "  BYTE payload = 2;\n"
+   "}",
+   Style);
+}
+
 TEST_F(FormatTest, LinuxBraceBreaking) {
   FormatStyle LinuxBraceStyle = getLLVMStyle();
   LinuxBraceStyle.BreakBeforeBraces = FormatStyle::BS_Linux;
Index: clang/lib/Format/WhitespaceManager.cpp
===
--- clang/lib/Format/WhitespaceManager.cpp
+++ clang/lib/Format/WhitespaceManager.cpp
@@ -353,6 +353,10 @@
 if (Changes[i].Tok->is(TT_ConditionalExpr))
   return true;
 
+// Period Initializer .XXX = 1.
+if (Changes[i].Tok->is(TT_DesignatedInitializerPeriod))
+  return true;
+
 // Continued ternary operator
 if (Changes[i].Tok->Previous &&
 Changes[i].Tok->Previous->is(TT_ConditionalExpr))


Index: clang/unittests/Format/FormatTest.cpp
===
--- clang/unittests/Format/FormatTest.cpp
+++ clang/unittests/Format/FormatTest.cpp
@@ -16272,6 +16272,52 @@
   // clang-format on
 }
 
+TEST_F(FormatTest, AlignWithInitializerPeriods) {
+  auto Style = getLLVMStyleWithColumns(60);
+
+  verifyFormat("void foo1(void) {\n"
+   "  BYTE p[1] = 1;\n"
+   "  A B = {.one_f = 2,\n"
+   " .two_fo = 3,\n"
+   " .three_fo = 4};\n"
+   "  BYTE payload = 2;\n"
+   "}",
+   Style);
+
+  Style.AlignConsecutiveAssignments = FormatStyle::ACS_Consecutive;
+  Style.AlignConsecutiveDeclarations = FormatStyle::ACS_None;
+  verifyFormat("void foo2(void) {\n"
+   "  BYTE p[1]= 1;\n"
+   "  A B  = {.one_f = 2,\n"
+   "  .two_fo= 3,\n"
+   "  .three_fo  = 4};\n"
+   "  BYTE payload = 2;\n"
+   "}",
+   Style);
+
+  Style.AlignConsecutiveAssignments = FormatStyle::ACS_None;
+  Style.AlignConsecutiveDeclarations = FormatStyle::ACS_Consecutive;
+  verifyFormat("void foo3(void) {\n"
+   "  BYTE p[1] = 1;\n"
+   "  AB = {.one_f = 2,\n"
+   ".two_fo = 3,\n"
+   ".three_fo = 4};\n"
+   "  BYTE payload = 2;\n"
+   

[clang] ee3b2c4 - [clang-format] PR50525 doesn't handle AlignConsecutiveAssignments correctly in some situations

2021-06-26 Thread via cfe-commits

Author: mydeveloperday
Date: 2021-06-26T13:29:16+01:00
New Revision: ee3b2c47ce41aeabede85d96e43bee33be73aa2f

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

LOG: [clang-format] PR50525 doesn't handle AlignConsecutiveAssignments 
correctly in some situations

https://bugs.llvm.org/show_bug.cgi?id=50525

AlignConsecutiveAssignments/Declarations cause incorrect alignment in the 
presence of a DesignatedInitializerPeriod 
(https://gcc.gnu.org/onlinedocs/gcc/Designated-Inits.html)

```
static NTSTATUS stg(PLW_STREAM Stream, int identity)
{
 NTSTATUS status;
 BYTE payload[256] = {'l', 'h', 'o', 't', 's', 'e'};
 struct dm_rpc_header header   = {.drh_magic= DRH_MAGIC,
.drh_op_code  = RPC_OP_ECHO,
.drh_payload_size = sizeof(payload),
.drh_body_size= sizeof(payload),
.drh_request_id   = 1};
 header.drh_version= identity;
```

This fix addresses that by ensuring the period isn't ignored

Reviewed By: HazardyKnusperkeks

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

Added: 


Modified: 
clang/lib/Format/WhitespaceManager.cpp
clang/unittests/Format/FormatTest.cpp

Removed: 




diff  --git a/clang/lib/Format/WhitespaceManager.cpp 
b/clang/lib/Format/WhitespaceManager.cpp
index b079eac9803c..cad1feff 100644
--- a/clang/lib/Format/WhitespaceManager.cpp
+++ b/clang/lib/Format/WhitespaceManager.cpp
@@ -353,6 +353,10 @@ AlignTokenSequence(const FormatStyle , unsigned 
Start, unsigned End,
 if (Changes[i].Tok->is(TT_ConditionalExpr))
   return true;
 
+// Period Initializer .XXX = 1.
+if (Changes[i].Tok->is(TT_DesignatedInitializerPeriod))
+  return true;
+
 // Continued ternary operator
 if (Changes[i].Tok->Previous &&
 Changes[i].Tok->Previous->is(TT_ConditionalExpr))

diff  --git a/clang/unittests/Format/FormatTest.cpp 
b/clang/unittests/Format/FormatTest.cpp
index df795e3c8932..e084d06b2aa6 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -16272,6 +16272,52 @@ TEST_F(FormatTest, AlignWithLineBreaks) {
   // clang-format on
 }
 
+TEST_F(FormatTest, AlignWithInitializerPeriods) {
+  auto Style = getLLVMStyleWithColumns(60);
+
+  verifyFormat("void foo1(void) {\n"
+   "  BYTE p[1] = 1;\n"
+   "  A B = {.one_f = 2,\n"
+   " .two_fo = 3,\n"
+   " .three_fo = 4};\n"
+   "  BYTE payload = 2;\n"
+   "}",
+   Style);
+
+  Style.AlignConsecutiveAssignments = FormatStyle::ACS_Consecutive;
+  Style.AlignConsecutiveDeclarations = FormatStyle::ACS_None;
+  verifyFormat("void foo2(void) {\n"
+   "  BYTE p[1]= 1;\n"
+   "  A B  = {.one_f = 2,\n"
+   "  .two_fo= 3,\n"
+   "  .three_fo  = 4};\n"
+   "  BYTE payload = 2;\n"
+   "}",
+   Style);
+
+  Style.AlignConsecutiveAssignments = FormatStyle::ACS_None;
+  Style.AlignConsecutiveDeclarations = FormatStyle::ACS_Consecutive;
+  verifyFormat("void foo3(void) {\n"
+   "  BYTE p[1] = 1;\n"
+   "  AB = {.one_f = 2,\n"
+   ".two_fo = 3,\n"
+   ".three_fo = 4};\n"
+   "  BYTE payload = 2;\n"
+   "}",
+   Style);
+
+  Style.AlignConsecutiveAssignments = FormatStyle::ACS_Consecutive;
+  Style.AlignConsecutiveDeclarations = FormatStyle::ACS_Consecutive;
+  verifyFormat("void foo4(void) {\n"
+   "  BYTE p[1]= 1;\n"
+   "  AB   = {.one_f = 2,\n"
+   "  .two_fo= 3,\n"
+   "  .three_fo  = 4};\n"
+   "  BYTE payload = 2;\n"
+   "}",
+   Style);
+}
+
 TEST_F(FormatTest, LinuxBraceBreaking) {
   FormatStyle LinuxBraceStyle = getLLVMStyle();
   LinuxBraceStyle.BreakBeforeBraces = FormatStyle::BS_Linux;



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


[PATCH] D104899: [clang][tests] Specify unwindlib in aix-ld tests

2021-06-26 Thread Timm Bäder via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG3255db4919f1: [clang][tests] Specify unwindlib in aix-ld 
tests (authored by tbaeder).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104899

Files:
  clang/test/Driver/aix-ld.c

Index: clang/test/Driver/aix-ld.c
===
--- clang/test/Driver/aix-ld.c
+++ clang/test/Driver/aix-ld.c
@@ -6,6 +6,7 @@
 // RUN:-resource-dir=%S/Inputs/resource_dir \
 // RUN:-target powerpc-ibm-aix7.1.0.0 \
 // RUN:--sysroot %S/Inputs/aix_ppc_tree \
+// RUN:-unwindlib=libunwind \
 // RUN:   | FileCheck --check-prefix=CHECK-LD32 %s
 // CHECK-LD32-NOT: warning:
 // CHECK-LD32: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
@@ -31,6 +32,7 @@
 // RUN:-resource-dir=%S/Inputs/resource_dir \
 // RUN:-target powerpc64-ibm-aix7.1.0.0 \
 // RUN:--sysroot %S/Inputs/aix_ppc_tree \
+// RUN:-unwindlib=libunwind \
 // RUN:   | FileCheck --check-prefix=CHECK-LD64 %s
 // CHECK-LD64-NOT: warning:
 // CHECK-LD64: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc64-ibm-aix7.1.0.0"
@@ -57,6 +59,7 @@
 // RUN:-pthread \
 // RUN:-target powerpc-ibm-aix7.1.0.0 \
 // RUN:--sysroot %S/Inputs/aix_ppc_tree \
+// RUN:-unwindlib=libunwind \
 // RUN:   | FileCheck --check-prefix=CHECK-LD32-PTHREAD %s
 // CHECK-LD32-PTHREAD-NOT: warning:
 // CHECK-LD32-PTHREAD: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
@@ -84,6 +87,7 @@
 // RUN:-pthreads \
 // RUN:-target powerpc64-ibm-aix7.1.0.0 \
 // RUN:--sysroot %S/Inputs/aix_ppc_tree \
+// RUN:-unwindlib=libunwind \
 // RUN:   | FileCheck --check-prefix=CHECK-LD64-PTHREAD %s
 // CHECK-LD64-PTHREAD-NOT: warning:
 // CHECK-LD64-PTHREAD: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc64-ibm-aix7.1.0.0"
@@ -111,6 +115,7 @@
 // RUN:-p \
 // RUN:-target powerpc-ibm-aix7.1.0.0 \
 // RUN:--sysroot %S/Inputs/aix_ppc_tree \
+// RUN:-unwindlib=libunwind \
 // RUN:   | FileCheck --check-prefix=CHECK-LD32-PROF %s
 // CHECK-LD32-PROF-NOT: warning:
 // CHECK-LD32-PROF: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
@@ -137,6 +142,7 @@
 // RUN:-pg \
 // RUN:-target powerpc64-ibm-aix7.1.0.0 \
 // RUN:--sysroot %S/Inputs/aix_ppc_tree \
+// RUN:-unwindlib=libunwind \
 // RUN:   | FileCheck --check-prefix=CHECK-LD64-GPROF %s
 // CHECK-LD64-GPROF-NOT: warning:
 // CHECK-LD64-GPROF: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc64-ibm-aix7.1.0.0"
@@ -163,6 +169,7 @@
 // RUN:-static \
 // RUN:-target powerpc-ibm-aix7.1.0.0 \
 // RUN:--sysroot %S/Inputs/aix_ppc_tree \
+// RUN:-unwindlib=libunwind \
 // RUN:   | FileCheck --check-prefix=CHECK-LD32-STATIC %s
 // CHECK-LD32-STATIC-NOT: warning:
 // CHECK-LD32-STATIC: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
@@ -189,6 +196,7 @@
 // RUN:-L%S/Inputs/aix_ppc_tree/powerpc-ibm-aix7.1.0.0 \
 // RUN:-target powerpc-ibm-aix7.1.0.0 \
 // RUN:--sysroot %S/Inputs/aix_ppc_tree \
+// RUN:-unwindlib=libunwind \
 // RUN:   | FileCheck --check-prefix=CHECK-LD32-LIBP %s
 // CHECK-LD32-LIBP-NOT: warning:
 // CHECK-LD32-LIBP: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
@@ -272,6 +280,7 @@
 // RUN:-Wl,-bnocdtors \
 // RUN:-target powerpc-ibm-aix7.1.0.0 \
 // RUN:--sysroot %S/Inputs/aix_ppc_tree \
+// RUN:-unwindlib=libunwind \
 // RUN:   | FileCheck --check-prefix=CHECK-LD32-ARG-ORDER %s
 // CHECK-LD32-ARG-ORDER: {{.*}}clang{{.*}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
 // CHECK-LD32-ARG-ORDER: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
@@ -300,6 +309,7 @@
 // RUN:-Wl,-bnocdtors \
 // RUN:-target powerpc-ibm-aix7.1.0.0 \
 // RUN:--sysroot %S/Inputs/aix_ppc_tree \
+// RUN:-unwindlib=libunwind \
 // RUN:   | FileCheck --check-prefix=CHECK-LD32-CXX-ARG-ORDER %s
 // CHECK-LD32-CXX-ARG-ORDER: {{.*}}clang{{.*}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
 // CHECK-LD32-CXX-ARG-ORDER: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
@@ -327,6 +337,7 @@
 // RUN:-resource-dir=%S/Inputs/resource_dir \
 // RUN:-target powerpc-ibm-aix7.1.0.0 \
 // RUN:--sysroot %S/Inputs/aix_ppc_tree \
+// RUN:-unwindlib=libunwind \
 // RUN:   | FileCheck --check-prefix=CHECK-LD32-CXX-ARG-LCXX %s
 // CHECK-LD32-CXX-ARG-LCXX: {{.*}}clang{{.*}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
 // CHECK-LD32-CXX-ARG-LCXX: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
@@ -350,6 +361,7 @@
 // RUN:-resource-dir=%S/Inputs/resource_dir \
 // RUN:-target powerpc64-ibm-aix7.1.0.0 \
 // RUN:--sysroot 

[clang] 3255db4 - [clang][tests] Specify unwindlib in aix-ld tests

2021-06-26 Thread Timm Bäder via cfe-commits

Author: Timm Bäder
Date: 2021-06-26T13:09:29+02:00
New Revision: 3255db4919f1b06736f391a0ae670f273c0ba09e

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

LOG: [clang][tests] Specify unwindlib in aix-ld tests

Clang can be configured with a different default unwindlib, for example
gcc. In that case, -lunwind will not be present in the output.

Fix this by explicitly specifying libunwind as the unwindlib.

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

Added: 


Modified: 
clang/test/Driver/aix-ld.c

Removed: 




diff  --git a/clang/test/Driver/aix-ld.c b/clang/test/Driver/aix-ld.c
index c66b235cb1e2..c5f1061f0346 100644
--- a/clang/test/Driver/aix-ld.c
+++ b/clang/test/Driver/aix-ld.c
@@ -6,6 +6,7 @@
 // RUN:-resource-dir=%S/Inputs/resource_dir \
 // RUN:-target powerpc-ibm-aix7.1.0.0 \
 // RUN:--sysroot %S/Inputs/aix_ppc_tree \
+// RUN:-unwindlib=libunwind \
 // RUN:   | FileCheck --check-prefix=CHECK-LD32 %s
 // CHECK-LD32-NOT: warning:
 // CHECK-LD32: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" 
"powerpc-ibm-aix7.1.0.0"
@@ -31,6 +32,7 @@
 // RUN:-resource-dir=%S/Inputs/resource_dir \
 // RUN:-target powerpc64-ibm-aix7.1.0.0 \
 // RUN:--sysroot %S/Inputs/aix_ppc_tree \
+// RUN:-unwindlib=libunwind \
 // RUN:   | FileCheck --check-prefix=CHECK-LD64 %s
 // CHECK-LD64-NOT: warning:
 // CHECK-LD64: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" 
"powerpc64-ibm-aix7.1.0.0"
@@ -57,6 +59,7 @@
 // RUN:-pthread \
 // RUN:-target powerpc-ibm-aix7.1.0.0 \
 // RUN:--sysroot %S/Inputs/aix_ppc_tree \
+// RUN:-unwindlib=libunwind \
 // RUN:   | FileCheck --check-prefix=CHECK-LD32-PTHREAD %s
 // CHECK-LD32-PTHREAD-NOT: warning:
 // CHECK-LD32-PTHREAD: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" 
"powerpc-ibm-aix7.1.0.0"
@@ -84,6 +87,7 @@
 // RUN:-pthreads \
 // RUN:-target powerpc64-ibm-aix7.1.0.0 \
 // RUN:--sysroot %S/Inputs/aix_ppc_tree \
+// RUN:-unwindlib=libunwind \
 // RUN:   | FileCheck --check-prefix=CHECK-LD64-PTHREAD %s
 // CHECK-LD64-PTHREAD-NOT: warning:
 // CHECK-LD64-PTHREAD: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" 
"powerpc64-ibm-aix7.1.0.0"
@@ -111,6 +115,7 @@
 // RUN:-p \
 // RUN:-target powerpc-ibm-aix7.1.0.0 \
 // RUN:--sysroot %S/Inputs/aix_ppc_tree \
+// RUN:-unwindlib=libunwind \
 // RUN:   | FileCheck --check-prefix=CHECK-LD32-PROF %s
 // CHECK-LD32-PROF-NOT: warning:
 // CHECK-LD32-PROF: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" 
"powerpc-ibm-aix7.1.0.0"
@@ -137,6 +142,7 @@
 // RUN:-pg \
 // RUN:-target powerpc64-ibm-aix7.1.0.0 \
 // RUN:--sysroot %S/Inputs/aix_ppc_tree \
+// RUN:-unwindlib=libunwind \
 // RUN:   | FileCheck --check-prefix=CHECK-LD64-GPROF %s
 // CHECK-LD64-GPROF-NOT: warning:
 // CHECK-LD64-GPROF: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" 
"powerpc64-ibm-aix7.1.0.0"
@@ -163,6 +169,7 @@
 // RUN:-static \
 // RUN:-target powerpc-ibm-aix7.1.0.0 \
 // RUN:--sysroot %S/Inputs/aix_ppc_tree \
+// RUN:-unwindlib=libunwind \
 // RUN:   | FileCheck --check-prefix=CHECK-LD32-STATIC %s
 // CHECK-LD32-STATIC-NOT: warning:
 // CHECK-LD32-STATIC: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" 
"powerpc-ibm-aix7.1.0.0"
@@ -189,6 +196,7 @@
 // RUN:-L%S/Inputs/aix_ppc_tree/powerpc-ibm-aix7.1.0.0 \
 // RUN:-target powerpc-ibm-aix7.1.0.0 \
 // RUN:--sysroot %S/Inputs/aix_ppc_tree \
+// RUN:-unwindlib=libunwind \
 // RUN:   | FileCheck --check-prefix=CHECK-LD32-LIBP %s
 // CHECK-LD32-LIBP-NOT: warning:
 // CHECK-LD32-LIBP: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" 
"powerpc-ibm-aix7.1.0.0"
@@ -272,6 +280,7 @@
 // RUN:-Wl,-bnocdtors \
 // RUN:-target powerpc-ibm-aix7.1.0.0 \
 // RUN:--sysroot %S/Inputs/aix_ppc_tree \
+// RUN:-unwindlib=libunwind \
 // RUN:   | FileCheck --check-prefix=CHECK-LD32-ARG-ORDER %s
 // CHECK-LD32-ARG-ORDER: {{.*}}clang{{.*}}" "-cc1" "-triple" 
"powerpc-ibm-aix7.1.0.0"
 // CHECK-LD32-ARG-ORDER: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
@@ -300,6 +309,7 @@
 // RUN:-Wl,-bnocdtors \
 // RUN:-target powerpc-ibm-aix7.1.0.0 \
 // RUN:--sysroot %S/Inputs/aix_ppc_tree \
+// RUN:-unwindlib=libunwind \
 // RUN:   | FileCheck --check-prefix=CHECK-LD32-CXX-ARG-ORDER %s
 // CHECK-LD32-CXX-ARG-ORDER: {{.*}}clang{{.*}}" "-cc1" "-triple" 
"powerpc-ibm-aix7.1.0.0"
 // CHECK-LD32-CXX-ARG-ORDER: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
@@ -327,6 +337,7 @@
 // RUN:-resource-dir=%S/Inputs/resource_dir \
 // RUN:-target powerpc-ibm-aix7.1.0.0 \
 // RUN:--sysroot %S/Inputs/aix_ppc_tree \
+// 

[PATCH] D104616: [analyzer][WIP] Model comparision methods of std::unique_ptr

2021-06-26 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD added inline comments.



Comment at: clang/test/Analysis/smart-ptr.cpp:466
+
+  clang_analyzer_eval(ptr == ptr); // expected-warning{{TRUE}}
+  clang_analyzer_eval(ptr > ptr);  // expected-warning{{FALSE}}

xazax.hun wrote:
> RedDocMD wrote:
> > xazax.hun wrote:
> > > Putting tests like this on the same path can be risky. Tests might split 
> > > the execution path (maybe not now, but in the future). I think it might 
> > > be more future proof to have a large switch statement that switches on an 
> > > unknown value and put the tests in separate cases. 
> > I didn't quite get you.
> You remember this in the other patch:
> ```
> member-constructor.cpp:15:5: warning: FALSE [debug.ExprInspection]
> clang_analyzer_eval(*P->p == 0);
> ^~~
> member-constructor.cpp:15:25: note: Assuming the condition is false
> clang_analyzer_eval(*P->p == 0);
> ^~
> member-constructor.cpp:15:5: note: FALSE
> clang_analyzer_eval(*P->p == 0);
> ^~~
> member-constructor.cpp:15:5: warning: TRUE [debug.ExprInspection]
> clang_analyzer_eval(*P->p == 0);
> ^~~
> member-constructor.cpp:15:25: note: Assuming the condition is true
> clang_analyzer_eval(*P->p == 0);
> ^~
> member-constructor.cpp:15:5: note: TRUE
> clang_analyzer_eval(*P->p == 0);
> ^~~
> 2 warnings generated.
> ```
> 
> It looks like this does not happen for overloaded comparison operators at the 
> moment. But we might want to do that in the future (@NoW what do you think). 
> I was wondering, if we want to future proof these test cases for that 
> behavior. But looking at the test cases again, you only have two, where the 
> expected result is unknown, and they are at the very end. So feel free to 
> ignore this and leave the code as is.
Then perhaps I should leave a comment to indicate this possibility.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104616

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


[PATCH] D95588: [RISCV] Implement the MC layer support of P extension

2021-06-26 Thread Jim Lin via Phabricator via cfe-commits
Jim added a comment.

Any comments? Thanks.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D95588

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


[PATCH] D104971: [Matrix] Minor fixes with language extension docs

2021-06-26 Thread Saurabh Jha via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGc8f3f46c6983: [Docs] Minor fixes with language extension 
docs (authored by SaurabhJha).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104971

Files:
  clang/docs/LanguageExtensions.rst


Index: clang/docs/LanguageExtensions.rst
===
--- clang/docs/LanguageExtensions.rst
+++ clang/docs/LanguageExtensions.rst
@@ -536,6 +536,7 @@
 The matrix type extension supports division on a matrix and a scalar but not 
on a matrix and a matrix.
 
 .. code-block:: c++
+
   typedef float m4x4_t __attribute__((matrix_type(4, 4)));
 
   m4x4_t f(m4x4_t a) {
@@ -543,8 +544,8 @@
 return a;
   }
 
-The matrix type extension supports compound assignments for addition, 
subtraction, and multiplication between matrices
-and between a matrix and a scalar, provided their types are consistent.
+The matrix type extension supports compound assignments for addition, 
subtraction, and multiplication on matrices
+and on a matrix and a scalar, provided their types are consistent.
 
 .. code-block:: c++
 


Index: clang/docs/LanguageExtensions.rst
===
--- clang/docs/LanguageExtensions.rst
+++ clang/docs/LanguageExtensions.rst
@@ -536,6 +536,7 @@
 The matrix type extension supports division on a matrix and a scalar but not on a matrix and a matrix.
 
 .. code-block:: c++
+
   typedef float m4x4_t __attribute__((matrix_type(4, 4)));
 
   m4x4_t f(m4x4_t a) {
@@ -543,8 +544,8 @@
 return a;
   }
 
-The matrix type extension supports compound assignments for addition, subtraction, and multiplication between matrices
-and between a matrix and a scalar, provided their types are consistent.
+The matrix type extension supports compound assignments for addition, subtraction, and multiplication on matrices
+and on a matrix and a scalar, provided their types are consistent.
 
 .. code-block:: c++
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] c8f3f46 - [Docs] Minor fixes with language extension docs

2021-06-26 Thread Saurabh Jha via cfe-commits

Author: Saurabh Jha
Date: 2021-06-26T10:07:33+01:00
New Revision: c8f3f46c6983b5a87a0a6fc9d9bb476883bee801

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

LOG: [Docs] Minor fixes with language extension docs

There were some issues in the patch https://reviews.llvm.org/D104198. I also 
forgot to address one comment. This patch addresses these.

Reviewed By: xgupta

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

Added: 


Modified: 
clang/docs/LanguageExtensions.rst

Removed: 




diff  --git a/clang/docs/LanguageExtensions.rst 
b/clang/docs/LanguageExtensions.rst
index f9e1208634b9..d638121eecd8 100644
--- a/clang/docs/LanguageExtensions.rst
+++ b/clang/docs/LanguageExtensions.rst
@@ -536,6 +536,7 @@ The matrix type extension also supports operations on a 
matrix and a scalar.
 The matrix type extension supports division on a matrix and a scalar but not 
on a matrix and a matrix.
 
 .. code-block:: c++
+
   typedef float m4x4_t __attribute__((matrix_type(4, 4)));
 
   m4x4_t f(m4x4_t a) {
@@ -543,8 +544,8 @@ The matrix type extension supports division on a matrix and 
a scalar but not on
 return a;
   }
 
-The matrix type extension supports compound assignments for addition, 
subtraction, and multiplication between matrices
-and between a matrix and a scalar, provided their types are consistent.
+The matrix type extension supports compound assignments for addition, 
subtraction, and multiplication on matrices
+and on a matrix and a scalar, provided their types are consistent.
 
 .. code-block:: c++
 



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


[PATCH] D104900: [clang-format] PR50525 doesn't handle AlignConsecutiveAssignments correctly in some situations

2021-06-26 Thread Björn Schäpers via Phabricator via cfe-commits
HazardyKnusperkeks accepted this revision.
HazardyKnusperkeks added a comment.
This revision is now accepted and ready to land.

Nice. :)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104900

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


[PATCH] D104971: [Matrix] Minor fixes with language extension docs

2021-06-26 Thread Saurabh Jha via Phabricator via cfe-commits
SaurabhJha added a comment.

In D104971#2842319 , @xgupta wrote:

> btw you should use [Docs] or [NFC] tag for this patch.

Okay, will follow the linked docs and amend the commit message with [Docs].


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104971

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


[PATCH] D104971: [Matrix] Minor fixes with language extension docs

2021-06-26 Thread Shivam Gupta via Phabricator via cfe-commits
xgupta added a comment.

btw you should use [Docs] or [NFC]  for this patch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104971

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


[PATCH] D104971: [Matrix] Minor fixes with language extension docs

2021-06-26 Thread Shivam Gupta via Phabricator via cfe-commits
xgupta accepted this revision.
xgupta added a comment.
This revision is now accepted and ready to land.

In D104971#2842293 , @SaurabhJha 
wrote:

> This is a light patch that probably does not require a review and I created a 
> patch anyway.
>
> Would it be appropriate to get this into main using `arc land` if this is 
> approved? I saw this https://reviews.llvm.org/D78867 which advises against 
> `arc land` but could not find anything related to that in the main docs.

I follow 
https://www.llvm.org/docs/Phabricator.html#committing-someone-s-change-from-phabricator
which says `git push https://github.com/llvm/llvm-project.git HEAD:main`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104971

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


[PATCH] D104971: [Matrix] Minor fixes with language extension docs

2021-06-26 Thread Saurabh Jha via Phabricator via cfe-commits
SaurabhJha added a comment.

This is a light patch that probably does not require a review and I created a 
patch anyway.

Would it be appropriate to get this into main using `arc land` if this is 
approved? I saw this https://reviews.llvm.org/D78867 which advises against `arc 
land` but could not find anything related to that in the main docs.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104971

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


[PATCH] D104971: [Matrix] Minor fixes with language extension docs

2021-06-26 Thread Saurabh Jha via Phabricator via cfe-commits
SaurabhJha created this revision.
Herald added a subscriber: tschuett.
SaurabhJha requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

There were some issues in the patch https://reviews.llvm.org/D104198. I also 
forgot to address one comment. This patch addresses these


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D104971

Files:
  clang/docs/LanguageExtensions.rst


Index: clang/docs/LanguageExtensions.rst
===
--- clang/docs/LanguageExtensions.rst
+++ clang/docs/LanguageExtensions.rst
@@ -536,6 +536,7 @@
 The matrix type extension supports division on a matrix and a scalar but not 
on a matrix and a matrix.
 
 .. code-block:: c++
+
   typedef float m4x4_t __attribute__((matrix_type(4, 4)));
 
   m4x4_t f(m4x4_t a) {
@@ -543,8 +544,8 @@
 return a;
   }
 
-The matrix type extension supports compound assignments for addition, 
subtraction, and multiplication between matrices
-and between a matrix and a scalar, provided their types are consistent.
+The matrix type extension supports compound assignments for addition, 
subtraction, and multiplication on matrices
+and on a matrix and a scalar, provided their types are consistent.
 
 .. code-block:: c++
 


Index: clang/docs/LanguageExtensions.rst
===
--- clang/docs/LanguageExtensions.rst
+++ clang/docs/LanguageExtensions.rst
@@ -536,6 +536,7 @@
 The matrix type extension supports division on a matrix and a scalar but not on a matrix and a matrix.
 
 .. code-block:: c++
+
   typedef float m4x4_t __attribute__((matrix_type(4, 4)));
 
   m4x4_t f(m4x4_t a) {
@@ -543,8 +544,8 @@
 return a;
   }
 
-The matrix type extension supports compound assignments for addition, subtraction, and multiplication between matrices
-and between a matrix and a scalar, provided their types are consistent.
+The matrix type extension supports compound assignments for addition, subtraction, and multiplication on matrices
+and on a matrix and a scalar, provided their types are consistent.
 
 .. code-block:: c++
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D104198: [Matrix] Add documentation for compound assignment and type conversion of matrix types

2021-06-26 Thread Saurabh Jha via Phabricator via cfe-commits
SaurabhJha added inline comments.



Comment at: clang/docs/LanguageExtensions.rst:538
+
+.. code-block:: c++
+  typedef float m4x4_t __attribute__((matrix_type(4, 4)));

xgupta wrote:
> oh just an blank line is needed :)
Thanks, fixing this now.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104198

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


[PATCH] D104198: [Matrix] Add documentation for compound assignment and type conversion of matrix types

2021-06-26 Thread Shivam Gupta via Phabricator via cfe-commits
xgupta added inline comments.



Comment at: clang/docs/LanguageExtensions.rst:538
+
+.. code-block:: c++
+  typedef float m4x4_t __attribute__((matrix_type(4, 4)));

oh just an blank line is needed :)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104198

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


[PATCH] D104198: [Matrix] Add documentation for compound assignment and type conversion of matrix types

2021-06-26 Thread Shivam Gupta via Phabricator via cfe-commits
xgupta added inline comments.



Comment at: clang/docs/LanguageExtensions.rst:539
+.. code-block:: c++
+  typedef float m4x4_t __attribute__((matrix_type(4, 4)));
+

This is incorrect ig.

I get warning message :

Warning, treated as error:
/home/user/llvm-project/clang/docs/LanguageExtensions.rst:538:Error in 
"code-block" directive:
maximum 1 argument(s) allowed, 6 supplied.
 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104198

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