[clang] [llvm] [sancov] Introduce optional callback for stack-depth tracking (PR #138323)

2025-05-06 Thread Marco Elver via cfe-commits


@@ -1078,22 +1091,65 @@ void 
ModuleSanitizerCoverage::InjectCoverageAtBlock(Function &F, BasicBlock &BB,
 Store->setNoSanitizeMetadata();
   }
   if (Options.StackDepth && IsEntryBB && !IsLeafFunc) {
-// Check stack depth.  If it's the deepest so far, record it.
 Module *M = F.getParent();
-auto FrameAddrPtr = IRB.CreateIntrinsic(
-Intrinsic::frameaddress,
-IRB.getPtrTy(M->getDataLayout().getAllocaAddrSpace()),
-{Constant::getNullValue(Int32Ty)});
-auto FrameAddrInt = IRB.CreatePtrToInt(FrameAddrPtr, IntptrTy);
-auto LowestStack = IRB.CreateLoad(IntptrTy, SanCovLowestStack);
-auto IsStackLower = IRB.CreateICmpULT(FrameAddrInt, LowestStack);
-auto ThenTerm = SplitBlockAndInsertIfThen(
-IsStackLower, &*IP, false,
-MDBuilder(IRB.getContext()).createUnlikelyBranchWeights());
-IRBuilder<> ThenIRB(ThenTerm);
-auto Store = ThenIRB.CreateStore(FrameAddrInt, SanCovLowestStack);
-LowestStack->setNoSanitizeMetadata();
-Store->setNoSanitizeMetadata();
+const DataLayout &DL = M->getDataLayout();
+
+if (Options.StackDepthCallbackMin) {
+  // In callback mode, only add call when stack depth reaches minimum.
+  uint32_t EstimatedStackSize = 0;
+  // If dynamic alloca found, always add call.
+  bool dynamic_alloca = false;

melver wrote:

HasDynamicAlloc?

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


[clang] [llvm] [sancov] Introduce optional callback for stack-depth tracking (PR #138323)

2025-05-06 Thread Marco Elver via cfe-commits


@@ -1078,22 +1091,65 @@ void 
ModuleSanitizerCoverage::InjectCoverageAtBlock(Function &F, BasicBlock &BB,
 Store->setNoSanitizeMetadata();
   }
   if (Options.StackDepth && IsEntryBB && !IsLeafFunc) {
-// Check stack depth.  If it's the deepest so far, record it.
 Module *M = F.getParent();
-auto FrameAddrPtr = IRB.CreateIntrinsic(
-Intrinsic::frameaddress,
-IRB.getPtrTy(M->getDataLayout().getAllocaAddrSpace()),
-{Constant::getNullValue(Int32Ty)});
-auto FrameAddrInt = IRB.CreatePtrToInt(FrameAddrPtr, IntptrTy);
-auto LowestStack = IRB.CreateLoad(IntptrTy, SanCovLowestStack);
-auto IsStackLower = IRB.CreateICmpULT(FrameAddrInt, LowestStack);
-auto ThenTerm = SplitBlockAndInsertIfThen(
-IsStackLower, &*IP, false,
-MDBuilder(IRB.getContext()).createUnlikelyBranchWeights());
-IRBuilder<> ThenIRB(ThenTerm);
-auto Store = ThenIRB.CreateStore(FrameAddrInt, SanCovLowestStack);
-LowestStack->setNoSanitizeMetadata();
-Store->setNoSanitizeMetadata();
+const DataLayout &DL = M->getDataLayout();
+
+if (Options.StackDepthCallbackMin) {
+  // In callback mode, only add call when stack depth reaches minimum.
+  uint32_t EstimatedStackSize = 0;
+  // If dynamic alloca found, always add call.
+  bool dynamic_alloca = false;
+  // Find an insertion point after last "alloca".
+  llvm::Instruction *InsertBefore = NULL;

melver wrote:

nullptr

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


[clang] [llvm] [ARM] Fix for crash when using -mcmodel=tiny on X86 (PR #125643)

2025-05-06 Thread via cfe-commits


@@ -391,6 +391,7 @@ Improvements to Clang's diagnostics
 
 
 - An error is now emitted when a ``musttail`` call is made to a function 
marked with the ``not_tail_called`` attribute. (#GH133509).
+- The ``-mcmodel=tiny`` option will now be diagnosed on all targets other than 
ARM or AArch64.

ShashwathiNavada wrote:

@MaskRay, Thank you for the response. I have removed the release note entry and 
updated the commit message as well.

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


[clang] [clang][NFC] Regroup declarations in `Parser` (PR #138511)

2025-05-06 Thread Owen Pan via cfe-commits

owenca wrote:

> > 3. File has been formatted with clang-format, except for the grammar, 
> > because clang-format butchers it.
> 
> Yeah, this problem comes up rather frequently, I wonder if clang-format can 
> get some additional smarts to make that less of a challenge? CC 
> @mydeveloperday @owenca

Maybe the `CommentPragmas` option can be of help here?

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


[clang] [llvm] [ARM] Adding diagnostics for mcmodel=tiny when used in invalid targets (PR #125643)

2025-05-06 Thread via cfe-commits

https://github.com/ShashwathiNavada updated 
https://github.com/llvm/llvm-project/pull/125643

>From 0aebcd7119fbcd51154c5d9706752e8ff3f041bc Mon Sep 17 00:00:00 2001
From: ShashwathiNavada 
Date: Tue, 4 Feb 2025 00:16:09 -0600
Subject: [PATCH 01/13] Adding diagnostics for unsupported option

---
 clang/lib/Frontend/CompilerInvocation.cpp | 9 +
 1 file changed, 9 insertions(+)

diff --git a/clang/lib/Frontend/CompilerInvocation.cpp 
b/clang/lib/Frontend/CompilerInvocation.cpp
index 11fd6ab7f52a7..ac8d8be572012 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -1897,6 +1897,15 @@ bool CompilerInvocation::ParseCodeGenArgs(CodeGenOptions 
&Opts, ArgList &Args,
 Opts.setInlining(CodeGenOptions::NormalInlining);
   }
 
+// -mcmodel option.
+if (const llvm::opt::Arg *A = 
Args.getLastArg(clang::driver::options::OPT_mcmodel_EQ)) 
+{
+llvm::StringRef modelName = A->getValue();
+if(modelName=="tiny" && !T.isARM())
+  Diags.Report(diag::err_drv_unsupported_option_argument_for_target) 
+  << A->getSpelling() getValue();
 if(modelName=="tiny" && !T.isARM())
-  Diags.Report(diag::err_drv_unsupported_option_argument_for_target) 
-  << A->getSpelling() From 689dc3a3472ff8270ee9631b235e776f5fa1a27f Mon Sep 17 00:00:00 2001
From: ShashwathiNavada 
Date: Tue, 4 Feb 2025 00:49:37 -0600
Subject: [PATCH 03/13] minor changes

---
 clang/lib/Frontend/CompilerInvocation.cpp | 12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/clang/lib/Frontend/CompilerInvocation.cpp 
b/clang/lib/Frontend/CompilerInvocation.cpp
index 1242073ea6746..15d382620d279 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -1896,13 +1896,15 @@ bool 
CompilerInvocation::ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args,
   } else {
 Opts.setInlining(CodeGenOptions::NormalInlining);
   }
-
- // -mcmodel option.
-  if (const llvm::opt::Arg *A = 
Args.getLastArg(clang::driver::options::OPT_mcmodel_EQ)){
+ 
+  // -mcmodel option.
+  if (const llvm::opt::Arg *A =
+  Args.getLastArg(clang::driver::options::OPT_mcmodel_EQ)) {
 llvm::StringRef modelName = A->getValue();
-if(modelName=="tiny" && !T.isARM())
+if (modelName == "tiny" && !T.isARM()) {
   Diags.Report(diag::err_drv_unsupported_option_argument_for_target)
-  << A->getSpelling() << modelName << T.getTriple();  
+  << A->getSpelling() << modelName << T.getTriple();
+}
   }
 
   // PIC defaults to -fno-direct-access-external-data while non-PIC defaults to

>From 28fcb0ee20645cd1d30dd15bfd7f6eff402ba2b9 Mon Sep 17 00:00:00 2001
From: ShashwathiNavada 
Date: Tue, 4 Feb 2025 01:01:00 -0600
Subject: [PATCH 04/13] minor changes

---
 clang/lib/Frontend/CompilerInvocation.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/Frontend/CompilerInvocation.cpp 
b/clang/lib/Frontend/CompilerInvocation.cpp
index 15d382620d279..f858ec2234cb5 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -1896,7 +1896,7 @@ bool CompilerInvocation::ParseCodeGenArgs(CodeGenOptions 
&Opts, ArgList &Args,
   } else {
 Opts.setInlining(CodeGenOptions::NormalInlining);
   }
- 
+
   // -mcmodel option.
   if (const llvm::opt::Arg *A =
   Args.getLastArg(clang::driver::options::OPT_mcmodel_EQ)) {

>From 843d4ccf4c41a78397e14eb5d9459a4921325741 Mon Sep 17 00:00:00 2001
From: ShashwathiNavada 
Date: Tue, 4 Feb 2025 21:39:44 +0530
Subject: [PATCH 05/13] Addressed build fail

---
 clang/lib/Frontend/CompilerInvocation.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/Frontend/CompilerInvocation.cpp 
b/clang/lib/Frontend/CompilerInvocation.cpp
index f858ec2234cb5..48f66931a

[clang] [Sema] Warn about omitting deprecated enumerator in switch (PR #138562)

2025-05-06 Thread Hans Wennborg via cfe-commits

https://github.com/zmodem updated 
https://github.com/llvm/llvm-project/pull/138562

>From e221ba3b0f7b08bcfc56bf75f7505265c332637d Mon Sep 17 00:00:00 2001
From: Hans Wennborg 
Date: Mon, 5 May 2025 20:24:15 +0200
Subject: [PATCH 1/2] [Sema] Warn about omitting deprecated enumerator in
 switch

This undoes part of 3e4e3b17c14c15c23c0ed18ca9165b42b1b13ae3 which
added the "Omitting a deprecated constant is ok; it should never
materialize." logic.

That seems wrong: deprecated means the enumerator is likely to be
removed in future versions, not that it canot materialize.
---
 clang/lib/Sema/SemaStmt.cpp   | 6 +-
 clang/test/Sema/switch-availability.c | 2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp
index e8c1f8490342a..990d2fadaf5aa 100644
--- a/clang/lib/Sema/SemaStmt.cpp
+++ b/clang/lib/Sema/SemaStmt.cpp
@@ -1667,8 +1667,12 @@ Sema::ActOnFinishSwitchStmt(SourceLocation SwitchLoc, 
Stmt *Switch,
 // Don't warn about omitted unavailable EnumConstantDecls.
 switch (EI->second->getAvailability()) {
 case AR_Deprecated:
-  // Omitting a deprecated constant is ok; it should never materialize.
+  // Deprecated enumerators still need to be handled: they may be
+  // deprecated, but can still occur.
+  break;
+
 case AR_Unavailable:
+  // Omitting an unavailable enumerator is ok; it should never occur.
   continue;
 
 case AR_NotYetIntroduced:
diff --git a/clang/test/Sema/switch-availability.c 
b/clang/test/Sema/switch-availability.c
index 888edddac463d..b4f8726addc0b 100644
--- a/clang/test/Sema/switch-availability.c
+++ b/clang/test/Sema/switch-availability.c
@@ -15,7 +15,7 @@ enum SwitchTwo {
 };
 
 void testSwitchTwo(enum SwitchTwo st) {
-  switch (st) {} // expected-warning{{enumeration values 'Vim' and 'Emacs' not 
handled in switch}}
+  switch (st) {} // expected-warning{{enumeration values 'Ed', 'Vim' and 
'Emacs' not handled in switch}}
 }
 
 enum SwitchThree {

>From 6bc923d27d77009b37de12c9e33d2e83835d6a4d Mon Sep 17 00:00:00 2001
From: Hans Wennborg 
Date: Tue, 6 May 2025 09:31:50 +0200
Subject: [PATCH 2/2] check for -Wreturn-type

---
 clang/test/Sema/switch-availability.c | 15 ++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/clang/test/Sema/switch-availability.c 
b/clang/test/Sema/switch-availability.c
index b4f8726addc0b..137cdc976ec2d 100644
--- a/clang/test/Sema/switch-availability.c
+++ b/clang/test/Sema/switch-availability.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -verify -Wswitch -triple x86_64-apple-macosx10.12 %s
+// RUN: %clang_cc1 -verify -Wswitch -Wreturn-type -triple 
x86_64-apple-macosx10.12 %s
 
 enum SwitchOne {
   Unavail __attribute__((availability(macos, unavailable))),
@@ -25,3 +25,16 @@ enum SwitchThree {
 void testSwitchThree(enum SwitchThree st) {
   switch (st) {} // expected-warning{{enumeration value 'New' not handled in 
switch}}
 }
+
+enum SwitchFour {
+  Red,
+  Green,
+  Blue [[deprecated]]
+};
+
+int testSwitchFour(enum SwitchFour e) {
+  switch (e) { // expected-warning{{enumeration value 'Blue' not handled in 
switch}}
+  case Red:   return 1;
+  case Green: return 2;
+  }
+} // expected-warning{{non-void function does not return a value in all 
control paths}}

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


[clang] [llvm] [ARM] Fix for crash when using -mcmodel=tiny on X86 (PR #125643)

2025-05-06 Thread via cfe-commits

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


[clang] [llvm] [ARM] Fix for crash when using -mcmodel=tiny on X86 (PR #125643)

2025-05-06 Thread via cfe-commits

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


[clang] d66dbd6 - [clang][doc] Document C2y flags (#138521)

2025-05-06 Thread via cfe-commits

Author: Raul Tambre
Date: 2025-05-06T11:19:57+03:00
New Revision: d66dbd6931a4358c0e4fd7c749179aa229fb36a4

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

LOG: [clang][doc] Document C2y flags (#138521)

As discussed at 
https://github.com/llvm/llvm-project/pull/138459#issuecomment-2850716184

Added: 


Modified: 
clang/docs/CommandGuide/clang.rst
clang/include/clang/Basic/LangStandards.def

Removed: 




diff  --git a/clang/docs/CommandGuide/clang.rst 
b/clang/docs/CommandGuide/clang.rst
index e3399d39bf00c..1b8776c5e9ad2 100644
--- a/clang/docs/CommandGuide/clang.rst
+++ b/clang/docs/CommandGuide/clang.rst
@@ -155,6 +155,14 @@ Language Selection and Mode Options
 
ISO C 2023 with GNU extensions
 
+  | ``c2y``
+
+   ISO C 202y
+
+  | ``gnu2y``
+
+   ISO C 202y with GNU extensions
+
  The default C language standard is ``gnu17``, except on PS4, where it is
  ``gnu99``.
 

diff  --git a/clang/include/clang/Basic/LangStandards.def 
b/clang/include/clang/Basic/LangStandards.def
index 49cd9881829d4..244692ab4296a 100644
--- a/clang/include/clang/Basic/LangStandards.def
+++ b/clang/include/clang/Basic/LangStandards.def
@@ -105,7 +105,7 @@ LANGSTANDARD(c2y, "c2y",
 LANGSTANDARD(gnu2y, "gnu2y",
  C, "Working Draft for ISO C2y with GNU extensions",
  LineComment | C99 | C11 | C17 | C23 | C2y | Digraphs | GNUMode | 
HexFloat)
-
+// TODO: Add the iso9899:202y alias once ISO publishes the standard.
 
 // C++ modes
 LANGSTANDARD(cxx98, "c++98",



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


[clang] [clang][doc] Document C2y flags (PR #138521)

2025-05-06 Thread Raul Tambre via cfe-commits

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


[clang] [clang] Add support for Debian 14 Forky and Debian 15 Duke (PR #138460)

2025-05-06 Thread Raul Tambre via cfe-commits

tambry wrote:

/cherry-pick 58e6883c8b6e571d6bd774645ee2b6348cfed6ba

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


[clang] [clang] Add support for Debian 14 Forky and Debian 15 Duke (PR #138460)

2025-05-06 Thread via cfe-commits

llvmbot wrote:

/pull-request llvm/llvm-project#138652

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


[clang] [clang] Add support for Debian 14 Forky and Debian 15 Duke (PR #138460)

2025-05-06 Thread Raul Tambre via cfe-commits

tambry wrote:

Seems like the cherry-pick only works if the branch of the PR still exists. 
:thinking: 

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


[clang] FEAT: one byte for "true" & "false" (PR #138649)

2025-05-06 Thread SAKSHAM JOSHI via cfe-commits

https://github.com/saksham-joshi updated 
https://github.com/llvm/llvm-project/pull/138649

>From 8bba07d817d4dd583122d7ed831de276da8801e0 Mon Sep 17 00:00:00 2001
From: SAKSHAM JOSHI 
Date: Tue, 6 May 2025 12:43:34 +0530
Subject: [PATCH] FEAT: one byte for "true" & "false"

In C programming language,

The size of "true" and "false" macros is 4 byte and size of "_Bool" datatype is 
1 byte.

By this simple change, we can set the size of "true" and "false" to 1 byte.
---
 clang/lib/Headers/stdbool.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/clang/lib/Headers/stdbool.h b/clang/lib/Headers/stdbool.h
index dfaad2b65a9b5..e9142327f0ffd 100644
--- a/clang/lib/Headers/stdbool.h
+++ b/clang/lib/Headers/stdbool.h
@@ -22,8 +22,8 @@
  */
 #elif !defined(__cplusplus)
 #define bool _Bool
-#define true 1
-#define false 0
+#define true (bool)1
+#define false (bool)0
 #elif defined(__GNUC__) && !defined(__STRICT_ANSI__)
 /* Define _Bool as a GNU extension. */
 #define _Bool bool

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


[clang] Reset CodeGenOptions fields for clean module/PCH builds (PR #138256)

2025-05-06 Thread Chuanqi Xu via cfe-commits

ChuanqiXu9 wrote:

hmmm for `test case`, I mean a test case in clang, either a unit test or a lit 
test, so we can understand the effect on users more clearly. 

And if you're talking about the general code policy, I'll suggest you to 
https://discourse.llvm.org/ to make it more verbose.

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


[libcxx] [libunwind] [llvm] [libc++] Upgrade to GCC 15 (PR #138293)

2025-05-06 Thread Nikolas Klauser via cfe-commits

https://github.com/philnik777 updated 
https://github.com/llvm/llvm-project/pull/138293



  



Rate limit · GitHub


  body {
background-color: #f6f8fa;
color: #24292e;
font-family: -apple-system,BlinkMacSystemFont,Segoe 
UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;
font-size: 14px;
line-height: 1.5;
margin: 0;
  }

  .container { margin: 50px auto; max-width: 600px; text-align: center; 
padding: 0 24px; }

  a { color: #0366d6; text-decoration: none; }
  a:hover { text-decoration: underline; }

  h1 { line-height: 60px; font-size: 48px; font-weight: 300; margin: 0px; 
text-shadow: 0 1px 0 #fff; }
  p { color: rgba(0, 0, 0, 0.5); margin: 20px 0 40px; }

  ul { list-style: none; margin: 25px 0; padding: 0; }
  li { display: table-cell; font-weight: bold; width: 1%; }

  .logo { display: inline-block; margin-top: 35px; }
  .logo-img-2x { display: none; }
  @media
  only screen and (-webkit-min-device-pixel-ratio: 2),
  only screen and (   min--moz-device-pixel-ratio: 2),
  only screen and ( -o-min-device-pixel-ratio: 2/1),
  only screen and (min-device-pixel-ratio: 2),
  only screen and (min-resolution: 192dpi),
  only screen and (min-resolution: 2dppx) {
.logo-img-1x { display: none; }
.logo-img-2x { display: inline-block; }
  }

  #suggestions {
margin-top: 35px;
color: #ccc;
  }
  #suggestions a {
color: #66;
font-weight: 200;
font-size: 14px;
margin: 0 10px;
  }


  
  



  Whoa there!
  You have exceeded a secondary rate limit.
Please wait a few minutes before you try again;
in some cases this may take up to an hour.
  
  
https://support.github.com/contact";>Contact Support —
https://githubstatus.com";>GitHub Status —
https://twitter.com/githubstatus";>@githubstatus
  

  

  

  

  

  


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


[clang] [Clang][CodeGen] Check `isUnderlyingBasePointerConstantNull` in `isNullPointerArithmeticExtension` (PR #137849)

2025-05-06 Thread Yingwei Zheng via cfe-commits


@@ -4169,11 +4169,16 @@ static Value *emitPointerArithmetic(CodeGenFunction 
&CGF,
   //   The index is not pointer-sized.
   //   The pointer type is not byte-sized.
   //
-  if (BinaryOperator::isNullPointerArithmeticExtension(CGF.getContext(),
-   op.Opcode,
-   expr->getLHS(),
-   expr->getRHS()))
-return CGF.Builder.CreateIntToPtr(index, pointer->getType());
+  // Note that we do not suppress the pointer overflow check in this case.
+  if (!CGF.SanOpts.has(SanitizerKind::PointerOverflow) &&
+  BinaryOperator::isNullPointerArithmeticExtension(
+  CGF.getContext(), op.Opcode, expr->getLHS(), expr->getRHS())) {
+// isUnderlyingBasePointerConstantNull returns true does not indicate that
+// the base pointer is null.

dtcxzyw wrote:

We may not need `isUnderlyingBasePointerConstantNull`. We can just handle 
`ConditionalOperator` in `Expr::isNullPointerConstant`.


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


[clang] FEAT: one byte for "true" & "false" (PR #138649)

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


[clang] FEAT: one byte for "true" & "false" (PR #138649)

2025-05-06 Thread SAKSHAM JOSHI via cfe-commits

https://github.com/saksham-joshi created 
https://github.com/llvm/llvm-project/pull/138649

### 1 byte is enough for bool

- In C programming language,

- the size of **"true"** and **"false"** macros is 4 byte and size of macro 
"bool" (typedef of _Bool) is 1 byte.

- By this simple change, we can set the size of "true" and "false" to 1 byte.

- This change will decrease the memory usage made by using true & false macros 
in C.

>From 8bba07d817d4dd583122d7ed831de276da8801e0 Mon Sep 17 00:00:00 2001
From: SAKSHAM JOSHI 
Date: Tue, 6 May 2025 12:43:34 +0530
Subject: [PATCH] FEAT: one byte for "true" & "false"

In C programming language,

The size of "true" and "false" macros is 4 byte and size of "_Bool" datatype is 
1 byte.

By this simple change, we can set the size of "true" and "false" to 1 byte.
---
 clang/lib/Headers/stdbool.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/clang/lib/Headers/stdbool.h b/clang/lib/Headers/stdbool.h
index dfaad2b65a9b5..e9142327f0ffd 100644
--- a/clang/lib/Headers/stdbool.h
+++ b/clang/lib/Headers/stdbool.h
@@ -22,8 +22,8 @@
  */
 #elif !defined(__cplusplus)
 #define bool _Bool
-#define true 1
-#define false 0
+#define true (bool)1
+#define false (bool)0
 #elif defined(__GNUC__) && !defined(__STRICT_ANSI__)
 /* Define _Bool as a GNU extension. */
 #define _Bool bool

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


[clang] [clang][Index] Add comment about out-of-line defaulted destructor (PR #138640)

2025-05-06 Thread Nathan Ridge via cfe-commits

https://github.com/HighCommander4 updated 
https://github.com/llvm/llvm-project/pull/138640



  



Rate limit · GitHub


  body {
background-color: #f6f8fa;
color: #24292e;
font-family: -apple-system,BlinkMacSystemFont,Segoe 
UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;
font-size: 14px;
line-height: 1.5;
margin: 0;
  }

  .container { margin: 50px auto; max-width: 600px; text-align: center; 
padding: 0 24px; }

  a { color: #0366d6; text-decoration: none; }
  a:hover { text-decoration: underline; }

  h1 { line-height: 60px; font-size: 48px; font-weight: 300; margin: 0px; 
text-shadow: 0 1px 0 #fff; }
  p { color: rgba(0, 0, 0, 0.5); margin: 20px 0 40px; }

  ul { list-style: none; margin: 25px 0; padding: 0; }
  li { display: table-cell; font-weight: bold; width: 1%; }

  .logo { display: inline-block; margin-top: 35px; }
  .logo-img-2x { display: none; }
  @media
  only screen and (-webkit-min-device-pixel-ratio: 2),
  only screen and (   min--moz-device-pixel-ratio: 2),
  only screen and ( -o-min-device-pixel-ratio: 2/1),
  only screen and (min-device-pixel-ratio: 2),
  only screen and (min-resolution: 192dpi),
  only screen and (min-resolution: 2dppx) {
.logo-img-1x { display: none; }
.logo-img-2x { display: inline-block; }
  }

  #suggestions {
margin-top: 35px;
color: #ccc;
  }
  #suggestions a {
color: #66;
font-weight: 200;
font-size: 14px;
margin: 0 10px;
  }


  
  



  Whoa there!
  You have exceeded a secondary rate limit.
Please wait a few minutes before you try again;
in some cases this may take up to an hour.
  
  
https://support.github.com/contact";>Contact Support —
https://githubstatus.com";>GitHub Status —
https://twitter.com/githubstatus";>@githubstatus
  

  

  

  

  

  


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


[clang] FEAT: one byte for "true" & "false" (PR #138649)

2025-05-06 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-backend-x86

Author: SAKSHAM JOSHI (saksham-joshi)


Changes

### 1 byte is enough for bool

- In C programming language,

- the size of **"true"** and **"false"** macros is 4 byte and size of macro 
"bool" (typedef of _Bool) is 1 byte.

- By this simple change, we can set the size of "true" and "false" to 1 byte.

- This change will decrease the memory usage made by using true & false 
macros in C.

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


1 Files Affected:

- (modified) clang/lib/Headers/stdbool.h (+2-2) 


``diff
diff --git a/clang/lib/Headers/stdbool.h b/clang/lib/Headers/stdbool.h
index dfaad2b65a9b5..e9142327f0ffd 100644
--- a/clang/lib/Headers/stdbool.h
+++ b/clang/lib/Headers/stdbool.h
@@ -22,8 +22,8 @@
  */
 #elif !defined(__cplusplus)
 #define bool _Bool
-#define true 1
-#define false 0
+#define true (bool)1
+#define false (bool)0
 #elif defined(__GNUC__) && !defined(__STRICT_ANSI__)
 /* Define _Bool as a GNU extension. */
 #define _Bool bool

``




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


[clang] FEAT: one byte for "true" & "false" (PR #138649)

2025-05-06 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang

Author: SAKSHAM JOSHI (saksham-joshi)


Changes

### 1 byte is enough for bool

- In C programming language,

- the size of **"true"** and **"false"** macros is 4 byte and size of macro 
"bool" (typedef of _Bool) is 1 byte.

- By this simple change, we can set the size of "true" and "false" to 1 byte.

- This change will decrease the memory usage made by using true & false 
macros in C.

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


1 Files Affected:

- (modified) clang/lib/Headers/stdbool.h (+2-2) 


``diff
diff --git a/clang/lib/Headers/stdbool.h b/clang/lib/Headers/stdbool.h
index dfaad2b65a9b5..e9142327f0ffd 100644
--- a/clang/lib/Headers/stdbool.h
+++ b/clang/lib/Headers/stdbool.h
@@ -22,8 +22,8 @@
  */
 #elif !defined(__cplusplus)
 #define bool _Bool
-#define true 1
-#define false 0
+#define true (bool)1
+#define false (bool)0
 #elif defined(__GNUC__) && !defined(__STRICT_ANSI__)
 /* Define _Bool as a GNU extension. */
 #define _Bool bool

``




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


[clang] [clang-format] Add SpaceAfterOperatorKeyword option (PR #137610)

2025-05-06 Thread Owen Pan via cfe-commits

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


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


[clang] [Clang] Do not warn for serialized builtin or command-line definitions (PR #137306)

2025-05-06 Thread Timm Baeder via cfe-commits

tbaederr wrote:

@jmmartinez Ping.

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


[clang] [Clang] Add `noalias` to `this` pointer in C++ constructors (PR #136792)

2025-05-06 Thread Guy David via cfe-commits

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


[clang] [Sema] Warn about omitting deprecated enumerator in switch (PR #138562)

2025-05-06 Thread Hans Wennborg via cfe-commits


@@ -15,7 +15,7 @@ enum SwitchTwo {
 };
 
 void testSwitchTwo(enum SwitchTwo st) {
-  switch (st) {} // expected-warning{{enumeration values 'Vim' and 'Emacs' not 
handled in switch}}
+  switch (st) {} // expected-warning{{enumeration values 'Ed', 'Vim' and 
'Emacs' not handled in switch}}
 }
 

zmodem wrote:

Done.

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


[clang] [clang][ASTImporter] Fix AST import if anonymous namespaces are merged (PR #128735)

2025-05-06 Thread Balázs Kéri via cfe-commits

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


[clang] 4b30b3f - [clang][ASTImporter] Fix AST import if anonymous namespaces are merged (#128735)

2025-05-06 Thread via cfe-commits

Author: Balázs Kéri
Date: 2025-05-06T10:17:26+02:00
New Revision: 4b30b3f901b00da1bd1f70e9ca9086e349c7cca0

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

LOG: [clang][ASTImporter] Fix AST import if anonymous namespaces are merged 
(#128735)

Fix of a faulty case that is shown in the second of the added
tests (an anonymous namespace is imported that resides in a `extern "C"`
block).

Added: 


Modified: 
clang/lib/AST/ASTImporter.cpp
clang/unittests/AST/ASTImporterTest.cpp

Removed: 




diff  --git a/clang/lib/AST/ASTImporter.cpp b/clang/lib/AST/ASTImporter.cpp
index eb0e6866e367b..b481ad5df667e 100644
--- a/clang/lib/AST/ASTImporter.cpp
+++ b/clang/lib/AST/ASTImporter.cpp
@@ -2628,11 +2628,12 @@ ExpectedDecl 
ASTNodeImporter::VisitNamespaceDecl(NamespaceDecl *D) {
   if (!Name) {
 // This is an anonymous namespace. Adopt an existing anonymous
 // namespace if we can.
-// FIXME: Not testable.
-if (auto *TU = dyn_cast(DC))
+DeclContext *EnclosingDC = DC->getEnclosingNamespaceContext();
+if (auto *TU = dyn_cast(EnclosingDC))
   MergeWithNamespace = TU->getAnonymousNamespace();
 else
-  MergeWithNamespace = cast(DC)->getAnonymousNamespace();
+  MergeWithNamespace =
+  cast(EnclosingDC)->getAnonymousNamespace();
   } else {
 SmallVector ConflictingDecls;
 auto FoundDecls = Importer.findDeclsInToCtx(DC, Name);

diff  --git a/clang/unittests/AST/ASTImporterTest.cpp 
b/clang/unittests/AST/ASTImporterTest.cpp
index 4192faee1af80..cddd301e22e50 100644
--- a/clang/unittests/AST/ASTImporterTest.cpp
+++ b/clang/unittests/AST/ASTImporterTest.cpp
@@ -10456,6 +10456,79 @@ TEST_P(ASTImporterOptionSpecificTestBase,
   EXPECT_EQ(ToFr1Imp, ToFr1);
 }
 
+struct ImportAndMergeAnonymousNamespace
+: public ASTImporterOptionSpecificTestBase {
+protected:
+  void test(const char *ToCode, const char *FromCode) {
+Decl *ToTU = getToTuDecl(ToCode, Lang_CXX11);
+Decl *FromTU = getTuDecl(FromCode, Lang_CXX11);
+auto *FromNS = FirstDeclMatcher().match(
+FromTU, namespaceDecl(isAnonymous()));
+auto *ToNS = FirstDeclMatcher().match(
+ToTU, namespaceDecl(isAnonymous()));
+auto *FromF = FirstDeclMatcher().match(
+FromTU, functionDecl(hasName("f")));
+auto *ImportedF = Import(FromF, Lang_CXX11);
+EXPECT_TRUE(ImportedF);
+EXPECT_EQ(ImportedF->getDeclContext(), ToNS);
+auto *ImportedNS = Import(FromNS, Lang_CXX11);
+EXPECT_EQ(ImportedNS, ToNS);
+  }
+};
+
+TEST_P(ImportAndMergeAnonymousNamespace, NamespaceInTU) {
+  const char *ToCode =
+  R"(
+  namespace {
+  }
+  )";
+  const char *FromCode =
+  R"(
+  namespace {
+void f();
+  }
+  )";
+  test(ToCode, FromCode);
+}
+
+TEST_P(ImportAndMergeAnonymousNamespace, NamespaceInLinkageSpec) {
+  const char *ToCode =
+  R"(
+  extern "C" {
+  namespace {
+  }
+  }
+  )";
+  const char *FromCode =
+  R"(
+  extern "C" {
+  namespace {
+void f();
+  }
+  }
+  )";
+  test(ToCode, FromCode);
+}
+
+TEST_P(ImportAndMergeAnonymousNamespace, NamespaceInNamespace) {
+  const char *ToCode =
+  R"(
+  namespace X {
+namespace {
+}
+  }
+  )";
+  const char *FromCode =
+  R"(
+  namespace X {
+namespace {
+  void f();
+}
+  }
+  )";
+  test(ToCode, FromCode);
+}
+
 INSTANTIATE_TEST_SUITE_P(ParameterizedTests, ASTImporterLookupTableTest,
  DefaultTestValuesForRunOptions);
 
@@ -10542,6 +10615,9 @@ INSTANTIATE_TEST_SUITE_P(ParameterizedTests, 
ImportMatrixType,
 INSTANTIATE_TEST_SUITE_P(ParameterizedTests, 
ImportTemplateParmDeclDefaultValue,
  DefaultTestValuesForRunOptions);
 
+INSTANTIATE_TEST_SUITE_P(ParameterizedTests, ImportAndMergeAnonymousNamespace,
+ DefaultTestValuesForRunOptions);
+
 // FIXME: Make ImportOpenCLPipe test work.
 // INSTANTIATE_TEST_SUITE_P(ParameterizedTests, ImportOpenCLPipe,
 //  DefaultTestValuesForRunOptions);



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


[clang] [Sema] Warn about omitting deprecated enumerator in switch (PR #138562)

2025-05-06 Thread Hans Wennborg via cfe-commits

zmodem wrote:

I wonder if we should also do something special about the 
`-Wdeprecated-declarations` diagnostic in switches.

If the user fixes the -Wswitch  / -Wreturn-type warnings from `testSwitchFour` 
the natural way:

```
int testSwitchFour(enum SwitchFour e) {
  switch (e) {
  case Red:   return 1;
  case Green: return 2;
  case Blue:  return 3;
  }
} 
```

They will get `warning: 'Blue' is deprecated [-Wdeprecated-declarations]` 
instead.

Maybe we should suppress that warning for switch cases? Or suggest adding a 
`default` label instead?

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


[clang] [Sema] Warn about omitting deprecated enumerator in switch (PR #138562)

2025-05-06 Thread Hans Wennborg via cfe-commits

zmodem wrote:

> Fly-by comment: I drafted the following alternative comment in another 
> thread. Please feel free to disregard as I don't know the tone and style of 
> comments in these files. (But I appreciate your consideration for the 
> contents in the message I'd like to see!)
> 
> ```
>   // We currently treat deprecated constants as if they don't exist;
>   // however, note that this current behavior leads to compile-time
>   // false negatives for coverage checking of switch statements. If
>   // a switch is missing a case for a deprecated constant, we will not
>   // emit a diagnostic, even though the deprecated constant might still
>   // be present in legacy use.
> ```

My patch changes the behavior so that deprecated constants are not ignored by 
the switch coverage warning.

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


[clang] [clang][OpenMP] Add error for large expr in SIMD collapse (PR #138592)

2025-05-06 Thread via cfe-commits

https://github.com/k-arrows commented:

I am not a developer, so I won't review the implementation, but I have one 
comment. The way I originally wrote the bug report was poor, but it is not 
necessary to limit the fix and its test to OpenMP SIMD. For example, the code 
below also crashes:
https://godbolt.org/z/7T8MbE5j5
```cpp
void f(void) {
#pragma omp for collapse(0x)
  for (int i = 0; i < 10; i++)
;
}
```

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


[clang] [llvm] [MIPS] Add FeatureMSA to i6400 and i6500 cores (PR #134985)

2025-05-06 Thread Mallikarjuna Gouda via cfe-commits

https://github.com/mgoudar updated 
https://github.com/llvm/llvm-project/pull/134985



  



Rate limit · GitHub


  body {
background-color: #f6f8fa;
color: #24292e;
font-family: -apple-system,BlinkMacSystemFont,Segoe 
UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;
font-size: 14px;
line-height: 1.5;
margin: 0;
  }

  .container { margin: 50px auto; max-width: 600px; text-align: center; 
padding: 0 24px; }

  a { color: #0366d6; text-decoration: none; }
  a:hover { text-decoration: underline; }

  h1 { line-height: 60px; font-size: 48px; font-weight: 300; margin: 0px; 
text-shadow: 0 1px 0 #fff; }
  p { color: rgba(0, 0, 0, 0.5); margin: 20px 0 40px; }

  ul { list-style: none; margin: 25px 0; padding: 0; }
  li { display: table-cell; font-weight: bold; width: 1%; }

  .logo { display: inline-block; margin-top: 35px; }
  .logo-img-2x { display: none; }
  @media
  only screen and (-webkit-min-device-pixel-ratio: 2),
  only screen and (   min--moz-device-pixel-ratio: 2),
  only screen and ( -o-min-device-pixel-ratio: 2/1),
  only screen and (min-device-pixel-ratio: 2),
  only screen and (min-resolution: 192dpi),
  only screen and (min-resolution: 2dppx) {
.logo-img-1x { display: none; }
.logo-img-2x { display: inline-block; }
  }

  #suggestions {
margin-top: 35px;
color: #ccc;
  }
  #suggestions a {
color: #66;
font-weight: 200;
font-size: 14px;
margin: 0 10px;
  }


  
  



  Whoa there!
  You have exceeded a secondary rate limit.
Please wait a few minutes before you try again;
in some cases this may take up to an hour.
  
  
https://support.github.com/contact";>Contact Support —
https://githubstatus.com";>GitHub Status —
https://twitter.com/githubstatus";>@githubstatus
  

  

  

  

  

  


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


[clang-tools-extra] [Clang-Tidy][NFC] Simplify check cppcoreguidelines-missing-std-forward (PR #138504)

2025-05-06 Thread Carlos Galvez via cfe-commits

carlosgalvezp wrote:

> because the cases handled by it are covered by CaptureByRefExplicit.

Strange, can you explain why that's the case? Are we missing tests?

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


[clang] [sanitizer] Fix empty string in unsupported argument error for -fsanitize-trap (PR #136549)

2025-05-06 Thread Sinkevich Artem via cfe-commits

https://github.com/ArtSin updated 
https://github.com/llvm/llvm-project/pull/136549

>From f5c8b4ea6539976e759e8fe183e009475d895052 Mon Sep 17 00:00:00 2001
From: Artem Sinkevich 
Date: Mon, 21 Apr 2025 12:48:51 +0400
Subject: [PATCH] [sanitizer] Fix empty string in unsupported argument error
 for -fsanitize-trap

When using `-fsanitize-trap` with a sanitizer group that doesn't support
trapping, an empty argument is passed to `err_drv_unsupported_option_argument`.
Expand groups for the diagnostic.
---
 clang/lib/Driver/SanitizerArgs.cpp | 4 ++--
 clang/test/Driver/fsanitize.c  | 3 +++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/clang/lib/Driver/SanitizerArgs.cpp 
b/clang/lib/Driver/SanitizerArgs.cpp
index ff08bffdbde1f..2829d6ebd078f 100644
--- a/clang/lib/Driver/SanitizerArgs.cpp
+++ b/clang/lib/Driver/SanitizerArgs.cpp
@@ -286,7 +286,7 @@ parseSanitizeArgs(const Driver &D, const llvm::opt::ArgList 
&Args,
   Add & AlwaysOut & ~DiagnosedAlwaysOutViolations) {
 if (DiagnoseErrors) {
   SanitizerSet SetToDiagnose;
-  SetToDiagnose.Mask |= KindsToDiagnose;
+  SetToDiagnose.Mask |= expandSanitizerGroups(KindsToDiagnose);
   D.Diag(diag::err_drv_unsupported_option_argument)
   << Arg->getSpelling() << toString(SetToDiagnose);
   DiagnosedAlwaysOutViolations |= KindsToDiagnose;
@@ -302,7 +302,7 @@ parseSanitizeArgs(const Driver &D, const llvm::opt::ArgList 
&Args,
   Remove & AlwaysIn & ~DiagnosedAlwaysInViolations) {
 if (DiagnoseErrors) {
   SanitizerSet SetToDiagnose;
-  SetToDiagnose.Mask |= KindsToDiagnose;
+  SetToDiagnose.Mask |= expandSanitizerGroups(KindsToDiagnose);
   D.Diag(diag::err_drv_unsupported_option_argument)
   << Arg->getSpelling() << toString(SetToDiagnose);
   DiagnosedAlwaysInViolations |= KindsToDiagnose;
diff --git a/clang/test/Driver/fsanitize.c b/clang/test/Driver/fsanitize.c
index eb72140fb1315..970622475f40b 100644
--- a/clang/test/Driver/fsanitize.c
+++ b/clang/test/Driver/fsanitize.c
@@ -259,6 +259,9 @@
 // RUN: not %clang --target=aarch64-linux -fsanitize=memtag -I +mte %s -### 
2>&1 | FileCheck %s --check-prefix=CHECK-SANMT-NOMT-1
 // CHECK-SANMT-NOMT-1: '-fsanitize=memtag-stack' requires hardware support 
(+memtag)
 
+// RUN: not %clang --target=aarch64-linux-android31 -fsanitize-trap=memtag 
-march=armv8-a+memtag -c %s -### 2>&1 | FileCheck %s 
--check-prefix=CHECK-SANMT-TRAP
+// CHECK-SANMT-TRAP: error: unsupported argument 
'memtag-stack,memtag-heap,memtag-globals' to option '-fsanitize-trap='
+
 // RUN: %clang --target=x86_64-linux-gnu -fsanitize=address 
-fsanitize-address-use-after-scope %s -### 2>&1 | FileCheck %s 
--check-prefix=CHECK-USE-AFTER-SCOPE
 // RUN: %clang_cl --target=x86_64-windows -fsanitize=address 
-fsanitize-address-use-after-scope -### -- %s 2>&1 | FileCheck %s 
--check-prefix=CHECK-USE-AFTER-SCOPE
 // CHECK-USE-AFTER-SCOPE: -cc1{{.*}}-fsanitize-address-use-after-scope

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


[clang] Reset CodeGenOptions fields for clean module/PCH builds (PR #138256)

2025-05-06 Thread Ayush Pareek via cfe-commits

ayushpareek2003 wrote:

> I feel `.clear()` should have a similar semantic with `= {};`. It will be 
> confusing for people to understand this. It will be helpful if you can 
> provide a test to show the difference.

I’ve tried to demonstrate the difference between .clear() and = {}, not a 
formal test case, but just a minimal example to illustrate the behavior 
clearly. It’s meant to show how these two approaches behave differently, 
especially when dealing with types like std::optional.

`   std::optional A = "clang";
auto B = A;
auto C = A;

B->clear(); // empties the string but keeps the optional engaged
C = {}; // fully resets the optional to disengaged (nullopt)

std::cout << "B has value? " << B.has_value() << "\n"; // it will print 1
std::cout << "C has value? " << C.has_value() << "\n"; // it will print 0
   `
   
   I hope it helps clarify why = {} can be a safer and more expressive choice 
in some situations
  
  
  

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


[clang] Reset CodeGenOptions fields for clean module/PCH builds (PR #138256)

2025-05-06 Thread Ayush Pareek via cfe-commits

https://github.com/ayushpareek2003 updated 
https://github.com/llvm/llvm-project/pull/138256



  



Rate limit · GitHub


  body {
background-color: #f6f8fa;
color: #24292e;
font-family: -apple-system,BlinkMacSystemFont,Segoe 
UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;
font-size: 14px;
line-height: 1.5;
margin: 0;
  }

  .container { margin: 50px auto; max-width: 600px; text-align: center; 
padding: 0 24px; }

  a { color: #0366d6; text-decoration: none; }
  a:hover { text-decoration: underline; }

  h1 { line-height: 60px; font-size: 48px; font-weight: 300; margin: 0px; 
text-shadow: 0 1px 0 #fff; }
  p { color: rgba(0, 0, 0, 0.5); margin: 20px 0 40px; }

  ul { list-style: none; margin: 25px 0; padding: 0; }
  li { display: table-cell; font-weight: bold; width: 1%; }

  .logo { display: inline-block; margin-top: 35px; }
  .logo-img-2x { display: none; }
  @media
  only screen and (-webkit-min-device-pixel-ratio: 2),
  only screen and (   min--moz-device-pixel-ratio: 2),
  only screen and ( -o-min-device-pixel-ratio: 2/1),
  only screen and (min-device-pixel-ratio: 2),
  only screen and (min-resolution: 192dpi),
  only screen and (min-resolution: 2dppx) {
.logo-img-1x { display: none; }
.logo-img-2x { display: inline-block; }
  }

  #suggestions {
margin-top: 35px;
color: #ccc;
  }
  #suggestions a {
color: #66;
font-weight: 200;
font-size: 14px;
margin: 0 10px;
  }


  
  



  Whoa there!
  You have exceeded a secondary rate limit.
Please wait a few minutes before you try again;
in some cases this may take up to an hour.
  
  
https://support.github.com/contact";>Contact Support —
https://githubstatus.com";>GitHub Status —
https://twitter.com/githubstatus";>@githubstatus
  

  

  

  

  

  


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


[clang] Reset CodeGenOptions fields for clean module/PCH builds (PR #138256)

2025-05-06 Thread Ayush Pareek via cfe-commits

ayushpareek2003 wrote:

> hmmm for `test case`, I mean a test case in clang, either a unit test or a 
> lit test, so we can understand the effect on users more clearly.
> 
> And if you're talking about the general code policy, I'll suggest you to 
> https://discourse.llvm.org/ to make it more verbose.

I've added a lit test under clang/test/Modules/reset-codegen-options.c to 
demonstrate that the affected fields (like MainFileName and 
DebugCompilationDir) are correctly reset and no longer leak into the module or 
PCH output.
This test helps confirm that switching from .clear() to = {} results in cleaner 
and more consistent output, particularly by fully resetting the fields to their 
default-constructed state

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


[clang] [Clang][CodeGen] Check `isUnderlyingBasePointerConstantNull` in `isNullPointerArithmeticExtension` (PR #137849)

2025-05-06 Thread Yingwei Zheng via cfe-commits


@@ -4169,11 +4169,16 @@ static Value *emitPointerArithmetic(CodeGenFunction 
&CGF,
   //   The index is not pointer-sized.
   //   The pointer type is not byte-sized.
   //
-  if (BinaryOperator::isNullPointerArithmeticExtension(CGF.getContext(),
-   op.Opcode,
-   expr->getLHS(),
-   expr->getRHS()))
-return CGF.Builder.CreateIntToPtr(index, pointer->getType());
+  // Note that we do not suppress the pointer overflow check in this case.
+  if (!CGF.SanOpts.has(SanitizerKind::PointerOverflow) &&
+  BinaryOperator::isNullPointerArithmeticExtension(
+  CGF.getContext(), op.Opcode, expr->getLHS(), expr->getRHS())) {
+// isUnderlyingBasePointerConstantNull returns true does not indicate that
+// the base pointer is null.

dtcxzyw wrote:

I think it makes more sense since `ChooseExpr` is also handled by 
`Expr::isNullPointerConstant`.


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


[clang] [Clang][CodeGen] Check `isUnderlyingBasePointerConstantNull` in `isNullPointerArithmeticExtension` (PR #137849)

2025-05-06 Thread Yingwei Zheng via cfe-commits

https://github.com/dtcxzyw updated 
https://github.com/llvm/llvm-project/pull/137849

>From 5b3a9ed3ed2f258a178e0c17891e2d9ae4f21446 Mon Sep 17 00:00:00 2001
From: Yingwei Zheng 
Date: Tue, 6 May 2025 17:47:07 +0800
Subject: [PATCH] [Clang][CodeGen] Enable pointer overflow check for GCC
 workaround

---
 clang/lib/CodeGen/CGExprScalar.cpp|  8 ++---
 .../catch-nullptr-and-nonzero-offset.c| 36 +--
 2 files changed, 38 insertions(+), 6 deletions(-)

diff --git a/clang/lib/CodeGen/CGExprScalar.cpp 
b/clang/lib/CodeGen/CGExprScalar.cpp
index 8dbbcdaef25d8..f7de0bfa2d76c 100644
--- a/clang/lib/CodeGen/CGExprScalar.cpp
+++ b/clang/lib/CodeGen/CGExprScalar.cpp
@@ -4169,10 +4169,10 @@ static Value *emitPointerArithmetic(CodeGenFunction 
&CGF,
   //   The index is not pointer-sized.
   //   The pointer type is not byte-sized.
   //
-  if (BinaryOperator::isNullPointerArithmeticExtension(CGF.getContext(),
-   op.Opcode,
-   expr->getLHS(),
-   expr->getRHS()))
+  // Note that we do not suppress the pointer overflow check in this case.
+  if (!CGF.SanOpts.has(SanitizerKind::PointerOverflow) &&
+  BinaryOperator::isNullPointerArithmeticExtension(
+  CGF.getContext(), op.Opcode, expr->getLHS(), expr->getRHS()))
 return CGF.Builder.CreateIntToPtr(index, pointer->getType());
 
   if (width != DL.getIndexTypeSizeInBits(PtrTy)) {
diff --git a/clang/test/CodeGen/catch-nullptr-and-nonzero-offset.c 
b/clang/test/CodeGen/catch-nullptr-and-nonzero-offset.c
index 63b6db2c2adeb..0cf147d27a3dd 100644
--- a/clang/test/CodeGen/catch-nullptr-and-nonzero-offset.c
+++ b/clang/test/CodeGen/catch-nullptr-and-nonzero-offset.c
@@ -1,9 +1,9 @@
-// RUN: %clang_cc1 -x c -emit-llvm %s -o - -triple x86_64-linux-gnu | 
FileCheck %s
+// RUN: %clang_cc1 -x c -emit-llvm %s -o - -triple x86_64-linux-gnu | 
FileCheck %s --check-prefixes=CHECK,CHECK-NOSANITIZE
 // RUN: %clang_cc1 -x c -fsanitize=pointer-overflow 
-fno-sanitize-recover=pointer-overflow -emit-llvm %s -o - -triple 
x86_64-linux-gnu | FileCheck %s -implicit-check-not="call void 
@__ubsan_handle_pointer_overflow" 
--check-prefixes=CHECK,CHECK-SANITIZE,CHECK-SANITIZE-ANYRECOVER,CHECK-SANITIZE-NORECOVER,CHECK-SANITIZE-UNREACHABLE
 // RUN: %clang_cc1 -x c -fsanitize=pointer-overflow 
-fsanitize-recover=pointer-overflow -emit-llvm %s -o - -triple x86_64-linux-gnu 
| FileCheck %s -implicit-check-not="call void @__ubsan_handle_pointer_overflow" 
--check-prefixes=CHECK,CHECK-SANITIZE,CHECK-SANITIZE-ANYRECOVER,CHECK-SANITIZE-RECOVER
 // RUN: %clang_cc1 -x c -fsanitize=pointer-overflow 
-fsanitize-trap=pointer-overflow -emit-llvm %s -o - -triple x86_64-linux-gnu | 
FileCheck %s -implicit-check-not="call void @__ubsan_handle_pointer_overflow" 
--check-prefixes=CHECK,CHECK-SANITIZE,CHECK-SANITIZE-TRAP,CHECK-SANITIZE-UNREACHABLE
 
-// RUN: %clang_cc1 -x c++ -emit-llvm %s -o - -triple x86_64-linux-gnu | 
FileCheck %s
+// RUN: %clang_cc1 -x c++ -emit-llvm %s -o - -triple x86_64-linux-gnu | 
FileCheck %s --check-prefixes=CHECK,CHECK-NOSANITIZE
 // RUN: %clang_cc1 -x c++ -fsanitize=pointer-overflow 
-fno-sanitize-recover=pointer-overflow -emit-llvm %s -o - -triple 
x86_64-linux-gnu | FileCheck %s -implicit-check-not="call void 
@__ubsan_handle_pointer_overflow" 
--check-prefixes=CHECK,CHECK-SANITIZE,CHECK-SANITIZE-ANYRECOVER,CHECK-SANITIZE-NORECOVER,CHECK-SANITIZE-UNREACHABLE
 // RUN: %clang_cc1 -x c++ -fsanitize=pointer-overflow 
-fsanitize-recover=pointer-overflow -emit-llvm %s -o - -triple x86_64-linux-gnu 
| FileCheck %s -implicit-check-not="call void @__ubsan_handle_pointer_overflow" 
--check-prefixes=CHECK,CHECK-SANITIZE,CHECK-SANITIZE-ANYRECOVER,CHECK-SANITIZE-RECOVER
 // RUN: %clang_cc1 -x c++ -fsanitize=pointer-overflow 
-fsanitize-trap=pointer-overflow -emit-llvm %s -o - -triple x86_64-linux-gnu | 
FileCheck %s -implicit-check-not="call void @__ubsan_handle_pointer_overflow" 
--check-prefixes=CHECK,CHECK-SANITIZE,CHECK-SANITIZE-TRAP,CHECK-SANITIZE-UNREACHABLE
@@ -32,6 +32,7 @@
 // CHECK-SANITIZE-ANYRECOVER-DAG: @[[LINE_1500:.*]] = {{.*}}, i32 1500, i32 15 
} }
 // CHECK-SANITIZE-ANYRECOVER-DAG: @[[LINE_1600:.*]] = {{.*}}, i32 1600, i32 15 
} }
 // CHECK-SANITIZE-ANYRECOVER-DAG: @[[LINE_1700:.*]] = {{.*}}, i32 1700, i32 15 
} }
+// CHECK-SANITIZE-ANYRECOVER-DAG: @[[LINE_1800:.*]] = {{.*}}, i32 1800, i32 20 
} }
 
 #ifdef __cplusplus
 extern "C" {
@@ -431,6 +432,37 @@ char *void_ptr(void *base, unsigned long offset) {
   return base + offset;
 }
 
+char *constant_null_add(unsigned long offset) {
+  // CHECK: define{{.*}} ptr @constant_null_add(i64 noundef %[[OFFSET:.*]])
+  // CHECK-NEXT:  [[ENTRY:.*]]:
+  // CHECK-NEXT:%[[OFFSET_ADDR:.*]] = alloca i64, 
align 8
+  // CHECK-NEXT:store i64 %[[OFFSET]], ptr 
%[[OFFSET_ADDR]], al

[clang] [Clang][CodeGen] Enable pointer overflow check for GCC workaround (PR #137849)

2025-05-06 Thread Yingwei Zheng via cfe-commits

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


[clang] [Clang][CodeGen] Enable pointer overflow check for GCC workaround (PR #137849)

2025-05-06 Thread Yingwei Zheng via cfe-commits

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


[clang-tools-extra] include-cleaner: Report function decls from __cleanup__ as used (PR #138669)

2025-05-06 Thread Daan De Meyer via cfe-commits

https://github.com/DaanDeMeyer created 
https://github.com/llvm/llvm-project/pull/138669

None



  



Rate limit · GitHub


  body {
background-color: #f6f8fa;
color: #24292e;
font-family: -apple-system,BlinkMacSystemFont,Segoe 
UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;
font-size: 14px;
line-height: 1.5;
margin: 0;
  }

  .container { margin: 50px auto; max-width: 600px; text-align: center; 
padding: 0 24px; }

  a { color: #0366d6; text-decoration: none; }
  a:hover { text-decoration: underline; }

  h1 { line-height: 60px; font-size: 48px; font-weight: 300; margin: 0px; 
text-shadow: 0 1px 0 #fff; }
  p { color: rgba(0, 0, 0, 0.5); margin: 20px 0 40px; }

  ul { list-style: none; margin: 25px 0; padding: 0; }
  li { display: table-cell; font-weight: bold; width: 1%; }

  .logo { display: inline-block; margin-top: 35px; }
  .logo-img-2x { display: none; }
  @media
  only screen and (-webkit-min-device-pixel-ratio: 2),
  only screen and (   min--moz-device-pixel-ratio: 2),
  only screen and ( -o-min-device-pixel-ratio: 2/1),
  only screen and (min-device-pixel-ratio: 2),
  only screen and (min-resolution: 192dpi),
  only screen and (min-resolution: 2dppx) {
.logo-img-1x { display: none; }
.logo-img-2x { display: inline-block; }
  }

  #suggestions {
margin-top: 35px;
color: #ccc;
  }
  #suggestions a {
color: #66;
font-weight: 200;
font-size: 14px;
margin: 0 10px;
  }


  
  



  Whoa there!
  You have exceeded a secondary rate limit.
Please wait a few minutes before you try again;
in some cases this may take up to an hour.
  
  
https://support.github.com/contact";>Contact Support —
https://githubstatus.com";>GitHub Status —
https://twitter.com/githubstatus";>@githubstatus
  

  

  

  

  

  


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


[clang-tools-extra] include-cleaner: Report function decls from __cleanup__ as used (PR #138669)

2025-05-06 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang-tools-extra

Author: Daan De Meyer (DaanDeMeyer)


Changes



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


2 Files Affected:

- (modified) clang-tools-extra/include-cleaner/lib/WalkAST.cpp (+5) 
- (modified) clang-tools-extra/include-cleaner/unittests/WalkASTTest.cpp (+6) 


``diff
diff --git a/clang-tools-extra/include-cleaner/lib/WalkAST.cpp 
b/clang-tools-extra/include-cleaner/lib/WalkAST.cpp
index dff0c711f04c5..ba6eff49e9c98 100644
--- a/clang-tools-extra/include-cleaner/lib/WalkAST.cpp
+++ b/clang-tools-extra/include-cleaner/lib/WalkAST.cpp
@@ -321,6 +321,11 @@ class ASTWalker : public RecursiveASTVisitor {
 return true;
   }
 
+  bool VisitCleanupAttr(CleanupAttr *attr) {
+report(attr->getLocation(), attr->getFunctionDecl());
+return true;
+  }
+
   // TypeLoc visitors.
   void reportType(SourceLocation RefLoc, NamedDecl *ND) {
 // Reporting explicit references to types nested inside classes can cause
diff --git a/clang-tools-extra/include-cleaner/unittests/WalkASTTest.cpp 
b/clang-tools-extra/include-cleaner/unittests/WalkASTTest.cpp
index e45ea36f7938e..19695a34bd63e 100644
--- a/clang-tools-extra/include-cleaner/unittests/WalkASTTest.cpp
+++ b/clang-tools-extra/include-cleaner/unittests/WalkASTTest.cpp
@@ -570,5 +570,11 @@ TEST(WalkAST, OperatorNewDelete) {
   testWalk("struct A { static void $ambiguous^operator delete(void*); };",
"void foo() { A a; ^delete &a; }");
 }
+
+TEST(WalkAST, CleanupAttr) {
+  testWalk("void* $explicit^freep(void *p);",
+   "void foo() { __attribute__((^__cleanup__(freep))) char* x = 0; }");
+}
+
 } // namespace
 } // namespace clang::include_cleaner

``




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


[clang] [llvm] [NFC] Replace more DenseMaps with SmallDenseMaps (PR #111836)

2025-05-06 Thread Jeremy Morse via cfe-commits

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


[clang] [llvm] [NFC] Replace more DenseMaps with SmallDenseMaps (PR #111836)

2025-05-06 Thread Jeremy Morse via cfe-commits

jmorse wrote:

/me squints -- this was a minor improvement and I've lost all the context 
behind it, abandoning as it's not worth revisiting IMO

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


[clang-tools-extra] [clang-tidy] Add check bugprone-misleading-setter-of-reference (PR #132242)

2025-05-06 Thread Balázs Kéri via cfe-commits

https://github.com/balazske updated 
https://github.com/llvm/llvm-project/pull/132242

From e3064b600ea726ab7b3dea054e9f11e1ce028297 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bal=C3=A1zs=20K=C3=A9ri?= 
Date: Wed, 19 Mar 2025 16:09:04 +0100
Subject: [PATCH 1/5] [clang-tidy] Add check
 bugprone-misleading-setter-of-reference

---
 .../bugprone/BugproneTidyModule.cpp   |  3 +
 .../clang-tidy/bugprone/CMakeLists.txt|  1 +
 .../MisleadingSetterOfReferenceCheck.cpp  | 58 +++
 .../MisleadingSetterOfReferenceCheck.h| 37 
 .../misleading-setter-of-reference.rst| 42 ++
 .../misleading-setter-of-reference.cpp| 50 
 6 files changed, 191 insertions(+)
 create mode 100644 
clang-tools-extra/clang-tidy/bugprone/MisleadingSetterOfReferenceCheck.cpp
 create mode 100644 
clang-tools-extra/clang-tidy/bugprone/MisleadingSetterOfReferenceCheck.h
 create mode 100644 
clang-tools-extra/docs/clang-tidy/checks/bugprone/misleading-setter-of-reference.rst
 create mode 100644 
clang-tools-extra/test/clang-tidy/checkers/bugprone/misleading-setter-of-reference.cpp

diff --git a/clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp 
b/clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp
index b780a85bdf3fe..64f4a524daf0d 100644
--- a/clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp
@@ -41,6 +41,7 @@
 #include "LambdaFunctionNameCheck.h"
 #include "MacroParenthesesCheck.h"
 #include "MacroRepeatedSideEffectsCheck.h"
+#include "MisleadingSetterOfReferenceCheck.h"
 #include "MisplacedOperatorInStrlenInAllocCheck.h"
 #include "MisplacedPointerArithmeticInAllocCheck.h"
 #include "MisplacedWideningCastCheck.h"
@@ -170,6 +171,8 @@ class BugproneModule : public ClangTidyModule {
 "bugprone-macro-parentheses");
 CheckFactories.registerCheck(
 "bugprone-macro-repeated-side-effects");
+CheckFactories.registerCheck(
+"bugprone-misleading-setter-of-reference");
 CheckFactories.registerCheck(
 "bugprone-misplaced-operator-in-strlen-in-alloc");
 CheckFactories.registerCheck(
diff --git a/clang-tools-extra/clang-tidy/bugprone/CMakeLists.txt 
b/clang-tools-extra/clang-tidy/bugprone/CMakeLists.txt
index e310ea9c94543..d862794cde323 100644
--- a/clang-tools-extra/clang-tidy/bugprone/CMakeLists.txt
+++ b/clang-tools-extra/clang-tidy/bugprone/CMakeLists.txt
@@ -42,6 +42,7 @@ add_clang_library(clangTidyBugproneModule STATIC
   LambdaFunctionNameCheck.cpp
   MacroParenthesesCheck.cpp
   MacroRepeatedSideEffectsCheck.cpp
+  MisleadingSetterOfReferenceCheck.cpp
   MisplacedOperatorInStrlenInAllocCheck.cpp
   MisplacedPointerArithmeticInAllocCheck.cpp
   MisplacedWideningCastCheck.cpp
diff --git 
a/clang-tools-extra/clang-tidy/bugprone/MisleadingSetterOfReferenceCheck.cpp 
b/clang-tools-extra/clang-tidy/bugprone/MisleadingSetterOfReferenceCheck.cpp
new file mode 100644
index 0..043d15e7fead2
--- /dev/null
+++ b/clang-tools-extra/clang-tidy/bugprone/MisleadingSetterOfReferenceCheck.cpp
@@ -0,0 +1,58 @@
+//===--- MisleadingSetterOfReferenceCheck.cpp - 
clang-tidy-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "MisleadingSetterOfReferenceCheck.h"
+#include "clang/AST/ASTContext.h"
+#include "clang/ASTMatchers/ASTMatchFinder.h"
+
+using namespace clang::ast_matchers;
+
+namespace clang::tidy::bugprone {
+
+void MisleadingSetterOfReferenceCheck::registerMatchers(MatchFinder *Finder) {
+  auto RefField =
+  fieldDecl(unless(isPublic()),
+hasType(referenceType(pointee(equalsBoundNode("type")
+  .bind("member");
+  auto AssignLHS =
+  memberExpr(hasObjectExpression(cxxThisExpr()), member(RefField));
+  auto DerefOperand = expr(ignoringParenImpCasts(
+  declRefExpr(to(parmVarDecl(equalsBoundNode("parm"));
+  auto AssignRHS = expr(ignoringParenImpCasts(
+  unaryOperator(hasOperatorName("*"), hasUnaryOperand(DerefOperand;
+
+  auto BinaryOpAssign = binaryOperator(hasOperatorName("="), hasLHS(AssignLHS),
+   hasRHS(AssignRHS));
+  auto CXXOperatorCallAssign = cxxOperatorCallExpr(
+  hasOverloadedOperatorName("="), hasLHS(AssignLHS), hasRHS(AssignRHS));
+
+  auto SetBody =
+  compoundStmt(statementCountIs(1),
+   anyOf(has(BinaryOpAssign), has(CXXOperatorCallAssign)));
+  auto BadSetFunction =
+  cxxMethodDecl(parameterCountIs(1), isPublic(),
+hasAnyParameter(parmVarDecl(hasType(pointerType(pointee(
+qualType().bind("type")
+

[clang-tools-extra] [clang-tidy] do not diagnose array types within implicit instantiations of a template (PR #132924)

2025-05-06 Thread St. Muench via cfe-commits


@@ -39,6 +39,29 @@ AST_MATCHER(clang::ParmVarDecl, isArgvOfMain) {
   return FD ? FD->isMain() : false;
 }
 
+AST_MATCHER(clang::TypeLoc, isInImplicitTemplateInstantiation) {
+  const auto IsImplicitTemplateInstantiation = [](const auto *Node) {
+return (Node != nullptr) &&
+   (Node->getTemplateSpecializationKind() == 
TSK_ImplicitInstantiation);
+  };
+
+  auto ParentNodes = Finder->getASTContext().getParents(Node);

stmuench wrote:

done

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


[clang-tools-extra] [clang-tidy] do not diagnose array types within implicit instantiations of a template (PR #132924)

2025-05-06 Thread St. Muench via cfe-commits


@@ -39,6 +39,29 @@ AST_MATCHER(clang::ParmVarDecl, isArgvOfMain) {
   return FD ? FD->isMain() : false;
 }
 
+AST_MATCHER(clang::TypeLoc, isInImplicitTemplateInstantiation) {
+  const auto IsImplicitTemplateInstantiation = [](const auto *Node) {
+return (Node != nullptr) &&
+   (Node->getTemplateSpecializationKind() == 
TSK_ImplicitInstantiation);
+  };
+
+  auto ParentNodes = Finder->getASTContext().getParents(Node);
+  while (!ParentNodes.empty()) {
+const auto &ParentNode = ParentNodes[0];

stmuench wrote:

done

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


[clang-tools-extra] [clang-tidy] do not diagnose array types within implicit instantiations of a template (PR #132924)

2025-05-06 Thread St. Muench via cfe-commits

https://github.com/stmuench updated 
https://github.com/llvm/llvm-project/pull/132924



  



Rate limit · GitHub


  body {
background-color: #f6f8fa;
color: #24292e;
font-family: -apple-system,BlinkMacSystemFont,Segoe 
UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;
font-size: 14px;
line-height: 1.5;
margin: 0;
  }

  .container { margin: 50px auto; max-width: 600px; text-align: center; 
padding: 0 24px; }

  a { color: #0366d6; text-decoration: none; }
  a:hover { text-decoration: underline; }

  h1 { line-height: 60px; font-size: 48px; font-weight: 300; margin: 0px; 
text-shadow: 0 1px 0 #fff; }
  p { color: rgba(0, 0, 0, 0.5); margin: 20px 0 40px; }

  ul { list-style: none; margin: 25px 0; padding: 0; }
  li { display: table-cell; font-weight: bold; width: 1%; }

  .logo { display: inline-block; margin-top: 35px; }
  .logo-img-2x { display: none; }
  @media
  only screen and (-webkit-min-device-pixel-ratio: 2),
  only screen and (   min--moz-device-pixel-ratio: 2),
  only screen and ( -o-min-device-pixel-ratio: 2/1),
  only screen and (min-device-pixel-ratio: 2),
  only screen and (min-resolution: 192dpi),
  only screen and (min-resolution: 2dppx) {
.logo-img-1x { display: none; }
.logo-img-2x { display: inline-block; }
  }

  #suggestions {
margin-top: 35px;
color: #ccc;
  }
  #suggestions a {
color: #66;
font-weight: 200;
font-size: 14px;
margin: 0 10px;
  }


  
  



  Whoa there!
  You have exceeded a secondary rate limit.
Please wait a few minutes before you try again;
in some cases this may take up to an hour.
  
  
https://support.github.com/contact";>Contact Support —
https://githubstatus.com";>GitHub Status —
https://twitter.com/githubstatus";>@githubstatus
  

  

  

  

  

  


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


[libcxx] [libunwind] [llvm] [libc++] Upgrade to GCC 15 (PR #138293)

2025-05-06 Thread Nikolas Klauser via cfe-commits

https://github.com/philnik777 updated 
https://github.com/llvm/llvm-project/pull/138293



  



Rate limit · GitHub


  body {
background-color: #f6f8fa;
color: #24292e;
font-family: -apple-system,BlinkMacSystemFont,Segoe 
UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;
font-size: 14px;
line-height: 1.5;
margin: 0;
  }

  .container { margin: 50px auto; max-width: 600px; text-align: center; 
padding: 0 24px; }

  a { color: #0366d6; text-decoration: none; }
  a:hover { text-decoration: underline; }

  h1 { line-height: 60px; font-size: 48px; font-weight: 300; margin: 0px; 
text-shadow: 0 1px 0 #fff; }
  p { color: rgba(0, 0, 0, 0.5); margin: 20px 0 40px; }

  ul { list-style: none; margin: 25px 0; padding: 0; }
  li { display: table-cell; font-weight: bold; width: 1%; }

  .logo { display: inline-block; margin-top: 35px; }
  .logo-img-2x { display: none; }
  @media
  only screen and (-webkit-min-device-pixel-ratio: 2),
  only screen and (   min--moz-device-pixel-ratio: 2),
  only screen and ( -o-min-device-pixel-ratio: 2/1),
  only screen and (min-device-pixel-ratio: 2),
  only screen and (min-resolution: 192dpi),
  only screen and (min-resolution: 2dppx) {
.logo-img-1x { display: none; }
.logo-img-2x { display: inline-block; }
  }

  #suggestions {
margin-top: 35px;
color: #ccc;
  }
  #suggestions a {
color: #66;
font-weight: 200;
font-size: 14px;
margin: 0 10px;
  }


  
  



  Whoa there!
  You have exceeded a secondary rate limit.
Please wait a few minutes before you try again;
in some cases this may take up to an hour.
  
  
https://support.github.com/contact";>Contact Support —
https://githubstatus.com";>GitHub Status —
https://twitter.com/githubstatus";>@githubstatus
  

  

  

  

  

  


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


[clang-tools-extra] [clang-tidy] do not diagnose array types within implicit instantiations of a template (PR #132924)

2025-05-06 Thread St. Muench via cfe-commits

stmuench wrote:

@PiotrZSL would have any further remarks for this PR?

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


[clang] [clang][ExprConst] Check for array size of initlists (PR #138673)

2025-05-06 Thread Timm Baeder via cfe-commits

tbaederr wrote:

That fixes compile-time computation, but this example still breaks in codegen:

```c++
#include 
using namespace std;
constexpr size_t kMemoryChunk = 1024 * 8;
constexpr size_t kNumberOfIterations = 200;
constexpr size_t kThreadsNumber = 2 * kMemoryChunk;
struct S {};

int main() {
array futures{};
}
```
here: 
https://github.com/llvm/llvm-project/blob/dad316275689c8ff9b3051c98a842d0bb1226368/clang/lib/CodeGen/CGExprConstant.cpp#L1408-L1412

because `NumElements` is `3276800`.


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


[clang-tools-extra] [clang-tidy] Add check bugprone-misleading-setter-of-reference (PR #132242)

2025-05-06 Thread Balázs Kéri via cfe-commits


@@ -0,0 +1,58 @@
+//===--- MisleadingSetterOfReferenceCheck.cpp - 
clang-tidy-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "MisleadingSetterOfReferenceCheck.h"
+#include "clang/AST/ASTContext.h"
+#include "clang/ASTMatchers/ASTMatchFinder.h"
+
+using namespace clang::ast_matchers;
+
+namespace clang::tidy::bugprone {
+
+void MisleadingSetterOfReferenceCheck::registerMatchers(MatchFinder *Finder) {
+  auto RefField =
+  fieldDecl(unless(isPublic()),

balazske wrote:

I have removed it now.

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


[clang] cb9683f - [Clang][Flang][Driver] Fix target parsing for -fveclib=libmvec option. (#138288)

2025-05-06 Thread via cfe-commits

Author: Paul Walker
Date: 2025-05-06T11:57:04+01:00
New Revision: cb9683fad12101417a46b35452cb23dfb7c6c367

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

LOG: [Clang][Flang][Driver] Fix target parsing for -fveclib=libmvec option. 
(#138288)

There are various places where the -fveclib option is parsed to
determine whether its value is correct for the target. Unfortunately
these places assume case-insensitivity and subsequently use "LIBMVEC"
where the driver mandates "libmvec", thus rendering the diagnosistic
useless.

This PR corrects the naming along with similar incorrect uses within the
test files.

Added: 


Modified: 
clang/lib/Driver/ToolChains/Clang.cpp
clang/lib/Driver/ToolChains/CommonArgs.cpp
clang/lib/Driver/ToolChains/Flang.cpp
clang/test/Driver/fveclib.c
flang/lib/Frontend/CompilerInvocation.cpp
flang/test/Driver/fveclib-codegen.f90
flang/test/Driver/fveclib.f90

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index b2e0e5c857228..f87549baff5e1 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -5843,7 +5843,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction 
&JA,
   Triple.getArch() != llvm::Triple::x86_64)
 D.Diag(diag::err_drv_unsupported_opt_for_target)
 << Name << Triple.getArchName();
-} else if (Name == "LIBMVEC-X86") {
+} else if (Name == "libmvec") {
   if (Triple.getArch() != llvm::Triple::x86 &&
   Triple.getArch() != llvm::Triple::x86_64)
 D.Diag(diag::err_drv_unsupported_opt_for_target)

diff  --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp 
b/clang/lib/Driver/ToolChains/CommonArgs.cpp
index 109316d0a27e7..e4bad39f8332a 100644
--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -934,7 +934,7 @@ void tools::addLTOOptions(const ToolChain &ToolChain, const 
ArgList &Args,
 std::optional OptVal =
 llvm::StringSwitch>(ArgVecLib->getValue())
 .Case("Accelerate", "Accelerate")
-.Case("LIBMVEC", "LIBMVEC-X86")
+.Case("libmvec", "LIBMVEC-X86")
 .Case("MASSV", "MASSV")
 .Case("SVML", "SVML")
 .Case("SLEEF", "sleefgnuabi")

diff  --git a/clang/lib/Driver/ToolChains/Flang.cpp 
b/clang/lib/Driver/ToolChains/Flang.cpp
index a407e295c09bd..b1ca747e68b89 100644
--- a/clang/lib/Driver/ToolChains/Flang.cpp
+++ b/clang/lib/Driver/ToolChains/Flang.cpp
@@ -484,7 +484,7 @@ void Flang::addTargetOptions(const ArgList &Args,
   Triple.getArch() != llvm::Triple::x86_64)
 D.Diag(diag::err_drv_unsupported_opt_for_target)
 << Name << Triple.getArchName();
-} else if (Name == "LIBMVEC-X86") {
+} else if (Name == "libmvec") {
   if (Triple.getArch() != llvm::Triple::x86 &&
   Triple.getArch() != llvm::Triple::x86_64)
 D.Diag(diag::err_drv_unsupported_opt_for_target)

diff  --git a/clang/test/Driver/fveclib.c b/clang/test/Driver/fveclib.c
index 78b5316b67e47..99baa46cb31c3 100644
--- a/clang/test/Driver/fveclib.c
+++ b/clang/test/Driver/fveclib.c
@@ -1,6 +1,6 @@
 // RUN: %clang -### -c -fveclib=none %s 2>&1 | FileCheck 
--check-prefix=CHECK-NOLIB %s
 // RUN: %clang -### -c -fveclib=Accelerate %s 2>&1 | FileCheck 
--check-prefix=CHECK-ACCELERATE %s
-// RUN: %clang -### -c -fveclib=libmvec %s 2>&1 | FileCheck 
--check-prefix=CHECK-libmvec %s
+// RUN: %clang -### -c --target=x86_64-unknown-linux-gnu -fveclib=libmvec %s 
2>&1 | FileCheck --check-prefix=CHECK-libmvec %s
 // RUN: %clang -### -c -fveclib=MASSV %s 2>&1 | FileCheck 
--check-prefix=CHECK-MASSV %s
 // RUN: %clang -### -c -fveclib=Darwin_libsystem_m %s 2>&1 | FileCheck 
--check-prefix=CHECK-DARWIN_LIBSYSTEM_M %s
 // RUN: %clang -### -c --target=aarch64 -fveclib=SLEEF %s 2>&1 | FileCheck 
--check-prefix=CHECK-SLEEF %s
@@ -21,7 +21,7 @@
 
 // RUN: not %clang --target=x86 -c -fveclib=SLEEF %s 2>&1 | FileCheck 
--check-prefix=CHECK-ERROR %s
 // RUN: not %clang --target=x86 -c -fveclib=ArmPL %s 2>&1 | FileCheck 
--check-prefix=CHECK-ERROR %s
-// RUN: not %clang --target=aarch64 -c -fveclib=LIBMVEC-X86 %s 2>&1 | 
FileCheck --check-prefix=CHECK-ERROR %s
+// RUN: not %clang --target=aarch64 -c -fveclib=libmvec %s 2>&1 | FileCheck 
--check-prefix=CHECK-ERROR %s
 // RUN: not %clang --target=aarch64 -c -fveclib=SVML %s 2>&1 | FileCheck 
--check-prefix=CHECK-ERROR %s
 // CHECK-ERROR: unsupported option {{.*}} for target
 
@@ -37,7 +37,7 @@
 
 /* Verify that the correct vector library is passed to LTO flags. */
 
-// RUN: %clang -### --target=x86_64-unknown-linux-gnu -fveclib=LIBMVEC -flto 
%s 2>&1 | FileCheck --check-prefix=CHECK-LTO-LIBMVEC %s
+// RUN: %c

[clang] [flang] [Clang][Flang][Driver] Fix target parsing for -fveclib=libmvec option. (PR #138288)

2025-05-06 Thread Paul Walker via cfe-commits

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


[clang] [Clang][analyzer] replace Stmt* with ConstCFGElement in SymbolConjured (reland) (PR #137355)

2025-05-06 Thread Fangyi Zhou via cfe-commits

fangyi-zhou wrote:

gentle ping

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


[clang] [analyzer] Workaround for slowdown spikes (unintended scope increase) (PR #136720)

2025-05-06 Thread Balázs Benics via cfe-commits

https://github.com/balazs-benics-sonarsource edited 
https://github.com/llvm/llvm-project/pull/136720
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [analyzer] Workaround for slowdown spikes (unintended scope increase) (PR #136720)

2025-05-06 Thread Balázs Benics via cfe-commits

https://github.com/balazs-benics-sonarsource commented:

Looks good. There were two points unaddressed:
 - Finding a name for the flag without the `legacy-` prefix
 - Find out if we can ever have multiple root nodes in an exploded graph. 

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


[clang] [analyzer] Workaround for slowdown spikes (unintended scope increase) (PR #136720)

2025-05-06 Thread Balázs Benics via cfe-commits


@@ -2523,6 +2523,20 @@ bool ExprEngine::replayWithoutInlining(ExplodedNode *N,
   return true;
 }
 
+/// Return the innermost location context which is inlined at `Node`, unless
+/// it's the top-level (entry point) location context.
+static const LocationContext *getInlinedLocationContext(ExplodedNode *Node,
+ExplodedGraph &G) {
+  const LocationContext *CalleeLC = Node->getLocation().getLocationContext();
+  const LocationContext *RootLC =

balazs-benics-sonarsource wrote:

This wasn't addressed.

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


[clang] [Clang] Implement the core language parts of P2786 - Trivial relocation (PR #127636)

2025-05-06 Thread via cfe-commits

https://github.com/cor3ntin updated 
https://github.com/llvm/llvm-project/pull/127636



  



Rate limit · GitHub


  body {
background-color: #f6f8fa;
color: #24292e;
font-family: -apple-system,BlinkMacSystemFont,Segoe 
UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;
font-size: 14px;
line-height: 1.5;
margin: 0;
  }

  .container { margin: 50px auto; max-width: 600px; text-align: center; 
padding: 0 24px; }

  a { color: #0366d6; text-decoration: none; }
  a:hover { text-decoration: underline; }

  h1 { line-height: 60px; font-size: 48px; font-weight: 300; margin: 0px; 
text-shadow: 0 1px 0 #fff; }
  p { color: rgba(0, 0, 0, 0.5); margin: 20px 0 40px; }

  ul { list-style: none; margin: 25px 0; padding: 0; }
  li { display: table-cell; font-weight: bold; width: 1%; }

  .logo { display: inline-block; margin-top: 35px; }
  .logo-img-2x { display: none; }
  @media
  only screen and (-webkit-min-device-pixel-ratio: 2),
  only screen and (   min--moz-device-pixel-ratio: 2),
  only screen and ( -o-min-device-pixel-ratio: 2/1),
  only screen and (min-device-pixel-ratio: 2),
  only screen and (min-resolution: 192dpi),
  only screen and (min-resolution: 2dppx) {
.logo-img-1x { display: none; }
.logo-img-2x { display: inline-block; }
  }

  #suggestions {
margin-top: 35px;
color: #ccc;
  }
  #suggestions a {
color: #66;
font-weight: 200;
font-size: 14px;
margin: 0 10px;
  }


  
  



  Whoa there!
  You have exceeded a secondary rate limit.
Please wait a few minutes before you try again;
in some cases this may take up to an hour.
  
  
https://support.github.com/contact";>Contact Support —
https://githubstatus.com";>GitHub Status —
https://twitter.com/githubstatus";>@githubstatus
  

  

  

  

  

  


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


[clang] [CLANG] Allow parsing arbitrary order of attributes for declarations (PR #133107)

2025-05-06 Thread via cfe-commits

https://github.com/DenisGZM updated 
https://github.com/llvm/llvm-project/pull/133107

>From c46eda67cd7434dcce5c1f29125a940dc4ff64ba Mon Sep 17 00:00:00 2001
From: Denis Gerasimov 
Date: Wed, 26 Mar 2025 18:29:38 +0300
Subject: [PATCH 1/8] [CLANG] Enable alignas after GNU attributes

---
 clang/lib/Parse/ParseStmt.cpp  |  5 +
 clang/test/SemaCUDA/cuda-attr-order.cu | 15 +++
 2 files changed, 20 insertions(+)
 create mode 100644 clang/test/SemaCUDA/cuda-attr-order.cu

diff --git a/clang/lib/Parse/ParseStmt.cpp b/clang/lib/Parse/ParseStmt.cpp
index 150b2879fc94f..33b9f63bcfa08 100644
--- a/clang/lib/Parse/ParseStmt.cpp
+++ b/clang/lib/Parse/ParseStmt.cpp
@@ -296,6 +296,11 @@ StmtResult 
Parser::ParseStatementOrDeclarationAfterAttributes(
 goto Retry;
   }
 
+  case tok::kw_alignas: {
+ParseAlignmentSpecifier(CXX11Attrs);
+goto Retry;
+  }
+
   case tok::kw_template: {
 SourceLocation DeclEnd;
 ParseTemplateDeclarationOrSpecialization(DeclaratorContext::Block, DeclEnd,
diff --git a/clang/test/SemaCUDA/cuda-attr-order.cu 
b/clang/test/SemaCUDA/cuda-attr-order.cu
new file mode 100644
index 0..d3bf5b014d1c6
--- /dev/null
+++ b/clang/test/SemaCUDA/cuda-attr-order.cu
@@ -0,0 +1,15 @@
+// Verify that we can parse a simple CUDA file with different attributes order.
+// RUN: %clang_cc1 "-triple" "nvptx-nvidia-cuda"  -fsyntax-only -verify %s
+// expected-no-diagnostics
+#include "Inputs/cuda.h"
+
+struct alignas(16) float4 {
+float x, y, z, w;
+};
+
+__attribute__((device)) float func() {
+__shared__ alignas(alignof(float4)) float As[4][4];  // Both combinations
+alignas(alignof(float4)) __shared__  float Bs[4][4]; // must be legal
+
+return As[0][0] + Bs[0][0];
+}

>From 517ba9e99f06c23ec675f5bf808b84273f5b409d Mon Sep 17 00:00:00 2001
From: Denis Gerasimov 
Date: Fri, 28 Mar 2025 18:27:49 +0300
Subject: [PATCH 2/8] [CLANG] Enable cxx11 attributes after gnu attributes in
 ParseCXXClassMemberDeclaration

---
 clang/lib/Parse/ParseDeclCXX.cpp   | 7 +--
 clang/test/AST/ast-dump-color.cpp  | 2 +-
 clang/test/Index/annotate-attribute.cpp| 2 +-
 clang/test/Parser/cxx0x-attributes.cpp | 6 ++
 clang/test/SemaCXX/warn-thread-safety-analysis.cpp | 8 
 5 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/clang/lib/Parse/ParseDeclCXX.cpp b/clang/lib/Parse/ParseDeclCXX.cpp
index 51fe0663a8d1a..42db9ceb89a2b 100644
--- a/clang/lib/Parse/ParseDeclCXX.cpp
+++ b/clang/lib/Parse/ParseDeclCXX.cpp
@@ -3035,10 +3035,13 @@ Parser::DeclGroupPtrTy 
Parser::ParseCXXClassMemberDeclaration(
   }
 
   ParsedAttributes DeclSpecAttrs(AttrFactory);
-  MaybeParseMicrosoftAttributes(DeclSpecAttrs);
-
   // Hold late-parsed attributes so we can attach a Decl to them later.
   LateParsedAttrList CommonLateParsedAttrs;
+  while (MaybeParseCXX11Attributes(DeclAttrs) ||
+ MaybeParseGNUAttributes(DeclSpecAttrs, &CommonLateParsedAttrs)) {
+  }
+
+  MaybeParseMicrosoftAttributes(DeclSpecAttrs);
 
   // decl-specifier-seq:
   // Parse the common declaration-specifiers piece.
diff --git a/clang/test/AST/ast-dump-color.cpp 
b/clang/test/AST/ast-dump-color.cpp
index 87797f6bffc5b..2bd9ab7c3c841 100644
--- a/clang/test/AST/ast-dump-color.cpp
+++ b/clang/test/AST/ast-dump-color.cpp
@@ -91,7 +91,7 @@ struct Invalid {
 //CHECK: {{^}}[[Blue]]|   `-[[RESET]][[MAGENTA]]DeclRefExpr[[RESET]][[Yellow]] 
0x{{[0-9a-fA-F]*}}[[RESET]] <[[Yellow]]col:40[[RESET]]> [[Green]]'class 
Mutex':'Mutex'[[RESET]][[Cyan]] lvalue[[RESET]][[Cyan]][[RESET]] 
[[GREEN]]Var[[RESET]][[Yellow]] 0x{{[0-9a-fA-F]*}}[[RESET]][[CYAN]] 
'mu1'[[RESET]] [[Green]]'class Mutex':'Mutex'[[RESET]] 
non_odr_use_unevaluated{{$}}
 //CHECK: {{^}}[[Blue]]|-[[RESET]][[GREEN]]CXXRecordDecl[[RESET]][[Yellow]] 
0x{{[0-9a-fA-F]*}}[[RESET]] <[[Yellow]]line:28:1[[RESET]], 
[[Yellow]]line:30:1[[RESET]]> [[Yellow]]line:28:8[[RESET]] struct[[CYAN]] 
Invalid[[RESET]] definition
 //CHECK: {{^}}[[Blue]]| |-[[RESET]][[GREEN]]CXXRecordDecl[[RESET]][[Yellow]] 
0x{{[0-9a-fA-F]*}}[[RESET]] <[[Yellow]]col:1[[RESET]], 
[[Yellow]]col:8[[RESET]]> [[Yellow]]col:8[[RESET]] implicit referenced 
struct[[CYAN]] Invalid[[RESET]]
-//CHECK: {{^}}[[Blue]]| 
|-[[RESET]][[GREEN]]CXXConstructorDecl[[RESET]][[Yellow]] 
0x{{[0-9a-fA-F]*}}[[RESET]] <[[Yellow]]line:29:3[[RESET]], 
[[Yellow]]col:42[[RESET]]> [[Yellow]]col:29[[RESET]] invalid[[CYAN]] 
Invalid[[RESET]] [[Green]]'void (int)'[[RESET]]
+//CHECK: {{^}}[[Blue]]| 
|-[[RESET]][[GREEN]]CXXConstructorDecl[[RESET]][[Yellow]] 
0x{{[0-9a-fA-F]*}}[[RESET]] <[[Yellow]]line:29:29[[RESET]], 
[[Yellow]]col:42[[RESET]]> [[Yellow]]col:29[[RESET]] invalid[[CYAN]] 
Invalid[[RESET]] [[Green]]'void (int)'[[RESET]]
 //CHECK: {{^}}[[Blue]]| | |-[[RESET]][[GREEN]]ParmVarDecl[[RESET]][[Yellow]] 
0x{{[0-9a-fA-F]*}}[[RESET]] <[[Yellow]]col:37[[RESET]], [[Yellow]][[RESET]]> [[Yellow]]col:42[[RESET]] invalid [[Green]]'int'[[RESET]]
 //CHECK: {{^}}[[Blue]

[clang] [Clang] Implement the core language parts of P2786 - Trivial relocation (PR #127636)

2025-05-06 Thread via cfe-commits

https://github.com/cor3ntin updated 
https://github.com/llvm/llvm-project/pull/127636



  



Rate limit · GitHub


  body {
background-color: #f6f8fa;
color: #24292e;
font-family: -apple-system,BlinkMacSystemFont,Segoe 
UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;
font-size: 14px;
line-height: 1.5;
margin: 0;
  }

  .container { margin: 50px auto; max-width: 600px; text-align: center; 
padding: 0 24px; }

  a { color: #0366d6; text-decoration: none; }
  a:hover { text-decoration: underline; }

  h1 { line-height: 60px; font-size: 48px; font-weight: 300; margin: 0px; 
text-shadow: 0 1px 0 #fff; }
  p { color: rgba(0, 0, 0, 0.5); margin: 20px 0 40px; }

  ul { list-style: none; margin: 25px 0; padding: 0; }
  li { display: table-cell; font-weight: bold; width: 1%; }

  .logo { display: inline-block; margin-top: 35px; }
  .logo-img-2x { display: none; }
  @media
  only screen and (-webkit-min-device-pixel-ratio: 2),
  only screen and (   min--moz-device-pixel-ratio: 2),
  only screen and ( -o-min-device-pixel-ratio: 2/1),
  only screen and (min-device-pixel-ratio: 2),
  only screen and (min-resolution: 192dpi),
  only screen and (min-resolution: 2dppx) {
.logo-img-1x { display: none; }
.logo-img-2x { display: inline-block; }
  }

  #suggestions {
margin-top: 35px;
color: #ccc;
  }
  #suggestions a {
color: #66;
font-weight: 200;
font-size: 14px;
margin: 0 10px;
  }


  
  



  Whoa there!
  You have exceeded a secondary rate limit.
Please wait a few minutes before you try again;
in some cases this may take up to an hour.
  
  
https://support.github.com/contact";>Contact Support —
https://githubstatus.com";>GitHub Status —
https://twitter.com/githubstatus";>@githubstatus
  

  

  

  

  

  


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


[clang] [flang] [Clang][Flang][Driver] Fix target parsing for -fveclib=libmvec option. (PR #138288)

2025-05-06 Thread LLVM Continuous Integration via cfe-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `lldb-arm-ubuntu` running 
on `linaro-lldb-arm-ubuntu` while building `clang,flang` at step 6 "test".

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


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

```
Step 6 (test) failure: build (failure)
...
PASS: lldb-api :: tools/lldb-dap/io/TestDAP_io.py (1181 of 3016)
UNSUPPORTED: lldb-api :: tools/lldb-dap/memory/TestDAP_memory.py (1182 of 3016)
PASS: lldb-api :: tools/lldb-dap/locations/TestDAP_locations.py (1183 of 3016)
PASS: lldb-api :: terminal/TestEditlineCompletions.py (1184 of 3016)
PASS: lldb-api :: tools/lldb-dap/optimized/TestDAP_optimized.py (1185 of 3016)
PASS: lldb-api :: tools/lldb-dap/output/TestDAP_output.py (1186 of 3016)
PASS: lldb-api :: tools/lldb-dap/repl-mode/TestDAP_repl_mode_detection.py (1187 
of 3016)
PASS: lldb-api :: tools/lldb-dap/launch/TestDAP_launch.py (1188 of 3016)
UNSUPPORTED: lldb-api :: 
tools/lldb-dap/restart/TestDAP_restart_runInTerminal.py (1189 of 3016)
UNRESOLVED: lldb-api :: tools/lldb-dap/restart/TestDAP_restart.py (1190 of 3016)
 TEST 'lldb-api :: 
tools/lldb-dap/restart/TestDAP_restart.py' FAILED 
Script:
--
/usr/bin/python3.10 
/home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/lldb/test/API/dotest.py 
-u CXXFLAGS -u CFLAGS --env 
LLVM_LIBS_DIR=/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./lib --env 
LLVM_INCLUDE_DIR=/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/include --env 
LLVM_TOOLS_DIR=/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./bin --arch 
armv8l --build-dir 
/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/lldb-test-build.noindex 
--lldb-module-cache-dir 
/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/lldb-test-build.noindex/module-cache-lldb/lldb-api
 --clang-module-cache-dir 
/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/lldb-test-build.noindex/module-cache-clang/lldb-api
 --executable /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./bin/lldb 
--compiler /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./bin/clang 
--dsymutil /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./bin/dsymutil 
--make /usr/bin/gmake --llvm-tools-dir 
/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./bin --lldb-obj-root 
/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/tools/lldb --lldb-libs-dir 
/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./lib 
/home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/lldb/test/API/tools/lldb-dap/restart
 -p TestDAP_restart.py
--
Exit Code: 1

Command Output (stdout):
--
lldb version 21.0.0git (https://github.com/llvm/llvm-project.git revision 
cb9683fad12101417a46b35452cb23dfb7c6c367)
  clang revision cb9683fad12101417a46b35452cb23dfb7c6c367
  llvm revision cb9683fad12101417a46b35452cb23dfb7c6c367
Skipping the following test categories: ['libc++', 'dsym', 'gmodules', 
'debugserver', 'objc']

--
Command Output (stderr):
--
FAIL: LLDB (/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/bin/clang-arm) :: 
test_arguments (TestDAP_restart.TestDAP_restart)
= DEBUG ADAPTER PROTOCOL LOGS =
1746531130.699173450 --> (stdin/stdout) 
{"command":"initialize","type":"request","arguments":{"adapterID":"lldb-native","clientID":"vscode","columnsStartAt1":true,"linesStartAt1":true,"locale":"en-us","pathFormat":"path","supportsRunInTerminalRequest":true,"supportsVariablePaging":true,"supportsVariableType":true,"supportsStartDebuggingRequest":true,"supportsProgressReporting":true,"$__lldb_sourceInitFile":false},"seq":1}
1746531130.703027487 <-- (stdin/stdout) {"body":{"$__lldb_version":"lldb 
version 21.0.0git (https://github.com/llvm/llvm-project.git revision 
cb9683fad12101417a46b35452cb23dfb7c6c367)\n  clang revision 
cb9683fad12101417a46b35452cb23dfb7c6c367\n  llvm revision 
cb9683fad12101417a46b35452cb23dfb7c6c367","completionTriggerCharacters":["."," 
","\t"],"exceptionBreakpointFilters":[{"default":false,"filter":"cpp_catch","label":"C++
 Catch"},{"default":false,"filter":"cpp_throw","label":"C++ 
Throw"},{"default":false,"filter":"objc_catch","label":"Objective-C 
Catch"},{"default":false,"filter":"objc_throw","label":"Objective-C 
Throw"}],"supportTerminateDebuggee":true,"supportsBreakpointLocationsRequest":true,"supportsCancelRequest":true,"supportsCompletionsRequest":true,"supportsConditionalBreakpoints":true,"supportsConfigurationDoneRequest":true,"supportsDataBreakpoints":true,"supportsDelayedStackTraceLoading":true,"supportsDisassembleRequest":true,"supportsEvaluateForHovers":true,"supportsExceptionInfoRequest":true,"supportsExceptionOptions":true,"supportsFunctionBreakpoints":true,"supportsHitConditionalBreakpoints":true,"supportsInstructionBreakpoints":true,"supportsLogPoints":true,"supportsModulesRequest":true,"supportsReadMemoryRequest":true,"supportsRestartRequest":true,"supportsSetVariable":true,"supportsStepInTargetsRequest":true,"supportsSteppingGranularity":true,"supportsValueFormat

[clang] [clang] Deflake the TimeProfile support tests (PR #138613)

2025-05-06 Thread Aaron Ballman via cfe-commits

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

LGTM!

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


[clang] [ObjC] Also enable ARC attachedcall operand bundle for arm64_32. (PR #138677)

2025-05-06 Thread Marina Taylor via cfe-commits

https://github.com/citymarina created 
https://github.com/llvm/llvm-project/pull/138677

It was enabled for "aarch64", which covers arm64e but not arm64_32.




  



Rate limit · GitHub


  body {
background-color: #f6f8fa;
color: #24292e;
font-family: -apple-system,BlinkMacSystemFont,Segoe 
UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;
font-size: 14px;
line-height: 1.5;
margin: 0;
  }

  .container { margin: 50px auto; max-width: 600px; text-align: center; 
padding: 0 24px; }

  a { color: #0366d6; text-decoration: none; }
  a:hover { text-decoration: underline; }

  h1 { line-height: 60px; font-size: 48px; font-weight: 300; margin: 0px; 
text-shadow: 0 1px 0 #fff; }
  p { color: rgba(0, 0, 0, 0.5); margin: 20px 0 40px; }

  ul { list-style: none; margin: 25px 0; padding: 0; }
  li { display: table-cell; font-weight: bold; width: 1%; }

  .logo { display: inline-block; margin-top: 35px; }
  .logo-img-2x { display: none; }
  @media
  only screen and (-webkit-min-device-pixel-ratio: 2),
  only screen and (   min--moz-device-pixel-ratio: 2),
  only screen and ( -o-min-device-pixel-ratio: 2/1),
  only screen and (min-device-pixel-ratio: 2),
  only screen and (min-resolution: 192dpi),
  only screen and (min-resolution: 2dppx) {
.logo-img-1x { display: none; }
.logo-img-2x { display: inline-block; }
  }

  #suggestions {
margin-top: 35px;
color: #ccc;
  }
  #suggestions a {
color: #66;
font-weight: 200;
font-size: 14px;
margin: 0 10px;
  }


  
  



  Whoa there!
  You have exceeded a secondary rate limit.
Please wait a few minutes before you try again;
in some cases this may take up to an hour.
  
  
https://support.github.com/contact";>Contact Support —
https://githubstatus.com";>GitHub Status —
https://twitter.com/githubstatus";>@githubstatus
  

  

  

  

  

  


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


[clang] [Clang][CodeGen] Enable pointer overflow check for GCC workaround (PR #137849)

2025-05-06 Thread Yingwei Zheng via cfe-commits


@@ -4169,11 +4169,16 @@ static Value *emitPointerArithmetic(CodeGenFunction 
&CGF,
   //   The index is not pointer-sized.
   //   The pointer type is not byte-sized.
   //
-  if (BinaryOperator::isNullPointerArithmeticExtension(CGF.getContext(),
-   op.Opcode,
-   expr->getLHS(),
-   expr->getRHS()))
-return CGF.Builder.CreateIntToPtr(index, pointer->getType());
+  // Note that we do not suppress the pointer overflow check in this case.
+  if (!CGF.SanOpts.has(SanitizerKind::PointerOverflow) &&
+  BinaryOperator::isNullPointerArithmeticExtension(
+  CGF.getContext(), op.Opcode, expr->getLHS(), expr->getRHS())) {
+// isUnderlyingBasePointerConstantNull returns true does not indicate that
+// the base pointer is null.

dtcxzyw wrote:

> We may not need `isUnderlyingBasePointerConstantNull`. We can just handle 
> `ConditionalOperator` in `Expr::isNullPointerConstant`.

It breaks `clang/test/Sema/conditional-expr.c`, so I decided to move the 
workaround into `isNullPointerArithmeticExtension`: 
https://github.com/llvm/llvm-project/pull/137851/commits/419863eb5169044d3c9f8350fdb3b172365f1b73

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


[clang] [analyzer] Workaround for slowdown spikes (unintended scope increase) (PR #136720)

2025-05-06 Thread Donát Nagy via cfe-commits


@@ -2523,6 +2523,20 @@ bool ExprEngine::replayWithoutInlining(ExplodedNode *N,
   return true;
 }
 
+/// Return the innermost location context which is inlined at `Node`, unless
+/// it's the top-level (entry point) location context.
+static const LocationContext *getInlinedLocationContext(ExplodedNode *Node,
+ExplodedGraph &G) {
+  const LocationContext *CalleeLC = Node->getLocation().getLocationContext();
+  const LocationContext *RootLC =

NagyDonat wrote:

I surveyed references to the root nodes of the graph and it seems that the 
analyzer doesn't create more than one root node within a single `ExplodedGraph` 
(it does create new root node in a new graph when it creates the trimmed graph 
for a bug report) and most locations that reference `roots_begin` work with the 
assumption that there is only a single root node.

To avoid this sort of confusion in the future, I think it would be useful to 
replace `std::vector Roots` with a single `ExplodedNode *Root` 
within a separate follow-up commit.

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


[clang] [StaticAnalyzer] Make it a noop when initializing a field of empty record (PR #138594)

2025-05-06 Thread Balazs Benics via cfe-commits


@@ -0,0 +1,45 @@
+// RUN: %clang_analyze_cc1 -analyzer-checker=cplusplus -verify %s
+// RUN: %clang_analyze_cc1 -analyzer-checker=cplusplus -verify %s -DEMPTY_CLASS
+
+// expected-no-diagnostics
+
+// This test reproduces the issue that previously the static analyzer
+// initialized an [[__no_unique_address__]] empty field to zero,
+// over-writing a non-empty field with the same offset.
+
+namespace std {
+#ifdef EMPTY_CLASS
+
+  template 
+  class default_delete {
+T dump();
+static T x;
+  };
+  template  >
+#else
+
+  struct default_delete {};
+  template 
+#endif
+  class unique_ptr {
+[[__no_unique_address__]]  _Tp * __ptr_;

steakhal wrote:

Now I 
[see](https://buildkite.com/llvm-project/github-pull-requests/builds/175624) 
what test didn't pass on Windows.

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


[clang] [clang-repl] Fix destructor for interpreter for the cuda negation case (PR #138091)

2025-05-06 Thread Anutosh Bhat via cfe-commits

anutosh491 wrote:

/cherry-pick 
https://github.com/llvm/llvm-project/commit/529b6fcb00aabbed17365e5fb3abbc2ae127c967


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


[clang] [clang-repl] Fix destructor for interpreter for the cuda negation case (PR #138091)

2025-05-06 Thread Anutosh Bhat via cfe-commits

anutosh491 wrote:

Deleting the branch and cherry picking seems problematic 
(https://github.com/llvm/llvm-project/pull/138460#issuecomment-2853718367) 
hence I've restored it and tried cherry picking again !

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


[clang] 300d402 - [Clang] Implement the core language parts of P2786 - Trivial relocation (#127636)

2025-05-06 Thread via cfe-commits

Author: cor3ntin
Date: 2025-05-06T14:13:32+02:00
New Revision: 300d4026f77683aae490361d250a51904dd19ed2

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

LOG: [Clang] Implement the core language parts of P2786 - Trivial relocation 
(#127636)

This adds

- The parsing of `trivially_relocatable_if_eligible`,
`replaceable_if_eligible` keywords
- `__builtin_trivially_relocate`, implemented in terms of memmove. In
the future this should
- Add the appropriate start/end lifetime markers that llvm does not have
(`start_lifetime_as`)
 - Add support for ptrauth when that's upstreamed

- the `__builtin_is_cpp_trivially_relocatable` and
`__builtin_is_replaceable` traits


Fixes #127609

Added: 
clang/test/CodeGenCXX/cxx2c-trivially-relocatable.cpp
clang/test/Parser/cxx2c-trivially-relocatable.cpp
clang/test/SemaCXX/cxx2c-trivially-relocatable.cpp

Modified: 
clang/docs/LanguageExtensions.rst
clang/docs/ReleaseNotes.rst
clang/include/clang/AST/ASTContext.h
clang/include/clang/AST/DeclCXX.h
clang/include/clang/AST/Type.h
clang/include/clang/Basic/Attr.td
clang/include/clang/Basic/Builtins.td
clang/include/clang/Basic/DiagnosticParseKinds.td
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/include/clang/Basic/TokenKinds.def
clang/include/clang/Parse/Parser.h
clang/include/clang/Sema/Sema.h
clang/lib/AST/ASTContext.cpp
clang/lib/AST/Decl.cpp
clang/lib/AST/DeclCXX.cpp
clang/lib/AST/Type.cpp
clang/lib/CodeGen/CGBuiltin.cpp
clang/lib/Frontend/InitPreprocessor.cpp
clang/lib/Parse/ParseDeclCXX.cpp
clang/lib/Parse/Parser.cpp
clang/lib/Sema/SemaChecking.cpp
clang/lib/Sema/SemaDecl.cpp
clang/lib/Sema/SemaDeclCXX.cpp
clang/lib/Sema/SemaExprCXX.cpp
clang/test/SemaCXX/attr-trivial-abi.cpp
clang/test/SemaCXX/ptrauth-triviality.cpp
clang/www/cxx_status.html

Removed: 




diff  --git a/clang/docs/LanguageExtensions.rst 
b/clang/docs/LanguageExtensions.rst
index 7835eceadf660..ebcad44197ce4 100644
--- a/clang/docs/LanguageExtensions.rst
+++ b/clang/docs/LanguageExtensions.rst
@@ -1680,6 +1680,7 @@ Static assert with user-generated message 
__cpp_static_assert >= 202306L   C
 Pack Indexing __cpp_pack_indexing  
C++26 C++03
 ``= delete ("should have a reason");``__cpp_deleted_function   
C++26 C++03
 Variadic Friends  __cpp_variadic_friend
C++26 C++03
+Trivial Relocatability__cpp_trivial_relocatability 
C++26 C++03
 -  
- -
 Designated initializers (N494) 
C99   C89
 Array & element qualification (N2607)  
C23   C89
@@ -1861,8 +1862,15 @@ The following type trait primitives are supported by 
Clang. Those traits marked
 * ``__is_trivially_relocatable`` (Clang): Returns true if moving an object
   of the given type, and then destroying the source object, is known to be
   functionally equivalent to copying the underlying bytes and then dropping the
-  source object on the floor. This is true of trivial types and types which
+  source object on the floor. This is true of trivial types,
+  C++26 relocatable types, and types which
   were made trivially relocatable via the ``clang::trivial_abi`` attribute.
+* ``__builtin_is_cpp_trivially_relocatable`` (C++): Returns true if an object
+  is trivially relocatable, as defined by the C++26 standard [meta.unary.prop].
+  Note that when relocating the caller code should ensure that if the object 
is polymorphic,
+  the dynamic type is of the most derived type. Padding bytes should not be 
copied.
+* ``__builtin_is_replaceable`` (C++): Returns true if an object
+  is replaceable, as defined by the C++26 standard [meta.unary.prop].
 * ``__is_trivially_equality_comparable`` (Clang): Returns true if comparing two
   objects of the provided type is known to be equivalent to comparing their
   object representations. Note that types containing padding bytes are never
@@ -3722,6 +3730,21 @@ Query for this feature with 
``__has_builtin(__builtin_operator_new)`` or
 replaceable global (de)allocation functions, but do support calling at 
least
 ``::operator new(size_t)`` and ``::operator delete(void*)``.
 
+
+``__builtin_trivially_relocate``
+---
+
+**Syntax**:
+
+.. code-block:: c
+
+  T* __builtin_trivially_relocate(T* dest, T* src, size_t count)
+
+Trivially relocates ``count`` objects of relocatable, complete type ``T``
+from ``src`` to ``dest`` and return

[clang] [Clang] Implement the core language parts of P2786 - Trivial relocation (PR #127636)

2025-05-06 Thread via cfe-commits

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


[clang] [clang] Add support for Debian 14 Forky and Debian 15 Duke (PR #138460)

2025-05-06 Thread Raul Tambre via cfe-commits

tambry wrote:

@anutosh491 Yep, precisely. That's what I did here.

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


[clang] Suppress errors from well-formed-testing type traits in SFINAE contexts (PR #135390)

2025-05-06 Thread Aaron Puchert via cfe-commits


@@ -12240,16 +12240,16 @@ class Sema final : public SemaBase {
 bool PrevLastDiagnosticIgnored;
 
   public:
-explicit SFINAETrap(Sema &SemaRef, bool AccessCheckingSFINAE = false)
+explicit SFINAETrap(Sema &SemaRef, bool TestWellformedSFINAE = false)

aaronpuchert wrote:

Although later it does say "only the validity of the immediate context is 
considered." So I guess it's fine.

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


[clang] [clang] Add support for Debian 14 Forky and Debian 15 Duke (PR #138460)

2025-05-06 Thread Anutosh Bhat via cfe-commits

anutosh491 wrote:

I did the same and worked pretty smoothly. Thank you :)

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


[clang] [clang] rename FPOptions.def's macro to FP_OPTION (PR #138374)

2025-05-06 Thread Zahira Ammarguellat via cfe-commits

zahiraam wrote:

May be an [NFC] in the title of the PR?

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


[clang] [clang] Add support for Debian 14 Forky and Debian 15 Duke (PR #138460)

2025-05-06 Thread Raul Tambre via cfe-commits

tambry wrote:

Someone probably ought to open an issue for that issue.

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


[clang] [clang] Add support for Debian 14 Forky and Debian 15 Duke (PR #138460)

2025-05-06 Thread Anutosh Bhat via cfe-commits

anutosh491 wrote:

> Someone probably ought to open an issue for this caveat.

I don't know who would be responsible for looking into this just yet :|

Can we raise something and tag someone responsible for this ?

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


[clang] [clang] rename FPOptions.def's macro to FP_OPTION (PR #138374)

2025-05-06 Thread Zahira Ammarguellat via cfe-commits

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

Looks good. Thanks.

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


[clang] Suppress errors from well-formed-testing type traits in SFINAE contexts (PR #135390)

2025-05-06 Thread Aaron Puchert via cfe-commits


@@ -12240,16 +12240,16 @@ class Sema final : public SemaBase {
 bool PrevLastDiagnosticIgnored;
 
   public:
-explicit SFINAETrap(Sema &SemaRef, bool AccessCheckingSFINAE = false)
+explicit SFINAETrap(Sema &SemaRef, bool TestWellformedSFINAE = false)

aaronpuchert wrote:

Adding a comment makes sense to me. I'm open to a different name, but I started 
with "well-formed" because that's how the standard calls it. "Valid" sounds 
fine, but it doesn't seem to be what the standard calls it.

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


[clang] [llvm] [clang][OpenMP] New OpenMP 6.0 threadset clause (PR #135807)

2025-05-06 Thread Alexey Bataev via cfe-commits


@@ -101,9 +103,11 @@ T tmain(T argc, T *argv) {
   a = 2;
 #pragma omp task default(none), private(argc, b) firstprivate(argv) shared(d) 
if (argc > 0) final(S::TS > 0) priority(argc) affinity(argc, argv[b:argc], 
arr[:], ([argc][sizeof(T)])argv)
   foo();
+#ifndef OMP60

alexey-bataev wrote:

Please, modify the test instead by replacing the reduction operaton

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


[clang] [mlir] [OpenACC] Implement tile/collapse lowering (PR #138576)

2025-05-06 Thread Erich Keane via cfe-commits

https://github.com/erichkeane updated 
https://github.com/llvm/llvm-project/pull/138576



  



Rate limit · GitHub


  body {
background-color: #f6f8fa;
color: #24292e;
font-family: -apple-system,BlinkMacSystemFont,Segoe 
UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;
font-size: 14px;
line-height: 1.5;
margin: 0;
  }

  .container { margin: 50px auto; max-width: 600px; text-align: center; 
padding: 0 24px; }

  a { color: #0366d6; text-decoration: none; }
  a:hover { text-decoration: underline; }

  h1 { line-height: 60px; font-size: 48px; font-weight: 300; margin: 0px; 
text-shadow: 0 1px 0 #fff; }
  p { color: rgba(0, 0, 0, 0.5); margin: 20px 0 40px; }

  ul { list-style: none; margin: 25px 0; padding: 0; }
  li { display: table-cell; font-weight: bold; width: 1%; }

  .logo { display: inline-block; margin-top: 35px; }
  .logo-img-2x { display: none; }
  @media
  only screen and (-webkit-min-device-pixel-ratio: 2),
  only screen and (   min--moz-device-pixel-ratio: 2),
  only screen and ( -o-min-device-pixel-ratio: 2/1),
  only screen and (min-device-pixel-ratio: 2),
  only screen and (min-resolution: 192dpi),
  only screen and (min-resolution: 2dppx) {
.logo-img-1x { display: none; }
.logo-img-2x { display: inline-block; }
  }

  #suggestions {
margin-top: 35px;
color: #ccc;
  }
  #suggestions a {
color: #66;
font-weight: 200;
font-size: 14px;
margin: 0 10px;
  }


  
  



  Whoa there!
  You have exceeded a secondary rate limit.
Please wait a few minutes before you try again;
in some cases this may take up to an hour.
  
  
https://support.github.com/contact";>Contact Support —
https://githubstatus.com";>GitHub Status —
https://twitter.com/githubstatus";>@githubstatus
  

  

  

  

  

  


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


[clang] [CLANG] Allow parsing arbitrary order of attributes for declarations (PR #133107)

2025-05-06 Thread Erich Keane via cfe-commits

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

What do we think @AaronBallman ?  I think the diagnostic column is as best 
effort as we are going to get, so I'm OK with this as-is.  WE could perhaps 
improve that, but I don't think doing that here is worth the effort.

I'll approve, but I want to make sure Aaron has a chance to say otherwise 
before merging.

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


[clang] [Clang][AArch64] Add fp8 variants for untyped NEON intrinsics (PR #128019)

2025-05-06 Thread via cfe-commits


@@ -2056,9 +2056,21 @@ void NeonEmitter::createIntrinsic(const Record *R,
   auto &Entry = IntrinsicMap[Name];
 
   for (auto &I : NewTypeSpecs) {
+
+// MFloat8 type is only available on AArch64. If encountered set ArchGuard
+// correctly.
+std::string savedArchGuard = ArchGuard;
+if (Type(I.first, ".").isMFloat8()) {
+  if (ArchGuard.empty()) {
+ArchGuard = "defined(__aarch64__)";
+  } else if (ArchGuard.find("defined(__aarch64__)") == std::string::npos) {
+ArchGuard = "defined(__aarch64__) && (" + savedArchGuard + ")";
+  }
+}
 Entry.emplace_back(R, Name, Proto, I.first, I.second, CK, Body, *this,
ArchGuard, TargetGuard, IsUnavailable, BigEndianSafe);
 Out.push_back(&Entry.back());
+ArchGuard = savedArchGuard;

Lukacma wrote:

Sorry ! Fixed now

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


[clang] [Clang][AArch64] Add fp8 variants for untyped NEON intrinsics (PR #128019)

2025-05-06 Thread via cfe-commits


@@ -5464,6 +5464,15 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo 
&CallInfo,
   Builder.CreateStore(errorValue, swiftErrorTemp);
 }
 
+// Mfloat8 type is loaded as scalar type, but is treated as single
+// vector type for other operations. We need to bitcast it to the 
vector
+// type here.
+if (auto *EltTy =

Lukacma wrote:

Done

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


[clang-tools-extra] [clang-tidy] Add check bugprone-misleading-setter-of-reference (PR #132242)

2025-05-06 Thread Donát Nagy via cfe-commits

NagyDonat wrote:

The commit looks promising, my only remaining remarks are about phrasing in the 
documentation and comments.

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


[clang] FEAT: one byte for "true" & "false" (PR #138649)

2025-05-06 Thread SAKSHAM JOSHI via cfe-commits

https://github.com/saksham-joshi updated 
https://github.com/llvm/llvm-project/pull/138649

>From 8bba07d817d4dd583122d7ed831de276da8801e0 Mon Sep 17 00:00:00 2001
From: SAKSHAM JOSHI 
Date: Tue, 6 May 2025 12:43:34 +0530
Subject: [PATCH 1/2] FEAT: one byte for "true" & "false"

In C programming language,

The size of "true" and "false" macros is 4 byte and size of "_Bool" datatype is 
1 byte.

By this simple change, we can set the size of "true" and "false" to 1 byte.
---
 clang/lib/Headers/stdbool.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/clang/lib/Headers/stdbool.h b/clang/lib/Headers/stdbool.h
index dfaad2b65a9b5..e9142327f0ffd 100644
--- a/clang/lib/Headers/stdbool.h
+++ b/clang/lib/Headers/stdbool.h
@@ -22,8 +22,8 @@
  */
 #elif !defined(__cplusplus)
 #define bool _Bool
-#define true 1
-#define false 0
+#define true (bool)1
+#define false (bool)0
 #elif defined(__GNUC__) && !defined(__STRICT_ANSI__)
 /* Define _Bool as a GNU extension. */
 #define _Bool bool

>From 890f5b7cb698fe6ae167247ff6453940b8f71af9 Mon Sep 17 00:00:00 2001
From: SAKSHAM JOSHI 
Date: Tue, 6 May 2025 21:24:03 +0530
Subject: [PATCH 2/2] Update stdbool.h

---
 clang/lib/Headers/stdbool.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/clang/lib/Headers/stdbool.h b/clang/lib/Headers/stdbool.h
index e9142327f0ffd..4b81e4ba820d1 100644
--- a/clang/lib/Headers/stdbool.h
+++ b/clang/lib/Headers/stdbool.h
@@ -22,8 +22,8 @@
  */
 #elif !defined(__cplusplus)
 #define bool _Bool
-#define true (bool)1
-#define false (bool)0
+#define true ((bool)1)
+#define false ((bool)0)
 #elif defined(__GNUC__) && !defined(__STRICT_ANSI__)
 /* Define _Bool as a GNU extension. */
 #define _Bool bool

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


[clang] [llvm] [LLVM][VecLib] Refactor LIBMVEC integration to be target neutral. (PR #138262)

2025-05-06 Thread Paul Walker via cfe-commits

https://github.com/paulwalker-arm updated 
https://github.com/llvm/llvm-project/pull/138262

>From 5da6f3e5ff07977294d82721c4bd37984daace47 Mon Sep 17 00:00:00 2001
From: Paul Walker 
Date: Fri, 2 May 2025 12:41:06 +0100
Subject: [PATCH 1/2] Add test showing x86 functions when targeting AArch64.

---
 llvm/test/Transforms/Util/add-TLI-mappings.ll | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/llvm/test/Transforms/Util/add-TLI-mappings.ll 
b/llvm/test/Transforms/Util/add-TLI-mappings.ll
index b7eef89304c0d..99098f94d37bc 100644
--- a/llvm/test/Transforms/Util/add-TLI-mappings.ll
+++ b/llvm/test/Transforms/Util/add-TLI-mappings.ll
@@ -1,6 +1,7 @@
 ; RUN: opt -mtriple=x86_64-unknown-linux-gnu -vector-library=SVML 
-passes=inject-tli-mappings -S < %s | FileCheck %s  --check-prefixes=COMMON,SVML
 ; RUN: opt -mtriple=x86_64-unknown-linux-gnu -vector-library=AMDLIBM 
-passes=inject-tli-mappings -S < %s | FileCheck %s  
--check-prefixes=COMMON,AMDLIBM
 ; RUN: opt -mtriple=powerpc64-unknown-linux-gnu -vector-library=MASSV 
-passes=inject-tli-mappings -S < %s | FileCheck %s  
--check-prefixes=COMMON,MASSV
+; RUN: opt -mtriple=aarch64-unknown-linux-gnu -vector-library=LIBMVEC-X86 
-passes=inject-tli-mappings -S < %s | FileCheck %s  
--check-prefixes=COMMON,LIBMVEC-AARCH64
 ; RUN: opt -mtriple=x86_64-unknown-linux-gnu -vector-library=LIBMVEC-X86 
-passes=inject-tli-mappings -S < %s | FileCheck %s  
--check-prefixes=COMMON,LIBMVEC-X86
 ; RUN: opt -mtriple=x86_64-unknown-linux-gnu -vector-library=Accelerate 
-passes=inject-tli-mappings -S < %s | FileCheck %s  
--check-prefixes=COMMON,ACCELERATE
 ; RUN: opt -mtriple=aarch64-unknown-linux-gnu -vector-library=sleefgnuabi 
-passes=inject-tli-mappings -S < %s | FileCheck %s  
--check-prefixes=COMMON,SLEEFGNUABI
@@ -32,6 +33,9 @@
 ; MASSV-SAME: ptr @__log10f4
 ; ACCELERATE-SAME:  [1 x ptr] [
 ; ACCELERATE-SAME:ptr @vlog10f
+; LIBMVEC-AARCH64-SAME: [2 x ptr] [
+; LIBMVEC-AARCH64-SAME:   ptr @_ZGVbN2v_sin,
+; LIBMVEC-AARCH64-SAME:   ptr @_ZGVdN4v_sin
 ; LIBMVEC-X86-SAME: [2 x ptr] [
 ; LIBMVEC-X86-SAME:   ptr @_ZGVbN2v_sin,
 ; LIBMVEC-X86-SAME:   ptr @_ZGVdN4v_sin
@@ -193,6 +197,9 @@ declare float @llvm.log10.f32(float) #0
 ; MASSV: declare <2 x double> @__sind2(<2 x double>)
 ; MASSV: declare <4 x float> @__log10f4(<4 x float>)
 
+; LIBMVEC-AARCH64: declare <2 x double> @_ZGVbN2v_sin(<2 x double>)
+; LIBMVEC-AARCH64: declare <4 x double> @_ZGVdN4v_sin(<4 x double>)
+
 ; LIBMVEC-X86: declare <2 x double> @_ZGVbN2v_sin(<2 x double>)
 ; LIBMVEC-X86: declare <4 x double> @_ZGVdN4v_sin(<4 x double>)
 

>From c1e632b21562626f45c4b259355c4732356fbb77 Mon Sep 17 00:00:00 2001
From: Paul Walker 
Date: Fri, 2 May 2025 12:36:26 +0100
Subject: [PATCH 2/2] [LLVM][VecLib] Refactor LIBMVEC integration to be target
 neutral.

Renames LIBMVEC-X86 to LIBMVEC and updates TLI to only add the
existing x86 specific mapping when targeting x86.
---
 clang/lib/Driver/ToolChains/CommonArgs.cpp  |  2 +-
 clang/test/Driver/fveclib.c |  2 +-
 llvm/include/llvm/Analysis/TargetLibraryInfo.h  |  2 +-
 llvm/lib/Analysis/TargetLibraryInfo.cpp | 13 ++---
 llvm/lib/Frontend/Driver/CodeGenOptions.cpp |  2 +-
 .../Generic/replace-intrinsics-with-veclib.ll   |  2 +-
 .../LoopVectorize/X86/libm-vector-calls-VF2-VF8.ll  |  2 +-
 .../LoopVectorize/X86/libm-vector-calls-finite.ll   |  2 +-
 .../LoopVectorize/X86/libm-vector-calls.ll  |  2 +-
 llvm/test/Transforms/Util/add-TLI-mappings.ll   | 13 ++---
 10 files changed, 24 insertions(+), 18 deletions(-)

diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp 
b/clang/lib/Driver/ToolChains/CommonArgs.cpp
index e4bad39f8332a..8fbffa071634c 100644
--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -934,7 +934,7 @@ void tools::addLTOOptions(const ToolChain &ToolChain, const 
ArgList &Args,
 std::optional OptVal =
 llvm::StringSwitch>(ArgVecLib->getValue())
 .Case("Accelerate", "Accelerate")
-.Case("libmvec", "LIBMVEC-X86")
+.Case("libmvec", "LIBMVEC")
 .Case("MASSV", "MASSV")
 .Case("SVML", "SVML")
 .Case("SLEEF", "sleefgnuabi")
diff --git a/clang/test/Driver/fveclib.c b/clang/test/Driver/fveclib.c
index 99baa46cb31c3..1235d08a3e139 100644
--- a/clang/test/Driver/fveclib.c
+++ b/clang/test/Driver/fveclib.c
@@ -38,7 +38,7 @@
 /* Verify that the correct vector library is passed to LTO flags. */
 
 // RUN: %clang -### --target=x86_64-unknown-linux-gnu -fveclib=libmvec -flto 
%s 2>&1 | FileCheck --check-prefix=CHECK-LTO-LIBMVEC %s
-// CHECK-LTO-LIBMVEC: "-plugin-opt=-vector-library=LIBMVEC-X86"
+// CHECK-LTO-LIBMVEC: "-plugin-opt=-vector-library=LIBMVEC"
 
 // RUN: %clang -### --target=powerpc64-unknown-linux-gnu -fveclib=MASSV -flto 
%s 2>&1 | FileCheck --check-prefix=CHECK-LTO-MASSV %s
 // CHECK-LTO-MASSV: "-plugin-opt=-vector-libra

[clang] [llvm] [LLVM][VecLib] Refactor LIBMVEC integration to be target neutral. (PR #138262)

2025-05-06 Thread Paul Walker via cfe-commits

paulwalker-arm wrote:

Re-review request after rebasing to pull in driver fix.

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


[clang] [llvm] [LLVM][VecLib] Refactor LIBMVEC integration to be target neutral. (PR #138262)

2025-05-06 Thread Paul Walker via cfe-commits


@@ -29,7 +29,7 @@ static cl::opt 
ClVectorLibrary(
   "Accelerate framework"),
clEnumValN(TargetLibraryInfoImpl::DarwinLibSystemM,
   "Darwin_libsystem_m", "Darwin libsystem_m"),
-   clEnumValN(TargetLibraryInfoImpl::LIBMVEC_X86, "LIBMVEC-X86",
+   clEnumValN(TargetLibraryInfoImpl::LIBMVEC, "LIBMVEC",

paulwalker-arm wrote:

Done.

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


[clang] FEAT: one byte for "true" & "false" (PR #138649)

2025-05-06 Thread SAKSHAM JOSHI via cfe-commits

https://github.com/saksham-joshi updated 
https://github.com/llvm/llvm-project/pull/138649



  



Rate limit · GitHub


  body {
background-color: #f6f8fa;
color: #24292e;
font-family: -apple-system,BlinkMacSystemFont,Segoe 
UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;
font-size: 14px;
line-height: 1.5;
margin: 0;
  }

  .container { margin: 50px auto; max-width: 600px; text-align: center; 
padding: 0 24px; }

  a { color: #0366d6; text-decoration: none; }
  a:hover { text-decoration: underline; }

  h1 { line-height: 60px; font-size: 48px; font-weight: 300; margin: 0px; 
text-shadow: 0 1px 0 #fff; }
  p { color: rgba(0, 0, 0, 0.5); margin: 20px 0 40px; }

  ul { list-style: none; margin: 25px 0; padding: 0; }
  li { display: table-cell; font-weight: bold; width: 1%; }

  .logo { display: inline-block; margin-top: 35px; }
  .logo-img-2x { display: none; }
  @media
  only screen and (-webkit-min-device-pixel-ratio: 2),
  only screen and (   min--moz-device-pixel-ratio: 2),
  only screen and ( -o-min-device-pixel-ratio: 2/1),
  only screen and (min-device-pixel-ratio: 2),
  only screen and (min-resolution: 192dpi),
  only screen and (min-resolution: 2dppx) {
.logo-img-1x { display: none; }
.logo-img-2x { display: inline-block; }
  }

  #suggestions {
margin-top: 35px;
color: #ccc;
  }
  #suggestions a {
color: #66;
font-weight: 200;
font-size: 14px;
margin: 0 10px;
  }


  
  



  Whoa there!
  You have exceeded a secondary rate limit.
Please wait a few minutes before you try again;
in some cases this may take up to an hour.
  
  
https://support.github.com/contact";>Contact Support —
https://githubstatus.com";>GitHub Status —
https://twitter.com/githubstatus";>@githubstatus
  

  

  

  

  

  


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


[clang] [OpenMP 6.0 ]Codegen for Reduction over private variables with reduction clause (PR #134709)

2025-05-06 Thread Alexey Bataev via cfe-commits

https://github.com/alexey-bataev commented:

Need to update OpenMPSupport.rst and release notes

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


[clang] [OpenMP 6.0 ]Codegen for Reduction over private variables with reduction clause (PR #134709)

2025-05-06 Thread Alexey Bataev via cfe-commits


@@ -4899,6 +4899,238 @@ void 
CGOpenMPRuntime::emitSingleReductionCombiner(CodeGenFunction &CGF,
   }
 }
 
+void CGOpenMPRuntime::emitPrivateReduction(

alexey-bataev wrote:

1. Add the comments, describing the logic of the function.
2. How does it differ from the regular reductions codegen? Can you try to unify 
the logic to reduce the maintenance cost?

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


[clang] [OpenMP 6.0 ]Codegen for Reduction over private variables with reduction clause (PR #134709)

2025-05-06 Thread Alexey Bataev via cfe-commits

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


[clang] FEAT: 1 byte for "true" & "false" (PR #138713)

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


[clang] FEAT: 1 byte for "true" & "false" (PR #138713)

2025-05-06 Thread SAKSHAM JOSHI via cfe-commits

https://github.com/saksham-joshi created 
https://github.com/llvm/llvm-project/pull/138713

# In C language,

- the size of "true" and "false" macro is 4 bytes (for x64 arch)

- but the size of "bool" (typedef _Bool) is 1 byte.

- In order to decrease the memory usage, we can set the size of "true" and 
"false" macros to 1 byte using explicit typecasting in macro definition.

>From db8d4b5b102c9e1cf8d43d108858ede66baea82f Mon Sep 17 00:00:00 2001
From: SAKSHAM JOSHI 
Date: Tue, 6 May 2025 21:37:08 +0530
Subject: [PATCH] FEAT: 1 byte for "true" & "false"

- In C language,

- the size of "true" and "false" macro is 4 bytes (for x64 arch)

- but the size of "bool" (typedef _Bool) is 1 byte.

- In order to decrease the memory usage, we can set the size of "true" and 
"false" macros to 1 byte using explicit typecasting in macro definition.
---
 clang/lib/Headers/stdbool.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/clang/lib/Headers/stdbool.h b/clang/lib/Headers/stdbool.h
index dfaad2b65a9b5..4b81e4ba820d1 100644
--- a/clang/lib/Headers/stdbool.h
+++ b/clang/lib/Headers/stdbool.h
@@ -22,8 +22,8 @@
  */
 #elif !defined(__cplusplus)
 #define bool _Bool
-#define true 1
-#define false 0
+#define true ((bool)1)
+#define false ((bool)0)
 #elif defined(__GNUC__) && !defined(__STRICT_ANSI__)
 /* Define _Bool as a GNU extension. */
 #define _Bool bool

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


[clang] [llvm] [LLVM][VecLib] Refactor LIBMVEC integration to be target neutral. (PR #138262)

2025-05-06 Thread Benjamin Maxwell via cfe-commits

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

LGTM, thanks :+1: 

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


[clang] [llvm] [LLVM][VecLib] Refactor LIBMVEC integration to be target neutral. (PR #138262)

2025-05-06 Thread Benjamin Maxwell via cfe-commits

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


[clang] [llvm] [LLVM][VecLib] Refactor LIBMVEC integration to be target neutral. (PR #138262)

2025-05-06 Thread Benjamin Maxwell via cfe-commits


@@ -1360,8 +1360,15 @@ void 
TargetLibraryInfoImpl::addVectorizableFunctionsFromVecLib(
 addVectorizableFunctions(VecFuncs_DarwinLibSystemM);
 break;
   }
-  case LIBMVEC_X86: {
-addVectorizableFunctions(VecFuncs_LIBMVEC_X86);
+  case LIBMVEC: {
+switch (TargetTriple.getArch()) {
+default:
+  break;
+case llvm::Triple::x86:
+case llvm::Triple::x86_64:
+  addVectorizableFunctions(VecFuncs_LIBMVEC_X86);
+  break;
+}

MacDue wrote:

```suggestion
if (TargetTriple.isX86())
  addVectorizableFunctions(VecFuncs_LIBMVEC_X86);
```

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


[clang] FEAT: 1 byte for "true" & "false" (PR #138713)

2025-05-06 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang

Author: SAKSHAM JOSHI (saksham-joshi)


Changes

# In C language,

- the size of "true" and "false" macro is 4 bytes (for x64 arch)

- but the size of "bool" (typedef _Bool) is 1 byte.

- In order to decrease the memory usage, we can set the size of "true" and 
"false" macros to 1 byte using explicit typecasting in macro definition.

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


1 Files Affected:

- (modified) clang/lib/Headers/stdbool.h (+2-2) 


``diff
diff --git a/clang/lib/Headers/stdbool.h b/clang/lib/Headers/stdbool.h
index dfaad2b65a9b5..4b81e4ba820d1 100644
--- a/clang/lib/Headers/stdbool.h
+++ b/clang/lib/Headers/stdbool.h
@@ -22,8 +22,8 @@
  */
 #elif !defined(__cplusplus)
 #define bool _Bool
-#define true 1
-#define false 0
+#define true ((bool)1)
+#define false ((bool)0)
 #elif defined(__GNUC__) && !defined(__STRICT_ANSI__)
 /* Define _Bool as a GNU extension. */
 #define _Bool bool

``




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


  1   2   3   4   >