[clang] [clang-tools-extra] [flang] [lldb] [llvm] [mlir] [polly] Add static to command line option (cl::opt) (PR #126243)

2025-02-07 Thread via cfe-commits

chrisPyr wrote:

Ok, to make it clear, I’ll split it up by projects.
And I will leave function local variables as-is.
Is that fair enough?

On Sat, Feb 8, 2025 at 04:45 Vitaly Buka ***@***.***> wrote:

> All these changes are independent and quite straight forward.
>
> I'd suggest to split in some way, so it's easier to review, land, and
> revert if we miss and break something.
>
> Maybe by component.
> also globals vs function local etc.
>
> —
> Reply to this email directly, view it on GitHub
> ,
> or unsubscribe
> 
> .
> You are receiving this because you authored the thread.Message ID:
> ***@***.***>
>


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


[clang] [clang-format] Handle C-style cast of member function pointer type (PR #126340)

2025-02-07 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang-format

Author: Owen Pan (owenca)


Changes

Fixes #125012.

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


2 Files Affected:

- (modified) clang/lib/Format/TokenAnnotator.cpp (+5-2) 
- (modified) clang/unittests/Format/TokenAnnotatorTest.cpp (+6) 


``diff
diff --git a/clang/lib/Format/TokenAnnotator.cpp 
b/clang/lib/Format/TokenAnnotator.cpp
index 94fd7ba9c0e79e3..b3540f39e6f69fc 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -477,8 +477,9 @@ class AnnotatingParser {
 FormatToken *PossibleObjCForInToken = nullptr;
 while (CurrentToken) {
   const auto &Prev = *CurrentToken->Previous;
+  const auto *PrevPrev = Prev.Previous;
   if (Prev.is(TT_PointerOrReference) &&
-  Prev.Previous->isOneOf(tok::l_paren, tok::coloncolon)) {
+  PrevPrev->isOneOf(tok::l_paren, tok::coloncolon)) {
 ProbablyFunctionType = true;
   }
   if (CurrentToken->is(tok::comma))
@@ -486,8 +487,10 @@ class AnnotatingParser {
   if (Prev.is(TT_BinaryOperator))
 Contexts.back().IsExpression = true;
   if (CurrentToken->is(tok::r_paren)) {
-if (Prev.is(TT_PointerOrReference) && Prev.Previous == &OpeningParen)
+if (Prev.is(TT_PointerOrReference) &&
+(PrevPrev == &OpeningParen || PrevPrev->is(tok::coloncolon))) {
   MightBeFunctionType = true;
+}
 if (OpeningParen.isNot(TT_CppCastLParen) && MightBeFunctionType &&
 ProbablyFunctionType && CurrentToken->Next &&
 (CurrentToken->Next->is(tok::l_paren) ||
diff --git a/clang/unittests/Format/TokenAnnotatorTest.cpp 
b/clang/unittests/Format/TokenAnnotatorTest.cpp
index 1b09c4570345622..54d8ff0571ca686 100644
--- a/clang/unittests/Format/TokenAnnotatorTest.cpp
+++ b/clang/unittests/Format/TokenAnnotatorTest.cpp
@@ -874,6 +874,12 @@ TEST_F(TokenAnnotatorTest, UnderstandsCasts) {
   EXPECT_TOKEN(Tokens[14], tok::r_paren, TT_CastRParen);
   EXPECT_TOKEN(Tokens[15], tok::amp, TT_UnaryOperator);
 
+  Tokens = annotate("return (Foo (Bar::*)())&Bar::foo;");
+  ASSERT_EQ(Tokens.size(), 17u) << Tokens;
+  EXPECT_TOKEN(Tokens[3], tok::l_paren, TT_FunctionTypeLParen);
+  EXPECT_TOKEN(Tokens[10], tok::r_paren, TT_CastRParen);
+  EXPECT_TOKEN(Tokens[11], tok::amp, TT_UnaryOperator);
+
   auto Style = getLLVMStyle();
   Style.TypeNames.push_back("Foo");
   Tokens = annotate("#define FOO(bar) foo((Foo)&bar)", Style);

``




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


[clang] [clang-format] Handle C-style cast of member function pointer type (PR #126340)

2025-02-07 Thread Owen Pan via cfe-commits

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

Fixes #125012.

>From a0e44456a4fa1f5ef1168ac0e399b7113252bf96 Mon Sep 17 00:00:00 2001
From: Owen Pan 
Date: Fri, 7 Feb 2025 19:53:17 -0800
Subject: [PATCH] [clang-format] Handle C-style cast of member function pointer
 type

Fixes #125012.
---
 clang/lib/Format/TokenAnnotator.cpp   | 7 +--
 clang/unittests/Format/TokenAnnotatorTest.cpp | 6 ++
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/clang/lib/Format/TokenAnnotator.cpp 
b/clang/lib/Format/TokenAnnotator.cpp
index 94fd7ba9c0e79e3..b3540f39e6f69fc 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -477,8 +477,9 @@ class AnnotatingParser {
 FormatToken *PossibleObjCForInToken = nullptr;
 while (CurrentToken) {
   const auto &Prev = *CurrentToken->Previous;
+  const auto *PrevPrev = Prev.Previous;
   if (Prev.is(TT_PointerOrReference) &&
-  Prev.Previous->isOneOf(tok::l_paren, tok::coloncolon)) {
+  PrevPrev->isOneOf(tok::l_paren, tok::coloncolon)) {
 ProbablyFunctionType = true;
   }
   if (CurrentToken->is(tok::comma))
@@ -486,8 +487,10 @@ class AnnotatingParser {
   if (Prev.is(TT_BinaryOperator))
 Contexts.back().IsExpression = true;
   if (CurrentToken->is(tok::r_paren)) {
-if (Prev.is(TT_PointerOrReference) && Prev.Previous == &OpeningParen)
+if (Prev.is(TT_PointerOrReference) &&
+(PrevPrev == &OpeningParen || PrevPrev->is(tok::coloncolon))) {
   MightBeFunctionType = true;
+}
 if (OpeningParen.isNot(TT_CppCastLParen) && MightBeFunctionType &&
 ProbablyFunctionType && CurrentToken->Next &&
 (CurrentToken->Next->is(tok::l_paren) ||
diff --git a/clang/unittests/Format/TokenAnnotatorTest.cpp 
b/clang/unittests/Format/TokenAnnotatorTest.cpp
index 1b09c4570345622..54d8ff0571ca686 100644
--- a/clang/unittests/Format/TokenAnnotatorTest.cpp
+++ b/clang/unittests/Format/TokenAnnotatorTest.cpp
@@ -874,6 +874,12 @@ TEST_F(TokenAnnotatorTest, UnderstandsCasts) {
   EXPECT_TOKEN(Tokens[14], tok::r_paren, TT_CastRParen);
   EXPECT_TOKEN(Tokens[15], tok::amp, TT_UnaryOperator);
 
+  Tokens = annotate("return (Foo (Bar::*)())&Bar::foo;");
+  ASSERT_EQ(Tokens.size(), 17u) << Tokens;
+  EXPECT_TOKEN(Tokens[3], tok::l_paren, TT_FunctionTypeLParen);
+  EXPECT_TOKEN(Tokens[10], tok::r_paren, TT_CastRParen);
+  EXPECT_TOKEN(Tokens[11], tok::amp, TT_UnaryOperator);
+
   auto Style = getLLVMStyle();
   Style.TypeNames.push_back("Foo");
   Tokens = annotate("#define FOO(bar) foo((Foo)&bar)", Style);

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


[clang] [clang] [ASTDump] Add support for structural value template arguments in TextNodeDumper (PR #126341)

2025-02-07 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang

Author: None (sakria9)


Changes

Dump structural value in AST.

Example code

```cpp
template<_Complex int x>
struct E;
template<>
struct E<{1, 2}>;
```

Command `clang++ -Xclang -ast-dump usr.cpp -fsyntax-only -std=c++23`

Current AST dump result

```
|-ClassTemplateDecl 0x61a3b52364e8  col:8 E
| |-NonTypeTemplateParmDecl 0x61a3b52363b8  col:23 
'_Complex int' depth 0 index 0 x
| |-CXXRecordDecl 0x61a3b5236438  col:8 struct E
| `-ClassTemplateSpecialization 0x61a3b5236918 'E'
`-ClassTemplateSpecializationDecl 0x61a3b5236918  col:8 struct E explicit_specialization
  `-TemplateArgument
```

After apply this fix

```
|-ClassTemplateDecl 0x7ce2a834fd60  col:8 E
| |-NonTypeTemplateParmDecl 0x7ce2a834fc10  col:23 
'_Complex int' depth 0 index 0 x
| |-CXXRecordDecl 0x7ce2a834fca0  col:8 struct E
| `-ClassTemplateSpecialization 0x7ce2a8350218 'E'
`-ClassTemplateSpecializationDecl 0x7ce2a8350218  col:8 struct E explicit_specialization
  `-TemplateArgument structural value '1+2i'
```

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


2 Files Affected:

- (modified) clang/include/clang/AST/TextNodeDumper.h (+1) 
- (modified) clang/lib/AST/TextNodeDumper.cpp (+5) 


``diff
diff --git a/clang/include/clang/AST/TextNodeDumper.h 
b/clang/include/clang/AST/TextNodeDumper.h
index bfd205ffb0d99a..4b5ad2b5fa74c0 100644
--- a/clang/include/clang/AST/TextNodeDumper.h
+++ b/clang/include/clang/AST/TextNodeDumper.h
@@ -249,6 +249,7 @@ class TextNodeDumper
   void VisitDeclarationTemplateArgument(const TemplateArgument &TA);
   void VisitNullPtrTemplateArgument(const TemplateArgument &TA);
   void VisitIntegralTemplateArgument(const TemplateArgument &TA);
+  void VisitStructuralValueTemplateArgument(const TemplateArgument &TA);
   void VisitTemplateTemplateArgument(const TemplateArgument &TA);
   void VisitTemplateExpansionTemplateArgument(const TemplateArgument &TA);
   void VisitExpressionTemplateArgument(const TemplateArgument &TA);
diff --git a/clang/lib/AST/TextNodeDumper.cpp b/clang/lib/AST/TextNodeDumper.cpp
index 6da1f776b4b635..cb0c742177d2c7 100644
--- a/clang/lib/AST/TextNodeDumper.cpp
+++ b/clang/lib/AST/TextNodeDumper.cpp
@@ -1226,6 +1226,11 @@ void TextNodeDumper::VisitIntegralTemplateArgument(const 
TemplateArgument &TA) {
   dumpTemplateArgument(TA);
 }
 
+void TextNodeDumper::VisitStructuralValueTemplateArgument(const 
TemplateArgument &TA) {
+  OS << " structural value";
+  dumpTemplateArgument(TA);
+}
+
 void TextNodeDumper::dumpTemplateName(TemplateName TN, StringRef Label) {
   AddChild(Label, [=] {
 {

``




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


[clang] [clang] [ASTDump] Add support for structural value template arguments in TextNodeDumper (PR #126341)

2025-02-07 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/126341
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [analyzer] Remove some false negatives in StackAddrEscapeChecker (PR #125638)

2025-02-07 Thread Michael Flanders via cfe-commits

https://github.com/Flandini updated 
https://github.com/llvm/llvm-project/pull/125638

>From 0674909f03703a70c3e259acd0590f50cea4615f Mon Sep 17 00:00:00 2001
From: Michael Flanders 
Date: Mon, 27 Jan 2025 11:35:03 -0600
Subject: [PATCH 01/30] wip

---
 .../Checkers/StackAddrEscapeChecker.cpp   | 45 ++-
 1 file changed, 44 insertions(+), 1 deletion(-)

diff --git a/clang/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp 
b/clang/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp
index f4de3b500499c48..59b47371df0d29e 100644
--- a/clang/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp
@@ -20,6 +20,7 @@
 #include "clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h"
+#include "clang/StaticAnalyzer/Core/PathSensitive/SValVisitor.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/Support/raw_ostream.h"
 using namespace clang;
@@ -233,6 +234,43 @@ void StackAddrEscapeChecker::checkReturnedBlockCaptures(
   }
 }
 
+class FindEscapingStackAddrsVisitor : public 
FullSValVisitor
+{
+  const StackFrameContext *Ctxt;
+
+  SmallVector Escaped;
+
+  bool IsTopFrame;
+
+public:
+  explicit FindEscapingStackAddrsVisitor(CheckerContext &CC, bool IsTopFrame) 
: 
+Ctxt(CC.getStackFrame()), IsTopFrame(IsTopFrame) {}
+
+  bool CheckForEscapes(SVal V) { return Visit(V); }
+
+  bool VisitSymbolVal(nonloc::SymbolVal SymV) {
+return Visit(SymV.getSymbol());
+  }
+
+  bool VisitLocAsInteger(nonloc::LocAsInteger LAI) {
+return Visit(LAI.getAsRegion());
+  }
+
+  bool VisitMemRegionVal(loc::MemRegionVal MRVal) {
+return Visit(MRVal.getRegion());
+  }
+
+  bool VisitMemRegion(const MemRegion *R) {
+const MemSpaceRegion *MS = R->getMemorySpace();
+const StackSpaceRegion *SSR = dyn_cast(MS);
+if (SSR && Ctxt == SSR->getStackFrame()) {
+  Escaped.push_back(R);
+  return true;
+}
+return false;
+  }
+};
+
 void StackAddrEscapeChecker::checkPreCall(const CallEvent &Call,
   CheckerContext &C) const {
   if (!ChecksEnabled[CK_StackAddrAsyncEscapeChecker])
@@ -257,7 +295,12 @@ void StackAddrEscapeChecker::checkPreStmt(const ReturnStmt 
*RS,
 return;
   RetE = RetE->IgnoreParens();
 
+  FindEscapingStackAddrsVisitor EscapeFinder(C, 
C.getPredecessor()->getLocationContext()->inTopFrame());
+
   SVal V = C.getSVal(RetE);
+
+  bool AnyEscapes = EscapeFinder.CheckForEscapes(V);
+
   const MemRegion *R = V.getAsRegion();
   if (!R)
 return;
@@ -402,7 +445,7 @@ void StackAddrEscapeChecker::checkEndFunction(const 
ReturnStmt *RS,
 bool checkForDanglingStackVariable(const MemRegion *Referrer,
const MemRegion *Referred) {
   const auto *ReferrerMemSpace = getStackOrGlobalSpaceRegion(Referrer);
-  const auto *ReferredMemSpace =
+  const auto *ReferredMemSpace = 
   Referred->getMemorySpace()->getAs();
 
   if (!ReferrerMemSpace || !ReferredMemSpace)

>From 0a26f83cd5f4a42238ba4fadb3436fec83e4bfcb Mon Sep 17 00:00:00 2001
From: Michael Flanders 
Date: Wed, 29 Jan 2025 00:34:45 -0600
Subject: [PATCH 02/30] wip

---
 .../Checkers/StackAddrEscapeChecker.cpp   | 143 ++
 clang/test/Analysis/stack-addr-ps.cpp |  73 ++---
 clang/test/Analysis/stackaddrleak.cpp |   2 +-
 3 files changed, 136 insertions(+), 82 deletions(-)

diff --git a/clang/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp 
b/clang/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp
index 59b47371df0d29e..b6ef3759368 100644
--- a/clang/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp
@@ -22,6 +22,7 @@
 #include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/SValVisitor.h"
 #include "llvm/ADT/SmallString.h"
+#include "llvm/Support/Debug.h"
 #include "llvm/Support/raw_ostream.h"
 using namespace clang;
 using namespace ento;
@@ -210,6 +211,7 @@ void 
StackAddrEscapeChecker::checkAsyncExecutedBlockCaptures(
   }
 }
 
+
 void StackAddrEscapeChecker::checkReturnedBlockCaptures(
 const BlockDataRegion &B, CheckerContext &C) const {
   for (const MemRegion *Region : getCapturedStackRegions(B, C)) {
@@ -234,43 +236,6 @@ void StackAddrEscapeChecker::checkReturnedBlockCaptures(
   }
 }
 
-class FindEscapingStackAddrsVisitor : public 
FullSValVisitor
-{
-  const StackFrameContext *Ctxt;
-
-  SmallVector Escaped;
-
-  bool IsTopFrame;
-
-public:
-  explicit FindEscapingStackAddrsVisitor(CheckerContext &CC, bool IsTopFrame) 
: 
-Ctxt(CC.getStackFrame()), IsTopFrame(IsTopFrame) {}
-
-  bool CheckForEscapes(SVal V) { return Visit(V); }
-
-  bool VisitSymbolVal(nonloc::SymbolVal SymV) {
-return Visit(SymV.getSymbol());

[clang] [clang-format] Improve function pointer CastRParen detection. (PR #126019)

2025-02-07 Thread Owen Pan via cfe-commits

owenca wrote:

See #126340.

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


[clang] [clang] [ASTDump] Add support for structural value template arguments in TextNodeDumper (PR #126341)

2025-02-07 Thread via cfe-commits

https://github.com/sakria9 updated 
https://github.com/llvm/llvm-project/pull/126341

>From a382aa9de206a194397f9424150f170d35101b42 Mon Sep 17 00:00:00 2001
From: sakria9 
Date: Sat, 8 Feb 2025 04:00:08 +
Subject: [PATCH 1/2] [ASTDump] Add support for structural value template
 arguments in TextNodeDumper

---
 clang/include/clang/AST/TextNodeDumper.h | 1 +
 clang/lib/AST/TextNodeDumper.cpp | 5 +
 2 files changed, 6 insertions(+)

diff --git a/clang/include/clang/AST/TextNodeDumper.h 
b/clang/include/clang/AST/TextNodeDumper.h
index bfd205ffb0d99ad..4b5ad2b5fa74c04 100644
--- a/clang/include/clang/AST/TextNodeDumper.h
+++ b/clang/include/clang/AST/TextNodeDumper.h
@@ -249,6 +249,7 @@ class TextNodeDumper
   void VisitDeclarationTemplateArgument(const TemplateArgument &TA);
   void VisitNullPtrTemplateArgument(const TemplateArgument &TA);
   void VisitIntegralTemplateArgument(const TemplateArgument &TA);
+  void VisitStructuralValueTemplateArgument(const TemplateArgument &TA);
   void VisitTemplateTemplateArgument(const TemplateArgument &TA);
   void VisitTemplateExpansionTemplateArgument(const TemplateArgument &TA);
   void VisitExpressionTemplateArgument(const TemplateArgument &TA);
diff --git a/clang/lib/AST/TextNodeDumper.cpp b/clang/lib/AST/TextNodeDumper.cpp
index 6da1f776b4b6357..cb0c742177d2c7f 100644
--- a/clang/lib/AST/TextNodeDumper.cpp
+++ b/clang/lib/AST/TextNodeDumper.cpp
@@ -1226,6 +1226,11 @@ void TextNodeDumper::VisitIntegralTemplateArgument(const 
TemplateArgument &TA) {
   dumpTemplateArgument(TA);
 }
 
+void TextNodeDumper::VisitStructuralValueTemplateArgument(const 
TemplateArgument &TA) {
+  OS << " structural value";
+  dumpTemplateArgument(TA);
+}
+
 void TextNodeDumper::dumpTemplateName(TemplateName TN, StringRef Label) {
   AddChild(Label, [=] {
 {

>From 5e9bfa7141a1b0eda2fe41d2727c66a1e4c19e5d Mon Sep 17 00:00:00 2001
From: sakria9 
Date: Sat, 8 Feb 2025 04:11:05 +
Subject: [PATCH 2/2] format

---
 clang/lib/AST/TextNodeDumper.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/clang/lib/AST/TextNodeDumper.cpp b/clang/lib/AST/TextNodeDumper.cpp
index cb0c742177d2c7f..08efcda46b8f9a4 100644
--- a/clang/lib/AST/TextNodeDumper.cpp
+++ b/clang/lib/AST/TextNodeDumper.cpp
@@ -1226,7 +1226,8 @@ void TextNodeDumper::VisitIntegralTemplateArgument(const 
TemplateArgument &TA) {
   dumpTemplateArgument(TA);
 }
 
-void TextNodeDumper::VisitStructuralValueTemplateArgument(const 
TemplateArgument &TA) {
+void TextNodeDumper::VisitStructuralValueTemplateArgument(
+const TemplateArgument &TA) {
   OS << " structural value";
   dumpTemplateArgument(TA);
 }

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


[clang] [clang] [ASTDump] Add support for structural value template arguments in TextNodeDumper (PR #126341)

2025-02-07 Thread via cfe-commits

https://github.com/sakria9 created 
https://github.com/llvm/llvm-project/pull/126341

Dump structural value in AST.

Example code

```cpp
template<_Complex int x>
struct E;
template<>
struct E<{1, 2}>;
```

Command `clang++ -Xclang -ast-dump usr.cpp -fsyntax-only -std=c++23`

Current AST dump result

```
|-ClassTemplateDecl 0x61a3b52364e8  col:8 E
| |-NonTypeTemplateParmDecl 0x61a3b52363b8  col:23 
'_Complex int' depth 0 index 0 x
| |-CXXRecordDecl 0x61a3b5236438  col:8 struct E
| `-ClassTemplateSpecialization 0x61a3b5236918 'E'
`-ClassTemplateSpecializationDecl 0x61a3b5236918  
col:8 struct E explicit_specialization
  `-TemplateArgument
```

After apply this fix

```
|-ClassTemplateDecl 0x7ce2a834fd60  col:8 E
| |-NonTypeTemplateParmDecl 0x7ce2a834fc10  col:23 
'_Complex int' depth 0 index 0 x
| |-CXXRecordDecl 0x7ce2a834fca0  col:8 struct E
| `-ClassTemplateSpecialization 0x7ce2a8350218 'E'
`-ClassTemplateSpecializationDecl 0x7ce2a8350218  
col:8 struct E explicit_specialization
  `-TemplateArgument structural value '1+2i'
```

>From a382aa9de206a194397f9424150f170d35101b42 Mon Sep 17 00:00:00 2001
From: sakria9 
Date: Sat, 8 Feb 2025 04:00:08 +
Subject: [PATCH] [ASTDump] Add support for structural value template arguments
 in TextNodeDumper

---
 clang/include/clang/AST/TextNodeDumper.h | 1 +
 clang/lib/AST/TextNodeDumper.cpp | 5 +
 2 files changed, 6 insertions(+)

diff --git a/clang/include/clang/AST/TextNodeDumper.h 
b/clang/include/clang/AST/TextNodeDumper.h
index bfd205ffb0d99ad..4b5ad2b5fa74c04 100644
--- a/clang/include/clang/AST/TextNodeDumper.h
+++ b/clang/include/clang/AST/TextNodeDumper.h
@@ -249,6 +249,7 @@ class TextNodeDumper
   void VisitDeclarationTemplateArgument(const TemplateArgument &TA);
   void VisitNullPtrTemplateArgument(const TemplateArgument &TA);
   void VisitIntegralTemplateArgument(const TemplateArgument &TA);
+  void VisitStructuralValueTemplateArgument(const TemplateArgument &TA);
   void VisitTemplateTemplateArgument(const TemplateArgument &TA);
   void VisitTemplateExpansionTemplateArgument(const TemplateArgument &TA);
   void VisitExpressionTemplateArgument(const TemplateArgument &TA);
diff --git a/clang/lib/AST/TextNodeDumper.cpp b/clang/lib/AST/TextNodeDumper.cpp
index 6da1f776b4b6357..cb0c742177d2c7f 100644
--- a/clang/lib/AST/TextNodeDumper.cpp
+++ b/clang/lib/AST/TextNodeDumper.cpp
@@ -1226,6 +1226,11 @@ void TextNodeDumper::VisitIntegralTemplateArgument(const 
TemplateArgument &TA) {
   dumpTemplateArgument(TA);
 }
 
+void TextNodeDumper::VisitStructuralValueTemplateArgument(const 
TemplateArgument &TA) {
+  OS << " structural value";
+  dumpTemplateArgument(TA);
+}
+
 void TextNodeDumper::dumpTemplateName(TemplateName TN, StringRef Label) {
   AddChild(Label, [=] {
 {

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


[clang] Fix print module manifest file for macos (PR #122370)

2025-02-07 Thread via cfe-commits

https://github.com/Armanidashh commented:

Deontae

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


[clang] [clang-format] add BinPackLongBracedLists style option (PR #112482)

2025-02-07 Thread Gedare Bloom via cfe-commits

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

>From 8282f754ae40b64a88e2d22a6cb21e7028da8371 Mon Sep 17 00:00:00 2001
From: Gedare Bloom 
Date: Tue, 15 Oct 2024 23:55:49 -0600
Subject: [PATCH 1/4] [clang-format] add BinPackLongBracedList style option

The use of Cpp11BracedListStyle with BinPackParameters=False
avoids bin packing until reaching a hard-coded limit of 20 items.
This is an arbitrary choice. Introduce a new style option to
allow disabling this limit.
---
 clang/include/clang/Format/Format.h| 20 +
 clang/lib/Format/Format.cpp|  2 ++
 clang/lib/Format/FormatToken.cpp   |  2 +-
 clang/unittests/Format/ConfigParseTest.cpp |  1 +
 clang/unittests/Format/FormatTest.cpp  | 26 ++
 5 files changed, 50 insertions(+), 1 deletion(-)

diff --git a/clang/include/clang/Format/Format.h 
b/clang/include/clang/Format/Format.h
index fbc9291ae950d41..476d9d4cf4ba1cb 100644
--- a/clang/include/clang/Format/Format.h
+++ b/clang/include/clang/Format/Format.h
@@ -1212,6 +1212,22 @@ struct FormatStyle {
   /// \version 3.7
   bool BinPackArguments;
 
+  /// If ``BinPackLongBracedLists`` is ``true`` it overrides
+  /// ``BinPackArguments`` if there are 20 or more items in a braced
+  /// initializer list.
+  /// \code
+  ///BinPackLongBracedLists: false  vs.   BinPackLongBracedLists: true
+  ///vector x{   vector x{1, 2, ...,
+  ///   20, 21};
+  ///1,
+  ///2,
+  ///...,
+  ///20,
+  ///21};
+  /// \endcode
+  /// \version 21
+  bool BinPackLongBracedLists;
+
   /// Different way to try to fit all parameters on a line.
   enum BinPackParametersStyle : int8_t {
 /// Bin-pack parameters.
@@ -2547,6 +2563,9 @@ struct FormatStyle {
   /// (e.g. a type or variable name), clang-format formats as if the ``{}`` 
were
   /// the parentheses of a function call with that name. If there is no name,
   /// a zero-length name is assumed.
+  ///
+  /// ``BinPackArguments`` may be forced to true for initializer lists with
+  /// more than 20 items if ``BinPackLongBracedLists`` is true.
   /// \code
   ///true:  false:
   ///vector x{1, 2, 3, 4}; vs. vector x{ 1, 2, 3, 4 };
@@ -5266,6 +5285,7 @@ struct FormatStyle {
R.AlwaysBreakBeforeMultilineStrings &&
AttributeMacros == R.AttributeMacros &&
BinPackArguments == R.BinPackArguments &&
+   BinPackLongBracedLists == R.BinPackLongBracedLists &&
BinPackParameters == R.BinPackParameters &&
BitFieldColonSpacing == R.BitFieldColonSpacing &&
BracedInitializerIndentWidth == R.BracedInitializerIndentWidth &&
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index 387daad934f67ac..b9dd541a3dda2a6 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -995,6 +995,7 @@ template <> struct MappingTraits {
Style.AlwaysBreakBeforeMultilineStrings);
 IO.mapOptional("AttributeMacros", Style.AttributeMacros);
 IO.mapOptional("BinPackArguments", Style.BinPackArguments);
+IO.mapOptional("BinPackLongBracedLists", Style.BinPackLongBracedLists);
 IO.mapOptional("BinPackParameters", Style.BinPackParameters);
 IO.mapOptional("BitFieldColonSpacing", Style.BitFieldColonSpacing);
 IO.mapOptional("BracedInitializerIndentWidth",
@@ -1507,6 +1508,7 @@ FormatStyle getLLVMStyle(FormatStyle::LanguageKind 
Language) {
   LLVMStyle.AlwaysBreakBeforeMultilineStrings = false;
   LLVMStyle.AttributeMacros.push_back("__capability");
   LLVMStyle.BinPackArguments = true;
+  LLVMStyle.BinPackLongBracedLists = true;
   LLVMStyle.BinPackParameters = FormatStyle::BPPS_BinPack;
   LLVMStyle.BitFieldColonSpacing = FormatStyle::BFCS_Both;
   LLVMStyle.BracedInitializerIndentWidth = std::nullopt;
diff --git a/clang/lib/Format/FormatToken.cpp b/clang/lib/Format/FormatToken.cpp
index 99bce1f5f09851e..239781129d7b96f 100644
--- a/clang/lib/Format/FormatToken.cpp
+++ b/clang/lib/Format/FormatToken.cpp
@@ -175,7 +175,7 @@ void CommaSeparatedList::precomputeFormattingInfos(const 
FormatToken *Token) {
   // have many items (20 or more) or we allow bin-packing of function call
   // arguments.
   if (Style.Cpp11BracedListStyle && !Style.BinPackArguments &&
-  Commas.size() < 19) {
+  (Commas.size() < 19 || !Style.BinPackLongBracedLists)) {
 return;
   }
 
diff --git a/clang/unittests/Format/ConfigParseTest.cpp 
b/clang/unittests/Format/ConfigParseTest.cpp
index 0cb2a1288bfd7ec..1ebc1ac2faa817a 100644
--- a/clang/unittests/Format/ConfigParseTest.cpp
+++ b/clang/unittests/Format/ConfigParseTest.cpp
@@ -168,6 +168,7 @@ TEST(ConfigParseTest, ParsesConfigurationBools) {
   CHECK_PARSE_BOOL(AllowShortLoopsOnASingleLine);
   CHECK_PARSE_BOOL(AllowSho

[clang] [clang-format] add BinPackLongBracedLists style option (PR #112482)

2025-02-07 Thread Gedare Bloom via cfe-commits

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

>From 8282f754ae40b64a88e2d22a6cb21e7028da8371 Mon Sep 17 00:00:00 2001
From: Gedare Bloom 
Date: Tue, 15 Oct 2024 23:55:49 -0600
Subject: [PATCH 1/6] [clang-format] add BinPackLongBracedList style option

The use of Cpp11BracedListStyle with BinPackParameters=False
avoids bin packing until reaching a hard-coded limit of 20 items.
This is an arbitrary choice. Introduce a new style option to
allow disabling this limit.
---
 clang/include/clang/Format/Format.h| 20 +
 clang/lib/Format/Format.cpp|  2 ++
 clang/lib/Format/FormatToken.cpp   |  2 +-
 clang/unittests/Format/ConfigParseTest.cpp |  1 +
 clang/unittests/Format/FormatTest.cpp  | 26 ++
 5 files changed, 50 insertions(+), 1 deletion(-)

diff --git a/clang/include/clang/Format/Format.h 
b/clang/include/clang/Format/Format.h
index fbc9291ae950d41..476d9d4cf4ba1cb 100644
--- a/clang/include/clang/Format/Format.h
+++ b/clang/include/clang/Format/Format.h
@@ -1212,6 +1212,22 @@ struct FormatStyle {
   /// \version 3.7
   bool BinPackArguments;
 
+  /// If ``BinPackLongBracedLists`` is ``true`` it overrides
+  /// ``BinPackArguments`` if there are 20 or more items in a braced
+  /// initializer list.
+  /// \code
+  ///BinPackLongBracedLists: false  vs.   BinPackLongBracedLists: true
+  ///vector x{   vector x{1, 2, ...,
+  ///   20, 21};
+  ///1,
+  ///2,
+  ///...,
+  ///20,
+  ///21};
+  /// \endcode
+  /// \version 21
+  bool BinPackLongBracedLists;
+
   /// Different way to try to fit all parameters on a line.
   enum BinPackParametersStyle : int8_t {
 /// Bin-pack parameters.
@@ -2547,6 +2563,9 @@ struct FormatStyle {
   /// (e.g. a type or variable name), clang-format formats as if the ``{}`` 
were
   /// the parentheses of a function call with that name. If there is no name,
   /// a zero-length name is assumed.
+  ///
+  /// ``BinPackArguments`` may be forced to true for initializer lists with
+  /// more than 20 items if ``BinPackLongBracedLists`` is true.
   /// \code
   ///true:  false:
   ///vector x{1, 2, 3, 4}; vs. vector x{ 1, 2, 3, 4 };
@@ -5266,6 +5285,7 @@ struct FormatStyle {
R.AlwaysBreakBeforeMultilineStrings &&
AttributeMacros == R.AttributeMacros &&
BinPackArguments == R.BinPackArguments &&
+   BinPackLongBracedLists == R.BinPackLongBracedLists &&
BinPackParameters == R.BinPackParameters &&
BitFieldColonSpacing == R.BitFieldColonSpacing &&
BracedInitializerIndentWidth == R.BracedInitializerIndentWidth &&
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index 387daad934f67ac..b9dd541a3dda2a6 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -995,6 +995,7 @@ template <> struct MappingTraits {
Style.AlwaysBreakBeforeMultilineStrings);
 IO.mapOptional("AttributeMacros", Style.AttributeMacros);
 IO.mapOptional("BinPackArguments", Style.BinPackArguments);
+IO.mapOptional("BinPackLongBracedLists", Style.BinPackLongBracedLists);
 IO.mapOptional("BinPackParameters", Style.BinPackParameters);
 IO.mapOptional("BitFieldColonSpacing", Style.BitFieldColonSpacing);
 IO.mapOptional("BracedInitializerIndentWidth",
@@ -1507,6 +1508,7 @@ FormatStyle getLLVMStyle(FormatStyle::LanguageKind 
Language) {
   LLVMStyle.AlwaysBreakBeforeMultilineStrings = false;
   LLVMStyle.AttributeMacros.push_back("__capability");
   LLVMStyle.BinPackArguments = true;
+  LLVMStyle.BinPackLongBracedLists = true;
   LLVMStyle.BinPackParameters = FormatStyle::BPPS_BinPack;
   LLVMStyle.BitFieldColonSpacing = FormatStyle::BFCS_Both;
   LLVMStyle.BracedInitializerIndentWidth = std::nullopt;
diff --git a/clang/lib/Format/FormatToken.cpp b/clang/lib/Format/FormatToken.cpp
index 99bce1f5f09851e..239781129d7b96f 100644
--- a/clang/lib/Format/FormatToken.cpp
+++ b/clang/lib/Format/FormatToken.cpp
@@ -175,7 +175,7 @@ void CommaSeparatedList::precomputeFormattingInfos(const 
FormatToken *Token) {
   // have many items (20 or more) or we allow bin-packing of function call
   // arguments.
   if (Style.Cpp11BracedListStyle && !Style.BinPackArguments &&
-  Commas.size() < 19) {
+  (Commas.size() < 19 || !Style.BinPackLongBracedLists)) {
 return;
   }
 
diff --git a/clang/unittests/Format/ConfigParseTest.cpp 
b/clang/unittests/Format/ConfigParseTest.cpp
index 0cb2a1288bfd7ec..1ebc1ac2faa817a 100644
--- a/clang/unittests/Format/ConfigParseTest.cpp
+++ b/clang/unittests/Format/ConfigParseTest.cpp
@@ -168,6 +168,7 @@ TEST(ConfigParseTest, ParsesConfigurationBools) {
   CHECK_PARSE_BOOL(AllowShortLoopsOnASingleLine);
   CHECK_PARSE_BOOL(AllowSho

[clang] [clang-format] add BinPackLongBracedLists style option (PR #112482)

2025-02-07 Thread Gedare Bloom via cfe-commits

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

>From 8282f754ae40b64a88e2d22a6cb21e7028da8371 Mon Sep 17 00:00:00 2001
From: Gedare Bloom 
Date: Tue, 15 Oct 2024 23:55:49 -0600
Subject: [PATCH 1/7] [clang-format] add BinPackLongBracedList style option

The use of Cpp11BracedListStyle with BinPackParameters=False
avoids bin packing until reaching a hard-coded limit of 20 items.
This is an arbitrary choice. Introduce a new style option to
allow disabling this limit.
---
 clang/include/clang/Format/Format.h| 20 +
 clang/lib/Format/Format.cpp|  2 ++
 clang/lib/Format/FormatToken.cpp   |  2 +-
 clang/unittests/Format/ConfigParseTest.cpp |  1 +
 clang/unittests/Format/FormatTest.cpp  | 26 ++
 5 files changed, 50 insertions(+), 1 deletion(-)

diff --git a/clang/include/clang/Format/Format.h 
b/clang/include/clang/Format/Format.h
index fbc9291ae950d41..476d9d4cf4ba1cb 100644
--- a/clang/include/clang/Format/Format.h
+++ b/clang/include/clang/Format/Format.h
@@ -1212,6 +1212,22 @@ struct FormatStyle {
   /// \version 3.7
   bool BinPackArguments;
 
+  /// If ``BinPackLongBracedLists`` is ``true`` it overrides
+  /// ``BinPackArguments`` if there are 20 or more items in a braced
+  /// initializer list.
+  /// \code
+  ///BinPackLongBracedLists: false  vs.   BinPackLongBracedLists: true
+  ///vector x{   vector x{1, 2, ...,
+  ///   20, 21};
+  ///1,
+  ///2,
+  ///...,
+  ///20,
+  ///21};
+  /// \endcode
+  /// \version 21
+  bool BinPackLongBracedLists;
+
   /// Different way to try to fit all parameters on a line.
   enum BinPackParametersStyle : int8_t {
 /// Bin-pack parameters.
@@ -2547,6 +2563,9 @@ struct FormatStyle {
   /// (e.g. a type or variable name), clang-format formats as if the ``{}`` 
were
   /// the parentheses of a function call with that name. If there is no name,
   /// a zero-length name is assumed.
+  ///
+  /// ``BinPackArguments`` may be forced to true for initializer lists with
+  /// more than 20 items if ``BinPackLongBracedLists`` is true.
   /// \code
   ///true:  false:
   ///vector x{1, 2, 3, 4}; vs. vector x{ 1, 2, 3, 4 };
@@ -5266,6 +5285,7 @@ struct FormatStyle {
R.AlwaysBreakBeforeMultilineStrings &&
AttributeMacros == R.AttributeMacros &&
BinPackArguments == R.BinPackArguments &&
+   BinPackLongBracedLists == R.BinPackLongBracedLists &&
BinPackParameters == R.BinPackParameters &&
BitFieldColonSpacing == R.BitFieldColonSpacing &&
BracedInitializerIndentWidth == R.BracedInitializerIndentWidth &&
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index 387daad934f67ac..b9dd541a3dda2a6 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -995,6 +995,7 @@ template <> struct MappingTraits {
Style.AlwaysBreakBeforeMultilineStrings);
 IO.mapOptional("AttributeMacros", Style.AttributeMacros);
 IO.mapOptional("BinPackArguments", Style.BinPackArguments);
+IO.mapOptional("BinPackLongBracedLists", Style.BinPackLongBracedLists);
 IO.mapOptional("BinPackParameters", Style.BinPackParameters);
 IO.mapOptional("BitFieldColonSpacing", Style.BitFieldColonSpacing);
 IO.mapOptional("BracedInitializerIndentWidth",
@@ -1507,6 +1508,7 @@ FormatStyle getLLVMStyle(FormatStyle::LanguageKind 
Language) {
   LLVMStyle.AlwaysBreakBeforeMultilineStrings = false;
   LLVMStyle.AttributeMacros.push_back("__capability");
   LLVMStyle.BinPackArguments = true;
+  LLVMStyle.BinPackLongBracedLists = true;
   LLVMStyle.BinPackParameters = FormatStyle::BPPS_BinPack;
   LLVMStyle.BitFieldColonSpacing = FormatStyle::BFCS_Both;
   LLVMStyle.BracedInitializerIndentWidth = std::nullopt;
diff --git a/clang/lib/Format/FormatToken.cpp b/clang/lib/Format/FormatToken.cpp
index 99bce1f5f09851e..239781129d7b96f 100644
--- a/clang/lib/Format/FormatToken.cpp
+++ b/clang/lib/Format/FormatToken.cpp
@@ -175,7 +175,7 @@ void CommaSeparatedList::precomputeFormattingInfos(const 
FormatToken *Token) {
   // have many items (20 or more) or we allow bin-packing of function call
   // arguments.
   if (Style.Cpp11BracedListStyle && !Style.BinPackArguments &&
-  Commas.size() < 19) {
+  (Commas.size() < 19 || !Style.BinPackLongBracedLists)) {
 return;
   }
 
diff --git a/clang/unittests/Format/ConfigParseTest.cpp 
b/clang/unittests/Format/ConfigParseTest.cpp
index 0cb2a1288bfd7ec..1ebc1ac2faa817a 100644
--- a/clang/unittests/Format/ConfigParseTest.cpp
+++ b/clang/unittests/Format/ConfigParseTest.cpp
@@ -168,6 +168,7 @@ TEST(ConfigParseTest, ParsesConfigurationBools) {
   CHECK_PARSE_BOOL(AllowShortLoopsOnASingleLine);
   CHECK_PARSE_BOOL(AllowSho

[clang] [clang-format] add BinPackLongBracedLists style option (PR #112482)

2025-02-07 Thread Gedare Bloom via cfe-commits

gedare wrote:

Review comments addressed. Nice splitting of the test case.

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


[clang] [clang] [ASTDump] Add support for structural value template arguments in TextNodeDumper (PR #126341)

2025-02-07 Thread Younan Zhang via cfe-commits

https://github.com/zyn0217 commented:

Thanks for the patch. This needs a test and a release note.

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


[clang] [HLSL][RootSignature] Implement Lexing of DescriptorTables (PR #122981)

2025-02-07 Thread Damyan Pepper via cfe-commits

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


[clang] [HLSL][RootSignature] Implement Lexing of DescriptorTables (PR #122981)

2025-02-07 Thread Damyan Pepper via cfe-commits


@@ -0,0 +1,171 @@
+#include "clang/Parse/ParseHLSLRootSignature.h"
+
+namespace clang {
+namespace hlsl {
+
+// Lexer Definitions
+
+static bool IsNumberChar(char C) {
+  // TODO(#120472): extend for float support exponents

damyanp wrote:

The issue linked here (#120472) is just about implementing the parser. Is there 
a reason not to get float tokens recognized by the lexer?

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


[clang] [HLSL][RootSignature] Implement Lexing of DescriptorTables (PR #122981)

2025-02-07 Thread Damyan Pepper via cfe-commits

https://github.com/damyanp commented:

LGTM - I'm surprised we don't have all of the tokens we're going to need for 
root signatures included in this PR.

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


[clang] [C++20][Modules][Serialization] Add an additional test case for #120277. (PR #126349)

2025-02-07 Thread Michael Park via cfe-commits

https://github.com/mpark created 
https://github.com/llvm/llvm-project/pull/126349

https://github.com/llvm/llvm-project/commit/4b35dd57b88a59b169c3471cbc398113d3bf98e8
 was shipped to address https://github.com/llvm/llvm-project/issues/120277 .

It was thought to be a regression in 19.x according to this comment: 
https://github.com/llvm/llvm-project/issues/120277#issuecomment-2558991129

This is a test case that fails even in 17.x but nevertheless is also fixed by: 
https://github.com/llvm/llvm-project/commit/4b35dd57b88a59b169c3471cbc398113d3bf98e8
 .

>From 832f6dc5a6b4d8cb72ba161e2a5d9e808ec9b340 Mon Sep 17 00:00:00 2001
From: Michael Park 
Date: Fri, 7 Feb 2025 21:23:26 -0800
Subject: [PATCH] [C++20][Modules][Serialization] Add an additional test case
 for #120277.

https://github.com/llvm/llvm-project/commit/4b35dd57b88a59b169c3471cbc398113d3bf98e8
was shipped to address https://github.com/llvm/llvm-project/issues/120277 .

It was thought to be a regression in 19.x according to this comment:
https://github.com/llvm/llvm-project/issues/120277#issuecomment-2558991129

This is a test case that fails even in 17.x but nevertheless is also fixed by:
https://github.com/llvm/llvm-project/commit/4b35dd57b88a59b169c3471cbc398113d3bf98e8
 .
---
 clang/test/Modules/pr120277-2.cpp | 69 +++
 1 file changed, 69 insertions(+)
 create mode 100644 clang/test/Modules/pr120277-2.cpp

diff --git a/clang/test/Modules/pr120277-2.cpp 
b/clang/test/Modules/pr120277-2.cpp
new file mode 100644
index 000..1ed8fc52cb1ef7a
--- /dev/null
+++ b/clang/test/Modules/pr120277-2.cpp
@@ -0,0 +1,69 @@
+// RUN: rm -rf %t
+// RUN: mkdir -p %t
+// RUN: split-file %s %t
+// RUN: cd %t
+
+// RUN: %clang_cc1 -std=c++20 -emit-header-unit -xc++-user-header %t/hu-01.h \
+// RUN:  -fcxx-exceptions -o %t/hu-01.pcm
+
+// RUN: %clang_cc1 -std=c++20 -emit-header-unit -xc++-user-header %t/hu-02.h \
+// RUN:  -Wno-experimental-header-units -fcxx-exceptions \
+// RUN:  -fmodule-file=%t/hu-01.pcm -o %t/hu-02.pcm
+
+// RUN: %clang_cc1 -std=c++20 -emit-header-unit -xc++-user-header %t/hu-03.h \
+// RUN:  -Wno-experimental-header-units -fcxx-exceptions \
+// RUN:  -fmodule-file=%t/hu-01.pcm -o %t/hu-03.pcm
+
+// RUN: %clang_cc1 -std=c++20 -emit-header-unit -xc++-user-header %t/hu-04.h \
+// RUN:  -Wno-experimental-header-units -fcxx-exceptions \
+// RUN:  -fmodule-file=%t/hu-02.pcm -fmodule-file=%t/hu-03.pcm -o %t/hu-04.pcm
+
+// RUN: %clang_cc1 -std=c++20 -emit-obj %t/main.cpp \
+// RUN:  -Wno-experimental-header-units -fcxx-exceptions \
+// RUN:  -fmodule-file=%t/hu-04.pcm
+//--- hu-01.h
+template 
+struct A {
+  ~A() { f(); }
+  auto f() const { return 0; }
+};
+
+template 
+struct B {
+  int g() const { return a.f(); }
+  A a;
+};
+
+//--- hu-02.h
+import "hu-01.h";
+
+template 
+struct C {
+  void h() {
+B().g();
+  }
+};
+
+template struct A;
+
+//--- hu-03.h
+import "hu-01.h";
+
+inline B b() {
+  return {};
+}
+
+//--- hu-04.h
+import "hu-02.h";
+import "hu-03.h";
+
+inline void f4() {
+  C{}.h();
+}
+
+//--- main.cpp
+import "hu-04.h";
+
+int main() {
+  f4();
+}

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


[clang] [C++20][Modules][Serialization] Add an additional test case for #120277. (PR #126349)

2025-02-07 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang-modules

Author: Michael Park (mpark)


Changes

https://github.com/llvm/llvm-project/commit/4b35dd57b88a59b169c3471cbc398113d3bf98e8
 was shipped to address https://github.com/llvm/llvm-project/issues/120277 .

It was thought to be a regression in 19.x according to this comment: 
https://github.com/llvm/llvm-project/issues/120277#issuecomment-2558991129

This is a test case that fails even in 17.x but nevertheless is also fixed by: 
https://github.com/llvm/llvm-project/commit/4b35dd57b88a59b169c3471cbc398113d3bf98e8
 .

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


1 Files Affected:

- (added) clang/test/Modules/pr120277-2.cpp (+69) 


``diff
diff --git a/clang/test/Modules/pr120277-2.cpp 
b/clang/test/Modules/pr120277-2.cpp
new file mode 100644
index 000..1ed8fc52cb1ef7a
--- /dev/null
+++ b/clang/test/Modules/pr120277-2.cpp
@@ -0,0 +1,69 @@
+// RUN: rm -rf %t
+// RUN: mkdir -p %t
+// RUN: split-file %s %t
+// RUN: cd %t
+
+// RUN: %clang_cc1 -std=c++20 -emit-header-unit -xc++-user-header %t/hu-01.h \
+// RUN:  -fcxx-exceptions -o %t/hu-01.pcm
+
+// RUN: %clang_cc1 -std=c++20 -emit-header-unit -xc++-user-header %t/hu-02.h \
+// RUN:  -Wno-experimental-header-units -fcxx-exceptions \
+// RUN:  -fmodule-file=%t/hu-01.pcm -o %t/hu-02.pcm
+
+// RUN: %clang_cc1 -std=c++20 -emit-header-unit -xc++-user-header %t/hu-03.h \
+// RUN:  -Wno-experimental-header-units -fcxx-exceptions \
+// RUN:  -fmodule-file=%t/hu-01.pcm -o %t/hu-03.pcm
+
+// RUN: %clang_cc1 -std=c++20 -emit-header-unit -xc++-user-header %t/hu-04.h \
+// RUN:  -Wno-experimental-header-units -fcxx-exceptions \
+// RUN:  -fmodule-file=%t/hu-02.pcm -fmodule-file=%t/hu-03.pcm -o %t/hu-04.pcm
+
+// RUN: %clang_cc1 -std=c++20 -emit-obj %t/main.cpp \
+// RUN:  -Wno-experimental-header-units -fcxx-exceptions \
+// RUN:  -fmodule-file=%t/hu-04.pcm
+//--- hu-01.h
+template 
+struct A {
+  ~A() { f(); }
+  auto f() const { return 0; }
+};
+
+template 
+struct B {
+  int g() const { return a.f(); }
+  A a;
+};
+
+//--- hu-02.h
+import "hu-01.h";
+
+template 
+struct C {
+  void h() {
+B().g();
+  }
+};
+
+template struct A;
+
+//--- hu-03.h
+import "hu-01.h";
+
+inline B b() {
+  return {};
+}
+
+//--- hu-04.h
+import "hu-02.h";
+import "hu-03.h";
+
+inline void f4() {
+  C{}.h();
+}
+
+//--- main.cpp
+import "hu-04.h";
+
+int main() {
+  f4();
+}

``




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


[clang] [sanitizer] [clang] Introduce fsanitize-bounds-strict-flex-arrays (PR #126163)

2025-02-07 Thread Eli Friedman via cfe-commits

efriedma-quic wrote:

What else even uses the level?  __builtin_object_size codegen?  Can you add a 
DocBrief to the flag explaining when you'd want to use it?

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


[clang] [libcxx] Reland: [clang] unified CWG2398 and P0522 changes; finishes implementation of P3310 (PR #124137)

2025-02-07 Thread via cfe-commits

llvmbot wrote:


Failed to cherry-pick: 28ad8978ee2054298d4198bf10c8cb68730af037

https://github.com/llvm/llvm-project/actions/runs/13209349652

Please manually backport the fix and push it to your github fork.  Once this is 
done, please create a [pull 
request](https://github.com/llvm/llvm-project/compare)

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


[clang] [Clang] Add __has_target_builtin macro (PR #126324)

2025-02-07 Thread Nick Sarnie via cfe-commits

https://github.com/sarnex created 
https://github.com/llvm/llvm-project/pull/126324

None

>From fe555ce59762edf71f43d0cd61978d60f5f949ef Mon Sep 17 00:00:00 2001
From: "Sarnie, Nick" 
Date: Fri, 7 Feb 2025 14:57:12 -0800
Subject: [PATCH] [Clang] Add __has_target_builtin macro

Signed-off-by: Sarnie, Nick 
---
 clang/docs/LanguageExtensions.rst | 33 +++
 clang/include/clang/Lex/Preprocessor.h|  1 +
 clang/lib/Lex/PPMacroExpansion.cpp| 17 +++---
 .../test/Preprocessor/has_target_builtin.cpp  | 18 ++
 4 files changed, 64 insertions(+), 5 deletions(-)
 create mode 100644 clang/test/Preprocessor/has_target_builtin.cpp

diff --git a/clang/docs/LanguageExtensions.rst 
b/clang/docs/LanguageExtensions.rst
index 973cf8f9d091c30..87f7df50471e790 100644
--- a/clang/docs/LanguageExtensions.rst
+++ b/clang/docs/LanguageExtensions.rst
@@ -67,6 +67,10 @@ It can be used like this:
   ``__has_builtin`` should not be used to detect support for a builtin macro;
   use ``#ifdef`` instead.
 
+  When using device offloading, a builtin is considered available if it is
+  available on either the host or the device targets.
+  Use ``__has_target_builtin`` to consider only the current target.
+
 ``__has_constexpr_builtin``
 ---
 
@@ -96,6 +100,35 @@ the  header file to conditionally make a 
function constexpr whenever
 the constant evaluation of the corresponding builtin (for example,
 ``std::fmax`` calls ``__builtin_fmax``) is supported in Clang.
 
+``__has_target_builtin``
+-
+
+This function-like macro takes a single identifier argument that is the name of
+a builtin function, a builtin pseudo-function (taking one or more type
+arguments), or a builtin template.
+It evaluates to 1 if the builtin is supported on the current target or 0 if 
not.
+The behavior is different than ``__has_builtin`` when there is an auxiliary 
target,
+such when offloading to a target device.
+It can be used like this:
+
+.. code-block:: c++
+
+  #ifndef __has_target_builtin // Optional of course.
+#define __has_target_builtin(x) 0  // Compatibility with non-clang 
compilers.
+  #endif
+
+  ...
+  #if __has_target_builtin(__builtin_trap)
+__builtin_trap();
+  #else
+abort();
+  #endif
+  ...
+
+.. note::
+  ``__has_target_builtin`` should not be used to detect support for a builtin 
macro;
+  use ``#ifdef`` instead.
+
 .. _langext-__has_feature-__has_extension:
 
 ``__has_feature`` and ``__has_extension``
diff --git a/clang/include/clang/Lex/Preprocessor.h 
b/clang/include/clang/Lex/Preprocessor.h
index 2bf4d1a16699430..240fe28aba93e33 100644
--- a/clang/include/clang/Lex/Preprocessor.h
+++ b/clang/include/clang/Lex/Preprocessor.h
@@ -174,6 +174,7 @@ class Preprocessor {
   IdentifierInfo *Ident__has_extension;// __has_extension
   IdentifierInfo *Ident__has_builtin;  // __has_builtin
   IdentifierInfo *Ident__has_constexpr_builtin;// __has_constexpr_builtin
+  IdentifierInfo *Ident__has_target_builtin;   // __has_target_builtin
   IdentifierInfo *Ident__has_attribute;// __has_attribute
   IdentifierInfo *Ident__has_embed;// __has_embed
   IdentifierInfo *Ident__has_include;  // __has_include
diff --git a/clang/lib/Lex/PPMacroExpansion.cpp 
b/clang/lib/Lex/PPMacroExpansion.cpp
index 347c13da0ad215a..b7b870e1a7fca82 100644
--- a/clang/lib/Lex/PPMacroExpansion.cpp
+++ b/clang/lib/Lex/PPMacroExpansion.cpp
@@ -357,6 +357,7 @@ void Preprocessor::RegisterBuiltinMacros() {
   Ident__has_builtin = RegisterBuiltinMacro("__has_builtin");
   Ident__has_constexpr_builtin =
   RegisterBuiltinMacro("__has_constexpr_builtin");
+  Ident__has_target_builtin = RegisterBuiltinMacro("__has_target_builtin");
   Ident__has_attribute = RegisterBuiltinMacro("__has_attribute");
   if (!getLangOpts().CPlusPlus)
 Ident__has_c_attribute = RegisterBuiltinMacro("__has_c_attribute");
@@ -1797,15 +1798,17 @@ void Preprocessor::ExpandBuiltinMacro(Token &Tok) {
diag::err_feature_check_malformed);
 return II && HasExtension(*this, II->getName());
   });
-  } else if (II == Ident__has_builtin) {
+  } else if (II == Ident__has_builtin || II == Ident__has_target_builtin) {
+bool IsHasTargetBuiltin = II == Ident__has_target_builtin;
 EvaluateFeatureLikeBuiltinMacro(OS, Tok, II, *this, false,
-  [this](Token &Tok, bool &HasLexedNextToken) -> int {
+  [this, IsHasTargetBuiltin](Token &Tok, bool &HasLexedNextToken) -> int {
 IdentifierInfo *II = ExpectFeatureIdentifierInfo(Tok, *this,
diag::err_feature_check_malformed);
 if (!II)
   return false;
-else if (II->getBuiltinID() != 0) {
-  switch (II->getBuiltinID()) {
+auto BuiltinID = II->getBuiltinID();
+if (BuiltinID != 0) {
+  switch (BuiltinID) {
   case B

[clang] [Clang] Add __has_target_builtin macro (PR #126324)

2025-02-07 Thread Nick Sarnie via cfe-commits

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


[clang] Reland: [clang] Track function template instantiation from definition (PR #125266)

2025-02-07 Thread Matheus Izvekov via cfe-commits

mizvekov wrote:

/cherry-pick 346077aaa6bef5652a72a2f3d9fc134ea8fc6a5b

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


[clang] [Clang] Add __has_target_builtin macro (PR #126324)

2025-02-07 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 4df287a171b63514a5028b85272fcc1b89555ee4 
fe555ce59762edf71f43d0cd61978d60f5f949ef --extensions h,cpp -- 
clang/test/Preprocessor/has_target_builtin.cpp 
clang/include/clang/Lex/Preprocessor.h clang/lib/Lex/PPMacroExpansion.cpp
``





View the diff from clang-format here.


``diff
diff --git a/clang/lib/Lex/PPMacroExpansion.cpp 
b/clang/lib/Lex/PPMacroExpansion.cpp
index b7b870e1a7..23a693b105 100644
--- a/clang/lib/Lex/PPMacroExpansion.cpp
+++ b/clang/lib/Lex/PPMacroExpansion.cpp
@@ -1800,59 +1800,60 @@ void Preprocessor::ExpandBuiltinMacro(Token &Tok) {
   });
   } else if (II == Ident__has_builtin || II == Ident__has_target_builtin) {
 bool IsHasTargetBuiltin = II == Ident__has_target_builtin;
-EvaluateFeatureLikeBuiltinMacro(OS, Tok, II, *this, false,
-  [this, IsHasTargetBuiltin](Token &Tok, bool &HasLexedNextToken) -> int {
-IdentifierInfo *II = ExpectFeatureIdentifierInfo(Tok, *this,
-   diag::err_feature_check_malformed);
-if (!II)
-  return false;
-auto BuiltinID = II->getBuiltinID();
-if (BuiltinID != 0) {
-  switch (BuiltinID) {
-  case Builtin::BI__builtin_cpu_is:
-return getTargetInfo().supportsCpuIs();
-  case Builtin::BI__builtin_cpu_init:
-return getTargetInfo().supportsCpuInit();
-  case Builtin::BI__builtin_cpu_supports:
-return getTargetInfo().supportsCpuSupports();
-  case Builtin::BI__builtin_operator_new:
-  case Builtin::BI__builtin_operator_delete:
-// denotes date of behavior change to support calling arbitrary
-// usual allocation and deallocation functions. Required by libc++
-return 201802;
-  default:
-// __has_target_builtin should return false for aux builtins.
-if(IsHasTargetBuiltin &&
-   getBuiltinInfo().isAuxBuiltinID(BuiltinID))
+EvaluateFeatureLikeBuiltinMacro(
+OS, Tok, II, *this, false,
+[this, IsHasTargetBuiltin](Token &Tok, bool &HasLexedNextToken) -> int 
{
+  IdentifierInfo *II = ExpectFeatureIdentifierInfo(
+  Tok, *this, diag::err_feature_check_malformed);
+  if (!II)
+return false;
+  auto BuiltinID = II->getBuiltinID();
+  if (BuiltinID != 0) {
+switch (BuiltinID) {
+case Builtin::BI__builtin_cpu_is:
+  return getTargetInfo().supportsCpuIs();
+case Builtin::BI__builtin_cpu_init:
+  return getTargetInfo().supportsCpuInit();
+case Builtin::BI__builtin_cpu_supports:
+  return getTargetInfo().supportsCpuSupports();
+case Builtin::BI__builtin_operator_new:
+case Builtin::BI__builtin_operator_delete:
+  // denotes date of behavior change to support calling arbitrary
+  // usual allocation and deallocation functions. Required by 
libc++
+  return 201802;
+default:
+  // __has_target_builtin should return false for aux builtins.
+  if (IsHasTargetBuiltin &&
+  getBuiltinInfo().isAuxBuiltinID(BuiltinID))
 return false;
-return Builtin::evaluateRequiredTargetFeatures(
-getBuiltinInfo().getRequiredFeatures(BuiltinID),
-getTargetInfo().getTargetOpts().FeatureMap);
+  return Builtin::evaluateRequiredTargetFeatures(
+  getBuiltinInfo().getRequiredFeatures(BuiltinID),
+  getTargetInfo().getTargetOpts().FeatureMap);
+}
+return true;
+  } else if (IsBuiltinTrait(Tok)) {
+return true;
+  } else if (II->getTokenID() != tok::identifier &&
+ II->getName().starts_with("__builtin_")) {
+return true;
+  } else {
+return llvm::StringSwitch(II->getName())
+// Report builtin templates as being builtins.
+.Case("__make_integer_seq", getLangOpts().CPlusPlus)
+.Case("__type_pack_element", getLangOpts().CPlusPlus)
+.Case("__builtin_common_type", getLangOpts().CPlusPlus)
+// Likewise for some builtin preprocessor macros.
+// FIXME: This is inconsistent; we usually suggest detecting
+// builtin macros via #ifdef. Don't add more cases here.
+.Case("__is_target_arch", true)
+.Case("__is_target_vendor", true)
+.Case("__is_target_os", true)
+.Case("__is_target_environment", true)
+.Case("__is_target_variant_os", true)
+.Case("__is_target_var

[clang] [Clang] Add __has_target_builtin macro (PR #126324)

2025-02-07 Thread Nick Sarnie via cfe-commits

https://github.com/sarnex updated 
https://github.com/llvm/llvm-project/pull/126324

>From fe555ce59762edf71f43d0cd61978d60f5f949ef Mon Sep 17 00:00:00 2001
From: "Sarnie, Nick" 
Date: Fri, 7 Feb 2025 14:57:12 -0800
Subject: [PATCH 1/2] [Clang] Add __has_target_builtin macro

Signed-off-by: Sarnie, Nick 
---
 clang/docs/LanguageExtensions.rst | 33 +++
 clang/include/clang/Lex/Preprocessor.h|  1 +
 clang/lib/Lex/PPMacroExpansion.cpp| 17 +++---
 .../test/Preprocessor/has_target_builtin.cpp  | 18 ++
 4 files changed, 64 insertions(+), 5 deletions(-)
 create mode 100644 clang/test/Preprocessor/has_target_builtin.cpp

diff --git a/clang/docs/LanguageExtensions.rst 
b/clang/docs/LanguageExtensions.rst
index 973cf8f9d091c30..87f7df50471e790 100644
--- a/clang/docs/LanguageExtensions.rst
+++ b/clang/docs/LanguageExtensions.rst
@@ -67,6 +67,10 @@ It can be used like this:
   ``__has_builtin`` should not be used to detect support for a builtin macro;
   use ``#ifdef`` instead.
 
+  When using device offloading, a builtin is considered available if it is
+  available on either the host or the device targets.
+  Use ``__has_target_builtin`` to consider only the current target.
+
 ``__has_constexpr_builtin``
 ---
 
@@ -96,6 +100,35 @@ the  header file to conditionally make a 
function constexpr whenever
 the constant evaluation of the corresponding builtin (for example,
 ``std::fmax`` calls ``__builtin_fmax``) is supported in Clang.
 
+``__has_target_builtin``
+-
+
+This function-like macro takes a single identifier argument that is the name of
+a builtin function, a builtin pseudo-function (taking one or more type
+arguments), or a builtin template.
+It evaluates to 1 if the builtin is supported on the current target or 0 if 
not.
+The behavior is different than ``__has_builtin`` when there is an auxiliary 
target,
+such when offloading to a target device.
+It can be used like this:
+
+.. code-block:: c++
+
+  #ifndef __has_target_builtin // Optional of course.
+#define __has_target_builtin(x) 0  // Compatibility with non-clang 
compilers.
+  #endif
+
+  ...
+  #if __has_target_builtin(__builtin_trap)
+__builtin_trap();
+  #else
+abort();
+  #endif
+  ...
+
+.. note::
+  ``__has_target_builtin`` should not be used to detect support for a builtin 
macro;
+  use ``#ifdef`` instead.
+
 .. _langext-__has_feature-__has_extension:
 
 ``__has_feature`` and ``__has_extension``
diff --git a/clang/include/clang/Lex/Preprocessor.h 
b/clang/include/clang/Lex/Preprocessor.h
index 2bf4d1a16699430..240fe28aba93e33 100644
--- a/clang/include/clang/Lex/Preprocessor.h
+++ b/clang/include/clang/Lex/Preprocessor.h
@@ -174,6 +174,7 @@ class Preprocessor {
   IdentifierInfo *Ident__has_extension;// __has_extension
   IdentifierInfo *Ident__has_builtin;  // __has_builtin
   IdentifierInfo *Ident__has_constexpr_builtin;// __has_constexpr_builtin
+  IdentifierInfo *Ident__has_target_builtin;   // __has_target_builtin
   IdentifierInfo *Ident__has_attribute;// __has_attribute
   IdentifierInfo *Ident__has_embed;// __has_embed
   IdentifierInfo *Ident__has_include;  // __has_include
diff --git a/clang/lib/Lex/PPMacroExpansion.cpp 
b/clang/lib/Lex/PPMacroExpansion.cpp
index 347c13da0ad215a..b7b870e1a7fca82 100644
--- a/clang/lib/Lex/PPMacroExpansion.cpp
+++ b/clang/lib/Lex/PPMacroExpansion.cpp
@@ -357,6 +357,7 @@ void Preprocessor::RegisterBuiltinMacros() {
   Ident__has_builtin = RegisterBuiltinMacro("__has_builtin");
   Ident__has_constexpr_builtin =
   RegisterBuiltinMacro("__has_constexpr_builtin");
+  Ident__has_target_builtin = RegisterBuiltinMacro("__has_target_builtin");
   Ident__has_attribute = RegisterBuiltinMacro("__has_attribute");
   if (!getLangOpts().CPlusPlus)
 Ident__has_c_attribute = RegisterBuiltinMacro("__has_c_attribute");
@@ -1797,15 +1798,17 @@ void Preprocessor::ExpandBuiltinMacro(Token &Tok) {
diag::err_feature_check_malformed);
 return II && HasExtension(*this, II->getName());
   });
-  } else if (II == Ident__has_builtin) {
+  } else if (II == Ident__has_builtin || II == Ident__has_target_builtin) {
+bool IsHasTargetBuiltin = II == Ident__has_target_builtin;
 EvaluateFeatureLikeBuiltinMacro(OS, Tok, II, *this, false,
-  [this](Token &Tok, bool &HasLexedNextToken) -> int {
+  [this, IsHasTargetBuiltin](Token &Tok, bool &HasLexedNextToken) -> int {
 IdentifierInfo *II = ExpectFeatureIdentifierInfo(Tok, *this,
diag::err_feature_check_malformed);
 if (!II)
   return false;
-else if (II->getBuiltinID() != 0) {
-  switch (II->getBuiltinID()) {
+auto BuiltinID = II->getBuiltinID();
+if (BuiltinID != 0) {
+  switch (BuiltinID) {
   case Bui

[clang] Reland: [clang] Track function template instantiation from definition (PR #125266)

2025-02-07 Thread via cfe-commits

llvmbot wrote:


Failed to cherry-pick: 346077aaa6bef5652a72a2f3d9fc134ea8fc6a5b

https://github.com/llvm/llvm-project/actions/runs/13209645800

Please manually backport the fix and push it to your github fork.  Once this is 
done, please create a [pull 
request](https://github.com/llvm/llvm-project/compare)

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


[clang] [HLSL] Constant buffer layout struct update (PR #124840)

2025-02-07 Thread Helena Kotas via cfe-commits

https://github.com/hekota updated 
https://github.com/llvm/llvm-project/pull/124840

>From 63c465b40512ad4c5fff84c0b2b022b49d46eaa7 Mon Sep 17 00:00:00 2001
From: Helena Kotas 
Date: Tue, 28 Jan 2025 13:20:30 -0800
Subject: [PATCH 1/6] [HLSL] Constant buffer layout struct update

- create structs with public fields instead of classes with private fields
- add Packed attribute to prevent struct padding
- use __cblayout_ prefix in name
- filter out arrays of resources (bug fix)
- don't create implicit initializer for constant buffer decls
- update tests
---
 clang/lib/Sema/SemaDecl.cpp   |   7 +
 clang/lib/Sema/SemaHLSL.cpp   |  29 ++--
 .../AST/HLSL/ast-dump-comment-cbuffer.hlsl|   3 -
 clang/test/AST/HLSL/cbuffer.hlsl  | 144 ++
 .../test/AST/HLSL/cbuffer_and_namespaces.hlsl |  30 ++--
 clang/test/AST/HLSL/pch_hlsl_buffer.hlsl  |   4 +-
 6 files changed, 121 insertions(+), 96 deletions(-)

diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index fe68eadc951b5ff..ba424567b23e0ba 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -14183,6 +14183,13 @@ void Sema::ActOnUninitializedDecl(Decl *RealDecl) {
 if (getLangOpts().OpenCL &&
 Var->getType().getAddressSpace() == LangAS::opencl_local)
   return;
+
+// In HLSL, objects in the hlsl_constat address space are initialized
+// externaly, so don't synthesize an implicit initializer.
+if (getLangOpts().HLSL &&
+Var->getType().getAddressSpace() == LangAS::hlsl_constant)
+  return;
+
 // C++03 [dcl.init]p9:
 //   If no initializer is specified for an object, and the
 //   object is of (possibly cv-qualified) non-POD class type (or
diff --git a/clang/lib/Sema/SemaHLSL.cpp b/clang/lib/Sema/SemaHLSL.cpp
index aa99b44958eafdd..97df01a5dd3074b 100644
--- a/clang/lib/Sema/SemaHLSL.cpp
+++ b/clang/lib/Sema/SemaHLSL.cpp
@@ -269,8 +269,11 @@ static bool isZeroSizedArray(const ConstantArrayType *CAT) 
{
   return CAT != nullptr;
 }
 
-// Returns true if the record type is an HLSL resource class
-static bool isResourceRecordType(const Type *Ty) {
+// Returns true if the record type is an HLSL resource class or an array of
+// HLSL resource classes
+static bool isResourceRecordTypeOrArrayOf(const Type *Ty) {
+  while (const ConstantArrayType *CAT = dyn_cast(Ty))
+Ty = CAT->getArrayElementTypeNoTypeQual();
   return HLSLAttributedResourceType::findHandleTypeOnResource(Ty) != nullptr;
 }
 
@@ -279,11 +282,10 @@ static bool isResourceRecordType(const Type *Ty) {
 // array, or a builtin intangible type. Returns false it is a valid leaf 
element
 // type or if it is a record type that needs to be inspected further.
 static bool isInvalidConstantBufferLeafElementType(const Type *Ty) {
-  if (Ty->isRecordType()) {
-if (isResourceRecordType(Ty) || Ty->getAsCXXRecordDecl()->isEmpty())
-  return true;
-return false;
-  }
+  if (isResourceRecordTypeOrArrayOf(Ty))
+return true;
+  if (Ty->isRecordType())
+return Ty->getAsCXXRecordDecl()->isEmpty();
   if (Ty->isConstantArrayType() &&
   isZeroSizedArray(cast(Ty)))
 return true;
@@ -339,7 +341,7 @@ static IdentifierInfo *getHostLayoutStructName(Sema &S, 
NamedDecl *BaseDecl,
   ASTContext &AST = S.getASTContext();
 
   IdentifierInfo *NameBaseII = BaseDecl->getIdentifier();
-  llvm::SmallString<64> Name("__layout_");
+  llvm::SmallString<64> Name("__cblayout_");
   if (NameBaseII) {
 Name.append(NameBaseII->getName());
   } else {
@@ -393,7 +395,7 @@ static FieldDecl *createFieldForHostLayoutStruct(Sema &S, 
const Type *Ty,
   auto *Field = FieldDecl::Create(AST, LayoutStruct, SourceLocation(),
   SourceLocation(), II, QT, TSI, nullptr, 
false,
   InClassInitStyle::ICIS_NoInit);
-  Field->setAccess(AccessSpecifier::AS_private);
+  Field->setAccess(AccessSpecifier::AS_public);
   return Field;
 }
 
@@ -417,9 +419,11 @@ static CXXRecordDecl *createHostLayoutStruct(Sema &S,
   if (CXXRecordDecl *RD = findRecordDeclInContext(II, DC))
 return RD;
 
-  CXXRecordDecl *LS = CXXRecordDecl::Create(
-  AST, TagDecl::TagKind::Class, DC, SourceLocation(), SourceLocation(), 
II);
+  CXXRecordDecl *LS =
+  CXXRecordDecl::Create(AST, TagDecl::TagKind::Struct, DC, 
SourceLocation(),
+SourceLocation(), II);
   LS->setImplicit(true);
+  LS->addAttr(PackedAttr::CreateImplicit(AST));
   LS->startDefinition();
 
   // copy base struct, create HLSL Buffer compatible version if needed
@@ -472,8 +476,9 @@ void createHostLayoutStructForBuffer(Sema &S, 
HLSLBufferDecl *BufDecl) {
   IdentifierInfo *II = getHostLayoutStructName(S, BufDecl, true);
 
   CXXRecordDecl *LS =
-  CXXRecordDecl::Create(AST, TagDecl::TagKind::Class, BufDecl,
+  CXXRecordDecl::Create(AST, TagDecl::TagKind::Struct, BufDecl,
 SourceLocation(), SourceLocatio

[clang] [llvm] [CaptureTracking][FunctionAttrs] Add support for CaptureInfo (PR #125880)

2025-02-07 Thread via cfe-commits


@@ -358,49 +360,64 @@ UseCaptureKind llvm::DetermineUseCaptureKind(
 // Volatile stores make the address observable.
 auto *ACXI = cast(I);
 if (U.getOperandNo() == 1 || U.getOperandNo() == 2 || ACXI->isVolatile())
-  return UseCaptureKind::MAY_CAPTURE;
-return UseCaptureKind::NO_CAPTURE;
+  return CaptureInfo::otherOnly();
+return CaptureInfo::none();
   }
   case Instruction::GetElementPtr:
 // AA does not support pointers of vectors, so GEP vector splats need to
 // be considered as captures.
 if (I->getType()->isVectorTy())
-  return UseCaptureKind::MAY_CAPTURE;
-return UseCaptureKind::PASSTHROUGH;
+  return CaptureInfo::otherOnly();
+return CaptureInfo::retOnly();
   case Instruction::BitCast:
   case Instruction::PHI:
   case Instruction::Select:
   case Instruction::AddrSpaceCast:
 // The original value is not captured via this if the new value isn't.
-return UseCaptureKind::PASSTHROUGH;
+return CaptureInfo::retOnly();
   case Instruction::ICmp: {
 unsigned Idx = U.getOperandNo();
 unsigned OtherIdx = 1 - Idx;
-if (auto *CPN = dyn_cast(I->getOperand(OtherIdx))) {
+if (isa(I->getOperand(OtherIdx)) &&
+cast(I)->isEquality()) {
+  // TODO(captures): Remove these special cases once we make use of
+  // captures(address_is_null).
+
   // Don't count comparisons of a no-alias return value against null as
   // captures. This allows us to ignore comparisons of malloc results
   // with null, for example.
-  if (CPN->getType()->getAddressSpace() == 0)
+  if (U->getType()->getPointerAddressSpace() == 0)
 if (isNoAliasCall(U.get()->stripPointerCasts()))
-  return UseCaptureKind::NO_CAPTURE;
+  return CaptureInfo::none();
   if (!I->getFunction()->nullPointerIsDefined()) {
 auto *O = I->getOperand(Idx)->stripPointerCastsSameRepresentation();
 // Comparing a dereferenceable_or_null pointer against null cannot
 // lead to pointer escapes, because if it is not null it must be a
 // valid (in-bounds) pointer.
 const DataLayout &DL = I->getDataLayout();
 if (IsDereferenceableOrNull && IsDereferenceableOrNull(O, DL))
-  return UseCaptureKind::NO_CAPTURE;
+  return CaptureInfo::none();
   }
+
+  // Check whether this is a comparison of the base pointer against
+  // null. We can also strip inbounds GEPs, as inbounds preserves
+  // the null-ness of the pointer.
+  Value *Stripped = U.get();
+  if (!NullPointerIsDefined(I->getFunction(),
+U->getType()->getPointerAddressSpace()))
+Stripped = Stripped->stripInBoundsOffsets();
+  if (Stripped == Base)

goldsteinn wrote:

nit: Given that `icmp pred %x, null` will get cleaned up by InstCombine, is 
there any value in the extra complexity here?

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


[clang] [LinkerWrapper] Clean up options after proper forwarding (PR #126297)

2025-02-07 Thread Nick Sarnie via cfe-commits


@@ -9223,6 +9223,8 @@ void LinkerWrapper::ConstructJob(Compilation &C, const 
JobAction &JA,
   Args.MakeArgString("--host-triple=" + getToolChain().getTripleString()));
   if (Args.hasArg(options::OPT_v))
 CmdArgs.push_back("--wrapper-verbose");
+  if (Arg *A = Args.getLastArg(options::OPT_cuda_path_EQ))

sarnex wrote:

i see this is already in the `CompilerOptions` set above, do we need this 
explicit handling because `--cuda-path` is a `clang-linker-wrapper` option as 
well as a clang one? 

if so, is there an easy way we could remove one of the two?

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


[clang] [llvm] [CaptureTracking][FunctionAttrs] Add support for CaptureInfo (PR #125880)

2025-02-07 Thread via cfe-commits


@@ -358,49 +360,64 @@ UseCaptureKind llvm::DetermineUseCaptureKind(
 // Volatile stores make the address observable.
 auto *ACXI = cast(I);
 if (U.getOperandNo() == 1 || U.getOperandNo() == 2 || ACXI->isVolatile())
-  return UseCaptureKind::MAY_CAPTURE;
-return UseCaptureKind::NO_CAPTURE;
+  return CaptureInfo::otherOnly();
+return CaptureInfo::none();
   }
   case Instruction::GetElementPtr:
 // AA does not support pointers of vectors, so GEP vector splats need to
 // be considered as captures.
 if (I->getType()->isVectorTy())
-  return UseCaptureKind::MAY_CAPTURE;
-return UseCaptureKind::PASSTHROUGH;
+  return CaptureInfo::otherOnly();
+return CaptureInfo::retOnly();
   case Instruction::BitCast:
   case Instruction::PHI:
   case Instruction::Select:
   case Instruction::AddrSpaceCast:
 // The original value is not captured via this if the new value isn't.
-return UseCaptureKind::PASSTHROUGH;
+return CaptureInfo::retOnly();
   case Instruction::ICmp: {
 unsigned Idx = U.getOperandNo();
 unsigned OtherIdx = 1 - Idx;
-if (auto *CPN = dyn_cast(I->getOperand(OtherIdx))) {
+if (isa(I->getOperand(OtherIdx)) &&
+cast(I)->isEquality()) {
+  // TODO(captures): Remove these special cases once we make use of
+  // captures(address_is_null).
+
   // Don't count comparisons of a no-alias return value against null as
   // captures. This allows us to ignore comparisons of malloc results
   // with null, for example.
-  if (CPN->getType()->getAddressSpace() == 0)
+  if (U->getType()->getPointerAddressSpace() == 0)

goldsteinn wrote:

I get that this is pre-existing, but isn't this (and the below) case also 
incorrect when applied to a non-inbounds GEP?

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


[clang] [OpenMP] Fix infinite loop on recursive initializers (PR #126269)

2025-02-07 Thread via cfe-commits

llvmbot wrote:


Failed to cherry-pick: 605a9e37b64b5b5647f1f3e560f7ffe31157841c

https://github.com/llvm/llvm-project/actions/runs/13206970400

Please manually backport the fix and push it to your github fork.  Once this is 
done, please create a [pull 
request](https://github.com/llvm/llvm-project/compare)

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


[clang] [LinkerWrapper] Clean up options after proper forwarding (PR #126297)

2025-02-07 Thread Artem Belevich via cfe-commits

https://github.com/Artem-B approved this pull request.


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


[clang] [LinkerWrapper] Clean up options after proper forwarding (PR #126297)

2025-02-07 Thread Nick Sarnie via cfe-commits

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


[clang] [LinkerWrapper] Clean up options after proper forwarding (PR #126297)

2025-02-07 Thread Nick Sarnie via cfe-commits

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


[clang] [LinkerWrapper] Clean up options after proper forwarding (PR #126297)

2025-02-07 Thread Nick Sarnie via cfe-commits


@@ -21,16 +21,16 @@ __attribute__((visibility("protected"), used)) int x;
 // RUN: clang-linker-wrapper --host-triple=x86_64-unknown-linux-gnu --dry-run \
 // RUN:   --linker-path=/usr/bin/ld %t.o -o a.out 2>&1 | FileCheck %s 
--check-prefix=NVPTX-LINK
 
-// NVPTX-LINK: clang{{.*}} -o {{.*}}.img --target=nvptx64-nvidia-cuda 
-march=sm_70 -O2 -flto {{.*}}.o {{.*}}.o
+// NVPTX-LINK: clang{{.*}} -o {{.*}}.img --target=nvptx64-nvidia-cuda 
-march=sm_70 {{.*}}.o {{.*}}.o
 
 // RUN: clang-offload-packager -o %t.out \
 // RUN:   
--image=file=%t.elf.o,kind=openmp,triple=nvptx64-nvidia-cuda,arch=sm_70 \
 // RUN:   
--image=file=%t.elf.o,kind=openmp,triple=nvptx64-nvidia-cuda,arch=sm_70
 // RUN: %clang -cc1 %s -triple x86_64-unknown-linux-gnu -emit-obj -o %t.o 
-fembed-offload-object=%t.out
-// RUN: clang-linker-wrapper --host-triple=x86_64-unknown-linux-gnu --dry-run 
--device-debug -O0 \
+// RUN: clang-linker-wrapper --host-triple=x86_64-unknown-linux-gnu --dry-run 
--device-compiler=-g \
 // RUN:   --linker-path=/usr/bin/ld %t.o -o a.out 2>&1 | FileCheck %s 
--check-prefix=NVPTX-LINK-DEBUG
 
-// NVPTX-LINK-DEBUG: clang{{.*}} -o {{.*}}.img --target=nvptx64-nvidia-cuda 
-march=sm_70 -O2 -flto {{.*}}.o {{.*}}.o -g

sarnex wrote:

in all cases where we removed `-flto` from the test, it's still passed as part 
of the `--device-compiler` string but we just aren't checking that right?

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


[clang] [llvm] [CaptureTracking][FunctionAttrs] Add support for CaptureInfo (PR #125880)

2025-02-07 Thread Nikita Popov via cfe-commits


@@ -358,49 +360,64 @@ UseCaptureKind llvm::DetermineUseCaptureKind(
 // Volatile stores make the address observable.
 auto *ACXI = cast(I);
 if (U.getOperandNo() == 1 || U.getOperandNo() == 2 || ACXI->isVolatile())
-  return UseCaptureKind::MAY_CAPTURE;
-return UseCaptureKind::NO_CAPTURE;
+  return CaptureInfo::otherOnly();
+return CaptureInfo::none();
   }
   case Instruction::GetElementPtr:
 // AA does not support pointers of vectors, so GEP vector splats need to
 // be considered as captures.
 if (I->getType()->isVectorTy())
-  return UseCaptureKind::MAY_CAPTURE;
-return UseCaptureKind::PASSTHROUGH;
+  return CaptureInfo::otherOnly();
+return CaptureInfo::retOnly();
   case Instruction::BitCast:
   case Instruction::PHI:
   case Instruction::Select:
   case Instruction::AddrSpaceCast:
 // The original value is not captured via this if the new value isn't.
-return UseCaptureKind::PASSTHROUGH;
+return CaptureInfo::retOnly();
   case Instruction::ICmp: {
 unsigned Idx = U.getOperandNo();
 unsigned OtherIdx = 1 - Idx;
-if (auto *CPN = dyn_cast(I->getOperand(OtherIdx))) {
+if (isa(I->getOperand(OtherIdx)) &&
+cast(I)->isEquality()) {
+  // TODO(captures): Remove these special cases once we make use of
+  // captures(address_is_null).
+
   // Don't count comparisons of a no-alias return value against null as
   // captures. This allows us to ignore comparisons of malloc results
   // with null, for example.
-  if (CPN->getType()->getAddressSpace() == 0)
+  if (U->getType()->getPointerAddressSpace() == 0)

nikic wrote:

This particular case is working on a base object. The one below is indeed 
problematic, though only in a pretty narrow case (if you are passing a null 
pointer *with provenance* to a dereferenceable_or_null argument). Fixing this 
case is why we're transitioning to address_is_null instead.

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


[clang] [LinkerWrapper] Clean up options after proper forwarding (PR #126297)

2025-02-07 Thread Nick Sarnie via cfe-commits


@@ -9223,6 +9223,8 @@ void LinkerWrapper::ConstructJob(Compilation &C, const 
JobAction &JA,
   Args.MakeArgString("--host-triple=" + getToolChain().getTripleString()));
   if (Args.hasArg(options::OPT_v))
 CmdArgs.push_back("--wrapper-verbose");
+  if (Arg *A = Args.getLastArg(options::OPT_cuda_path_EQ))

sarnex wrote:

thanks, makes sense

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


[clang] [llvm] [CaptureTracking][FunctionAttrs] Add support for CaptureInfo (PR #125880)

2025-02-07 Thread via cfe-commits


@@ -358,49 +360,64 @@ UseCaptureKind llvm::DetermineUseCaptureKind(
 // Volatile stores make the address observable.
 auto *ACXI = cast(I);
 if (U.getOperandNo() == 1 || U.getOperandNo() == 2 || ACXI->isVolatile())
-  return UseCaptureKind::MAY_CAPTURE;
-return UseCaptureKind::NO_CAPTURE;
+  return CaptureInfo::otherOnly();
+return CaptureInfo::none();
   }
   case Instruction::GetElementPtr:
 // AA does not support pointers of vectors, so GEP vector splats need to
 // be considered as captures.
 if (I->getType()->isVectorTy())
-  return UseCaptureKind::MAY_CAPTURE;
-return UseCaptureKind::PASSTHROUGH;
+  return CaptureInfo::otherOnly();
+return CaptureInfo::retOnly();
   case Instruction::BitCast:
   case Instruction::PHI:
   case Instruction::Select:
   case Instruction::AddrSpaceCast:
 // The original value is not captured via this if the new value isn't.
-return UseCaptureKind::PASSTHROUGH;
+return CaptureInfo::retOnly();
   case Instruction::ICmp: {
 unsigned Idx = U.getOperandNo();
 unsigned OtherIdx = 1 - Idx;
-if (auto *CPN = dyn_cast(I->getOperand(OtherIdx))) {
+if (isa(I->getOperand(OtherIdx)) &&
+cast(I)->isEquality()) {
+  // TODO(captures): Remove these special cases once we make use of
+  // captures(address_is_null).
+
   // Don't count comparisons of a no-alias return value against null as
   // captures. This allows us to ignore comparisons of malloc results
   // with null, for example.
-  if (CPN->getType()->getAddressSpace() == 0)
+  if (U->getType()->getPointerAddressSpace() == 0)

goldsteinn wrote:

Should it not be `AddressIsNull` below?

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


[clang] [llvm] [CaptureTracking][FunctionAttrs] Add support for CaptureInfo (PR #125880)

2025-02-07 Thread via cfe-commits


@@ -358,49 +360,59 @@ UseCaptureKind llvm::DetermineUseCaptureKind(
 // Volatile stores make the address observable.
 auto *ACXI = cast(I);
 if (U.getOperandNo() == 1 || U.getOperandNo() == 2 || ACXI->isVolatile())
-  return UseCaptureKind::MAY_CAPTURE;
-return UseCaptureKind::NO_CAPTURE;
+  return CaptureInfo::otherOnly();
+return CaptureInfo::none();
   }
   case Instruction::GetElementPtr:
 // AA does not support pointers of vectors, so GEP vector splats need to
 // be considered as captures.
 if (I->getType()->isVectorTy())
-  return UseCaptureKind::MAY_CAPTURE;
-return UseCaptureKind::PASSTHROUGH;
+  return CaptureInfo::otherOnly();
+return CaptureInfo::retOnly();
   case Instruction::BitCast:
   case Instruction::PHI:
   case Instruction::Select:
   case Instruction::AddrSpaceCast:
 // The original value is not captured via this if the new value isn't.
-return UseCaptureKind::PASSTHROUGH;
+return CaptureInfo::retOnly();
   case Instruction::ICmp: {
 unsigned Idx = U.getOperandNo();
 unsigned OtherIdx = 1 - Idx;
-if (auto *CPN = dyn_cast(I->getOperand(OtherIdx))) {
+if (isa(I->getOperand(OtherIdx)) &&
+cast(I)->isEquality()) {
+  // TODO(captures): Remove these special cases once we make use of
+  // captures(address_is_null).
+
   // Don't count comparisons of a no-alias return value against null as
   // captures. This allows us to ignore comparisons of malloc results
   // with null, for example.
-  if (CPN->getType()->getAddressSpace() == 0)
+  if (U->getType()->getPointerAddressSpace() == 0)
 if (isNoAliasCall(U.get()->stripPointerCasts()))
-  return UseCaptureKind::NO_CAPTURE;
+  return CaptureInfo::none();
   if (!I->getFunction()->nullPointerIsDefined()) {
 auto *O = I->getOperand(Idx)->stripPointerCastsSameRepresentation();
 // Comparing a dereferenceable_or_null pointer against null cannot
 // lead to pointer escapes, because if it is not null it must be a
 // valid (in-bounds) pointer.
 const DataLayout &DL = I->getDataLayout();
 if (IsDereferenceableOrNull && IsDereferenceableOrNull(O, DL))
-  return UseCaptureKind::NO_CAPTURE;
+  return CaptureInfo::none();
   }
+
+  // Check whether this is a comparison of the base pointer against
+  // null.
+  if (U.get() == Base)
+return CaptureInfo::otherOnly(CaptureComponents::AddressIsNull);
 }
 
 // Otherwise, be conservative. There are crazy ways to capture pointers
-// using comparisons.
-return UseCaptureKind::MAY_CAPTURE;
+// using comparisons. However, only the address is captured, not the
+// provenance.
+return CaptureInfo::otherOnly(CaptureComponents::Address);

goldsteinn wrote:

Why here (and above) is the `otherOnly`? If the result is used by a `ret` is it 
not potentially both?

Maybe I misunderstand the refinement process.

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


[clang] [HLSL] Implement HLSL intialization list support (PR #123141)

2025-02-07 Thread Helena Kotas via cfe-commits

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


[clang] [HLSL] Implement HLSL intialization list support (PR #123141)

2025-02-07 Thread Helena Kotas via cfe-commits


@@ -2576,3 +2576,162 @@ void SemaHLSL::processExplicitBindingsOnDecl(VarDecl 
*VD) {
 }
   }
 }
+
+static bool CastInitializer(Sema &S, ASTContext &Ctx, Expr *E,
+llvm::SmallVectorImpl &List,
+llvm::SmallVectorImpl &DestTypes) {
+  if (List.size() >= DestTypes.size())
+return false;
+  InitializedEntity Entity =
+  InitializedEntity::InitializeParameter(Ctx, DestTypes[List.size()], 
false);
+  ExprResult Res =
+  S.PerformCopyInitialization(Entity, E->getBeginLoc(), E);
+  if (Res.isInvalid())
+return false;
+  Expr *Init = Res.get();
+  List.push_back(Init);
+  return true;
+}
+
+static void BuildIntializerList(Sema &S, ASTContext &Ctx, Expr *E,
+llvm::SmallVectorImpl &List,
+llvm::SmallVectorImpl &DestTypes,
+bool &ExcessInits) {
+  if (List.size() >= DestTypes.size()) {
+ExcessInits = true;
+return;
+  }
+
+  // If this is an initialization list, traverse the sub initializers.
+  if (auto *Init = dyn_cast(E)) {
+for (auto *SubInit : Init->inits())
+  BuildIntializerList(S, Ctx, SubInit, List, DestTypes, ExcessInits);
+return;
+  }
+
+  // If this is a scalar type, just enqueue the expression.
+  QualType Ty = E->getType();
+  if (Ty->isScalarType()) {
+(void)CastInitializer(S, Ctx, E, List, DestTypes);
+return;
+  }
+
+  if (auto *ATy = Ty->getAs()) {
+uint64_t Size = ATy->getNumElements();
+
+if (List.size() + Size > DestTypes.size()) {
+  ExcessInits = true;
+  return;
+}
+QualType SizeTy = Ctx.getSizeType();
+uint64_t SizeTySize = Ctx.getTypeSize(SizeTy);
+for (uint64_t I = 0; I < Size; ++I) {
+  auto *Idx = IntegerLiteral::Create(Ctx, llvm::APInt(SizeTySize, I),
+ SizeTy, SourceLocation());
+
+  ExprResult ElExpr = S.CreateBuiltinArraySubscriptExpr(
+  E, E->getBeginLoc(), Idx, E->getEndLoc());
+  if (ElExpr.isInvalid())
+return;
+  if (!CastInitializer(S, Ctx, ElExpr.get(), List, DestTypes))
+return;
+}
+return;
+  }
+
+  if (auto *VTy = dyn_cast(Ty.getTypePtr())) {
+uint64_t Size = VTy->getZExtSize();
+QualType SizeTy = Ctx.getSizeType();
+uint64_t SizeTySize = Ctx.getTypeSize(SizeTy);
+for (uint64_t I = 0; I < Size; ++I) {
+  auto *Idx = IntegerLiteral::Create(Ctx, llvm::APInt(SizeTySize, I),
+ SizeTy, SourceLocation());
+  ExprResult ElExpr = S.CreateBuiltinArraySubscriptExpr(
+  E, E->getBeginLoc(), Idx, E->getEndLoc());
+  if (ElExpr.isInvalid())
+return;
+  BuildIntializerList(S, Ctx, ElExpr.get(), List, DestTypes, ExcessInits);
+}
+return;
+  }
+
+  if (auto *RTy = Ty->getAs()) {
+for (auto *FD : RTy->getDecl()->fields()) {

hekota wrote:

What if the record has a base class with additional fields? I believe 
`fields()` iterates over the fields on this class but not base class fields.

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


[clang] [HLSL] Implement HLSL intialization list support (PR #123141)

2025-02-07 Thread Helena Kotas via cfe-commits

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


[clang] [HLSL] Implement HLSL intialization list support (PR #123141)

2025-02-07 Thread Helena Kotas via cfe-commits

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


[clang] [HLSL] Implement HLSL intialization list support (PR #123141)

2025-02-07 Thread Helena Kotas via cfe-commits

https://github.com/hekota commented:

Few notes and questions, otherwise looks mostly good!
Typos in title na description: intialization, implementaiton 

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


[clang] [Clang] Add __has_target_builtin macro (PR #126324)

2025-02-07 Thread Nick Sarnie via cfe-commits

https://github.com/sarnex updated 
https://github.com/llvm/llvm-project/pull/126324

>From fe555ce59762edf71f43d0cd61978d60f5f949ef Mon Sep 17 00:00:00 2001
From: "Sarnie, Nick" 
Date: Fri, 7 Feb 2025 14:57:12 -0800
Subject: [PATCH 1/3] [Clang] Add __has_target_builtin macro

Signed-off-by: Sarnie, Nick 
---
 clang/docs/LanguageExtensions.rst | 33 +++
 clang/include/clang/Lex/Preprocessor.h|  1 +
 clang/lib/Lex/PPMacroExpansion.cpp| 17 +++---
 .../test/Preprocessor/has_target_builtin.cpp  | 18 ++
 4 files changed, 64 insertions(+), 5 deletions(-)
 create mode 100644 clang/test/Preprocessor/has_target_builtin.cpp

diff --git a/clang/docs/LanguageExtensions.rst 
b/clang/docs/LanguageExtensions.rst
index 973cf8f9d091c30..87f7df50471e790 100644
--- a/clang/docs/LanguageExtensions.rst
+++ b/clang/docs/LanguageExtensions.rst
@@ -67,6 +67,10 @@ It can be used like this:
   ``__has_builtin`` should not be used to detect support for a builtin macro;
   use ``#ifdef`` instead.
 
+  When using device offloading, a builtin is considered available if it is
+  available on either the host or the device targets.
+  Use ``__has_target_builtin`` to consider only the current target.
+
 ``__has_constexpr_builtin``
 ---
 
@@ -96,6 +100,35 @@ the  header file to conditionally make a 
function constexpr whenever
 the constant evaluation of the corresponding builtin (for example,
 ``std::fmax`` calls ``__builtin_fmax``) is supported in Clang.
 
+``__has_target_builtin``
+-
+
+This function-like macro takes a single identifier argument that is the name of
+a builtin function, a builtin pseudo-function (taking one or more type
+arguments), or a builtin template.
+It evaluates to 1 if the builtin is supported on the current target or 0 if 
not.
+The behavior is different than ``__has_builtin`` when there is an auxiliary 
target,
+such when offloading to a target device.
+It can be used like this:
+
+.. code-block:: c++
+
+  #ifndef __has_target_builtin // Optional of course.
+#define __has_target_builtin(x) 0  // Compatibility with non-clang 
compilers.
+  #endif
+
+  ...
+  #if __has_target_builtin(__builtin_trap)
+__builtin_trap();
+  #else
+abort();
+  #endif
+  ...
+
+.. note::
+  ``__has_target_builtin`` should not be used to detect support for a builtin 
macro;
+  use ``#ifdef`` instead.
+
 .. _langext-__has_feature-__has_extension:
 
 ``__has_feature`` and ``__has_extension``
diff --git a/clang/include/clang/Lex/Preprocessor.h 
b/clang/include/clang/Lex/Preprocessor.h
index 2bf4d1a16699430..240fe28aba93e33 100644
--- a/clang/include/clang/Lex/Preprocessor.h
+++ b/clang/include/clang/Lex/Preprocessor.h
@@ -174,6 +174,7 @@ class Preprocessor {
   IdentifierInfo *Ident__has_extension;// __has_extension
   IdentifierInfo *Ident__has_builtin;  // __has_builtin
   IdentifierInfo *Ident__has_constexpr_builtin;// __has_constexpr_builtin
+  IdentifierInfo *Ident__has_target_builtin;   // __has_target_builtin
   IdentifierInfo *Ident__has_attribute;// __has_attribute
   IdentifierInfo *Ident__has_embed;// __has_embed
   IdentifierInfo *Ident__has_include;  // __has_include
diff --git a/clang/lib/Lex/PPMacroExpansion.cpp 
b/clang/lib/Lex/PPMacroExpansion.cpp
index 347c13da0ad215a..b7b870e1a7fca82 100644
--- a/clang/lib/Lex/PPMacroExpansion.cpp
+++ b/clang/lib/Lex/PPMacroExpansion.cpp
@@ -357,6 +357,7 @@ void Preprocessor::RegisterBuiltinMacros() {
   Ident__has_builtin = RegisterBuiltinMacro("__has_builtin");
   Ident__has_constexpr_builtin =
   RegisterBuiltinMacro("__has_constexpr_builtin");
+  Ident__has_target_builtin = RegisterBuiltinMacro("__has_target_builtin");
   Ident__has_attribute = RegisterBuiltinMacro("__has_attribute");
   if (!getLangOpts().CPlusPlus)
 Ident__has_c_attribute = RegisterBuiltinMacro("__has_c_attribute");
@@ -1797,15 +1798,17 @@ void Preprocessor::ExpandBuiltinMacro(Token &Tok) {
diag::err_feature_check_malformed);
 return II && HasExtension(*this, II->getName());
   });
-  } else if (II == Ident__has_builtin) {
+  } else if (II == Ident__has_builtin || II == Ident__has_target_builtin) {
+bool IsHasTargetBuiltin = II == Ident__has_target_builtin;
 EvaluateFeatureLikeBuiltinMacro(OS, Tok, II, *this, false,
-  [this](Token &Tok, bool &HasLexedNextToken) -> int {
+  [this, IsHasTargetBuiltin](Token &Tok, bool &HasLexedNextToken) -> int {
 IdentifierInfo *II = ExpectFeatureIdentifierInfo(Tok, *this,
diag::err_feature_check_malformed);
 if (!II)
   return false;
-else if (II->getBuiltinID() != 0) {
-  switch (II->getBuiltinID()) {
+auto BuiltinID = II->getBuiltinID();
+if (BuiltinID != 0) {
+  switch (BuiltinID) {
   case Bui

[clang] [profile] Add a clang option -fprofile-continuous that enables continuous instrumentation profiling mode (PR #124353)

2025-02-07 Thread Fangrui Song via cfe-commits


@@ -0,0 +1,21 @@
+// 1) test on platforms that (do or do not) require runtime relocation
+//

MaskRay wrote:

sed 's,^//$,,'

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


[clang] [profile] Add a clang option -fprofile-continuous that enables continuous instrumentation profiling mode (PR #124353)

2025-02-07 Thread Fangrui Song via cfe-commits

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


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


[clang] [profile] Add a clang option -fprofile-continuous that enables continuous instrumentation profiling mode (PR #124353)

2025-02-07 Thread Muhammad Rehan khan via cfe-commits

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


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


[clang] [C++20][Modules][Serialization] Add an additional test case for #120277. (PR #126349)

2025-02-07 Thread Michael Park via cfe-commits

https://github.com/mpark updated 
https://github.com/llvm/llvm-project/pull/126349

>From eac633d78359245f1ce478b5f3cff26c6f5c858f Mon Sep 17 00:00:00 2001
From: Michael Park 
Date: Fri, 7 Feb 2025 21:23:26 -0800
Subject: [PATCH] [C++20][Modules][Serialization] Add an additional test case
 for #120277.

https://github.com/llvm/llvm-project/commit/4b35dd57b88a59b169c3471cbc398113d3bf98e8
was shipped to address https://github.com/llvm/llvm-project/issues/120277 .

It was thought to be a regression in 19.x according to this comment:
https://github.com/llvm/llvm-project/issues/120277#issuecomment-2558991129

This is a test case that fails even in 17.x but nevertheless is also fixed by:
https://github.com/llvm/llvm-project/commit/4b35dd57b88a59b169c3471cbc398113d3bf98e8
 .
---
 clang/test/Modules/pr120277-2.cpp | 67 +++
 1 file changed, 67 insertions(+)
 create mode 100644 clang/test/Modules/pr120277-2.cpp

diff --git a/clang/test/Modules/pr120277-2.cpp 
b/clang/test/Modules/pr120277-2.cpp
new file mode 100644
index 000..21d24207c920dac
--- /dev/null
+++ b/clang/test/Modules/pr120277-2.cpp
@@ -0,0 +1,67 @@
+// RUN: rm -rf %t
+// RUN: mkdir -p %t
+// RUN: split-file %s %t
+// RUN: cd %t
+
+// RUN: %clang_cc1 -std=c++20 -emit-header-unit -xc++-user-header %t/hu-01.h \
+// RUN:  -o %t/hu-01.pcm
+
+// RUN: %clang_cc1 -std=c++20 -emit-header-unit -xc++-user-header %t/hu-02.h \
+// RUN:  -Wno-experimental-header-units -fmodule-file=%t/hu-01.pcm -o 
%t/hu-02.pcm
+
+// RUN: %clang_cc1 -std=c++20 -emit-header-unit -xc++-user-header %t/hu-03.h \
+// RUN:  -Wno-experimental-header-units \
+// RUN:  -fmodule-file=%t/hu-01.pcm -o %t/hu-03.pcm
+
+// RUN: %clang_cc1 -std=c++20 -emit-header-unit -xc++-user-header %t/hu-04.h \
+// RUN:  -Wno-experimental-header-units -fmodule-file=%t/hu-02.pcm \
+// RUN:  -fmodule-file=%t/hu-03.pcm -o %t/hu-04.pcm
+
+// RUN: %clang_cc1 -std=c++20 -emit-obj %t/main.cpp \
+// RUN:  -Wno-experimental-header-units -fmodule-file=%t/hu-04.pcm
+//--- hu-01.h
+template 
+struct A {
+  ~A() { f(); }
+  auto f() const { return 0; }
+};
+
+template 
+struct B {
+  int g() const { return a.f(); }
+  A a;
+};
+
+//--- hu-02.h
+import "hu-01.h";
+
+template 
+struct C {
+  void h() {
+B().g();
+  }
+};
+
+template struct A;
+
+//--- hu-03.h
+import "hu-01.h";
+
+inline B b() {
+  return {};
+}
+
+//--- hu-04.h
+import "hu-02.h";
+import "hu-03.h";
+
+inline void f4() {
+  C{}.h();
+}
+
+//--- main.cpp
+import "hu-04.h";
+
+int main() {
+  f4();
+}

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


[clang] [clang] [ASTDump] Add support for structural value template arguments in TextNodeDumper (PR #126341)

2025-02-07 Thread via cfe-commits

https://github.com/sakria9 updated 
https://github.com/llvm/llvm-project/pull/126341

>From a382aa9de206a194397f9424150f170d35101b42 Mon Sep 17 00:00:00 2001
From: sakria9 
Date: Sat, 8 Feb 2025 04:00:08 +
Subject: [PATCH 1/3] [ASTDump] Add support for structural value template
 arguments in TextNodeDumper

---
 clang/include/clang/AST/TextNodeDumper.h | 1 +
 clang/lib/AST/TextNodeDumper.cpp | 5 +
 2 files changed, 6 insertions(+)

diff --git a/clang/include/clang/AST/TextNodeDumper.h 
b/clang/include/clang/AST/TextNodeDumper.h
index bfd205ffb0d99ad..4b5ad2b5fa74c04 100644
--- a/clang/include/clang/AST/TextNodeDumper.h
+++ b/clang/include/clang/AST/TextNodeDumper.h
@@ -249,6 +249,7 @@ class TextNodeDumper
   void VisitDeclarationTemplateArgument(const TemplateArgument &TA);
   void VisitNullPtrTemplateArgument(const TemplateArgument &TA);
   void VisitIntegralTemplateArgument(const TemplateArgument &TA);
+  void VisitStructuralValueTemplateArgument(const TemplateArgument &TA);
   void VisitTemplateTemplateArgument(const TemplateArgument &TA);
   void VisitTemplateExpansionTemplateArgument(const TemplateArgument &TA);
   void VisitExpressionTemplateArgument(const TemplateArgument &TA);
diff --git a/clang/lib/AST/TextNodeDumper.cpp b/clang/lib/AST/TextNodeDumper.cpp
index 6da1f776b4b6357..cb0c742177d2c7f 100644
--- a/clang/lib/AST/TextNodeDumper.cpp
+++ b/clang/lib/AST/TextNodeDumper.cpp
@@ -1226,6 +1226,11 @@ void TextNodeDumper::VisitIntegralTemplateArgument(const 
TemplateArgument &TA) {
   dumpTemplateArgument(TA);
 }
 
+void TextNodeDumper::VisitStructuralValueTemplateArgument(const 
TemplateArgument &TA) {
+  OS << " structural value";
+  dumpTemplateArgument(TA);
+}
+
 void TextNodeDumper::dumpTemplateName(TemplateName TN, StringRef Label) {
   AddChild(Label, [=] {
 {

>From 5e9bfa7141a1b0eda2fe41d2727c66a1e4c19e5d Mon Sep 17 00:00:00 2001
From: sakria9 
Date: Sat, 8 Feb 2025 04:11:05 +
Subject: [PATCH 2/3] format

---
 clang/lib/AST/TextNodeDumper.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/clang/lib/AST/TextNodeDumper.cpp b/clang/lib/AST/TextNodeDumper.cpp
index cb0c742177d2c7f..08efcda46b8f9a4 100644
--- a/clang/lib/AST/TextNodeDumper.cpp
+++ b/clang/lib/AST/TextNodeDumper.cpp
@@ -1226,7 +1226,8 @@ void TextNodeDumper::VisitIntegralTemplateArgument(const 
TemplateArgument &TA) {
   dumpTemplateArgument(TA);
 }
 
-void TextNodeDumper::VisitStructuralValueTemplateArgument(const 
TemplateArgument &TA) {
+void TextNodeDumper::VisitStructuralValueTemplateArgument(
+const TemplateArgument &TA) {
   OS << " structural value";
   dumpTemplateArgument(TA);
 }

>From f930983e7286e4d1e46fbd2081996fd18ebdddfc Mon Sep 17 00:00:00 2001
From: sakria9 
Date: Sat, 8 Feb 2025 05:50:35 +
Subject: [PATCH 3/3] add test

---
 .../ast-dump-template-argument-structural-value.cpp  | 12 
 1 file changed, 12 insertions(+)
 create mode 100644 
clang/test/AST/ast-dump-template-argument-structural-value.cpp

diff --git a/clang/test/AST/ast-dump-template-argument-structural-value.cpp 
b/clang/test/AST/ast-dump-template-argument-structural-value.cpp
new file mode 100644
index 000..61d4a9ef82db439
--- /dev/null
+++ b/clang/test/AST/ast-dump-template-argument-structural-value.cpp
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -std=c++20 -ast-dump -ast-dump-filter=pr126341 %s | 
FileCheck %s
+
+template<_Complex int x>
+struct pr126341;
+template<>
+struct pr126341<{1, 2}>;
+
+// CHECK: Dumping pr126341:
+// CHECK-NEXT: ClassTemplateDecl
+// CHECK: Dumping pr126341:
+// CHECK-NEXT: ClassTemplateSpecializationDecl
+// CHECK-NEXT: `-TemplateArgument structural value '1+2i'
\ No newline at end of file

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


[clang] [Driver][HIP] Do not pass -dependency-file flag for HIP Device offloading (PR #125646)

2025-02-07 Thread Aniket Lal via cfe-commits

https://github.com/lalaniket8 updated 
https://github.com/llvm/llvm-project/pull/125646

>From 7be637fa9fcde8977f650e208c7ddc1495080941 Mon Sep 17 00:00:00 2001
From: anikelal 
Date: Tue, 4 Feb 2025 12:13:20 +0530
Subject: [PATCH 1/2] [Driver][HIP] Do not pass -dependency-file flag for HIP
 Device offloading

When we launch hipcc with multiple offload architectures along with -MF 
dep_file flag, the clang compilation invocations for host and device offloads 
write to the same dep_file, and can lead to collision during file IO 
operations. This can typically happen during large workloads.
This commit provides a fix to generate dep_file only in host compilation.
---
 clang/lib/Driver/ToolChains/Clang.cpp | 30 ++-
 1 file changed, 16 insertions(+), 14 deletions(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index 0a6756eadba317..66acd2f7b91a57 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -1013,21 +1013,23 @@ void Clang::AddPreprocessingOptions(Compilation &C, 
const JobAction &JA,
 ArgM = ArgMD;
 
   if (ArgM) {
-// Determine the output location.
-const char *DepFile;
-if (Arg *MF = Args.getLastArg(options::OPT_MF)) {
-  DepFile = MF->getValue();
-  C.addFailureResultFile(DepFile, &JA);
-} else if (Output.getType() == types::TY_Dependencies) {
-  DepFile = Output.getFilename();
-} else if (!ArgMD) {
-  DepFile = "-";
-} else {
-  DepFile = getDependencyFileName(Args, Inputs);
-  C.addFailureResultFile(DepFile, &JA);
+if (!JA.isDeviceOffloading(Action::OFK_HIP)) {
+  // Determine the output location.
+  const char *DepFile;
+  if (Arg *MF = Args.getLastArg(options::OPT_MF)) {
+DepFile = MF->getValue();
+C.addFailureResultFile(DepFile, &JA);
+  } else if (Output.getType() == types::TY_Dependencies) {
+DepFile = Output.getFilename();
+  } else if (!ArgMD) {
+DepFile = "-";
+  } else {
+DepFile = getDependencyFileName(Args, Inputs);
+C.addFailureResultFile(DepFile, &JA);
+  }
+  CmdArgs.push_back("-dependency-file");
+  CmdArgs.push_back(DepFile);
 }
-CmdArgs.push_back("-dependency-file");
-CmdArgs.push_back(DepFile);
 
 bool HasTarget = false;
 for (const Arg *A : Args.filtered(options::OPT_MT, options::OPT_MQ)) {

>From 5c52e3a065d0c6e3bf59c450102ae95595ed5b10 Mon Sep 17 00:00:00 2001
From: anikelal 
Date: Wed, 5 Feb 2025 14:49:50 +0530
Subject: [PATCH 2/2] Adding littest

---
 .../dep-file-flag-with-multiple-offload-archs.hip   | 13 +
 1 file changed, 13 insertions(+)
 create mode 100644 
clang/test/Driver/dep-file-flag-with-multiple-offload-archs.hip

diff --git a/clang/test/Driver/dep-file-flag-with-multiple-offload-archs.hip 
b/clang/test/Driver/dep-file-flag-with-multiple-offload-archs.hip
new file mode 100644
index 00..9dd4b6a4601a01
--- /dev/null
+++ b/clang/test/Driver/dep-file-flag-with-multiple-offload-archs.hip
@@ -0,0 +1,13 @@
+// RUN: %clang -### -x hip --offload-arch=gfx1030 --offload-arch=gfx1100 
--offload-arch=gfx1101 -MD -MF tmp.d -v %s 2>&1 | FileCheck %s
+
+// CHECK: Build config:
+// CHECK-NOT: {{.*}}clang{{.*}}"-target-cpu" "gfx1030"{{.*}}"-dependency-file" 
"tmp.d"
+// CHECK: {{.*}}lld{{.*}}"-plugin-opt=mcpu=gfx1030"
+// CHECK-NOT: {{.*}}clang{{.*}}"-target-cpu" "gfx1100"{{.*}}"-dependency-file" 
"tmp.d"
+// CHECK: {{.*}}lld{{.*}}"-plugin-opt=mcpu=gfx1100"
+// CHECK-NOT: {{.*}}clang{{.*}}"-target-cpu" "gfx1101"{{.*}}"-dependency-file" 
"tmp.d"
+// CHECK: {{.*}}lld{{.*}}"-plugin-opt=mcpu=gfx1101"
+// CHECK: {{.*}}clang-offload-bundler
+// CHECK: {{.*}}clang{{.*}}"-target-cpu" "x86-64"{{.*}}"-dependency-file" 
"tmp.d"
+
+void main(){}

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


[clang] [clang-format] Add BinPackLongBracedList style option (PR #112482)

2025-02-07 Thread Owen Pan via cfe-commits

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


[clang] [clang-format] Add BinPackLongBracedList style option (PR #112482)

2025-02-07 Thread Owen Pan via cfe-commits

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


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


[clang] [clang] print correct context for diagnostics suppressed by deduction (PR #125453)

2025-02-07 Thread Younan Zhang via cfe-commits


@@ -1654,11 +1654,20 @@ void Sema::EmitDiagnostic(unsigned DiagID, const 
DiagnosticBuilder &DB) {
 }
 
 case DiagnosticIDs::SFINAE_Suppress:
+  if (DiagnosticsEngine::Level Level = getDiagnostics().getDiagnosticLevel(
+  DiagInfo.getID(), DiagInfo.getLocation());
+  Level == DiagnosticsEngine::Ignored)
+return;
   // Make a copy of this suppressed diagnostic and store it with the
   // template-deduction information;
   if (*Info) {
-(*Info)->addSuppressedDiagnostic(DiagInfo.getLocation(),
-   PartialDiagnostic(DiagInfo, 
Context.getDiagAllocator()));
+(*Info)->addSuppressedDiagnostic(
+DiagInfo.getLocation(),
+PartialDiagnostic(DiagInfo, Context.getDiagAllocator()));
+if (!Diags.getDiagnosticIDs()->isNote(DiagID))
+  PrintContextStack([Info](SourceLocation Loc, PartialDiagnostic PD) {
+(*Info)->addSuppressedDiagnostic(Loc, std::move(PD));
+  });

zyn0217 wrote:

If I read it right, the issue arises because we weren't recording 
`instantiation required at...` in TemplateDeductionInfo, right? Is there any 
risk of emitting duplicate diagnostics by doing so? (I might be overconcerned 
if I'm misremembering some implementation details.)

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


[clang] [clang] print correct context for diagnostics suppressed by deduction (PR #125453)

2025-02-07 Thread Younan Zhang via cfe-commits


@@ -1909,7 +1909,19 @@ class Sema final : public SemaBase {
   /// '\#pragma clang attribute push' directives to the given declaration.
   void AddPragmaAttributes(Scope *S, Decl *D);
 
-  void PrintPragmaAttributeInstantiationPoint();
+  using DiagFuncRef =

zyn0217 wrote:

I think I agree with @cor3ntin here, we need a more specific name than 
`DiagFuncRef` (which looks like something supposed to be localized in a 
function other than the god Sema) - how about `InstantiationContextDiagFuncRef`?

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


[clang] [clang-format] Add BinPackLongBracedList style option (PR #112482)

2025-02-07 Thread Owen Pan via cfe-commits

https://github.com/owenca updated 
https://github.com/llvm/llvm-project/pull/112482

>From 8282f754ae40b64a88e2d22a6cb21e7028da8371 Mon Sep 17 00:00:00 2001
From: Gedare Bloom 
Date: Tue, 15 Oct 2024 23:55:49 -0600
Subject: [PATCH 1/8] [clang-format] add BinPackLongBracedList style option

The use of Cpp11BracedListStyle with BinPackParameters=False
avoids bin packing until reaching a hard-coded limit of 20 items.
This is an arbitrary choice. Introduce a new style option to
allow disabling this limit.
---
 clang/include/clang/Format/Format.h| 20 +
 clang/lib/Format/Format.cpp|  2 ++
 clang/lib/Format/FormatToken.cpp   |  2 +-
 clang/unittests/Format/ConfigParseTest.cpp |  1 +
 clang/unittests/Format/FormatTest.cpp  | 26 ++
 5 files changed, 50 insertions(+), 1 deletion(-)

diff --git a/clang/include/clang/Format/Format.h 
b/clang/include/clang/Format/Format.h
index fbc9291ae950d41..476d9d4cf4ba1cb 100644
--- a/clang/include/clang/Format/Format.h
+++ b/clang/include/clang/Format/Format.h
@@ -1212,6 +1212,22 @@ struct FormatStyle {
   /// \version 3.7
   bool BinPackArguments;
 
+  /// If ``BinPackLongBracedLists`` is ``true`` it overrides
+  /// ``BinPackArguments`` if there are 20 or more items in a braced
+  /// initializer list.
+  /// \code
+  ///BinPackLongBracedLists: false  vs.   BinPackLongBracedLists: true
+  ///vector x{   vector x{1, 2, ...,
+  ///   20, 21};
+  ///1,
+  ///2,
+  ///...,
+  ///20,
+  ///21};
+  /// \endcode
+  /// \version 21
+  bool BinPackLongBracedLists;
+
   /// Different way to try to fit all parameters on a line.
   enum BinPackParametersStyle : int8_t {
 /// Bin-pack parameters.
@@ -2547,6 +2563,9 @@ struct FormatStyle {
   /// (e.g. a type or variable name), clang-format formats as if the ``{}`` 
were
   /// the parentheses of a function call with that name. If there is no name,
   /// a zero-length name is assumed.
+  ///
+  /// ``BinPackArguments`` may be forced to true for initializer lists with
+  /// more than 20 items if ``BinPackLongBracedLists`` is true.
   /// \code
   ///true:  false:
   ///vector x{1, 2, 3, 4}; vs. vector x{ 1, 2, 3, 4 };
@@ -5266,6 +5285,7 @@ struct FormatStyle {
R.AlwaysBreakBeforeMultilineStrings &&
AttributeMacros == R.AttributeMacros &&
BinPackArguments == R.BinPackArguments &&
+   BinPackLongBracedLists == R.BinPackLongBracedLists &&
BinPackParameters == R.BinPackParameters &&
BitFieldColonSpacing == R.BitFieldColonSpacing &&
BracedInitializerIndentWidth == R.BracedInitializerIndentWidth &&
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index 387daad934f67ac..b9dd541a3dda2a6 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -995,6 +995,7 @@ template <> struct MappingTraits {
Style.AlwaysBreakBeforeMultilineStrings);
 IO.mapOptional("AttributeMacros", Style.AttributeMacros);
 IO.mapOptional("BinPackArguments", Style.BinPackArguments);
+IO.mapOptional("BinPackLongBracedLists", Style.BinPackLongBracedLists);
 IO.mapOptional("BinPackParameters", Style.BinPackParameters);
 IO.mapOptional("BitFieldColonSpacing", Style.BitFieldColonSpacing);
 IO.mapOptional("BracedInitializerIndentWidth",
@@ -1507,6 +1508,7 @@ FormatStyle getLLVMStyle(FormatStyle::LanguageKind 
Language) {
   LLVMStyle.AlwaysBreakBeforeMultilineStrings = false;
   LLVMStyle.AttributeMacros.push_back("__capability");
   LLVMStyle.BinPackArguments = true;
+  LLVMStyle.BinPackLongBracedLists = true;
   LLVMStyle.BinPackParameters = FormatStyle::BPPS_BinPack;
   LLVMStyle.BitFieldColonSpacing = FormatStyle::BFCS_Both;
   LLVMStyle.BracedInitializerIndentWidth = std::nullopt;
diff --git a/clang/lib/Format/FormatToken.cpp b/clang/lib/Format/FormatToken.cpp
index 99bce1f5f09851e..239781129d7b96f 100644
--- a/clang/lib/Format/FormatToken.cpp
+++ b/clang/lib/Format/FormatToken.cpp
@@ -175,7 +175,7 @@ void CommaSeparatedList::precomputeFormattingInfos(const 
FormatToken *Token) {
   // have many items (20 or more) or we allow bin-packing of function call
   // arguments.
   if (Style.Cpp11BracedListStyle && !Style.BinPackArguments &&
-  Commas.size() < 19) {
+  (Commas.size() < 19 || !Style.BinPackLongBracedLists)) {
 return;
   }
 
diff --git a/clang/unittests/Format/ConfigParseTest.cpp 
b/clang/unittests/Format/ConfigParseTest.cpp
index 0cb2a1288bfd7ec..1ebc1ac2faa817a 100644
--- a/clang/unittests/Format/ConfigParseTest.cpp
+++ b/clang/unittests/Format/ConfigParseTest.cpp
@@ -168,6 +168,7 @@ TEST(ConfigParseTest, ParsesConfigurationBools) {
   CHECK_PARSE_BOOL(AllowShortLoopsOnASingleLine);
   CHECK_PARSE_BOOL(AllowSho

[clang] [clang] print correct context for diagnostics suppressed by deduction (PR #125453)

2025-02-07 Thread Younan Zhang via cfe-commits


@@ -1909,7 +1909,22 @@ class Sema final : public SemaBase {
   /// '\#pragma clang attribute push' directives to the given declaration.
   void AddPragmaAttributes(Scope *S, Decl *D);
 
-  void PrintPragmaAttributeInstantiationPoint();
+  using DiagFuncRef =
+  llvm::function_ref;
+  auto getDefaultDiagFunc() {
+return [this](SourceLocation Loc, PartialDiagnostic PD) {
+  // This bypasses a lof of the filters in the diag engine, as it's

zyn0217 wrote:

```suggestion
  // This bypasses a lot of the filters in the diag engine, as it's
```

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


[clang] [clang] [ASTDump] Add support for structural value template arguments in TextNodeDumper (PR #126341)

2025-02-07 Thread via cfe-commits

https://github.com/sakria9 updated 
https://github.com/llvm/llvm-project/pull/126341

>From a382aa9de206a194397f9424150f170d35101b42 Mon Sep 17 00:00:00 2001
From: sakria9 
Date: Sat, 8 Feb 2025 04:00:08 +
Subject: [PATCH 1/5] [ASTDump] Add support for structural value template
 arguments in TextNodeDumper

---
 clang/include/clang/AST/TextNodeDumper.h | 1 +
 clang/lib/AST/TextNodeDumper.cpp | 5 +
 2 files changed, 6 insertions(+)

diff --git a/clang/include/clang/AST/TextNodeDumper.h 
b/clang/include/clang/AST/TextNodeDumper.h
index bfd205ffb0d99ad..4b5ad2b5fa74c04 100644
--- a/clang/include/clang/AST/TextNodeDumper.h
+++ b/clang/include/clang/AST/TextNodeDumper.h
@@ -249,6 +249,7 @@ class TextNodeDumper
   void VisitDeclarationTemplateArgument(const TemplateArgument &TA);
   void VisitNullPtrTemplateArgument(const TemplateArgument &TA);
   void VisitIntegralTemplateArgument(const TemplateArgument &TA);
+  void VisitStructuralValueTemplateArgument(const TemplateArgument &TA);
   void VisitTemplateTemplateArgument(const TemplateArgument &TA);
   void VisitTemplateExpansionTemplateArgument(const TemplateArgument &TA);
   void VisitExpressionTemplateArgument(const TemplateArgument &TA);
diff --git a/clang/lib/AST/TextNodeDumper.cpp b/clang/lib/AST/TextNodeDumper.cpp
index 6da1f776b4b6357..cb0c742177d2c7f 100644
--- a/clang/lib/AST/TextNodeDumper.cpp
+++ b/clang/lib/AST/TextNodeDumper.cpp
@@ -1226,6 +1226,11 @@ void TextNodeDumper::VisitIntegralTemplateArgument(const 
TemplateArgument &TA) {
   dumpTemplateArgument(TA);
 }
 
+void TextNodeDumper::VisitStructuralValueTemplateArgument(const 
TemplateArgument &TA) {
+  OS << " structural value";
+  dumpTemplateArgument(TA);
+}
+
 void TextNodeDumper::dumpTemplateName(TemplateName TN, StringRef Label) {
   AddChild(Label, [=] {
 {

>From 5e9bfa7141a1b0eda2fe41d2727c66a1e4c19e5d Mon Sep 17 00:00:00 2001
From: sakria9 
Date: Sat, 8 Feb 2025 04:11:05 +
Subject: [PATCH 2/5] format

---
 clang/lib/AST/TextNodeDumper.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/clang/lib/AST/TextNodeDumper.cpp b/clang/lib/AST/TextNodeDumper.cpp
index cb0c742177d2c7f..08efcda46b8f9a4 100644
--- a/clang/lib/AST/TextNodeDumper.cpp
+++ b/clang/lib/AST/TextNodeDumper.cpp
@@ -1226,7 +1226,8 @@ void TextNodeDumper::VisitIntegralTemplateArgument(const 
TemplateArgument &TA) {
   dumpTemplateArgument(TA);
 }
 
-void TextNodeDumper::VisitStructuralValueTemplateArgument(const 
TemplateArgument &TA) {
+void TextNodeDumper::VisitStructuralValueTemplateArgument(
+const TemplateArgument &TA) {
   OS << " structural value";
   dumpTemplateArgument(TA);
 }

>From f930983e7286e4d1e46fbd2081996fd18ebdddfc Mon Sep 17 00:00:00 2001
From: sakria9 
Date: Sat, 8 Feb 2025 05:50:35 +
Subject: [PATCH 3/5] add test

---
 .../ast-dump-template-argument-structural-value.cpp  | 12 
 1 file changed, 12 insertions(+)
 create mode 100644 
clang/test/AST/ast-dump-template-argument-structural-value.cpp

diff --git a/clang/test/AST/ast-dump-template-argument-structural-value.cpp 
b/clang/test/AST/ast-dump-template-argument-structural-value.cpp
new file mode 100644
index 000..61d4a9ef82db439
--- /dev/null
+++ b/clang/test/AST/ast-dump-template-argument-structural-value.cpp
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -std=c++20 -ast-dump -ast-dump-filter=pr126341 %s | 
FileCheck %s
+
+template<_Complex int x>
+struct pr126341;
+template<>
+struct pr126341<{1, 2}>;
+
+// CHECK: Dumping pr126341:
+// CHECK-NEXT: ClassTemplateDecl
+// CHECK: Dumping pr126341:
+// CHECK-NEXT: ClassTemplateSpecializationDecl
+// CHECK-NEXT: `-TemplateArgument structural value '1+2i'
\ No newline at end of file

>From b80626ff56adc6db71298eea7fd824b9463056e8 Mon Sep 17 00:00:00 2001
From: sakria9 
Date: Sat, 8 Feb 2025 05:55:15 +
Subject: [PATCH 4/5] add newline

---
 clang/test/AST/ast-dump-template-argument-structural-value.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/test/AST/ast-dump-template-argument-structural-value.cpp 
b/clang/test/AST/ast-dump-template-argument-structural-value.cpp
index 61d4a9ef82db439..7f5a3d4508f1cfd 100644
--- a/clang/test/AST/ast-dump-template-argument-structural-value.cpp
+++ b/clang/test/AST/ast-dump-template-argument-structural-value.cpp
@@ -9,4 +9,4 @@ struct pr126341<{1, 2}>;
 // CHECK-NEXT: ClassTemplateDecl
 // CHECK: Dumping pr126341:
 // CHECK-NEXT: ClassTemplateSpecializationDecl
-// CHECK-NEXT: `-TemplateArgument structural value '1+2i'
\ No newline at end of file
+// CHECK-NEXT: `-TemplateArgument structural value '1+2i'

>From 5678ce0a8910bb9800e182ca7755a14e446f0f72 Mon Sep 17 00:00:00 2001
From: sakria9 
Date: Sat, 8 Feb 2025 05:58:39 +
Subject: [PATCH 5/5] add release note

---
 clang/docs/ReleaseNotes.rst | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 92f63c15030898f..89cb0f7e9d57db3 100644
--- a/clang/docs/Rele

[clang] [clang] [ASTDump] Add support for structural value template arguments in TextNodeDumper (PR #126341)

2025-02-07 Thread via cfe-commits

sakria9 wrote:

@zyn0217 Hi, I have added a test and modfied the release note. Please take a 
look.

Test log:

```
$ ./bin/llvm-lit 
../clang/test/AST/ast-dump-template-argument-structural-value.cpp 
llvm-lit: /workspaces/clice/deps/llvm/llvm/utils/lit/lit/llvm/config.py:506: 
note: using clang: /workspaces/clice/deps/llvm/build-debug/bin/clang
-- Testing: 1 tests, 1 workers --
PASS: Clang :: AST/ast-dump-template-argument-structural-value.cpp (1 of 1)

Testing Time: 0.22s

Total Discovered Tests: 1
  Passed: 1 (100.00%)
```

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


[clang] [Clang][Sema] Fix wrong initialization kind when handling initializing structured bindings from an array with direct-list-initialization (PR #124793)

2025-02-07 Thread Younan Zhang via cfe-commits

zyn0217 wrote:

@zwuis Can you resolve the conflicts before we help you merge it? thanks

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


[clang] e0a21e2 - [clang-format] Add BinPackLongBracedList style option (#112482)

2025-02-07 Thread via cfe-commits

Author: Gedare Bloom
Date: 2025-02-07T22:10:35-08:00
New Revision: e0a21e23a7aa6acf3e07b866c3c599db5eb4b67f

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

LOG: [clang-format] Add BinPackLongBracedList style option (#112482)

The use of Cpp11BracedListStyle with BinPackArguments=False avoids bin
packing until reaching a hard-coded limit of 20 items. This is an
arbitrary choice. Introduce a new style option to allow disabling this
limit.

Added: 


Modified: 
clang/docs/ClangFormatStyleOptions.rst
clang/docs/ReleaseNotes.rst
clang/include/clang/Format/Format.h
clang/lib/Format/Format.cpp
clang/lib/Format/FormatToken.cpp
clang/unittests/Format/ConfigParseTest.cpp
clang/unittests/Format/FormatTest.cpp

Removed: 




diff  --git a/clang/docs/ClangFormatStyleOptions.rst 
b/clang/docs/ClangFormatStyleOptions.rst
index ce38a3a9ba1f739..bf6dd9e13915f8c 100644
--- a/clang/docs/ClangFormatStyleOptions.rst
+++ b/clang/docs/ClangFormatStyleOptions.rst
@@ -2182,6 +2182,24 @@ the configuration (without a prefix: ``Auto``).
 aaa);
 }
 
+.. _BinPackLongBracedList:
+
+**BinPackLongBracedList** (``Boolean``) :versionbadge:`clang-format 21` 
:ref:`¶ `
+  If ``BinPackLongBracedList`` is ``true`` it overrides
+  ``BinPackArguments`` if there are 20 or more items in a braced
+  initializer list.
+
+  .. code-block:: c++
+
+ BinPackLongBracedList: false  vs.BinPackLongBracedList: true
+ vector x{   vector x{1, 2, ...,
+20, 21};
+ 1,
+ 2,
+ ...,
+ 20,
+ 21};
+
 .. _BinPackParameters:
 
 **BinPackParameters** (``BinPackParametersStyle``) :versionbadge:`clang-format 
3.7` :ref:`¶ `

diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 92f63c15030898f..03997395f56d84c 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -237,6 +237,8 @@ clang-format
 
 
 - Adds ``BreakBeforeTemplateCloser`` option.
+- Adds ``BinPackLongBracedList`` option to override bin packing options in
+  long (20 item or more) braced list initializer lists.
 
 libclang
 

diff  --git a/clang/include/clang/Format/Format.h 
b/clang/include/clang/Format/Format.h
index fbc9291ae950d41..16956b4e0fbd4f3 100644
--- a/clang/include/clang/Format/Format.h
+++ b/clang/include/clang/Format/Format.h
@@ -1212,6 +1212,22 @@ struct FormatStyle {
   /// \version 3.7
   bool BinPackArguments;
 
+  /// If ``BinPackLongBracedList`` is ``true`` it overrides
+  /// ``BinPackArguments`` if there are 20 or more items in a braced
+  /// initializer list.
+  /// \code
+  ///BinPackLongBracedList: false  vs.BinPackLongBracedList: true
+  ///vector x{   vector x{1, 2, ...,
+  ///   20, 21};
+  ///1,
+  ///2,
+  ///...,
+  ///20,
+  ///21};
+  /// \endcode
+  /// \version 21
+  bool BinPackLongBracedList;
+
   /// Different way to try to fit all parameters on a line.
   enum BinPackParametersStyle : int8_t {
 /// Bin-pack parameters.
@@ -5266,6 +5282,7 @@ struct FormatStyle {
R.AlwaysBreakBeforeMultilineStrings &&
AttributeMacros == R.AttributeMacros &&
BinPackArguments == R.BinPackArguments &&
+   BinPackLongBracedList == R.BinPackLongBracedList &&
BinPackParameters == R.BinPackParameters &&
BitFieldColonSpacing == R.BitFieldColonSpacing &&
BracedInitializerIndentWidth == R.BracedInitializerIndentWidth &&

diff  --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index 387daad934f67ac..0898b69528ebcde 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -995,6 +995,7 @@ template <> struct MappingTraits {
Style.AlwaysBreakBeforeMultilineStrings);
 IO.mapOptional("AttributeMacros", Style.AttributeMacros);
 IO.mapOptional("BinPackArguments", Style.BinPackArguments);
+IO.mapOptional("BinPackLongBracedList", Style.BinPackLongBracedList);
 IO.mapOptional("BinPackParameters", Style.BinPackParameters);
 IO.mapOptional("BitFieldColonSpacing", Style.BitFieldColonSpacing);
 IO.mapOptional("BracedInitializerIndentWidth",
@@ -1507,6 +1508,7 @@ FormatStyle getLLVMStyle(FormatStyle::LanguageKind 
Language) {
   LLVMStyle.AlwaysBreakBeforeMultilineStrings = false;
   LLVMStyle.AttributeMacros.push_back("__capability");
   LLVMStyle.BinPackArguments = true;
+  LLVMStyle.BinPackLongBracedList = true;
   LLVMStyle.BinPackParameters = Format

[clang] [clang-format] Add BinPackLongBracedList style option (PR #112482)

2025-02-07 Thread Owen Pan via cfe-commits

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


[clang] [clang] [ASTDump] Add support for structural value template arguments in TextNodeDumper (PR #126341)

2025-02-07 Thread Younan Zhang via cfe-commits


@@ -54,6 +54,8 @@ ABI Changes in This Version
 AST Dumping Potentially Breaking Changes
 
 
+- Added support for dumping structural value template arguments in AST dumps. 
(#GH126341)

zyn0217 wrote:

We don't usually reference PR numbers in the release note - so if there isn't 
any tracking issue, leaving it empty is fine.

```suggestion
- Added support for dumping template arguments of structural value kinds.
```

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


[clang] [clang] [ASTDump] Add support for structural value template arguments in TextNodeDumper (PR #126341)

2025-02-07 Thread Younan Zhang via cfe-commits


@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -std=c++20 -ast-dump -ast-dump-filter=pr126341 %s | 
FileCheck %s

zyn0217 wrote:

Can you consolidate the test into a pre-existing file e.g. 
`AST/ast-dump-templates.cpp`?

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


[clang] [clang] [ASTDump] Add support for structural value template arguments in TextNodeDumper (PR #126341)

2025-02-07 Thread via cfe-commits

https://github.com/sakria9 updated 
https://github.com/llvm/llvm-project/pull/126341

>From a382aa9de206a194397f9424150f170d35101b42 Mon Sep 17 00:00:00 2001
From: sakria9 
Date: Sat, 8 Feb 2025 04:00:08 +
Subject: [PATCH 1/6] [ASTDump] Add support for structural value template
 arguments in TextNodeDumper

---
 clang/include/clang/AST/TextNodeDumper.h | 1 +
 clang/lib/AST/TextNodeDumper.cpp | 5 +
 2 files changed, 6 insertions(+)

diff --git a/clang/include/clang/AST/TextNodeDumper.h 
b/clang/include/clang/AST/TextNodeDumper.h
index bfd205ffb0d99ad..4b5ad2b5fa74c04 100644
--- a/clang/include/clang/AST/TextNodeDumper.h
+++ b/clang/include/clang/AST/TextNodeDumper.h
@@ -249,6 +249,7 @@ class TextNodeDumper
   void VisitDeclarationTemplateArgument(const TemplateArgument &TA);
   void VisitNullPtrTemplateArgument(const TemplateArgument &TA);
   void VisitIntegralTemplateArgument(const TemplateArgument &TA);
+  void VisitStructuralValueTemplateArgument(const TemplateArgument &TA);
   void VisitTemplateTemplateArgument(const TemplateArgument &TA);
   void VisitTemplateExpansionTemplateArgument(const TemplateArgument &TA);
   void VisitExpressionTemplateArgument(const TemplateArgument &TA);
diff --git a/clang/lib/AST/TextNodeDumper.cpp b/clang/lib/AST/TextNodeDumper.cpp
index 6da1f776b4b6357..cb0c742177d2c7f 100644
--- a/clang/lib/AST/TextNodeDumper.cpp
+++ b/clang/lib/AST/TextNodeDumper.cpp
@@ -1226,6 +1226,11 @@ void TextNodeDumper::VisitIntegralTemplateArgument(const 
TemplateArgument &TA) {
   dumpTemplateArgument(TA);
 }
 
+void TextNodeDumper::VisitStructuralValueTemplateArgument(const 
TemplateArgument &TA) {
+  OS << " structural value";
+  dumpTemplateArgument(TA);
+}
+
 void TextNodeDumper::dumpTemplateName(TemplateName TN, StringRef Label) {
   AddChild(Label, [=] {
 {

>From 5e9bfa7141a1b0eda2fe41d2727c66a1e4c19e5d Mon Sep 17 00:00:00 2001
From: sakria9 
Date: Sat, 8 Feb 2025 04:11:05 +
Subject: [PATCH 2/6] format

---
 clang/lib/AST/TextNodeDumper.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/clang/lib/AST/TextNodeDumper.cpp b/clang/lib/AST/TextNodeDumper.cpp
index cb0c742177d2c7f..08efcda46b8f9a4 100644
--- a/clang/lib/AST/TextNodeDumper.cpp
+++ b/clang/lib/AST/TextNodeDumper.cpp
@@ -1226,7 +1226,8 @@ void TextNodeDumper::VisitIntegralTemplateArgument(const 
TemplateArgument &TA) {
   dumpTemplateArgument(TA);
 }
 
-void TextNodeDumper::VisitStructuralValueTemplateArgument(const 
TemplateArgument &TA) {
+void TextNodeDumper::VisitStructuralValueTemplateArgument(
+const TemplateArgument &TA) {
   OS << " structural value";
   dumpTemplateArgument(TA);
 }

>From f930983e7286e4d1e46fbd2081996fd18ebdddfc Mon Sep 17 00:00:00 2001
From: sakria9 
Date: Sat, 8 Feb 2025 05:50:35 +
Subject: [PATCH 3/6] add test

---
 .../ast-dump-template-argument-structural-value.cpp  | 12 
 1 file changed, 12 insertions(+)
 create mode 100644 
clang/test/AST/ast-dump-template-argument-structural-value.cpp

diff --git a/clang/test/AST/ast-dump-template-argument-structural-value.cpp 
b/clang/test/AST/ast-dump-template-argument-structural-value.cpp
new file mode 100644
index 000..61d4a9ef82db439
--- /dev/null
+++ b/clang/test/AST/ast-dump-template-argument-structural-value.cpp
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -std=c++20 -ast-dump -ast-dump-filter=pr126341 %s | 
FileCheck %s
+
+template<_Complex int x>
+struct pr126341;
+template<>
+struct pr126341<{1, 2}>;
+
+// CHECK: Dumping pr126341:
+// CHECK-NEXT: ClassTemplateDecl
+// CHECK: Dumping pr126341:
+// CHECK-NEXT: ClassTemplateSpecializationDecl
+// CHECK-NEXT: `-TemplateArgument structural value '1+2i'
\ No newline at end of file

>From b80626ff56adc6db71298eea7fd824b9463056e8 Mon Sep 17 00:00:00 2001
From: sakria9 
Date: Sat, 8 Feb 2025 05:55:15 +
Subject: [PATCH 4/6] add newline

---
 clang/test/AST/ast-dump-template-argument-structural-value.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/test/AST/ast-dump-template-argument-structural-value.cpp 
b/clang/test/AST/ast-dump-template-argument-structural-value.cpp
index 61d4a9ef82db439..7f5a3d4508f1cfd 100644
--- a/clang/test/AST/ast-dump-template-argument-structural-value.cpp
+++ b/clang/test/AST/ast-dump-template-argument-structural-value.cpp
@@ -9,4 +9,4 @@ struct pr126341<{1, 2}>;
 // CHECK-NEXT: ClassTemplateDecl
 // CHECK: Dumping pr126341:
 // CHECK-NEXT: ClassTemplateSpecializationDecl
-// CHECK-NEXT: `-TemplateArgument structural value '1+2i'
\ No newline at end of file
+// CHECK-NEXT: `-TemplateArgument structural value '1+2i'

>From 5678ce0a8910bb9800e182ca7755a14e446f0f72 Mon Sep 17 00:00:00 2001
From: sakria9 
Date: Sat, 8 Feb 2025 05:58:39 +
Subject: [PATCH 5/6] add release note

---
 clang/docs/ReleaseNotes.rst | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 92f63c15030898f..89cb0f7e9d57db3 100644
--- a/clang/docs/Rele

[clang] [llvm] [libclang/python] Enable packaging libclang bindings (PR #125806)

2025-02-07 Thread Ryan Mast via cfe-commits


@@ -0,0 +1,34 @@
+[build-system]
+requires = ["setuptools>=42", "setuptools_scm"]
+build-backend = "setuptools.build_meta"
+
+[project]
+name = "clang"
+description = "libclang python bindings"
+readme = {file = "README.txt", content-type = "text/plain"}
+
+license = { text = "Apache-2.0 with LLVM exception" }
+authors = [
+{ name = "LLVM" }
+]
+keywords = ["llvm", "clang", "libclang"]
+classifiers = [
+"Intended Audience :: Developers",
+"License :: OSI Approved :: Apache Software License",
+"Development Status :: 5 - Production/Stable",
+"Topic :: Software Development :: Compilers",
+"Operating System :: OS Independent",
+"Programming Language :: Python :: 3",
+]
+dynamic = ["version"]
+
+[project.urls]
+Homepage = "http://clang.llvm.org/";
+Download = "http://llvm.org/releases/download.html";

nightlark wrote:

It looks like @sighingnow is the one who maintains that site (doc build scripts 
at https://github.com/sighingnow/libclang/tree/master/docs). If he's okay with 
it (my RTD username is rmast), I can get that documentation site updated.

Otherwise, the docs are just built with sphinx so we could upload it as a 
subpage to one of the documentation sites under the llvm.org domain -- if the 
source code for those sites is under the llvm org I can look at opening a PR to 
generate the libclang Python binding docs and deploying them to a website.

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


[clang] [llvm] [HLSL] [DXIL] Implement the `AddUint64` HLSL function and the `UAddc` DXIL op (PR #125319)

2025-02-07 Thread Finn Plummer via cfe-commits

https://github.com/inbelic commented:

My comments are addressed and this LGTM if we go ahead with the current 
implementation. That being said, I think if there is a (not-too-complex) way 
that we can re-use the codegen, then I would vote for that. So maybe we could 
bring this up quickly in a design meeting.

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


[clang] [llvm] [HLSL] [DXIL] Implement the `AddUint64` HLSL function and the `UAddc` DXIL op (PR #125319)

2025-02-07 Thread Farzon Lotfi via cfe-commits


@@ -19105,6 +19105,51 @@ Value *CodeGenFunction::EmitHLSLBuiltinExpr(unsigned 
BuiltinID,
 return nullptr;
 
   switch (BuiltinID) {
+  case Builtin::BI__builtin_hlsl_adduint64: {

farzonl wrote:

So the downside of what I suggested is that it would be a hybrid solution. You 
are writing the algorithm in  HLSL, but you are also massaging the codegen to 
do out args  instead of pointers, and write sema checks because we have to 
introduce a new builtin.

My thinking was  there would be less total codgen if we did it the way I 
suggested and some of the sema checks would  benefit from language rules  
instead of us having to  put a bunch of effort into `HLSLSema.cpp`.   I don't 
have a strong opinion.  So I won't make a requirement here. 

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


[clang] [llvm] [CaptureTracking][FunctionAttrs] Add support for CaptureInfo (PR #125880)

2025-02-07 Thread via cfe-commits

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

LGTM

I think another set of eyes on this would be useful, can you wait a few days 
before pushing unless you get another approval.

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


[clang] [clang][ExtractAPI] combine typedef records if the underlying type's name is underscored (PR #125964)

2025-02-07 Thread via cfe-commits

QuietMisdreavus wrote:

I don't see how that failure is related to my PR; my change was restricted to 
ExtractAPI, it shouldn't be affecting the driver invocations.

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


[clang] [HLSL] Implement HLSL intialization list support (PR #123141)

2025-02-07 Thread Helena Kotas via cfe-commits


@@ -2576,3 +2576,162 @@ void SemaHLSL::processExplicitBindingsOnDecl(VarDecl 
*VD) {
 }
   }
 }
+
+static bool CastInitializer(Sema &S, ASTContext &Ctx, Expr *E,
+llvm::SmallVectorImpl &List,
+llvm::SmallVectorImpl &DestTypes) {
+  if (List.size() >= DestTypes.size())
+return false;
+  InitializedEntity Entity =
+  InitializedEntity::InitializeParameter(Ctx, DestTypes[List.size()], 
false);
+  ExprResult Res =
+  S.PerformCopyInitialization(Entity, E->getBeginLoc(), E);
+  if (Res.isInvalid())
+return false;
+  Expr *Init = Res.get();
+  List.push_back(Init);
+  return true;
+}
+
+static void BuildIntializerList(Sema &S, ASTContext &Ctx, Expr *E,
+llvm::SmallVectorImpl &List,
+llvm::SmallVectorImpl &DestTypes,
+bool &ExcessInits) {
+  if (List.size() >= DestTypes.size()) {
+ExcessInits = true;
+return;
+  }
+
+  // If this is an initialization list, traverse the sub initializers.
+  if (auto *Init = dyn_cast(E)) {
+for (auto *SubInit : Init->inits())
+  BuildIntializerList(S, Ctx, SubInit, List, DestTypes, ExcessInits);
+return;
+  }
+
+  // If this is a scalar type, just enqueue the expression.
+  QualType Ty = E->getType();
+  if (Ty->isScalarType()) {
+(void)CastInitializer(S, Ctx, E, List, DestTypes);
+return;
+  }
+
+  if (auto *ATy = Ty->getAs()) {
+uint64_t Size = ATy->getNumElements();
+
+if (List.size() + Size > DestTypes.size()) {
+  ExcessInits = true;
+  return;
+}
+QualType SizeTy = Ctx.getSizeType();
+uint64_t SizeTySize = Ctx.getTypeSize(SizeTy);
+for (uint64_t I = 0; I < Size; ++I) {
+  auto *Idx = IntegerLiteral::Create(Ctx, llvm::APInt(SizeTySize, I),
+ SizeTy, SourceLocation());
+
+  ExprResult ElExpr = S.CreateBuiltinArraySubscriptExpr(
+  E, E->getBeginLoc(), Idx, E->getEndLoc());
+  if (ElExpr.isInvalid())
+return;
+  if (!CastInitializer(S, Ctx, ElExpr.get(), List, DestTypes))
+return;
+}
+return;
+  }
+
+  if (auto *VTy = dyn_cast(Ty.getTypePtr())) {
+uint64_t Size = VTy->getZExtSize();
+QualType SizeTy = Ctx.getSizeType();
+uint64_t SizeTySize = Ctx.getTypeSize(SizeTy);
+for (uint64_t I = 0; I < Size; ++I) {
+  auto *Idx = IntegerLiteral::Create(Ctx, llvm::APInt(SizeTySize, I),
+ SizeTy, SourceLocation());
+  ExprResult ElExpr = S.CreateBuiltinArraySubscriptExpr(
+  E, E->getBeginLoc(), Idx, E->getEndLoc());
+  if (ElExpr.isInvalid())
+return;
+  BuildIntializerList(S, Ctx, ElExpr.get(), List, DestTypes, ExcessInits);
+}
+return;
+  }
+
+  if (auto *RTy = Ty->getAs()) {
+for (auto *FD : RTy->getDecl()->fields()) {
+  DeclAccessPair Found = DeclAccessPair::make(FD, FD->getAccess());
+  DeclarationNameInfo NameInfo(FD->getDeclName(), E->getBeginLoc());
+  ExprResult Res = S.BuildFieldReferenceExpr(
+  E, false, E->getBeginLoc(), CXXScopeSpec(), FD, Found, NameInfo);
+  if (Res.isInvalid())
+return;
+  BuildIntializerList(S, Ctx, Res.get(), List, DestTypes, ExcessInits);
+}
+  }
+}
+
+static Expr *GenerateInitLists(ASTContext &Ctx, QualType Ty,
+   llvm::SmallVectorImpl::iterator &It) {
+  if (Ty->isScalarType()) {
+return *(It++);
+  }
+  llvm::SmallVector Inits;
+  assert(!isa(Ty) && "Matrix types not yet supported in HLSL");
+  if (Ty->isVectorType() || Ty->isConstantArrayType()) {
+QualType ElTy;
+uint64_t Size = 0;
+if (auto *ATy = Ty->getAs()) {
+  ElTy = ATy->getElementType();
+  Size = ATy->getNumElements();
+} else {
+  auto *VTy = cast(Ty.getTypePtr());
+  ElTy = VTy->getElementType();
+  Size = VTy->getZExtSize();
+}
+for (uint64_t I = 0; I < Size; ++I)
+  Inits.push_back(GenerateInitLists(Ctx, ElTy, It));
+  }
+  if (const RecordDecl *RD = Ty->getAsRecordDecl()) {
+for (auto *FD : RD->fields()) {
+  Inits.push_back(GenerateInitLists(Ctx, FD->getType(), It));
+}
+  }
+  auto *NewInit = new (Ctx) InitListExpr(Ctx, Inits.front()->getBeginLoc(),
+ Inits, Inits.back()->getEndLoc());
+  NewInit->setType(Ty);
+  return NewInit;
+}
+
+bool SemaHLSL::TransformInitList(const InitializedEntity &Entity,
+ const InitializationKind &Kind,
+ InitListExpr *Init) {
+  // If the initializer is a scalar, just return it.
+  if (Init->getType()->isScalarType())
+return true;
+  ASTContext &Ctx = SemaRef.getASTContext();
+  llvm::SmallVector DestTypes;
+  // An initializer list might be attempting to initialize a reference or
+  // rvalue-reference. When checking the initializer we should look through the
+  // reference.
+  Qual

[clang] [HLSL] Implement HLSL intialization list support (PR #123141)

2025-02-07 Thread Helena Kotas via cfe-commits


@@ -0,0 +1,714 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py 
UTC_ARGS: --version 5
+// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -disable-llvm-passes 
-emit-llvm -finclude-default-header -o - %s | FileCheck %s
+
+struct TwoFloats {
+  float X, Y;
+};
+
+struct TwoInts {
+  int Z, W;
+};
+
+struct Doggo {
+  int4 LegState;
+  int TailState;
+  float HairCount;
+  float4 EarDirection[2];
+};
+
+struct AnimalBits {
+  int Legs[4];
+  uint State;
+  int64_t Counter;
+  float4 LeftDir;
+  float4 RightDir;
+};
+
+struct Kitteh {
+  int4 Legs;
+  int TailState;
+  float HairCount;
+  float4 Claws[2];
+};
+
+struct Zoo {
+  Doggo Dogs[2];
+  Kitteh Cats[4];
+};
+
+// Case 1: Extraneous braces get ignored in literal instantiation.
+// CHECK-LABEL: define void @_Z5case1v(
+// CHECK-SAME: ptr dead_on_unwind noalias writable 
sret([[STRUCT_TWOFLOATS:%.*]]) align 4 [[AGG_RESULT:%.*]]) #[[ATTR0:[0-9]+]] {
+// CHECK-NEXT:  [[ENTRY:.*:]]
+// CHECK-NEXT:call void @llvm.memcpy.p0.p0.i32(ptr align 4 [[AGG_RESULT]], 
ptr align 4 @__const._Z5case1v.TF1, i32 8, i1 false)
+// CHECK-NEXT:ret void
+//
+TwoFloats case1() {
+  TwoFloats TF1 = {{{1.0, 2}}};
+  return TF1;
+}
+
+// Case 2: Valid C/C++ initializer is handled appropriately.
+// CHECK-LABEL: define void @_Z5case2v(
+// CHECK-SAME: ptr dead_on_unwind noalias writable 
sret([[STRUCT_TWOFLOATS:%.*]]) align 4 [[AGG_RESULT:%.*]]) #[[ATTR0]] {
+// CHECK-NEXT:  [[ENTRY:.*:]]
+// CHECK-NEXT:call void @llvm.memcpy.p0.p0.i32(ptr align 4 [[AGG_RESULT]], 
ptr align 4 @__const._Z5case2v.TF2, i32 8, i1 false)
+// CHECK-NEXT:ret void
+//
+TwoFloats case2() {
+  TwoFloats TF2 = {1, 2};
+  return TF2;
+}
+
+// Case 3: Simple initialization with conversion of an argument.
+// CHECK-LABEL: define void @_Z5case3i(
+// CHECK-SAME: ptr dead_on_unwind noalias writable 
sret([[STRUCT_TWOFLOATS:%.*]]) align 4 [[AGG_RESULT:%.*]], i32 noundef 
[[VAL:%.*]]) #[[ATTR0]] {
+// CHECK-NEXT:  [[ENTRY:.*:]]
+// CHECK-NEXT:[[VAL_ADDR:%.*]] = alloca i32, align 4
+// CHECK-NEXT:store i32 [[VAL]], ptr [[VAL_ADDR]], align 4
+// CHECK-NEXT:[[X:%.*]] = getelementptr inbounds nuw [[STRUCT_TWOFLOATS]], 
ptr [[AGG_RESULT]], i32 0, i32 0
+// CHECK-NEXT:[[TMP0:%.*]] = load i32, ptr [[VAL_ADDR]], align 4
+// CHECK-NEXT:[[CONV:%.*]] = sitofp i32 [[TMP0]] to float
+// CHECK-NEXT:store float [[CONV]], ptr [[X]], align 4
+// CHECK-NEXT:[[Y:%.*]] = getelementptr inbounds nuw [[STRUCT_TWOFLOATS]], 
ptr [[AGG_RESULT]], i32 0, i32 1
+// CHECK-NEXT:store float 2.00e+00, ptr [[Y]], align 4
+// CHECK-NEXT:ret void
+//
+TwoFloats case3(int Val) {
+  TwoFloats TF3 = {Val, 2};
+  return TF3;
+}
+
+// Case 4: Initialization from a scalarized vector into a structure with 
element
+// conversions.
+// CHECK-LABEL: define void @_Z5case4Dv2_i(
+// CHECK-SAME: ptr dead_on_unwind noalias writable 
sret([[STRUCT_TWOFLOATS:%.*]]) align 4 [[AGG_RESULT:%.*]], <2 x i32> noundef 
[[TWOVALS:%.*]]) #[[ATTR0]] {
+// CHECK-NEXT:  [[ENTRY:.*:]]
+// CHECK-NEXT:[[TWOVALS_ADDR:%.*]] = alloca <2 x i32>, align 8
+// CHECK-NEXT:store <2 x i32> [[TWOVALS]], ptr [[TWOVALS_ADDR]], align 8
+// CHECK-NEXT:[[X:%.*]] = getelementptr inbounds nuw [[STRUCT_TWOFLOATS]], 
ptr [[AGG_RESULT]], i32 0, i32 0
+// CHECK-NEXT:[[TMP0:%.*]] = load <2 x i32>, ptr [[TWOVALS_ADDR]], align 8
+// CHECK-NEXT:[[VECEXT:%.*]] = extractelement <2 x i32> [[TMP0]], i64 0
+// CHECK-NEXT:[[CONV:%.*]] = sitofp i32 [[VECEXT]] to float
+// CHECK-NEXT:store float [[CONV]], ptr [[X]], align 4
+// CHECK-NEXT:[[Y:%.*]] = getelementptr inbounds nuw [[STRUCT_TWOFLOATS]], 
ptr [[AGG_RESULT]], i32 0, i32 1
+// CHECK-NEXT:[[TMP1:%.*]] = load <2 x i32>, ptr [[TWOVALS_ADDR]], align 8
+// CHECK-NEXT:[[VECEXT1:%.*]] = extractelement <2 x i32> [[TMP1]], i64 1
+// CHECK-NEXT:[[CONV2:%.*]] = sitofp i32 [[VECEXT1]] to float
+// CHECK-NEXT:store float [[CONV2]], ptr [[Y]], align 4
+// CHECK-NEXT:ret void
+//
+TwoFloats case4(int2 TwoVals) {
+  TwoFloats TF4 = {TwoVals};
+  return TF4;
+}
+
+// Case 5: Initialization from a scalarized vector of matching type.
+// CHECK-LABEL: define void @_Z5case5Dv2_i(
+// CHECK-SAME: ptr dead_on_unwind noalias writable 
sret([[STRUCT_TWOINTS:%.*]]) align 4 [[AGG_RESULT:%.*]], <2 x i32> noundef 
[[TWOVALS:%.*]]) #[[ATTR0]] {
+// CHECK-NEXT:  [[ENTRY:.*:]]
+// CHECK-NEXT:[[TWOVALS_ADDR:%.*]] = alloca <2 x i32>, align 8
+// CHECK-NEXT:store <2 x i32> [[TWOVALS]], ptr [[TWOVALS_ADDR]], align 8
+// CHECK-NEXT:[[Z:%.*]] = getelementptr inbounds nuw [[STRUCT_TWOINTS]], 
ptr [[AGG_RESULT]], i32 0, i32 0
+// CHECK-NEXT:[[TMP0:%.*]] = load <2 x i32>, ptr [[TWOVALS_ADDR]], align 8
+// CHECK-NEXT:[[VECEXT:%.*]] = extractelement <2 x i32> [[TMP0]], i64 0
+// CHECK-NEXT:store i32 [[VECEXT]], ptr [[Z]], align 4
+// CHECK-NEXT:[[W:%.*]] = getelementptr inbounds nuw [[STRUCT_TWOINTS]], 
ptr 

[clang] [HLSL] Implement HLSL intialization list support (PR #123141)

2025-02-07 Thread Helena Kotas via cfe-commits


@@ -2576,3 +2576,162 @@ void SemaHLSL::processExplicitBindingsOnDecl(VarDecl 
*VD) {
 }
   }
 }
+
+static bool CastInitializer(Sema &S, ASTContext &Ctx, Expr *E,
+llvm::SmallVectorImpl &List,
+llvm::SmallVectorImpl &DestTypes) {
+  if (List.size() >= DestTypes.size())
+return false;
+  InitializedEntity Entity =
+  InitializedEntity::InitializeParameter(Ctx, DestTypes[List.size()], 
false);
+  ExprResult Res =
+  S.PerformCopyInitialization(Entity, E->getBeginLoc(), E);
+  if (Res.isInvalid())
+return false;
+  Expr *Init = Res.get();
+  List.push_back(Init);
+  return true;
+}
+
+static void BuildIntializerList(Sema &S, ASTContext &Ctx, Expr *E,

hekota wrote:

```suggestion
static void BuildInitializerList(Sema &S, ASTContext &Ctx, Expr *E,
```

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


[clang] [llvm] [ThinLTO] Support dead RTTI data elimination under -fno-split-lto-unit (PR #126336)

2025-02-07 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-llvm-transforms

Author: None (luxufan)


Changes

This commit enhances the ThinLTO pipeline to support the elimination of unused 
Run-Time Type Information (RTTI) data when the `-fno-split-lto-unit` flag is 
used. Previously, dead RTTI data was not effectively removed, leading to larger 
binary sizes.

---

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


26 Files Affected:

- (modified) clang/lib/CodeGen/ItaniumCXXABI.cpp (+1) 
- (added) clang/test/CodeGenCXX/typeid-type-test.cpp (+32) 
- (modified) llvm/include/llvm/Analysis/TypeMetadataUtils.h (+2) 
- (modified) llvm/include/llvm/AsmParser/LLParser.h (+1) 
- (modified) llvm/include/llvm/AsmParser/LLToken.h (+1) 
- (modified) llvm/include/llvm/Bitcode/LLVMBitCodes.h (+1) 
- (modified) llvm/include/llvm/IR/ModuleSummaryIndex.h (+22) 
- (modified) llvm/include/llvm/LTO/LTO.h (+10-2) 
- (added) llvm/include/llvm/Support/LibCXXABI.h (+49) 
- (added) llvm/include/llvm/Transforms/IPO/DeadRTTIElimination.h (+21) 
- (modified) llvm/lib/Analysis/ModuleSummaryAnalysis.cpp (+64-2) 
- (modified) llvm/lib/Analysis/TypeMetadataUtils.cpp (+61) 
- (modified) llvm/lib/AsmParser/LLLexer.cpp (+1) 
- (modified) llvm/lib/AsmParser/LLParser.cpp (+30) 
- (modified) llvm/lib/Bitcode/Reader/BitcodeReader.cpp (+13) 
- (modified) llvm/lib/Bitcode/Writer/BitcodeWriter.cpp (+15) 
- (modified) llvm/lib/IR/AsmWriter.cpp (+12) 
- (modified) llvm/lib/LTO/LTO.cpp (+25-9) 
- (modified) llvm/lib/LTO/LTOBackend.cpp (+13-3) 
- (modified) llvm/lib/Support/CMakeLists.txt (+1) 
- (added) llvm/lib/Support/LibCXXABI.cpp (+25) 
- (modified) llvm/lib/Transforms/IPO/CMakeLists.txt (+1) 
- (added) llvm/lib/Transforms/IPO/DeadRTTIElimination.cpp (+46) 
- (added) llvm/test/Assembler/thinlto-rtti-summary.ll (+20) 
- (added) llvm/test/ThinLTO/X86/rtti-clean.ll (+34) 
- (added) llvm/test/ThinLTO/X86/rtti-dont-clean.ll (+46) 


``diff
diff --git a/clang/lib/CodeGen/ItaniumCXXABI.cpp 
b/clang/lib/CodeGen/ItaniumCXXABI.cpp
index 7c463f51f63dc5c..090eb4c16ce0b47 100644
--- a/clang/lib/CodeGen/ItaniumCXXABI.cpp
+++ b/clang/lib/CodeGen/ItaniumCXXABI.cpp
@@ -1592,6 +1592,7 @@ llvm::Value *ItaniumCXXABI::EmitTypeid(CodeGenFunction 
&CGF,
   cast(SrcRecordTy->castAs()->getDecl());
   llvm::Value *Value = CGF.GetVTablePtr(ThisPtr, CGM.GlobalsInt8PtrTy,
 ClassDecl);
+  CGF.EmitTypeMetadataCodeForVCall(ClassDecl, Value, SourceLocation());
 
   if (CGM.getItaniumVTableContext().isRelativeLayout()) {
 // Load the type info.
diff --git a/clang/test/CodeGenCXX/typeid-type-test.cpp 
b/clang/test/CodeGenCXX/typeid-type-test.cpp
new file mode 100644
index 000..9408d87495c608b
--- /dev/null
+++ b/clang/test/CodeGenCXX/typeid-type-test.cpp
@@ -0,0 +1,32 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py 
UTC_ARGS: --version 5
+// RUN: %clang_cc1 -I%S -triple x86_64-unknown-linux -flto 
-fwhole-program-vtables -fvisibility=hidden -emit-llvm -o - %s | FileCheck %s
+
+#include 
+
+namespace Test1 {
+struct A { virtual void f(); };
+
+// CHECK-LABEL: define hidden noundef nonnull align 8 dereferenceable(16) ptr 
@_ZN5Test19gettypeidEPNS_1AE(
+// CHECK-SAME: ptr noundef [[A:%.*]]) #[[ATTR0:[0-9]+]] {
+// CHECK-NEXT:  [[ENTRY:.*:]]
+// CHECK-NEXT:[[A_ADDR:%.*]] = alloca ptr, align 8
+// CHECK-NEXT:store ptr [[A]], ptr [[A_ADDR]], align 8
+// CHECK-NEXT:[[TMP0:%.*]] = load ptr, ptr [[A_ADDR]], align 8
+// CHECK-NEXT:[[TMP1:%.*]] = icmp eq ptr [[TMP0]], null
+// CHECK-NEXT:br i1 [[TMP1]], label %[[TYPEID_BAD_TYPEID:.*]], label 
%[[TYPEID_END:.*]]
+// CHECK:   [[TYPEID_BAD_TYPEID]]:
+// CHECK-NEXT:call void @__cxa_bad_typeid() #[[ATTR3:[0-9]+]]
+// CHECK-NEXT:unreachable
+// CHECK:   [[TYPEID_END]]:
+// CHECK-NEXT:[[VTABLE:%.*]] = load ptr, ptr [[TMP0]], align 8
+// CHECK-NEXT:[[TMP2:%.*]] = call i1 @llvm.type.test(ptr [[VTABLE]], 
metadata !"_ZTSN5Test11AE")
+// CHECK-NEXT:call void @llvm.assume(i1 [[TMP2]])
+// CHECK-NEXT:[[TMP3:%.*]] = getelementptr inbounds ptr, ptr [[VTABLE]], 
i64 -1
+// CHECK-NEXT:[[TMP4:%.*]] = load ptr, ptr [[TMP3]], align 8
+// CHECK-NEXT:ret ptr [[TMP4]]
+//
+const std::type_info &gettypeid(A *a) {
+  return typeid(*a);
+}
+
+}
diff --git a/llvm/include/llvm/Analysis/TypeMetadataUtils.h 
b/llvm/include/llvm/Analysis/TypeMetadataUtils.h
index bdb477b54b532d0..87da08dba34c745 100644
--- a/llvm/include/llvm/Analysis/TypeMetadataUtils.h
+++ b/llvm/include/llvm/Analysis/TypeMetadataUtils.h
@@ -51,6 +51,8 @@ void findDevirtualizableCallsForTypeTest(
 SmallVectorImpl &Assumes, const CallInst *CI,
 DominatorTree &DT);
 
+bool hasTypeIdLoadForTypeTest(const CallInst *CI);
+
 /// Given a call to the intrinsic \@llvm.type.checked.load, find all
 /// devirtualizable call sites based on the call and return them in 
DevirtCalls.
 void findDevirt

[clang] [llvm] [ThinLTO] Support dead RTTI data elimination under -fno-split-lto-unit (PR #126336)

2025-02-07 Thread via cfe-commits

https://github.com/luxufan created 
https://github.com/llvm/llvm-project/pull/126336

This commit enhances the ThinLTO pipeline to support the elimination of unused 
Run-Time Type Information (RTTI) data when the `-fno-split-lto-unit` flag is 
used. Previously, dead RTTI data was not effectively removed, leading to larger 
binary sizes.

>From 83b532a3382a07e472558b8813d43a6f51801423 Mon Sep 17 00:00:00 2001
From: luxufan 
Date: Thu, 23 Jan 2025 09:28:15 +0800
Subject: [PATCH] [ThinLTO] Support dead RTTI data elimination under
 -fno-split-lto-unit

This commit enhances the ThinLTO pipeline to support the elimination of
unused Run-Time Type Information (RTTI) data when the
`-fno-split-lto-unit` flag is used. Previously, dead RTTI data was not
effectively removed, leading to larger binary sizes.
---
 clang/lib/CodeGen/ItaniumCXXABI.cpp   |  1 +
 clang/test/CodeGenCXX/typeid-type-test.cpp| 32 +
 .../include/llvm/Analysis/TypeMetadataUtils.h |  2 +
 llvm/include/llvm/AsmParser/LLParser.h|  1 +
 llvm/include/llvm/AsmParser/LLToken.h |  1 +
 llvm/include/llvm/Bitcode/LLVMBitCodes.h  |  1 +
 llvm/include/llvm/IR/ModuleSummaryIndex.h | 22 +++
 llvm/include/llvm/LTO/LTO.h   | 12 +++-
 llvm/include/llvm/Support/LibCXXABI.h | 49 ++
 .../llvm/Transforms/IPO/DeadRTTIElimination.h | 21 ++
 llvm/lib/Analysis/ModuleSummaryAnalysis.cpp   | 66 ++-
 llvm/lib/Analysis/TypeMetadataUtils.cpp   | 61 +
 llvm/lib/AsmParser/LLLexer.cpp|  1 +
 llvm/lib/AsmParser/LLParser.cpp   | 30 +
 llvm/lib/Bitcode/Reader/BitcodeReader.cpp | 13 
 llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | 15 +
 llvm/lib/IR/AsmWriter.cpp | 12 
 llvm/lib/LTO/LTO.cpp  | 34 +++---
 llvm/lib/LTO/LTOBackend.cpp   | 16 -
 llvm/lib/Support/CMakeLists.txt   |  1 +
 llvm/lib/Support/LibCXXABI.cpp| 25 +++
 llvm/lib/Transforms/IPO/CMakeLists.txt|  1 +
 .../Transforms/IPO/DeadRTTIElimination.cpp| 46 +
 llvm/test/Assembler/thinlto-rtti-summary.ll   | 20 ++
 llvm/test/ThinLTO/X86/rtti-clean.ll   | 34 ++
 llvm/test/ThinLTO/X86/rtti-dont-clean.ll  | 46 +
 26 files changed, 547 insertions(+), 16 deletions(-)
 create mode 100644 clang/test/CodeGenCXX/typeid-type-test.cpp
 create mode 100644 llvm/include/llvm/Support/LibCXXABI.h
 create mode 100644 llvm/include/llvm/Transforms/IPO/DeadRTTIElimination.h
 create mode 100644 llvm/lib/Support/LibCXXABI.cpp
 create mode 100644 llvm/lib/Transforms/IPO/DeadRTTIElimination.cpp
 create mode 100644 llvm/test/Assembler/thinlto-rtti-summary.ll
 create mode 100644 llvm/test/ThinLTO/X86/rtti-clean.ll
 create mode 100644 llvm/test/ThinLTO/X86/rtti-dont-clean.ll

diff --git a/clang/lib/CodeGen/ItaniumCXXABI.cpp 
b/clang/lib/CodeGen/ItaniumCXXABI.cpp
index 7c463f51f63dc5c..090eb4c16ce0b47 100644
--- a/clang/lib/CodeGen/ItaniumCXXABI.cpp
+++ b/clang/lib/CodeGen/ItaniumCXXABI.cpp
@@ -1592,6 +1592,7 @@ llvm::Value *ItaniumCXXABI::EmitTypeid(CodeGenFunction 
&CGF,
   cast(SrcRecordTy->castAs()->getDecl());
   llvm::Value *Value = CGF.GetVTablePtr(ThisPtr, CGM.GlobalsInt8PtrTy,
 ClassDecl);
+  CGF.EmitTypeMetadataCodeForVCall(ClassDecl, Value, SourceLocation());
 
   if (CGM.getItaniumVTableContext().isRelativeLayout()) {
 // Load the type info.
diff --git a/clang/test/CodeGenCXX/typeid-type-test.cpp 
b/clang/test/CodeGenCXX/typeid-type-test.cpp
new file mode 100644
index 000..9408d87495c608b
--- /dev/null
+++ b/clang/test/CodeGenCXX/typeid-type-test.cpp
@@ -0,0 +1,32 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py 
UTC_ARGS: --version 5
+// RUN: %clang_cc1 -I%S -triple x86_64-unknown-linux -flto 
-fwhole-program-vtables -fvisibility=hidden -emit-llvm -o - %s | FileCheck %s
+
+#include 
+
+namespace Test1 {
+struct A { virtual void f(); };
+
+// CHECK-LABEL: define hidden noundef nonnull align 8 dereferenceable(16) ptr 
@_ZN5Test19gettypeidEPNS_1AE(
+// CHECK-SAME: ptr noundef [[A:%.*]]) #[[ATTR0:[0-9]+]] {
+// CHECK-NEXT:  [[ENTRY:.*:]]
+// CHECK-NEXT:[[A_ADDR:%.*]] = alloca ptr, align 8
+// CHECK-NEXT:store ptr [[A]], ptr [[A_ADDR]], align 8
+// CHECK-NEXT:[[TMP0:%.*]] = load ptr, ptr [[A_ADDR]], align 8
+// CHECK-NEXT:[[TMP1:%.*]] = icmp eq ptr [[TMP0]], null
+// CHECK-NEXT:br i1 [[TMP1]], label %[[TYPEID_BAD_TYPEID:.*]], label 
%[[TYPEID_END:.*]]
+// CHECK:   [[TYPEID_BAD_TYPEID]]:
+// CHECK-NEXT:call void @__cxa_bad_typeid() #[[ATTR3:[0-9]+]]
+// CHECK-NEXT:unreachable
+// CHECK:   [[TYPEID_END]]:
+// CHECK-NEXT:[[VTABLE:%.*]] = load ptr, ptr [[TMP0]], align 8
+// CHECK-NEXT:[[TMP2:%.*]] = call i1 @llvm.type.test(ptr [[VTABLE]], 
metadata !"_ZTSN5Test11AE")
+// CHECK-NEXT:ca

[clang] [llvm] [ThinLTO] Support dead RTTI data elimination under -fno-split-lto-unit (PR #126336)

2025-02-07 Thread via cfe-commits

llvmbot wrote:



@llvm/pr-subscribers-clang-codegen

@llvm/pr-subscribers-llvm-ir

Author: None (luxufan)


Changes

This commit enhances the ThinLTO pipeline to support the elimination of unused 
Run-Time Type Information (RTTI) data when the `-fno-split-lto-unit` flag is 
used. Previously, dead RTTI data was not effectively removed, leading to larger 
binary sizes.

---

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


26 Files Affected:

- (modified) clang/lib/CodeGen/ItaniumCXXABI.cpp (+1) 
- (added) clang/test/CodeGenCXX/typeid-type-test.cpp (+32) 
- (modified) llvm/include/llvm/Analysis/TypeMetadataUtils.h (+2) 
- (modified) llvm/include/llvm/AsmParser/LLParser.h (+1) 
- (modified) llvm/include/llvm/AsmParser/LLToken.h (+1) 
- (modified) llvm/include/llvm/Bitcode/LLVMBitCodes.h (+1) 
- (modified) llvm/include/llvm/IR/ModuleSummaryIndex.h (+22) 
- (modified) llvm/include/llvm/LTO/LTO.h (+10-2) 
- (added) llvm/include/llvm/Support/LibCXXABI.h (+49) 
- (added) llvm/include/llvm/Transforms/IPO/DeadRTTIElimination.h (+21) 
- (modified) llvm/lib/Analysis/ModuleSummaryAnalysis.cpp (+64-2) 
- (modified) llvm/lib/Analysis/TypeMetadataUtils.cpp (+61) 
- (modified) llvm/lib/AsmParser/LLLexer.cpp (+1) 
- (modified) llvm/lib/AsmParser/LLParser.cpp (+30) 
- (modified) llvm/lib/Bitcode/Reader/BitcodeReader.cpp (+13) 
- (modified) llvm/lib/Bitcode/Writer/BitcodeWriter.cpp (+15) 
- (modified) llvm/lib/IR/AsmWriter.cpp (+12) 
- (modified) llvm/lib/LTO/LTO.cpp (+25-9) 
- (modified) llvm/lib/LTO/LTOBackend.cpp (+13-3) 
- (modified) llvm/lib/Support/CMakeLists.txt (+1) 
- (added) llvm/lib/Support/LibCXXABI.cpp (+25) 
- (modified) llvm/lib/Transforms/IPO/CMakeLists.txt (+1) 
- (added) llvm/lib/Transforms/IPO/DeadRTTIElimination.cpp (+46) 
- (added) llvm/test/Assembler/thinlto-rtti-summary.ll (+20) 
- (added) llvm/test/ThinLTO/X86/rtti-clean.ll (+34) 
- (added) llvm/test/ThinLTO/X86/rtti-dont-clean.ll (+46) 


``diff
diff --git a/clang/lib/CodeGen/ItaniumCXXABI.cpp 
b/clang/lib/CodeGen/ItaniumCXXABI.cpp
index 7c463f51f63dc5c..090eb4c16ce0b47 100644
--- a/clang/lib/CodeGen/ItaniumCXXABI.cpp
+++ b/clang/lib/CodeGen/ItaniumCXXABI.cpp
@@ -1592,6 +1592,7 @@ llvm::Value *ItaniumCXXABI::EmitTypeid(CodeGenFunction 
&CGF,
   cast(SrcRecordTy->castAs()->getDecl());
   llvm::Value *Value = CGF.GetVTablePtr(ThisPtr, CGM.GlobalsInt8PtrTy,
 ClassDecl);
+  CGF.EmitTypeMetadataCodeForVCall(ClassDecl, Value, SourceLocation());
 
   if (CGM.getItaniumVTableContext().isRelativeLayout()) {
 // Load the type info.
diff --git a/clang/test/CodeGenCXX/typeid-type-test.cpp 
b/clang/test/CodeGenCXX/typeid-type-test.cpp
new file mode 100644
index 000..9408d87495c608b
--- /dev/null
+++ b/clang/test/CodeGenCXX/typeid-type-test.cpp
@@ -0,0 +1,32 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py 
UTC_ARGS: --version 5
+// RUN: %clang_cc1 -I%S -triple x86_64-unknown-linux -flto 
-fwhole-program-vtables -fvisibility=hidden -emit-llvm -o - %s | FileCheck %s
+
+#include 
+
+namespace Test1 {
+struct A { virtual void f(); };
+
+// CHECK-LABEL: define hidden noundef nonnull align 8 dereferenceable(16) ptr 
@_ZN5Test19gettypeidEPNS_1AE(
+// CHECK-SAME: ptr noundef [[A:%.*]]) #[[ATTR0:[0-9]+]] {
+// CHECK-NEXT:  [[ENTRY:.*:]]
+// CHECK-NEXT:[[A_ADDR:%.*]] = alloca ptr, align 8
+// CHECK-NEXT:store ptr [[A]], ptr [[A_ADDR]], align 8
+// CHECK-NEXT:[[TMP0:%.*]] = load ptr, ptr [[A_ADDR]], align 8
+// CHECK-NEXT:[[TMP1:%.*]] = icmp eq ptr [[TMP0]], null
+// CHECK-NEXT:br i1 [[TMP1]], label %[[TYPEID_BAD_TYPEID:.*]], label 
%[[TYPEID_END:.*]]
+// CHECK:   [[TYPEID_BAD_TYPEID]]:
+// CHECK-NEXT:call void @__cxa_bad_typeid() #[[ATTR3:[0-9]+]]
+// CHECK-NEXT:unreachable
+// CHECK:   [[TYPEID_END]]:
+// CHECK-NEXT:[[VTABLE:%.*]] = load ptr, ptr [[TMP0]], align 8
+// CHECK-NEXT:[[TMP2:%.*]] = call i1 @llvm.type.test(ptr [[VTABLE]], 
metadata !"_ZTSN5Test11AE")
+// CHECK-NEXT:call void @llvm.assume(i1 [[TMP2]])
+// CHECK-NEXT:[[TMP3:%.*]] = getelementptr inbounds ptr, ptr [[VTABLE]], 
i64 -1
+// CHECK-NEXT:[[TMP4:%.*]] = load ptr, ptr [[TMP3]], align 8
+// CHECK-NEXT:ret ptr [[TMP4]]
+//
+const std::type_info &gettypeid(A *a) {
+  return typeid(*a);
+}
+
+}
diff --git a/llvm/include/llvm/Analysis/TypeMetadataUtils.h 
b/llvm/include/llvm/Analysis/TypeMetadataUtils.h
index bdb477b54b532d0..87da08dba34c745 100644
--- a/llvm/include/llvm/Analysis/TypeMetadataUtils.h
+++ b/llvm/include/llvm/Analysis/TypeMetadataUtils.h
@@ -51,6 +51,8 @@ void findDevirtualizableCallsForTypeTest(
 SmallVectorImpl &Assumes, const CallInst *CI,
 DominatorTree &DT);
 
+bool hasTypeIdLoadForTypeTest(const CallInst *CI);
+
 /// Given a call to the intrinsic \@llvm.type.checked.load, find all
 /// devirtualizable call sites based on the call and return them in 
De

[clang] [llvm] [ThinLTO] Support dead RTTI data elimination under -fno-split-lto-unit (PR #126336)

2025-02-07 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 4294fe173e9696a4c090857fa0766cd44c1964dc 
83b532a3382a07e472558b8813d43a6f51801423 --extensions h,cpp -- 
clang/test/CodeGenCXX/typeid-type-test.cpp 
llvm/include/llvm/Support/LibCXXABI.h 
llvm/include/llvm/Transforms/IPO/DeadRTTIElimination.h 
llvm/lib/Support/LibCXXABI.cpp llvm/lib/Transforms/IPO/DeadRTTIElimination.cpp 
clang/lib/CodeGen/ItaniumCXXABI.cpp 
llvm/include/llvm/Analysis/TypeMetadataUtils.h 
llvm/include/llvm/AsmParser/LLParser.h llvm/include/llvm/AsmParser/LLToken.h 
llvm/include/llvm/Bitcode/LLVMBitCodes.h 
llvm/include/llvm/IR/ModuleSummaryIndex.h llvm/include/llvm/LTO/LTO.h 
llvm/lib/Analysis/ModuleSummaryAnalysis.cpp 
llvm/lib/Analysis/TypeMetadataUtils.cpp llvm/lib/AsmParser/LLLexer.cpp 
llvm/lib/AsmParser/LLParser.cpp llvm/lib/Bitcode/Reader/BitcodeReader.cpp 
llvm/lib/Bitcode/Writer/BitcodeWriter.cpp llvm/lib/IR/AsmWriter.cpp 
llvm/lib/LTO/LTO.cpp llvm/lib/LTO/LTOBackend.cpp
``





View the diff from clang-format here.


``diff
diff --git a/llvm/include/llvm/LTO/LTO.h b/llvm/include/llvm/LTO/LTO.h
index 085e6eaddc..73b8974b35 100644
--- a/llvm/include/llvm/LTO/LTO.h
+++ b/llvm/include/llvm/LTO/LTO.h
@@ -529,7 +529,7 @@ private:
 
   Error checkPartiallySplit();
 
-  std::string & getTargetTriple() { return TargetTriple; }
+  std::string &getTargetTriple() { return TargetTriple; }
 
   void setTargetTriple(std::string TT) { TargetTriple = std::move(TT); }
 
diff --git a/llvm/include/llvm/Support/LibCXXABI.h 
b/llvm/include/llvm/Support/LibCXXABI.h
index 37f4b43f95..855aca5527 100644
--- a/llvm/include/llvm/Support/LibCXXABI.h
+++ b/llvm/include/llvm/Support/LibCXXABI.h
@@ -8,9 +8,9 @@ namespace llvm {
 
 class CXXABI {
 
-  virtual const char * getVTablePrefix() = 0;
-  virtual const char * getTypeNamePrefix() = 0;
-  virtual const char * getTypeInfoPrefix() = 0;
+  virtual const char *getVTablePrefix() = 0;
+  virtual const char *getTypeNamePrefix() = 0;
+  virtual const char *getTypeInfoPrefix() = 0;
 
 public:
   static std::unique_ptr Create(Triple &TT);
@@ -32,9 +32,9 @@ public:
 
 class Itanium final : public CXXABI {
 
-  const char * getVTablePrefix() override { return "_ZTV"; }
-  const char * getTypeNamePrefix() override { return "_ZTS"; }
-  const char * getTypeInfoPrefix() override { return "_ZTI"; }
+  const char *getVTablePrefix() override { return "_ZTV"; }
+  const char *getTypeNamePrefix() override { return "_ZTS"; }
+  const char *getTypeInfoPrefix() override { return "_ZTI"; }
 
 public:
   virtual ~Itanium() {}
diff --git a/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp 
b/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
index ec0aa81d05..a1778bf6e2 100644
--- a/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
+++ b/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
@@ -925,7 +925,8 @@ static bool hasNonVTableUsers(const User *U, CXXABI *ABI) {
   }
 
   // The virtual table type is either a struct of arrays. For example:
-  // @vtable = constant { [3 x ptr] } { [3 x ptr] [ ptr null, ptr @rtti, ptr 
@vf] }
+  // @vtable = constant { [3 x ptr] } { [3 x ptr] [ ptr null, ptr @rtti, ptr
+  // @vf] }
   //
   // In this case, the user of @rtti is an anonymous ConstantArray.
   // Therefore, if the user of the type information is anonymous,
@@ -959,8 +960,7 @@ static void analyzeRTTIVars(ModuleSummaryIndex &Index, 
const Module &M) {
   continue;
 
 if (hasNonVTableUsers(&GV, ABI.get())) {
-  std::string TypeName =
-  ABI->getTypeNameFromTypeInfo(GV.getName());
+  std::string TypeName = ABI->getTypeNameFromTypeInfo(GV.getName());
   const GlobalVariable *TypeNameGV = M.getNamedGlobal(TypeName);
   if (TypeNameGV)
 Index.addTypeIdAccessed(TypeNameGV->getName());
diff --git a/llvm/lib/LTO/LTO.cpp b/llvm/lib/LTO/LTO.cpp
index 49a0c31af5..a4c07acf96 100644
--- a/llvm/lib/LTO/LTO.cpp
+++ b/llvm/lib/LTO/LTO.cpp
@@ -53,9 +53,9 @@
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Target/TargetOptions.h"
 #include "llvm/Transforms/IPO.h"
+#include "llvm/Transforms/IPO/DeadRTTIElimination.h"
 #include "llvm/Transforms/IPO/MemProfContextDisambiguation.h"
 #include "llvm/Transforms/IPO/WholeProgramDevirt.h"
-#include "llvm/Transforms/IPO/DeadRTTIElimination.h"
 #include "llvm/Transforms/Utils/FunctionImportUtils.h"
 #include "llvm/Transforms/Utils/SplitModule.h"
 
@@ -1931,7 +1931,6 @@ Error LTO::runThinLTO(
 computeDeadSymbolsWithConstProp(ThinLTO.CombinedIndex, 
GUIDPreservedSymbols,
 IsPrevailing, Conf.OptLevel > 0);
 
-
   if (Conf.CombinedIndexHook &&
   !Conf.CombinedIndexHook(ThinLTO.CombinedIndex, GUIDPreservedSymbols))
 return Error::success();
diff --git a/llvm/lib/LTO/LTOBackend.cpp b/llvm/lib/LTO/LTOBackend.cpp
index d0566f0d00..c094d1f166 100644
--- a/llvm/lib/LTO/LTOBacke

[clang] [analyzer] Remove some false negatives in StackAddrEscapeChecker (PR #125638)

2025-02-07 Thread Michael Flanders via cfe-commits


@@ -247,45 +240,134 @@ void StackAddrEscapeChecker::checkPreCall(const 
CallEvent &Call,
   }
 }
 
-void StackAddrEscapeChecker::checkPreStmt(const ReturnStmt *RS,
-  CheckerContext &C) const {
-  if (!ChecksEnabled[CK_StackAddrEscapeChecker])
-return;
+/// A visitor made for use with a ScanReachableSymbols scanner, used
+/// for finding stack regions within an SVal that live on the current
+/// stack frame of the given checker context. This visitor excludes
+/// NonParamVarRegion that data is bound to in a BlockDataRegion's
+/// bindings, since these are likely uninteresting, e.g., in case a
+/// temporary is constructed on the stack, but it captures values
+/// that would leak.
+class FindStackRegionsSymbolVisitor final : public SymbolVisitor {
+  CheckerContext &Ctxt;
+  const StackFrameContext *StackFrameContext;
+  SmallVector &EscapingStackRegions;
 
-  const Expr *RetE = RS->getRetValue();
-  if (!RetE)
-return;
-  RetE = RetE->IgnoreParens();
+public:
+  explicit FindStackRegionsSymbolVisitor(
+  CheckerContext &Ctxt,
+  SmallVector &StorageForStackRegions)
+  : Ctxt(Ctxt), StackFrameContext(Ctxt.getStackFrame()),
+EscapingStackRegions(StorageForStackRegions) {}
 
-  SVal V = C.getSVal(RetE);
-  const MemRegion *R = V.getAsRegion();
-  if (!R)
-return;
+  bool VisitSymbol(SymbolRef sym) override { return true; }
 
-  if (const BlockDataRegion *B = dyn_cast(R))
-checkReturnedBlockCaptures(*B, C);
+  bool VisitMemRegion(const MemRegion *MR) override {
+SaveIfEscapes(MR);
 
-  if (!isa(R->getMemorySpace()) || isNotInCurrentFrame(R, C))
-return;
+if (const BlockDataRegion *BDR = MR->getAs())
+  return VisitBlockDataRegionCaptures(BDR);
+
+return true;
+  }
+
+private:
+  void SaveIfEscapes(const MemRegion *MR) {
+const StackSpaceRegion *SSR =
+MR->getMemorySpace()->getAs();
+if (SSR && SSR->getStackFrame() == StackFrameContext)
+  EscapingStackRegions.push_back(MR);
+  }
+
+  bool VisitBlockDataRegionCaptures(const BlockDataRegion *BDR) {
+for (auto Var : BDR->referenced_vars()) {
+  SVal Val = Ctxt.getState()->getSVal(Var.getCapturedRegion());
+  const MemRegion *Region = Val.getAsRegion();
+  if (Region) {
+SaveIfEscapes(Region);
+VisitMemRegion(Region);
+  }
+}
+
+return false;
+  }
+};
+
+/// Given some memory regions that are flagged by 
FindStackRegionsSymbolVisitor,
+/// this function filters out memory regions that are being returned that are
+/// likely not true leaks:
+/// 1. If returning a block data region that has stack memory space
+/// 2. If returning a constructed object that has stack memory space
+static SmallVector
+FilterReturnExpressionLeaks(const SmallVector &MaybeEscaped,
+CheckerContext &C, const Expr *RetE, SVal &RetVal) 
{
+
+  SmallVector WillEscape;
+
+  const MemRegion *RetRegion = RetVal.getAsRegion();
 
   // Returning a record by value is fine. (In this case, the returned
   // expression will be a copy-constructor, possibly wrapped in an
   // ExprWithCleanups node.)
   if (const ExprWithCleanups *Cleanup = dyn_cast(RetE))
 RetE = Cleanup->getSubExpr();
-  if (isa(RetE) && RetE->getType()->isRecordType())
-return;
+  bool IsConstructExpr =
+  isa(RetE) && RetE->getType()->isRecordType();
 
   // The CK_CopyAndAutoreleaseBlockObject cast causes the block to be copied
   // so the stack address is not escaping here.
+  bool IsCopyAndAutoreleaseBlockObj = false;
   if (const auto *ICE = dyn_cast(RetE)) {
-if (isa(R) &&
-ICE->getCastKind() == CK_CopyAndAutoreleaseBlockObject) {
-  return;
-}
+IsCopyAndAutoreleaseBlockObj =
+isa_and_nonnull(RetRegion) &&
+ICE->getCastKind() == CK_CopyAndAutoreleaseBlockObject;
+  }
+
+  for (const MemRegion *MR : MaybeEscaped) {
+if (RetRegion == MR && (IsCopyAndAutoreleaseBlockObj || IsConstructExpr))
+  continue;
+
+// If this is a construct expr of an unelided return value copy, then don't
+// warn about returning a region that currently lives on the stack.
+if (IsConstructExpr && RetVal.getAs() &&

Flandini wrote:

> I am wondering why is it sufficient to check if a memory region belongs to 
> the current stack. I.e., why we would not warn on:
> ```
> int test2() {
> int x = someFunc();
>  return x;
> }
> ```

Is it because we do this:
```
void StackAddrEscapeChecker::checkPreStmt(const ReturnStmt *RS,
  CheckerContext &C) const {
  if (!ChecksEnabled[CK_StackAddrEscapeChecker])
return;

  const Expr *RetE = RS->getRetValue();
  if (!RetE)
return;
  RetE = RetE->IgnoreParens();

  SVal V = C.getSVal(RetE);
```
and we get the result of the LValueToRValue conversion?

https://github.com/llvm/llvm-project/pull/125638
___
cfe-commits mailing list
cfe-commits@list

[clang] [analyzer] Remove some false negatives in StackAddrEscapeChecker (PR #125638)

2025-02-07 Thread Michael Flanders via cfe-commits

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


[clang] [Driver][HIP] Do not pass -dependency-file flag for HIP Device offloading (PR #125646)

2025-02-07 Thread Aniket Lal via cfe-commits

https://github.com/lalaniket8 updated 
https://github.com/llvm/llvm-project/pull/125646

>From 3608d77e3633d853682ffbae16c5b227259ed69c Mon Sep 17 00:00:00 2001
From: anikelal 
Date: Tue, 4 Feb 2025 12:13:20 +0530
Subject: [PATCH 1/2] [Driver][HIP] Do not pass -dependency-file flag for HIP
 Device offloading

When we launch hipcc with multiple offload architectures along with -MF 
dep_file flag, the clang compilation invocations for host and device offloads 
write to the same dep_file, and can lead to collision during file IO 
operations. This can typically happen during large workloads.
This commit provides a fix to generate dep_file only in host compilation.
---
 clang/lib/Driver/ToolChains/Clang.cpp | 30 ++-
 1 file changed, 16 insertions(+), 14 deletions(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index c0891d46b0a62cd..00ef8983c58e711 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -1013,21 +1013,23 @@ void Clang::AddPreprocessingOptions(Compilation &C, 
const JobAction &JA,
 ArgM = ArgMD;
 
   if (ArgM) {
-// Determine the output location.
-const char *DepFile;
-if (Arg *MF = Args.getLastArg(options::OPT_MF)) {
-  DepFile = MF->getValue();
-  C.addFailureResultFile(DepFile, &JA);
-} else if (Output.getType() == types::TY_Dependencies) {
-  DepFile = Output.getFilename();
-} else if (!ArgMD) {
-  DepFile = "-";
-} else {
-  DepFile = getDependencyFileName(Args, Inputs);
-  C.addFailureResultFile(DepFile, &JA);
+if (!JA.isDeviceOffloading(Action::OFK_HIP)) {
+  // Determine the output location.
+  const char *DepFile;
+  if (Arg *MF = Args.getLastArg(options::OPT_MF)) {
+DepFile = MF->getValue();
+C.addFailureResultFile(DepFile, &JA);
+  } else if (Output.getType() == types::TY_Dependencies) {
+DepFile = Output.getFilename();
+  } else if (!ArgMD) {
+DepFile = "-";
+  } else {
+DepFile = getDependencyFileName(Args, Inputs);
+C.addFailureResultFile(DepFile, &JA);
+  }
+  CmdArgs.push_back("-dependency-file");
+  CmdArgs.push_back(DepFile);
 }
-CmdArgs.push_back("-dependency-file");
-CmdArgs.push_back(DepFile);
 
 bool HasTarget = false;
 for (const Arg *A : Args.filtered(options::OPT_MT, options::OPT_MQ)) {

>From adb72d733f8129ab88a0b83f959afeefe39af94e Mon Sep 17 00:00:00 2001
From: anikelal 
Date: Wed, 5 Feb 2025 14:49:50 +0530
Subject: [PATCH 2/2] Adding littest

---
 .../dep-file-flag-with-multiple-offload-archs.hip   | 13 +
 1 file changed, 13 insertions(+)
 create mode 100644 
clang/test/Driver/dep-file-flag-with-multiple-offload-archs.hip

diff --git a/clang/test/Driver/dep-file-flag-with-multiple-offload-archs.hip 
b/clang/test/Driver/dep-file-flag-with-multiple-offload-archs.hip
new file mode 100644
index 000..fe5e1ff18548ec8
--- /dev/null
+++ b/clang/test/Driver/dep-file-flag-with-multiple-offload-archs.hip
@@ -0,0 +1,13 @@
+// RUN: %clang -### -x hip --offload-arch=gfx1030 --offload-arch=gfx1100 
--offload-arch=gfx1101 -MD -MF tmp.d -v %s 2>&1 | FileCheck %s
+
+// CHECK: Build config:
+// CHECK-NOT: {{.*}}clang{{.*}}"-target-cpu" "gfx1030"{{.*}}"-dependency-file" 
"tmp.d"
+// CHECK: {{.*}}lld{{.*}}"-plugin-opt=mcpu=gfx1030"
+// CHECK-NOT: {{.*}}clang{{.*}}"-target-cpu" "gfx1100"{{.*}}"-dependency-file" 
"tmp.d"
+// CHECK: {{.*}}lld{{.*}}"-plugin-opt=mcpu=gfx1100"
+// CHECK-NOT: {{.*}}clang{{.*}}"-target-cpu" "gfx1101"{{.*}}"-dependency-file" 
"tmp.d"
+// CHECK: {{.*}}lld{{.*}}"-plugin-opt=mcpu=gfx1101"
+// CHECK: {{.*}}clang-offload-bundler
+// CHECK: {{.*}}clang{{.*}}"-target-cpu" "x86-64"{{.*}}"-dependency-file" 
"tmp.d"
+
+void main(){}
\ No newline at end of file

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


[clang] [analyzer] Remove some false negatives in StackAddrEscapeChecker (PR #125638)

2025-02-07 Thread Michael Flanders via cfe-commits

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


[clang] [analyzer] Remove some false negatives in StackAddrEscapeChecker (PR #125638)

2025-02-07 Thread Michael Flanders via cfe-commits

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


[clang] [C++20][Modules][Serialization] Delay marking pending incomplete decl chains until the end of `finishPendingActions`. (PR #121245)

2025-02-07 Thread Michael Park via cfe-commits

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


[clang] [OpenMP][Docs] Update OpenMP supported features table (PR #126292)

2025-02-07 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang

Author: David Pagan (ddpagan)


Changes

Updated status to 'done' for OpenMP 6.0 features:
  - OpenMP directives in concurrent loop regions
  - atomics constructs on concurrent loop regions
  - Lift nesting restriction on concurrent loop

Removed duplicate OpenMP 6.0 feature per Michael Klemm:
  - atomic constructs in loop region

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


1 Files Affected:

- (modified) clang/docs/OpenMPSupport.rst (+3-5) 


``diff
diff --git a/clang/docs/OpenMPSupport.rst b/clang/docs/OpenMPSupport.rst
index c31d6e90ecb084..725624ee8c66cd 100644
--- a/clang/docs/OpenMPSupport.rst
+++ b/clang/docs/OpenMPSupport.rst
@@ -416,9 +416,9 @@ implementation.
 
+-+---+---+--+
 | safe_sync and progress with identifier and API  | 
:none:`unclaimed` | :none:`unclaimed` | 
 |
 
+-+---+---+--+
-| OpenMP directives in concurrent loop regions| 
:none:`unclaimed` | :none:`unclaimed` | 
 |
+| OpenMP directives in concurrent loop regions| :good:`done`   
   | :none:`unclaimed` | 
https://github.com/llvm/llvm-project/pull/125621 |
 
+-+---+---+--+
-| atomics constructs on concurrent loop regions   | 
:none:`unclaimed` | :none:`unclaimed` | 
 |
+| atomics constructs on concurrent loop regions   | :good:`done`   
   | :none:`unclaimed` | 
https://github.com/llvm/llvm-project/pull/125621 |
 
+-+---+---+--+
 | Loop construct with DO CONCURRENT   | 
:none:`unclaimed` | :none:`unclaimed` | 
 |
 
+-+---+---+--+
@@ -456,9 +456,7 @@ implementation.
 
+-+---+---+--+
 | map-type modifiers in arbitrary position| 
:none:`unclaimed` | :none:`unclaimed` | 
 |
 
+-+---+---+--+
-| atomic constructs in loop region| 
:none:`unclaimed` | :none:`unclaimed` | 
 |
-+-+---+---+--+
-| Lift nesting restriction on concurrent loop | 
:none:`unclaimed` | :none:`unclaimed` | 
 |
+| Lift nesting restriction on concurrent loop | :good:`done`   
   | :none:`unclaimed` | 
https://github.com/llvm/llvm-project/pull/125621 |
 
+-+---+---+--+
 | priority clause for target constructs   | 
:none:`unclaimed` | :none:`unclaimed` | 
 |
 
+-+---+---+--+

``




https://github.com/llvm/llvm-project/pu

[clang] [FreeBSD] Support -stdlib=libstdc++ (PR #126302)

2025-02-07 Thread Alexander Richardson via cfe-commits


@@ -452,12 +452,12 @@ void FreeBSD::addLibCxxIncludePaths(const 
llvm::opt::ArgList &DriverArgs,
 
 void FreeBSD::AddCXXStdlibLibArgs(const ArgList &Args,
   ArgStringList &CmdArgs) const {
+  Generic_ELF::AddCXXStdlibLibArgs(Args, CmdArgs);
   unsigned Major = getTriple().getOSMajorVersion();
-  bool Profiling = Args.hasArg(options::OPT_pg) && Major != 0 && Major < 14;
-
-  CmdArgs.push_back(Profiling ? "-lc++_p" : "-lc++");
-  if (Args.hasArg(options::OPT_fexperimental_library))
-CmdArgs.push_back("-lc++experimental");
+  bool SuffixedLib = Args.hasArg(options::OPT_pg) && Major != 0 && Major < 14;
+  if (SuffixedLib && GetCXXStdlibType(Args) == CST_Libcxx)
+llvm::replace(CmdArgs, static_cast("-lc++"),

arichardson wrote:

The cast here is needed since it doesn't decay and complains about `char[5]` vs 
`char[7]`

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


[clang] [OpenMP][Docs] Update OpenMP supported features table (PR #126292)

2025-02-07 Thread Alexey Bataev via cfe-commits

https://github.com/alexey-bataev approved this pull request.

LG

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


[clang] [llvm] [CaptureTracking][FunctionAttrs] Add support for CaptureInfo (PR #125880)

2025-02-07 Thread Nikita Popov via cfe-commits


@@ -358,49 +360,59 @@ UseCaptureKind llvm::DetermineUseCaptureKind(
 // Volatile stores make the address observable.
 auto *ACXI = cast(I);
 if (U.getOperandNo() == 1 || U.getOperandNo() == 2 || ACXI->isVolatile())
-  return UseCaptureKind::MAY_CAPTURE;
-return UseCaptureKind::NO_CAPTURE;
+  return CaptureInfo::otherOnly();
+return CaptureInfo::none();
   }
   case Instruction::GetElementPtr:
 // AA does not support pointers of vectors, so GEP vector splats need to
 // be considered as captures.
 if (I->getType()->isVectorTy())
-  return UseCaptureKind::MAY_CAPTURE;
-return UseCaptureKind::PASSTHROUGH;
+  return CaptureInfo::otherOnly();
+return CaptureInfo::retOnly();
   case Instruction::BitCast:
   case Instruction::PHI:
   case Instruction::Select:
   case Instruction::AddrSpaceCast:
 // The original value is not captured via this if the new value isn't.
-return UseCaptureKind::PASSTHROUGH;
+return CaptureInfo::retOnly();
   case Instruction::ICmp: {
 unsigned Idx = U.getOperandNo();
 unsigned OtherIdx = 1 - Idx;
-if (auto *CPN = dyn_cast(I->getOperand(OtherIdx))) {
+if (isa(I->getOperand(OtherIdx)) &&
+cast(I)->isEquality()) {
+  // TODO(captures): Remove these special cases once we make use of
+  // captures(address_is_null).
+
   // Don't count comparisons of a no-alias return value against null as
   // captures. This allows us to ignore comparisons of malloc results
   // with null, for example.
-  if (CPN->getType()->getAddressSpace() == 0)
+  if (U->getType()->getPointerAddressSpace() == 0)
 if (isNoAliasCall(U.get()->stripPointerCasts()))
-  return UseCaptureKind::NO_CAPTURE;
+  return CaptureInfo::none();
   if (!I->getFunction()->nullPointerIsDefined()) {
 auto *O = I->getOperand(Idx)->stripPointerCastsSameRepresentation();
 // Comparing a dereferenceable_or_null pointer against null cannot
 // lead to pointer escapes, because if it is not null it must be a
 // valid (in-bounds) pointer.
 const DataLayout &DL = I->getDataLayout();
 if (IsDereferenceableOrNull && IsDereferenceableOrNull(O, DL))
-  return UseCaptureKind::NO_CAPTURE;
+  return CaptureInfo::none();
   }
+
+  // Check whether this is a comparison of the base pointer against
+  // null.
+  if (U.get() == Base)
+return CaptureInfo::otherOnly(CaptureComponents::AddressIsNull);
 }
 
 // Otherwise, be conservative. There are crazy ways to capture pointers
-// using comparisons.
-return UseCaptureKind::MAY_CAPTURE;
+// using comparisons. However, only the address is captured, not the
+// provenance.
+return CaptureInfo::otherOnly(CaptureComponents::Address);

nikic wrote:

Yes, the use of CaptureInfo is overloaded here. The return value of 
DetermineUseCaptureKind and the argument of captures() uses Other == what is 
captured by the Use and Ret == what is (potentially) captured by the return 
value of the User.

I thought this was a reasonable way to use it (with "ret" here referring to the 
return value of the instruction rather than the function), but if this is too 
confusing I could replace the use of CaptureInfo in this context with 
`std::pair`.

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


[clang] [llvm] [CaptureTracking][FunctionAttrs] Add support for CaptureInfo (PR #125880)

2025-02-07 Thread via cfe-commits


@@ -358,49 +360,59 @@ UseCaptureKind llvm::DetermineUseCaptureKind(
 // Volatile stores make the address observable.
 auto *ACXI = cast(I);
 if (U.getOperandNo() == 1 || U.getOperandNo() == 2 || ACXI->isVolatile())
-  return UseCaptureKind::MAY_CAPTURE;
-return UseCaptureKind::NO_CAPTURE;
+  return CaptureInfo::otherOnly();
+return CaptureInfo::none();
   }
   case Instruction::GetElementPtr:
 // AA does not support pointers of vectors, so GEP vector splats need to
 // be considered as captures.
 if (I->getType()->isVectorTy())
-  return UseCaptureKind::MAY_CAPTURE;
-return UseCaptureKind::PASSTHROUGH;
+  return CaptureInfo::otherOnly();
+return CaptureInfo::retOnly();
   case Instruction::BitCast:
   case Instruction::PHI:
   case Instruction::Select:
   case Instruction::AddrSpaceCast:
 // The original value is not captured via this if the new value isn't.
-return UseCaptureKind::PASSTHROUGH;
+return CaptureInfo::retOnly();
   case Instruction::ICmp: {
 unsigned Idx = U.getOperandNo();
 unsigned OtherIdx = 1 - Idx;
-if (auto *CPN = dyn_cast(I->getOperand(OtherIdx))) {
+if (isa(I->getOperand(OtherIdx)) &&
+cast(I)->isEquality()) {
+  // TODO(captures): Remove these special cases once we make use of
+  // captures(address_is_null).
+
   // Don't count comparisons of a no-alias return value against null as
   // captures. This allows us to ignore comparisons of malloc results
   // with null, for example.
-  if (CPN->getType()->getAddressSpace() == 0)
+  if (U->getType()->getPointerAddressSpace() == 0)
 if (isNoAliasCall(U.get()->stripPointerCasts()))
-  return UseCaptureKind::NO_CAPTURE;
+  return CaptureInfo::none();
   if (!I->getFunction()->nullPointerIsDefined()) {
 auto *O = I->getOperand(Idx)->stripPointerCastsSameRepresentation();
 // Comparing a dereferenceable_or_null pointer against null cannot
 // lead to pointer escapes, because if it is not null it must be a
 // valid (in-bounds) pointer.
 const DataLayout &DL = I->getDataLayout();
 if (IsDereferenceableOrNull && IsDereferenceableOrNull(O, DL))
-  return UseCaptureKind::NO_CAPTURE;
+  return CaptureInfo::none();
   }
+
+  // Check whether this is a comparison of the base pointer against
+  // null.
+  if (U.get() == Base)
+return CaptureInfo::otherOnly(CaptureComponents::AddressIsNull);
 }
 
 // Otherwise, be conservative. There are crazy ways to capture pointers
-// using comparisons.
-return UseCaptureKind::MAY_CAPTURE;
+// using comparisons. However, only the address is captured, not the
+// provenance.
+return CaptureInfo::otherOnly(CaptureComponents::Address);

goldsteinn wrote:

I'm in favor of  `std::pair<...>`. I think it would be far less confusing.

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


[clang] 6ef978b - [clang][ExtractAPI] combine typedef records if the underlying type's name is underscored (#125964)

2025-02-07 Thread via cfe-commits

Author: QuietMisdreavus
Date: 2025-02-07T13:23:10-07:00
New Revision: 6ef978b8c41a83378af3de1dceeea434715f80f4

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

LOG: [clang][ExtractAPI] combine typedef records if the underlying type's name 
is underscored (#125964)

fixes rdar://137214218

When 'typedef struct' decls are encountered, the records are combined if
the underlying type is either anonymous or has the same name as the
typedef. Extend this behavior to also combine records when the
underlying type has an underscored name that is equivalent to the
typedef name when the leading underscores are removed.

Added: 
clang/test/ExtractAPI/typedef_underscore.c

Modified: 
clang/include/clang/ExtractAPI/ExtractAPIVisitor.h

Removed: 




diff  --git a/clang/include/clang/ExtractAPI/ExtractAPIVisitor.h 
b/clang/include/clang/ExtractAPI/ExtractAPIVisitor.h
index aa86e4180671144..e60440e14a9fe40 100644
--- a/clang/include/clang/ExtractAPI/ExtractAPIVisitor.h
+++ b/clang/include/clang/ExtractAPI/ExtractAPIVisitor.h
@@ -1146,11 +1146,29 @@ bool 
ExtractAPIVisitorBase::VisitTypedefNameDecl(
 
   StringRef Name = Decl->getName();
 
+  auto nameMatches = [&Name](TagDecl *TagDecl) {
+StringRef TagName = TagDecl->getName();
+
+if (TagName == Name)
+  return true;
+
+// Also check whether the tag decl's name is the same as the typedef name
+// with prefixed underscores
+if (TagName.starts_with('_')) {
+  StringRef StrippedName = TagName.ltrim('_');
+
+  if (StrippedName == Name)
+return true;
+}
+
+return false;
+  };
+
   // If the underlying type was defined as part of the typedef modify it's
   // fragments directly and pretend the typedef doesn't exist.
   if (auto *TagDecl = Decl->getUnderlyingType()->getAsTagDecl()) {
 if (TagDecl->isEmbeddedInDeclarator() && TagDecl->isCompleteDefinition() &&
-Decl->getName() == TagDecl->getName()) {
+nameMatches(TagDecl)) {
   SmallString<128> TagUSR;
   index::generateUSRForDecl(TagDecl, TagUSR);
   if (auto *Record = API.findRecordForUSR(TagUSR)) {
@@ -1164,6 +1182,11 @@ bool 
ExtractAPIVisitorBase::VisitTypedefNameDecl(
 .append(Name, DeclarationFragments::FragmentKind::Identifier)
 .appendSemicolon();
 
+// Replace the name and subheading in case it's underscored so we can
+// use the non-underscored version
+Record->Name = Name;
+Record->SubHeading = DeclarationFragmentsBuilder::getSubHeading(Decl);
+
 return true;
   }
 }

diff  --git a/clang/test/ExtractAPI/typedef_underscore.c 
b/clang/test/ExtractAPI/typedef_underscore.c
new file mode 100644
index 000..a42046907b46de8
--- /dev/null
+++ b/clang/test/ExtractAPI/typedef_underscore.c
@@ -0,0 +1,69 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -extract-api --pretty-sgf 
--emit-sgf-symbol-labels-for-testing \
+// RUN:   --product-name=TypedefChain -triple arm64-apple-macosx -x c-header 
%s -o %t/typedefchain-c.symbols.json -verify
+// RUN: %clang_cc1 -extract-api --pretty-sgf 
--emit-sgf-symbol-labels-for-testing \
+// RUN:   --product-name=TypedefChain -triple arm64-apple-macosx -x c++-header 
%s -o %t/typedefchain-cxx.symbols.json -verify
+
+// RUN: FileCheck %s --input-file %t/typedefchain-c.symbols.json 
--check-prefix MYSTRUCT
+// RUN: FileCheck %s --input-file %t/typedefchain-cxx.symbols.json 
--check-prefix MYSTRUCT
+typedef struct _MyStruct { } MyStruct;
+
+// MYSTRUCT-LABEL: "!testLabel": "c:@S@_MyStruct"
+// MYSTRUCT:  "accessLevel": "public",
+// MYSTRUCT:  "declarationFragments": [
+// MYSTRUCT-NEXT:   {
+// MYSTRUCT-NEXT: "kind": "keyword",
+// MYSTRUCT-NEXT: "spelling": "typedef"
+// MYSTRUCT-NEXT:   },
+// MYSTRUCT-NEXT:   {
+// MYSTRUCT-NEXT: "kind": "text",
+// MYSTRUCT-NEXT: "spelling": " "
+// MYSTRUCT-NEXT:   },
+// MYSTRUCT-NEXT:   {
+// MYSTRUCT-NEXT: "kind": "keyword",
+// MYSTRUCT-NEXT: "spelling": "struct"
+// MYSTRUCT-NEXT:   },
+// MYSTRUCT-NEXT:   {
+// MYSTRUCT-NEXT: "kind": "text",
+// MYSTRUCT-NEXT: "spelling": " "
+// MYSTRUCT-NEXT:   },
+// MYSTRUCT-NEXT:   {
+// MYSTRUCT-NEXT: "kind": "identifier",
+// MYSTRUCT-NEXT: "spelling": "_MyStruct"
+// MYSTRUCT-NEXT:   },
+// MYSTRUCT-NEXT:   {
+// MYSTRUCT-NEXT: "kind": "text",
+// MYSTRUCT-NEXT: "spelling": " { ... } "
+// MYSTRUCT-NEXT:   },
+// MYSTRUCT-NEXT:   {
+// MYSTRUCT-NEXT: "kind": "identifier",
+// MYSTRUCT-NEXT: "spelling": "MyStruct"
+// MYSTRUCT-NEXT:   },
+// MYSTRUCT-NEXT:   {
+// MYSTRUCT-NEXT: "kind": "text",
+// MYSTRUCT-NEXT: "spelling": ";"
+// MYSTRUCT-NEXT:   }
+// MYSTRUCT-NEXT: ],
+// MYSTRUCT:  "kind": {
+// MYSTRUCT-NEXT:   "displayName": "Structure",
+// MYSTR

[clang] [clang][ExtractAPI] combine typedef records if the underlying type's name is underscored (PR #125964)

2025-02-07 Thread via cfe-commits

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


[clang] [flang] [lld] [Flang] Don't use FortranDecimal for runtime (PR #121997)

2025-02-07 Thread LLVM Continuous Integration via cfe-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `lld-x86_64-win` running on 
`as-worker-93` while building `clang,flang,lld` at step 7 
"test-build-unified-tree-check-all".

Full details are available at: 
https://lab.llvm.org/buildbot/#/builders/146/builds/2247


Here is the relevant piece of the build log for the reference

```
Step 7 (test-build-unified-tree-check-all) failure: test (failure)
 TEST 'LLVM-Unit :: Support/./SupportTests.exe/38/87' 
FAILED 
Script(shard):
--
GTEST_OUTPUT=json:C:\a\lld-x86_64-win\build\unittests\Support\.\SupportTests.exe-LLVM-Unit-10300-38-87.json
 GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=87 GTEST_SHARD_INDEX=38 
C:\a\lld-x86_64-win\build\unittests\Support\.\SupportTests.exe
--

Script:
--
C:\a\lld-x86_64-win\build\unittests\Support\.\SupportTests.exe 
--gtest_filter=ProgramEnvTest.CreateProcessLongPath
--
C:\a\lld-x86_64-win\llvm-project\llvm\unittests\Support\ProgramTest.cpp(160): 
error: Expected equality of these values:
  0
  RC
Which is: -2

C:\a\lld-x86_64-win\llvm-project\llvm\unittests\Support\ProgramTest.cpp(163): 
error: fs::remove(Twine(LongPath)): did not return errc::success.
error number: 13
error message: permission denied



C:\a\lld-x86_64-win\llvm-project\llvm\unittests\Support\ProgramTest.cpp:160
Expected equality of these values:
  0
  RC
Which is: -2

C:\a\lld-x86_64-win\llvm-project\llvm\unittests\Support\ProgramTest.cpp:163
fs::remove(Twine(LongPath)): did not return errc::success.
error number: 13
error message: permission denied







```



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


[clang] [RFC][clang][BPF] Make trivial uninit var value to be 0 (PR #125601)

2025-02-07 Thread via cfe-commits

4ast wrote:

what veristat says before/after?

re: selftests

there should be a flag to disable this, so the tests can remain as-is (with 
only Makefile change).

There is also -ftrivial-auto-var-init-max-size= flag. What is the default?
Looks like: char buf[64]; will be zero inited as well?
That will probably hurt performance/verification for cases like:
char comm[16];
bpf_get_current_comm(comm, ...)
?

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


[clang] [compiler-rt] [rtsan] Enable RealtimeSanitizer for FreeBSD (PR #125389)

2025-02-07 Thread Chris Apple via cfe-commits

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


[clang] [compiler-rt] [rtsan] Enable RealtimeSanitizer for FreeBSD (PR #125389)

2025-02-07 Thread Chris Apple via cfe-commits


@@ -1539,6 +1543,7 @@ TEST_F(KqueueTest, KeventDiesWhenRealtime) {
   ExpectNonRealtimeSurvival(Func);
 }
 
+#if SANITIZER_APPLE

cjappl wrote:

ah, fine to leave then probably. Thanks for pointing that out

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


[clang] [llvm] [libclang/python] Enable packaging libclang bindings (PR #125806)

2025-02-07 Thread Ryan Mast via cfe-commits


@@ -0,0 +1,36 @@
+[build-system]
+requires = ["setuptools>=42", "setuptools_scm==8.1.0"]
+build-backend = "setuptools.build_meta"
+
+[project]
+name = "clang"
+description = "libclang python bindings"
+readme = {file = "README.txt", content-type = "text/plain"}
+
+license = {text = "Apache-2.0 WITH LLVM-exception"}
+authors = [
+{ name = "LLVM" }
+]
+keywords = ["llvm", "clang", "libclang"]
+classifiers = [
+"Intended Audience :: Developers",
+"Development Status :: 5 - Production/Stable",
+"Topic :: Software Development :: Compilers",
+"Operating System :: OS Independent",
+"Programming Language :: Python :: 3",
+]
+dynamic = ["version"]
+
+[project.urls]
+Homepage = "https://clang.llvm.org/";
+Download = "https://llvm.org/releases/download.html";
+Discussions = "https://discourse.llvm.org/";
+"Issue Tracker" = "https://github.com/llvm/llvm-project/issues";
+"Source Code" = 
"https://github.com/llvm/llvm-project/tree/main/clang/bindings/python";
+
+[tool.setuptools_scm]
+root = "../../.."
+version_file = "clang/_version.py"
+version_scheme = "no-guess-dev"
+# Regex version capture group gets x.y.z with optional -rcN, -aN, -bN 
suffixes; -init is just consumed
+tag_regex = "^llvmorg-(?P\\d+(?:\\.\\d+)*(?:-(?:rc|a|b)\\d+)?)(?:.*)$"

nightlark wrote:

I updated it to only match an `-rcN` suffix as part of the captured version. I 
had to leave the first `\\d+` to match the first number in the version 
component (the repeating portion requires a `.` to come before the number).

Since the version tags seem to typically only be on commits in release branches 
and the main branch only has `llvmorg-N-init` tags, I left the `*` so it can 
pick up the major version number from the `llvmorg-N-init` tag, and the 
`(?:.*)` at the end to ignore the trailing `-ini`. This makes so if someone 
installs from the main branch it will at least pick up a major version number 
rather than using the fallback_version.

The typical version number when installing from a random commit in the main 
branch will be something like `21.post.devN` -- so developers installing from 
main will at least have some indication of the major version of the bindings 
they've installed.

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


[clang] [llvm] [libclang/python] Enable packaging libclang bindings (PR #125806)

2025-02-07 Thread Ryan Mast via cfe-commits

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


[clang] [clang][ExtractAPI] combine typedef records if the underlying type's name is underscored (PR #125964)

2025-02-07 Thread via cfe-commits

dyung wrote:

> I don't see how that failure is related to my PR; my change was restricted to 
> ExtractAPI, it shouldn't be affecting the driver invocations.

You can probably ignore it. I was about to take the machine offline to update 
it and might have interfered in the run somehow. The other builder did not show 
the failure when it built the next commit.

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


[clang] [lldb] Reland: [clang] fix P3310 overload resolution flag propagation (PR #125791)

2025-02-07 Thread Matheus Izvekov via cfe-commits

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


  1   2   3   4   5   6   >