[clang-tools-extra] [clang] [llvm] [clang] Differentiate between identifier and string EnumArgument (PR #68550)

2024-01-12 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang

Author: Sergei Barannikov (s-barannikov)


Changes

EnumArgument may be a string or an identifier. If it is a string, it should be 
parsed as unevaluated string literal. Add IsString flag to EnumArgument so that 
the parser can choose the correct parsing method.

Target-specific attributes that share spelling may have different attribute 
"prototypes". For example, ARM's version of "interrupt" attribute accepts a 
string enum, while MSP430's version accepts an unsigned integer. Adjust 
ClangAttrEmitter so that the generated `attributeStringLiteralListArg` returns 
the correct mask depending on target triple.

It is worth noting that even after this change some string arguments are still 
parsed as identifiers or, worse, as expressions. This is because of some 
special logic in `ParseAttributeArgsCommon`. Fixing it is out of scope of this 
patch.

---

Patch is 32.07 KiB, truncated to 20.00 KiB below, full version: 
https://github.com/llvm/llvm-project/pull/68550.diff


11 Files Affected:

- (modified) clang/include/clang/Basic/Attr.td (+48-36) 
- (modified) clang/lib/Parse/ParseDecl.cpp (+2-2) 
- (modified) clang/test/Sema/attr-function-return.c (+1-1) 
- (modified) clang/test/Sema/callingconv-iamcu.c (+1-1) 
- (modified) clang/test/Sema/callingconv.c (+1-1) 
- (modified) clang/test/Sema/mips-interrupt-attr.c (+1) 
- (modified) clang/test/Sema/riscv-interrupt-attr.c (+1) 
- (modified) clang/test/Sema/zero_call_used_regs.c (+1-1) 
- (modified) clang/test/SemaCXX/warn-consumed-parsing.cpp (+1-1) 
- (modified) clang/test/SemaHLSL/shader_type_attr.hlsl (+2-2) 
- (modified) clang/utils/TableGen/ClangAttrEmitter.cpp (+63-17) 


``diff
diff --git a/clang/include/clang/Basic/Attr.td 
b/clang/include/clang/Basic/Attr.td
index a03b0e44e15f7d..6df1f3ba1a822f 100644
--- a/clang/include/clang/Basic/Attr.td
+++ b/clang/include/clang/Basic/Attr.td
@@ -284,12 +284,15 @@ class DefaultIntArgument : 
IntArgument {
 
 // This argument is more complex, it includes the enumerator type
 // name, whether the enum type is externally defined, a list of
-// strings to accept, and a list of enumerators to map them to.
-class EnumArgument values,
+// possible values, and a list of enumerators to map them to.
+class EnumArgument 
values,
list enums, bit opt = 0, bit fake = 0,
bit isExternalType = 0>
 : Argument {
   string Type = type;
+  // When true, the argument will be parsed as an unevaluated string literal
+  // and otherwise as an identifier.
+  bit IsString = is_string;
   list Values = values;
   list Enums = enums;
   bit IsExternalType = isExternalType;
@@ -297,10 +300,14 @@ class EnumArgument 
values,
 
 // FIXME: There should be a VariadicArgument type that takes any other type
 //of argument and generates the appropriate type.
-class VariadicEnumArgument values,
-   list enums, bit isExternalType = 0>
+class VariadicEnumArgument values, list enums,
+   bit isExternalType = 0>
 : Argument  {
   string Type = type;
+  // When true, the argument will be parsed as an unevaluated string literal
+  // and otherwise as an identifier.
+  bit IsString = is_string;
   list Values = values;
   list Enums = enums;
   bit IsExternalType = isExternalType;
@@ -904,7 +911,7 @@ def ARMInterrupt : InheritableAttr, 
TargetSpecificAttr {
   // MSP430Interrupt's, MipsInterrupt's and AnyX86Interrupt's spellings
   // must match.
   let Spellings = [GCC<"interrupt">];
-  let Args = [EnumArgument<"Interrupt", "InterruptType",
+  let Args = [EnumArgument<"Interrupt", "InterruptType", /*is_string=*/true,
["IRQ", "FIQ", "SWI", "ABORT", "UNDEF", ""],
["IRQ", "FIQ", "SWI", "ABORT", "UNDEF", "Generic"],
1>];
@@ -1029,7 +1036,8 @@ def ExternalSourceSymbol : InheritableAttr {
 
 def Blocks : InheritableAttr {
   let Spellings = [Clang<"blocks">];
-  let Args = [EnumArgument<"Type", "BlockType", ["byref"], ["ByRef"]>];
+  let Args = [EnumArgument<"Type", "BlockType", /*is_string=*/true,
+   ["byref"], ["ByRef"]>];
   let Documentation = [Undocumented];
 }
 
@@ -1611,7 +1619,7 @@ def FlagEnum : InheritableAttr {
 def EnumExtensibility : InheritableAttr {
   let Spellings = [Clang<"enum_extensibility">];
   let Subjects = SubjectList<[Enum]>;
-  let Args = [EnumArgument<"Extensibility", "Kind",
+  let Args = [EnumArgument<"Extensibility", "Kind", /*is_string=*/false,
   ["closed", "open"], ["Closed", "Open"]>];
   let Documentation = [EnumExtensibilityDocs];
 }
@@ -1777,7 +1785,7 @@ def MipsInterrupt : InheritableAttr, 
TargetSpecificAttr {
   // must match.
   let Spellings = [GCC<"interrupt">];
   let Subjects = SubjectList<[Function]>;
-  let Args = [EnumArgument<"Interrupt", "InterruptType",
+  let Args = [EnumArgument<"Interrupt", "InterruptType", /*is_string=*/true,
 

[clang-tools-extra] [clang] [llvm] [clang] Differentiate between identifier and string EnumArgument (PR #68550)

2024-01-12 Thread Sergei Barannikov via cfe-commits

https://github.com/s-barannikov ready_for_review 
https://github.com/llvm/llvm-project/pull/68550
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [clang-tools-extra] [clang] Differentiate between identifier and string EnumArgument (PR #68550)

2024-01-12 Thread Sergei Barannikov via cfe-commits

https://github.com/s-barannikov updated 
https://github.com/llvm/llvm-project/pull/68550

>From 96dd0121b095f92cc66fcfc3ef08a19d0b2d6bec Mon Sep 17 00:00:00 2001
From: Sergei Barannikov 
Date: Mon, 9 Oct 2023 01:38:33 +0300
Subject: [PATCH 1/2] [clang] Differentiate between identifier and string
 EnumArgument

EnumArgument may be a string or an identifier. If it is a string, it
should be parsed as unevaluated string literal. Add IsString flag to
EnumArgument so that the parser can choose the correct parsing method.

Target-specific attributes that share spelling may have different
attribute "prototypes". For example, ARM's version of "interrupt"
attribute accepts a string enum, while MSP430's version accepts an
unsigned integer. Adjust ClangAttrEmitter so that the generated
`attributeStringLiteralListArg` returns the correct mask depending on
target triple.

It is worth noting that even after this change some string arguments are
still parsed as identifiers or, worse, as expressions. This is because
of some special logic in `ParseAttributeArgsCommon`. Fixing it is out of
scope of this patch.
---
 clang/include/clang/Basic/Attr.td| 82 +++-
 clang/lib/Parse/ParseDecl.cpp|  4 +-
 clang/test/Sema/attr-function-return.c   |  2 +-
 clang/test/Sema/callingconv-iamcu.c  |  2 +-
 clang/test/Sema/callingconv.c|  2 +-
 clang/test/Sema/zero_call_used_regs.c|  2 +-
 clang/test/SemaCXX/warn-consumed-parsing.cpp |  2 +-
 clang/test/SemaHLSL/shader_type_attr.hlsl|  4 +-
 clang/utils/TableGen/ClangAttrEmitter.cpp| 80 +++
 9 files changed, 119 insertions(+), 61 deletions(-)

diff --git a/clang/include/clang/Basic/Attr.td 
b/clang/include/clang/Basic/Attr.td
index db17211747b17d..d9b55422d3a530 100644
--- a/clang/include/clang/Basic/Attr.td
+++ b/clang/include/clang/Basic/Attr.td
@@ -279,12 +279,15 @@ class DefaultIntArgument : 
IntArgument {
 
 // This argument is more complex, it includes the enumerator type
 // name, whether the enum type is externally defined, a list of
-// strings to accept, and a list of enumerators to map them to.
-class EnumArgument values,
+// possible values, and a list of enumerators to map them to.
+class EnumArgument 
values,
list enums, bit opt = 0, bit fake = 0,
bit isExternalType = 0>
 : Argument {
   string Type = type;
+  // When true, the argument will be parsed as an unevaluated string literal
+  // and otherwise as an identifier.
+  bit IsString = is_string;
   list Values = values;
   list Enums = enums;
   bit IsExternalType = isExternalType;
@@ -292,10 +295,14 @@ class EnumArgument 
values,
 
 // FIXME: There should be a VariadicArgument type that takes any other type
 //of argument and generates the appropriate type.
-class VariadicEnumArgument values,
-   list enums, bit isExternalType = 0>
+class VariadicEnumArgument values, list enums,
+   bit isExternalType = 0>
 : Argument  {
   string Type = type;
+  // When true, the argument will be parsed as an unevaluated string literal
+  // and otherwise as an identifier.
+  bit IsString = is_string;
   list Values = values;
   list Enums = enums;
   bit IsExternalType = isExternalType;
@@ -898,7 +905,7 @@ def ARMInterrupt : InheritableAttr, 
TargetSpecificAttr {
   // MSP430Interrupt's, MipsInterrupt's and AnyX86Interrupt's spellings
   // must match.
   let Spellings = [GCC<"interrupt">];
-  let Args = [EnumArgument<"Interrupt", "InterruptType",
+  let Args = [EnumArgument<"Interrupt", "InterruptType", /*is_string=*/true,
["IRQ", "FIQ", "SWI", "ABORT", "UNDEF", ""],
["IRQ", "FIQ", "SWI", "ABORT", "UNDEF", "Generic"],
1>];
@@ -1023,7 +1030,8 @@ def ExternalSourceSymbol : InheritableAttr {
 
 def Blocks : InheritableAttr {
   let Spellings = [Clang<"blocks">];
-  let Args = [EnumArgument<"Type", "BlockType", ["byref"], ["ByRef"]>];
+  let Args = [EnumArgument<"Type", "BlockType", /*is_string=*/true,
+   ["byref"], ["ByRef"]>];
   let Documentation = [Undocumented];
 }
 
@@ -1597,7 +1605,7 @@ def FlagEnum : InheritableAttr {
 def EnumExtensibility : InheritableAttr {
   let Spellings = [Clang<"enum_extensibility">];
   let Subjects = SubjectList<[Enum]>;
-  let Args = [EnumArgument<"Extensibility", "Kind",
+  let Args = [EnumArgument<"Extensibility", "Kind", /*is_string=*/false,
   ["closed", "open"], ["Closed", "Open"]>];
   let Documentation = [EnumExtensibilityDocs];
 }
@@ -1763,7 +1771,7 @@ def MipsInterrupt : InheritableAttr, 
TargetSpecificAttr {
   // must match.
   let Spellings = [GCC<"interrupt">];
   let Subjects = SubjectList<[Function]>;
-  let Args = [EnumArgument<"Interrupt", "InterruptType",
+  let Args = [EnumArgument<"Interrupt", "InterruptType", /*is_string=*/true,
["vec

[clang-tools-extra] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-01-12 Thread Bhuminjay Soni via cfe-commits

11happy wrote:

@PiotrZSL can you please review the changes.
thank you.

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


[libunwind] [libunwind] fix dynamic .eh_frame registration (PR #77185)

2024-01-12 Thread via cfe-commits

https://github.com/SihangZhu updated 
https://github.com/llvm/llvm-project/pull/77185

>From ed0a694dbf7cb8e6775b53f3553f4ec7d1fdbee2 Mon Sep 17 00:00:00 2001
From: SihangZhu 
Date: Sat, 6 Jan 2024 15:43:41 +0800
Subject: [PATCH] [libunwind] fix dynamic .eh_frame registration

---
 libunwind/src/libunwind.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libunwind/src/libunwind.cpp b/libunwind/src/libunwind.cpp
index cd610377b63de8..723c8ceb5c8c94 100644
--- a/libunwind/src/libunwind.cpp
+++ b/libunwind/src/libunwind.cpp
@@ -324,7 +324,7 @@ void __unw_add_dynamic_eh_frame_section(unw_word_t 
eh_frame_start) {
   CFI_Parser::CIE_Info cieInfo;
   CFI_Parser::FDE_Info fdeInfo;
   auto p = (LocalAddressSpace::pint_t)eh_frame_start;
-  while (true) {
+  while (LocalAddressSpace::sThisAddressSpace.get32(p)) {
 if (CFI_Parser::decodeFDE(
 LocalAddressSpace::sThisAddressSpace, p, &fdeInfo, &cieInfo,
 true) == NULL) {

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


[llvm] [clang-tools-extra] [clang] [clang] Differentiate between identifier and string EnumArgument (PR #68550)

2024-01-12 Thread Sergei Barannikov via cfe-commits

https://github.com/s-barannikov updated 
https://github.com/llvm/llvm-project/pull/68550

>From 96dd0121b095f92cc66fcfc3ef08a19d0b2d6bec Mon Sep 17 00:00:00 2001
From: Sergei Barannikov 
Date: Mon, 9 Oct 2023 01:38:33 +0300
Subject: [PATCH] [clang] Differentiate between identifier and string
 EnumArgument

EnumArgument may be a string or an identifier. If it is a string, it
should be parsed as unevaluated string literal. Add IsString flag to
EnumArgument so that the parser can choose the correct parsing method.

Target-specific attributes that share spelling may have different
attribute "prototypes". For example, ARM's version of "interrupt"
attribute accepts a string enum, while MSP430's version accepts an
unsigned integer. Adjust ClangAttrEmitter so that the generated
`attributeStringLiteralListArg` returns the correct mask depending on
target triple.

It is worth noting that even after this change some string arguments are
still parsed as identifiers or, worse, as expressions. This is because
of some special logic in `ParseAttributeArgsCommon`. Fixing it is out of
scope of this patch.
---
 clang/include/clang/Basic/Attr.td| 82 +++-
 clang/lib/Parse/ParseDecl.cpp|  4 +-
 clang/test/Sema/attr-function-return.c   |  2 +-
 clang/test/Sema/callingconv-iamcu.c  |  2 +-
 clang/test/Sema/callingconv.c|  2 +-
 clang/test/Sema/zero_call_used_regs.c|  2 +-
 clang/test/SemaCXX/warn-consumed-parsing.cpp |  2 +-
 clang/test/SemaHLSL/shader_type_attr.hlsl|  4 +-
 clang/utils/TableGen/ClangAttrEmitter.cpp| 80 +++
 9 files changed, 119 insertions(+), 61 deletions(-)

diff --git a/clang/include/clang/Basic/Attr.td 
b/clang/include/clang/Basic/Attr.td
index db17211747b17d..d9b55422d3a530 100644
--- a/clang/include/clang/Basic/Attr.td
+++ b/clang/include/clang/Basic/Attr.td
@@ -279,12 +279,15 @@ class DefaultIntArgument : 
IntArgument {
 
 // This argument is more complex, it includes the enumerator type
 // name, whether the enum type is externally defined, a list of
-// strings to accept, and a list of enumerators to map them to.
-class EnumArgument values,
+// possible values, and a list of enumerators to map them to.
+class EnumArgument 
values,
list enums, bit opt = 0, bit fake = 0,
bit isExternalType = 0>
 : Argument {
   string Type = type;
+  // When true, the argument will be parsed as an unevaluated string literal
+  // and otherwise as an identifier.
+  bit IsString = is_string;
   list Values = values;
   list Enums = enums;
   bit IsExternalType = isExternalType;
@@ -292,10 +295,14 @@ class EnumArgument 
values,
 
 // FIXME: There should be a VariadicArgument type that takes any other type
 //of argument and generates the appropriate type.
-class VariadicEnumArgument values,
-   list enums, bit isExternalType = 0>
+class VariadicEnumArgument values, list enums,
+   bit isExternalType = 0>
 : Argument  {
   string Type = type;
+  // When true, the argument will be parsed as an unevaluated string literal
+  // and otherwise as an identifier.
+  bit IsString = is_string;
   list Values = values;
   list Enums = enums;
   bit IsExternalType = isExternalType;
@@ -898,7 +905,7 @@ def ARMInterrupt : InheritableAttr, 
TargetSpecificAttr {
   // MSP430Interrupt's, MipsInterrupt's and AnyX86Interrupt's spellings
   // must match.
   let Spellings = [GCC<"interrupt">];
-  let Args = [EnumArgument<"Interrupt", "InterruptType",
+  let Args = [EnumArgument<"Interrupt", "InterruptType", /*is_string=*/true,
["IRQ", "FIQ", "SWI", "ABORT", "UNDEF", ""],
["IRQ", "FIQ", "SWI", "ABORT", "UNDEF", "Generic"],
1>];
@@ -1023,7 +1030,8 @@ def ExternalSourceSymbol : InheritableAttr {
 
 def Blocks : InheritableAttr {
   let Spellings = [Clang<"blocks">];
-  let Args = [EnumArgument<"Type", "BlockType", ["byref"], ["ByRef"]>];
+  let Args = [EnumArgument<"Type", "BlockType", /*is_string=*/true,
+   ["byref"], ["ByRef"]>];
   let Documentation = [Undocumented];
 }
 
@@ -1597,7 +1605,7 @@ def FlagEnum : InheritableAttr {
 def EnumExtensibility : InheritableAttr {
   let Spellings = [Clang<"enum_extensibility">];
   let Subjects = SubjectList<[Enum]>;
-  let Args = [EnumArgument<"Extensibility", "Kind",
+  let Args = [EnumArgument<"Extensibility", "Kind", /*is_string=*/false,
   ["closed", "open"], ["Closed", "Open"]>];
   let Documentation = [EnumExtensibilityDocs];
 }
@@ -1763,7 +1771,7 @@ def MipsInterrupt : InheritableAttr, 
TargetSpecificAttr {
   // must match.
   let Spellings = [GCC<"interrupt">];
   let Subjects = SubjectList<[Function]>;
-  let Args = [EnumArgument<"Interrupt", "InterruptType",
+  let Args = [EnumArgument<"Interrupt", "InterruptType", /*is_string=*/true,
["vector=

[clang-tools-extra] [llvm] [clang] [clang] Differentiate between identifier and string EnumArgument (PR #68550)

2024-01-12 Thread Sergei Barannikov via cfe-commits

https://github.com/s-barannikov updated 
https://github.com/llvm/llvm-project/pull/68550

>From 96dd0121b095f92cc66fcfc3ef08a19d0b2d6bec Mon Sep 17 00:00:00 2001
From: Sergei Barannikov 
Date: Mon, 9 Oct 2023 01:38:33 +0300
Subject: [PATCH] [clang] Differentiate between identifier and string
 EnumArgument

EnumArgument may be a string or an identifier. If it is a string, it
should be parsed as unevaluated string literal. Add IsString flag to
EnumArgument so that the parser can choose the correct parsing method.

Target-specific attributes that share spelling may have different
attribute "prototypes". For example, ARM's version of "interrupt"
attribute accepts a string enum, while MSP430's version accepts an
unsigned integer. Adjust ClangAttrEmitter so that the generated
`attributeStringLiteralListArg` returns the correct mask depending on
target triple.

It is worth noting that even after this change some string arguments are
still parsed as identifiers or, worse, as expressions. This is because
of some special logic in `ParseAttributeArgsCommon`. Fixing it is out of
scope of this patch.
---
 clang/include/clang/Basic/Attr.td| 82 +++-
 clang/lib/Parse/ParseDecl.cpp|  4 +-
 clang/test/Sema/attr-function-return.c   |  2 +-
 clang/test/Sema/callingconv-iamcu.c  |  2 +-
 clang/test/Sema/callingconv.c|  2 +-
 clang/test/Sema/zero_call_used_regs.c|  2 +-
 clang/test/SemaCXX/warn-consumed-parsing.cpp |  2 +-
 clang/test/SemaHLSL/shader_type_attr.hlsl|  4 +-
 clang/utils/TableGen/ClangAttrEmitter.cpp| 80 +++
 9 files changed, 119 insertions(+), 61 deletions(-)

diff --git a/clang/include/clang/Basic/Attr.td 
b/clang/include/clang/Basic/Attr.td
index db17211747b17d..d9b55422d3a530 100644
--- a/clang/include/clang/Basic/Attr.td
+++ b/clang/include/clang/Basic/Attr.td
@@ -279,12 +279,15 @@ class DefaultIntArgument : 
IntArgument {
 
 // This argument is more complex, it includes the enumerator type
 // name, whether the enum type is externally defined, a list of
-// strings to accept, and a list of enumerators to map them to.
-class EnumArgument values,
+// possible values, and a list of enumerators to map them to.
+class EnumArgument 
values,
list enums, bit opt = 0, bit fake = 0,
bit isExternalType = 0>
 : Argument {
   string Type = type;
+  // When true, the argument will be parsed as an unevaluated string literal
+  // and otherwise as an identifier.
+  bit IsString = is_string;
   list Values = values;
   list Enums = enums;
   bit IsExternalType = isExternalType;
@@ -292,10 +295,14 @@ class EnumArgument 
values,
 
 // FIXME: There should be a VariadicArgument type that takes any other type
 //of argument and generates the appropriate type.
-class VariadicEnumArgument values,
-   list enums, bit isExternalType = 0>
+class VariadicEnumArgument values, list enums,
+   bit isExternalType = 0>
 : Argument  {
   string Type = type;
+  // When true, the argument will be parsed as an unevaluated string literal
+  // and otherwise as an identifier.
+  bit IsString = is_string;
   list Values = values;
   list Enums = enums;
   bit IsExternalType = isExternalType;
@@ -898,7 +905,7 @@ def ARMInterrupt : InheritableAttr, 
TargetSpecificAttr {
   // MSP430Interrupt's, MipsInterrupt's and AnyX86Interrupt's spellings
   // must match.
   let Spellings = [GCC<"interrupt">];
-  let Args = [EnumArgument<"Interrupt", "InterruptType",
+  let Args = [EnumArgument<"Interrupt", "InterruptType", /*is_string=*/true,
["IRQ", "FIQ", "SWI", "ABORT", "UNDEF", ""],
["IRQ", "FIQ", "SWI", "ABORT", "UNDEF", "Generic"],
1>];
@@ -1023,7 +1030,8 @@ def ExternalSourceSymbol : InheritableAttr {
 
 def Blocks : InheritableAttr {
   let Spellings = [Clang<"blocks">];
-  let Args = [EnumArgument<"Type", "BlockType", ["byref"], ["ByRef"]>];
+  let Args = [EnumArgument<"Type", "BlockType", /*is_string=*/true,
+   ["byref"], ["ByRef"]>];
   let Documentation = [Undocumented];
 }
 
@@ -1597,7 +1605,7 @@ def FlagEnum : InheritableAttr {
 def EnumExtensibility : InheritableAttr {
   let Spellings = [Clang<"enum_extensibility">];
   let Subjects = SubjectList<[Enum]>;
-  let Args = [EnumArgument<"Extensibility", "Kind",
+  let Args = [EnumArgument<"Extensibility", "Kind", /*is_string=*/false,
   ["closed", "open"], ["Closed", "Open"]>];
   let Documentation = [EnumExtensibilityDocs];
 }
@@ -1763,7 +1771,7 @@ def MipsInterrupt : InheritableAttr, 
TargetSpecificAttr {
   // must match.
   let Spellings = [GCC<"interrupt">];
   let Subjects = SubjectList<[Function]>;
-  let Args = [EnumArgument<"Interrupt", "InterruptType",
+  let Args = [EnumArgument<"Interrupt", "InterruptType", /*is_string=*/true,
["vector=

[clang] 6bd488d - [CodeGen] Use DenseMap::contains (NFC)

2024-01-12 Thread Kazu Hirata via cfe-commits

Author: Kazu Hirata
Date: 2024-01-12T22:08:28-08:00
New Revision: 6bd488dd24cc06daea0d9a9dea0e2843f4c8d38e

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

LOG: [CodeGen] Use DenseMap::contains (NFC)

Added: 


Modified: 
clang/lib/CodeGen/CoverageMappingGen.cpp

Removed: 




diff  --git a/clang/lib/CodeGen/CoverageMappingGen.cpp 
b/clang/lib/CodeGen/CoverageMappingGen.cpp
index b245abd16c3f4a..916016601a9327 100644
--- a/clang/lib/CodeGen/CoverageMappingGen.cpp
+++ b/clang/lib/CodeGen/CoverageMappingGen.cpp
@@ -730,8 +730,8 @@ struct MCDCCoverageBuilder {
   return;
 
 // If binary expression is disqualified, don't do mapping.
-if (NestLevel.empty() && MCDCBitmapMap.find(CodeGenFunction::stripCond(
- E)) == MCDCBitmapMap.end())
+if (NestLevel.empty() &&
+!MCDCBitmapMap.contains(CodeGenFunction::stripCond(E)))
   NotMapped = true;
 
 // Push Stmt on 'NestLevel' stack to keep track of nest location.
@@ -744,7 +744,7 @@ struct MCDCCoverageBuilder {
 // If the operator itself has an assigned ID, this means it represents a
 // larger subtree.  In this case, pop its ID out of the RHS stack and
 // assign that ID to its LHS node.  Its RHS will receive a new ID.
-if (CondIDs.find(CodeGenFunction::stripCond(E)) != CondIDs.end()) {
+if (CondIDs.contains(CodeGenFunction::stripCond(E))) {
   // If Stmt has an ID, assign its ID to LHS
   CondIDs[CodeGenFunction::stripCond(E->getLHS())] = CondIDs[E];
 



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


[llvm] [clang] [RISCV] Bump Zfbfmin, Zvfbfmin, and Zvfbfwma to 1.0. (PR #78021)

2024-01-12 Thread via cfe-commits

github-actions[bot] wrote:




:warning: C/C++ code formatter, clang-format found issues in your code. 
:warning:



You can test this locally with the following command:


``bash
git-clang-format --diff fc2766c1d4776a8e56a7b931a779c57bf7ed3d8b 
9081bb6aa1e461893680f0ab91048a5ca1cd680a -- 
clang/test/Preprocessor/riscv-target-features.c 
llvm/lib/Support/RISCVISAInfo.cpp llvm/unittests/Support/RISCVISAInfoTest.cpp
``





View the diff from clang-format here.


``diff
diff --git a/llvm/lib/Support/RISCVISAInfo.cpp 
b/llvm/lib/Support/RISCVISAInfo.cpp
index 0f549168cb..f75415c02b 100644
--- a/llvm/lib/Support/RISCVISAInfo.cpp
+++ b/llvm/lib/Support/RISCVISAInfo.cpp
@@ -189,8 +189,7 @@ static const RISCVSupportedExtension 
SupportedExperimentalExtensions[] = {
 
 {"zfbfmin", {1, 0}},
 
-{"zicfilp", {0, 4}},
-{"zicfiss", {0, 4}},
+{"zicfilp", {0, 4}},  {"zicfiss", {0, 4}},
 
 {"zicond", {1, 0}},
 
@@ -198,8 +197,7 @@ static const RISCVSupportedExtension 
SupportedExperimentalExtensions[] = {
 
 {"ztso", {0, 1}},
 
-{"zvfbfmin", {1, 0}},
-{"zvfbfwma", {1, 0}},
+{"zvfbfmin", {1, 0}}, {"zvfbfwma", {1, 0}},
 };
 
 static void verifyTables() {

``




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


[llvm] [clang] [RISCV] Bump Zfbfmin, Zvfbfmin, and Zvfbfwma to 1.0. (PR #78021)

2024-01-12 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang

Author: Craig Topper (topperc)


Changes



---
Full diff: https://github.com/llvm/llvm-project/pull/78021.diff


6 Files Affected:

- (modified) clang/test/Preprocessor/riscv-target-features.c (+9-9) 
- (modified) llvm/docs/RISCVUsage.rst (+1-1) 
- (modified) llvm/lib/Support/RISCVISAInfo.cpp (+3-3) 
- (modified) llvm/test/CodeGen/RISCV/attributes.ll (+8-8) 
- (modified) llvm/test/MC/RISCV/attribute-arch.s (+7-7) 
- (modified) llvm/unittests/Support/RISCVISAInfoTest.cpp (+3-3) 


``diff
diff --git a/clang/test/Preprocessor/riscv-target-features.c 
b/clang/test/Preprocessor/riscv-target-features.c
index 02d8d34116f804..be28b97af29c6a 100644
--- a/clang/test/Preprocessor/riscv-target-features.c
+++ b/clang/test/Preprocessor/riscv-target-features.c
@@ -1042,12 +1042,12 @@
 // CHECK-ZFA-EXT: __riscv_zfa 100{{$}}
 
 // RUN: %clang --target=riscv32 -menable-experimental-extensions \
-// RUN: -march=rv32izfbfmin0p8 -x c -E -dM %s \
+// RUN: -march=rv32izfbfmin1p0 -x c -E -dM %s \
 // RUN: -o - | FileCheck --check-prefix=CHECK-ZFBFMIN-EXT %s
 // RUN: %clang --target=riscv64 -menable-experimental-extensions \
-// RUN: -march=rv64izfbfmin0p8 -x c -E -dM %s \
+// RUN: -march=rv64izfbfmin1p0 -x c -E -dM %s \
 // RUN: -o - | FileCheck --check-prefix=CHECK-ZFBFMIN-EXT %s
-// CHECK-ZFBFMIN-EXT: __riscv_zfbfmin 8000{{$}}
+// CHECK-ZFBFMIN-EXT: __riscv_zfbfmin 100{{$}}
 
 // RUN: %clang --target=riscv32 -menable-experimental-extensions \
 // RUN: -march=rv32i_zicfilp0p4 -x c -E -dM %s \
@@ -1106,20 +1106,20 @@
 // CHECK-ZVBC-EXT: __riscv_zvbc  100{{$}}
 
 // RUN: %clang --target=riscv32 -menable-experimental-extensions \
-// RUN: -march=rv32ifzvfbfmin0p8 -x c -E -dM %s \
+// RUN: -march=rv32ifzvfbfmin1p0 -x c -E -dM %s \
 // RUN: -o - | FileCheck --check-prefix=CHECK-ZVFBFMIN-EXT %s
 // RUN: %clang --target=riscv64 -menable-experimental-extensions \
-// RUN: -march=rv64ifzvfbfmin0p8 -x c -E -dM %s \
+// RUN: -march=rv64ifzvfbfmin1p0 -x c -E -dM %s \
 // RUN: -o - | FileCheck --check-prefix=CHECK-ZVFBFMIN-EXT %s
-// CHECK-ZVFBFMIN-EXT: __riscv_zvfbfmin 8000{{$}}
+// CHECK-ZVFBFMIN-EXT: __riscv_zvfbfmin 100{{$}}
 
 // RUN: %clang --target=riscv32 -menable-experimental-extensions \
-// RUN: -march=rv32ifzvfbfwma0p8 -x c -E -dM %s \
+// RUN: -march=rv32ifzvfbfwma1p0 -x c -E -dM %s \
 // RUN: -o - | FileCheck --check-prefix=CHECK-ZVFBFWMA-EXT %s
 // RUN: %clang --target=riscv64 -menable-experimental-extensions \
-// RUN: -march=rv64ifzvfbfwma0p8 -x c -E -dM %s \
+// RUN: -march=rv64ifzvfbfwma1p0 -x c -E -dM %s \
 // RUN: -o - | FileCheck --check-prefix=CHECK-ZVFBFWMA-EXT %s
-// CHECK-ZVFBFWMA-EXT: __riscv_zvfbfwma 8000{{$}}
+// CHECK-ZVFBFWMA-EXT: __riscv_zvfbfwma 100{{$}}
 
 // RUN: %clang --target=riscv32 -menable-experimental-extensions \
 // RUN: -march=rv32i_zve32x_zvkg1p0 -x c -E -dM %s \
diff --git a/llvm/docs/RISCVUsage.rst b/llvm/docs/RISCVUsage.rst
index 99c7146825f5ee..ee61db4960bce0 100644
--- a/llvm/docs/RISCVUsage.rst
+++ b/llvm/docs/RISCVUsage.rst
@@ -210,7 +210,7 @@ The primary goal of experimental support is to assist in 
the process of ratifica
   LLVM implements the `1.0-rc1 draft specification 
`_.
 
 ``experimental-zfbfmin``, ``experimental-zvfbfmin``, ``experimental-zvfbfwma``
-  LLVM implements assembler support for the `0.8.0 draft specification 
`_.
+  LLVM implements assembler support for the `1.0.0-rc2 specification 
`_.
 
 ``experimental-zicfilp``, ``experimental-zicfiss``
   LLVM implements the `0.4 draft specification 
`__.
diff --git a/llvm/lib/Support/RISCVISAInfo.cpp 
b/llvm/lib/Support/RISCVISAInfo.cpp
index 390d950486a795..0f549168cb8e91 100644
--- a/llvm/lib/Support/RISCVISAInfo.cpp
+++ b/llvm/lib/Support/RISCVISAInfo.cpp
@@ -187,7 +187,7 @@ static const RISCVSupportedExtension 
SupportedExperimentalExtensions[] = {
 
 {"zcmop", {0, 2}},
 
-{"zfbfmin", {0, 8}},
+{"zfbfmin", {1, 0}},
 
 {"zicfilp", {0, 4}},
 {"zicfiss", {0, 4}},
@@ -198,8 +198,8 @@ static const RISCVSupportedExtension 
SupportedExperimentalExtensions[] = {
 
 {"ztso", {0, 1}},
 
-{"zvfbfmin", {0, 8}},
-{"zvfbfwma", {0, 8}},
+{"zvfbfmin", {1, 0}},
+{"zvfbfwma", {1, 0}},
 };
 
 static void verifyTables() {
diff --git a/llvm/test/CodeGen/RISCV/attributes.ll 
b/llvm/test/CodeGen/RISCV/attributes.ll
index 9a6e78c09ad8c3..60ef404ac345d1 100644
--- a/llvm/test/CodeGen/RISCV/attributes.ll
+++ b/llvm/test/CodeGen/RISCV/attributes.ll
@@ -238,7 +238,7 @@
 ; RV32XCVMEM: .attribute 5, "rv32i2p1_xcvmem1p0"
 ; RV32XCVSIMD: .attribute 5, "rv32i2p1_xcvsimd1p0"
 ; RV32XCVBI: .attribute 5, "rv32i2p1_xcvbi1p0"
-; RV32XSFVFWMACCQQQ: .attribute 5, 
"rv32i2p1_f2p2_

[llvm] [clang] [RISCV] Bump Zfbfmin, Zvfbfmin, and Zvfbfwma to 1.0. (PR #78021)

2024-01-12 Thread Craig Topper via cfe-commits

https://github.com/topperc created 
https://github.com/llvm/llvm-project/pull/78021

None

>From 9081bb6aa1e461893680f0ab91048a5ca1cd680a Mon Sep 17 00:00:00 2001
From: Craig Topper 
Date: Fri, 12 Jan 2024 22:01:03 -0800
Subject: [PATCH] [RISCV] Bump Zfbfmin, Zvfbfmin, and Zvfbfwma to 1.0.

---
 .../test/Preprocessor/riscv-target-features.c  | 18 +-
 llvm/docs/RISCVUsage.rst   |  2 +-
 llvm/lib/Support/RISCVISAInfo.cpp  |  6 +++---
 llvm/test/CodeGen/RISCV/attributes.ll  | 16 
 llvm/test/MC/RISCV/attribute-arch.s| 14 +++---
 llvm/unittests/Support/RISCVISAInfoTest.cpp|  6 +++---
 6 files changed, 31 insertions(+), 31 deletions(-)

diff --git a/clang/test/Preprocessor/riscv-target-features.c 
b/clang/test/Preprocessor/riscv-target-features.c
index 02d8d34116f804..be28b97af29c6a 100644
--- a/clang/test/Preprocessor/riscv-target-features.c
+++ b/clang/test/Preprocessor/riscv-target-features.c
@@ -1042,12 +1042,12 @@
 // CHECK-ZFA-EXT: __riscv_zfa 100{{$}}
 
 // RUN: %clang --target=riscv32 -menable-experimental-extensions \
-// RUN: -march=rv32izfbfmin0p8 -x c -E -dM %s \
+// RUN: -march=rv32izfbfmin1p0 -x c -E -dM %s \
 // RUN: -o - | FileCheck --check-prefix=CHECK-ZFBFMIN-EXT %s
 // RUN: %clang --target=riscv64 -menable-experimental-extensions \
-// RUN: -march=rv64izfbfmin0p8 -x c -E -dM %s \
+// RUN: -march=rv64izfbfmin1p0 -x c -E -dM %s \
 // RUN: -o - | FileCheck --check-prefix=CHECK-ZFBFMIN-EXT %s
-// CHECK-ZFBFMIN-EXT: __riscv_zfbfmin 8000{{$}}
+// CHECK-ZFBFMIN-EXT: __riscv_zfbfmin 100{{$}}
 
 // RUN: %clang --target=riscv32 -menable-experimental-extensions \
 // RUN: -march=rv32i_zicfilp0p4 -x c -E -dM %s \
@@ -1106,20 +1106,20 @@
 // CHECK-ZVBC-EXT: __riscv_zvbc  100{{$}}
 
 // RUN: %clang --target=riscv32 -menable-experimental-extensions \
-// RUN: -march=rv32ifzvfbfmin0p8 -x c -E -dM %s \
+// RUN: -march=rv32ifzvfbfmin1p0 -x c -E -dM %s \
 // RUN: -o - | FileCheck --check-prefix=CHECK-ZVFBFMIN-EXT %s
 // RUN: %clang --target=riscv64 -menable-experimental-extensions \
-// RUN: -march=rv64ifzvfbfmin0p8 -x c -E -dM %s \
+// RUN: -march=rv64ifzvfbfmin1p0 -x c -E -dM %s \
 // RUN: -o - | FileCheck --check-prefix=CHECK-ZVFBFMIN-EXT %s
-// CHECK-ZVFBFMIN-EXT: __riscv_zvfbfmin 8000{{$}}
+// CHECK-ZVFBFMIN-EXT: __riscv_zvfbfmin 100{{$}}
 
 // RUN: %clang --target=riscv32 -menable-experimental-extensions \
-// RUN: -march=rv32ifzvfbfwma0p8 -x c -E -dM %s \
+// RUN: -march=rv32ifzvfbfwma1p0 -x c -E -dM %s \
 // RUN: -o - | FileCheck --check-prefix=CHECK-ZVFBFWMA-EXT %s
 // RUN: %clang --target=riscv64 -menable-experimental-extensions \
-// RUN: -march=rv64ifzvfbfwma0p8 -x c -E -dM %s \
+// RUN: -march=rv64ifzvfbfwma1p0 -x c -E -dM %s \
 // RUN: -o - | FileCheck --check-prefix=CHECK-ZVFBFWMA-EXT %s
-// CHECK-ZVFBFWMA-EXT: __riscv_zvfbfwma 8000{{$}}
+// CHECK-ZVFBFWMA-EXT: __riscv_zvfbfwma 100{{$}}
 
 // RUN: %clang --target=riscv32 -menable-experimental-extensions \
 // RUN: -march=rv32i_zve32x_zvkg1p0 -x c -E -dM %s \
diff --git a/llvm/docs/RISCVUsage.rst b/llvm/docs/RISCVUsage.rst
index 99c7146825f5ee..ee61db4960bce0 100644
--- a/llvm/docs/RISCVUsage.rst
+++ b/llvm/docs/RISCVUsage.rst
@@ -210,7 +210,7 @@ The primary goal of experimental support is to assist in 
the process of ratifica
   LLVM implements the `1.0-rc1 draft specification 
`_.
 
 ``experimental-zfbfmin``, ``experimental-zvfbfmin``, ``experimental-zvfbfwma``
-  LLVM implements assembler support for the `0.8.0 draft specification 
`_.
+  LLVM implements assembler support for the `1.0.0-rc2 specification 
`_.
 
 ``experimental-zicfilp``, ``experimental-zicfiss``
   LLVM implements the `0.4 draft specification 
`__.
diff --git a/llvm/lib/Support/RISCVISAInfo.cpp 
b/llvm/lib/Support/RISCVISAInfo.cpp
index 390d950486a795..0f549168cb8e91 100644
--- a/llvm/lib/Support/RISCVISAInfo.cpp
+++ b/llvm/lib/Support/RISCVISAInfo.cpp
@@ -187,7 +187,7 @@ static const RISCVSupportedExtension 
SupportedExperimentalExtensions[] = {
 
 {"zcmop", {0, 2}},
 
-{"zfbfmin", {0, 8}},
+{"zfbfmin", {1, 0}},
 
 {"zicfilp", {0, 4}},
 {"zicfiss", {0, 4}},
@@ -198,8 +198,8 @@ static const RISCVSupportedExtension 
SupportedExperimentalExtensions[] = {
 
 {"ztso", {0, 1}},
 
-{"zvfbfmin", {0, 8}},
-{"zvfbfwma", {0, 8}},
+{"zvfbfmin", {1, 0}},
+{"zvfbfwma", {1, 0}},
 };
 
 static void verifyTables() {
diff --git a/llvm/test/CodeGen/RISCV/attributes.ll 
b/llvm/test/CodeGen/RISCV/attributes.ll
index 9a6e78c09ad8c3..60ef404ac345d1 100644
--- a/llvm/test/CodeGen/RISCV/attributes.ll
+++ b/llvm/test/CodeGen/RISCV/attributes.ll
@@ -238,7 +238,7 @@
 ; RV32XCVMEM: 

[llvm] [clang] [SPARC] Support reserving arbitrary general purpose registers (PR #74927)

2024-01-12 Thread Sergei Barannikov via cfe-commits


@@ -29,6 +29,12 @@ namespace llvm {
 class StringRef;
 
 class SparcSubtarget : public SparcGenSubtargetInfo {
+  // Reserve*Register[i] - *#i is not available as a general purpose register.
+  BitVector ReserveGRegister;

s-barannikov wrote:

Can this be a single `BitVector` indexed by physical register number? This 
would simplify `TRI.getReservedRegs()`, I think.


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


[clang] [llvm] [SPARC] Support reserving arbitrary general purpose registers (PR #74927)

2024-01-12 Thread Sergei Barannikov via cfe-commits


@@ -98,9 +96,34 @@ BitVector SparcRegisterInfo::getReservedRegs(const 
MachineFunction &MF) const {
   for (unsigned n = 0; n < 31; n++)
 Reserved.set(SP::ASR1 + n);
 
+  for (size_t i = 0; i < SP::IntRegsRegClass.getNumRegs() / 4; ++i) {
+// Mark both single register and register pairs.
+if (MF.getSubtarget().isGRegisterReserved(i)) {
+  Reserved.set(SP::G0 + i);
+  Reserved.set(SP::G0_G1 + i / 2);
+}
+if (MF.getSubtarget().isORegisterReserved(i)) {
+  Reserved.set(SP::O0 + i);
+  Reserved.set(SP::O0_O1 + i / 2);
+}
+if (MF.getSubtarget().isLRegisterReserved(i)) {
+  Reserved.set(SP::L0 + i);
+  Reserved.set(SP::L0_L1 + i / 2);
+}
+if (MF.getSubtarget().isIRegisterReserved(i)) {
+  Reserved.set(SP::I0 + i);
+  Reserved.set(SP::I0_I1 + i / 2);
+}
+  }
+
   return Reserved;

s-barannikov wrote:

```suggestion
  return checkAllSuperRegsMarked(Reserved);
```


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


[llvm] [clang] [SPARC] Support reserving arbitrary general purpose registers (PR #74927)

2024-01-12 Thread Sergei Barannikov via cfe-commits


@@ -80,6 +86,11 @@ class SparcSubtarget : public SparcGenSubtargetInfo {
 return is64Bit() ? 2047 : 0;
   }
 
+  bool isGRegisterReserved(size_t i) const { return ReserveGRegister[i]; }
+  bool isORegisterReserved(size_t i) const { return ReserveORegister[i]; }
+  bool isLRegisterReserved(size_t i) const { return ReserveLRegister[i]; }
+  bool isIRegisterReserved(size_t i) const { return ReserveIRegister[i]; }

s-barannikov wrote:

This could be a single interface accepting a physical register instead of an 
index.


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


[llvm] [clang] [SPARC] Support reserving arbitrary general purpose registers (PR #74927)

2024-01-12 Thread Sergei Barannikov via cfe-commits


@@ -98,9 +96,34 @@ BitVector SparcRegisterInfo::getReservedRegs(const 
MachineFunction &MF) const {
   for (unsigned n = 0; n < 31; n++)
 Reserved.set(SP::ASR1 + n);
 
+  for (size_t i = 0; i < SP::IntRegsRegClass.getNumRegs() / 4; ++i) {
+// Mark both single register and register pairs.
+if (MF.getSubtarget().isGRegisterReserved(i)) {
+  Reserved.set(SP::G0 + i);
+  Reserved.set(SP::G0_G1 + i / 2);
+}

s-barannikov wrote:

```suggestion
if (MF.getSubtarget().isGRegisterReserved(i))
  markSuperRegs(Reserved, SP::G0 + i);
```

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


[clang] [clang-format] Optimize processing .clang-format-ignore files (PR #76733)

2024-01-12 Thread Owen Pan via cfe-commits

owenca wrote:

See #77977.

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


[clang] [clang][Interp] Diagnose reads from non-const global variables (PR #71919)

2024-01-12 Thread Timm Baeder via cfe-commits

https://github.com/tbaederr closed 
https://github.com/llvm/llvm-project/pull/71919
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] fc2766c - [clang][Interp] Diagnose reads from non-const global variables (#71919)

2024-01-12 Thread via cfe-commits

Author: Timm Baeder
Date: 2024-01-13T05:51:03+01:00
New Revision: fc2766c1d4776a8e56a7b931a779c57bf7ed3d8b

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

LOG: [clang][Interp] Diagnose reads from non-const global variables (#71919)

This fixes a long-standing FIXME item.

Unfortunately it changes the diagnostic output of the tests added in
`cxx23.cpp`, but they were wrong before and are wrong after, so no big
deal.

Added: 


Modified: 
clang/lib/AST/Interp/ByteCodeExprGen.cpp
clang/lib/AST/Interp/Interp.cpp
clang/lib/AST/Interp/Interp.h
clang/lib/AST/Interp/Opcodes.td
clang/test/AST/Interp/arrays.cpp
clang/test/AST/Interp/cxx23.cpp
clang/test/AST/Interp/literals.cpp

Removed: 




diff  --git a/clang/lib/AST/Interp/ByteCodeExprGen.cpp 
b/clang/lib/AST/Interp/ByteCodeExprGen.cpp
index 7f8bbe78732481..d6be9a306aeaf6 100644
--- a/clang/lib/AST/Interp/ByteCodeExprGen.cpp
+++ b/clang/lib/AST/Interp/ByteCodeExprGen.cpp
@@ -2337,7 +2337,7 @@ bool ByteCodeExprGen::visitDecl(const VarDecl 
*VD) {
 auto GlobalIndex = P.getGlobal(VD);
 assert(GlobalIndex); // visitVarDecl() didn't return false.
 if (VarT) {
-  if (!this->emitGetGlobal(*VarT, *GlobalIndex, VD))
+  if (!this->emitGetGlobalUnchecked(*VarT, *GlobalIndex, VD))
 return false;
 } else {
   if (!this->emitGetPtrGlobal(*GlobalIndex, VD))

diff  --git a/clang/lib/AST/Interp/Interp.cpp b/clang/lib/AST/Interp/Interp.cpp
index 9de0926b9dba9c..b95a52199846fa 100644
--- a/clang/lib/AST/Interp/Interp.cpp
+++ b/clang/lib/AST/Interp/Interp.cpp
@@ -53,6 +53,21 @@ static bool Jf(InterpState &S, CodePtr &PC, int32_t Offset) {
   return true;
 }
 
+static void diagnoseNonConstVariable(InterpState &S, CodePtr OpPC,
+ const ValueDecl *VD) {
+  if (!S.getLangOpts().CPlusPlus)
+return;
+
+  const SourceInfo &Loc = S.Current->getSource(OpPC);
+  S.FFDiag(Loc,
+   VD->getType()->isIntegralOrEnumerationType()
+   ? diag::note_constexpr_ltor_non_const_int
+   : diag::note_constexpr_ltor_non_constexpr,
+   1)
+  << VD;
+  S.Note(VD->getLocation(), diag::note_declared_at);
+}
+
 static bool CheckActive(InterpState &S, CodePtr OpPC, const Pointer &Ptr,
 AccessKinds AK) {
   if (Ptr.isActive())
@@ -171,9 +186,7 @@ bool CheckExtern(InterpState &S, CodePtr OpPC, const 
Pointer &Ptr) {
 
   if (!S.checkingPotentialConstantExpression() && S.getLangOpts().CPlusPlus) {
 const auto *VD = Ptr.getDeclDesc()->asValueDecl();
-const SourceInfo &Loc = S.Current->getSource(OpPC);
-S.FFDiag(Loc, diag::note_constexpr_ltor_non_constexpr, 1) << VD;
-S.Note(VD->getLocation(), diag::note_declared_at);
+diagnoseNonConstVariable(S, OpPC, VD);
   }
   return false;
 }
@@ -216,6 +229,24 @@ bool CheckLive(InterpState &S, CodePtr OpPC, const Pointer 
&Ptr,
   return true;
 }
 
+bool CheckConstant(InterpState &S, CodePtr OpPC, const Descriptor *Desc) {
+  assert(Desc);
+  if (const auto *D = Desc->asValueDecl()) {
+if (const auto *VD = dyn_cast(D);
+VD && VD->hasGlobalStorage() &&
+!(VD->isConstexpr() || VD->getType().isConstQualified())) {
+  diagnoseNonConstVariable(S, OpPC, VD);
+  return false;
+}
+  }
+
+  return true;
+}
+
+static bool CheckConstant(InterpState &S, CodePtr OpPC, const Pointer &Ptr) {
+  return CheckConstant(S, OpPC, Ptr.getDeclDesc());
+}
+
 bool CheckDummy(InterpState &S, CodePtr OpPC, const Pointer &Ptr) {
   return !Ptr.isZero() && !Ptr.isDummy();
 }
@@ -304,6 +335,9 @@ bool CheckInitialized(InterpState &S, CodePtr OpPC, const 
Pointer &Ptr,
 bool CheckLoad(InterpState &S, CodePtr OpPC, const Pointer &Ptr) {
   if (!CheckLive(S, OpPC, Ptr, AK_Read))
 return false;
+  if (!CheckConstant(S, OpPC, Ptr))
+return false;
+
   if (!CheckDummy(S, OpPC, Ptr))
 return false;
   if (!CheckExtern(S, OpPC, Ptr))
@@ -605,13 +639,7 @@ bool CheckDeclRef(InterpState &S, CodePtr OpPC, const 
DeclRefExpr *DR) {
 }
   } else if (const auto *VD = dyn_cast(D)) {
 if (!VD->getType().isConstQualified()) {
-  S.FFDiag(E,
-   VD->getType()->isIntegralOrEnumerationType()
-   ? diag::note_constexpr_ltor_non_const_int
-   : diag::note_constexpr_ltor_non_constexpr,
-   1)
-  << VD;
-  S.Note(VD->getLocation(), diag::note_declared_at) << 
VD->getSourceRange();
+  diagnoseNonConstVariable(S, OpPC, VD);
   return false;
 }
 

diff  --git a/clang/lib/AST/Interp/Interp.h b/clang/lib/AST/Interp/Interp.h
index c05dea0cc55d3c..dbbc4c09ce42a1 100644
--- a/clang/lib/AST/Interp/Interp.h
+++ b/clang/lib/AST/Interp/Interp.h
@@ -77,6 +77,9 @@ bool CheckSubobject(InterpState &S, 

[llvm] [clang-tools-extra] [Kaleidoscope] LLVM is not needed for chapter two (PR #69823)

2024-01-12 Thread Fangrui Song via cfe-commits

https://github.com/MaskRay closed 
https://github.com/llvm/llvm-project/pull/69823
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [llvm] [Kaleidoscope] LLVM is not needed for chapter two (PR #69823)

2024-01-12 Thread Fangrui Song via cfe-commits

https://github.com/MaskRay edited 
https://github.com/llvm/llvm-project/pull/69823
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [llvm] [Kaleidoscope] LLVM is not needed for chapter two (PR #69823)

2024-01-12 Thread Fangrui Song via cfe-commits

https://github.com/MaskRay edited 
https://github.com/llvm/llvm-project/pull/69823
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [llvm] LLVM is not needed for chapter two. (PR #69823)

2024-01-12 Thread Fangrui Song via cfe-commits

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

This is correct. `llvm/examples/Kaleidoscope/Chapter2/toy.cpp` doesn't use LLVM.

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


[clang] [clang][analyzer] Improve modeling of 'fseeko' and 'ftello' in StdLibraryFunctionsChecker (PR #77902)

2024-01-12 Thread Ben Shi via cfe-commits

https://github.com/benshi001 updated 
https://github.com/llvm/llvm-project/pull/77902

>From 97d753446ffc8eb9c701effb52dd671afc73e1dd Mon Sep 17 00:00:00 2001
From: Ben Shi 
Date: Fri, 12 Jan 2024 18:17:39 +0800
Subject: [PATCH 1/2] [clang][analyzer] Improve modeling of 'fseeko' and
 'ftello' in StdLibraryFunctionsChecker

---
 .../Checkers/StdLibraryFunctionsChecker.cpp   | 12 +--
 clang/test/Analysis/stream-errno.c| 32 +++
 2 files changed, 41 insertions(+), 3 deletions(-)

diff --git a/clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp 
b/clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
index 3b36565681a7f3..f93eb4bf48 100644
--- a/clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
@@ -2859,13 +2859,19 @@ void StdLibraryFunctionsChecker::initFunctionSummaries(
 "fseeko",
 Signature(ArgTypes{FilePtrTy, Off_tTy, IntTy}, RetType{IntTy}),
 Summary(NoEvalCall)
-.Case(ReturnsZeroOrMinusOne, ErrnoIrrelevant)
-.ArgConstraint(NotNull(ArgNo(0;
+.Case(ReturnsZero, ErrnoMustNotBeChecked, GenericSuccessMsg)
+.Case(ReturnsMinusOne, ErrnoNEZeroIrrelevant, GenericFailureMsg)
+.ArgConstraint(NotNull(ArgNo(0)))
+.ArgConstraint(ArgumentCondition(2, WithinRange, {{0, 2}})));
 
 // off_t ftello(FILE *stream);
 addToFunctionSummaryMap(
 "ftello", Signature(ArgTypes{FilePtrTy}, RetType{Off_tTy}),
-Summary(NoEvalCall).ArgConstraint(NotNull(ArgNo(0;
+Summary(NoEvalCall)
+.Case({ReturnValueCondition(WithinRange, Range(0, LongMax))},
+  ErrnoUnchanged, GenericSuccessMsg)
+.Case(ReturnsMinusOne, ErrnoNEZeroIrrelevant, GenericFailureMsg)
+.ArgConstraint(NotNull(ArgNo(0;
 
 // void *mmap(void *addr, size_t length, int prot, int flags, int fd,
 // off_t offset);
diff --git a/clang/test/Analysis/stream-errno.c 
b/clang/test/Analysis/stream-errno.c
index f44ee6070708b2..bc184d5ce018d3 100644
--- a/clang/test/Analysis/stream-errno.c
+++ b/clang/test/Analysis/stream-errno.c
@@ -129,6 +129,7 @@ void check_fseek(void) {
   int S = fseek(F, 11, SEEK_SET);
   if (S != 0) {
 clang_analyzer_eval(errno != 0); // expected-warning{{TRUE}}
+clang_analyzer_eval(S == -1);// expected-warning{{TRUE}}
 if (errno) {} // no-warning
 fclose(F);
 return;
@@ -136,6 +137,21 @@ void check_fseek(void) {
   if (errno) {} // expected-warning{{An undefined value may be read from 
'errno'}}
 }
 
+void check_fseeko(void) {
+  FILE *F = tmpfile();
+  if (!F)
+return;
+  int S = fseeko(F, 11, SEEK_SET);
+  if (S == -1) {
+clang_analyzer_eval(errno != 0); // expected-warning{{TRUE}}
+if (errno) {}// no-warning
+  } else {
+clang_analyzer_eval(S == 0); // expected-warning{{TRUE}}
+if (errno) {}// expected-warning{{An undefined value 
may be read from 'errno'}}
+  }
+  fclose(F);
+}
+
 void check_no_errno_change(void) {
   FILE *F = tmpfile();
   if (!F)
@@ -197,6 +213,22 @@ void check_ftell(void) {
   fclose(F);
 }
 
+void check_ftello(void) {
+  FILE *F = tmpfile();
+  if (!F)
+return;
+  errno = 0;
+  off_t Ret = ftello(F);
+  if (Ret >= 0) {
+clang_analyzer_eval(errno == 0); // expected-warning{{TRUE}}
+  } else {
+clang_analyzer_eval(Ret == -1);  // expected-warning{{TRUE}}
+clang_analyzer_eval(errno != 0); // expected-warning{{TRUE}}
+  }
+  if (errno) {}  // no-warning
+  fclose(F);
+}
+
 void check_rewind(void) {
   FILE *F = tmpfile();
   if (!F)

>From abf8a48d6c188f83d05ce7ae1604767b18a27490 Mon Sep 17 00:00:00 2001
From: Ben Shi 
Date: Sat, 13 Jan 2024 12:33:35 +0800
Subject: [PATCH 2/2] [clang][analyzer] Improve modeling of 'fseeko' and
 'ftello' in StdLibraryFunctionsChecker

---
 .../Checkers/StdLibraryFunctionsChecker.cpp   | 43 ++-
 .../Analysis/std-c-library-functions-POSIX.c  |  4 +-
 clang/test/Analysis/stream-errno.c|  5 +--
 3 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp 
b/clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
index f93eb4bf48..641ebe90f88e2e 100644
--- a/clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
@@ -2220,6 +2220,9 @@ void StdLibraryFunctionsChecker::initFunctionSummaries(
 0, WithinRange, {{EOFv, EOFv}, {0, UCharRangeMax}}))
 .ArgConstraint(NotNull(ArgNo(1;
 
+std::optional Off_tTy = lookupTy("off_t");
+std::optional Off_tMax = getMaxValue(Off_tTy);
+
 // int fseek(FILE *stream, long offset, int whence);
 // FIXME: It can be possible to get the 'SEEK_' values (like EOFv) and use
 // these for cond

[clang] [llvm] [PowerPC] Make "ca" aliased to "xer" (PR #77557)

2024-01-12 Thread Stefan Pintilie via cfe-commits


@@ -288,9 +288,9 @@ def SPEFSCR: SPR<512, "spefscr">, DwarfRegNum<[612, 112]>;
 
 def XER: SPR<1, "xer">, DwarfRegNum<[76]>;
 
-// Carry bit.  In the architecture this is really bit 0 of the XER register
-// (which really is SPR register 1);  this is the only bit interesting to a
-// compiler.
+// Carry bit. In the architecture this is really bit 2 of the 32-bit XER

stefanp-ibm wrote:

nit: 
The XER register is actually a 64 bit register.  I realize that the first 32 
bits are technically reserved (as well as a number of other bits like 35-43) 
but it is still a 64 bit register. In that way the carry bit becomes bit 34.

I also looked above and it seems that we incorrectly document SPR as being one 
of a number of 32 bit registers. The issue is that some of the SPR are 32 bit 
and others are 64 bit. It really depends on which SPR we are looking at. 

I may be missing something here. Is there a history of the compiler assuming 
that all SPR are 32 bits?

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


[llvm] [clang] [PowerPC] Make "ca" aliased to "xer" (PR #77557)

2024-01-12 Thread Stefan Pintilie via cfe-commits


@@ -782,6 +782,8 @@ ArrayRef PPCTargetInfo::getGCCRegNames() 
const {
 const TargetInfo::GCCRegAlias PPCTargetInfo::GCCRegAliases[] = {
 // While some of these aliases do map to different registers
 // they still share the same register name.
+// Strictly speaking, "ca" is a subregister of "xer". However currently we

stefanp-ibm wrote:

The point of this patch was to allow the compiler to add "ca" as part of the 
clobber list. 

However, even if the compiler doesn't track other bits in the XER we may have 
to add them so that the compiler doesn't complain when a user tries to specify 
the bit. If that happens, would we have to add those other fields and then 
specify them as proper subregs of XER?

Also, which of these bits, if any, does GCC support on PowerPC?

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


[clang] [X86_64] fix empty structure vaarg in c++ (PR #77907)

2024-01-12 Thread via cfe-commits

https://github.com/hstk30-hw updated 
https://github.com/llvm/llvm-project/pull/77907

>From 8e1d61de36a3b6ffe8b28713988898fad89ab685 Mon Sep 17 00:00:00 2001
From: Longsheng Mou 
Date: Fri, 12 Jan 2024 18:24:08 +0800
Subject: [PATCH] [X86_64] fix empty structure vaarg in c++

SizeInBytes of empty structure is 0 in C, while 1 in C++.
And empty structure argument of the function is ignored
in X86_64 backend.As a result, the value of variable
arguments in C++ is incorrect.
---
 clang/lib/CodeGen/Targets/X86.cpp  |  5 +
 clang/test/CodeGenCXX/x86_64-vaarg.cpp | 16 
 2 files changed, 21 insertions(+)
 create mode 100644 clang/test/CodeGenCXX/x86_64-vaarg.cpp

diff --git a/clang/lib/CodeGen/Targets/X86.cpp 
b/clang/lib/CodeGen/Targets/X86.cpp
index d053f41ab168f5..4f9e903b8f0e98 100644
--- a/clang/lib/CodeGen/Targets/X86.cpp
+++ b/clang/lib/CodeGen/Targets/X86.cpp
@@ -2989,6 +2989,11 @@ static Address EmitX86_64VAArgFromMemory(CodeGenFunction 
&CGF,
   // an 8 byte boundary.
 
   uint64_t SizeInBytes = (CGF.getContext().getTypeSize(Ty) + 7) / 8;
+
+  if (isEmptyRecord(CGF.getContext(), Ty, true)) {
+SizeInBytes = 0;
+  }
+
   llvm::Value *Offset =
   llvm::ConstantInt::get(CGF.Int32Ty, (SizeInBytes + 7)  & ~7);
   overflow_arg_area = CGF.Builder.CreateGEP(CGF.Int8Ty, overflow_arg_area,
diff --git a/clang/test/CodeGenCXX/x86_64-vaarg.cpp 
b/clang/test/CodeGenCXX/x86_64-vaarg.cpp
new file mode 100644
index 00..cbb9a47cf444fd
--- /dev/null
+++ b/clang/test/CodeGenCXX/x86_64-vaarg.cpp
@@ -0,0 +1,16 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py 
UTC_ARGS: --version 4
+// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -o - %s | FileCheck %s
+
+struct Empty {};
+
+struct Empty emptyvar;
+
+void take_args(int a, ...) {
+// CHECK:  %overflow_arg_area = load ptr, ptr %overflow_arg_area_p, align 8
+// CHECK-NEXT: %overflow_arg_area.next = getelementptr i8, ptr 
%overflow_arg_area, i32 0
+// CHECK-NEXT: store ptr %overflow_arg_area.next, ptr %overflow_arg_area_p, 
align 8
+  __builtin_va_list l;
+  __builtin_va_start(l, a);
+  emptyvar = __builtin_va_arg(l, struct Empty);
+  __builtin_va_end(l);
+}

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


[clang] [X86_64] fix empty structure vaarg in c++ (PR #77907)

2024-01-12 Thread via cfe-commits

https://github.com/hstk30-hw updated 
https://github.com/llvm/llvm-project/pull/77907

>From 0cb5f9a36721e55789f7f60c557d4c23a2d747a2 Mon Sep 17 00:00:00 2001
From: Longsheng Mou 
Date: Fri, 12 Jan 2024 18:24:08 +0800
Subject: [PATCH] [X86_64] fix empty structure vaarg in c++

SizeInBytes of empty structure is 0 in C, while 1 in C++.
And empty structure argument of the function is ignored
in X86_64 backend.As a result, the value of variable
arguments in C++ is incorrect.
---
 clang/lib/CodeGen/Targets/X86.cpp   |  5 +
 clang/test/CodeGen/X86/x86_64-vaarg.cpp | 17 +
 2 files changed, 22 insertions(+)
 create mode 100644 clang/test/CodeGen/X86/x86_64-vaarg.cpp

diff --git a/clang/lib/CodeGen/Targets/X86.cpp 
b/clang/lib/CodeGen/Targets/X86.cpp
index d053f41ab168f5..4f9e903b8f0e98 100644
--- a/clang/lib/CodeGen/Targets/X86.cpp
+++ b/clang/lib/CodeGen/Targets/X86.cpp
@@ -2989,6 +2989,11 @@ static Address EmitX86_64VAArgFromMemory(CodeGenFunction 
&CGF,
   // an 8 byte boundary.
 
   uint64_t SizeInBytes = (CGF.getContext().getTypeSize(Ty) + 7) / 8;
+
+  if (isEmptyRecord(CGF.getContext(), Ty, true)) {
+SizeInBytes = 0;
+  }
+
   llvm::Value *Offset =
   llvm::ConstantInt::get(CGF.Int32Ty, (SizeInBytes + 7)  & ~7);
   overflow_arg_area = CGF.Builder.CreateGEP(CGF.Int8Ty, overflow_arg_area,
diff --git a/clang/test/CodeGen/X86/x86_64-vaarg.cpp 
b/clang/test/CodeGen/X86/x86_64-vaarg.cpp
new file mode 100644
index 00..4c58ee1cd33c48
--- /dev/null
+++ b/clang/test/CodeGen/X86/x86_64-vaarg.cpp
@@ -0,0 +1,17 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py 
UTC_ARGS: --version 4
+// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -o - %s | FileCheck %s
+
+struct Empty {};
+
+struct Empty emptyvar;
+
+// CHECK: [[OVERFLOW_ARG_AREA:%.*]] = load ptr, ptr 
[[OVERFLOW_ARG_AREA_P]], align 8
+// CHECK-NEXT:[[OVERFLOW_ARG_AREA_NEXT:%.*]] = getelementptr i8, ptr 
[[OVERFLOW_ARG_AREA]], i32 0
+// CHECK-NEXT:store ptr [[OVERFLOW_ARG_AREA_NEXT]], ptr 
[[OVERFLOW_ARG_AREA_P]], align 8
+void take_args(int a, ...) {
+
+  __builtin_va_list l;
+  __builtin_va_start(l, a);
+  emptyvar = __builtin_va_arg(l, struct Empty);
+  __builtin_va_end(l);
+}

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


[clang-tools-extra] 771ab15 - [clang-tidy] Use StringRef::ltrim (NFC)

2024-01-12 Thread Kazu Hirata via cfe-commits

Author: Kazu Hirata
Date: 2024-01-12T18:39:51-08:00
New Revision: 771ab15e4881b9c4adaabb694d901c3dbeb1fa47

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

LOG: [clang-tidy] Use StringRef::ltrim (NFC)

Added: 


Modified: 
clang-tools-extra/clang-tidy/utils/HeaderGuard.cpp

Removed: 




diff  --git a/clang-tools-extra/clang-tidy/utils/HeaderGuard.cpp 
b/clang-tools-extra/clang-tidy/utils/HeaderGuard.cpp
index 80580bc9888a8c..3540c496515bed 100644
--- a/clang-tools-extra/clang-tidy/utils/HeaderGuard.cpp
+++ b/clang-tools-extra/clang-tidy/utils/HeaderGuard.cpp
@@ -281,7 +281,7 @@ void HeaderGuardCheck::registerPPCallbacks(const 
SourceManager &SM,
 
 std::string HeaderGuardCheck::sanitizeHeaderGuard(StringRef Guard) {
   // Only reserved identifiers are allowed to start with an '_'.
-  return Guard.drop_while([](char C) { return C == '_'; }).str();
+  return Guard.ltrim('_').str();
 }
 
 bool HeaderGuardCheck::shouldSuggestEndifComment(StringRef FileName) {



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


[clang] eccd279 - [clang] Use SmallString::operator std::string() (NFC)

2024-01-12 Thread Kazu Hirata via cfe-commits

Author: Kazu Hirata
Date: 2024-01-12T18:39:49-08:00
New Revision: eccd279979ac210248cdf7d583169df6a8e552bd

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

LOG: [clang] Use SmallString::operator std::string() (NFC)

Added: 


Modified: 
clang/lib/Frontend/CompilerInstance.cpp
clang/lib/Frontend/Rewrite/FrontendActions.cpp
clang/tools/driver/driver.cpp

Removed: 




diff  --git a/clang/lib/Frontend/CompilerInstance.cpp 
b/clang/lib/Frontend/CompilerInstance.cpp
index 56bbef9697b650..6df5521b25cc08 100644
--- a/clang/lib/Frontend/CompilerInstance.cpp
+++ b/clang/lib/Frontend/CompilerInstance.cpp
@@ -2204,7 +2204,7 @@ void 
CompilerInstance::createModuleFromSource(SourceLocation ImportLoc,
   // Build the module, inheriting any modules that we've built locally.
   if (compileModuleImpl(*this, ImportLoc, ModuleName, Input, StringRef(),
 ModuleFileName, PreBuildStep, PostBuildStep)) {
-BuiltModules[std::string(ModuleName)] = std::string(ModuleFileName.str());
+BuiltModules[std::string(ModuleName)] = std::string(ModuleFileName);
 llvm::sys::RemoveFileOnSignal(ModuleFileName);
   }
 }

diff  --git a/clang/lib/Frontend/Rewrite/FrontendActions.cpp 
b/clang/lib/Frontend/Rewrite/FrontendActions.cpp
index 14569013b92ce9..92921bf6f3d7bd 100644
--- a/clang/lib/Frontend/Rewrite/FrontendActions.cpp
+++ b/clang/lib/Frontend/Rewrite/FrontendActions.cpp
@@ -77,7 +77,7 @@ class FixItActionSuffixInserter : public FixItOptions {
 SmallString<128> Path(Filename);
 llvm::sys::path::replace_extension(Path,
   NewSuffix + llvm::sys::path::extension(Path));
-return std::string(Path.str());
+return std::string(Path);
   }
 };
 

diff  --git a/clang/tools/driver/driver.cpp b/clang/tools/driver/driver.cpp
index a46d5169719bc9..1407c7fcdab769 100644
--- a/clang/tools/driver/driver.cpp
+++ b/clang/tools/driver/driver.cpp
@@ -64,7 +64,7 @@ std::string GetExecutablePath(const char *Argv0, bool 
CanonicalPrefixes) {
   if (llvm::ErrorOr P =
   llvm::sys::findProgramByName(ExecutablePath))
 ExecutablePath = *P;
-return std::string(ExecutablePath.str());
+return std::string(ExecutablePath);
   }
 
   // This just needs to be some symbol in the binary; C++ doesn't



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


[clang] [clang-format] Add PenaltyBreakScopeResolution option. (PR #78015)

2024-01-12 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang

Author: None (rmarker)


Changes

Resolves #78014

---
Full diff: https://github.com/llvm/llvm-project/pull/78015.diff


7 Files Affected:

- (modified) clang/docs/ClangFormatStyleOptions.rst (+5) 
- (modified) clang/docs/ReleaseNotes.rst (+1) 
- (modified) clang/include/clang/Format/Format.h (+5) 
- (modified) clang/lib/Format/Format.cpp (+3) 
- (modified) clang/lib/Format/TokenAnnotator.cpp (+1-1) 
- (modified) clang/unittests/Format/ConfigParseTest.cpp (+2) 
- (modified) clang/unittests/Format/FormatTest.cpp (+13) 


``diff
diff --git a/clang/docs/ClangFormatStyleOptions.rst 
b/clang/docs/ClangFormatStyleOptions.rst
index ac9a0b70ed5daa..8bc13e45bf2f5f 100644
--- a/clang/docs/ClangFormatStyleOptions.rst
+++ b/clang/docs/ClangFormatStyleOptions.rst
@@ -4432,6 +4432,11 @@ the configuration (without a prefix: ``Auto``).
 **PenaltyBreakOpenParenthesis** (``Unsigned``) :versionbadge:`clang-format 14` 
:ref:`¶ `
   The penalty for breaking after ``(``.
 
+.. _PenaltyBreakScopeResolution:
+
+**PenaltyBreakScopeResolution** (``Unsigned``) :versionbadge:`clang-format 18` 
:ref:`¶ `
+  The penalty for breaking after ``::``.
+
 .. _PenaltyBreakString:
 
 **PenaltyBreakString** (``Unsigned``) :versionbadge:`clang-format 3.7` :ref:`¶ 
`
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 3cbce1be159437..dc8a6fe506bce6 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -1131,6 +1131,7 @@ clang-format
 - Add ``BreakAdjacentStringLiterals`` option.
 - Add ``ObjCPropertyAttributeOrder`` which can be used to sort ObjC property
   attributes (like ``nonatomic, strong, nullable``).
+- Add ``PenaltyBreakScopeResolution`` option.
 - Add ``.clang-format-ignore`` files.
 - Add ``AlignFunctionPointers`` sub-option for 
``AlignConsecutiveDeclarations``.
 
diff --git a/clang/include/clang/Format/Format.h 
b/clang/include/clang/Format/Format.h
index 5ffd63ee73fc36..6fd7947bd21791 100644
--- a/clang/include/clang/Format/Format.h
+++ b/clang/include/clang/Format/Format.h
@@ -3398,6 +3398,10 @@ struct FormatStyle {
   /// \version 14
   unsigned PenaltyBreakOpenParenthesis;
 
+  /// The penalty for breaking after ``::``.
+  /// \version 18
+  unsigned PenaltyBreakScopeResolution;
+
   /// The penalty for each line break introduced inside a string literal.
   /// \version 3.7
   unsigned PenaltyBreakString;
@@ -4873,6 +4877,7 @@ struct FormatStyle {
PenaltyBreakComment == R.PenaltyBreakComment &&
PenaltyBreakFirstLessLess == R.PenaltyBreakFirstLessLess &&
PenaltyBreakOpenParenthesis == R.PenaltyBreakOpenParenthesis &&
+   PenaltyBreakScopeResolution == R.PenaltyBreakScopeResolution &&
PenaltyBreakString == R.PenaltyBreakString &&
PenaltyBreakTemplateDeclaration ==
R.PenaltyBreakTemplateDeclaration &&
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index ff5ed6c306f383..d3e62c41098437 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -1054,6 +1054,8 @@ template <> struct MappingTraits {
Style.PenaltyBreakFirstLessLess);
 IO.mapOptional("PenaltyBreakOpenParenthesis",
Style.PenaltyBreakOpenParenthesis);
+IO.mapOptional("PenaltyBreakScopeResolution",
+   Style.PenaltyBreakScopeResolution);
 IO.mapOptional("PenaltyBreakString", Style.PenaltyBreakString);
 IO.mapOptional("PenaltyBreakTemplateDeclaration",
Style.PenaltyBreakTemplateDeclaration);
@@ -1602,6 +1604,7 @@ FormatStyle getLLVMStyle(FormatStyle::LanguageKind 
Language) {
   LLVMStyle.PenaltyReturnTypeOnItsOwnLine = 60;
   LLVMStyle.PenaltyBreakBeforeFirstCallParameter = 19;
   LLVMStyle.PenaltyBreakOpenParenthesis = 0;
+  LLVMStyle.PenaltyBreakScopeResolution = 500;
   LLVMStyle.PenaltyBreakTemplateDeclaration = prec::Relational;
   LLVMStyle.PenaltyIndentedWhitespace = 0;
 
diff --git a/clang/lib/Format/TokenAnnotator.cpp 
b/clang/lib/Format/TokenAnnotator.cpp
index 24ce18a64348c1..01a599db2e83c3 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -3765,7 +3765,7 @@ unsigned TokenAnnotator::splitPenalty(const AnnotatedLine 
&Line,
   }
 
   if (Left.is(tok::coloncolon))
-return 500;
+return Style.PenaltyBreakScopeResolution;
   if (Right.isOneOf(TT_StartOfName, TT_FunctionDeclarationName) ||
   Right.is(tok::kw_operator)) {
 if (Line.startsWith(tok::kw_for) && Right.PartOfMultiVariableDeclStmt)
diff --git a/clang/unittests/Format/ConfigParseTest.cpp 
b/clang/unittests/Format/ConfigParseTest.cpp
index 18ecba270e3455..6c0f9ddac5ac8f 100644
--- a/clang/unittests/Format/ConfigParseTest.cpp
+++ b/clang/unittests/Format/ConfigParseTest.cpp
@@ -255,6 +255,8 @@ TEST(ConfigParseTest, ParsesConfiguration) {
   PenaltyBreakTemplateDeclaration, 1234u);
   CHECK_PARSE("PenaltyBreakOpenParenthesis:

[clang] [clang-format] Add PenaltyBreakScopeResolution option. (PR #78015)

2024-01-12 Thread via cfe-commits

github-actions[bot] wrote:

Thank you for submitting a Pull Request (PR) to the LLVM Project!

This PR will be automatically labeled and the relevant teams will be
notified.

If you wish to, you can add reviewers by using the "Reviewers" section on this 
page.

If this is not working for you, it is probably because you do not have write
permissions for the repository. In which case you can instead tag reviewers by
name in a comment by using `@` followed by their GitHub username.

If you have received no comments on your PR for a week, you can request a review
by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate
is once a week. Please remember that you are asking for valuable time from 
other developers.

If you have further questions, they may be answered by the [LLVM GitHub User 
Guide](https://llvm.org/docs/GitHub.html).

You can also ask questions in a comment on this PR, on the [LLVM 
Discord](https://discord.com/invite/xS7Z362) or on the 
[forums](https://discourse.llvm.org/).

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


[clang] [clang-format] Add PenaltyBreakScopeResolution option. (PR #78015)

2024-01-12 Thread via cfe-commits

https://github.com/rmarker created 
https://github.com/llvm/llvm-project/pull/78015

Resolves #78014

>From 7b072cbf52418e92962bb8eb8a24471e5c01f1ea Mon Sep 17 00:00:00 2001
From: rmarker 
Date: Wed, 10 Jan 2024 10:55:51 +1030
Subject: [PATCH] [clang-format] Add PenaltyBreakScopeResolution option.

---
 clang/docs/ClangFormatStyleOptions.rst |  5 +
 clang/docs/ReleaseNotes.rst|  1 +
 clang/include/clang/Format/Format.h|  5 +
 clang/lib/Format/Format.cpp|  3 +++
 clang/lib/Format/TokenAnnotator.cpp|  2 +-
 clang/unittests/Format/ConfigParseTest.cpp |  2 ++
 clang/unittests/Format/FormatTest.cpp  | 13 +
 7 files changed, 30 insertions(+), 1 deletion(-)

diff --git a/clang/docs/ClangFormatStyleOptions.rst 
b/clang/docs/ClangFormatStyleOptions.rst
index ac9a0b70ed5daa4..8bc13e45bf2f5fa 100644
--- a/clang/docs/ClangFormatStyleOptions.rst
+++ b/clang/docs/ClangFormatStyleOptions.rst
@@ -4432,6 +4432,11 @@ the configuration (without a prefix: ``Auto``).
 **PenaltyBreakOpenParenthesis** (``Unsigned``) :versionbadge:`clang-format 14` 
:ref:`¶ `
   The penalty for breaking after ``(``.
 
+.. _PenaltyBreakScopeResolution:
+
+**PenaltyBreakScopeResolution** (``Unsigned``) :versionbadge:`clang-format 18` 
:ref:`¶ `
+  The penalty for breaking after ``::``.
+
 .. _PenaltyBreakString:
 
 **PenaltyBreakString** (``Unsigned``) :versionbadge:`clang-format 3.7` :ref:`¶ 
`
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 3cbce1be1594376..dc8a6fe506bce65 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -1131,6 +1131,7 @@ clang-format
 - Add ``BreakAdjacentStringLiterals`` option.
 - Add ``ObjCPropertyAttributeOrder`` which can be used to sort ObjC property
   attributes (like ``nonatomic, strong, nullable``).
+- Add ``PenaltyBreakScopeResolution`` option.
 - Add ``.clang-format-ignore`` files.
 - Add ``AlignFunctionPointers`` sub-option for 
``AlignConsecutiveDeclarations``.
 
diff --git a/clang/include/clang/Format/Format.h 
b/clang/include/clang/Format/Format.h
index 5ffd63ee73fc361..6fd7947bd217911 100644
--- a/clang/include/clang/Format/Format.h
+++ b/clang/include/clang/Format/Format.h
@@ -3398,6 +3398,10 @@ struct FormatStyle {
   /// \version 14
   unsigned PenaltyBreakOpenParenthesis;
 
+  /// The penalty for breaking after ``::``.
+  /// \version 18
+  unsigned PenaltyBreakScopeResolution;
+
   /// The penalty for each line break introduced inside a string literal.
   /// \version 3.7
   unsigned PenaltyBreakString;
@@ -4873,6 +4877,7 @@ struct FormatStyle {
PenaltyBreakComment == R.PenaltyBreakComment &&
PenaltyBreakFirstLessLess == R.PenaltyBreakFirstLessLess &&
PenaltyBreakOpenParenthesis == R.PenaltyBreakOpenParenthesis &&
+   PenaltyBreakScopeResolution == R.PenaltyBreakScopeResolution &&
PenaltyBreakString == R.PenaltyBreakString &&
PenaltyBreakTemplateDeclaration ==
R.PenaltyBreakTemplateDeclaration &&
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index ff5ed6c306f383b..d3e62c41098437c 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -1054,6 +1054,8 @@ template <> struct MappingTraits {
Style.PenaltyBreakFirstLessLess);
 IO.mapOptional("PenaltyBreakOpenParenthesis",
Style.PenaltyBreakOpenParenthesis);
+IO.mapOptional("PenaltyBreakScopeResolution",
+   Style.PenaltyBreakScopeResolution);
 IO.mapOptional("PenaltyBreakString", Style.PenaltyBreakString);
 IO.mapOptional("PenaltyBreakTemplateDeclaration",
Style.PenaltyBreakTemplateDeclaration);
@@ -1602,6 +1604,7 @@ FormatStyle getLLVMStyle(FormatStyle::LanguageKind 
Language) {
   LLVMStyle.PenaltyReturnTypeOnItsOwnLine = 60;
   LLVMStyle.PenaltyBreakBeforeFirstCallParameter = 19;
   LLVMStyle.PenaltyBreakOpenParenthesis = 0;
+  LLVMStyle.PenaltyBreakScopeResolution = 500;
   LLVMStyle.PenaltyBreakTemplateDeclaration = prec::Relational;
   LLVMStyle.PenaltyIndentedWhitespace = 0;
 
diff --git a/clang/lib/Format/TokenAnnotator.cpp 
b/clang/lib/Format/TokenAnnotator.cpp
index 24ce18a64348c1d..01a599db2e83c3b 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -3765,7 +3765,7 @@ unsigned TokenAnnotator::splitPenalty(const AnnotatedLine 
&Line,
   }
 
   if (Left.is(tok::coloncolon))
-return 500;
+return Style.PenaltyBreakScopeResolution;
   if (Right.isOneOf(TT_StartOfName, TT_FunctionDeclarationName) ||
   Right.is(tok::kw_operator)) {
 if (Line.startsWith(tok::kw_for) && Right.PartOfMultiVariableDeclStmt)
diff --git a/clang/unittests/Format/ConfigParseTest.cpp 
b/clang/unittests/Format/ConfigParseTest.cpp
index 18ecba270e3455a..6c0f9ddac5ac8fd 100644
--- a/clang/unittests/Format/ConfigParseTest.cpp
+++ b/clang/unittests/Format/ConfigParseTest.cpp
@@ -2

[clang] [llvm] [SPARC] Consume `tune-cpu` directive in the backend (PR #77195)

2024-01-12 Thread Brad Smith via cfe-commits

https://github.com/brad0 closed https://github.com/llvm/llvm-project/pull/77195
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 5fa4b1d - [SPARC] Consume `tune-cpu` directive in the backend (#77195)

2024-01-12 Thread via cfe-commits

Author: Koakuma
Date: 2024-01-12T21:21:32-05:00
New Revision: 5fa4b1d83c80769f6003ae8aa504a21e64ddde63

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

LOG: [SPARC] Consume `tune-cpu` directive in the backend (#77195)

This lets the backend read the `tune-cpu` directive that is emitted by the 
frontend.

No changes are needed for clang as it is already emits it.

Added: 


Modified: 
clang/include/clang/Driver/Options.td
llvm/lib/Target/Sparc/SparcSubtarget.cpp
llvm/lib/Target/Sparc/SparcSubtarget.h
llvm/lib/Target/Sparc/SparcTargetMachine.cpp

Removed: 




diff  --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index c237d1f6619348..d9d6ce81b4d84a 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -5172,7 +5172,7 @@ def module_file_info : Flag<["-"], "module-file-info">, 
Flags<[]>,
   HelpText<"Provide information about a particular module file">;
 def mthumb : Flag<["-"], "mthumb">, Group;
 def mtune_EQ : Joined<["-"], "mtune=">, Group,
-  HelpText<"Only supported on AArch64, PowerPC, RISC-V, SystemZ, and X86">;
+  HelpText<"Only supported on AArch64, PowerPC, RISC-V, SPARC, SystemZ, and 
X86">;
 def multi__module : Flag<["-"], "multi_module">;
 def multiply__defined__unused : Separate<["-"], "multiply_defined_unused">;
 def multiply__defined : Separate<["-"], "multiply_defined">;

diff  --git a/llvm/lib/Target/Sparc/SparcSubtarget.cpp 
b/llvm/lib/Target/Sparc/SparcSubtarget.cpp
index 81c2137ea730f8..6b09904ca5e8e5 100644
--- a/llvm/lib/Target/Sparc/SparcSubtarget.cpp
+++ b/llvm/lib/Target/Sparc/SparcSubtarget.cpp
@@ -12,6 +12,7 @@
 
 #include "SparcSubtarget.h"
 #include "Sparc.h"
+#include "llvm/ADT/StringRef.h"
 #include "llvm/MC/TargetRegistry.h"
 #include "llvm/Support/MathExtras.h"
 
@@ -25,15 +26,18 @@ using namespace llvm;
 
 void SparcSubtarget::anchor() { }
 
-SparcSubtarget &SparcSubtarget::initializeSubtargetDependencies(StringRef CPU,
-StringRef FS) {
+SparcSubtarget &SparcSubtarget::initializeSubtargetDependencies(
+StringRef CPU, StringRef TuneCPU, StringRef FS) {
   // Determine default and user specified characteristics
   std::string CPUName = std::string(CPU);
   if (CPUName.empty())
 CPUName = (Is64Bit) ? "v9" : "v8";
 
+  if (TuneCPU.empty())
+TuneCPU = CPUName;
+
   // Parse features string.
-  ParseSubtargetFeatures(CPUName, /*TuneCPU*/ CPUName, FS);
+  ParseSubtargetFeatures(CPUName, TuneCPU, FS);
 
   // Popc is a v9-only instruction.
   if (!IsV9)
@@ -42,11 +46,12 @@ SparcSubtarget 
&SparcSubtarget::initializeSubtargetDependencies(StringRef CPU,
   return *this;
 }
 
-SparcSubtarget::SparcSubtarget(const Triple &TT, const std::string &CPU,
-   const std::string &FS, const TargetMachine &TM,
+SparcSubtarget::SparcSubtarget(const StringRef &CPU, const StringRef &TuneCPU,
+   const StringRef &FS, const TargetMachine &TM,
bool is64Bit)
-: SparcGenSubtargetInfo(TT, CPU, /*TuneCPU*/ CPU, FS), TargetTriple(TT),
-  Is64Bit(is64Bit), InstrInfo(initializeSubtargetDependencies(CPU, FS)),
+: SparcGenSubtargetInfo(TM.getTargetTriple(), CPU, TuneCPU, FS),
+  TargetTriple(TM.getTargetTriple()), Is64Bit(is64Bit),
+  InstrInfo(initializeSubtargetDependencies(CPU, TuneCPU, FS)),
   TLInfo(TM, *this), FrameLowering(*this) {}
 
 int SparcSubtarget::getAdjustedFrameSize(int frameSize) const {

diff  --git a/llvm/lib/Target/Sparc/SparcSubtarget.h 
b/llvm/lib/Target/Sparc/SparcSubtarget.h
index 8e3d05d5d7e5df..cdb210f67482c4 100644
--- a/llvm/lib/Target/Sparc/SparcSubtarget.h
+++ b/llvm/lib/Target/Sparc/SparcSubtarget.h
@@ -44,8 +44,8 @@ class SparcSubtarget : public SparcGenSubtargetInfo {
   SparcFrameLowering FrameLowering;
 
 public:
-  SparcSubtarget(const Triple &TT, const std::string &CPU,
- const std::string &FS, const TargetMachine &TM, bool is64bit);
+  SparcSubtarget(const StringRef &CPU, const StringRef &TuneCPU,
+ const StringRef &FS, const TargetMachine &TM, bool is64bit);
 
   const SparcInstrInfo *getInstrInfo() const override { return &InstrInfo; }
   const TargetFrameLowering *getFrameLowering() const override {
@@ -70,7 +70,9 @@ class SparcSubtarget : public SparcGenSubtargetInfo {
   /// ParseSubtargetFeatures - Parses features string setting specified
   /// subtarget options.  Definition of function is auto generated by tblgen.
   void ParseSubtargetFeatures(StringRef CPU, StringRef TuneCPU, StringRef FS);
-  SparcSubtarget &initializeSubtargetDependencies(StringRef CPU, StringRef FS);
+  SparcSubtarget &initializeSubtargetDependencies(St

[clang] [clang-format] Stop aligning the to continuation lines (PR #76378)

2024-01-12 Thread via cfe-commits


@@ -1304,6 +1304,18 @@ TEST_F(FormatTestCSharp, CSharpGenericTypeConstraints) {
"}",
Style);
 
+  // When the where line is not to be formatted, following lines should not 
take
+  // on its indentation.
+  verifyFormat("class ItemFactory\n"

sstwcw wrote:

There is no variant which only takes one string.

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


[clang] [Clang][RISCV] Forward --no-relax option to linker for RISC-V (PR #76432)

2024-01-12 Thread Fangrui Song via cfe-commits

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


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


[clang] [clang-format] Stop aligning the to continuation lines (PR #76378)

2024-01-12 Thread via cfe-commits

https://github.com/sstwcw updated 
https://github.com/llvm/llvm-project/pull/76378

>From 7a8939bcd41cdfafe0546502064a6378ba117d60 Mon Sep 17 00:00:00 2001
From: sstwcw 
Date: Tue, 26 Dec 2023 03:07:58 +
Subject: [PATCH 1/2] [clang-format] Stop aligning the to continuation lines

Some unwrapped lines are marked as continuations of the previous lines,
for example the ports in a Verilog module header.  Previously, if the
first line following the ports lines was changed, and git-clang-format
was run, the changed line would be indented by an extra continuation
indentation.
---
 clang/lib/Format/UnwrappedLineFormatter.cpp  |  2 +-
 clang/unittests/Format/FormatTestCSharp.cpp  | 12 
 clang/unittests/Format/FormatTestVerilog.cpp | 11 +++
 3 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Format/UnwrappedLineFormatter.cpp 
b/clang/lib/Format/UnwrappedLineFormatter.cpp
index 56077499c39d53..2fc15d8828e4be 100644
--- a/clang/lib/Format/UnwrappedLineFormatter.cpp
+++ b/clang/lib/Format/UnwrappedLineFormatter.cpp
@@ -95,7 +95,7 @@ class LevelIndentTracker {
   /// level to the same indent.
   /// Note that \c nextLine must have been called before this method.
   void adjustToUnmodifiedLine(const AnnotatedLine &Line) {
-if (Line.InPPDirective)
+if (Line.InPPDirective || Line.IsContinuation)
   return;
 assert(Line.Level < IndentForLevel.size());
 if (Line.First->is(tok::comment) && IndentForLevel[Line.Level] != -1)
diff --git a/clang/unittests/Format/FormatTestCSharp.cpp 
b/clang/unittests/Format/FormatTestCSharp.cpp
index 4a0840d32341e8..c27e2b576adf73 100644
--- a/clang/unittests/Format/FormatTestCSharp.cpp
+++ b/clang/unittests/Format/FormatTestCSharp.cpp
@@ -1304,6 +1304,18 @@ TEST_F(FormatTestCSharp, CSharpGenericTypeConstraints) {
"}",
Style);
 
+  // When the where line is not to be formatted, following lines should not 
take
+  // on its indentation.
+  verifyFormat("class ItemFactory\n"
+   "where T : new() {\n"
+   "  int f() {}\n"
+   "}",
+   "class ItemFactory\n"
+   "where T : new() {\n"
+   "  int f() {}\n"
+   "}",
+   Style, {tooling::Range(43, 13)});
+
   verifyFormat("class Dictionary\n"
"where TKey : IComparable\n"
"where TVal : IMyInterface {\n"
diff --git a/clang/unittests/Format/FormatTestVerilog.cpp 
b/clang/unittests/Format/FormatTestVerilog.cpp
index fcda05df182687..abebf9f7d4c785 100644
--- a/clang/unittests/Format/FormatTestVerilog.cpp
+++ b/clang/unittests/Format/FormatTestVerilog.cpp
@@ -613,6 +613,17 @@ TEST_F(FormatTestVerilog, Headers) {
"  (input var x aaa``x, \\\n"
"   b);",
Style);
+  // When the ports line is not to be formatted, following lines should not 
take
+  // on its indentation.
+  verifyFormat("module x\n"
+   "(output x);\n"
+   "  assign x = 0;\n"
+   "endmodule",
+   "module x\n"
+   "(output x);\n"
+   "assign x = 0;\n"
+   "endmodule",
+   getDefaultStyle(), {tooling::Range(25, 18)});
 }
 
 TEST_F(FormatTestVerilog, Hierarchy) {

>From 1fc9d9ac0db7b798c75d97be00250345b98da1b1 Mon Sep 17 00:00:00 2001
From: sstwcw 
Date: Sat, 13 Jan 2024 02:00:18 +
Subject: [PATCH 2/2] Update comment

---
 clang/unittests/Format/FormatTestCSharp.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/clang/unittests/Format/FormatTestCSharp.cpp 
b/clang/unittests/Format/FormatTestCSharp.cpp
index c27e2b576adf73..6f5e1e41ef7e0b 100644
--- a/clang/unittests/Format/FormatTestCSharp.cpp
+++ b/clang/unittests/Format/FormatTestCSharp.cpp
@@ -1304,8 +1304,8 @@ TEST_F(FormatTestCSharp, CSharpGenericTypeConstraints) {
"}",
Style);
 
-  // When the where line is not to be formatted, following lines should not 
take
-  // on its indentation.
+  // When the "where" line is not to be formatted, following lines should not
+  // take on its indentation.
   verifyFormat("class ItemFactory\n"
"where T : new() {\n"
"  int f() {}\n"

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


[clang] [AVX10][Doc] Add documentation about AVX10 options and their attentions (PR #77925)

2024-01-12 Thread Phoebe Wang via cfe-commits


@@ -3963,6 +3963,60 @@ implicitly included in later levels.
 - ``-march=x86-64-v3``: (close to Haswell) AVX, AVX2, BMI1, BMI2, F16C, FMA, 
LZCNT, MOVBE, XSAVE
 - ``-march=x86-64-v4``: AVX512F, AVX512BW, AVX512CD, AVX512DQ, AVX512VL
 
+`Intel AVX10 ISA `_ is
+a major new vector ISA incorporating the modern vectorization aspects of
+Intel AVX-512. This ISA will be supported on all future Intel processor.
+Users are supposed to use the new options ``-mavx10.N`` and ``-mavx10.N-512``
+on these processors and should not use traditional AVX512 options anymore.
+
+The ``N`` in ``-mavx10.N`` represents a continuous integer number starting
+from ``1``. ``-mavx10.N`` is an alias of ``-mavx10.N-256``, which means to
+enable all instructions within AVX10 version N at a maximum vector length of
+256 bits. ``-mavx10.N-512`` enables all instructions at a maximum vector
+length of 512 bits, which is a superset of instructions ``-mavx10.N`` enabled.
+
+Current binaries built with AVX512 features can run on Intel AVX10/512 capable
+processor without re-compile, but cannot run on AVX10/256 capable processor.
+Users need to re-compile their code with ``-mavx10.N``, and maybe update some
+code that calling to 512-bit X86 specific intrinsics and passing or returning
+512-bit vector types in function call, if they want to run on AVX10/256 capable
+processor. Binaries built with ``-mavx10.N`` can run on both AVX10/256 and
+AVX10/512 capable processor.
+
+Users can add a ``-mno-evex512`` in the command line with AVX512 options if
+they want to run the binary on both legacy AVX512 and new AVX10/256 capable
+processors. The option has the same constraints as ``-mavx10.N``, i.e.,
+cannot call to 512-bit X86 specific intrinsics and pass or return 512-bit 
vector
+types in function call.
+
+Users should avoid using AVX512 features in function target attributes when
+developing code for AVX10. If they have to do so, they need to add an explicit
+``evex512`` or ``no-evex512`` together with AVX512 features for 512-bit or
+non-512-bit functions respectively to avoid unexpected code generation. Both
+command line option and target attribute of EVEX512 feature can only be used
+with AVX512. They don't affect vector size of AVX10.
+
+User should not mix the use AVX10 and AVX512 options together at any time,
+because the option combinations are conflicting sometimes. For example, a
+combination of ``-mavx512f -mavx10.1-256`` doesn't show a clear intention to
+compiler, since instructions in AVX512F and AVX10.1/256 intersect but do not
+overlap. In this case, compiler will emit warning for it, but the behavior
+is determined. It will generate the same code as option ``-mavx10.1-512``.
+A similar case is ``-mavx512f -mavx10.2-256``, which equals to
+``-mavx10.1-512 -mavx10.2-256``, because ``avx10.2-256`` implies 
``avx10.1-256``
+and ``-mavx512f -mavx10.1-256`` equals to ``-mavx10.1-512``.
+
+There are some new macros introduced with AVX10 support. ``-mavx10.1-256`` will
+enable ``__AVX10_1__`` and ``__EVEX256__``, while ``-mavx10.1-512`` enables
+``__AVX10_1__``, ``__EVEX256__``, ``__EVEX512__``  and ``__AVX10_1_512__``.
+Besides, both ``-mavx10.1-256`` and ``-mavx10.1-512`` will enable all AVX512
+feature specific macros. A AVX512 feature will enable both ``__EVEX256__``,
+``__EVEX512__`` and its own macro. So ``__EVEX512__`` can be used to guard code
+that can run on both legacy AVX512 and AVX10/512 capable processors but cannot
+run on AVX10/256, while a AVX512 macro like ``__AVX512F__`` cannot tell the
+difference among the three options. Users need to check additional macros
+``__AVX10_1__`` and ``__EVEX512__`` if they want to make distinction.

phoebewang wrote:

I think it'd better to use compier version to distinguish compilers support 
AVX10 or not.

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


[clang] [AVX10][Doc] Add documentation about AVX10 options and their attentions (PR #77925)

2024-01-12 Thread Phoebe Wang via cfe-commits


@@ -3963,6 +3963,60 @@ implicitly included in later levels.
 - ``-march=x86-64-v3``: (close to Haswell) AVX, AVX2, BMI1, BMI2, F16C, FMA, 
LZCNT, MOVBE, XSAVE
 - ``-march=x86-64-v4``: AVX512F, AVX512BW, AVX512CD, AVX512DQ, AVX512VL
 
+`Intel AVX10 ISA `_ is
+a major new vector ISA incorporating the modern vectorization aspects of
+Intel AVX-512. This ISA will be supported on all future Intel processor.
+Users are supposed to use the new options ``-mavx10.N`` and ``-mavx10.N-512``
+on these processors and should not use traditional AVX512 options anymore.
+
+The ``N`` in ``-mavx10.N`` represents a continuous integer number starting
+from ``1``. ``-mavx10.N`` is an alias of ``-mavx10.N-256``, which means to
+enable all instructions within AVX10 version N at a maximum vector length of
+256 bits. ``-mavx10.N-512`` enables all instructions at a maximum vector
+length of 512 bits, which is a superset of instructions ``-mavx10.N`` enabled.
+
+Current binaries built with AVX512 features can run on Intel AVX10/512 capable
+processor without re-compile, but cannot run on AVX10/256 capable processor.
+Users need to re-compile their code with ``-mavx10.N``, and maybe update some
+code that calling to 512-bit X86 specific intrinsics and passing or returning
+512-bit vector types in function call, if they want to run on AVX10/256 capable
+processor. Binaries built with ``-mavx10.N`` can run on both AVX10/256 and
+AVX10/512 capable processor.
+
+Users can add a ``-mno-evex512`` in the command line with AVX512 options if
+they want to run the binary on both legacy AVX512 and new AVX10/256 capable
+processors. The option has the same constraints as ``-mavx10.N``, i.e.,
+cannot call to 512-bit X86 specific intrinsics and pass or return 512-bit 
vector
+types in function call.
+
+Users should avoid using AVX512 features in function target attributes when
+developing code for AVX10. If they have to do so, they need to add an explicit
+``evex512`` or ``no-evex512`` together with AVX512 features for 512-bit or
+non-512-bit functions respectively to avoid unexpected code generation. Both
+command line option and target attribute of EVEX512 feature can only be used
+with AVX512. They don't affect vector size of AVX10.
+
+User should not mix the use AVX10 and AVX512 options together at any time,
+because the option combinations are conflicting sometimes. For example, a
+combination of ``-mavx512f -mavx10.1-256`` doesn't show a clear intention to
+compiler, since instructions in AVX512F and AVX10.1/256 intersect but do not
+overlap. In this case, compiler will emit warning for it, but the behavior
+is determined. It will generate the same code as option ``-mavx10.1-512``.
+A similar case is ``-mavx512f -mavx10.2-256``, which equals to
+``-mavx10.1-512 -mavx10.2-256``, because ``avx10.2-256`` implies 
``avx10.1-256``
+and ``-mavx512f -mavx10.1-256`` equals to ``-mavx10.1-512``.
+
+There are some new macros introduced with AVX10 support. ``-mavx10.1-256`` will
+enable ``__AVX10_1__`` and ``__EVEX256__``, while ``-mavx10.1-512`` enables
+``__AVX10_1__``, ``__EVEX256__``, ``__EVEX512__``  and ``__AVX10_1_512__``.
+Besides, both ``-mavx10.1-256`` and ``-mavx10.1-512`` will enable all AVX512
+feature specific macros. A AVX512 feature will enable both ``__EVEX256__``,
+``__EVEX512__`` and its own macro. So ``__EVEX512__`` can be used to guard code
+that can run on both legacy AVX512 and AVX10/512 capable processors but cannot
+run on AVX10/256, while a AVX512 macro like ``__AVX512F__`` cannot tell the
+difference among the three options. Users need to check additional macros
+``__AVX10_1__`` and ``__EVEX512__`` if they want to make distinction.

phoebewang wrote:

I don't quite understand the scenario. There's no macro `__EVEX512__`  before 
AVX10 been introduced.

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


[clang] [AVX10][Doc] Add documentation about AVX10 options and their attentions (PR #77925)

2024-01-12 Thread Phoebe Wang via cfe-commits


@@ -3963,6 +3963,60 @@ implicitly included in later levels.
 - ``-march=x86-64-v3``: (close to Haswell) AVX, AVX2, BMI1, BMI2, F16C, FMA, 
LZCNT, MOVBE, XSAVE
 - ``-march=x86-64-v4``: AVX512F, AVX512BW, AVX512CD, AVX512DQ, AVX512VL
 
+`Intel AVX10 ISA `_ is
+a major new vector ISA incorporating the modern vectorization aspects of
+Intel AVX-512. This ISA will be supported on all future Intel processor.

phoebewang wrote:

Good catch, done!

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


[clang] [AVX10][Doc] Add documentation about AVX10 options and their attentions (PR #77925)

2024-01-12 Thread Phoebe Wang via cfe-commits

https://github.com/phoebewang updated 
https://github.com/llvm/llvm-project/pull/77925

>From cc0f2b24299bdfc9216ee87ab1aba08707f95503 Mon Sep 17 00:00:00 2001
From: Phoebe Wang 
Date: Fri, 12 Jan 2024 21:29:50 +0800
Subject: [PATCH 1/3] [AVX10][Doc] Add documentation about AVX10 options and
 their attentions

---
 clang/docs/UsersManual.rst | 54 ++
 1 file changed, 54 insertions(+)

diff --git a/clang/docs/UsersManual.rst b/clang/docs/UsersManual.rst
index 7c30570437e8b0..cbefa2cf0e9497 100644
--- a/clang/docs/UsersManual.rst
+++ b/clang/docs/UsersManual.rst
@@ -3963,6 +3963,60 @@ implicitly included in later levels.
 - ``-march=x86-64-v3``: (close to Haswell) AVX, AVX2, BMI1, BMI2, F16C, FMA, 
LZCNT, MOVBE, XSAVE
 - ``-march=x86-64-v4``: AVX512F, AVX512BW, AVX512CD, AVX512DQ, AVX512VL
 
+`Intel AVX10 ISA `_ is
+a major new vector ISA incorporating the modern vectorization aspects of
+Intel AVX-512. This ISA will be supported on all future Intel processor.
+Users are supposed to use the new options ``-mavx10.N`` and ``-mavx10.N-512``
+on these processors and do not use traditional AVX512 options anymore.
+
+The ``N`` in ``-mavx10.N`` represents a continuous integer number starting
+from ``1``. ``-mavx10.N`` is an alias of ``-mavx10.N-256``, which means to
+enable all instructions within AVX10 version N at a maximum vector length of
+256 bits. ``-mavx10.N-512`` enables all instructions at a maximum vector
+length of 512 bits, which is a superset of instructions ``-mavx10.N`` enabled.
+
+Current binaries built with AVX512 features can run on Intel AVX10/512 capable
+processor without re-compile, but cannot run on AVX10/256 capable processor.
+Users need to re-compile their code with ``-mavx10.N``, and maybe update some
+code that calling to 512-bit X86 specific intrinsics and passing or returning
+512-bit vector types in function call, if they want to run on AVX10/256 capable
+processor. Binaries built with ``-mavx10.N`` can run on both AVX10/256 and
+AVX10/512 capable processor.
+
+Users can add a ``-mno-evex512`` in the command line with AVX512 options if
+they want run the binary on both legacy AVX512 processor and new AVX10/256
+capable processor. The option has the same constraints as ``-mavx10.N``, i.e.,
+cannot call to 512-bit X86 specific intrinsics and pass or return 512-bit 
vector
+types in function call.
+
+Users should avoid to use AVX512 features in function target attributes when
+develop code for AVX10. If they have to do so, they need to add an explicit
+``evex512`` or ``no-evex512`` together with AVX512 features for 512-bit or
+non-512-bit functions respectively to avoid unexpected code generation. Both
+command line option and target attribute of EVEX512 feature can only be used
+with AVX512. They don't affect vector size of AVX10.
+
+User should not mix use AVX10 and AVX512 options together in any time, because
+the option combinations are conflicting sometimes. For example, a combination
+of ``-mavx512f -mavx10.1-256`` doesn't show a clear intention to compiler, 
since
+instructions in AVX512F and AVX10.1/256 intersect but do not overlap. In this
+case, compiler will emit warning for it, but the behavior is determined. It
+will generate the same code as option ``-mavx10.1-512``. A similar case is
+``-mavx512f -mavx10.2-256``, which equals to ``-mavx10.1-512 -mavx10.2-256``,
+because ``avx10.2-256`` implies ``avx10.1-256`` and ``-mavx512f -mavx10.1-256``
+equals to ``-mavx10.1-512``.
+
+There are some new macros introduced with AVX10 support. ``-mavx10.1-256`` will
+enable ``__AVX10_1__`` and ``__EVEX256__``, while ``-mavx10.1-512`` enables
+``__AVX10_1__``, ``__EVEX256__``, ``__EVEX512__``  and ``__AVX10_1_512__``.
+Besides, both ``-mavx10.1-256`` and ``-mavx10.1-512`` will enable all AVX512
+feature specific macros. A AVX512 feature will enable both ``__EVEX256__``,
+``__EVEX512__`` and its own macro. So ``__EVEX512__`` can be used to guard code
+that can run on both legacy AVX512 and AVX10/512 capable processor but cannot
+run on AVX10/256, while a AVX512 macro like ``__AVX512F__`` cannot tell the
+difference among the three options. Users need to check additional macros
+``__AVX10_1__`` and ``__EVEX512__`` if they want to make distinction.
+
 ARM
 ^^^
 

>From 485095d9befbb21cad1d980e4bca7fa58ee28e67 Mon Sep 17 00:00:00 2001
From: Phoebe Wang 
Date: Fri, 12 Jan 2024 22:40:04 +0800
Subject: [PATCH 2/3] Address review comments

---
 clang/docs/UsersManual.rst | 30 +++---
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/clang/docs/UsersManual.rst b/clang/docs/UsersManual.rst
index cbefa2cf0e9497..02aad64c4dd08b 100644
--- a/clang/docs/UsersManual.rst
+++ b/clang/docs/UsersManual.rst
@@ -3967,7 +3967,7 @@ implicitly included in later levels.
 a major new vector ISA incorporating the modern vectorization aspects of
 Intel AVX-512. This ISA will be supported on all

[clang] [compiler-rt] [clang-tools-extra] [llvm] [AMDGPU] Avoid hitting AMDGPUAsmPrinter related asserts for local functions at O0 (PR #72129)

2024-01-12 Thread Joseph Huber via cfe-commits

jhuber6 wrote:

> As a somewhat naive question, what would it take to turn off requiring 
> codegen to be in SCC order? We seem to be the only target doing that. The 
> comments on that line say something about function calls and noinline

I believe this is also the reason parallel codegen via `--lto-partitions` 
creates incorrect code, so if there were a way to avoid that it would be 
beneficial in other ways. I'm by no means an expert, but as far as I'm aware 
the SCC order is used for some resource scheduling.

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


[clang] [clang-format] Add ShortReturnTypeLength option. (PR #78011)

2024-01-12 Thread via cfe-commits

llvmbot wrote:



@llvm/pr-subscribers-clang-format

@llvm/pr-subscribers-clang

Author: None (rmarker)


Changes

Resolves #78010

---
Full diff: https://github.com/llvm/llvm-project/pull/78011.diff


7 Files Affected:

- (modified) clang/docs/ClangFormatStyleOptions.rst (+8) 
- (modified) clang/docs/ReleaseNotes.rst (+1) 
- (modified) clang/include/clang/Format/Format.h (+8) 
- (modified) clang/lib/Format/ContinuationIndenter.cpp (+2-1) 
- (modified) clang/lib/Format/Format.cpp (+2) 
- (modified) clang/unittests/Format/ConfigParseTest.cpp (+1) 
- (modified) clang/unittests/Format/FormatTest.cpp (+44) 


``diff
diff --git a/clang/docs/ClangFormatStyleOptions.rst 
b/clang/docs/ClangFormatStyleOptions.rst
index ac9a0b70ed5daa..3255ceb0aba75b 100644
--- a/clang/docs/ClangFormatStyleOptions.rst
+++ b/clang/docs/ClangFormatStyleOptions.rst
@@ -4994,6 +4994,14 @@ the configuration (without a prefix: ``Auto``).
int bar;   int bar;
  } // namespace b   } // namespace b
 
+.. _ShortReturnTypeLength:
+
+**ShortReturnTypeLength** (``Unsigned``) :versionbadge:`clang-format 18` 
:ref:`¶ `
+  When AlwaysBreakAfterReturnType is None, line breaks are prevented after
+  short return types. This configures the character limit for a type to be
+  regarded as short. Note that this isn't the length of the type itself,
+  but the column where it finishes. I.e. it includes indentation, etc.
+
 .. _SortIncludes:
 
 **SortIncludes** (``SortIncludesOptions``) :versionbadge:`clang-format 3.8` 
:ref:`¶ `
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 3cbce1be159437..04bf5cd4e768f3 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -1131,6 +1131,7 @@ clang-format
 - Add ``BreakAdjacentStringLiterals`` option.
 - Add ``ObjCPropertyAttributeOrder`` which can be used to sort ObjC property
   attributes (like ``nonatomic, strong, nullable``).
+- Add ``ShortReturnTypeLength`` option.
 - Add ``.clang-format-ignore`` files.
 - Add ``AlignFunctionPointers`` sub-option for 
``AlignConsecutiveDeclarations``.
 
diff --git a/clang/include/clang/Format/Format.h 
b/clang/include/clang/Format/Format.h
index 5ffd63ee73fc36..f94d68f2cf2a85 100644
--- a/clang/include/clang/Format/Format.h
+++ b/clang/include/clang/Format/Format.h
@@ -3928,6 +3928,13 @@ struct FormatStyle {
   /// \version 13
   unsigned ShortNamespaceLines;
 
+  /// When AlwaysBreakAfterReturnType is None, line breaks are prevented after
+  /// short return types. This configures the character limit for a type to be
+  /// regarded as short. Note that this isn't the length of the type itself,
+  /// but the column where it finishes. I.e. it includes indentation, etc.
+  /// \version 18
+  unsigned ShortReturnTypeLength;
+
   /// Include sorting options.
   enum SortIncludesOptions : int8_t {
 /// Includes are never sorted.
@@ -4890,6 +4897,7 @@ struct FormatStyle {
RequiresExpressionIndentation == R.RequiresExpressionIndentation &&
SeparateDefinitionBlocks == R.SeparateDefinitionBlocks &&
ShortNamespaceLines == R.ShortNamespaceLines &&
+   ShortReturnTypeLength == R.ShortReturnTypeLength &&
SortIncludes == R.SortIncludes &&
SortJavaStaticImport == R.SortJavaStaticImport &&
SpaceAfterCStyleCast == R.SpaceAfterCStyleCast &&
diff --git a/clang/lib/Format/ContinuationIndenter.cpp 
b/clang/lib/Format/ContinuationIndenter.cpp
index 102504182c4505..bc0748ec52e676 100644
--- a/clang/lib/Format/ContinuationIndenter.cpp
+++ b/clang/lib/Format/ContinuationIndenter.cpp
@@ -328,7 +328,8 @@ bool ContinuationIndenter::canBreak(const LineState &State) 
{
 
   // Don't break after very short return types (e.g. "void") as that is often
   // unexpected.
-  if (Current.is(TT_FunctionDeclarationName) && State.Column < 6) {
+  if (Current.is(TT_FunctionDeclarationName) &&
+  State.Column <= Style.ShortReturnTypeLength) {
 if (Style.AlwaysBreakAfterReturnType == FormatStyle::RTBS_None)
   return false;
   }
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index ff5ed6c306f383..20ffbeef7e9a6e 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -1083,6 +1083,7 @@ template <> struct MappingTraits {
Style.RequiresExpressionIndentation);
 IO.mapOptional("SeparateDefinitionBlocks", Style.SeparateDefinitionBlocks);
 IO.mapOptional("ShortNamespaceLines", Style.ShortNamespaceLines);
+IO.mapOptional("ShortReturnTypeLength", Style.ShortReturnTypeLength);
 IO.mapOptional("SortIncludes", Style.SortIncludes);
 IO.mapOptional("SortJavaStaticImport", Style.SortJavaStaticImport);
 IO.mapOptional("SortUsingDeclarations", Style.SortUsingDeclarations);
@@ -1554,6 +1555,7 @@ FormatStyle getLLVMStyle(FormatStyle::LanguageKind 
Language) {
   LLVMStyle.RequiresExpressionIndentation = FormatStyle::REI_OuterScope;
   LLVMStyle.Sep

[clang] [clang-format] Add ShortReturnTypeLength option. (PR #78011)

2024-01-12 Thread via cfe-commits

github-actions[bot] wrote:

Thank you for submitting a Pull Request (PR) to the LLVM Project!

This PR will be automatically labeled and the relevant teams will be
notified.

If you wish to, you can add reviewers by using the "Reviewers" section on this 
page.

If this is not working for you, it is probably because you do not have write
permissions for the repository. In which case you can instead tag reviewers by
name in a comment by using `@` followed by their GitHub username.

If you have received no comments on your PR for a week, you can request a review
by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate
is once a week. Please remember that you are asking for valuable time from 
other developers.

If you have further questions, they may be answered by the [LLVM GitHub User 
Guide](https://llvm.org/docs/GitHub.html).

You can also ask questions in a comment on this PR, on the [LLVM 
Discord](https://discord.com/invite/xS7Z362) or on the 
[forums](https://discourse.llvm.org/).

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


[clang] [clang-format] Add ShortReturnTypeLength option. (PR #78011)

2024-01-12 Thread via cfe-commits

https://github.com/rmarker created 
https://github.com/llvm/llvm-project/pull/78011

Resolves #78010

>From c4d28f82e108f9f12ccd0375e2a3502025b8c1e8 Mon Sep 17 00:00:00 2001
From: rmarker 
Date: Thu, 11 Jan 2024 15:01:18 +1030
Subject: [PATCH] [clang-format] Add ShortReturnTypeLength option.

---
 clang/docs/ClangFormatStyleOptions.rst |  8 
 clang/docs/ReleaseNotes.rst|  1 +
 clang/include/clang/Format/Format.h|  8 
 clang/lib/Format/ContinuationIndenter.cpp  |  3 +-
 clang/lib/Format/Format.cpp|  2 +
 clang/unittests/Format/ConfigParseTest.cpp |  1 +
 clang/unittests/Format/FormatTest.cpp  | 44 ++
 7 files changed, 66 insertions(+), 1 deletion(-)

diff --git a/clang/docs/ClangFormatStyleOptions.rst 
b/clang/docs/ClangFormatStyleOptions.rst
index ac9a0b70ed5daa4..3255ceb0aba75b4 100644
--- a/clang/docs/ClangFormatStyleOptions.rst
+++ b/clang/docs/ClangFormatStyleOptions.rst
@@ -4994,6 +4994,14 @@ the configuration (without a prefix: ``Auto``).
int bar;   int bar;
  } // namespace b   } // namespace b
 
+.. _ShortReturnTypeLength:
+
+**ShortReturnTypeLength** (``Unsigned``) :versionbadge:`clang-format 18` 
:ref:`¶ `
+  When AlwaysBreakAfterReturnType is None, line breaks are prevented after
+  short return types. This configures the character limit for a type to be
+  regarded as short. Note that this isn't the length of the type itself,
+  but the column where it finishes. I.e. it includes indentation, etc.
+
 .. _SortIncludes:
 
 **SortIncludes** (``SortIncludesOptions``) :versionbadge:`clang-format 3.8` 
:ref:`¶ `
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 3cbce1be1594376..04bf5cd4e768f34 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -1131,6 +1131,7 @@ clang-format
 - Add ``BreakAdjacentStringLiterals`` option.
 - Add ``ObjCPropertyAttributeOrder`` which can be used to sort ObjC property
   attributes (like ``nonatomic, strong, nullable``).
+- Add ``ShortReturnTypeLength`` option.
 - Add ``.clang-format-ignore`` files.
 - Add ``AlignFunctionPointers`` sub-option for 
``AlignConsecutiveDeclarations``.
 
diff --git a/clang/include/clang/Format/Format.h 
b/clang/include/clang/Format/Format.h
index 5ffd63ee73fc361..f94d68f2cf2a853 100644
--- a/clang/include/clang/Format/Format.h
+++ b/clang/include/clang/Format/Format.h
@@ -3928,6 +3928,13 @@ struct FormatStyle {
   /// \version 13
   unsigned ShortNamespaceLines;
 
+  /// When AlwaysBreakAfterReturnType is None, line breaks are prevented after
+  /// short return types. This configures the character limit for a type to be
+  /// regarded as short. Note that this isn't the length of the type itself,
+  /// but the column where it finishes. I.e. it includes indentation, etc.
+  /// \version 18
+  unsigned ShortReturnTypeLength;
+
   /// Include sorting options.
   enum SortIncludesOptions : int8_t {
 /// Includes are never sorted.
@@ -4890,6 +4897,7 @@ struct FormatStyle {
RequiresExpressionIndentation == R.RequiresExpressionIndentation &&
SeparateDefinitionBlocks == R.SeparateDefinitionBlocks &&
ShortNamespaceLines == R.ShortNamespaceLines &&
+   ShortReturnTypeLength == R.ShortReturnTypeLength &&
SortIncludes == R.SortIncludes &&
SortJavaStaticImport == R.SortJavaStaticImport &&
SpaceAfterCStyleCast == R.SpaceAfterCStyleCast &&
diff --git a/clang/lib/Format/ContinuationIndenter.cpp 
b/clang/lib/Format/ContinuationIndenter.cpp
index 102504182c4505b..bc0748ec52e6769 100644
--- a/clang/lib/Format/ContinuationIndenter.cpp
+++ b/clang/lib/Format/ContinuationIndenter.cpp
@@ -328,7 +328,8 @@ bool ContinuationIndenter::canBreak(const LineState &State) 
{
 
   // Don't break after very short return types (e.g. "void") as that is often
   // unexpected.
-  if (Current.is(TT_FunctionDeclarationName) && State.Column < 6) {
+  if (Current.is(TT_FunctionDeclarationName) &&
+  State.Column <= Style.ShortReturnTypeLength) {
 if (Style.AlwaysBreakAfterReturnType == FormatStyle::RTBS_None)
   return false;
   }
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index ff5ed6c306f383b..20ffbeef7e9a6e9 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -1083,6 +1083,7 @@ template <> struct MappingTraits {
Style.RequiresExpressionIndentation);
 IO.mapOptional("SeparateDefinitionBlocks", Style.SeparateDefinitionBlocks);
 IO.mapOptional("ShortNamespaceLines", Style.ShortNamespaceLines);
+IO.mapOptional("ShortReturnTypeLength", Style.ShortReturnTypeLength);
 IO.mapOptional("SortIncludes", Style.SortIncludes);
 IO.mapOptional("SortJavaStaticImport", Style.SortJavaStaticImport);
 IO.mapOptional("SortUsingDeclarations", Style.SortUsingDeclarations);
@@ -1554,6 +1555,7 @@ FormatStyle getLLVMStyle(FormatStyle::

[lldb] [libc] [compiler-rt] [libcxxabi] [flang] [libcxx] [clang-tools-extra] [lld] [clang] [llvm] [Flang][OpenMP] Push genEval calls to individual operations, NFC (PR #77758)

2024-01-12 Thread Krzysztof Parzyszek via cfe-commits


@@ -3655,8 +3661,7 @@ void Fortran::lower::genOpenMPDeclarativeConstruct(
 Fortran::lower::pft::Evaluation &eval,
 const Fortran::parser::OpenMPDeclarativeConstruct &omp) {
   genOMP(converter, eval, omp);

kparzysz wrote:

I made all `genOMP` functions have the same interface.  That required a small 
change in Bridge.cpp to pass two extra arguments, and in OpenMP.h to reflect 
the change in a function header.

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


[lldb] [libc] [compiler-rt] [libcxxabi] [flang] [libcxx] [clang-tools-extra] [lld] [clang] [llvm] [Flang][OpenMP] Push genEval calls to individual operations, NFC (PR #77758)

2024-01-12 Thread Krzysztof Parzyszek via cfe-commits

https://github.com/kparzysz updated 
https://github.com/llvm/llvm-project/pull/77758

>From 62f31654ec66fe0e2a27200d0484d3c70d4ce2c1 Mon Sep 17 00:00:00 2001
From: Krzysztof Parzyszek 
Date: Wed, 20 Dec 2023 15:12:04 -0600
Subject: [PATCH 1/5] [Flang][OpenMP] Separate creation of work-sharing and
 SIMD loops, NFC

These two constructs were both handled in `genOMP` for loop constructs.
There is some shared code between the two, but there are also enough
differences to separate these two cases into individual functions.

The shared code may be placed into a helper function later if needed.

Recursive lowering [1/5]
---
 flang/lib/Lower/OpenMP.cpp | 252 ++---
 1 file changed, 153 insertions(+), 99 deletions(-)

diff --git a/flang/lib/Lower/OpenMP.cpp b/flang/lib/Lower/OpenMP.cpp
index c3a570bf15ea0d..350cb29121da93 100644
--- a/flang/lib/Lower/OpenMP.cpp
+++ b/flang/lib/Lower/OpenMP.cpp
@@ -2968,24 +2968,150 @@ genOMP(Fortran::lower::AbstractConverter &converter,
   standaloneConstruct.u);
 }
 
-static void genOMP(Fortran::lower::AbstractConverter &converter,
-   Fortran::lower::pft::Evaluation &eval,
-   Fortran::semantics::SemanticsContext &semanticsContext,
-   const Fortran::parser::OpenMPLoopConstruct &loopConstruct) {
+static void
+createSimdLoop(Fortran::lower::AbstractConverter &converter,
+   Fortran::lower::pft::Evaluation &eval,
+   llvm::omp::Directive ompDirective,
+   const Fortran::parser::OmpClauseList &loopOpClauseList,
+   mlir::Location loc) {
   fir::FirOpBuilder &firOpBuilder = converter.getFirOpBuilder();
-  llvm::SmallVector lowerBound, upperBound, step, linearVars,
-  linearStepVars, reductionVars;
+  DataSharingProcessor dsp(converter, loopOpClauseList, eval);
+  dsp.processStep1();
+
+  Fortran::lower::StatementContext stmtCtx;
   mlir::Value scheduleChunkClauseOperand;
-  mlir::IntegerAttr orderedClauseOperand;
+  llvm::SmallVector lowerBound, upperBound, step, reductionVars;
+  llvm::SmallVector iv;
+  llvm::SmallVector reductionDeclSymbols;
+  mlir::omp::ClauseOrderKindAttr orderClauseOperand;
+  std::size_t loopVarTypeSize;
+
+  ClauseProcessor cp(converter, loopOpClauseList);
+  cp.processCollapse(loc, eval, lowerBound, upperBound, step, iv,
+ loopVarTypeSize);
+  cp.processScheduleChunk(stmtCtx, scheduleChunkClauseOperand);
+  cp.processReduction(loc, reductionVars, reductionDeclSymbols);
+  cp.processTODO(loc, ompDirective);
+
+  // The types of lower bound, upper bound, and step are converted into the
+  // type of the loop variable if necessary.
+  mlir::Type loopVarType = getLoopVarType(converter, loopVarTypeSize);
+  for (unsigned it = 0; it < (unsigned)lowerBound.size(); it++) {
+lowerBound[it] =
+firOpBuilder.createConvert(loc, loopVarType, lowerBound[it]);
+upperBound[it] =
+firOpBuilder.createConvert(loc, loopVarType, upperBound[it]);
+step[it] = firOpBuilder.createConvert(loc, loopVarType, step[it]);
+  }
+
+  llvm::SmallVector alignedVars, nontemporalVars;
+  mlir::Value ifClauseOperand;
+  mlir::IntegerAttr simdlenClauseOperand, safelenClauseOperand;
+  cp.processIf(Fortran::parser::OmpIfClause::DirectiveNameModifier::Simd,
+   ifClauseOperand);
+  cp.processSimdlen(simdlenClauseOperand);
+  cp.processSafelen(safelenClauseOperand);
+  cp.processTODO(loc, ompDirective);
+
+  mlir::TypeRange resultType;
+  auto simdLoopOp = firOpBuilder.create(
+  loc, resultType, lowerBound, upperBound, step, alignedVars,
+  /*alignment_values=*/nullptr, ifClauseOperand, nontemporalVars,
+  orderClauseOperand, simdlenClauseOperand, safelenClauseOperand,
+  /*inclusive=*/firOpBuilder.getUnitAttr());
+  createBodyOfOp(simdLoopOp, converter, loc, eval,
+&loopOpClauseList, iv,
+/*outer=*/false, &dsp);
+}
+
+static void createWsLoop(Fortran::lower::AbstractConverter &converter,
+ Fortran::lower::pft::Evaluation &eval,
+ llvm::omp::Directive ompDirective,
+ const Fortran::parser::OmpClauseList &beginClauseList,
+ const Fortran::parser::OmpClauseList *endClauseList,
+ mlir::Location loc) {
+  fir::FirOpBuilder &firOpBuilder = converter.getFirOpBuilder();
+  DataSharingProcessor dsp(converter, beginClauseList, eval);
+  dsp.processStep1();
+
+  Fortran::lower::StatementContext stmtCtx;
+  mlir::Value scheduleChunkClauseOperand;
+  llvm::SmallVector lowerBound, upperBound, step, reductionVars,
+  linearVars, linearStepVars;
+  llvm::SmallVector iv;
+  llvm::SmallVector reductionDeclSymbols;
   mlir::omp::ClauseOrderKindAttr orderClauseOperand;
   mlir::omp::ClauseScheduleKindAttr scheduleValClauseOperand;
-  mlir::omp::ScheduleModifierAttr scheduleModClauseOperand;
   mlir::UnitAttr 

[clang-tools-extra] [libcxx] [clang] [flang] [lldb] [llvm] [mlir] [X86] Add "Ws" constraint and "p" modifier for symbolic address/label reference (PR #77886)

2024-01-12 Thread Phoebe Wang via cfe-commits


@@ -5336,6 +5336,7 @@ X86:
   operand in a SSE register. If AVX is also enabled, can also be a 256-bit
   vector operand in an AVX register. If AVX-512 is also enabled, can also be a
   512-bit vector operand in an AVX512 register. Otherwise, an error.
+- ``Ws``: A symbolic reference or label reference.

phoebewang wrote:

Got it, thanks for the link! Do we support the pointer offset like GCC `&var + 
1`?

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


[clang] [llvm] [CMake][PGO] Build Sema.cpp to generate profdata for PGO builds (PR #77347)

2024-01-12 Thread Chris B via cfe-commits


@@ -26,9 +30,23 @@ if(LLVM_BUILD_INSTRUMENTED)
 message(STATUS "To enable merging PGO data LLVM_PROFDATA has to point to 
llvm-profdata")
   else()
 add_custom_target(generate-profdata
-  COMMAND "${Python3_EXECUTABLE}" 
${CMAKE_CURRENT_SOURCE_DIR}/perf-helper.py merge ${LLVM_PROFDATA} 
${CMAKE_CURRENT_BINARY_DIR}/clang.profdata ${CMAKE_CURRENT_BINARY_DIR}
+  COMMAND "${Python3_EXECUTABLE}" 
${CMAKE_CURRENT_SOURCE_DIR}/perf-helper.py merge ${LLVM_PROFDATA} 
${CMAKE_CURRENT_BINARY_DIR}/clang.profdata ${CMAKE_CURRENT_BINARY_DIR} 
${CMAKE_BINARY_DIR}/profiles/
   COMMENT "Merging profdata"
   DEPENDS generate-profraw)
+if (CLANG_PGO_TRAINING_DATA_SOURCE_DIR)
+  llvm_ExternalProject_Add(generate-profraw-external 
${CLANG_PGO_TRAINING_DATA_SOURCE_DIR}
+  USE_TOOLCHAIN EXLUDE_FROM_ALL NO_INSTALL DEPENDS 
generate-profraw)
+  add_dependencies(generate-profdata generate-profraw-external)
+else()
+  # Default to compiling a file from clang. This also builds all the
+  # dependencies needed to build this file, like TableGen.
+  set(generate_profraw_clang_sema 
tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/Sema.cpp.o)
+  llvm_ExternalProject_Add(generate-profraw-clang 
${CMAKE_CURRENT_SOURCE_DIR}/../../../llvm
+  USE_TOOLCHAIN EXLUDE_FROM_ALL NO_INSTALL DEPENDS generate-profraw
+  EXTRA_TARGETS generate_profraw_clang_sema

llvm-beanz wrote:

I saw small gains when I added it, but that was years ago. My confidence in it 
having any meaningful gain today is close to 0. I still think using training 
sources that have no stability is a bad idea. I'd feel much more comfortable 
using the LLVM examples or some other coding samples as testing sources.

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


[clang] [WIP] Turn 'counted_by' into a type attribute and parse it into 'CountAttributedType' (PR #78000)

2024-01-12 Thread via cfe-commits

github-actions[bot] wrote:




:warning: C/C++ code formatter, clang-format found issues in your code. 
:warning:



You can test this locally with the following command:


``bash
git-clang-format --diff 3bbc912d37f03d9ad3be330b81d91c2eaf6c37f2 
e65a99a00faba70960e75b4b8edb5acecb675197 -- 
clang/include/clang/AST/ASTContext.h 
clang/include/clang/AST/RecursiveASTVisitor.h clang/include/clang/AST/Type.h 
clang/include/clang/AST/TypeLoc.h clang/include/clang/Parse/Parser.h 
clang/include/clang/Sema/Sema.h 
clang/include/clang/Serialization/ASTRecordReader.h 
clang/include/clang/Serialization/ASTRecordWriter.h 
clang/lib/AST/ASTContext.cpp clang/lib/AST/ASTImporter.cpp 
clang/lib/AST/ASTStructuralEquivalence.cpp clang/lib/AST/ItaniumMangle.cpp 
clang/lib/AST/Type.cpp clang/lib/AST/TypeLoc.cpp clang/lib/AST/TypePrinter.cpp 
clang/lib/CodeGen/CGDebugInfo.cpp clang/lib/CodeGen/CGExpr.cpp 
clang/lib/CodeGen/CodeGenFunction.cpp clang/lib/Parse/ParseDecl.cpp 
clang/lib/Sema/SemaDecl.cpp clang/lib/Sema/SemaDeclAttr.cpp 
clang/lib/Sema/SemaExpr.cpp clang/lib/Sema/SemaType.cpp 
clang/lib/Sema/TreeTransform.h clang/lib/Serialization/ASTReader.cpp 
clang/lib/Serialization/ASTWriter.cpp clang/tools/libclang/CIndex.cpp
``





View the diff from clang-format here.


``diff
diff --git a/clang/include/clang/Parse/Parser.h 
b/clang/include/clang/Parse/Parser.h
index f88191ef5f..65f2e67fe7 100644
--- a/clang/include/clang/Parse/Parser.h
+++ b/clang/include/clang/Parse/Parser.h
@@ -3055,10 +3055,8 @@ private:
  ParsedAttr::Form Form);
 
   void ParseBoundsAttribute(IdentifierInfo &AttrName,
-SourceLocation AttrNameLoc,
-ParsedAttributes &Attrs,
-IdentifierInfo *ScopeName,
-SourceLocation ScopeLoc,
+SourceLocation AttrNameLoc, ParsedAttributes 
&Attrs,
+IdentifierInfo *ScopeName, SourceLocation ScopeLoc,
 ParsedAttr::Form Form);
 
   void ParseTypeofSpecifier(DeclSpec &DS);
diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index 027afb5d70..849692079c 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -1341,7 +1341,10 @@ public:
 /// \brief Describes whether we are in an expression constext which we have
 /// to handle differently.
 enum ExpressionKind {
-  EK_Decltype, EK_TemplateArgument, EK_BoundsAttrArgument, EK_Other
+  EK_Decltype,
+  EK_TemplateArgument,
+  EK_BoundsAttrArgument,
+  EK_Other
 } ExprContext;
 
 // A context can be nested in both a discarded statement context and
@@ -1437,11 +1440,11 @@ public:
   getCurrentMangleNumberContext(const DeclContext *DC);
 
   bool isBoundsAttrArgument() const {
-return ExprEvalContexts.back().ExprContext == 
-
ExpressionEvaluationContextRecord::ExpressionKind::EK_BoundsAttrArgument; 
+return ExprEvalContexts.back().ExprContext ==
+   ExpressionEvaluationContextRecord::ExpressionKind::
+   EK_BoundsAttrArgument;
   }
 
-
   /// SpecialMemberOverloadResult - The overloading result for a special member
   /// function.
   ///
@@ -2617,8 +2620,9 @@ public:
   QualType BuiltinChangeSignedness(QualType BaseType, UTTKind UKind,
SourceLocation Loc);
 
-  QualType BuildCountAttributedArrayType(QualType WrappedTy, Expr *CountExpr,
-  const llvm::SmallVector &Decls);
+  QualType BuildCountAttributedArrayType(
+  QualType WrappedTy, Expr *CountExpr,
+  const llvm::SmallVector &Decls);
 
   
//======//
   // Symbol table / Decl tracking callbacks: SemaDecl.cpp.
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp
index 1bbccfd47c..83a1e09ebd 100644
--- a/clang/lib/Parse/ParseDecl.cpp
+++ b/clang/lib/Parse/ParseDecl.cpp
@@ -630,8 +630,8 @@ void Parser::ParseGNUAttributeArgs(
   ScopeLoc, Form);
 return;
   } else if (AttrKind == ParsedAttr::AT_CountedBy) {
-ParseBoundsAttribute(*AttrName, AttrNameLoc, Attrs, ScopeName,
- ScopeLoc, Form);
+ParseBoundsAttribute(*AttrName, AttrNameLoc, Attrs, ScopeName, ScopeLoc,
+ Form);
 return;
   }
 
@@ -3167,11 +3167,14 @@ void Parser::ParseAlignmentSpecifier(ParsedAttributes 
&Attrs,
 
 /// Bounds attributes (e.g., counted_by):
 ///   AttrName '(' expression ')'
-void Parser::ParseBoundsAttribute(IdentifierInfo &AttrName, SourceLocation 
AttrNameLoc, ParsedAttributes &Attrs, IdentifierInfo *ScopeName,
-   SourceLocation ScopeLoc,
-   ParsedAttr::Form Form) {
+void Parser::ParseBoundsAttribute(IdentifierInfo &AttrName,
+  

[clang] [llvm] [CMake][PGO] Build Sema.cpp to generate profdata for PGO builds (PR #77347)

2024-01-12 Thread Tom Stellard via cfe-commits


@@ -26,9 +30,23 @@ if(LLVM_BUILD_INSTRUMENTED)
 message(STATUS "To enable merging PGO data LLVM_PROFDATA has to point to 
llvm-profdata")
   else()
 add_custom_target(generate-profdata
-  COMMAND "${Python3_EXECUTABLE}" 
${CMAKE_CURRENT_SOURCE_DIR}/perf-helper.py merge ${LLVM_PROFDATA} 
${CMAKE_CURRENT_BINARY_DIR}/clang.profdata ${CMAKE_CURRENT_BINARY_DIR}
+  COMMAND "${Python3_EXECUTABLE}" 
${CMAKE_CURRENT_SOURCE_DIR}/perf-helper.py merge ${LLVM_PROFDATA} 
${CMAKE_CURRENT_BINARY_DIR}/clang.profdata ${CMAKE_CURRENT_BINARY_DIR} 
${CMAKE_BINARY_DIR}/profiles/
   COMMENT "Merging profdata"
   DEPENDS generate-profraw)
+if (CLANG_PGO_TRAINING_DATA_SOURCE_DIR)
+  llvm_ExternalProject_Add(generate-profraw-external 
${CLANG_PGO_TRAINING_DATA_SOURCE_DIR}
+  USE_TOOLCHAIN EXLUDE_FROM_ALL NO_INSTALL DEPENDS 
generate-profraw)
+  add_dependencies(generate-profdata generate-profraw-external)
+else()
+  # Default to compiling a file from clang. This also builds all the
+  # dependencies needed to build this file, like TableGen.
+  set(generate_profraw_clang_sema 
tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/Sema.cpp.o)
+  llvm_ExternalProject_Add(generate-profraw-clang 
${CMAKE_CURRENT_SOURCE_DIR}/../../../llvm
+  USE_TOOLCHAIN EXLUDE_FROM_ALL NO_INSTALL DEPENDS generate-profraw
+  EXTRA_TARGETS generate_profraw_clang_sema

tstellar wrote:

> If you're not concerned about the efficacy of the PGO build, I'm not sure why 
> the existing single hello_world is a bad default. It isn't great but it is 
> stable and something. If you want something that gives better performance 
> then you must care about the efficacy, and I think you need to be somewhat 
> concerned about the stability of those results, otherwise what's the point?

I'm concerned about the efficacy if it is 0%, but not really concerned if it 
bounces around between say 10 and 25 % based on updates to the file we are 
using to train.

I tested with the existing default (hello_world) and I didn't see any 
performance improvements from that.  We also did some manual builds (not using 
the 2-stage PGO cache) and could not get any performance gains for using a 
hello world source.  How certain are we that hello_world is enough to get 
performance improvements from PGO?  Has anyone tested this recently?  I will 
re-run my tests just to double check.

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


[clang] [WIP] Turn 'counted_by' into a type attribute and parse it into 'CountAttributedType' (PR #78000)

2024-01-12 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang

Author: Yeoul Na (rapidsna)


Changes

In `-fbounds-safety`, bounds annotations are considered type attributes rather 
than declaration attributes. Constructing them as type attributes allows us to 
extend the attribute to apply nested pointers, which is essential to annotate 
functions that involve out parameters: `void foo(int *__counted_by(*out_count) 
*out_buf, int *out_count)`.

We introduce a new sugar type to support bounds annotated types, 
`CountAttributedType`. In order to maintain extra data (the bounds expression 
and the dependent declaration information) that is not trackable in 
`AttributedType` we create a new type dedicate to this functionality.

This patch also extends the parsing logic to parse the `counted_by` argument as 
an expression, which will allow us to extend the model to support arguments 
beyond an identifier, e.g., `__counted_by(n + m)` in the future as specified by 
`-fbounds-safety`.

This also adjusts `__bdos` and array-bounds sanitizer code that already uses 
`CountedByAttr` to check `CountAttributedType` instead to get the field 
referred to by the attribute.

---

Patch is 50.71 KiB, truncated to 20.00 KiB below, full version: 
https://github.com/llvm/llvm-project/pull/78000.diff


33 Files Affected:

- (modified) clang/include/clang/AST/ASTContext.h (+7) 
- (modified) clang/include/clang/AST/PropertiesBase.td (+1) 
- (modified) clang/include/clang/AST/RecursiveASTVisitor.h (+9) 
- (modified) clang/include/clang/AST/Type.h (+152) 
- (modified) clang/include/clang/AST/TypeLoc.h (+26) 
- (modified) clang/include/clang/AST/TypeProperties.td (+19) 
- (modified) clang/include/clang/Basic/Attr.td (+4-3) 
- (modified) clang/include/clang/Basic/DiagnosticSemaKinds.td (+10-4) 
- (modified) clang/include/clang/Basic/TypeNodes.td (+2) 
- (modified) clang/include/clang/Parse/Parser.h (+7) 
- (modified) clang/include/clang/Sema/Sema.h (+9-3) 
- (modified) clang/include/clang/Serialization/ASTRecordReader.h (+2) 
- (modified) clang/include/clang/Serialization/ASTRecordWriter.h (+5) 
- (modified) clang/include/clang/Serialization/TypeBitCodes.def (+1) 
- (modified) clang/lib/AST/ASTContext.cpp (+56) 
- (modified) clang/lib/AST/ASTImporter.cpp (+12) 
- (modified) clang/lib/AST/ASTStructuralEquivalence.cpp (+7) 
- (modified) clang/lib/AST/ItaniumMangle.cpp (+1) 
- (modified) clang/lib/AST/Type.cpp (+65) 
- (modified) clang/lib/AST/TypeLoc.cpp (+4) 
- (modified) clang/lib/AST/TypePrinter.cpp (+23) 
- (modified) clang/lib/CodeGen/CGDebugInfo.cpp (+1) 
- (modified) clang/lib/CodeGen/CGExpr.cpp (+8-27) 
- (modified) clang/lib/CodeGen/CodeGenFunction.cpp (+1) 
- (modified) clang/lib/Parse/ParseDecl.cpp (+50) 
- (modified) clang/lib/Sema/SemaDecl.cpp (-6) 
- (modified) clang/lib/Sema/SemaDeclAttr.cpp (+71-102) 
- (modified) clang/lib/Sema/SemaExpr.cpp (+21-2) 
- (modified) clang/lib/Sema/SemaType.cpp (+11) 
- (modified) clang/lib/Sema/TreeTransform.h (+7) 
- (modified) clang/lib/Serialization/ASTReader.cpp (+8) 
- (modified) clang/lib/Serialization/ASTWriter.cpp (+4) 
- (modified) clang/tools/libclang/CIndex.cpp (+4) 


``diff
diff --git a/clang/include/clang/AST/ASTContext.h 
b/clang/include/clang/AST/ASTContext.h
index 3e46a5da3fc043..c8354fbb108a27 100644
--- a/clang/include/clang/AST/ASTContext.h
+++ b/clang/include/clang/AST/ASTContext.h
@@ -247,6 +247,8 @@ class ASTContext : public RefCountedBase {
   DependentBitIntTypes;
   llvm::FoldingSet BTFTagAttributedTypes;
 
+  mutable llvm::FoldingSet CountAttributedTypes;
+
   mutable llvm::FoldingSet QualifiedTemplateNames;
   mutable llvm::FoldingSet DependentTemplateNames;
   mutable llvm::FoldingSet
@@ -1338,6 +1340,11 @@ class ASTContext : public RefCountedBase {
 return CanQualType::CreateUnsafe(getPointerType((QualType) T));
   }
 
+  QualType
+  getCountAttributedType(QualType T, Expr *CountExpr, bool CountInBytes,
+ bool OrNull,
+ ArrayRef DependentDecls) 
const;
+
   /// Return the uniqued reference to a type adjusted from the original
   /// type to a new type.
   QualType getAdjustedType(QualType Orig, QualType New) const;
diff --git a/clang/include/clang/AST/PropertiesBase.td 
b/clang/include/clang/AST/PropertiesBase.td
index d86c4eba6a2251..25ddfd105ab877 100644
--- a/clang/include/clang/AST/PropertiesBase.td
+++ b/clang/include/clang/AST/PropertiesBase.td
@@ -143,6 +143,7 @@ def UInt32 : CountPropertyType<"uint32_t">;
 def UInt64 : CountPropertyType<"uint64_t">;
 def UnaryTypeTransformKind : EnumPropertyType<"UnaryTransformType::UTTKind">;
 def VectorKind : EnumPropertyType<"VectorKind">;
+def TypeCoupledDeclRefInfo : PropertyType;
 
 def ExceptionSpecInfo : PropertyType<"FunctionProtoType::ExceptionSpecInfo"> {
   let BufferElementTypes = [ QualType ];
diff --git a/clang/include/clang/AST/RecursiveASTVisitor.h 
b/clang/include/clang/AST/RecursiveASTVisitor.h
index 8f2714e142bbe3..b57ab36939d07c 100644
--- a/clang/inc

[clang] [WIP] Turn 'counted_by' into a type attribute and parse it into 'CountAttributedType' (PR #78000)

2024-01-12 Thread via cfe-commits

github-actions[bot] wrote:

Thank you for submitting a Pull Request (PR) to the LLVM Project!

This PR will be automatically labeled and the relevant teams will be
notified.

If you wish to, you can add reviewers by using the "Reviewers" section on this 
page.

If this is not working for you, it is probably because you do not have write
permissions for the repository. In which case you can instead tag reviewers by
name in a comment by using `@` followed by their GitHub username.

If you have received no comments on your PR for a week, you can request a review
by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate
is once a week. Please remember that you are asking for valuable time from 
other developers.

If you have further questions, they may be answered by the [LLVM GitHub User 
Guide](https://llvm.org/docs/GitHub.html).

You can also ask questions in a comment on this PR, on the [LLVM 
Discord](https://discord.com/invite/xS7Z362) or on the 
[forums](https://discourse.llvm.org/).

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


[clang] [WIP] Turn 'counted_by' into a type attribute and parse it into 'CountAttributedType' (PR #78000)

2024-01-12 Thread Yeoul Na via cfe-commits

https://github.com/rapidsna created 
https://github.com/llvm/llvm-project/pull/78000

In `-fbounds-safety`, bounds annotations are considered type attributes rather 
than declaration attributes. Constructing them as type attributes allows us to 
extend the attribute to apply nested pointers, which is essential to annotate 
functions that involve out parameters: `void foo(int *__counted_by(*out_count) 
*out_buf, int *out_count)`.

We introduce a new sugar type to support bounds annotated types, 
`CountAttributedType`. In order to maintain extra data (the bounds expression 
and the dependent declaration information) that is not trackable in 
`AttributedType` we create a new type dedicate to this functionality.

This patch also extends the parsing logic to parse the `counted_by` argument as 
an expression, which will allow us to extend the model to support arguments 
beyond an identifier, e.g., `__counted_by(n + m)` in the future as specified by 
`-fbounds-safety`.

This also adjusts `__bdos` and array-bounds sanitizer code that already uses 
`CountedByAttr` to check `CountAttributedType` instead to get the field 
referred to by the attribute.

>From 1a17c254ddf09cd4faf5217b2f72da3f44622f8a Mon Sep 17 00:00:00 2001
From: Yeoul Na 
Date: Mon, 18 Dec 2023 10:58:16 +0900
Subject: [PATCH 1/2] [BoundsSafety] Introduce CountAttributedType

CountAttributedType is a sugar type to represent a type with
a 'counted_by' attribute and the likes, which provides bounds
information to the underlying type. The type contains an
the argument of attribute as an expression. Additionally, the type
holds metadata about declarations referenced by the expression in
order to make it easier for Sema to access declarations on which
the type depends.
---
 clang/include/clang/AST/ASTContext.h  |   7 +
 clang/include/clang/AST/PropertiesBase.td |   1 +
 clang/include/clang/AST/RecursiveASTVisitor.h |   9 ++
 clang/include/clang/AST/Type.h| 152 ++
 clang/include/clang/AST/TypeLoc.h |  26 +++
 clang/include/clang/AST/TypeProperties.td |  19 +++
 clang/include/clang/Basic/TypeNodes.td|   2 +
 .../clang/Serialization/ASTRecordReader.h |   2 +
 .../clang/Serialization/ASTRecordWriter.h |   5 +
 .../clang/Serialization/TypeBitCodes.def  |   1 +
 clang/lib/AST/ASTContext.cpp  |  56 +++
 clang/lib/AST/ASTImporter.cpp |  12 ++
 clang/lib/AST/ASTStructuralEquivalence.cpp|   7 +
 clang/lib/AST/ItaniumMangle.cpp   |   1 +
 clang/lib/AST/Type.cpp|  57 +++
 clang/lib/AST/TypeLoc.cpp |   4 +
 clang/lib/AST/TypePrinter.cpp |  23 +++
 clang/lib/CodeGen/CGDebugInfo.cpp |   1 +
 clang/lib/CodeGen/CodeGenFunction.cpp |   1 +
 clang/lib/Sema/SemaExpr.cpp   |   1 +
 clang/lib/Sema/TreeTransform.h|   7 +
 clang/lib/Serialization/ASTReader.cpp |   8 +
 clang/lib/Serialization/ASTWriter.cpp |   4 +
 clang/tools/libclang/CIndex.cpp   |   4 +
 24 files changed, 410 insertions(+)

diff --git a/clang/include/clang/AST/ASTContext.h 
b/clang/include/clang/AST/ASTContext.h
index 3e46a5da3fc043..c8354fbb108a27 100644
--- a/clang/include/clang/AST/ASTContext.h
+++ b/clang/include/clang/AST/ASTContext.h
@@ -247,6 +247,8 @@ class ASTContext : public RefCountedBase {
   DependentBitIntTypes;
   llvm::FoldingSet BTFTagAttributedTypes;
 
+  mutable llvm::FoldingSet CountAttributedTypes;
+
   mutable llvm::FoldingSet QualifiedTemplateNames;
   mutable llvm::FoldingSet DependentTemplateNames;
   mutable llvm::FoldingSet
@@ -1338,6 +1340,11 @@ class ASTContext : public RefCountedBase {
 return CanQualType::CreateUnsafe(getPointerType((QualType) T));
   }
 
+  QualType
+  getCountAttributedType(QualType T, Expr *CountExpr, bool CountInBytes,
+ bool OrNull,
+ ArrayRef DependentDecls) 
const;
+
   /// Return the uniqued reference to a type adjusted from the original
   /// type to a new type.
   QualType getAdjustedType(QualType Orig, QualType New) const;
diff --git a/clang/include/clang/AST/PropertiesBase.td 
b/clang/include/clang/AST/PropertiesBase.td
index d86c4eba6a2251..25ddfd105ab877 100644
--- a/clang/include/clang/AST/PropertiesBase.td
+++ b/clang/include/clang/AST/PropertiesBase.td
@@ -143,6 +143,7 @@ def UInt32 : CountPropertyType<"uint32_t">;
 def UInt64 : CountPropertyType<"uint64_t">;
 def UnaryTypeTransformKind : EnumPropertyType<"UnaryTransformType::UTTKind">;
 def VectorKind : EnumPropertyType<"VectorKind">;
+def TypeCoupledDeclRefInfo : PropertyType;
 
 def ExceptionSpecInfo : PropertyType<"FunctionProtoType::ExceptionSpecInfo"> {
   let BufferElementTypes = [ QualType ];
diff --git a/clang/include/clang/AST/RecursiveASTVisitor.h 
b/clang/include/clang/AST/RecursiveASTVisitor.h
index 8f2714e142bbe3..b57ab36939d07c 100644
--- a/clang/include

[clang-tools-extra] 5ca2d75 - [NFC]fix incorrect autosar link in clang-tidy doc

2024-01-12 Thread Congcong Cai via cfe-commits

Author: Congcong Cai
Date: 2024-01-13T08:09:36+08:00
New Revision: 5ca2d75f2046612978ba71c4b36714b2a0a01886

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

LOG: [NFC]fix incorrect autosar link in clang-tidy doc

Added: 


Modified: 

clang-tools-extra/docs/clang-tidy/checks/misc/unconventional-assign-operator.rst

Removed: 




diff  --git 
a/clang-tools-extra/docs/clang-tidy/checks/misc/unconventional-assign-operator.rst
 
b/clang-tools-extra/docs/clang-tidy/checks/misc/unconventional-assign-operator.rst
index 825a94b45799eb..3b4b65a5cb6838 100644
--- 
a/clang-tools-extra/docs/clang-tidy/checks/misc/unconventional-assign-operator.rst
+++ 
b/clang-tools-extra/docs/clang-tidy/checks/misc/unconventional-assign-operator.rst
@@ -15,4 +15,4 @@ types and definitions with good return type but wrong 
``return`` statements.
   * The operator must always return ``*this``.
 
 This check implements `AUTOSAR C++14 Rule A13-2-1
-`_.
+`_.



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


[clang-tools-extra] e028bee - [NFC]update autosar link in clang-tidy doc

2024-01-12 Thread Congcong Cai via cfe-commits

Author: Congcong Cai
Date: 2024-01-13T08:08:11+08:00
New Revision: e028bee52ffc2ab9883d3d9a7dc66fe7b7c50a65

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

LOG: [NFC]update autosar link in clang-tidy doc

Added: 


Modified: 
clang-tools-extra/docs/clang-tidy/checks/misc/const-correctness.rst

clang-tools-extra/docs/clang-tidy/checks/misc/unconventional-assign-operator.rst

Removed: 




diff  --git 
a/clang-tools-extra/docs/clang-tidy/checks/misc/const-correctness.rst 
b/clang-tools-extra/docs/clang-tidy/checks/misc/const-correctness.rst
index b5a59fa691da40..86fba6c7e4f7cf 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/misc/const-correctness.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/misc/const-correctness.rst
@@ -8,7 +8,7 @@ This check implements detection of local variables which could 
be declared as
 coding guidelines, such as:
 `ES.25 
`_
 from the C++ Core Guidelines and `AUTOSAR C++14 Rule A7-1-1 (6.7.1 Specifiers)
-`_.
+`_.
 
 Please note that this check's analysis is type-based only. Variables that are 
not modified
 but used to create a non-const handle that might escape the scope are not 
diagnosed

diff  --git 
a/clang-tools-extra/docs/clang-tidy/checks/misc/unconventional-assign-operator.rst
 
b/clang-tools-extra/docs/clang-tidy/checks/misc/unconventional-assign-operator.rst
index 49e3fd5b6ee428..825a94b45799eb 100644
--- 
a/clang-tools-extra/docs/clang-tidy/checks/misc/unconventional-assign-operator.rst
+++ 
b/clang-tools-extra/docs/clang-tidy/checks/misc/unconventional-assign-operator.rst
@@ -13,3 +13,6 @@ types and definitions with good return type but wrong 
``return`` statements.
 type (e.g. ``int``).
   * Private and deleted operators are ignored.
   * The operator must always return ``*this``.
+
+This check implements `AUTOSAR C++14 Rule A13-2-1
+`_.



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


[clang-tools-extra] [clang-tid]fix modernize-use-auto incorrect fix hints for pointer (PR #77943)

2024-01-12 Thread Congcong Cai via cfe-commits


@@ -405,12 +421,20 @@ void UseAutoCheck::replaceExpr(
 
   auto Diag = diag(Range.getBegin(), Message);
 
+  bool ShouldReplenishVariableName = isMutliLevelPointerToTypeLocClasses(
+  FirstDecl->getTypeSourceInfo()->getTypeLoc(),
+  {TypeLoc::FunctionProto, TypeLoc::ConstantArray});
+
   // Space after 'auto' to handle cases where the '*' in the pointer type is
   // next to the identifier. This avoids changing 'int *p' into 'autop'.
-  // FIXME: This doesn't work for function pointers because the variable name
-  // is inside the type.
-  Diag << FixItHint::CreateReplacement(Range, RemoveStars ? "auto " : "auto")
-   << StarRemovals;
+  llvm::StringRef Auto = ShouldReplenishVariableName
+ ? (RemoveStars ? "auto " : "auto *")
+ : (RemoveStars ? "auto " : "auto");
+  std::string ReplenishedVariableName =
+  ShouldReplenishVariableName ? FirstDecl->getQualifiedNameAsString() : "";
+  std::string Replacement =
+  (Auto + llvm::StringRef{ReplenishedVariableName}).str();
+  Diag << FixItHint::CreateReplacement(Range, Replacement) << StarRemovals;

HerrCai0907 wrote:

It is very hard to split the variable name according to `TypeLoc` and `VarDecl`.

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


[clang-tools-extra] [clang-tid]fix modernize-use-auto incorrect fix hints for pointer (PR #77943)

2024-01-12 Thread Congcong Cai via cfe-commits

https://github.com/HerrCai0907 updated 
https://github.com/llvm/llvm-project/pull/77943

>From 537d283288f555c2bb7cff90aee89fe9b18f08b8 Mon Sep 17 00:00:00 2001
From: Congcong Cai 
Date: Sat, 13 Jan 2024 00:31:33 +0800
Subject: [PATCH 1/3] [clang-tid]fix modernize-use-auto incorrect fix hints for
 pointer

avoid create incorrect fix hints for pointer to array type and pointer to 
function type
Fixes: #77891
---
 .../clang-tidy/modernize/UseAutoCheck.cpp | 52 ++-
 clang-tools-extra/docs/ReleaseNotes.rst   |  4 ++
 2 files changed, 42 insertions(+), 14 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/modernize/UseAutoCheck.cpp 
b/clang-tools-extra/clang-tidy/modernize/UseAutoCheck.cpp
index 7af30e688b6a71..af41c4b5071796 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseAutoCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseAutoCheck.cpp
@@ -8,10 +8,12 @@
 
 #include "UseAutoCheck.h"
 #include "clang/AST/ASTContext.h"
+#include "clang/AST/TypeLoc.h"
 #include "clang/ASTMatchers/ASTMatchFinder.h"
 #include "clang/ASTMatchers/ASTMatchers.h"
 #include "clang/Basic/CharInfo.h"
 #include "clang/Tooling/FixIt.h"
+#include "llvm/ADT/STLExtras.h"
 
 using namespace clang;
 using namespace clang::ast_matchers;
@@ -333,6 +335,26 @@ void UseAutoCheck::replaceIterators(const DeclStmt *D, 
ASTContext *Context) {
   << FixItHint::CreateReplacement(Range, "auto");
 }
 
+namespace {
+
+void ignoreTypeLocClasses(
+TypeLoc &Loc, llvm::SmallVector const &LocClasses) {
+  while (llvm::is_contained(LocClasses, Loc.getTypeLocClass()))
+Loc = Loc.getNextTypeLoc();
+}
+
+bool isMutliLevelPointerToTypeLocClasses(
+TypeLoc Loc, llvm::SmallVector const &LocClasses) {
+  ignoreTypeLocClasses(Loc, {TypeLoc::Paren, TypeLoc::Qualified});
+  if (Loc.getTypeLocClass() != TypeLoc::Pointer)
+return false;
+  ignoreTypeLocClasses(Loc,
+   {TypeLoc::Paren, TypeLoc::Qualified, TypeLoc::Pointer});
+  return llvm::is_contained(LocClasses, Loc.getTypeLocClass());
+}
+
+} // namespace
+
 void UseAutoCheck::replaceExpr(
 const DeclStmt *D, ASTContext *Context,
 llvm::function_ref GetType, StringRef Message) {
@@ -384,16 +406,10 @@ void UseAutoCheck::replaceExpr(
   // information is not reliable where CV qualifiers are concerned so we can't
   // do anything about this case for now.
   TypeLoc Loc = FirstDecl->getTypeSourceInfo()->getTypeLoc();
-  if (!RemoveStars) {
-while (Loc.getTypeLocClass() == TypeLoc::Pointer ||
-   Loc.getTypeLocClass() == TypeLoc::Qualified)
-  Loc = Loc.getNextTypeLoc();
-  }
-  while (Loc.getTypeLocClass() == TypeLoc::LValueReference ||
- Loc.getTypeLocClass() == TypeLoc::RValueReference ||
- Loc.getTypeLocClass() == TypeLoc::Qualified) {
-Loc = Loc.getNextTypeLoc();
-  }
+  if (!RemoveStars)
+ignoreTypeLocClasses(Loc, {TypeLoc::Pointer, TypeLoc::Qualified});
+  ignoreTypeLocClasses(Loc, {TypeLoc::LValueReference, 
TypeLoc::RValueReference,
+ TypeLoc::Qualified});
   SourceRange Range(Loc.getSourceRange());
 
   if (MinTypeNameLength != 0 &&
@@ -405,12 +421,20 @@ void UseAutoCheck::replaceExpr(
 
   auto Diag = diag(Range.getBegin(), Message);
 
+  bool ShouldReplenishVariableName = isMutliLevelPointerToTypeLocClasses(
+  FirstDecl->getTypeSourceInfo()->getTypeLoc(),
+  {TypeLoc::FunctionProto, TypeLoc::ConstantArray});
+
   // Space after 'auto' to handle cases where the '*' in the pointer type is
   // next to the identifier. This avoids changing 'int *p' into 'autop'.
-  // FIXME: This doesn't work for function pointers because the variable name
-  // is inside the type.
-  Diag << FixItHint::CreateReplacement(Range, RemoveStars ? "auto " : "auto")
-   << StarRemovals;
+  llvm::StringRef Auto = ShouldReplenishVariableName
+ ? (RemoveStars ? "auto " : "auto *")
+ : (RemoveStars ? "auto " : "auto");
+  std::string ReplenishedVariableName =
+  ShouldReplenishVariableName ? FirstDecl->getQualifiedNameAsString() : "";
+  std::string Replacement =
+  (Auto + llvm::StringRef{ReplenishedVariableName}).str();
+  Diag << FixItHint::CreateReplacement(Range, Replacement) << StarRemovals;
 }
 
 void UseAutoCheck::check(const MatchFinder::MatchResult &Result) {
diff --git a/clang-tools-extra/docs/ReleaseNotes.rst 
b/clang-tools-extra/docs/ReleaseNotes.rst
index b4d87e0ed2a67a..9bf34177ebff2c 100644
--- a/clang-tools-extra/docs/ReleaseNotes.rst
+++ b/clang-tools-extra/docs/ReleaseNotes.rst
@@ -405,6 +405,10 @@ Changes in existing checks
   false-positives when constructing the container with ``count`` copies of
   elements with value ``value``.
 
+- Improved :doc:`modernize-use-auto
+  ` to avoid create incorrect fix hints
+  for pointer to array type and pointer to function type.
+
 - Improved :doc:`modernize-use-emplace
   ` to not replace aggregates that
   ``emplace`` cannot construct with aggregate

[clang-tools-extra] [clang-tidy] Invalid Fix-It generated for implicit-widening-multiplication-result (PR #76315)

2024-01-12 Thread Félix-Antoine Constantin via cfe-commits

felix642 wrote:

@PiotrZSL thank you for the review. 
I would greatly appreciate if you could merge this PR for me since I do not 
have the rights to do it.

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


[clang-tools-extra] [clang-tidy] Invalid Fix-It generated for implicit-widening-multiplication-result (PR #76315)

2024-01-12 Thread Félix-Antoine Constantin via cfe-commits


@@ -18,7 +18,7 @@ char *t0(char *base, int a, int b) {
   // CHECK-NOTES-CXX:  static_cast( )
   // CHECK-NOTES-ALL: :[[@LINE-5]]:17: note: perform multiplication in a wider 
type
   // CHECK-NOTES-C:(ptrdiff_t)
-  // CHECK-NOTES-CXX:  static_cast()
+  // CHECK-NOTES-CXX:  static_cast( )

felix642 wrote:

I agree with you, like I've mentionned :

> Since both suggestions are overlapping clang-tidy refuses to apply them [...]

This is probably the reason why they are currently not using `CHECK-FIXES`. It 
would be a good idea to update the tests to use `CHECK-FIXES` but we would 
probably need to remove one of the FIX-IT for it to work.


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


[llvm] [clang] [compiler-rt] [clang-tools-extra] [AMDGPU] Avoid hitting AMDGPUAsmPrinter related asserts for local functions at O0 (PR #72129)

2024-01-12 Thread Krzysztof Drewniak via cfe-commits

krzysz00 wrote:

As a somewhat naive question, what would it take to turn off requiring codegen 
to be in SCC order? We seem to be the only target doing that. The comments on 
that line say something about function calls and noinline

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


[llvm] [clang] [clang-tools-extra] [Driver] Add -fandroid-pad-segment/-fno-android-pad-segment (PR #77244)

2024-01-12 Thread via cfe-commits

llvmbot wrote:



@llvm/pr-subscribers-clang

@llvm/pr-subscribers-clang-driver

Author: Fangrui Song (MaskRay)


Changes

-fandroid-pad-segment is an Android-specific opt-in option that
links in crt_pad_segment.o (beside other crt*.o relocatable files).

crt_pad_segment.o contains a note section, which will be included in the
linker-created PT_NOTE segment. This PT_NOTE tell Bionic that: when
create a map for a PT_LOAD segment, extend the end to cover the gap so
that we will have fewer kernel 'struct vm_area_struct' objects when
page_size < MAXPAGESIZE.

See also https://sourceware.org/bugzilla/show_bug.cgi?id=31076

Link: https://r.android.com/2902180


---
Full diff: https://github.com/llvm/llvm-project/pull/77244.diff


4 Files Affected:

- (modified) clang/include/clang/Driver/Options.td (+5) 
- (modified) clang/lib/Driver/ToolChains/Gnu.cpp (+5) 
- (added) 
clang/test/Driver/Inputs/basic_android_tree/sysroot/usr/lib/crt_pad_segment.o 
() 
- (modified) clang/test/Driver/linux-ld.c (+18-1) 


``diff
diff --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index c237d1f6619348..bd897d5b6de31b 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -6297,6 +6297,11 @@ def fno_sycl : Flag<["-"], "fno-sycl">,
   Visibility<[ClangOption, CLOption]>,
   Group, HelpText<"Disables SYCL kernels compilation for device">;
 
+// OS-specific options
+let Flags = [TargetSpecific] in {
+defm android_pad_segment : BooleanFFlag<"android-pad-segment">, Group;
+} // let Flags = [TargetSpecific]
+
 
//===--===//
 // FLangOption + NoXarchOption
 
//===--===//
diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp 
b/clang/lib/Driver/ToolChains/Gnu.cpp
index 771240dac7a83e..5a1d40478295d6 100644
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
@@ -508,6 +508,11 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, 
const JobAction &JA,
 
 // Add crtfastmath.o if available and fast math is enabled.
 ToolChain.addFastMathRuntimeIfAvailable(Args, CmdArgs);
+
+if (isAndroid && Args.hasFlag(options::OPT_fandroid_pad_segment,
+  options::OPT_fno_android_pad_segment, false))
+  CmdArgs.push_back(
+  Args.MakeArgString(ToolChain.GetFilePath("crt_pad_segment.o")));
   }
 
   Args.addAllArgs(CmdArgs, {options::OPT_L, options::OPT_u});
diff --git 
a/clang/test/Driver/Inputs/basic_android_tree/sysroot/usr/lib/crt_pad_segment.o 
b/clang/test/Driver/Inputs/basic_android_tree/sysroot/usr/lib/crt_pad_segment.o
new file mode 100644
index 00..e69de29bb2d1d6
diff --git a/clang/test/Driver/linux-ld.c b/clang/test/Driver/linux-ld.c
index d5cc3103a3a746..dd3f4b6784d487 100644
--- a/clang/test/Driver/linux-ld.c
+++ b/clang/test/Driver/linux-ld.c
@@ -1347,7 +1347,24 @@
 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID-PTHREAD-LINK %s
 // CHECK-ANDROID-PTHREAD-LINK-NOT: argument unused during compilation: 
'-pthread'
-//
+
+/// Check -fandroid-pad-segment.
+// RUN: %clang -### %s --target=aarch64-linux-android -rtlib=platform 
--unwindlib=platform \
+// RUN:   --gcc-toolchain="" --sysroot=%S/Inputs/basic_android_tree/sysroot \
+// RUN:   -fandroid-pad-segment 2>&1 | FileCheck 
--check-prefix=CHECK-ANDROID-PAD-PHDR %s
+// CHECK-ANDROID-PAD-PHDR: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
+// CHECK-ANDROID-PAD-PHDR: "[[SYSROOT]]/usr/lib/crtbegin_dynamic.o" 
"[[SYSROOT]]/usr/lib/crt_pad_phdr.o"
+
+// RUN: %clang -### %s --target=aarch64-linux-android -rtlib=platform 
--unwindlib=platform \
+// RUN:   --gcc-toolchain="" --sysroot=%S/Inputs/basic_android_tree/sysroot \
+// RUN:   -fandroid-pad-segment -fno-android-pad-segment 2>&1 | FileCheck 
--check-prefix=CHECK-NO-ANDROID-PAD-PHDR %s
+// CHECK-NO-ANDROID-PAD-PHDR: "{{.*}}ld{{(.exe)?}}" 
"--sysroot=[[SYSROOT:[^"]+]]"
+// CHECK-NO-ANDROID-PAD-PHDR: "[[SYSROOT]]/usr/lib/crtbegin_dynamic.o"
+// CHECK-NO-ANDROID-PAD-PHDR-NOT: crt_pad_phdr.o"
+
+// RUN: not %clang -### %s --target=aarch64-linux -fandroid-pad-segment 2>&1 | 
FileCheck --check-prefix=ERR-ANDROID-PAD-EHDR %s
+// ERR-ANDROID-PAD-EHDR: error: unsupported option '-fandroid-pad-segment' for 
target 'aarch64-linux'
+
 // Check linker invocation on a Debian LoongArch sysroot.
 // RUN: %clang -### %s -no-pie 2>&1 \
 // RUN: --target=loongarch64-linux-gnu -rtlib=platform 
--unwindlib=platform \

``




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


[llvm] [clang] [clang-tools-extra] [Driver] Add -fandroid-pad-segment/-fno-android-pad-segment (PR #77244)

2024-01-12 Thread Fangrui Song via cfe-commits

https://github.com/MaskRay ready_for_review 
https://github.com/llvm/llvm-project/pull/77244
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[llvm] [clang] [clang-tools-extra] [Driver] Add -fandroid-pad-segment/-fno-android-pad-segment (PR #77244)

2024-01-12 Thread Fangrui Song via cfe-commits

https://github.com/MaskRay edited 
https://github.com/llvm/llvm-project/pull/77244
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [llvm] [clang] [Driver] Add -fandroid-pad-segment/-fno-android-pad-segment (PR #77244)

2024-01-12 Thread Fangrui Song via cfe-commits

https://github.com/MaskRay updated 
https://github.com/llvm/llvm-project/pull/77244

>From f4758993998e221cc41924d8ec9feb70f759937a Mon Sep 17 00:00:00 2001
From: Fangrui Song 
Date: Sun, 7 Jan 2024 09:47:53 -0800
Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20initia?=
 =?UTF-8?q?l=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.4
---
 clang/include/clang/Driver/Options.td |  5 +
 clang/lib/Driver/ToolChains/Gnu.cpp   |  5 +
 .../sysroot/usr/lib/crt_pad_segment.o |  0
 clang/test/Driver/linux-ld.c  | 19 ++-
 4 files changed, 28 insertions(+), 1 deletion(-)
 create mode 100644 
clang/test/Driver/Inputs/basic_android_tree/sysroot/usr/lib/crt_pad_segment.o

diff --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index 6aff37f1336871..6a5a7c58759e62 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -6293,6 +6293,11 @@ def fno_sycl : Flag<["-"], "fno-sycl">,
   Visibility<[ClangOption, CLOption]>,
   Group, HelpText<"Disables SYCL kernels compilation for device">;
 
+// OS-specific options
+let Flags = [TargetSpecific] in {
+defm android_pad_segment : BooleanFFlag<"android-pad-segment">, Group;
+} // let Flags = [TargetSpecific]
+
 
//===--===//
 // FLangOption + NoXarchOption
 
//===--===//
diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp 
b/clang/lib/Driver/ToolChains/Gnu.cpp
index a610a94a39a2b4..dd0dd13883d83a 100644
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
@@ -508,6 +508,11 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, 
const JobAction &JA,
 
 // Add crtfastmath.o if available and fast math is enabled.
 ToolChain.addFastMathRuntimeIfAvailable(Args, CmdArgs);
+
+if (isAndroid && Args.hasFlag(options::OPT_fandroid_pad_segment,
+  options::OPT_fno_android_pad_segment, false))
+  CmdArgs.push_back(
+  Args.MakeArgString(ToolChain.GetFilePath("crt_pad_segment.o")));
   }
 
   Args.addAllArgs(CmdArgs, {options::OPT_L, options::OPT_u});
diff --git 
a/clang/test/Driver/Inputs/basic_android_tree/sysroot/usr/lib/crt_pad_segment.o 
b/clang/test/Driver/Inputs/basic_android_tree/sysroot/usr/lib/crt_pad_segment.o
new file mode 100644
index 00..e69de29bb2d1d6
diff --git a/clang/test/Driver/linux-ld.c b/clang/test/Driver/linux-ld.c
index 15643d6491ae52..49693b6a2d87e2 100644
--- a/clang/test/Driver/linux-ld.c
+++ b/clang/test/Driver/linux-ld.c
@@ -1338,7 +1338,24 @@
 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID-PTHREAD-LINK %s
 // CHECK-ANDROID-PTHREAD-LINK-NOT: argument unused during compilation: 
'-pthread'
-//
+
+/// Check -fandroid-pad-segment.
+// RUN: %clang -### %s --target=aarch64-linux-android -rtlib=platform 
--unwindlib=platform \
+// RUN:   --gcc-toolchain="" --sysroot=%S/Inputs/basic_android_tree/sysroot \
+// RUN:   -fandroid-pad-segment 2>&1 | FileCheck 
--check-prefix=CHECK-ANDROID-PAD-PHDR %s
+// CHECK-ANDROID-PAD-PHDR: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
+// CHECK-ANDROID-PAD-PHDR: "[[SYSROOT]]/usr/lib/crtbegin_dynamic.o" 
"[[SYSROOT]]/usr/lib/crt_pad_phdr.o"
+
+// RUN: %clang -### %s --target=aarch64-linux-android -rtlib=platform 
--unwindlib=platform \
+// RUN:   --gcc-toolchain="" --sysroot=%S/Inputs/basic_android_tree/sysroot \
+// RUN:   -fandroid-pad-segment -fno-android-pad-segment 2>&1 | FileCheck 
--check-prefix=CHECK-NO-ANDROID-PAD-PHDR %s
+// CHECK-NO-ANDROID-PAD-PHDR: "{{.*}}ld{{(.exe)?}}" 
"--sysroot=[[SYSROOT:[^"]+]]"
+// CHECK-NO-ANDROID-PAD-PHDR: "[[SYSROOT]]/usr/lib/crtbegin_dynamic.o"
+// CHECK-NO-ANDROID-PAD-PHDR-NOT: crt_pad_phdr.o"
+
+// RUN: not %clang -### %s --target=aarch64-linux -fandroid-pad-segment 2>&1 | 
FileCheck --check-prefix=ERR-ANDROID-PAD-EHDR %s
+// ERR-ANDROID-PAD-EHDR: error: unsupported option '-fandroid-pad-segment' for 
target 'aarch64-linux'
+
 // Check linker invocation on a Debian LoongArch sysroot.
 // RUN: %clang -### %s -no-pie 2>&1 \
 // RUN: --target=loongarch64-linux-gnu -rtlib=platform 
--unwindlib=platform \

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


[clang-tools-extra] [clang-tidy] Add bugprone-move-shared-pointer-contents check. (PR #67467)

2024-01-12 Thread via cfe-commits

https://github.com/pizzud updated 
https://github.com/llvm/llvm-project/pull/67467

>From 04a3e8d8cbd6943f44a81fddb0524902202a1a78 Mon Sep 17 00:00:00 2001
From: David Pizzuto 
Date: Tue, 26 Sep 2023 10:45:42 -0700
Subject: [PATCH 1/4] [clang-tidy] Add bugprone-move-shared-pointer-contents
 check.

This check detects moves of the contents of a shared pointer rather than the
pointer itself. Other code with a reference to the shared pointer is probably
not expecting the move.

The set of shared pointer classes is configurable via options to allow 
individual
projects to cover additional types.
---
 .../MoveSharedPointerContentsCheck.cpp| 157 ++
 .../bugprone/MoveSharedPointerContentsCheck.h |  45 +
 .../bugprone/move-shared-pointer-contents.rst |  19 +++
 .../docs/clang-tidy/checks/list.rst   |   4 +
 4 files changed, 225 insertions(+)
 create mode 100644 
clang-tools-extra/clang-tidy/bugprone/MoveSharedPointerContentsCheck.cpp
 create mode 100644 
clang-tools-extra/clang-tidy/bugprone/MoveSharedPointerContentsCheck.h
 create mode 100644 
clang-tools-extra/docs/clang-tidy/checks/bugprone/move-shared-pointer-contents.rst

diff --git 
a/clang-tools-extra/clang-tidy/bugprone/MoveSharedPointerContentsCheck.cpp 
b/clang-tools-extra/clang-tidy/bugprone/MoveSharedPointerContentsCheck.cpp
new file mode 100644
index 00..461fe91267e632
--- /dev/null
+++ b/clang-tools-extra/clang-tidy/bugprone/MoveSharedPointerContentsCheck.cpp
@@ -0,0 +1,157 @@
+//===--- MoveSharedPointerContentsCheck.cpp - clang-tidy 
--===//
+//
+// 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 "MoveSharedPointerContentsCheck.h"
+#include "../ClangTidyCheck.h"
+#include "../utils/Matchers.h"
+#include "../utils/OptionsUtils.h"
+#include "clang/AST/ASTContext.h"
+#include "clang/ASTMatchers/ASTMatchFinder.h"
+
+using namespace clang::ast_matchers;
+
+namespace clang::tidy::bugprone {
+
+MoveSharedPointerContentsCheck::MoveSharedPointerContentsCheck(
+StringRef Name, ClangTidyContext *Context)
+: ClangTidyCheck(Name, Context),
+  SharedPointerClasses(utils::options::parseStringList(
+  Options.get("SharedPointerClasses", "::std::shared_ptr"))) {}
+
+void MoveSharedPointerContentsCheck::registerMatchers(MatchFinder *Finder) {
+  auto isStdMove = callee(functionDecl(hasName("::std::move")));
+
+  // Resolved type, direct move.
+  Finder->addMatcher(
+  callExpr(isStdMove, hasArgument(0, cxxOperatorCallExpr(
+ hasOverloadedOperatorName("*"),
+ callee(cxxMethodDecl(ofClass(
+ 
matchers::matchesAnyListedName(
+ 
SharedPointerClasses)))
+  .bind("call"),
+  this);
+
+  // Resolved type, move out of get().
+  Finder->addMatcher(
+  callExpr(
+  isStdMove,
+  hasArgument(
+  0, unaryOperator(
+ hasOperatorName("*"),
+ hasUnaryOperand(cxxMemberCallExpr(callee(cxxMethodDecl(
+ hasName("get"), 
ofClass(matchers::matchesAnyListedName(
+ SharedPointerClasses)
+  .bind("get_call"),
+  this);
+
+  auto isStdMoveUnresolved = callee(unresolvedLookupExpr(
+  
hasAnyDeclaration(namedDecl(hasUnderlyingDecl(hasName("::std::move"));
+
+  // Unresolved type, direct move.
+  Finder->addMatcher(
+  callExpr(
+  isStdMoveUnresolved,
+  hasArgument(0, unaryOperator(hasOperatorName("*"),
+   hasUnaryOperand(declRefExpr(hasType(
+   
qualType().bind("unresolved_p")))
+  .bind("unresolved_call"),
+  this);
+  // Annoyingly, the declRefExpr in the unresolved-move-of-get() case
+  // is of  rather than shared_ptr, so we have to
+  // just fetch the variable. This does leave a gap where a temporary
+  // shared_ptr wouldn't be caught, but moving out of a temporary
+  // shared pointer is a truly wild thing to do so it should be okay.
+
+  // Unresolved type, move out of get().
+  Finder->addMatcher(
+  callExpr(isStdMoveUnresolved,
+   hasArgument(
+   0, unaryOperator(hasOperatorName("*"),
+hasDescendant(cxxDependentScopeMemberExpr(
+hasMemberName("get"))),
+hasDescendant(declRefExpr(to(
+
varDecl().bind("unresolved_get_p")))
+  .bind("unresolved_get_call"),
+  this);
+}
+
+bo

[clang] [llvm] [clang-tools-extra] [lldb] [lldb][test] Add tests for target.max-string-summary-length setting (PR #77920)

2024-01-12 Thread Michael Buch via cfe-commits

https://github.com/Michael137 closed 
https://github.com/llvm/llvm-project/pull/77920
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [clang-tools-extra] [lldb] [lldb][test] Add tests for target.max-string-summary-length setting (PR #77920)

2024-01-12 Thread Adrian Prantl via cfe-commits

https://github.com/adrian-prantl approved this pull request.


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


[clang] [AMDGPU] add function attrbute amdgpu-lib-fun (PR #74737)

2024-01-12 Thread Yaxun Liu via cfe-commits

https://github.com/yxsamliu updated 
https://github.com/llvm/llvm-project/pull/74737

>From 4264e7e9c7f655f134623d113ba9dccc5564f4c3 Mon Sep 17 00:00:00 2001
From: "Yaxun (Sam) Liu" 
Date: Thu, 7 Dec 2023 11:45:14 -0500
Subject: [PATCH] [AMDGPU] add function attrbute amdgpu-lib-fun

Add a function attribute "amdgpu-lib-fun" to indicate that the
function needs special handling in backend. Basically it will
not be internalized so that it will not be removed by DCE
after internalization. This is to keep the library functions
that are not called by users' code but will be called by
instructions generated by LLVM passes or instruction selection,
e.g. sanitizers or lowering of 128 bit integer divisioin.
---
 clang/include/clang/Basic/Attr.td |  8 ++
 clang/include/clang/Basic/AttrDocs.td | 11 +++
 clang/lib/CodeGen/Targets/AMDGPU.cpp  |  2 +
 clang/test/CodeGenCUDA/amdgpu-func-attrs.cu   |  8 ++
 clang/test/CodeGenOpenCL/amdgpu-attrs.cl  | 89 ++-
 ...a-attribute-supported-attributes-list.test |  1 +
 6 files changed, 78 insertions(+), 41 deletions(-)

diff --git a/clang/include/clang/Basic/Attr.td 
b/clang/include/clang/Basic/Attr.td
index a03b0e44e15f7d..b2b7ac88bf5943 100644
--- a/clang/include/clang/Basic/Attr.td
+++ b/clang/include/clang/Basic/Attr.td
@@ -446,6 +446,7 @@ def TargetX86 : TargetArch<["x86"]>;
 def TargetAnyX86 : TargetArch<["x86", "x86_64"]>;
 def TargetWebAssembly : TargetArch<["wasm32", "wasm64"]>;
 def TargetNVPTX : TargetArch<["nvptx", "nvptx64"]>;
+def TargetAMDGPU : TargetArch<["r600", "amdgcn"]>;
 def TargetWindows : TargetSpec {
   let OSes = ["Win32"];
 }
@@ -2028,6 +2029,13 @@ def AMDGPUNumVGPR : InheritableAttr {
   let Subjects = SubjectList<[Function], ErrorDiag, "kernel functions">;
 }
 
+def AMDGPULibFun : InheritableAttr, TargetSpecificAttr{
+  let Spellings = [Clang<"amdgpu_lib_fun">];
+  let Documentation = [AMDGPULibFunDocs];
+  let Subjects = SubjectList<[Function]>;
+  let SimpleHandler = 1;
+}
+
 def AMDGPUKernelCall : DeclOrTypeAttr {
   let Spellings = [Clang<"amdgpu_kernel">];
   let Documentation = [Undocumented];
diff --git a/clang/include/clang/Basic/AttrDocs.td 
b/clang/include/clang/Basic/AttrDocs.td
index 2e8d7752c9751e..063a15d578b178 100644
--- a/clang/include/clang/Basic/AttrDocs.td
+++ b/clang/include/clang/Basic/AttrDocs.td
@@ -2702,6 +2702,17 @@ An error will be given if:
   }];
 }
 
+def AMDGPULibFunDocs : Documentation {
+  let Category = DocCatAMDGPUAttributes;
+  let Content = [{
+The ``amdgpu_lib_fun`` attribute can be applied to a function while targeting
+AMDGPU to indicate that it will be handled specially by the backend.
+A library function will not be optimized out by standard LLVM passes and can 
be 
+used to resolve function calls generated by the backend. These functions will
+not be emitted by the backend if they are not used.
+  }];
+}
+
 def DocCatCallingConvs : DocumentationCategory<"Calling Conventions"> {
   let Content = [{
 Clang supports several different calling conventions, depending on the target
diff --git a/clang/lib/CodeGen/Targets/AMDGPU.cpp 
b/clang/lib/CodeGen/Targets/AMDGPU.cpp
index 03ac6b78598fc8..08b763c1e7576c 100644
--- a/clang/lib/CodeGen/Targets/AMDGPU.cpp
+++ b/clang/lib/CodeGen/Targets/AMDGPU.cpp
@@ -356,6 +356,8 @@ void AMDGPUTargetCodeGenInfo::setFunctionDeclAttributes(
 if (NumVGPR != 0)
   F->addFnAttr("amdgpu-num-vgpr", llvm::utostr(NumVGPR));
   }
+  if (FD->getAttr())
+F->addFnAttr("amdgpu-lib-fun");
 }
 
 /// Emits control constants used to change per-architecture behaviour in the
diff --git a/clang/test/CodeGenCUDA/amdgpu-func-attrs.cu 
b/clang/test/CodeGenCUDA/amdgpu-func-attrs.cu
index 89add87919c12d..e319cd4809e0dd 100644
--- a/clang/test/CodeGenCUDA/amdgpu-func-attrs.cu
+++ b/clang/test/CodeGenCUDA/amdgpu-func-attrs.cu
@@ -8,6 +8,9 @@
 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm \
 // RUN: -o - -x hip %s -munsafe-fp-atomics \
 // RUN: | FileCheck -check-prefix=NO-UNSAFE-FP-ATOMICS %s
+// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa \
+// RUN: -fcuda-is-device -emit-llvm -o - -x hip %s \
+// RUN: | FileCheck %s
 
 #include "Inputs/cuda.h"
 
@@ -15,8 +18,13 @@ __device__ void test() {
 // UNSAFE-FP-ATOMICS: define{{.*}} void @_Z4testv() [[ATTR:#[0-9]+]]
 }
 
+__attribute__((amdgpu_lib_fun)) __device__ void lib_fun() {
+// CHECK: define{{.*}} void @_Z7lib_funv() [[LIB_FUN:#[0-9]+]]
+}
+
 
 // Make sure this is silently accepted on other targets.
 // NO-UNSAFE-FP-ATOMICS-NOT: "amdgpu-unsafe-fp-atomics"
 
 // UNSAFE-FP-ATOMICS-DAG: attributes [[ATTR]] = 
{{.*}}"amdgpu-unsafe-fp-atomics"="true"
+// CHECK-DAG: attributes [[LIB_FUN]] = {{.*}}"amdgpu-lib-fun"
diff --git a/clang/test/CodeGenOpenCL/amdgpu-attrs.cl 
b/clang/test/CodeGenOpenCL/amdgpu-attrs.cl
index b0dfc97b53b2c5..201d867b55047b 100644
--- a/clang/test/CodeGenOpenCL/amdgpu-attrs.cl
+++ b/clang/test/CodeGenOpenCL/amdgpu-attrs.cl
@@ -1,105 +1,107 @@
-// RUN: %c

[clang] [clang][NFC] Refactor `clang/test/SemaCXX/type-traits.cpp` to use modern `static_assert` (PR #77584)

2024-01-12 Thread Amirreza Ashouri via cfe-commits


@@ -214,56 +212,56 @@ struct HasVirtBase : virtual ACompleteType {};
 
 void is_pod()
 {
-  { int arr[T(__is_pod(int))]; }
-  { int arr[T(__is_pod(Enum))]; }
-  { int arr[T(__is_pod(POD))]; }
-  { int arr[T(__is_pod(Int))]; }
-  { int arr[T(__is_pod(IntAr))]; }
-  { int arr[T(__is_pod(Statics))]; }
-  { int arr[T(__is_pod(Empty))]; }
-  { int arr[T(__is_pod(EmptyUnion))]; }
-  { int arr[T(__is_pod(Union))]; }
-  { int arr[T(__is_pod(HasFunc))]; }
-  { int arr[T(__is_pod(HasOp))]; }
-  { int arr[T(__is_pod(HasConv))]; }
-  { int arr[T(__is_pod(HasAssign))]; }
-  { int arr[T(__is_pod(IntArNB))]; }
-  { int arr[T(__is_pod(HasAnonymousUnion))]; }
-  { int arr[T(__is_pod(Vector))]; }
-  { int arr[T(__is_pod(VectorExt))]; }
-  { int arr[T(__is_pod(Derives))]; }
-  { int arr[T(__is_pod(DerivesAr))]; }
-  { int arr[T(__is_pod(DerivesArNB))]; }
-  { int arr[T(__is_pod(DerivesEmpty))]; }
-  { int arr[T(__is_pod(HasPriv))]; }
-  { int arr[T(__is_pod(HasProt))]; }
-  { int arr[T(__is_pod(DerivesHasPriv))]; }
-  { int arr[T(__is_pod(DerivesHasProt))]; }
-
-  { int arr[F(__is_pod(HasCons))]; }
-  { int arr[F(__is_pod(HasCopyAssign))]; }
-  { int arr[F(__is_pod(HasMoveAssign))]; }
-  { int arr[F(__is_pod(HasDest))]; }
-  { int arr[F(__is_pod(HasRef))]; }
-  { int arr[F(__is_pod(HasVirt))]; }
-  { int arr[F(__is_pod(DerivesHasCons))]; }
-  { int arr[F(__is_pod(DerivesHasCopyAssign))]; }
-  { int arr[F(__is_pod(DerivesHasMoveAssign))]; }
-  { int arr[F(__is_pod(DerivesHasDest))]; }
-  { int arr[F(__is_pod(DerivesHasRef))]; }
-  { int arr[F(__is_pod(DerivesHasVirt))]; }
-  { int arr[F(__is_pod(NonPOD))]; }
-  { int arr[F(__is_pod(HasNonPOD))]; }
-  { int arr[F(__is_pod(NonPODAr))]; }
-  { int arr[F(__is_pod(NonPODArNB))]; }
-  { int arr[F(__is_pod(void))]; }
-  { int arr[F(__is_pod(cvoid))]; }
-// { int arr[F(__is_pod(NonPODUnion))]; }
-
-  { int arr[T(__is_pod(ACompleteType))]; }
-  { int arr[F(__is_pod(AnIncompleteType))]; } // expected-error {{incomplete 
type}}
-  { int arr[F(__is_pod(AnIncompleteType[]))]; } // expected-error {{incomplete 
type}}
-  { int arr[F(__is_pod(AnIncompleteType[1]))]; } // expected-error 
{{incomplete type}}
+  static_assert(__is_pod(int), "");

AMP999 wrote:

Should we also remove the non-empty messages in the 
`__has_unique_object_representations` section? They seem mostly 
self-explanatory to me, and none of the other traits use non-empty messages. 
Like changing
`static_assert(!__has_unique_object_representations(PaddedBitfield), "Bitfield 
padding");` to 
`static_assert(!__has_unique_object_representations(PaddedBitfield));`

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


[clang] [clang][NFC] Refactor `clang/test/SemaCXX/type-traits.cpp` to use modern `static_assert` (PR #77584)

2024-01-12 Thread Amirreza Ashouri via cfe-commits


@@ -2875,10 +2875,10 @@ struct __attribute__((packed)) PackedNoPadding2 {
   int j;
   short i;
 };
-static_assert(has_unique_object_representations::value, 
"Packed structs have no padding");
-static_assert(has_unique_object_representations::value, 
"Packed structs have no padding");
+static_assert(__has_unique_object_representations(PackedNoPadding1), "Packed 
structs have no padding");
+static_assert(__has_unique_object_representations(PackedNoPadding2), "Packed 
structs have no padding");
 
-static_assert(!has_unique_object_representations::value, "Functions 
are not unique");
+static_assert(!__has_unique_object_representations(int(int)), "Functions are 
not unique");
 static_assert(!has_unique_object_representations::value, 
"Functions are not unique");

AMP999 wrote:

We'd like to eliminate this usage too, but the parser doesn't support it yet.
The issue is explained here: https://github.com/llvm/llvm-project/issues/77585

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


[llvm] [clang-tools-extra] [clang] [clang] Add test for CWG472 (PR #67948)

2024-01-12 Thread Vlad Serebrennikov via cfe-commits


@@ -2871,7 +2871,7 @@ C++ defect report implementation 
status
 https://cplusplus.github.io/CWG/issues/472.html";>472
 drafting
 Casting across protected inheritance
-Not resolved
+No

Endilll wrote:

Current state of things is my fault (I was the one who introduced `no open`, 
`no drafting`, and `no review` statuses). I've been pondering on a different 
idea recently: `No*`, and a pop-up saying something along the lines of 
`Tentative; issue hasn't been resolved yet`. Like cppreference does in their 
compiler support table. Seems less heavy for such a big table, but still 
provides details for those who are interested.

Another idea is for `No` to be a link to an issue on bug tracker instead of a 
pop-up.

It also worth mentioning that `make_cxx_dr_status` is strict with those 
unresolved statuses, and it yells every time status in a test doesn't match 
status in `cwg_index.html`.

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


[llvm] [clang] [CMake][PGO] Build Sema.cpp to generate profdata for PGO builds (PR #77347)

2024-01-12 Thread Chris B via cfe-commits


@@ -26,9 +30,23 @@ if(LLVM_BUILD_INSTRUMENTED)
 message(STATUS "To enable merging PGO data LLVM_PROFDATA has to point to 
llvm-profdata")
   else()
 add_custom_target(generate-profdata
-  COMMAND "${Python3_EXECUTABLE}" 
${CMAKE_CURRENT_SOURCE_DIR}/perf-helper.py merge ${LLVM_PROFDATA} 
${CMAKE_CURRENT_BINARY_DIR}/clang.profdata ${CMAKE_CURRENT_BINARY_DIR}
+  COMMAND "${Python3_EXECUTABLE}" 
${CMAKE_CURRENT_SOURCE_DIR}/perf-helper.py merge ${LLVM_PROFDATA} 
${CMAKE_CURRENT_BINARY_DIR}/clang.profdata ${CMAKE_CURRENT_BINARY_DIR} 
${CMAKE_BINARY_DIR}/profiles/
   COMMENT "Merging profdata"
   DEPENDS generate-profraw)
+if (CLANG_PGO_TRAINING_DATA_SOURCE_DIR)
+  llvm_ExternalProject_Add(generate-profraw-external 
${CLANG_PGO_TRAINING_DATA_SOURCE_DIR}
+  USE_TOOLCHAIN EXLUDE_FROM_ALL NO_INSTALL DEPENDS 
generate-profraw)
+  add_dependencies(generate-profdata generate-profraw-external)
+else()
+  # Default to compiling a file from clang. This also builds all the
+  # dependencies needed to build this file, like TableGen.
+  set(generate_profraw_clang_sema 
tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/Sema.cpp.o)
+  llvm_ExternalProject_Add(generate-profraw-clang 
${CMAKE_CURRENT_SOURCE_DIR}/../../../llvm
+  USE_TOOLCHAIN EXLUDE_FROM_ALL NO_INSTALL DEPENDS generate-profraw
+  EXTRA_TARGETS generate_profraw_clang_sema

llvm-beanz wrote:

IMO, the PGO use case is already an advanced-user feature. It's even documented 
in the "Advanced Builds" documentation.

If we want some more complex C++ sources there are some samples we could look 
at, like Kaleidoscope. The Kaleidoscope chapter 2 source builds without 
dependencies, and the other ones are also pretty simple to just compile.

If you're not concerned about the efficacy of the PGO build, I'm not sure why 
the existing single hello_world is a bad default. It isn't great but it is 
stable and something. If you want something that gives better performance then 
you must care about the efficacy, and I think you need to be somewhat concerned 
about the stability of those results, otherwise what's the point?

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


[clang-tools-extra] [llvm] [clang] [clang] Add test for CWG472 (PR #67948)

2024-01-12 Thread Richard Smith via cfe-commits


@@ -2871,7 +2871,7 @@ C++ defect report implementation 
status
 https://cplusplus.github.io/CWG/issues/472.html";>472
 drafting
 Casting across protected inheritance
-Not resolved
+No

zygoloid wrote:

For `"no drafting" status, can we say something different here? I think 
something like "Not resolved, probably no" would be better, given that we don't 
actually know what the resolution will be, and if it ends up resolved NAD then 
we actually do implement it correctly :-)

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


[clang-tools-extra] [llvm] [clang] [clang] Add test for CWG472 (PR #67948)

2024-01-12 Thread Richard Smith via cfe-commits

zygoloid wrote:

> None of the implementations seem to agree with the resolution of the DR: 
> https://godbolt.org/z/a7nEvW5Gr

Yeah, I think this is a case where the wording is clear and everyone implements 
it, but it doesn't actually do the right thing. The example in the issue "ought 
to be" ill-formed, because as the issue points out, there's no reason to think 
that the N object is actually a base subobject of P, so access to its protected 
base B shouldn't be granted to a P object.

I think a rule even more similar to [class.protected] should be implemented: if 
we rely on a conversion from a class `N` to a class `B`, if `N` is a protected 
base class of `B` (if a public member of `B` would be a protected member of 
`N`), then additionally require that `N` is either `C` or a class derived from 
`C` (where `C` is the class granting access, as in [class.protected]).

I'd suggest we implement that as a warning, given that the standard is clear 
and other implementers accept.

In any case, this new testcase looks good to me, and would be good to add 
regardless of what CWG ends up deciding here (if they ever make a decision...).

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


[clang] 060505a - [OpenACC] Remove mistakenly left TODO and fix format issue

2024-01-12 Thread via cfe-commits

Author: erichkeane
Date: 2024-01-12T13:55:15-08:00
New Revision: 060505aa0d49f31e6f2fd4e137c76d86f571f66b

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

LOG: [OpenACC] Remove mistakenly left TODO and fix format issue

Added: 


Modified: 
clang/lib/Parse/ParseOpenACC.cpp

Removed: 




diff  --git a/clang/lib/Parse/ParseOpenACC.cpp 
b/clang/lib/Parse/ParseOpenACC.cpp
index 83378a094492b2..05087a6565a11c 100644
--- a/clang/lib/Parse/ParseOpenACC.cpp
+++ b/clang/lib/Parse/ParseOpenACC.cpp
@@ -87,10 +87,9 @@ OpenACCClauseKind getOpenACCClauseKind(Token Tok) {
   if (!Tok.is(tok::identifier))
 return OpenACCClauseKind::Invalid;
 
-  // TODO: ERICH: add new clauses here.
   return llvm::StringSwitch(
  Tok.getIdentifierInfo()->getName())
-.Case("attach",OpenACCClauseKind::Attach)
+  .Case("attach", OpenACCClauseKind::Attach)
   .Case("auto", OpenACCClauseKind::Auto)
   .Case("copy", OpenACCClauseKind::Copy)
   .Case("default", OpenACCClauseKind::Default)



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


[clang] [clang-format] Add SpacesInParensOption for attributes and filtering for repeated parens (PR #77522)

2024-01-12 Thread Gedare Bloom via cfe-commits

https://github.com/gedare updated 
https://github.com/llvm/llvm-project/pull/77522

>From 5e5bec9fba56f34c7dd28ca866eef145035a Mon Sep 17 00:00:00 2001
From: Gedare Bloom 
Date: Mon, 17 Jul 2023 18:24:30 -0600
Subject: [PATCH 01/15] Add SpaceInParensOption for __attribute__ keyword

The __attribute((specifier-list)) currently is formatted based on the
SpacesInParensOptions.Other (previously, SpacesInParentheses). This change
allows finer control over addition of spaces between the consecutive parens,
and between the inner parens and the list of attribute specifiers.

Differential Revision: https://reviews.llvm.org/D155529
---
 clang/docs/ClangFormatStyleOptions.rst |  7 +++
 clang/docs/ReleaseNotes.rst|  2 ++
 clang/include/clang/Format/Format.h| 19 ++-
 clang/lib/Format/Format.cpp|  2 ++
 clang/lib/Format/TokenAnnotator.cpp| 16 
 clang/unittests/Format/ConfigParseTest.cpp | 13 +
 clang/unittests/Format/FormatTest.cpp  |  7 +++
 7 files changed, 53 insertions(+), 13 deletions(-)

diff --git a/clang/docs/ClangFormatStyleOptions.rst 
b/clang/docs/ClangFormatStyleOptions.rst
index ac9a0b70ed5daa..5dc7ad5298f83b 100644
--- a/clang/docs/ClangFormatStyleOptions.rst
+++ b/clang/docs/ClangFormatStyleOptions.rst
@@ -5693,6 +5693,13 @@ the configuration (without a prefix: ``Auto``).
   InConditionalStatements: true
   Other: true
 
+  * ``bool InAttributeSpecifiers`` Put a space in parentheses of attribute 
specifiers.
+
+.. code-block:: c++
+
+   true:  false:
+   __attribute__( ( noreturn ) )vs. __attribute__((noreturn))
+
   * ``bool InConditionalStatements`` Put a space in parentheses only inside 
conditional statements
 (``for/if/while/switch...``).
 
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 59732962caac65..f4e29df336b3a6 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -1102,6 +1102,8 @@ clang-format
   attributes (like ``nonatomic, strong, nullable``).
 - Add ``.clang-format-ignore`` files.
 - Add ``AlignFunctionPointers`` sub-option for 
``AlignConsecutiveDeclarations``.
+- Add ``InAttributeSpecifiers`` style option to ``SpacesInParensOptions``
+  to control addition of spaces after the ``__attribute__`` keyword.
 
 libclang
 
diff --git a/clang/include/clang/Format/Format.h 
b/clang/include/clang/Format/Format.h
index 5ffd63ee73fc36..95f15a3098044c 100644
--- a/clang/include/clang/Format/Format.h
+++ b/clang/include/clang/Format/Format.h
@@ -4534,6 +4534,12 @@ struct FormatStyle {
   /// Other: true
   /// \endcode
   struct SpacesInParensCustom {
+/// Put a space in parentheses of attribute specifiers.
+/// \code
+///true:  false:
+///__attribute__( ( noreturn ) )vs. __attribute__((noreturn))
+/// \endcode
+bool InAttributeSpecifiers;
 /// Put a space in parentheses only inside conditional statements
 /// (``for/if/while/switch...``).
 /// \code
@@ -4567,17 +4573,20 @@ struct FormatStyle {
 bool Other;
 
 SpacesInParensCustom()
-: InConditionalStatements(false), InCStyleCasts(false),
-  InEmptyParentheses(false), Other(false) {}
+: InAttributeSpecifiers(false), InConditionalStatements(false),
+  InCStyleCasts(false), InEmptyParentheses(false), Other(false) {}
 
-SpacesInParensCustom(bool InConditionalStatements, bool InCStyleCasts,
+SpacesInParensCustom(bool InAttributeSpecifiers,
+ bool InConditionalStatements, bool InCStyleCasts,
  bool InEmptyParentheses, bool Other)
-: InConditionalStatements(InConditionalStatements),
+: InAttributeSpecifiers(InAttributeSpecifiers),
+  InConditionalStatements(InConditionalStatements),
   InCStyleCasts(InCStyleCasts), InEmptyParentheses(InEmptyParentheses),
   Other(Other) {}
 
 bool operator==(const SpacesInParensCustom &R) const {
-  return InConditionalStatements == R.InConditionalStatements &&
+  return InAttributeSpecifiers == R.InAttributeSpecifiers &&
+ InConditionalStatements == R.InConditionalStatements &&
  InCStyleCasts == R.InCStyleCasts &&
  InEmptyParentheses == R.InEmptyParentheses && Other == R.Other;
 }
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index ff5ed6c306f383..af4db7161be20b 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -752,6 +752,7 @@ template <> struct 
MappingTraits {
 
 template <> struct MappingTraits {
   static void mapping(IO &IO, FormatStyle::SpacesInParensCustom &Spaces) {
+IO.mapOptional("InAttributeSpecifiers", Spaces.InAttributeSpecifiers);
 IO.mapOptional("InCStyleCasts", Spaces.InCStyleCasts);
 IO.mapOptional("InConditionalStatements", Spaces.I

[llvm] [clang] [TargetParser] Define AEK_FCMA and AEK_JSCVT for tsv110 (PR #75516)

2024-01-12 Thread Qi Hu via cfe-commits

https://github.com/Qi-Hu updated https://github.com/llvm/llvm-project/pull/75516

>From 136471458682f393b15ed2807342a03309ed0b56 Mon Sep 17 00:00:00 2001
From: Qi Hu 
Date: Thu, 14 Dec 2023 13:35:52 -0500
Subject: [PATCH] [TargetParser] Define AEK_FCMA and AEK_JSCVT for tsv110

We define AEK_JSCVT and AEK_FCMA for CPU features FEAT_JSCVT and FEAT_FCMA
respectively, and add them to the CpuInfo of tsv110.
---
 clang/test/CodeGen/aarch64-targetattr.c   |  12 +-
 .../Preprocessor/aarch64-target-features.c|  10 +-
 .../llvm/TargetParser/AArch64TargetParser.h   |  11 +-
 llvm/lib/Target/AArch64/AArch64.td|   3 +-
 .../TargetParser/TargetParserTest.cpp | 106 ++
 5 files changed, 82 insertions(+), 60 deletions(-)

diff --git a/clang/test/CodeGen/aarch64-targetattr.c 
b/clang/test/CodeGen/aarch64-targetattr.c
index 5f557532a4b4a7..02da18264da0a3 100644
--- a/clang/test/CodeGen/aarch64-targetattr.c
+++ b/clang/test/CodeGen/aarch64-targetattr.c
@@ -97,19 +97,19 @@ void minusarch() {}
 // CHECK: attributes #0 = { {{.*}} 
"target-features"="+crc,+fp-armv8,+lse,+neon,+ras,+rdm,+v8.1a,+v8.2a,+v8a" }
 // CHECK: attributes #1 = { {{.*}} 
"target-features"="+crc,+fp-armv8,+fullfp16,+lse,+neon,+ras,+rdm,+sve,+v8.1a,+v8.2a,+v8a"
 }
 // CHECK: attributes #2 = { {{.*}} 
"target-features"="+crc,+fp-armv8,+fullfp16,+lse,+neon,+ras,+rdm,+sve,+sve2,+v8.1a,+v8.2a,+v8a"
 }
-// CHECK: attributes #3 = { {{.*}} 
"target-features"="+bf16,+crc,+dotprod,+fp-armv8,+fullfp16,+i8mm,+lse,+neon,+ras,+rcpc,+rdm,+sve,+sve2,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8.5a,+v8.6a,+v8a"
 }
-// CHECK: attributes #4 = { {{.*}} "target-cpu"="cortex-a710" 
"target-features"="+bf16,+crc,+dotprod,+flagm,+fp-armv8,+fp16fml,+fullfp16,+i8mm,+lse,+mte,+neon,+pauth,+ras,+rcpc,+rdm,+sb,+sve,+sve2,+sve2-bitperm"
 }
+// CHECK: attributes #3 = { {{.*}} 
"target-features"="+bf16,+complxnum,+crc,+dotprod,+fp-armv8,+fullfp16,+i8mm,+jsconv,+lse,+neon,+ras,+rcpc,+rdm,+sve,+sve2,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8.5a,+v8.6a,+v8a"
 }
+// CHECK: attributes #4 = { {{.*}} "target-cpu"="cortex-a710" 
"target-features"="+bf16,+complxnum,+crc,+dotprod,+flagm,+fp-armv8,+fp16fml,+fullfp16,+i8mm,+jsconv,+lse,+mte,+neon,+pauth,+ras,+rcpc,+rdm,+sb,+sve,+sve2,+sve2-bitperm"
 }
 // CHECK: attributes #5 = { {{.*}} "tune-cpu"="cortex-a710" }
 // CHECK: attributes #6 = { {{.*}} "target-cpu"="generic" }
 // CHECK: attributes #7 = { {{.*}} "tune-cpu"="generic" }
 // CHECK: attributes #8 = { {{.*}} "target-cpu"="neoverse-n1" 
"target-features"="+aes,+crc,+dotprod,+fp-armv8,+fullfp16,+lse,+neon,+ras,+rcpc,+rdm,+sha2,+spe,+ssbs"
 "tune-cpu"="cortex-a710" }
 // CHECK: attributes #9 = { {{.*}} 
"target-features"="+fp-armv8,+fullfp16,+neon,+sve" "tune-cpu"="cortex-a710" }
-// CHECK: attributes #10 = { {{.*}} "target-cpu"="neoverse-v1" 
"target-features"="+aes,+bf16,+crc,+dotprod,+fp-armv8,+fp16fml,+fullfp16,+i8mm,+lse,+neon,+rand,+ras,+rcpc,+rdm,+sha2,+sha3,+sm4,+spe,+ssbs,+sve,+sve2"
 }
-// CHECK: attributes #11 = { {{.*}} "target-cpu"="neoverse-v1" 
"target-features"="+aes,+bf16,+crc,+dotprod,+fp-armv8,+fp16fml,+fullfp16,+i8mm,+lse,+neon,+rand,+ras,+rcpc,+rdm,+sha2,+sha3,+sm4,+spe,+ssbs,-sve"
 }
+// CHECK: attributes #10 = { {{.*}} "target-cpu"="neoverse-v1" 
"target-features"="+aes,+bf16,+complxnum,+crc,+dotprod,+fp-armv8,+fp16fml,+fullfp16,+i8mm,+jsconv,+lse,+neon,+rand,+ras,+rcpc,+rdm,+sha2,+sha3,+sm4,+spe,+ssbs,+sve,+sve2"
 }
+// CHECK: attributes #11 = { {{.*}} "target-cpu"="neoverse-v1" 
"target-features"="+aes,+bf16,+complxnum,+crc,+dotprod,+fp-armv8,+fp16fml,+fullfp16,+i8mm,+jsconv,+lse,+neon,+rand,+ras,+rcpc,+rdm,+sha2,+sha3,+sm4,+spe,+ssbs,-sve"
 }
 // CHECK: attributes #12 = { {{.*}} 
"target-features"="+fp-armv8,+fullfp16,+neon,+sve" }
 // CHECK: attributes #13 = { {{.*}} 
"target-features"="+fp-armv8,+fullfp16,+neon,+sve,-sve2" }
 // CHECK: attributes #14 = { {{.*}} "target-features"="+fullfp16" }
-// CHECK: attributes #15 = { {{.*}} "target-cpu"="neoverse-n1" 
"target-features"="+aes,+bf16,+crc,+dotprod,+fp-armv8,+fullfp16,+i8mm,+lse,+neon,+ras,+rcpc,+rdm,+sha2,+spe,+ssbs,+sve,+sve2,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8.5a,+v8.6a,+v8a"
 "tune-cpu"="cortex-a710" }
-// CHECK: attributes #16 = { {{.*}} "branch-target-enforcement"="true" 
"guarded-control-stack"="true" {{.*}} 
"target-features"="+aes,+bf16,+crc,+dotprod,+fp-armv8,+fullfp16,+i8mm,+lse,+neon,+ras,+rcpc,+rdm,+sha2,+spe,+ssbs,+sve,+sve2,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8.5a,+v8.6a,+v8a"
 "tune-cpu"="cortex-a710" }
+// CHECK: attributes #15 = { {{.*}} "target-cpu"="neoverse-n1" 
"target-features"="+aes,+bf16,+complxnum,+crc,+dotprod,+fp-armv8,+fullfp16,+i8mm,+jsconv,+lse,+neon,+ras,+rcpc,+rdm,+sha2,+spe,+ssbs,+sve,+sve2,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8.5a,+v8.6a,+v8a"
 "tune-cpu"="cortex-a710" }
+// CHECK: attributes #16 = { {{.*}} "branch-target-enforcement"="true" 
"guarded-control-stack"="true" {{.*}} 
"target-features"="+aes,+bf16,+complxnum,+crc,+dotprod,+fp-armv8,+fullfp16,+i8mm,+jsconv,+lse,+neon,

[clang] [llvm] [TargetParser] Define AEK_FCMA and AEK_JSCVT for tsv110 (PR #75516)

2024-01-12 Thread Bryan Chan via cfe-commits

bryanpkc wrote:

@davemgreen @ilinpv @DavidSpickett @hassnaaHamdi Gentle ping.

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


[clang] [llvm] [LLVM][DWARF] Fix accelerator table switching between CU and TU (PR #77511)

2024-01-12 Thread Alexander Yermolovich via cfe-commits

ayermolo wrote:

> However, the patch broke the [Solaris/sparcv9 
> buildbot](https://lab.llvm.org/buildbot/#/builders/72/builds/1834):
> 
> ```
> llc: error: unable to get target for 'x86_64-unknown-linux-gnu', see 
> --version and --triple.
> ```
> 
> The bot is configured to do a Sparc-only build.

oh. I think 
; REQUIRES: x86-registered-target is missing. Let me add it

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


[clang] [clang-tools-extra] [flang] [llvm] [flang] Add EXECUTE_COMMAND_LINE runtime and lowering intrinsics implementation (PR #74077)

2024-01-12 Thread Pete Steinfeld via cfe-commits

psteinfeld wrote:

See issue #77979.

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


[llvm] [libcxx] [openmp] [mlir] [lld] [clang] [libc++] Deprecate the _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS macro (PR #77692)

2024-01-12 Thread James Y Knight via cfe-commits

jyknight wrote:

Ah, I see that now. SGTM, thanks for the clarification!

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


[llvm] [clang] [flang] [clang-tools-extra] [flang] Add EXECUTE_COMMAND_LINE runtime and lowering intrinsics implementation (PR #74077)

2024-01-12 Thread Pete Steinfeld via cfe-commits

psteinfeld wrote:

See issue #77984

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


[clang] [llvm] [LLVM][DWARF] Fix accelerator table switching between CU and TU (PR #77511)

2024-01-12 Thread Rainer Orth via cfe-commits

rorth wrote:

However, the patch broke the [Solaris/sparcv9 
buildbot](https://lab.llvm.org/buildbot/#/builders/72/builds/1834):
```
llc: error: unable to get target for 'x86_64-unknown-linux-gnu', see --version 
and --triple.
```
The bot is configured to do a Sparc-only build.

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


[clang] [AMDGPU] add function attrbute amdgpu-lib-fun (PR #74737)

2024-01-12 Thread Yaxun Liu via cfe-commits


@@ -2693,6 +2693,17 @@ An error will be given if:
   }];
 }
 
+def AMDGPULibFunDocs : Documentation {
+  let Category = DocCatAMDGPUAttributes;
+  let Content = [{
+The ``amdgpu_lib_fun`` attribute can be applied to a function for AMDGPU target
+to indicate it is a library function which are handled specially in backend.
+An AMDGPU library function is not internalized and can be used to fullfill
+calls generated by LLVM passes or instruction selection. Unused AMDGPU library
+functions will be eliminated by the backend.

yxsamliu wrote:

will do

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


[clang] [AMDGPU] add function attrbute amdgpu-lib-fun (PR #74737)

2024-01-12 Thread Yaxun Liu via cfe-commits


@@ -2011,6 +2011,13 @@ def AMDGPUNumVGPR : InheritableAttr {
   let Subjects = SubjectList<[Function], ErrorDiag, "kernel functions">;
 }
 
+def AMDGPULibFun : InheritableAttr {

yxsamliu wrote:

will do

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


[clang] [AMDGPU] add function attrbute amdgpu-lib-fun (PR #74737)

2024-01-12 Thread Yaxun Liu via cfe-commits

yxsamliu wrote:

> > > > An AMDGPU library function is not internalized and can be used to 
> > > > fullfill calls generated by LLVM passes or instruction selection.
> > > 
> > > 
> > > I am confused by the description of "internalized". Do you refer to LTO 
> > > internalization? You can leverage `llvm.used` to disable LTO 
> > > internalization.
> > 
> > 
> > Yes I mean LTO internalization. We want keep them to the backend but we 
> > also want to remove them if they are not used by the backend. `llvm.used` 
> > won't tell us that we can remove them since it could be specified by the 
> > users for non-amdgpu-library functions.
> 
> I wonder if we could just define another `llvm.used` similar to 
> `llvm.compiler.used` for this special case where the variable can be thrown 
> away by the backend.

we need this attribute because AMDGPU target does not support ISA level 
linking, otherwise we could just link with a library after LLVM codegen. I 
doubt this attribute is generic enough to introduce something like llvm.used. 
Also, we do not need to prevent linker from discarding the symbol, therefore it 
is unnecessary to put them in some global variables. A simple function 
attribute is suffice.

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


[lldb] [clang-tools-extra] [flang] [openmp] [libcxx] [clang] [libc] [llvm] [mlir] [BOLT] Embed cold mapping info into function entry in BAT (PR #76903)

2024-01-12 Thread Amir Ayupov via cfe-commits

https://github.com/aaupov closed https://github.com/llvm/llvm-project/pull/76903
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[lldb] [clang-tools-extra] [flang] [openmp] [libcxx] [clang] [libc] [llvm] [mlir] [BOLT] Embed cold mapping info into function entry in BAT (PR #76903)

2024-01-12 Thread Amir Ayupov via cfe-commits

https://github.com/aaupov edited https://github.com/llvm/llvm-project/pull/76903
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxxabi] [clang-tools-extra] [flang] [lldb] [libcxx] [clang] [libclc] [libunwind] [libc] [llvm] [compiler-rt] [lld] [builtins] Generate __multc3 for z/OS (PR #77554)

2024-01-12 Thread Sean Perry via cfe-commits


@@ -374,10 +376,10 @@ static __inline fp_t __compiler_rt_fmax(fp_t x, fp_t y) {
 #endif
 }
 
-#elif defined(QUAD_PRECISION) && defined(CRT_HAS_TF_MODE)
+#elif defined(QUAD_PRECISION)

perry-ca wrote:

I've put up #77981 for review.

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


[clang] [clang][CodeGen] Emit atomic IR in place of optimized libcalls. (PR #73176)

2024-01-12 Thread via cfe-commits


@@ -1047,122 +1019,19 @@ RValue CodeGenFunction::EmitAtomicExpr(AtomicExpr *E) {
   Dest = Atomics.castToAtomicIntPointer(Dest);
   }
 
-  // Use a library call.  See: http://gcc.gnu.org/wiki/Atomic/GCCMM/LIbrary .
-  if (UseLibcall) {
-bool UseOptimizedLibcall = false;
-switch (E->getOp()) {
-case AtomicExpr::AO__c11_atomic_init:
-case AtomicExpr::AO__opencl_atomic_init:
-  llvm_unreachable("Already handled above with EmitAtomicInit!");
-
-case AtomicExpr::AO__atomic_fetch_add:
-case AtomicExpr::AO__atomic_fetch_and:
-case AtomicExpr::AO__atomic_fetch_max:
-case AtomicExpr::AO__atomic_fetch_min:
-case AtomicExpr::AO__atomic_fetch_nand:
-case AtomicExpr::AO__atomic_fetch_or:
-case AtomicExpr::AO__atomic_fetch_sub:
-case AtomicExpr::AO__atomic_fetch_xor:
-case AtomicExpr::AO__atomic_add_fetch:
-case AtomicExpr::AO__atomic_and_fetch:
-case AtomicExpr::AO__atomic_max_fetch:
-case AtomicExpr::AO__atomic_min_fetch:
-case AtomicExpr::AO__atomic_nand_fetch:
-case AtomicExpr::AO__atomic_or_fetch:
-case AtomicExpr::AO__atomic_sub_fetch:
-case AtomicExpr::AO__atomic_xor_fetch:
-case AtomicExpr::AO__c11_atomic_fetch_add:
-case AtomicExpr::AO__c11_atomic_fetch_and:
-case AtomicExpr::AO__c11_atomic_fetch_max:
-case AtomicExpr::AO__c11_atomic_fetch_min:
-case AtomicExpr::AO__c11_atomic_fetch_nand:
-case AtomicExpr::AO__c11_atomic_fetch_or:
-case AtomicExpr::AO__c11_atomic_fetch_sub:
-case AtomicExpr::AO__c11_atomic_fetch_xor:
-case AtomicExpr::AO__hip_atomic_fetch_add:
-case AtomicExpr::AO__hip_atomic_fetch_and:
-case AtomicExpr::AO__hip_atomic_fetch_max:
-case AtomicExpr::AO__hip_atomic_fetch_min:
-case AtomicExpr::AO__hip_atomic_fetch_or:
-case AtomicExpr::AO__hip_atomic_fetch_sub:
-case AtomicExpr::AO__hip_atomic_fetch_xor:
-case AtomicExpr::AO__opencl_atomic_fetch_add:
-case AtomicExpr::AO__opencl_atomic_fetch_and:
-case AtomicExpr::AO__opencl_atomic_fetch_max:
-case AtomicExpr::AO__opencl_atomic_fetch_min:
-case AtomicExpr::AO__opencl_atomic_fetch_or:
-case AtomicExpr::AO__opencl_atomic_fetch_sub:
-case AtomicExpr::AO__opencl_atomic_fetch_xor:
-case AtomicExpr::AO__scoped_atomic_fetch_add:
-case AtomicExpr::AO__scoped_atomic_fetch_and:
-case AtomicExpr::AO__scoped_atomic_fetch_max:
-case AtomicExpr::AO__scoped_atomic_fetch_min:
-case AtomicExpr::AO__scoped_atomic_fetch_nand:
-case AtomicExpr::AO__scoped_atomic_fetch_or:
-case AtomicExpr::AO__scoped_atomic_fetch_sub:
-case AtomicExpr::AO__scoped_atomic_fetch_xor:
-case AtomicExpr::AO__scoped_atomic_add_fetch:
-case AtomicExpr::AO__scoped_atomic_and_fetch:
-case AtomicExpr::AO__scoped_atomic_max_fetch:
-case AtomicExpr::AO__scoped_atomic_min_fetch:
-case AtomicExpr::AO__scoped_atomic_nand_fetch:
-case AtomicExpr::AO__scoped_atomic_or_fetch:
-case AtomicExpr::AO__scoped_atomic_sub_fetch:
-case AtomicExpr::AO__scoped_atomic_xor_fetch:
-  // For these, only library calls for certain sizes exist.
-  UseOptimizedLibcall = true;
-  break;
-
-case AtomicExpr::AO__atomic_load:
-case AtomicExpr::AO__atomic_store:
-case AtomicExpr::AO__atomic_exchange:
-case AtomicExpr::AO__atomic_compare_exchange:
-case AtomicExpr::AO__scoped_atomic_load:
-case AtomicExpr::AO__scoped_atomic_store:
-case AtomicExpr::AO__scoped_atomic_exchange:
-case AtomicExpr::AO__scoped_atomic_compare_exchange:
-  // Use the generic version if we don't know that the operand will be
-  // suitably aligned for the optimized version.
-  if (Misaligned)
-break;
-  [[fallthrough]];
-case AtomicExpr::AO__atomic_load_n:
-case AtomicExpr::AO__atomic_store_n:
-case AtomicExpr::AO__atomic_exchange_n:
-case AtomicExpr::AO__atomic_compare_exchange_n:
-case AtomicExpr::AO__c11_atomic_load:
-case AtomicExpr::AO__c11_atomic_store:
-case AtomicExpr::AO__c11_atomic_exchange:
-case AtomicExpr::AO__c11_atomic_compare_exchange_weak:
-case AtomicExpr::AO__c11_atomic_compare_exchange_strong:
-case AtomicExpr::AO__hip_atomic_load:
-case AtomicExpr::AO__hip_atomic_store:
-case AtomicExpr::AO__hip_atomic_exchange:
-case AtomicExpr::AO__hip_atomic_compare_exchange_weak:
-case AtomicExpr::AO__hip_atomic_compare_exchange_strong:
-case AtomicExpr::AO__opencl_atomic_load:
-case AtomicExpr::AO__opencl_atomic_store:
-case AtomicExpr::AO__opencl_atomic_exchange:
-case AtomicExpr::AO__opencl_atomic_compare_exchange_weak:
-case AtomicExpr::AO__opencl_atomic_compare_exchange_strong:
-case AtomicExpr::AO__scoped_atomic_load_n:
-case AtomicExpr::AO__scoped_atomic_store_n:
-case AtomicExpr::AO__scoped_atomic_exchange_n:
-case AtomicExpr::AO__scoped_atomic_compare_exchange_n:
-  // Only use optimized library calls for sizes for which

[lld] [mlir] [clang] [libcxx] [openmp] [llvm] [libc++] Deprecate the _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS macro (PR #77692)

2024-01-12 Thread Nikolas Klauser via cfe-commits

philnik777 wrote:

> My suggestion on #69994 had been to stop implying 
> `_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS` from 
> `_LIBCPP_ENABLE_CXX20_REMOVED_FEATURES` in LLVM 18 at the same time as 
> deprecating it. Did you intend to _not_ do that, or was it just missed?

We've also deprecated (or plan to?) `_LIBCPP_ENABLE_CXX20_REMOVED_FEATURES`, so 
there isn't really a point in changing anything there now.

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


[clang] [clang-format][NFC] Use FileCheck for clang-format-ignore lit test (PR #77977)

2024-01-12 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang-format

Author: Owen Pan (owenca)


Changes



---
Full diff: https://github.com/llvm/llvm-project/pull/77977.diff


1 Files Affected:

- (modified) clang/test/Format/clang-format-ignore.cpp (+25-21) 


``diff
diff --git a/clang/test/Format/clang-format-ignore.cpp 
b/clang/test/Format/clang-format-ignore.cpp
index 5a2267b302d22f..fb49fa9dd52c65 100644
--- a/clang/test/Format/clang-format-ignore.cpp
+++ b/clang/test/Format/clang-format-ignore.cpp
@@ -6,41 +6,45 @@
 // RUN: echo "level*/*.c*" >> .clang-format-ignore
 // RUN: echo "*/*2/foo.*" >> .clang-format-ignore
 // RUN: touch foo.cc
-// RUN: clang-format -verbose .clang-format-ignore foo.cc 2> %t.stderr
-// RUN: not grep Formatting %t.stderr
+// RUN: clang-format -verbose .clang-format-ignore foo.cc 2>&1 \
+// RUN:   | FileCheck %s -allow-empty
 
 // RUN: cd level1
 // RUN: touch bar.cc baz.c
-// RUN: clang-format -verbose bar.cc baz.c 2> %t.stderr
-// RUN: not grep Formatting %t.stderr
+// RUN: clang-format -verbose bar.cc baz.c 2>&1 | FileCheck %s -allow-empty
 
 // RUN: cd level2
 // RUN: touch foo.c foo.js
-// RUN: clang-format -verbose foo.c foo.js 2> %t.stderr
-// RUN: not grep Formatting %t.stderr
+// RUN: clang-format -verbose foo.c foo.js 2>&1 | FileCheck %s -allow-empty
+
+// CHECK-NOT: Formatting
 
 // RUN: touch .clang-format-ignore
-// RUN: clang-format -verbose foo.c foo.js 2> %t.stderr
-// RUN: grep -Fx "Formatting [1/2] foo.c" %t.stderr
-// RUN: grep -Fx "Formatting [2/2] foo.js" %t.stderr
+// RUN: clang-format -verbose foo.c foo.js 2>&1 \
+// RUN:   | FileCheck %s -check-prefix=CHECK2 -match-full-lines
+// CHECK2: Formatting [1/2] foo.c
+// CHECK2-NEXT: Formatting [2/2] foo.js
 
 // RUN: echo "*.js" > .clang-format-ignore
-// RUN: clang-format -verbose foo.c foo.js 2> %t.stderr
-// RUN: grep -Fx "Formatting [1/2] foo.c" %t.stderr
-// RUN: not grep -F foo.js %t.stderr
+// RUN: clang-format -verbose foo.c foo.js 2>&1 \
+// RUN:   | FileCheck %s -check-prefix=CHECK3 -match-full-lines
+// CHECK3: Formatting [1/2] foo.c
+// CHECK3-NOT: foo.js
 
 // RUN: cd ../..
-// RUN: clang-format -verbose *.cc level1/*.c* level1/level2/foo.* 2> %t.stderr
-// RUN: grep -x "Formatting \[1/5] .*foo\.c" %t.stderr
-// RUN: not grep -F foo.js %t.stderr
+// RUN: clang-format -verbose *.cc level1/*.c* level1/level2/foo.* 2>&1 \
+// RUN:   | FileCheck %s -check-prefix=CHECK4 -match-full-lines
+// CHECK4: {{Formatting \[1/5] .*foo\.c}}
+// CHECK4-NOT: foo.js
 
 // RUN: rm .clang-format-ignore
-// RUN: clang-format -verbose *.cc level1/*.c* level1/level2/foo.* 2> %t.stderr
-// RUN: grep -x "Formatting \[1/5] .*foo\.cc" %t.stderr
-// RUN: grep -x "Formatting \[2/5] .*bar\.cc" %t.stderr
-// RUN: grep -x "Formatting \[3/5] .*baz\.c" %t.stderr
-// RUN: grep -x "Formatting \[4/5] .*foo\.c" %t.stderr
-// RUN: not grep -F foo.js %t.stderr
+// RUN: clang-format -verbose *.cc level1/*.c* level1/level2/foo.* 2>&1 \
+// RUN:   | FileCheck %s -check-prefix=CHECK5 -match-full-lines
+// CHECK5: {{Formatting \[1/5] .*foo\.cc}}
+// CHECK5-NEXT: {{Formatting \[2/5] .*bar\.cc}}
+// CHECK5-NEXT: {{Formatting \[3/5] .*baz\.c}}
+// CHECK5-NEXT: {{Formatting \[4/5] .*foo\.c}}
+// CHECK5-NOT: foo.js
 
 // RUN: cd ..
 // RUN: rm -r %t.dir

``




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


[clang] [clang-format][NFC] Use FileCheck for clang-format-ignore lit test (PR #77977)

2024-01-12 Thread Owen Pan via cfe-commits

https://github.com/owenca created 
https://github.com/llvm/llvm-project/pull/77977

None

>From 4f516c1ee4ab99af2c3135ca161a82e6428d3ee9 Mon Sep 17 00:00:00 2001
From: Owen Pan 
Date: Fri, 12 Jan 2024 12:30:17 -0800
Subject: [PATCH] [clang-format][NFC] Use FileCheck for clang-format-ignore lit
 test

---
 clang/test/Format/clang-format-ignore.cpp | 46 ---
 1 file changed, 25 insertions(+), 21 deletions(-)

diff --git a/clang/test/Format/clang-format-ignore.cpp 
b/clang/test/Format/clang-format-ignore.cpp
index 5a2267b302d22f..fb49fa9dd52c65 100644
--- a/clang/test/Format/clang-format-ignore.cpp
+++ b/clang/test/Format/clang-format-ignore.cpp
@@ -6,41 +6,45 @@
 // RUN: echo "level*/*.c*" >> .clang-format-ignore
 // RUN: echo "*/*2/foo.*" >> .clang-format-ignore
 // RUN: touch foo.cc
-// RUN: clang-format -verbose .clang-format-ignore foo.cc 2> %t.stderr
-// RUN: not grep Formatting %t.stderr
+// RUN: clang-format -verbose .clang-format-ignore foo.cc 2>&1 \
+// RUN:   | FileCheck %s -allow-empty
 
 // RUN: cd level1
 // RUN: touch bar.cc baz.c
-// RUN: clang-format -verbose bar.cc baz.c 2> %t.stderr
-// RUN: not grep Formatting %t.stderr
+// RUN: clang-format -verbose bar.cc baz.c 2>&1 | FileCheck %s -allow-empty
 
 // RUN: cd level2
 // RUN: touch foo.c foo.js
-// RUN: clang-format -verbose foo.c foo.js 2> %t.stderr
-// RUN: not grep Formatting %t.stderr
+// RUN: clang-format -verbose foo.c foo.js 2>&1 | FileCheck %s -allow-empty
+
+// CHECK-NOT: Formatting
 
 // RUN: touch .clang-format-ignore
-// RUN: clang-format -verbose foo.c foo.js 2> %t.stderr
-// RUN: grep -Fx "Formatting [1/2] foo.c" %t.stderr
-// RUN: grep -Fx "Formatting [2/2] foo.js" %t.stderr
+// RUN: clang-format -verbose foo.c foo.js 2>&1 \
+// RUN:   | FileCheck %s -check-prefix=CHECK2 -match-full-lines
+// CHECK2: Formatting [1/2] foo.c
+// CHECK2-NEXT: Formatting [2/2] foo.js
 
 // RUN: echo "*.js" > .clang-format-ignore
-// RUN: clang-format -verbose foo.c foo.js 2> %t.stderr
-// RUN: grep -Fx "Formatting [1/2] foo.c" %t.stderr
-// RUN: not grep -F foo.js %t.stderr
+// RUN: clang-format -verbose foo.c foo.js 2>&1 \
+// RUN:   | FileCheck %s -check-prefix=CHECK3 -match-full-lines
+// CHECK3: Formatting [1/2] foo.c
+// CHECK3-NOT: foo.js
 
 // RUN: cd ../..
-// RUN: clang-format -verbose *.cc level1/*.c* level1/level2/foo.* 2> %t.stderr
-// RUN: grep -x "Formatting \[1/5] .*foo\.c" %t.stderr
-// RUN: not grep -F foo.js %t.stderr
+// RUN: clang-format -verbose *.cc level1/*.c* level1/level2/foo.* 2>&1 \
+// RUN:   | FileCheck %s -check-prefix=CHECK4 -match-full-lines
+// CHECK4: {{Formatting \[1/5] .*foo\.c}}
+// CHECK4-NOT: foo.js
 
 // RUN: rm .clang-format-ignore
-// RUN: clang-format -verbose *.cc level1/*.c* level1/level2/foo.* 2> %t.stderr
-// RUN: grep -x "Formatting \[1/5] .*foo\.cc" %t.stderr
-// RUN: grep -x "Formatting \[2/5] .*bar\.cc" %t.stderr
-// RUN: grep -x "Formatting \[3/5] .*baz\.c" %t.stderr
-// RUN: grep -x "Formatting \[4/5] .*foo\.c" %t.stderr
-// RUN: not grep -F foo.js %t.stderr
+// RUN: clang-format -verbose *.cc level1/*.c* level1/level2/foo.* 2>&1 \
+// RUN:   | FileCheck %s -check-prefix=CHECK5 -match-full-lines
+// CHECK5: {{Formatting \[1/5] .*foo\.cc}}
+// CHECK5-NEXT: {{Formatting \[2/5] .*bar\.cc}}
+// CHECK5-NEXT: {{Formatting \[3/5] .*baz\.c}}
+// CHECK5-NEXT: {{Formatting \[4/5] .*foo\.c}}
+// CHECK5-NOT: foo.js
 
 // RUN: cd ..
 // RUN: rm -r %t.dir

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


[clang-tools-extra] [flang] [libc] [lldb] [compiler-rt] [lld] [llvm] [libcxx] [clang] [AMDGPU] Use alias info to relax waitcounts for LDS DMA (PR #74537)

2024-01-12 Thread Stanislav Mekhanoshin via cfe-commits


@@ -703,8 +713,37 @@ void WaitcntBrackets::updateByEvent(const SIInstrInfo *TII,
 setRegScore(RegNo, T, CurrScore);
   }
 }
-if (Inst.mayStore() && (TII->isDS(Inst) || mayWriteLDSThroughDMA(Inst))) {
-  setRegScore(SQ_MAX_PGM_VGPRS + EXTRA_VGPR_LDS, T, CurrScore);
+if (Inst.mayStore() &&
+(TII->isDS(Inst) || TII->mayWriteLDSThroughDMA(Inst))) {
+  // MUBUF and FLAT LDS DMA operations need a wait on vmcnt before LDS
+  // written can be accessed. A load from LDS to VMEM does not need a wait.
+  unsigned Slot = 0;
+  for (const auto *MemOp : Inst.memoperands()) {
+if (!MemOp->isStore() ||
+MemOp->getAddrSpace() != AMDGPUAS::LOCAL_ADDRESS)
+  continue;
+// Comparing just AA info does not guarantee memoperands are equal

rampitec wrote:

Right, there is no PSV. I have mentioned PSV because you have earlier suggested 
to use it. For the real IR value: it is not helpful to compare it. The IR value 
is a GEP, and this GEP is always different. I.e. these values never compare 
equal. The rest of the IR is already gone and unavailable for the analysis. 
Even if it would be available this GEP will address kernel module LDS variable, 
a single huge LDS array, and will be useless again. In this case it will tell 
you any LDS operation aliases any other. Now during the module LDS lowering I 
am creating alias scope info specifically to disambiguate aliasing after the 
pass has squashed all LDS variables.

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


[clang-tools-extra] [llvm] [flang] [clang] [flang] Add EXECUTE_COMMAND_LINE runtime and lowering intrinsics implementation (PR #74077)

2024-01-12 Thread Pete Steinfeld via cfe-commits

psteinfeld wrote:

See issue #77975.

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


[flang] [libcxx] [compiler-rt] [llvm] [libc] [lldb] [lld] [clang-tools-extra] [clang] [AMDGPU] Use alias info to relax waitcounts for LDS DMA (PR #74537)

2024-01-12 Thread Stanislav Mekhanoshin via cfe-commits


@@ -1183,9 +1228,21 @@ bool 
SIInsertWaitcnts::generateWaitcntInstBefore(MachineInstr &MI,
 // No need to wait before load from VMEM to LDS.
 if (TII->mayWriteLDSThroughDMA(MI))
   continue;
-unsigned RegNo = SQ_MAX_PGM_VGPRS + EXTRA_VGPR_LDS;
+
 // VM_CNT is only relevant to vgpr or LDS.
-ScoreBrackets.determineWait(VM_CNT, RegNo, Wait);
+unsigned RegNo = SQ_MAX_PGM_VGPRS + EXTRA_VGPR_LDS;
+bool FoundAliasingStore = false;
+if (Ptr && Memop->getAAInfo() && Memop->getAAInfo().Scope) {

rampitec wrote:

I have reserved just 8 pseudo registers to track it. I do not want to fill it 
with unrelated stuff. I know that the only way AA will be able to handle this 
very specific situation is if there is scope info, otherwise there is no reason 
to waste a slot and compile time. If I do not enter this 'if' the pass will 
just do conservatively correct thing and wait for this memory regardless of 
aliasing or lack of it.

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


[clang] [clang] Adjust -mlarge-data-threshold handling (PR #77958)

2024-01-12 Thread Arthur Eubanks via cfe-commits

https://github.com/aeubanks closed 
https://github.com/llvm/llvm-project/pull/77958
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] f05b081 - [clang] Adjust -mlarge-data-threshold handling (#77958)

2024-01-12 Thread via cfe-commits

Author: Arthur Eubanks
Date: 2024-01-12T12:23:42-08:00
New Revision: f05b0812145897ba34bc2d7fda436a54f9fbca22

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

LOG: [clang] Adjust -mlarge-data-threshold handling (#77958)

Make it apply to x86-64 medium and large code models since that's what
the backend does.

Limit logic to exclude x86-32.

Default to 0, let the driver set it to 65536 for the medium code model
if one is not passed. Set it to 0 for the large code model by default to
match gcc and since some users make assumptions about the large code
model that any small data will break.

Added: 


Modified: 
clang/include/clang/Basic/DiagnosticDriverKinds.td
clang/include/clang/Driver/Options.td
clang/lib/CodeGen/CodeGenModule.cpp
clang/lib/Driver/ToolChains/Clang.cpp
clang/test/CodeGen/large-data-threshold.c
clang/test/Driver/large-data-threshold.c

Removed: 




diff  --git a/clang/include/clang/Basic/DiagnosticDriverKinds.td 
b/clang/include/clang/Basic/DiagnosticDriverKinds.td
index 0a8a77fadbeb1b..8b5232a6df3958 100644
--- a/clang/include/clang/Basic/DiagnosticDriverKinds.td
+++ b/clang/include/clang/Basic/DiagnosticDriverKinds.td
@@ -472,7 +472,7 @@ def warn_unsupported_branch_protection: Warning <
 def err_sls_hardening_arm_not_supported : Error<
   "-mharden-sls is only supported on armv7-a or later">;
 def warn_drv_large_data_threshold_invalid_code_model: Warning<
-  "'%0' only applies to medium code model">,
+  "'%0' only applies to medium and large code models">,
   InGroup;
 
 def note_drv_command_failed_diag_msg : Note<

diff  --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index 7f97d6b6faa398..c237d1f6619348 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -4392,8 +4392,8 @@ def mcmodel_EQ : Joined<["-"], "mcmodel=">, 
Group,
   Visibility<[ClangOption, CC1Option]>,
   MarshallingInfoString, [{"default"}]>;
 def mlarge_data_threshold_EQ : Joined<["-"], "mlarge-data-threshold=">, 
Group,
-  Visibility<[ClangOption, CC1Option]>,
-  MarshallingInfoInt, "65535">;
+  Flags<[TargetSpecific]>, Visibility<[ClangOption, CC1Option]>,
+  MarshallingInfoInt, "0">;
 def mtls_size_EQ : Joined<["-"], "mtls-size=">, Group,
   Visibility<[ClangOption, CC1Option]>,
   HelpText<"Specify bit size of immediate TLS offsets (AArch64 ELF only): "

diff  --git a/clang/lib/CodeGen/CodeGenModule.cpp 
b/clang/lib/CodeGen/CodeGenModule.cpp
index ad6fc71c1e5038..0cfe7a0133b7e3 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -1201,7 +1201,7 @@ void CodeGenModule::Release() {
   llvm::CodeModel::Model codeModel = 
static_cast(CM);
   getModule().setCodeModel(codeModel);
 
-  if (CM == llvm::CodeModel::Medium &&
+  if ((CM == llvm::CodeModel::Medium || CM == llvm::CodeModel::Large) &&
   Context.getTargetInfo().getTriple().getArch() ==
   llvm::Triple::x86_64) {
 getModule().setLargeDataThreshold(getCodeGenOpts().LargeDataThreshold);

diff  --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index 1ee7ae602f3ce5..9edae3fec91a87 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -5752,20 +5752,24 @@ void Clang::ConstructJob(Compilation &C, const 
JobAction &JA,
 }
   }
 
-  if (Arg *A = Args.getLastArg(options::OPT_mlarge_data_threshold_EQ)) {
-if (!Triple.isX86()) {
-  D.Diag(diag::err_drv_unsupported_opt_for_target)
-  << A->getOption().getName() << TripleStr;
-} else {
-  bool IsMediumCM = false;
-  if (Arg *A = Args.getLastArg(options::OPT_mcmodel_EQ))
-IsMediumCM = StringRef(A->getValue()) == "medium";
-  if (!IsMediumCM) {
+  if (Triple.getArch() == llvm::Triple::x86_64) {
+bool IsMediumCM = false;
+bool IsLargeCM = false;
+if (Arg *A = Args.getLastArg(options::OPT_mcmodel_EQ)) {
+  IsMediumCM = StringRef(A->getValue()) == "medium";
+  IsLargeCM = StringRef(A->getValue()) == "large";
+}
+if (Arg *A = Args.getLastArg(options::OPT_mlarge_data_threshold_EQ)) {
+  if (!IsMediumCM && !IsLargeCM) {
 D.Diag(diag::warn_drv_large_data_threshold_invalid_code_model)
 << A->getOption().getRenderName();
   } else {
 A->render(Args, CmdArgs);
   }
+} else if (IsMediumCM) {
+  CmdArgs.push_back("-mlarge-data-threshold=65536");
+} else if (IsLargeCM) {
+  CmdArgs.push_back("-mlarge-data-threshold=0");
 }
   }
 

diff  --git a/clang/test/CodeGen/large-data-threshold.c 
b/clang/test/CodeGen/large-data-threshold.c
index 29ae19e9b71899..d110ad2125c7bc 100644
--- a/clang/test/CodeGen/large-data-threshold.c

[flang] [libcxx] [compiler-rt] [llvm] [libc] [lldb] [lld] [clang-tools-extra] [clang] [AMDGPU] Use alias info to relax waitcounts for LDS DMA (PR #74537)

2024-01-12 Thread Stanislav Mekhanoshin via cfe-commits


@@ -130,6 +130,8 @@
 ; GCN-O0-NEXT:MachineDominator Tree Construction
 ; GCN-O0-NEXT:Machine Natural Loop Construction
 ; GCN-O0-NEXT:MachinePostDominator Tree Construction
+; GCN-O0-NEXT:Basic Alias Analysis (stateless AA impl)
+; GCN-O0-NEXT:Function Alias Analysis Results

rampitec wrote:

If I just skip getAnalysis call it does not help since analysis is requested in 
the getAnalysisUsage. If I do not request it it is not available at any 
optlevel.  This is the benefit of the alternative 
https://github.com/llvm/llvm-project/pull/75974, it does not request the full 
analysis.

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


  1   2   3   4   5   >