[clang] [Tooling/Inclusion] Update std symbol mapping (PR #118174)

2024-12-16 Thread Haojian Wu via cfe-commits

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

Thanks, this looks good.

https://github.com/llvm/llvm-project/pull/118174
___
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 readability-string-view-substr check (PR #120055)

2024-12-16 Thread Helmut Januschka via cfe-commits

https://github.com/hjanuschka updated 
https://github.com/llvm/llvm-project/pull/120055

>From bcee24de45d955760257bb0b1825e3e59bf7a28c Mon Sep 17 00:00:00 2001
From: Helmut Januschka 
Date: Mon, 16 Dec 2024 08:24:14 +0100
Subject: [PATCH 1/2] [clang-tidy] Add readability-string-view-substr check

Add a new check that suggests using string_view::remove_prefix() and
remove_suffix() instead of substr() when the intent is to remove
characters from either end of a string_view.
---
 .../clang-tidy/readability/CMakeLists.txt |   1 +
 .../readability/ReadabilityTidyModule.cpp |   3 +
 .../readability/StringViewSubstrCheck.cpp | 132 ++
 .../readability/StringViewSubstrCheck.h   |  39 ++
 clang-tools-extra/docs/ReleaseNotes.rst   |   7 +
 .../checks/readability/string-view-substr.rst |  16 +++
 .../readability/stringview_substr.cpp |  55 
 7 files changed, 253 insertions(+)
 create mode 100644 
clang-tools-extra/clang-tidy/readability/StringViewSubstrCheck.cpp
 create mode 100644 
clang-tools-extra/clang-tidy/readability/StringViewSubstrCheck.h
 create mode 100644 
clang-tools-extra/docs/clang-tidy/checks/readability/string-view-substr.rst
 create mode 100644 
clang-tools-extra/test/clang-tidy/checkers/readability/stringview_substr.cpp

diff --git a/clang-tools-extra/clang-tidy/readability/CMakeLists.txt 
b/clang-tools-extra/clang-tidy/readability/CMakeLists.txt
index 8f303c51e1b0da..8b44fc339441ac 100644
--- a/clang-tools-extra/clang-tidy/readability/CMakeLists.txt
+++ b/clang-tools-extra/clang-tidy/readability/CMakeLists.txt
@@ -53,6 +53,7 @@ add_clang_library(clangTidyReadabilityModule STATIC
   StaticAccessedThroughInstanceCheck.cpp
   StaticDefinitionInAnonymousNamespaceCheck.cpp
   StringCompareCheck.cpp
+  StringViewSubstrCheck.cpp
   SuspiciousCallArgumentCheck.cpp
   UniqueptrDeleteReleaseCheck.cpp
   UppercaseLiteralSuffixCheck.cpp
diff --git a/clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp 
b/clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp
index d61c0ba39658e5..0889fbbd86a281 100644
--- a/clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp
+++ b/clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp
@@ -56,6 +56,7 @@
 #include "StaticAccessedThroughInstanceCheck.h"
 #include "StaticDefinitionInAnonymousNamespaceCheck.h"
 #include "StringCompareCheck.h"
+#include "StringViewSubstrCheck.h"
 #include "SuspiciousCallArgumentCheck.h"
 #include "UniqueptrDeleteReleaseCheck.h"
 #include "UppercaseLiteralSuffixCheck.h"
@@ -146,6 +147,8 @@ class ReadabilityModule : public ClangTidyModule {
 "readability-static-definition-in-anonymous-namespace");
 CheckFactories.registerCheck(
 "readability-string-compare");
+CheckFactories.registerCheck(
+  "readability-stringview-substr");
 CheckFactories.registerCheck(
 "readability-named-parameter");
 CheckFactories.registerCheck(
diff --git a/clang-tools-extra/clang-tidy/readability/StringViewSubstrCheck.cpp 
b/clang-tools-extra/clang-tidy/readability/StringViewSubstrCheck.cpp
new file mode 100644
index 00..e86a971695a835
--- /dev/null
+++ b/clang-tools-extra/clang-tidy/readability/StringViewSubstrCheck.cpp
@@ -0,0 +1,132 @@
+//===--- StringViewSubstrCheck.cpp - clang-tidy--*- C++ 
-*-===//
+//
+// 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 "StringViewSubstrCheck.h"
+#include "clang/AST/ASTContext.h"
+#include "clang/ASTMatchers/ASTMatchFinder.h"
+#include "clang/Lex/Lexer.h"
+
+using namespace clang::ast_matchers;
+
+namespace clang::tidy::readability {
+
+void StringViewSubstrCheck::registerMatchers(MatchFinder *Finder) {
+  const auto HasStringViewType = 
hasType(hasUnqualifiedDesugaredType(recordType(
+  hasDeclaration(recordDecl(hasName("::std::basic_string_view"));
+
+  // Match assignment to string_view's substr
+  Finder->addMatcher(
+  cxxOperatorCallExpr(
+  hasOverloadedOperatorName("="),
+  hasArgument(0, expr(HasStringViewType).bind("target")),
+  hasArgument(
+  1, cxxMemberCallExpr(callee(memberExpr(hasDeclaration(
+   cxxMethodDecl(hasName("substr"),
+   on(expr(HasStringViewType).bind("source")))
+ .bind("substr_call")))
+  .bind("assignment"),
+  this);
+}
+
+void StringViewSubstrCheck::check(const MatchFinder::MatchResult &Result) {
+  const auto *Assignment =
+  Result.Nodes.getNodeAs("assignment");
+  const auto *Target = Result.Nodes.getNodeAs("target");
+  const auto *Source = Result.Nodes.getNodeAs("source");
+  const auto *SubstrCall =
+  Result.Nodes

[clang-tools-extra] [clang-tidy] Add readability-string-view-substr check (PR #120055)

2024-12-16 Thread Helmut Januschka via cfe-commits

https://github.com/hjanuschka updated 
https://github.com/llvm/llvm-project/pull/120055

>From bcee24de45d955760257bb0b1825e3e59bf7a28c Mon Sep 17 00:00:00 2001
From: Helmut Januschka 
Date: Mon, 16 Dec 2024 08:24:14 +0100
Subject: [PATCH 1/2] [clang-tidy] Add readability-string-view-substr check

Add a new check that suggests using string_view::remove_prefix() and
remove_suffix() instead of substr() when the intent is to remove
characters from either end of a string_view.
---
 .../clang-tidy/readability/CMakeLists.txt |   1 +
 .../readability/ReadabilityTidyModule.cpp |   3 +
 .../readability/StringViewSubstrCheck.cpp | 132 ++
 .../readability/StringViewSubstrCheck.h   |  39 ++
 clang-tools-extra/docs/ReleaseNotes.rst   |   7 +
 .../checks/readability/string-view-substr.rst |  16 +++
 .../readability/stringview_substr.cpp |  55 
 7 files changed, 253 insertions(+)
 create mode 100644 
clang-tools-extra/clang-tidy/readability/StringViewSubstrCheck.cpp
 create mode 100644 
clang-tools-extra/clang-tidy/readability/StringViewSubstrCheck.h
 create mode 100644 
clang-tools-extra/docs/clang-tidy/checks/readability/string-view-substr.rst
 create mode 100644 
clang-tools-extra/test/clang-tidy/checkers/readability/stringview_substr.cpp

diff --git a/clang-tools-extra/clang-tidy/readability/CMakeLists.txt 
b/clang-tools-extra/clang-tidy/readability/CMakeLists.txt
index 8f303c51e1b0da..8b44fc339441ac 100644
--- a/clang-tools-extra/clang-tidy/readability/CMakeLists.txt
+++ b/clang-tools-extra/clang-tidy/readability/CMakeLists.txt
@@ -53,6 +53,7 @@ add_clang_library(clangTidyReadabilityModule STATIC
   StaticAccessedThroughInstanceCheck.cpp
   StaticDefinitionInAnonymousNamespaceCheck.cpp
   StringCompareCheck.cpp
+  StringViewSubstrCheck.cpp
   SuspiciousCallArgumentCheck.cpp
   UniqueptrDeleteReleaseCheck.cpp
   UppercaseLiteralSuffixCheck.cpp
diff --git a/clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp 
b/clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp
index d61c0ba39658e5..0889fbbd86a281 100644
--- a/clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp
+++ b/clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp
@@ -56,6 +56,7 @@
 #include "StaticAccessedThroughInstanceCheck.h"
 #include "StaticDefinitionInAnonymousNamespaceCheck.h"
 #include "StringCompareCheck.h"
+#include "StringViewSubstrCheck.h"
 #include "SuspiciousCallArgumentCheck.h"
 #include "UniqueptrDeleteReleaseCheck.h"
 #include "UppercaseLiteralSuffixCheck.h"
@@ -146,6 +147,8 @@ class ReadabilityModule : public ClangTidyModule {
 "readability-static-definition-in-anonymous-namespace");
 CheckFactories.registerCheck(
 "readability-string-compare");
+CheckFactories.registerCheck(
+  "readability-stringview-substr");
 CheckFactories.registerCheck(
 "readability-named-parameter");
 CheckFactories.registerCheck(
diff --git a/clang-tools-extra/clang-tidy/readability/StringViewSubstrCheck.cpp 
b/clang-tools-extra/clang-tidy/readability/StringViewSubstrCheck.cpp
new file mode 100644
index 00..e86a971695a835
--- /dev/null
+++ b/clang-tools-extra/clang-tidy/readability/StringViewSubstrCheck.cpp
@@ -0,0 +1,132 @@
+//===--- StringViewSubstrCheck.cpp - clang-tidy--*- C++ 
-*-===//
+//
+// 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 "StringViewSubstrCheck.h"
+#include "clang/AST/ASTContext.h"
+#include "clang/ASTMatchers/ASTMatchFinder.h"
+#include "clang/Lex/Lexer.h"
+
+using namespace clang::ast_matchers;
+
+namespace clang::tidy::readability {
+
+void StringViewSubstrCheck::registerMatchers(MatchFinder *Finder) {
+  const auto HasStringViewType = 
hasType(hasUnqualifiedDesugaredType(recordType(
+  hasDeclaration(recordDecl(hasName("::std::basic_string_view"));
+
+  // Match assignment to string_view's substr
+  Finder->addMatcher(
+  cxxOperatorCallExpr(
+  hasOverloadedOperatorName("="),
+  hasArgument(0, expr(HasStringViewType).bind("target")),
+  hasArgument(
+  1, cxxMemberCallExpr(callee(memberExpr(hasDeclaration(
+   cxxMethodDecl(hasName("substr"),
+   on(expr(HasStringViewType).bind("source")))
+ .bind("substr_call")))
+  .bind("assignment"),
+  this);
+}
+
+void StringViewSubstrCheck::check(const MatchFinder::MatchResult &Result) {
+  const auto *Assignment =
+  Result.Nodes.getNodeAs("assignment");
+  const auto *Target = Result.Nodes.getNodeAs("target");
+  const auto *Source = Result.Nodes.getNodeAs("source");
+  const auto *SubstrCall =
+  Result.Nodes

[clang] [AArch64] Fix argument passing for SVE tuples (PR #118961)

2024-12-16 Thread Momchil Velikov via cfe-commits

https://github.com/momchil-velikov updated 
https://github.com/llvm/llvm-project/pull/118961

>From 7d4c0cded14845fe854157d550fafd4637bea14f Mon Sep 17 00:00:00 2001
From: Momchil Velikov 
Date: Fri, 6 Dec 2024 10:47:43 +
Subject: [PATCH] Fix SVE tuples

---
 clang/lib/CodeGen/Targets/AArch64.cpp |  68 +++
 .../test/CodeGen/AArch64/pure-scalable-args.c |  19 
 .../CodeGenCXX/aarch64-mangle-sve-vectors.cpp | 106 --
 3 files changed, 111 insertions(+), 82 deletions(-)

diff --git a/clang/lib/CodeGen/Targets/AArch64.cpp 
b/clang/lib/CodeGen/Targets/AArch64.cpp
index be33e26f047841..ad7f405cc72550 100644
--- a/clang/lib/CodeGen/Targets/AArch64.cpp
+++ b/clang/lib/CodeGen/Targets/AArch64.cpp
@@ -52,6 +52,7 @@ class AArch64ABIInfo : public ABIInfo {
 
   bool isIllegalVectorType(QualType Ty) const;
 
+  bool passAsAggregateType(QualType Ty) const;
   bool passAsPureScalableType(QualType Ty, unsigned &NV, unsigned &NP,
   SmallVectorImpl &CoerceToSeq) 
const;
 
@@ -337,6 +338,10 @@ ABIArgInfo 
AArch64ABIInfo::coerceAndExpandPureScalableAggregate(
   NSRN += NVec;
   NPRN += NPred;
 
+  // Handle SVE vector tuples.
+  if (Ty->isSVESizelessBuiltinType())
+return ABIArgInfo::getDirect();
+
   llvm::Type *UnpaddedCoerceToType =
   UnpaddedCoerceToSeq.size() == 1
   ? UnpaddedCoerceToSeq[0]
@@ -362,7 +367,7 @@ ABIArgInfo AArch64ABIInfo::classifyArgumentType(QualType 
Ty, bool IsVariadicFn,
   if (isIllegalVectorType(Ty))
 return coerceIllegalVector(Ty, NSRN, NPRN);
 
-  if (!isAggregateTypeForABI(Ty)) {
+  if (!passAsAggregateType(Ty)) {
 // Treat an enum type as its underlying type.
 if (const EnumType *EnumTy = Ty->getAs())
   Ty = EnumTy->getDecl()->getIntegerType();
@@ -417,7 +422,7 @@ ABIArgInfo AArch64ABIInfo::classifyArgumentType(QualType 
Ty, bool IsVariadicFn,
   // elsewhere for GNU compatibility.
   uint64_t Size = getContext().getTypeSize(Ty);
   bool IsEmpty = isEmptyRecord(getContext(), Ty, true);
-  if (IsEmpty || Size == 0) {
+  if (!Ty->isSVESizelessBuiltinType() && (IsEmpty || Size == 0)) {
 if (!getContext().getLangOpts().CPlusPlus || isDarwinPCS())
   return ABIArgInfo::getIgnore();
 
@@ -504,7 +509,7 @@ ABIArgInfo AArch64ABIInfo::classifyReturnType(QualType 
RetTy,
   if (RetTy->isVectorType() && getContext().getTypeSize(RetTy) > 128)
 return getNaturalAlignIndirect(RetTy);
 
-  if (!isAggregateTypeForABI(RetTy)) {
+  if (!passAsAggregateType(RetTy)) {
 // Treat an enum type as its underlying type.
 if (const EnumType *EnumTy = RetTy->getAs())
   RetTy = EnumTy->getDecl()->getIntegerType();
@@ -519,7 +524,8 @@ ABIArgInfo AArch64ABIInfo::classifyReturnType(QualType 
RetTy,
   }
 
   uint64_t Size = getContext().getTypeSize(RetTy);
-  if (isEmptyRecord(getContext(), RetTy, true) || Size == 0)
+  if (!RetTy->isSVESizelessBuiltinType() &&
+  (isEmptyRecord(getContext(), RetTy, true) || Size == 0))
 return ABIArgInfo::getIgnore();
 
   const Type *Base = nullptr;
@@ -654,6 +660,15 @@ bool 
AArch64ABIInfo::isZeroLengthBitfieldPermittedInHomogeneousAggregate()
   return true;
 }
 
+bool AArch64ABIInfo::passAsAggregateType(QualType Ty) const {
+  if (Kind == AArch64ABIKind::AAPCS && Ty->isSVESizelessBuiltinType()) {
+const auto *BT = Ty->getAs();
+return !BT->isSVECount() &&
+   getContext().getBuiltinVectorTypeInfo(BT).NumVectors > 1;
+  }
+  return isAggregateTypeForABI(Ty);
+}
+
 // Check if a type needs to be passed in registers as a Pure Scalable Type (as
 // defined by AAPCS64). Return the number of data vectors and the number of
 // predicate vectors in the type, into `NVec` and `NPred`, respectively. Upon
@@ -719,37 +734,38 @@ bool AArch64ABIInfo::passAsPureScalableType(
 return true;
   }
 
-  const auto *VT = Ty->getAs();
-  if (!VT)
-return false;
+  if (const auto *VT = Ty->getAs()) {
+if (VT->getVectorKind() == VectorKind::SveFixedLengthPredicate) {
+  ++NPred;
+  if (CoerceToSeq.size() + 1 > 12)
+return false;
+  CoerceToSeq.push_back(convertFixedToScalableVectorType(VT));
+  return true;
+}
 
-  if (VT->getVectorKind() == VectorKind::SveFixedLengthPredicate) {
-++NPred;
-if (CoerceToSeq.size() + 1 > 12)
-  return false;
-CoerceToSeq.push_back(convertFixedToScalableVectorType(VT));
-return true;
-  }
+if (VT->getVectorKind() == VectorKind::SveFixedLengthData) {
+  ++NVec;
+  if (CoerceToSeq.size() + 1 > 12)
+return false;
+  CoerceToSeq.push_back(convertFixedToScalableVectorType(VT));
+  return true;
+}
 
-  if (VT->getVectorKind() == VectorKind::SveFixedLengthData) {
-++NVec;
-if (CoerceToSeq.size() + 1 > 12)
-  return false;
-CoerceToSeq.push_back(convertFixedToScalableVectorType(VT));
-return true;
+return false;
   }
 
-  if (!VT->isBuiltinType())
+  if (!Ty->isBuiltinType())
 return false;
 
-  switch (cast(VT)->getKind())

[clang] [AArch64] Fix argument passing for SVE tuples (PR #118961)

2024-12-16 Thread Momchil Velikov via cfe-commits

https://github.com/momchil-velikov edited 
https://github.com/llvm/llvm-project/pull/118961
___
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 readability-string-view-substr check (PR #120055)

2024-12-16 Thread Helmut Januschka via cfe-commits

https://github.com/hjanuschka updated 
https://github.com/llvm/llvm-project/pull/120055

>From 8b2dc9adf4fae2065823e5beb3a1cd851686913c Mon Sep 17 00:00:00 2001
From: Helmut Januschka 
Date: Mon, 16 Dec 2024 08:24:14 +0100
Subject: [PATCH] [clang-tidy] Add readability-string-view-substr check

Add a new check that suggests using string_view::remove_prefix() and
remove_suffix() instead of substr() when the intent is to remove
characters from either end of a string_view.
---
 .../clang-tidy/readability/CMakeLists.txt |   1 +
 .../readability/ReadabilityTidyModule.cpp |   3 +
 .../readability/StringViewSubstrCheck.cpp | 132 ++
 .../readability/StringViewSubstrCheck.h   |  39 ++
 clang-tools-extra/docs/ReleaseNotes.rst   |   7 +
 .../checks/readability/string-view-substr.rst |  16 +++
 .../readability/stringview_substr.cpp |  55 
 7 files changed, 253 insertions(+)
 create mode 100644 
clang-tools-extra/clang-tidy/readability/StringViewSubstrCheck.cpp
 create mode 100644 
clang-tools-extra/clang-tidy/readability/StringViewSubstrCheck.h
 create mode 100644 
clang-tools-extra/docs/clang-tidy/checks/readability/string-view-substr.rst
 create mode 100644 
clang-tools-extra/test/clang-tidy/checkers/readability/stringview_substr.cpp

diff --git a/clang-tools-extra/clang-tidy/readability/CMakeLists.txt 
b/clang-tools-extra/clang-tidy/readability/CMakeLists.txt
index 8f303c51e1b0da..8b44fc339441ac 100644
--- a/clang-tools-extra/clang-tidy/readability/CMakeLists.txt
+++ b/clang-tools-extra/clang-tidy/readability/CMakeLists.txt
@@ -53,6 +53,7 @@ add_clang_library(clangTidyReadabilityModule STATIC
   StaticAccessedThroughInstanceCheck.cpp
   StaticDefinitionInAnonymousNamespaceCheck.cpp
   StringCompareCheck.cpp
+  StringViewSubstrCheck.cpp
   SuspiciousCallArgumentCheck.cpp
   UniqueptrDeleteReleaseCheck.cpp
   UppercaseLiteralSuffixCheck.cpp
diff --git a/clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp 
b/clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp
index d61c0ba39658e5..f36ec8f95ede60 100644
--- a/clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp
+++ b/clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp
@@ -56,6 +56,7 @@
 #include "StaticAccessedThroughInstanceCheck.h"
 #include "StaticDefinitionInAnonymousNamespaceCheck.h"
 #include "StringCompareCheck.h"
+#include "StringViewSubstrCheck.h"
 #include "SuspiciousCallArgumentCheck.h"
 #include "UniqueptrDeleteReleaseCheck.h"
 #include "UppercaseLiteralSuffixCheck.h"
@@ -146,6 +147,8 @@ class ReadabilityModule : public ClangTidyModule {
 "readability-static-definition-in-anonymous-namespace");
 CheckFactories.registerCheck(
 "readability-string-compare");
+CheckFactories.registerCheck(
+"readability-stringview-substr");
 CheckFactories.registerCheck(
 "readability-named-parameter");
 CheckFactories.registerCheck(
diff --git a/clang-tools-extra/clang-tidy/readability/StringViewSubstrCheck.cpp 
b/clang-tools-extra/clang-tidy/readability/StringViewSubstrCheck.cpp
new file mode 100644
index 00..e86a971695a835
--- /dev/null
+++ b/clang-tools-extra/clang-tidy/readability/StringViewSubstrCheck.cpp
@@ -0,0 +1,132 @@
+//===--- StringViewSubstrCheck.cpp - clang-tidy--*- C++ 
-*-===//
+//
+// 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 "StringViewSubstrCheck.h"
+#include "clang/AST/ASTContext.h"
+#include "clang/ASTMatchers/ASTMatchFinder.h"
+#include "clang/Lex/Lexer.h"
+
+using namespace clang::ast_matchers;
+
+namespace clang::tidy::readability {
+
+void StringViewSubstrCheck::registerMatchers(MatchFinder *Finder) {
+  const auto HasStringViewType = 
hasType(hasUnqualifiedDesugaredType(recordType(
+  hasDeclaration(recordDecl(hasName("::std::basic_string_view"));
+
+  // Match assignment to string_view's substr
+  Finder->addMatcher(
+  cxxOperatorCallExpr(
+  hasOverloadedOperatorName("="),
+  hasArgument(0, expr(HasStringViewType).bind("target")),
+  hasArgument(
+  1, cxxMemberCallExpr(callee(memberExpr(hasDeclaration(
+   cxxMethodDecl(hasName("substr"),
+   on(expr(HasStringViewType).bind("source")))
+ .bind("substr_call")))
+  .bind("assignment"),
+  this);
+}
+
+void StringViewSubstrCheck::check(const MatchFinder::MatchResult &Result) {
+  const auto *Assignment =
+  Result.Nodes.getNodeAs("assignment");
+  const auto *Target = Result.Nodes.getNodeAs("target");
+  const auto *Source = Result.Nodes.getNodeAs("source");
+  const auto *SubstrCall =
+  Result.Nodes.g

[clang] [llvm] [X86] Add missing feature USERMSR to DiamondRapids (PR #120061)

2024-12-16 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-backend-x86

Author: Phoebe Wang (phoebewang)


Changes

Ref.: https://cdrdv2.intel.com/v1/dl/getContent/671368

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


3 Files Affected:

- (modified) clang/test/Preprocessor/predefined-arch-macros.c (+4) 
- (modified) llvm/lib/Target/X86/X86.td (+1) 
- (modified) llvm/lib/TargetParser/X86TargetParser.cpp (+1-1) 


``diff
diff --git a/clang/test/Preprocessor/predefined-arch-macros.c 
b/clang/test/Preprocessor/predefined-arch-macros.c
index 20aa2d4e0a54cb..43f3454ed3c35d 100644
--- a/clang/test/Preprocessor/predefined-arch-macros.c
+++ b/clang/test/Preprocessor/predefined-arch-macros.c
@@ -1953,6 +1953,8 @@
 // CHECK_GNR_M32: #define __SSSE3__ 1
 // CHECK_GNR_M32: #define __TSXLDTRK__ 1
 // CHECK_GNR_M32: #define __UINTR__ 1
+// CHECK_GNR_M32-NOT: #define __USERMSR__ 1
+// CHECK_DMR_M32: #define __USERMSR__ 1
 // CHECK_GNR_M32: #define __VAES__ 1
 // CHECK_GNR_M32: #define __VPCLMULQDQ__ 1
 // CHECK_GNR_M32: #define __WAITPKG__ 1
@@ -2061,6 +2063,8 @@
 // CHECK_GNR_M64: #define __SSSE3__ 1
 // CHECK_GNR_M64: #define __TSXLDTRK__ 1
 // CHECK_GNR_M64: #define __UINTR__ 1
+// CHECK_GNR_M64-NOT: #define __USERMSR__ 1
+// CHECK_DMR_M64: #define __USERMSR__ 1
 // CHECK_GNR_M64: #define __VAES__ 1
 // CHECK_GNR_M64: #define __VPCLMULQDQ__ 1
 // CHECK_GNR_M64: #define __WAITPKG__ 1
diff --git a/llvm/lib/Target/X86/X86.td b/llvm/lib/Target/X86/X86.td
index 5722167beca9f8..38761e1fd7eecc 100644
--- a/llvm/lib/Target/X86/X86.td
+++ b/llvm/lib/Target/X86/X86.td
@@ -1163,6 +1163,7 @@ def ProcessorFeatures {
   FeatureAVXNECONVERT,
   FeatureAVXVNNIINT8,
   FeatureAVXVNNIINT16,
+  FeatureUSERMSR,
   FeatureSHA512,
   FeatureSM3,
   FeatureEGPR,
diff --git a/llvm/lib/TargetParser/X86TargetParser.cpp 
b/llvm/lib/TargetParser/X86TargetParser.cpp
index cc356186188913..e4b7ed7cf9b61f 100644
--- a/llvm/lib/TargetParser/X86TargetParser.cpp
+++ b/llvm/lib/TargetParser/X86TargetParser.cpp
@@ -145,7 +145,7 @@ constexpr FeatureBitset FeaturesDiamondRapids =
 FeatureSM4 | FeatureEGPR | FeatureZU | FeatureCCMP | FeaturePush2Pop2 |
 FeaturePPX | FeatureNDD | FeatureNF | FeatureCF | FeatureMOVRS |
 FeatureAMX_MOVRS | FeatureAMX_AVX512 | FeatureAMX_FP8 | FeatureAMX_TF32 |
-FeatureAMX_TRANSPOSE;
+FeatureAMX_TRANSPOSE | FeatureUSERMSR;
 
 // Intel Atom processors.
 // Bonnell has feature parity with Core2 and adds MOVBE.

``




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


[clang] [llvm] [X86] Add missing feature USERMSR to DiamondRapids (PR #120061)

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

https://github.com/phoebewang created 
https://github.com/llvm/llvm-project/pull/120061

Ref.: https://cdrdv2.intel.com/v1/dl/getContent/671368

>From d2bd70ca596987fc8ed0292e10c56fe1a98b1333 Mon Sep 17 00:00:00 2001
From: "Wang, Phoebe" 
Date: Mon, 16 Dec 2024 17:48:41 +0800
Subject: [PATCH] [X86] Add missing feature USERMSR to DiamondRapids

Ref.: https://cdrdv2.intel.com/v1/dl/getContent/671368
---
 clang/test/Preprocessor/predefined-arch-macros.c | 4 
 llvm/lib/Target/X86/X86.td   | 1 +
 llvm/lib/TargetParser/X86TargetParser.cpp| 2 +-
 3 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/clang/test/Preprocessor/predefined-arch-macros.c 
b/clang/test/Preprocessor/predefined-arch-macros.c
index 20aa2d4e0a54cb..43f3454ed3c35d 100644
--- a/clang/test/Preprocessor/predefined-arch-macros.c
+++ b/clang/test/Preprocessor/predefined-arch-macros.c
@@ -1953,6 +1953,8 @@
 // CHECK_GNR_M32: #define __SSSE3__ 1
 // CHECK_GNR_M32: #define __TSXLDTRK__ 1
 // CHECK_GNR_M32: #define __UINTR__ 1
+// CHECK_GNR_M32-NOT: #define __USERMSR__ 1
+// CHECK_DMR_M32: #define __USERMSR__ 1
 // CHECK_GNR_M32: #define __VAES__ 1
 // CHECK_GNR_M32: #define __VPCLMULQDQ__ 1
 // CHECK_GNR_M32: #define __WAITPKG__ 1
@@ -2061,6 +2063,8 @@
 // CHECK_GNR_M64: #define __SSSE3__ 1
 // CHECK_GNR_M64: #define __TSXLDTRK__ 1
 // CHECK_GNR_M64: #define __UINTR__ 1
+// CHECK_GNR_M64-NOT: #define __USERMSR__ 1
+// CHECK_DMR_M64: #define __USERMSR__ 1
 // CHECK_GNR_M64: #define __VAES__ 1
 // CHECK_GNR_M64: #define __VPCLMULQDQ__ 1
 // CHECK_GNR_M64: #define __WAITPKG__ 1
diff --git a/llvm/lib/Target/X86/X86.td b/llvm/lib/Target/X86/X86.td
index 5722167beca9f8..38761e1fd7eecc 100644
--- a/llvm/lib/Target/X86/X86.td
+++ b/llvm/lib/Target/X86/X86.td
@@ -1163,6 +1163,7 @@ def ProcessorFeatures {
   FeatureAVXNECONVERT,
   FeatureAVXVNNIINT8,
   FeatureAVXVNNIINT16,
+  FeatureUSERMSR,
   FeatureSHA512,
   FeatureSM3,
   FeatureEGPR,
diff --git a/llvm/lib/TargetParser/X86TargetParser.cpp 
b/llvm/lib/TargetParser/X86TargetParser.cpp
index cc356186188913..e4b7ed7cf9b61f 100644
--- a/llvm/lib/TargetParser/X86TargetParser.cpp
+++ b/llvm/lib/TargetParser/X86TargetParser.cpp
@@ -145,7 +145,7 @@ constexpr FeatureBitset FeaturesDiamondRapids =
 FeatureSM4 | FeatureEGPR | FeatureZU | FeatureCCMP | FeaturePush2Pop2 |
 FeaturePPX | FeatureNDD | FeatureNF | FeatureCF | FeatureMOVRS |
 FeatureAMX_MOVRS | FeatureAMX_AVX512 | FeatureAMX_FP8 | FeatureAMX_TF32 |
-FeatureAMX_TRANSPOSE;
+FeatureAMX_TRANSPOSE | FeatureUSERMSR;
 
 // Intel Atom processors.
 // Bonnell has feature parity with Core2 and adds MOVBE.

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


[clang] [llvm] [NFC] [RISCV] Refactor class RISCVExtension (PR #120040)

2024-12-16 Thread Pengcheng Wang via cfe-commits


@@ -22,11 +24,21 @@
 // uses the record name by replacing Feature with Has.
 // value - Value to assign to the field in RISCVSubtarget when this
 // extension is enabled. Usually "true", but can be changed.
-class RISCVExtension implies = [],
  string fieldname = !subst("Feature", "Has", NAME),
- string value = "true">
-: SubtargetFeature {
+ string value = "true", bit IsExperimental = false>
+: SubtargetFeature<"", fieldname, value, "", implies> {
+  defvar ExtName = !subst("FeatureVendor", "", !subst("FeatureStdExt", "", 
NAME));

wangpc-pp wrote:

I still think we should use lower case here. Please see also `SchedCommon` in 
`llvm/lib/Target/RISCV/RISCVInstrInfoV.td`.

We have the discussion before (but I forgot the patch), for local variables, we 
tend to use lower camel case.

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


[clang] [llvm] [X86] Add missing feature USERMSR to DiamondRapids (PR #120061)

2024-12-16 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang

Author: Phoebe Wang (phoebewang)


Changes

Ref.: https://cdrdv2.intel.com/v1/dl/getContent/671368

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


3 Files Affected:

- (modified) clang/test/Preprocessor/predefined-arch-macros.c (+4) 
- (modified) llvm/lib/Target/X86/X86.td (+1) 
- (modified) llvm/lib/TargetParser/X86TargetParser.cpp (+1-1) 


``diff
diff --git a/clang/test/Preprocessor/predefined-arch-macros.c 
b/clang/test/Preprocessor/predefined-arch-macros.c
index 20aa2d4e0a54cb..43f3454ed3c35d 100644
--- a/clang/test/Preprocessor/predefined-arch-macros.c
+++ b/clang/test/Preprocessor/predefined-arch-macros.c
@@ -1953,6 +1953,8 @@
 // CHECK_GNR_M32: #define __SSSE3__ 1
 // CHECK_GNR_M32: #define __TSXLDTRK__ 1
 // CHECK_GNR_M32: #define __UINTR__ 1
+// CHECK_GNR_M32-NOT: #define __USERMSR__ 1
+// CHECK_DMR_M32: #define __USERMSR__ 1
 // CHECK_GNR_M32: #define __VAES__ 1
 // CHECK_GNR_M32: #define __VPCLMULQDQ__ 1
 // CHECK_GNR_M32: #define __WAITPKG__ 1
@@ -2061,6 +2063,8 @@
 // CHECK_GNR_M64: #define __SSSE3__ 1
 // CHECK_GNR_M64: #define __TSXLDTRK__ 1
 // CHECK_GNR_M64: #define __UINTR__ 1
+// CHECK_GNR_M64-NOT: #define __USERMSR__ 1
+// CHECK_DMR_M64: #define __USERMSR__ 1
 // CHECK_GNR_M64: #define __VAES__ 1
 // CHECK_GNR_M64: #define __VPCLMULQDQ__ 1
 // CHECK_GNR_M64: #define __WAITPKG__ 1
diff --git a/llvm/lib/Target/X86/X86.td b/llvm/lib/Target/X86/X86.td
index 5722167beca9f8..38761e1fd7eecc 100644
--- a/llvm/lib/Target/X86/X86.td
+++ b/llvm/lib/Target/X86/X86.td
@@ -1163,6 +1163,7 @@ def ProcessorFeatures {
   FeatureAVXNECONVERT,
   FeatureAVXVNNIINT8,
   FeatureAVXVNNIINT16,
+  FeatureUSERMSR,
   FeatureSHA512,
   FeatureSM3,
   FeatureEGPR,
diff --git a/llvm/lib/TargetParser/X86TargetParser.cpp 
b/llvm/lib/TargetParser/X86TargetParser.cpp
index cc356186188913..e4b7ed7cf9b61f 100644
--- a/llvm/lib/TargetParser/X86TargetParser.cpp
+++ b/llvm/lib/TargetParser/X86TargetParser.cpp
@@ -145,7 +145,7 @@ constexpr FeatureBitset FeaturesDiamondRapids =
 FeatureSM4 | FeatureEGPR | FeatureZU | FeatureCCMP | FeaturePush2Pop2 |
 FeaturePPX | FeatureNDD | FeatureNF | FeatureCF | FeatureMOVRS |
 FeatureAMX_MOVRS | FeatureAMX_AVX512 | FeatureAMX_FP8 | FeatureAMX_TF32 |
-FeatureAMX_TRANSPOSE;
+FeatureAMX_TRANSPOSE | FeatureUSERMSR;
 
 // Intel Atom processors.
 // Bonnell has feature parity with Core2 and adds MOVBE.

``




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


[clang] [llvm] [X86] Add missing feature USERMSR to DiamondRapids (PR #120061)

2024-12-16 Thread Shengchen Kan via cfe-commits

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

LGTM

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


[clang] [llvm] [NFC][AMDGPU] Pre-commit clang and llvm tests for dynamic allocas (PR #120063)

2024-12-16 Thread via cfe-commits

https://github.com/easyonaadit created 
https://github.com/llvm/llvm-project/pull/120063

For #119822


>From 469e1dc39e045c29e2e9e332a77e29b492181508 Mon Sep 17 00:00:00 2001
From: easyonaadit 
Date: Mon, 16 Dec 2024 15:25:07 +0530
Subject: [PATCH] [NFC][AMDGPU] Pre-commit clang and llvm tests for dynamic
 allocas

---
 clang/test/CodeGenHIP/dynamic-alloca.cpp  | 532 ++
 .../GlobalISel/dynamic-alloca-divergent.ll|  22 +
 .../GlobalISel/dynamic-alloca-uniform.ll  |  85 +++
 .../test/CodeGen/AMDGPU/dynamic_stackalloc.ll |  36 +-
 4 files changed, 673 insertions(+), 2 deletions(-)
 create mode 100644 clang/test/CodeGenHIP/dynamic-alloca.cpp

diff --git a/clang/test/CodeGenHIP/dynamic-alloca.cpp 
b/clang/test/CodeGenHIP/dynamic-alloca.cpp
new file mode 100644
index 00..5a02e817e10975
--- /dev/null
+++ b/clang/test/CodeGenHIP/dynamic-alloca.cpp
@@ -0,0 +1,532 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py 
UTC_ARGS: --version 5
+// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -x hip -emit-llvm 
-fcuda-is-device -o - %s | FileCheck %s
+
+
+#define __global__ __attribute__((global))
+#define __device__ __attribute__((device))
+
+// CHECK-LABEL: define dso_local amdgpu_kernel void 
@_Z34kernel_function_builtin_alloca_immv(
+// CHECK-SAME: ) #[[ATTR0:[0-9]+]] {
+// CHECK-NEXT:  [[ENTRY:.*:]]
+// CHECK-NEXT:[[ALLOCA:%.*]] = alloca ptr, align 8, addrspace(5)
+// CHECK-NEXT:[[ALLOCA_ASCAST:%.*]] = addrspacecast ptr addrspace(5) 
[[ALLOCA]] to ptr
+// CHECK-NEXT:[[TMP0:%.*]] = alloca i8, i64 40, align 8, addrspace(5)
+// CHECK-NEXT:[[TMP1:%.*]] = addrspacecast ptr addrspace(5) [[TMP0]] to ptr
+// CHECK-NEXT:store ptr [[TMP1]], ptr [[ALLOCA_ASCAST]], align 8
+// CHECK-NEXT:[[TMP2:%.*]] = load ptr, ptr [[ALLOCA_ASCAST]], align 8
+// CHECK-NEXT:[[ARRAYIDX:%.*]] = getelementptr inbounds i32, ptr [[TMP2]], 
i64 0
+// CHECK-NEXT:store volatile i32 10, ptr [[ARRAYIDX]], align 4
+// CHECK-NEXT:ret void
+//
+__global__ void kernel_function_builtin_alloca_imm(){
+volatile int *alloca = static_cast(__builtin_alloca(10*sizeof(int)));
+static_cast(alloca)[0] = 10;
+}
+
+// CHECK-LABEL: define dso_local amdgpu_kernel void 
@_Z50kernel_function_non_entry_block_builtin_alloca_immPi(
+// CHECK-SAME: ptr addrspace(1) noundef [[A_COERCE:%.*]]) #[[ATTR0]] {
+// CHECK-NEXT:  [[ENTRY:.*:]]
+// CHECK-NEXT:[[A:%.*]] = alloca ptr, align 8, addrspace(5)
+// CHECK-NEXT:[[A_ADDR:%.*]] = alloca ptr, align 8, addrspace(5)
+// CHECK-NEXT:[[ALLOCA:%.*]] = alloca ptr, align 8, addrspace(5)
+// CHECK-NEXT:[[ALLOCA2:%.*]] = alloca ptr, align 8, addrspace(5)
+// CHECK-NEXT:[[A_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[A]] to 
ptr
+// CHECK-NEXT:[[A_ADDR_ASCAST:%.*]] = addrspacecast ptr addrspace(5) 
[[A_ADDR]] to ptr
+// CHECK-NEXT:[[ALLOCA_ASCAST:%.*]] = addrspacecast ptr addrspace(5) 
[[ALLOCA]] to ptr
+// CHECK-NEXT:[[ALLOCA2_ASCAST:%.*]] = addrspacecast ptr addrspace(5) 
[[ALLOCA2]] to ptr
+// CHECK-NEXT:store ptr addrspace(1) [[A_COERCE]], ptr [[A_ASCAST]], align 
8
+// CHECK-NEXT:[[A1:%.*]] = load ptr, ptr [[A_ASCAST]], align 8
+// CHECK-NEXT:store ptr [[A1]], ptr [[A_ADDR_ASCAST]], align 8
+// CHECK-NEXT:[[TMP0:%.*]] = load ptr, ptr [[A_ADDR_ASCAST]], align 8
+// CHECK-NEXT:[[TMP1:%.*]] = load i32, ptr [[TMP0]], align 4
+// CHECK-NEXT:[[CMP:%.*]] = icmp slt i32 [[TMP1]], 10
+// CHECK-NEXT:br i1 [[CMP]], label %[[IF_THEN:.*]], label %[[IF_ELSE:.*]]
+// CHECK:   [[IF_THEN]]:
+// CHECK-NEXT:[[TMP2:%.*]] = alloca i8, i64 40, align 8, addrspace(5)
+// CHECK-NEXT:[[TMP3:%.*]] = addrspacecast ptr addrspace(5) [[TMP2]] to ptr
+// CHECK-NEXT:store ptr [[TMP3]], ptr [[ALLOCA_ASCAST]], align 8
+// CHECK-NEXT:[[TMP4:%.*]] = load ptr, ptr [[ALLOCA_ASCAST]], align 8
+// CHECK-NEXT:[[ARRAYIDX:%.*]] = getelementptr inbounds i32, ptr [[TMP4]], 
i64 0
+// CHECK-NEXT:store volatile i32 10, ptr [[ARRAYIDX]], align 4
+// CHECK-NEXT:br label %[[IF_END:.*]]
+// CHECK:   [[IF_ELSE]]:
+// CHECK-NEXT:[[TMP5:%.*]] = alloca i8, i64 80, align 8, addrspace(5)
+// CHECK-NEXT:[[TMP6:%.*]] = addrspacecast ptr addrspace(5) [[TMP5]] to ptr
+// CHECK-NEXT:store ptr [[TMP6]], ptr [[ALLOCA2_ASCAST]], align 8
+// CHECK-NEXT:[[TMP7:%.*]] = load ptr, ptr [[ALLOCA2_ASCAST]], align 8
+// CHECK-NEXT:[[ARRAYIDX3:%.*]] = getelementptr inbounds i32, ptr 
[[TMP7]], i64 0
+// CHECK-NEXT:store volatile i32 20, ptr [[ARRAYIDX3]], align 4
+// CHECK-NEXT:br label %[[IF_END]]
+// CHECK:   [[IF_END]]:
+// CHECK-NEXT:ret void
+//
+__global__ void kernel_function_non_entry_block_builtin_alloca_imm(int* a){
+if(*a < 10){
+volatile void *alloca = __builtin_alloca(10*sizeof(int));
+static_cast(alloca)[0] = 10;
+}
+else {
+volatile void *alloca = __builtin_alloca(20*sizeof(int));
+static_cast(alloca)[0] = 20;
+  

[clang] [llvm] [NFC] [RISCV] Refactor class RISCVExtension (PR #120040)

2024-12-16 Thread Shao-Ce SUN via cfe-commits


@@ -22,11 +24,21 @@
 // uses the record name by replacing Feature with Has.
 // value - Value to assign to the field in RISCVSubtarget when this
 // extension is enabled. Usually "true", but can be changed.
-class RISCVExtension implies = [],
  string fieldname = !subst("Feature", "Has", NAME),
- string value = "true">
-: SubtargetFeature {
+ string value = "true", bit IsExperimental = false>
+: SubtargetFeature<"", fieldname, value, "", implies> {
+  defvar ExtName = !subst("FeatureVendor", "", !subst("FeatureStdExt", "", 
NAME));

sunshaoce wrote:

Addressed. Thanks!

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


[clang] [clang] Add sincos builtin using `llvm.sincos` intrinsic (PR #114086)

2024-12-16 Thread Benjamin Maxwell via cfe-commits

https://github.com/MacDue updated 
https://github.com/llvm/llvm-project/pull/114086

>From 5e6e49cf8bceed6d137ea67abe81a8a425d5aed8 Mon Sep 17 00:00:00 2001
From: Benjamin Maxwell 
Date: Mon, 9 Sep 2024 10:15:20 +
Subject: [PATCH 1/4] [clang] Add sincos builtin using `llvm.sincos` intrinsic

This registers `sincos[f|l]` as a clang builtin and updates GCBuiltin
to emit the `llvm.sincos.*` intrinsic when `-fno-math-errno` is set.
---
 clang/include/clang/Basic/Builtins.td| 13 +++
 clang/lib/CodeGen/CGBuiltin.cpp  | 43 
 clang/test/CodeGen/AArch64/sincos.c  | 33 ++
 clang/test/CodeGen/X86/math-builtins.c   | 35 +++
 clang/test/OpenMP/declare_simd_aarch64.c |  4 +--
 5 files changed, 126 insertions(+), 2 deletions(-)
 create mode 100644 clang/test/CodeGen/AArch64/sincos.c

diff --git a/clang/include/clang/Basic/Builtins.td 
b/clang/include/clang/Basic/Builtins.td
index 32a09e2ceb3857..d0e09e735c39d3 100644
--- a/clang/include/clang/Basic/Builtins.td
+++ b/clang/include/clang/Basic/Builtins.td
@@ -3568,6 +3568,19 @@ def Frexp : FPMathTemplate, LibBuiltin<"math.h"> {
   let AddBuiltinPrefixedAlias = 1;
 }
 
+def Sincos : FPMathTemplate, GNULibBuiltin<"math.h"> {
+  let Spellings = ["sincos"];
+  let Attributes = [NoThrow];
+  let Prototype = "void(T, T*, T*)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def SincosF16F128 : F16F128MathTemplate, Builtin {
+  let Spellings = ["__builtin_sincos"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow];
+  let Prototype = "void(T, T*, T*)";
+}
+
 def Ldexp : FPMathTemplate, LibBuiltin<"math.h"> {
   let Spellings = ["ldexp"];
   let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index 84048a4beac2c5..bdf797440d36a2 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -835,6 +835,38 @@ static Value *emitFrexpBuiltin(CodeGenFunction &CGF, const 
CallExpr *E,
   return CGF.Builder.CreateExtractValue(Call, 0);
 }
 
+static void emitSincosBuiltin(CodeGenFunction &CGF, const CallExpr *E,
+  llvm::Intrinsic::ID IntrinsicID) {
+  llvm::Value *Val = CGF.EmitScalarExpr(E->getArg(0));
+  llvm::Value *Dest0 = CGF.EmitScalarExpr(E->getArg(1));
+  llvm::Value *Dest1 = CGF.EmitScalarExpr(E->getArg(2));
+
+  llvm::Function *F = CGF.CGM.getIntrinsic(IntrinsicID, {Val->getType()});
+  llvm::Value *Call = CGF.Builder.CreateCall(F, Val);
+
+  llvm::Value *SinResult = CGF.Builder.CreateExtractValue(Call, 0);
+  llvm::Value *CosResult = CGF.Builder.CreateExtractValue(Call, 1);
+
+  QualType DestPtrType = E->getArg(1)->getType()->getPointeeType();
+  LValue SinLV = CGF.MakeNaturalAlignAddrLValue(Dest0, DestPtrType);
+  LValue CosLV = CGF.MakeNaturalAlignAddrLValue(Dest1, DestPtrType);
+
+  llvm::StoreInst *StoreSin =
+  CGF.Builder.CreateStore(SinResult, SinLV.getAddress());
+  llvm::StoreInst *StoreCos =
+  CGF.Builder.CreateStore(CosResult, CosLV.getAddress());
+
+  // Mark the two stores as non-aliasing with eachother. The order of stores
+  // emitted by this builtin is arbitrary, enforcing a particular order will
+  // prevent optimizations later on.
+  llvm::MDBuilder MDHelper(CGF.getLLVMContext());
+  MDNode *Domain = MDHelper.createAnonymousAliasScopeDomain();
+  MDNode *AliasScope = MDHelper.createAnonymousAliasScope(Domain);
+  MDNode *AliasScopeList = MDNode::get(Call->getContext(), AliasScope);
+  StoreSin->setMetadata(LLVMContext::MD_alias_scope, AliasScopeList);
+  StoreCos->setMetadata(LLVMContext::MD_noalias, AliasScopeList);
+}
+
 /// EmitFAbs - Emit a call to @llvm.fabs().
 static Value *EmitFAbs(CodeGenFunction &CGF, Value *V) {
   Function *F = CGF.CGM.getIntrinsic(Intrinsic::fabs, V->getType());
@@ -3232,6 +3264,17 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl 
GD, unsigned BuiltinID,
   return RValue::get(emitUnaryMaybeConstrainedFPBuiltin(
   *this, E, Intrinsic::sinh, 
Intrinsic::experimental_constrained_sinh));
 
+case Builtin::BIsincos:
+case Builtin::BIsincosf:
+case Builtin::BIsincosl:
+case Builtin::BI__builtin_sincos:
+case Builtin::BI__builtin_sincosf:
+case Builtin::BI__builtin_sincosl:
+case Builtin::BI__builtin_sincosf128:
+case Builtin::BI__builtin_sincosf16:
+  emitSincosBuiltin(*this, E, Intrinsic::sincos);
+  return RValue::get(nullptr);
+
 case Builtin::BIsqrt:
 case Builtin::BIsqrtf:
 case Builtin::BIsqrtl:
diff --git a/clang/test/CodeGen/AArch64/sincos.c 
b/clang/test/CodeGen/AArch64/sincos.c
new file mode 100644
index 00..240d921b2b7034
--- /dev/null
+++ b/clang/test/CodeGen/AArch64/sincos.c
@@ -0,0 +1,33 @@
+// RUN: %clang_cc1 -triple=aarch64-gnu-linux -emit-llvm %s -o - | FileCheck 
--check-prefix=NO-MATH-ERRNO %s
+// RUN: %clang_cc1 -triple=aarch64-gnu-linux -emit-llvm -fmath-errno %s -o - | 
FileCheck --check-prefix=MATH-

[clang] [Clang][AMDGPU] Stop defaulting to `one-as` for all atomic scopes (PR #120095)

2024-12-16 Thread Jon Chesterfield via cfe-commits

https://github.com/JonChesterfield requested changes to this pull request.

"You need to leave a comment indicating the requested changes."

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


[clang-tools-extra] Added options to readability-implicit-bool-conversion (PR #120087)

2024-12-16 Thread via cfe-commits

EugeneZelenko wrote:

Please mention options in Release Notes and check documentation.

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


[clang] [llvm] Reimplement constrained 'trunc' using operand bundles (PR #118253)

2024-12-16 Thread Serge Pavlov via cfe-commits


@@ -86,6 +86,43 @@ IRBuilderBase::createCallHelper(Function *Callee, 
ArrayRef Ops,
   return CI;
 }
 
+CallInst *IRBuilderBase::CreateCall(FunctionType *FTy, Value *Callee,
+ArrayRef Args,
+ArrayRef OpBundles,
+const Twine &Name, MDNode *FPMathTag) {
+  ArrayRef ActualBundlesRef = OpBundles;
+  SmallVector ActualBundles;
+
+  if (IsFPConstrained) {
+if (const auto *Func = dyn_cast(Callee)) {
+  if (Intrinsic::ID ID = Func->getIntrinsicID()) {
+if (IntrinsicInst::canAccessFPEnvironment(ID)) {
+  bool NeedRound = true, NeedExcept = true;
+  for (const auto &Item : OpBundles) {
+if (NeedRound && Item.getTag() == "fpe.round")
+  NeedRound = false;
+else if (NeedExcept && Item.getTag() == "fpe.except")
+  NeedExcept = false;
+ActualBundles.push_back(Item);

spavloff wrote:

It depend on how we want to treat the rounding mode bundle. At least two cases 
are possible.

(1) The rounding mode bundle specifies the floating-point environment. That is 
it provides information about the current value of the rounding mode in FPCR. 
If optimizer can deduce this value, it may set the appropriate value in all 
affected instruction. For example, in the following code:
```
call @llvm.set_rounding(i32 1)
%v = float call @llvm.trunc(float %x)
```
the call to `trunc` can be replaced with:
```
%v = float call @llvm.trunc(float %x) [ "fpe.control"(metadata !"rte") ]
```
The rounding mode in this bundle does not change the meaning of `trunc`, but 
could be useful in some cases. The two calls:
```
%v = float call @llvm.trunc(float %x) [ "fpe.control"(metadata !"rte") ]
%v = float call @llvm.trunc(float %x) [ "fpe.control"(metadata !"rtz") ]
```
represent the same operation, but on the target where `trunc` is implemented as 
`round using current mode` the latter instruction is implemented as one 
operation, while the former generally requires three operations (`set fpcr`, 
`nearbyint`, `set fpcr`). This is a hypothetical example however.

It seems the meaning of current rounding metadata argument in the constrained 
intrinsics agrees with this model, see discussion in 
https://discourse.llvm.org/t/static-rounding-mode-in-ir/80621. 

In this scenario it does not make much sense to exclude unused rounding mode 
from allowed bundles. The bundles can be set by optimizer in a simple way, 
without checking if the instruction uses rounding mode. We use a similar method 
in clang AST, where all relevant nodes have complete `FPOptions`.

(2) The rounding mode bundle specifies the rounding mode used for evaluating 
the instruction. Instructions like `trunc` do not depend on the specified 
rounding mode, so it does not make sense to use rounding bundles for them.

This viewpoint seems more natural since rounding is considered as a parameter 
of an operation, similar to arguments. It also can be naturally extended to 
static FP control modes. Rounding as a parameter produces exactly the same 
effect no matter if it is read from FPCR or specified in the instruction. Other 
FP options, such as denormal behavior, can be handled similarly.

Neither method has a clear-cut advantage, and we need to discuss which approach 
to take.

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


[clang] [llvm] [Clang][OpenMP] Support for dispatch construct (Sema & Codegen) support (PR #117904)

2024-12-16 Thread via cfe-commits

SunilKuravinakop wrote:

> update the openmp doc and clang release note as well?

Done.

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


[clang] [clang][dataflow] Add matchers for smart pointer accessors to be cached (PR #120102)

2024-12-16 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang

Author: Jan Voung (jvoung)


Changes

This is part 1 of caching for smart pointer accessors, building on top
of the CachedConstAccessorsLattice, which caches "normal" accessors.

Smart pointer accessors are a bit different in that they may:
- have aliases to access the same underlying data (but potentially
  returning slightly different types like `&` vs `*`). Within a
  "checked" sequence users may mix uses of the different aliases and the
  check should apply to any of the spellings.
- may have non-const overloads in addition to the const version, where
  the non-const doesn't actually modify the container

Part 2 will follow and add transfer functions utilities. It will also
add a user UncheckedOptionalAccessModel. We'd seen false positives when
nesting StatusOr> and 
optional>, etc. which this
can help address.


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


5 Files Affected:

- (added) 
clang/include/clang/Analysis/FlowSensitive/SmartPointerAccessorCaching.h (+63) 
- (modified) clang/lib/Analysis/FlowSensitive/CMakeLists.txt (+1) 
- (added) clang/lib/Analysis/FlowSensitive/SmartPointerAccessorCaching.cpp 
(+134) 
- (modified) clang/unittests/Analysis/FlowSensitive/CMakeLists.txt (+1) 
- (added) 
clang/unittests/Analysis/FlowSensitive/SmartPointerAccessorCachingTest.cpp 
(+194) 


``diff
diff --git 
a/clang/include/clang/Analysis/FlowSensitive/SmartPointerAccessorCaching.h 
b/clang/include/clang/Analysis/FlowSensitive/SmartPointerAccessorCaching.h
new file mode 100644
index 00..1adb63af4e724b
--- /dev/null
+++ b/clang/include/clang/Analysis/FlowSensitive/SmartPointerAccessorCaching.h
@@ -0,0 +1,63 @@
+//===-- SmartPointerAccessorCaching.h ---*- C++ 
-*-===//
+//
+// 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
+//
+//===--===//
+//
+// This file defines utilities to help cache accessors for smart pointer
+// like objects.
+//
+// These should be combined with CachedConstAccessorsLattice.
+// Beyond basic const accessors, smart pointers may have the following two
+// additional issues:
+//
+// 1) There may be multiple accessors for the same underlying object, e.g.
+//`operator->`, `operator*`, and `get`. Users may use a mixture of these
+//accessors, so the cache should unify them.
+//
+// 2) There may be non-const overloads of accessors. They are still safe to
+//cache, as they don't modify the container object.
+//===--===//
+
+#ifndef LLVM_CLANG_ANALYSIS_FLOWSENSITIVE_SMARTPOINTERACCESSORCACHING_H
+#define LLVM_CLANG_ANALYSIS_FLOWSENSITIVE_SMARTPOINTERACCESSORCACHING_H
+
+#include 
+
+#include "clang/AST/Decl.h"
+#include "clang/AST/Stmt.h"
+#include "clang/ASTMatchers/ASTMatchers.h"
+
+namespace clang::dataflow {
+
+/// Matchers:
+/// For now, these match on any class with an `operator*` or `operator->`
+/// where the return types have a similar shape as std::unique_ptr
+/// and std::optional.
+///
+/// - `*` returns a reference to a type `T`
+/// - `->` returns a pointer to `T`
+/// - `get` returns a pointer to `T`
+/// - `value` returns a reference `T`
+///
+/// (1) The `T` should all match across the accessors (ignoring qualifiers).
+///
+/// (2) The specific accessor used in a call isn't required to be const,
+/// but the class must have a const overload of each accessor.
+///
+/// For now, we don't have customization to ignore certain classes.
+/// For example, if writing a ClangTidy check for `std::optional`, these
+/// would also match `std::optional`. In order to have special handling
+/// for `std::optional`, we assume the (Matcher, TransferFunction) case
+/// with custom handling is ordered early so that these generic cases
+/// do not trigger.
+ast_matchers::internal::Matcher isSmartPointerLikeOperatorStar();
+ast_matchers::internal::Matcher isSmartPointerLikeOperatorArrow();
+ast_matchers::internal::Matcher isSmartPointerLikeValueMethodCall();
+ast_matchers::internal::Matcher isSmartPointerLikeGetMethodCall();
+
+} // namespace clang::dataflow
+
+#endif // LLVM_CLANG_ANALYSIS_FLOWSENSITIVE_SMARTPOINTERACCESSORCACHING_H
diff --git a/clang/lib/Analysis/FlowSensitive/CMakeLists.txt 
b/clang/lib/Analysis/FlowSensitive/CMakeLists.txt
index 05cdaa7e27823d..0c30df8b4b194f 100644
--- a/clang/lib/Analysis/FlowSensitive/CMakeLists.txt
+++ b/clang/lib/Analysis/FlowSensitive/CMakeLists.txt
@@ -10,6 +10,7 @@ add_clang_library(clangAnalysisFlowSensitive
   Logger.cpp
   RecordOps.cpp
   SimplifyConstraints.cpp
+  SmartPointerAccessorCaching.cpp
   Transfer.cpp
   TypeErasedDataflowAnalysis.cpp
   Value.cpp
diff --git a/clang/lib/Analysis/FlowSensitive/SmartPoin

[clang] [llvm] [HLSL] Adding Flatten and Branch if attributes (PR #116331)

2024-12-16 Thread via cfe-commits


@@ -2076,7 +2076,28 @@ void CodeGenFunction::EmitBranchOnBoolExpr(
 Weights = createProfileWeights(TrueCount, CurrentCount - TrueCount);
   }
 
-  Builder.CreateCondBr(CondV, TrueBlock, FalseBlock, Weights, Unpredictable);
+  auto *BrInst = Builder.CreateCondBr(CondV, TrueBlock, FalseBlock, Weights,
+  Unpredictable);
+  switch (HLSLControlFlowAttr) {
+  case HLSLControlFlowHintAttr::Microsoft_branch:
+  case HLSLControlFlowHintAttr::Microsoft_flatten: {
+llvm::MDBuilder MDHelper(CGM.getLLVMContext());
+
+llvm::ConstantInt *BranchHintConstant =
+HLSLControlFlowAttr ==
+HLSLControlFlowHintAttr::Spelling::Microsoft_branch
+? llvm::ConstantInt::get(CGM.Int32Ty, 1)
+: llvm::ConstantInt::get(CGM.Int32Ty, 2);
+
+SmallVector Vals(
+{MDHelper.createString("hlsl.controlflow.hint"),
+ MDHelper.createConstant(BranchHintConstant)});
+BrInst->setMetadata("hlsl.controlflow.hint",
+llvm::MDNode::get(CGM.getLLVMContext(), Vals));
+  } break;
+  case HLSLControlFlowHintAttr::SpellingNotCalculated:

joaosaffran wrote:

`SpellingNotCalculated` is the default value for `HLSLControlFlowAttr`. I 
noticed that this case doesn't make sense to exist, so I will remove it 

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


[clang] [clang][bytecode] Don't check returned pointers for liveness (PR #120107)

2024-12-16 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang

Author: Timm Baeder (tbaederr)


Changes

We're supposed to let them through and then later diagnose reading from them, 
but returning dead pointers is fine.

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


2 Files Affected:

- (modified) clang/lib/AST/ByteCode/Interp.h (-12) 
- (modified) clang/test/AST/ByteCode/functions.cpp (+6-10) 


``diff
diff --git a/clang/lib/AST/ByteCode/Interp.h b/clang/lib/AST/ByteCode/Interp.h
index f085f96fdf5391..2a6ea69475f787 100644
--- a/clang/lib/AST/ByteCode/Interp.h
+++ b/clang/lib/AST/ByteCode/Interp.h
@@ -318,18 +318,6 @@ template ::T>
 bool Ret(InterpState &S, CodePtr &PC) {
   const T &Ret = S.Stk.pop();
 
-  // Make sure returned pointers are live. We might be trying to return a
-  // pointer or reference to a local variable.
-  // Just return false, since a diagnostic has already been emitted in Sema.
-  if constexpr (std::is_same_v) {
-// FIXME: We could be calling isLive() here, but the emitted diagnostics
-// seem a little weird, at least if the returned expression is of
-// pointer type.
-// Null pointers are considered live here.
-if (!Ret.isZero() && !Ret.isLive())
-  return false;
-  }
-
   assert(S.Current);
   assert(S.Current->getFrameOffset() == S.Stk.size() && "Invalid frame");
   if (!S.checkingPotentialConstantExpression() || S.Current->Caller)
diff --git a/clang/test/AST/ByteCode/functions.cpp 
b/clang/test/AST/ByteCode/functions.cpp
index b00f59a8d8d433..10bea3a0d017e2 100644
--- a/clang/test/AST/ByteCode/functions.cpp
+++ b/clang/test/AST/ByteCode/functions.cpp
@@ -303,21 +303,17 @@ namespace ReturnLocalPtr {
 return &a; // both-warning {{address of stack memory}}
   }
 
-  /// GCC rejects the expression below, just like the new interpreter. The 
current interpreter
-  /// however accepts it and only warns about the function above returning an 
address to stack
-  /// memory. If we change the condition to 'p() != nullptr', it even succeeds.
-  static_assert(p() == nullptr, ""); // ref-error {{static assertion failed}} \
- // expected-error {{not an integral 
constant expression}}
-
-  /// FIXME: The current interpreter emits diagnostics in the reference case 
below, but the
-  /// new one does not.
+  /// FIXME: Both interpreters should diagnose this. We're returning a pointer 
to a local
+  /// variable.
+  static_assert(p() == nullptr, ""); // both-error {{static assertion failed}}
+
   constexpr const int &p2() {
-int a = 12; // ref-note {{declared here}}
+int a = 12; // both-note {{declared here}}
 return a; // both-warning {{reference to stack memory associated with 
local variable}}
   }
 
   static_assert(p2() == 12, ""); // both-error {{not an integral constant 
expression}} \
- // ref-note {{read of variable whose lifetime 
has ended}}
+ // both-note {{read of variable whose 
lifetime has ended}}
 }
 
 namespace VoidReturn {

``




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


[clang] [clang][bytecode] Don't check returned pointers for liveness (PR #120107)

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

https://github.com/tbaederr created 
https://github.com/llvm/llvm-project/pull/120107

We're supposed to let them through and then later diagnose reading from them, 
but returning dead pointers is fine.

>From 18b850cd8e6dfce416f7ab40feff3aad9c21a5bf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timm=20B=C3=A4der?= 
Date: Mon, 16 Dec 2024 16:56:10 +0100
Subject: [PATCH] [clang][bytecode] Don't check returned pointers for liveness

---
 clang/lib/AST/ByteCode/Interp.h   | 12 
 clang/test/AST/ByteCode/functions.cpp | 16 ++--
 2 files changed, 6 insertions(+), 22 deletions(-)

diff --git a/clang/lib/AST/ByteCode/Interp.h b/clang/lib/AST/ByteCode/Interp.h
index f085f96fdf5391..2a6ea69475f787 100644
--- a/clang/lib/AST/ByteCode/Interp.h
+++ b/clang/lib/AST/ByteCode/Interp.h
@@ -318,18 +318,6 @@ template ::T>
 bool Ret(InterpState &S, CodePtr &PC) {
   const T &Ret = S.Stk.pop();
 
-  // Make sure returned pointers are live. We might be trying to return a
-  // pointer or reference to a local variable.
-  // Just return false, since a diagnostic has already been emitted in Sema.
-  if constexpr (std::is_same_v) {
-// FIXME: We could be calling isLive() here, but the emitted diagnostics
-// seem a little weird, at least if the returned expression is of
-// pointer type.
-// Null pointers are considered live here.
-if (!Ret.isZero() && !Ret.isLive())
-  return false;
-  }
-
   assert(S.Current);
   assert(S.Current->getFrameOffset() == S.Stk.size() && "Invalid frame");
   if (!S.checkingPotentialConstantExpression() || S.Current->Caller)
diff --git a/clang/test/AST/ByteCode/functions.cpp 
b/clang/test/AST/ByteCode/functions.cpp
index b00f59a8d8d433..10bea3a0d017e2 100644
--- a/clang/test/AST/ByteCode/functions.cpp
+++ b/clang/test/AST/ByteCode/functions.cpp
@@ -303,21 +303,17 @@ namespace ReturnLocalPtr {
 return &a; // both-warning {{address of stack memory}}
   }
 
-  /// GCC rejects the expression below, just like the new interpreter. The 
current interpreter
-  /// however accepts it and only warns about the function above returning an 
address to stack
-  /// memory. If we change the condition to 'p() != nullptr', it even succeeds.
-  static_assert(p() == nullptr, ""); // ref-error {{static assertion failed}} \
- // expected-error {{not an integral 
constant expression}}
-
-  /// FIXME: The current interpreter emits diagnostics in the reference case 
below, but the
-  /// new one does not.
+  /// FIXME: Both interpreters should diagnose this. We're returning a pointer 
to a local
+  /// variable.
+  static_assert(p() == nullptr, ""); // both-error {{static assertion failed}}
+
   constexpr const int &p2() {
-int a = 12; // ref-note {{declared here}}
+int a = 12; // both-note {{declared here}}
 return a; // both-warning {{reference to stack memory associated with 
local variable}}
   }
 
   static_assert(p2() == 12, ""); // both-error {{not an integral constant 
expression}} \
- // ref-note {{read of variable whose lifetime 
has ended}}
+ // both-note {{read of variable whose 
lifetime has ended}}
 }
 
 namespace VoidReturn {

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


[clang] [NFC][webkit.UncountedLambdaCapturesChecker] Remove unnecessary check (PR #120069)

2024-12-16 Thread Balazs Benics via cfe-commits

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


[clang] [clang][dataflow] Add matchers for smart pointer accessors to be cached (PR #120102)

2024-12-16 Thread Jan Voung via cfe-commits

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


[clang] [HLSL] Codegen for `cbuffer` declarations without embedded arrays or structs (PR #119755)

2024-12-16 Thread Justin Bogner via cfe-commits


@@ -54,69 +54,110 @@ void addDxilValVersion(StringRef ValVersionStr, 
llvm::Module &M) {
   auto *DXILValMD = M.getOrInsertNamedMetadata(DXILValKey);
   DXILValMD->addOperand(Val);
 }
+
 void addDisableOptimizations(llvm::Module &M) {
   StringRef Key = "dx.disable_optimizations";
   M.addModuleFlag(llvm::Module::ModFlagBehavior::Override, Key, 1);
 }
-// cbuffer will be translated into global variable in special address space.
-// If translate into C,
-// cbuffer A {
-//   float a;
-//   float b;
-// }
-// float foo() { return a + b; }
-//
-// will be translated into
-//
-// struct A {
-//   float a;
-//   float b;
-// } cbuffer_A __attribute__((address_space(4)));
-// float foo() { return cbuffer_A.a + cbuffer_A.b; }
-//
-// layoutBuffer will create the struct A type.
-// replaceBuffer will replace use of global variable a and b with cbuffer_A.a
-// and cbuffer_A.b.
-//
-void layoutBuffer(CGHLSLRuntime::Buffer &Buf, const DataLayout &DL) {
-  if (Buf.Constants.empty())
-return;
+
+// Creates the LLVM struct type representing the shape of the constant buffer,
+// which will be included in the LLVM target type, and calculates the memory
+// layout and constant buffer layout offsets of each constant.
+static void layoutBuffer(CGHLSLRuntime::Buffer &Buf, const DataLayout &DL) {
+  assert(!Buf.Constants.empty() &&
+ "empty constant buffer should not be created");
 
   std::vector EltTys;
-  for (auto &Const : Buf.Constants) {
-GlobalVariable *GV = Const.first;
-Const.second = EltTys.size();
+  unsigned MemOffset = 0, CBufOffset = 0, Size = 0;
+
+  for (auto &C : Buf.Constants) {
+GlobalVariable *GV = C.GlobalVar;
 llvm::Type *Ty = GV->getValueType();
+
+assert(!Ty->isArrayTy() && !Ty->isStructTy() &&
+   "arrays and structs in cbuffer are not yet implemened");
+
+// scalar type, vector or matrix
 EltTys.emplace_back(Ty);
+unsigned FieldSize = Ty->getScalarSizeInBits() / 8;
+if (Ty->isVectorTy())
+  FieldSize *= cast(Ty)->getNumElements();
+assert(FieldSize <= 16 && "field side larger than constant buffer row");
+
+// set memory layout offset (no padding)
+C.MemOffset = MemOffset;
+MemOffset += FieldSize;
+
+// calculate cbuffer layout offset or update total cbuffer size from
+// packoffset annotations
+if (Buf.HasPackoffset) {
+  assert(C.CBufferOffset != UINT_MAX &&
+ "cbuffer offset should have been set from packoffset attribute");
+  unsigned OffsetAfterField = C.CBufferOffset + FieldSize;
+  if (Size < OffsetAfterField)
+Size = OffsetAfterField;
+} else {
+  // allign to the size of the field
+  CBufOffset = llvm::alignTo(CBufOffset, FieldSize);
+  C.CBufferOffset = CBufOffset;
+  CBufOffset += FieldSize;
+  Size = CBufOffset;
+}
   }
   Buf.LayoutStruct = llvm::StructType::get(EltTys[0]->getContext(), EltTys);
+  Buf.Size = Size;
 }
 
-GlobalVariable *replaceBuffer(CGHLSLRuntime::Buffer &Buf) {
-  // Create global variable for CB.
-  GlobalVariable *CBGV = new GlobalVariable(
-  Buf.LayoutStruct, /*isConstant*/ true,
-  GlobalValue::LinkageTypes::ExternalLinkage, nullptr,
-  llvm::formatv("{0}{1}", Buf.Name, Buf.IsCBuffer ? ".cb." : ".tb."),
-  GlobalValue::NotThreadLocal);
+// Creates LLVM target type target("dx.CBuffer",..) for the constant buffer.
+// The target type includes the LLVM struct type representing the shape
+// of the constant buffer, size, and a list of offsets for each fields
+// in cbuffer layout.
+static llvm::Type *getBufferTargetType(LLVMContext &Ctx,
+   CGHLSLRuntime::Buffer &Buf) {
+  assert(Buf.LayoutStruct != nullptr && Buf.Size != UINT_MAX &&
+ "the buffer layout has not been calculated yet");
+  llvm::SmallVector SizeAndOffsets;
+  SizeAndOffsets.reserve(Buf.Constants.size() + 1);
+  SizeAndOffsets.push_back(Buf.Size);
+  for (CGHLSLRuntime::BufferConstant &C : Buf.Constants) {
+SizeAndOffsets.push_back(C.CBufferOffset);
+  }
+  return llvm::TargetExtType::get(Ctx, "dx.CBuffer", {Buf.LayoutStruct},
+  SizeAndOffsets);

bogner wrote:

We shouldn't/can't be creating `dx.` target types here, it needs to be in 
`DirectXTargetCodeGenInfo`. That way we can properly handle SPIR-V and generic 
handling as needed.

I was thinking it would be nice if we could manufacture a buffer type here and 
just call `TargetCodeGenInfo::getHLSLType` in the runtime code, but if that 
isn't practical we may need to add another API hook instead.

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


[libunwind] [Libunwind] Don't XFAIL tests with msan (PR #120013)

2024-12-16 Thread Dmitry Chestnykh via cfe-commits

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


[clang] [Static analysis] Encodes a filename before inserting it into a URL. (PR #120123)

2024-12-16 Thread Ryosuke Niwa via cfe-commits

https://github.com/rniwa created 
https://github.com/llvm/llvm-project/pull/120123

This fixes a bug where report links generated from files such as 
StylePrimitiveNumericTypes+Conversions.h in WebKit result in an error.

>From ac1fd2653d009760b5cb46a2bf6c5d1c3f52fc41 Mon Sep 17 00:00:00 2001
From: Brianna Fan 
Date: Mon, 16 Dec 2024 10:29:05 -0800
Subject: [PATCH] [Static analysis] Encodes a filename before inserting it into
 a URL.

This fixes a bug where report links generated from files such as
StylePrimitiveNumericTypes+Conversions.h in WebKit result in an error.
---
 clang/tools/scan-build/bin/scan-build | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/clang/tools/scan-build/bin/scan-build 
b/clang/tools/scan-build/bin/scan-build
index 37241c6d85c5b2..1df043ef8b72bd 100755
--- a/clang/tools/scan-build/bin/scan-build
+++ b/clang/tools/scan-build/bin/scan-build
@@ -23,6 +23,7 @@ use Term::ANSIColor qw(:constants);
 use Cwd qw/ getcwd abs_path /;
 use Sys::Hostname;
 use Hash::Util qw(lock_keys);
+use URI::Escape;
 
 my $Prog = "scan-build";
 my $BuildName;
@@ -820,7 +821,8 @@ ENDTEXT
   }
 
   # Emit the "View" link.
-  print OUT "View Report";
+  my $EncodedReport = uri_escape($ReportFile, "^A-Za-z0-9\-\._~\/");
+  print OUT "View Report";
 
   # Emit REPORTBUG markers.
   print OUT "\n\n";

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


[libunwind] [Libunwind] Try to fix msan failures (PR #120013)

2024-12-16 Thread Dmitry Chestnykh via cfe-commits

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


[clang] Fix lld link issue for OHOS (PR #118192)

2024-12-16 Thread Peng Huang via cfe-commits

phuang wrote:

I found out how to run the test, but I cannot reproduce the problem with my 
change. I run the test with below steps:

1: `cmake -S llvm -B build -G Ninja -DCMAKE_BUILD_TYPE=Release 
-DLLVM_ENABLE_PROJECTS="clang;lld"`
2: `ninja -C build`
3: `./build/bin/llvm-lit  ./clang/test/Driver/ohos.c -a -v
`

I checked the compile log at http://45.33.8.238/linux/155432/step_3.txt , it 
only compiles around 1000 files. But in my tree, it  compiles 5329 files. @nico 
do you know why? what's your build steps? 



https://github.com/llvm/llvm-project/pull/118192
___
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 readability-string-view-substr check (PR #120055)

2024-12-16 Thread Helmut Januschka via cfe-commits

https://github.com/hjanuschka updated 
https://github.com/llvm/llvm-project/pull/120055

>From 8b2dc9adf4fae2065823e5beb3a1cd851686913c Mon Sep 17 00:00:00 2001
From: Helmut Januschka 
Date: Mon, 16 Dec 2024 08:24:14 +0100
Subject: [PATCH 1/3] [clang-tidy] Add readability-string-view-substr check

Add a new check that suggests using string_view::remove_prefix() and
remove_suffix() instead of substr() when the intent is to remove
characters from either end of a string_view.
---
 .../clang-tidy/readability/CMakeLists.txt |   1 +
 .../readability/ReadabilityTidyModule.cpp |   3 +
 .../readability/StringViewSubstrCheck.cpp | 132 ++
 .../readability/StringViewSubstrCheck.h   |  39 ++
 clang-tools-extra/docs/ReleaseNotes.rst   |   7 +
 .../checks/readability/string-view-substr.rst |  16 +++
 .../readability/stringview_substr.cpp |  55 
 7 files changed, 253 insertions(+)
 create mode 100644 
clang-tools-extra/clang-tidy/readability/StringViewSubstrCheck.cpp
 create mode 100644 
clang-tools-extra/clang-tidy/readability/StringViewSubstrCheck.h
 create mode 100644 
clang-tools-extra/docs/clang-tidy/checks/readability/string-view-substr.rst
 create mode 100644 
clang-tools-extra/test/clang-tidy/checkers/readability/stringview_substr.cpp

diff --git a/clang-tools-extra/clang-tidy/readability/CMakeLists.txt 
b/clang-tools-extra/clang-tidy/readability/CMakeLists.txt
index 8f303c51e1b0da..8b44fc339441ac 100644
--- a/clang-tools-extra/clang-tidy/readability/CMakeLists.txt
+++ b/clang-tools-extra/clang-tidy/readability/CMakeLists.txt
@@ -53,6 +53,7 @@ add_clang_library(clangTidyReadabilityModule STATIC
   StaticAccessedThroughInstanceCheck.cpp
   StaticDefinitionInAnonymousNamespaceCheck.cpp
   StringCompareCheck.cpp
+  StringViewSubstrCheck.cpp
   SuspiciousCallArgumentCheck.cpp
   UniqueptrDeleteReleaseCheck.cpp
   UppercaseLiteralSuffixCheck.cpp
diff --git a/clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp 
b/clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp
index d61c0ba39658e5..f36ec8f95ede60 100644
--- a/clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp
+++ b/clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp
@@ -56,6 +56,7 @@
 #include "StaticAccessedThroughInstanceCheck.h"
 #include "StaticDefinitionInAnonymousNamespaceCheck.h"
 #include "StringCompareCheck.h"
+#include "StringViewSubstrCheck.h"
 #include "SuspiciousCallArgumentCheck.h"
 #include "UniqueptrDeleteReleaseCheck.h"
 #include "UppercaseLiteralSuffixCheck.h"
@@ -146,6 +147,8 @@ class ReadabilityModule : public ClangTidyModule {
 "readability-static-definition-in-anonymous-namespace");
 CheckFactories.registerCheck(
 "readability-string-compare");
+CheckFactories.registerCheck(
+"readability-stringview-substr");
 CheckFactories.registerCheck(
 "readability-named-parameter");
 CheckFactories.registerCheck(
diff --git a/clang-tools-extra/clang-tidy/readability/StringViewSubstrCheck.cpp 
b/clang-tools-extra/clang-tidy/readability/StringViewSubstrCheck.cpp
new file mode 100644
index 00..e86a971695a835
--- /dev/null
+++ b/clang-tools-extra/clang-tidy/readability/StringViewSubstrCheck.cpp
@@ -0,0 +1,132 @@
+//===--- StringViewSubstrCheck.cpp - clang-tidy--*- C++ 
-*-===//
+//
+// 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 "StringViewSubstrCheck.h"
+#include "clang/AST/ASTContext.h"
+#include "clang/ASTMatchers/ASTMatchFinder.h"
+#include "clang/Lex/Lexer.h"
+
+using namespace clang::ast_matchers;
+
+namespace clang::tidy::readability {
+
+void StringViewSubstrCheck::registerMatchers(MatchFinder *Finder) {
+  const auto HasStringViewType = 
hasType(hasUnqualifiedDesugaredType(recordType(
+  hasDeclaration(recordDecl(hasName("::std::basic_string_view"));
+
+  // Match assignment to string_view's substr
+  Finder->addMatcher(
+  cxxOperatorCallExpr(
+  hasOverloadedOperatorName("="),
+  hasArgument(0, expr(HasStringViewType).bind("target")),
+  hasArgument(
+  1, cxxMemberCallExpr(callee(memberExpr(hasDeclaration(
+   cxxMethodDecl(hasName("substr"),
+   on(expr(HasStringViewType).bind("source")))
+ .bind("substr_call")))
+  .bind("assignment"),
+  this);
+}
+
+void StringViewSubstrCheck::check(const MatchFinder::MatchResult &Result) {
+  const auto *Assignment =
+  Result.Nodes.getNodeAs("assignment");
+  const auto *Target = Result.Nodes.getNodeAs("target");
+  const auto *Source = Result.Nodes.getNodeAs("source");
+  const auto *SubstrCall =
+  Result.Nod

[clang] [ExtractAPI] reorder the module names in extension symbol graph file names (PR #119925)

2024-12-16 Thread via cfe-commits

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


[clang] [llvm] [Driver][clang-linker-wrapper] Add initial support for OpenMP offloading to generic SPIR-V (PR #120145)

2024-12-16 Thread Nick Sarnie via cfe-commits

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

This is the first of a series of patches to add support for OpenMP offloading 
to SPIR-V through liboffload with the first intended target being Intel GPUs. 
This patch implements the basic driver and `clang-linker-wrapper` work for JIT 
mode. There are still many missing pieces, so this is not yet usable.

We introduce `spirv64-intel-unknown` as the only currently supported triple. 
The user-facing argument to enable offloading will be `-fopenmp 
-fopenmp-targets=spirv64-intel`

Add a new `SPIRVOpenMPToolChain` toolchain based on the existing general SPIR-V 
toolchain which will call all the required SPIR-V tools (and eventually the 
SPIR-V backend) as well as add the corresponding device RTL as an argument to 
the linker.

As there is no production quality SPIR-V linker available, manually create an 
ELF binary containing the offloading image in a way that fits into the existing 
`liboffload` plugin infrastructure. This ELF will eventually be passed to a 
runtime plugin that interacts with the Intel GPU runtime.

There is also a small fix to an issue I found when trying to assemble SPIR-V 
when in text format.

>From e1b9b503b1e9b8ebf5a9c94dcefd0c47ab009019 Mon Sep 17 00:00:00 2001
From: "Sarnie, Nick" 
Date: Mon, 16 Dec 2024 09:25:44 -0800
Subject: [PATCH] [Driver][clang-linker-wrapper] Add initial support for OpenMP
 offloading to generic SPIR-V

This is the first of a series of patches to add support for OpenMP offloading 
to SPIR-V through liboffload with the first intended target being Intel GPUs. 
This patch implements the basic driver and `clang-linker-wrapper` work for JIT 
mode. There are still many missing pieces, so this is not yet usable.

We introduce `spirv64-intel-unknown` as the only currently supported triple. 
The user-facing argument to enable offloading will be `-fopenmp 
-fopenmp-targets=spirv64-intel`

Add a new `SPIRVOpenMPToolChain` toolchain based on the existing general SPIR-V 
toolchain which will call all the required SPIR-V tools as well as add the 
device RTL as an argument to the linker.

As there is no production quality SPIR-V linker available, manually create an 
ELF binary containing the offloading image in a way that fits into the existing 
`liboffload` infrastructure. This ELF will eventually be passed to a runtime 
plugin that interacts with the Intel GPU runtime.

There is also a small fix to an issue I found when trying to assemble SPIR-V 
when in text format.

Signed-off-by: Sarnie, Nick 
---
 clang/include/clang/Driver/Options.td |  2 +
 clang/lib/Driver/CMakeLists.txt   |  1 +
 clang/lib/Driver/Driver.cpp   | 40 +++--
 clang/lib/Driver/ToolChains/CommonArgs.cpp|  9 +-
 clang/lib/Driver/ToolChains/SPIRV.cpp |  5 +-
 clang/lib/Driver/ToolChains/SPIRV.h   |  2 +-
 clang/lib/Driver/ToolChains/SPIRVOpenMP.cpp   | 36 
 clang/lib/Driver/ToolChains/SPIRVOpenMP.h | 29 +++
 clang/lib/Frontend/CompilerInvocation.cpp |  1 +
 .../lib/libomptarget-spirv64-spirv64-intel.bc |  0
 clang/test/Driver/spirv-openmp-toolchain.c| 71 +++
 clang/test/Driver/spirv-toolchain.cl  |  6 +-
 .../ClangLinkerWrapper.cpp| 17 ++--
 .../llvm/Frontend/Offloading/Utility.h|  5 ++
 llvm/include/llvm/TargetParser/Triple.h   |  3 +-
 llvm/lib/Frontend/Offloading/CMakeLists.txt   |  1 +
 llvm/lib/Frontend/Offloading/Utility.cpp  | 86 +++
 llvm/lib/TargetParser/Triple.cpp  |  2 +
 18 files changed, 296 insertions(+), 20 deletions(-)
 create mode 100644 clang/lib/Driver/ToolChains/SPIRVOpenMP.cpp
 create mode 100644 clang/lib/Driver/ToolChains/SPIRVOpenMP.h
 create mode 100644 
clang/test/Driver/Inputs/spirv-openmp/lib/libomptarget-spirv64-spirv64-intel.bc
 create mode 100644 clang/test/Driver/spirv-openmp-toolchain.c

diff --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index bed2a56b003512..a46fa1353af587 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -1493,6 +1493,8 @@ def libomptarget_amdgcn_bc_path_EQ : Joined<["--"], 
"libomptarget-amdgcn-bc-path
   HelpText<"Path to libomptarget-amdgcn bitcode library">, 
Alias;
 def libomptarget_nvptx_bc_path_EQ : Joined<["--"], 
"libomptarget-nvptx-bc-path=">, Group,
   HelpText<"Path to libomptarget-nvptx bitcode library">;
+def libomptarget_spirv_bc_path_EQ : Joined<["--"], 
"libomptarget-spirv-bc-path=">, Group,
+  HelpText<"Path to libomptarget-spirv bitcode library">;
 def dD : Flag<["-"], "dD">, Group, Visibility<[ClangOption, 
CC1Option]>,
   HelpText<"Print macro definitions in -E mode in addition to normal output">;
 def dI : Flag<["-"], "dI">, Group, Visibility<[ClangOption, 
CC1Option]>,
diff --git a/clang/lib/Driver/CMakeLists.txt b/clang/lib/Driver/CMakeLists.txt
index 4fd10bf671512f..57d04c3fefa843 100644
--- a/

[clang] Reland [Clang] skip default argument instantiation for non-defining friend declarations to meet [dcl.fct.default] p4 (PR #115487)

2024-12-16 Thread Oleksandr T. via cfe-commits

https://github.com/a-tarasyuk updated 
https://github.com/llvm/llvm-project/pull/115487

>From 5e24d212f797b5fa1b6da1526c807046373d3c21 Mon Sep 17 00:00:00 2001
From: Oleksandr T 
Date: Fri, 8 Nov 2024 16:13:17 +0200
Subject: [PATCH 1/6] [Clang] skip default argument instantiation for
 non-defining friend declarations to meet [dcl.fct.default] p4

---
 clang/docs/ReleaseNotes.rst   |  2 +
 .../lib/Sema/SemaTemplateInstantiateDecl.cpp  |  4 ++
 clang/test/CXX/temp/temp.res/p4.cpp   | 43 +++
 3 files changed, 49 insertions(+)

diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index d0c43ff11f7bae..e8cf6fc50a1290 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -636,6 +636,8 @@ Bug Fixes to C++ Support
   an implicitly instantiated class template specialization. (#GH51051)
 - Fixed an assertion failure caused by invalid enum forward declarations. 
(#GH112208)
 - Name independent data members were not correctly initialized from default 
member initializers. (#GH114069)
+- Fixed an assertion failure caused by invalid default argument substitutions 
in non-defining
+  friend declarations. (#GH113324).
 
 Bug Fixes to AST Handling
 ^
diff --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp 
b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
index 5a001843e2ba46..200519c71c57ab 100644
--- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -4694,6 +4694,10 @@ bool Sema::InstantiateDefaultArgument(SourceLocation 
CallLoc, FunctionDecl *FD,
   ParmVarDecl *Param) {
   assert(Param->hasUninstantiatedDefaultArg());
 
+  if (FD->getFriendObjectKind() != Decl::FOK_None &&
+  !FD->getTemplateInstantiationPattern())
+return true;
+
   // Instantiate the expression.
   //
   // FIXME: Pass in a correct Pattern argument, otherwise
diff --git a/clang/test/CXX/temp/temp.res/p4.cpp 
b/clang/test/CXX/temp/temp.res/p4.cpp
index f54d8649f5da88..cf6c45b4c351c5 100644
--- a/clang/test/CXX/temp/temp.res/p4.cpp
+++ b/clang/test/CXX/temp/temp.res/p4.cpp
@@ -185,3 +185,46 @@ template struct S {
   friend void X::f(T::type);
 };
 }
+
+namespace GH113324 {
+template  struct S1 {
+  friend void f1(S1, int = 0); // expected-error {{friend declaration 
specifying a default argument must be a definition}}
+  friend void f2(S1 a, S1 = decltype(a){}); // expected-error {{friend 
declaration specifying a default argument must be a definition}}
+};
+
+template  using alias = int;
+template  struct S2 {
+  // FIXME: We miss diagnosing the default argument instantiation failure
+  // (forming reference to void)
+  friend void f3(S2, int a = alias(1)); // expected-error {{friend 
declaration specifying a default argument must be a definition}}
+};
+
+struct S3 {
+  friend void f4(S3, int = 42) { }
+};
+
+template  using __enable_if_t = int;
+template  struct S4 {
+  static const int value = v;
+};
+struct S5 {
+  template <__enable_if_t::value, int> = 0>
+  S5(const char *);
+};
+struct S6 {
+  template 
+  friend void f5(int, S6, a, b, S5 = "") { }
+};
+
+void test() {
+  f1(S1<>{});
+  f2(S1<>{});
+  f3(S2());
+
+  S3 s3;
+  f4(s3);
+
+  S6 s6;
+  auto result = f5(0, s6, [] {}, [] {}); // expected-error {{variable has 
incomplete type 'void}}
+}
+} // namespace GH113324

>From 3ad3b6c5f35730be32f4f6ba2dc8d19f53be0442 Mon Sep 17 00:00:00 2001
From: Oleksandr T 
Date: Fri, 8 Nov 2024 16:53:39 +0200
Subject: [PATCH 2/6] update comments

---
 clang/lib/Sema/SemaTemplateInstantiateDecl.cpp | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp 
b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
index 200519c71c57ab..0bbab95001ad8e 100644
--- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -4694,6 +4694,13 @@ bool Sema::InstantiateDefaultArgument(SourceLocation 
CallLoc, FunctionDecl *FD,
   ParmVarDecl *Param) {
   assert(Param->hasUninstantiatedDefaultArg());
 
+  // FIXME: We don't track member specialization info for non-defining
+  // friend declarations, so we will not be able to later find the function
+  // pattern. As a workaround, don't instantiate the default argument in this
+  // case. This is correct per wording and only an error recovery issue, as per
+  // [dcl.fct.default]p4:
+  //   if a friend declaration D specifies a default argument expression,
+  //   that declaration shall be a definition.
   if (FD->getFriendObjectKind() != Decl::FOK_None &&
   !FD->getTemplateInstantiationPattern())
 return true;

>From 09215dea0212368ef54956d8464788cc4b88cc02 Mon Sep 17 00:00:00 2001
From: Oleksandr T 
Date: Thu, 21 Nov 2024 16:56:11 +0200
Subject: [PATCH 3/6] move cases that cause code generation failures to the
 appropriate folder

---
 clang/test/CXX/temp/temp.res/p4.cpp | 23

[clang] [llvm] [Driver][clang-linker-wrapper] Add initial support for OpenMP offloading to generic SPIR-V (PR #120145)

2024-12-16 Thread via cfe-commits

github-actions[bot] wrote:




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



You can test this locally with the following command:


``bash
git-clang-format --diff a9237b1a1083c7c6c4778e8a586d329bc41a6adc 
e1b9b503b1e9b8ebf5a9c94dcefd0c47ab009019 --extensions h,c,cpp -- 
clang/lib/Driver/ToolChains/SPIRVOpenMP.cpp 
clang/lib/Driver/ToolChains/SPIRVOpenMP.h 
clang/test/Driver/spirv-openmp-toolchain.c clang/lib/Driver/Driver.cpp 
clang/lib/Driver/ToolChains/CommonArgs.cpp 
clang/lib/Driver/ToolChains/SPIRV.cpp clang/lib/Driver/ToolChains/SPIRV.h 
clang/lib/Frontend/CompilerInvocation.cpp 
clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp 
llvm/include/llvm/Frontend/Offloading/Utility.h 
llvm/include/llvm/TargetParser/Triple.h 
llvm/lib/Frontend/Offloading/Utility.cpp llvm/lib/TargetParser/Triple.cpp
``





View the diff from clang-format here.


``diff
diff --git a/llvm/lib/TargetParser/Triple.cpp b/llvm/lib/TargetParser/Triple.cpp
index 3b0620bf5b..26263d7463 100644
--- a/llvm/lib/TargetParser/Triple.cpp
+++ b/llvm/lib/TargetParser/Triple.cpp
@@ -241,7 +241,8 @@ StringRef Triple::getVendorTypeName(VendorType Kind) {
   case Freescale: return "fsl";
   case IBM: return "ibm";
   case ImaginationTechnologies: return "img";
-  case Intel: return "intel";
+  case Intel:
+return "intel";
   case Mesa: return "mesa";
   case MipsTechnologies: return "mti";
   case NVIDIA: return "nvidia";
@@ -628,22 +629,22 @@ static Triple::ArchType parseArch(StringRef ArchName) {
 
 static Triple::VendorType parseVendor(StringRef VendorName) {
   return StringSwitch(VendorName)
-.Case("apple", Triple::Apple)
-.Case("pc", Triple::PC)
-.Case("scei", Triple::SCEI)
-.Case("sie", Triple::SCEI)
-.Case("fsl", Triple::Freescale)
-.Case("ibm", Triple::IBM)
-.Case("img", Triple::ImaginationTechnologies)
-.Case("intel", Triple::Intel)
-.Case("mti", Triple::MipsTechnologies)
-.Case("nvidia", Triple::NVIDIA)
-.Case("csr", Triple::CSR)
-.Case("amd", Triple::AMD)
-.Case("mesa", Triple::Mesa)
-.Case("suse", Triple::SUSE)
-.Case("oe", Triple::OpenEmbedded)
-.Default(Triple::UnknownVendor);
+  .Case("apple", Triple::Apple)
+  .Case("pc", Triple::PC)
+  .Case("scei", Triple::SCEI)
+  .Case("sie", Triple::SCEI)
+  .Case("fsl", Triple::Freescale)
+  .Case("ibm", Triple::IBM)
+  .Case("img", Triple::ImaginationTechnologies)
+  .Case("intel", Triple::Intel)
+  .Case("mti", Triple::MipsTechnologies)
+  .Case("nvidia", Triple::NVIDIA)
+  .Case("csr", Triple::CSR)
+  .Case("amd", Triple::AMD)
+  .Case("mesa", Triple::Mesa)
+  .Case("suse", Triple::SUSE)
+  .Case("oe", Triple::OpenEmbedded)
+  .Default(Triple::UnknownVendor);
 }
 
 static Triple::OSType parseOS(StringRef OSName) {

``




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


[clang] [llvm] [Driver][clang-linker-wrapper] Add initial support for OpenMP offloading to generic SPIR-V (PR #120145)

2024-12-16 Thread Nick Sarnie via cfe-commits

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

>From e1b9b503b1e9b8ebf5a9c94dcefd0c47ab009019 Mon Sep 17 00:00:00 2001
From: "Sarnie, Nick" 
Date: Mon, 16 Dec 2024 09:25:44 -0800
Subject: [PATCH 1/2] [Driver][clang-linker-wrapper] Add initial support for
 OpenMP offloading to generic SPIR-V

This is the first of a series of patches to add support for OpenMP offloading 
to SPIR-V through liboffload with the first intended target being Intel GPUs. 
This patch implements the basic driver and `clang-linker-wrapper` work for JIT 
mode. There are still many missing pieces, so this is not yet usable.

We introduce `spirv64-intel-unknown` as the only currently supported triple. 
The user-facing argument to enable offloading will be `-fopenmp 
-fopenmp-targets=spirv64-intel`

Add a new `SPIRVOpenMPToolChain` toolchain based on the existing general SPIR-V 
toolchain which will call all the required SPIR-V tools as well as add the 
device RTL as an argument to the linker.

As there is no production quality SPIR-V linker available, manually create an 
ELF binary containing the offloading image in a way that fits into the existing 
`liboffload` infrastructure. This ELF will eventually be passed to a runtime 
plugin that interacts with the Intel GPU runtime.

There is also a small fix to an issue I found when trying to assemble SPIR-V 
when in text format.

Signed-off-by: Sarnie, Nick 
---
 clang/include/clang/Driver/Options.td |  2 +
 clang/lib/Driver/CMakeLists.txt   |  1 +
 clang/lib/Driver/Driver.cpp   | 40 +++--
 clang/lib/Driver/ToolChains/CommonArgs.cpp|  9 +-
 clang/lib/Driver/ToolChains/SPIRV.cpp |  5 +-
 clang/lib/Driver/ToolChains/SPIRV.h   |  2 +-
 clang/lib/Driver/ToolChains/SPIRVOpenMP.cpp   | 36 
 clang/lib/Driver/ToolChains/SPIRVOpenMP.h | 29 +++
 clang/lib/Frontend/CompilerInvocation.cpp |  1 +
 .../lib/libomptarget-spirv64-spirv64-intel.bc |  0
 clang/test/Driver/spirv-openmp-toolchain.c| 71 +++
 clang/test/Driver/spirv-toolchain.cl  |  6 +-
 .../ClangLinkerWrapper.cpp| 17 ++--
 .../llvm/Frontend/Offloading/Utility.h|  5 ++
 llvm/include/llvm/TargetParser/Triple.h   |  3 +-
 llvm/lib/Frontend/Offloading/CMakeLists.txt   |  1 +
 llvm/lib/Frontend/Offloading/Utility.cpp  | 86 +++
 llvm/lib/TargetParser/Triple.cpp  |  2 +
 18 files changed, 296 insertions(+), 20 deletions(-)
 create mode 100644 clang/lib/Driver/ToolChains/SPIRVOpenMP.cpp
 create mode 100644 clang/lib/Driver/ToolChains/SPIRVOpenMP.h
 create mode 100644 
clang/test/Driver/Inputs/spirv-openmp/lib/libomptarget-spirv64-spirv64-intel.bc
 create mode 100644 clang/test/Driver/spirv-openmp-toolchain.c

diff --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index bed2a56b003512..a46fa1353af587 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -1493,6 +1493,8 @@ def libomptarget_amdgcn_bc_path_EQ : Joined<["--"], 
"libomptarget-amdgcn-bc-path
   HelpText<"Path to libomptarget-amdgcn bitcode library">, 
Alias;
 def libomptarget_nvptx_bc_path_EQ : Joined<["--"], 
"libomptarget-nvptx-bc-path=">, Group,
   HelpText<"Path to libomptarget-nvptx bitcode library">;
+def libomptarget_spirv_bc_path_EQ : Joined<["--"], 
"libomptarget-spirv-bc-path=">, Group,
+  HelpText<"Path to libomptarget-spirv bitcode library">;
 def dD : Flag<["-"], "dD">, Group, Visibility<[ClangOption, 
CC1Option]>,
   HelpText<"Print macro definitions in -E mode in addition to normal output">;
 def dI : Flag<["-"], "dI">, Group, Visibility<[ClangOption, 
CC1Option]>,
diff --git a/clang/lib/Driver/CMakeLists.txt b/clang/lib/Driver/CMakeLists.txt
index 4fd10bf671512f..57d04c3fefa843 100644
--- a/clang/lib/Driver/CMakeLists.txt
+++ b/clang/lib/Driver/CMakeLists.txt
@@ -77,6 +77,7 @@ add_clang_library(clangDriver
   ToolChains/RISCVToolchain.cpp
   ToolChains/Solaris.cpp
   ToolChains/SPIRV.cpp
+  ToolChains/SPIRVOpenMP.cpp
   ToolChains/TCE.cpp
   ToolChains/UEFI.cpp
   ToolChains/VEToolchain.cpp
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index dc84c1b9d1cc4e..c74a474f487d95 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -43,6 +43,7 @@
 #include "ToolChains/PS4CPU.h"
 #include "ToolChains/RISCVToolchain.h"
 #include "ToolChains/SPIRV.h"
+#include "ToolChains/SPIRVOpenMP.h"
 #include "ToolChains/Solaris.h"
 #include "ToolChains/TCE.h"
 #include "ToolChains/UEFI.h"
@@ -166,6 +167,20 @@ getHIPOffloadTargetTriple(const Driver &D, const ArgList 
&Args) {
   return std::nullopt;
 }
 
+static std::optional
+getSPIRVOffloadTargetTriple(const Driver &D, const ArgList &Args) {
+  if (!Args.hasArg(options::OPT_offload_EQ))
+return llvm::Triple(
+"spirv64-intel"); // Only vendor "intel" is currently supported.
+  auto TT = getOffloadTargetTripl

[clang] [llvm] [HLSL] Implement elementwise firstbitlow builtin (PR #116858)

2024-12-16 Thread Ashley Coleman via cfe-commits

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


[clang] [clang] Fix crashes when passing VLA to va_arg (PR #119563)

2024-12-16 Thread via cfe-commits

github-actions[bot] wrote:




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



You can test this locally with the following command:


``bash
git-clang-format --diff f4081711f0884ec7afe93577e118ecc89cb7b1cf 
7dcd400df3670d749902ab04485974ba843415f2 --extensions c,cpp -- 
clang/lib/CodeGen/CGCall.cpp clang/lib/CodeGen/CGExprScalar.cpp 
clang/lib/Sema/SemaExpr.cpp clang/test/CodeGen/xcore-abi.c 
clang/test/Sema/varargs.c
``





View the diff from clang-format here.


``diff
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index fca678e024..4c1cb82219 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -16540,9 +16540,9 @@ ExprResult Sema::BuildVAArgExpr(SourceLocation 
BuiltinLoc,
 
 if (TInfo->getType()->isArrayType()) {
   DiagRuntimeBehavior(TInfo->getTypeLoc().getBeginLoc(), E,
-  PDiag(diag::warn_second_parameter_to_va_arg_array)
-  << TInfo->getType()
-  << TInfo->getTypeLoc().getSourceRange());
+  PDiag(diag::warn_second_parameter_to_va_arg_array)
+  << TInfo->getType()
+  << TInfo->getTypeLoc().getSourceRange());
 }
 
 // Check for va_arg where arguments of the given type will be promoted

``




https://github.com/llvm/llvm-project/pull/119563
___
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 readability-string-view-substr check (PR #120055)

2024-12-16 Thread Helmut Januschka via cfe-commits

https://github.com/hjanuschka updated 
https://github.com/llvm/llvm-project/pull/120055

>From 8b2dc9adf4fae2065823e5beb3a1cd851686913c Mon Sep 17 00:00:00 2001
From: Helmut Januschka 
Date: Mon, 16 Dec 2024 08:24:14 +0100
Subject: [PATCH 1/4] [clang-tidy] Add readability-string-view-substr check

Add a new check that suggests using string_view::remove_prefix() and
remove_suffix() instead of substr() when the intent is to remove
characters from either end of a string_view.
---
 .../clang-tidy/readability/CMakeLists.txt |   1 +
 .../readability/ReadabilityTidyModule.cpp |   3 +
 .../readability/StringViewSubstrCheck.cpp | 132 ++
 .../readability/StringViewSubstrCheck.h   |  39 ++
 clang-tools-extra/docs/ReleaseNotes.rst   |   7 +
 .../checks/readability/string-view-substr.rst |  16 +++
 .../readability/stringview_substr.cpp |  55 
 7 files changed, 253 insertions(+)
 create mode 100644 
clang-tools-extra/clang-tidy/readability/StringViewSubstrCheck.cpp
 create mode 100644 
clang-tools-extra/clang-tidy/readability/StringViewSubstrCheck.h
 create mode 100644 
clang-tools-extra/docs/clang-tidy/checks/readability/string-view-substr.rst
 create mode 100644 
clang-tools-extra/test/clang-tidy/checkers/readability/stringview_substr.cpp

diff --git a/clang-tools-extra/clang-tidy/readability/CMakeLists.txt 
b/clang-tools-extra/clang-tidy/readability/CMakeLists.txt
index 8f303c51e1b0da..8b44fc339441ac 100644
--- a/clang-tools-extra/clang-tidy/readability/CMakeLists.txt
+++ b/clang-tools-extra/clang-tidy/readability/CMakeLists.txt
@@ -53,6 +53,7 @@ add_clang_library(clangTidyReadabilityModule STATIC
   StaticAccessedThroughInstanceCheck.cpp
   StaticDefinitionInAnonymousNamespaceCheck.cpp
   StringCompareCheck.cpp
+  StringViewSubstrCheck.cpp
   SuspiciousCallArgumentCheck.cpp
   UniqueptrDeleteReleaseCheck.cpp
   UppercaseLiteralSuffixCheck.cpp
diff --git a/clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp 
b/clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp
index d61c0ba39658e5..f36ec8f95ede60 100644
--- a/clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp
+++ b/clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp
@@ -56,6 +56,7 @@
 #include "StaticAccessedThroughInstanceCheck.h"
 #include "StaticDefinitionInAnonymousNamespaceCheck.h"
 #include "StringCompareCheck.h"
+#include "StringViewSubstrCheck.h"
 #include "SuspiciousCallArgumentCheck.h"
 #include "UniqueptrDeleteReleaseCheck.h"
 #include "UppercaseLiteralSuffixCheck.h"
@@ -146,6 +147,8 @@ class ReadabilityModule : public ClangTidyModule {
 "readability-static-definition-in-anonymous-namespace");
 CheckFactories.registerCheck(
 "readability-string-compare");
+CheckFactories.registerCheck(
+"readability-stringview-substr");
 CheckFactories.registerCheck(
 "readability-named-parameter");
 CheckFactories.registerCheck(
diff --git a/clang-tools-extra/clang-tidy/readability/StringViewSubstrCheck.cpp 
b/clang-tools-extra/clang-tidy/readability/StringViewSubstrCheck.cpp
new file mode 100644
index 00..e86a971695a835
--- /dev/null
+++ b/clang-tools-extra/clang-tidy/readability/StringViewSubstrCheck.cpp
@@ -0,0 +1,132 @@
+//===--- StringViewSubstrCheck.cpp - clang-tidy--*- C++ 
-*-===//
+//
+// 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 "StringViewSubstrCheck.h"
+#include "clang/AST/ASTContext.h"
+#include "clang/ASTMatchers/ASTMatchFinder.h"
+#include "clang/Lex/Lexer.h"
+
+using namespace clang::ast_matchers;
+
+namespace clang::tidy::readability {
+
+void StringViewSubstrCheck::registerMatchers(MatchFinder *Finder) {
+  const auto HasStringViewType = 
hasType(hasUnqualifiedDesugaredType(recordType(
+  hasDeclaration(recordDecl(hasName("::std::basic_string_view"));
+
+  // Match assignment to string_view's substr
+  Finder->addMatcher(
+  cxxOperatorCallExpr(
+  hasOverloadedOperatorName("="),
+  hasArgument(0, expr(HasStringViewType).bind("target")),
+  hasArgument(
+  1, cxxMemberCallExpr(callee(memberExpr(hasDeclaration(
+   cxxMethodDecl(hasName("substr"),
+   on(expr(HasStringViewType).bind("source")))
+ .bind("substr_call")))
+  .bind("assignment"),
+  this);
+}
+
+void StringViewSubstrCheck::check(const MatchFinder::MatchResult &Result) {
+  const auto *Assignment =
+  Result.Nodes.getNodeAs("assignment");
+  const auto *Target = Result.Nodes.getNodeAs("target");
+  const auto *Source = Result.Nodes.getNodeAs("source");
+  const auto *SubstrCall =
+  Result.Nod

[clang] df0b34c - [OpenACC/NFC] Fix 'trailing objects' CRTP.

2024-12-16 Thread via cfe-commits

Author: erichkeane
Date: 2024-12-16T12:43:45-08:00
New Revision: df0b34cbeb822c81fec43390663659bea97dd2ae

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

LOG: [OpenACC/NFC] Fix 'trailing objects' CRTP.

A previous patch mistakenly set the CRTP object for the trailing objects
incorrectly.  This patch fixes those.  This wasn't noticed in testing,
  since these types have the same layout.

Added: 


Modified: 
clang/include/clang/AST/StmtOpenACC.h

Removed: 




diff  --git a/clang/include/clang/AST/StmtOpenACC.h 
b/clang/include/clang/AST/StmtOpenACC.h
index df73980822c7be..e256a4b7c69eb5 100644
--- a/clang/include/clang/AST/StmtOpenACC.h
+++ b/clang/include/clang/AST/StmtOpenACC.h
@@ -297,7 +297,7 @@ class OpenACCCombinedConstruct final
 // and clauses, but is otherwise pretty simple.
 class OpenACCDataConstruct final
 : public OpenACCAssociatedStmtConstruct,
-  public llvm::TrailingObjects {
   OpenACCDataConstruct(unsigned NumClauses)
   : OpenACCAssociatedStmtConstruct(
@@ -345,7 +345,7 @@ class OpenACCDataConstruct final
 // This class represents a 'enter data' construct, which JUST has clauses.
 class OpenACCEnterDataConstruct final
 : public OpenACCConstructStmt,
-  public llvm::TrailingObjects {
   OpenACCEnterDataConstruct(unsigned NumClauses)
   : OpenACCConstructStmt(OpenACCEnterDataConstructClass,
@@ -382,7 +382,7 @@ class OpenACCEnterDataConstruct final
 // This class represents a 'exit data' construct, which JUST has clauses.
 class OpenACCExitDataConstruct final
 : public OpenACCConstructStmt,
-  public llvm::TrailingObjects {
   OpenACCExitDataConstruct(unsigned NumClauses)
   : OpenACCConstructStmt(OpenACCExitDataConstructClass,
@@ -420,7 +420,7 @@ class OpenACCExitDataConstruct final
 // statement and clauses, but is otherwise pretty simple.
 class OpenACCHostDataConstruct final
 : public OpenACCAssociatedStmtConstruct,
-  public llvm::TrailingObjects {
   OpenACCHostDataConstruct(unsigned NumClauses)
   : OpenACCAssociatedStmtConstruct(



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


[clang] 1be4a67 - [ExtractAPI] reorder the module names in extension symbol graph file names (#119925)

2024-12-16 Thread via cfe-commits

Author: QuietMisdreavus
Date: 2024-12-16T13:36:19-07:00
New Revision: 1be4a67454b02dae4df2368af31b5f655736d829

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

LOG: [ExtractAPI] reorder the module names in extension symbol graph file names 
(#119925)

Resolves rdar://140298287

ExtractAPI's support for printing Objective-C category extensions from
other modules emits symbol graphs with an
`extendedmod...@hostmodule.symbols.json`. However, this is backwards
from existing symbol graph practices, causing issues when these symbol
graphs are consumed alongside symbol graphs generated with other tools
like Swift. This PR flips the naming scheme to be in line with existing
symbol graph tooling.

Added: 


Modified: 
clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
clang/test/ExtractAPI/objc_external_category.m

Removed: 




diff  --git a/clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp 
b/clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
index c730c062b6a1d5..e881d56258e5e4 100644
--- a/clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
+++ b/clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
@@ -1067,9 +1067,8 @@ void SymbolGraphSerializer::serializeWithExtensionGraphs(
 
   for (auto &ExtensionSGF : Serializer.ExtendedModules) {
 if (auto ExtensionOS =
-CreateOutputStream(ExtensionSGF.getKey() + "@" + API.ProductName))
-  Serializer.serializeGraphToStream(*ExtensionOS, Options,
-ExtensionSGF.getKey(),
+CreateOutputStream(API.ProductName + "@" + ExtensionSGF.getKey()))
+  Serializer.serializeGraphToStream(*ExtensionOS, Options, API.ProductName,
 std::move(ExtensionSGF.getValue()));
   }
 }

diff  --git a/clang/test/ExtractAPI/objc_external_category.m 
b/clang/test/ExtractAPI/objc_external_category.m
index 8afc92489f28b6..1947237d088e8f 100644
--- a/clang/test/ExtractAPI/objc_external_category.m
+++ b/clang/test/ExtractAPI/objc_external_category.m
@@ -46,7 +46,7 @@ @interface ExtInterface
 // Symbol graph from the build without extension SGFs should be identical to 
main symbol graph with extension SGFs
 // RUN: 
diff  %t/symbols/Module.symbols.json %t/ModuleNoExt.symbols.json
 
-// RUN: FileCheck %s --input-file 
%t/symbols/externalmod...@module.symbols.json --check-prefix EXT
+// RUN: FileCheck %s --input-file 
%t/symbols/mod...@externalmodule.symbols.json --check-prefix EXT
 // EXT-DAG: "!testRelLabel": "memberOf $ c:objc(cs)ExtInterface(py)Property $ 
c:objc(cs)ExtInterface"
 // EXT-DAG: "!testRelLabel": "memberOf $ 
c:objc(cs)ExtInterface(im)InstanceMethod $ c:objc(cs)ExtInterface"
 // EXT-DAG: "!testRelLabel": "memberOf $ c:objc(cs)ExtInterface(cm)ClassMethod 
$ c:objc(cs)ExtInterface"
@@ -55,3 +55,10 @@ @interface ExtInterface
 // EXT-DAG: "!testLabel": "c:objc(cs)ExtInterface(cm)ClassMethod"
 // EXT-NOT: "!testLabel": "c:objc(cs)ExtInterface"
 // EXT-NOT: "!testLabel": "c:objc(cs)ModInterface"
+
+// Ensure that the 'module' metadata for the extension symbol graph should 
still reference the
+// declaring module
+
+// RUN: FileCheck %s --input-file 
%t/symbols/mod...@externalmodule.symbols.json --check-prefix META
+// META:   "module": {
+// META-NEXT:"name": "Module",



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


[clang] [llvm] [HLSL] Implement elementwise firstbitlow builtin (PR #116858)

2024-12-16 Thread Ashley Coleman via cfe-commits


@@ -3166,109 +3171,228 @@ bool 
SPIRVInstructionSelector::selectFirstBitHigh32(Register ResVReg,
   .constrainAllUses(TII, TRI, RBI);
 }
 
-bool SPIRVInstructionSelector::selectFirstBitHigh64(Register ResVReg,
-const SPIRVType *ResType,
-MachineInstr &I,
-bool IsSigned) const {
-  Register OpReg = I.getOperand(2).getReg();
-  // 1. split our int64 into 2 pieces using a bitcast
-  unsigned count = GR.getScalarOrVectorComponentCount(ResType);
-  SPIRVType *baseType = GR.retrieveScalarOrVectorIntType(ResType);
+bool SPIRVInstructionSelector::selectFirstBitSet64(
+Register ResVReg, const SPIRVType *ResType, MachineInstr &I,
+Register SrcReg, unsigned BitSetOpcode, bool SwapPrimarySide) const {
+  unsigned ComponentCount = GR.getScalarOrVectorComponentCount(ResType);
+  SPIRVType *BaseType = GR.retrieveScalarOrVectorIntType(ResType);
+  bool ZeroAsNull = STI.isOpenCLEnv();
+  Register ConstIntZero =
+  GR.getOrCreateConstInt(0, I, BaseType, TII, ZeroAsNull);
+  Register ConstIntOne =
+  GR.getOrCreateConstInt(1, I, BaseType, TII, ZeroAsNull);
+
+  // SPIRV doesn't support vectors with more than 4 components. Since the
+  // algoritm below converts i64 -> i32x2 and i64x4 -> i32x8 it can only
+  // operate on vectors with 2 or less components. When largers vectors are
+  // seen. Split them, recurse, then recombine them.
+  if (ComponentCount > 2) {
+unsigned LeftComponentCount = ComponentCount / 2;

V-FEXrt wrote:

Can you give an example? I'm pretty sure the splitting will never create a 
vector too large (but the merging back together certainly can)

Example:

Given `u64x12` the call stack becomes

```c++
selectFirstBitSet64(u64x12); // Top
selectFirstBitSet64Overflow(u64x12); // Top
  selectFirstBitSet64(u64x6); // Top.Left
  selectFirstBitSet64Overflow(u64x6);   // Top.Left
selectFirstBitSet64(u64x3);  // Top.Left.Left
selectFirstBitSet64Overflow(u64x3); // Top.Left.Left
  selectFirstBitSet64(u64);  // Top.Left.Left.Left
  selectFirstBitSet64(u64x2);  // Top.Left.Left.Right
selectFirstBitSet64Overflow(u64x3); // Top.Left.Right
  selectFirstBitSet64(u64);  // Top.Left.Right.Left
  selectFirstBitSet64(u64x2);  // Top.Left.Right.Right
  selectFirstBitSet64Overflow(u64x6);   // Top.Right
selectFirstBitSet64(u64x3);  // Top.Right.Left
selectFirstBitSet64Overflow(u64x3); // Top.Right.Left
  selectFirstBitSet64(u64);  // Top.Right.Left.Left
  selectFirstBitSet64(u64x2);  // Top.Right.Left.Right
selectFirstBitSet64Overflow(u64x3); // Top.Right.Right
  selectFirstBitSet64(u64);  // Top.Right.Right.Left
  selectFirstBitSet64(u64x2);  // Top.Right.Right.Right
```

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


[clang] [llvm] [Driver][clang-linker-wrapper] Add initial support for OpenMP offloading to generic SPIR-V (PR #120145)

2024-12-16 Thread Nick Sarnie via cfe-commits

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


[clang] [NFC] Updating Debug Info generation for 'this' (PR #119445)

2024-12-16 Thread Justin Bogner via cfe-commits

bogner wrote:

> Don't see a problem with this but could we elaborate on the motivation for 
> this? Looks like this is required for #119041? Why is that?
> 
> The original change this is based on is: 
> [microsoft/DirectXShaderCompiler#6296](https://github.com/microsoft/DirectXShaderCompiler/pull/6296)?
>  Which makes it sounds like it does affect the generated debug-info. I'm 
> confused as to what's NFC and what's not

This PR is entirely NFC. #119041 additionally has a functional change - the 
relevant part of which is the addition of an overload:
```c++
llvm::DIType *CGDebugInfo::CreateType(const HLSLAttributedResourceType *Ty,
  llvm::DIFile *U) {
  return getOrCreateType(Ty->getWrappedType(), U);
}
```

The reason this change is needed for that PR, is that this new overload needs 
to be called whether or not we're dealing with a function specialization, but 
since the code as is special-cases specializations we don't ever call the 
overloaded CreateType.

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


[clang] [HLSL] Fix call convention mismatch for ctor/dtor (PR #118651)

2024-12-16 Thread Justin Bogner via cfe-commits

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


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


[clang] [clang][Darwin] Remove legacy framework search path logic in the frontend (PR #120149)

2024-12-16 Thread Louis Dionne via cfe-commits

https://github.com/ldionne created 
https://github.com/llvm/llvm-project/pull/120149

This removes a long standing piece of technical debt. Most other platforms have 
moved all their header search path logic to the driver, but Darwin still had 
some logic for setting framework search paths present in the frontend. This 
patch moves that logic to the driver alongside existing logic that already 
handles part of these search paths.

To achieve parity with the previous search path order, this patch introduces 
the -internal-iframework flag which is used to pass system framework paths from 
the driver to the frontend. These paths are handled specially in that they are 
added after normal framework search paths, which preserves the old frontend 
behavior for system frameworks.

This patch is a re-application of 
https://github.com/llvm/llvm-project/pull/75841 which was reverted in d34901f30 
because it broke framework search paths. In fact, the original patch was only 
adding framework search paths to the linker job, but was not adding search 
paths for finding headers. That issue is resolved in this version of the patch, 
with added tests.

Fixes #75638

>From e578bd75d82a5ff16168222e4f30c32f9aa5e6bd Mon Sep 17 00:00:00 2001
From: Louis Dionne 
Date: Mon, 16 Dec 2024 13:28:38 -0500
Subject: [PATCH] [clang][Darwin] Remove legacy framework search path logic in
 the frontend

This removes a long standing piece of technical debt. Most other platforms
have moved all their header search path logic to the driver, but Darwin
still had some logic for setting framework search paths present in the
frontend. This patch moves that logic to the driver alongside existing
logic that already handles part of these search paths.

To achieve parity with the previous search path order, this patch
introduces the -internal-iframework flag which is used to pass
system framework paths from the driver to the frontend. These paths
are handled specially in that they are added after normal framework
search paths, which preserves the old frontend behavior for system
frameworks.

This patch is a re-application of 
https://github.com/llvm/llvm-project/pull/75841
which was reverted in d34901f30 because it broke framework search paths.
In fact, the original patch was only adding framework search paths to
the linker job, but was not adding search paths for finding headers.
That issue is resolved in this version of the patch, with added tests.

Fixes #75638
---
 clang/include/clang/Driver/Options.td |  5 ++
 clang/lib/Driver/Job.cpp  |  2 +-
 clang/lib/Driver/ToolChains/Darwin.cpp| 49 ++-
 clang/lib/Frontend/CompilerInvocation.cpp |  7 ++-
 clang/lib/Lex/InitHeaderSearch.cpp| 19 ++-
 .../Driver/darwin-framework-search-paths.c| 26 ++
 clang/test/Driver/darwin-subframeworks.c  | 18 ---
 .../test/Preprocessor/cuda-macos-includes.cu  | 13 ++---
 8 files changed, 79 insertions(+), 60 deletions(-)
 create mode 100644 clang/test/Driver/darwin-framework-search-paths.c
 delete mode 100644 clang/test/Driver/darwin-subframeworks.c

diff --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index 88862ae9edb29d..8692d5d7eabe1c 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -8265,6 +8265,11 @@ def internal_externc_isystem : Separate<["-"], 
"internal-externc-isystem">,
"implicit extern \"C\" semantics; these are assumed to not be "
"user-provided and are used to model system and standard headers' "
"paths.">;
+def internal_iframework : Separate<["-"], "internal-iframework">,
+  MetaVarName<"">,
+  HelpText<"Add directory to the internal system framework include search 
path; these "
+   "are assumed to not be user-provided and are used to model system "
+   "and standard frameworks' paths.">;
 
 } // let Visibility = [CC1Option]
 
diff --git a/clang/lib/Driver/Job.cpp b/clang/lib/Driver/Job.cpp
index ae2f1cd1f56c99..07d2d371c5626b 100644
--- a/clang/lib/Driver/Job.cpp
+++ b/clang/lib/Driver/Job.cpp
@@ -73,7 +73,7 @@ static bool skipArgs(const char *Flag, bool HaveCrashVFS, int 
&SkipNum,
 .Cases("-internal-externc-isystem", "-iprefix", true)
 .Cases("-iwithprefixbefore", "-isystem", "-iquote", true)
 .Cases("-isysroot", "-I", "-F", "-resource-dir", true)
-.Cases("-iframework", "-include-pch", true)
+.Cases("-internal-iframework", "-iframework", "-include-pch", true)
 .Default(false);
   if (IsInclude)
 return !HaveCrashVFS;
diff --git a/clang/lib/Driver/ToolChains/Darwin.cpp 
b/clang/lib/Driver/ToolChains/Darwin.cpp
index cdb6d21a0148b6..76d6244daff920 100644
--- a/clang/lib/Driver/ToolChains/Darwin.cpp
+++ b/clang/lib/Driver/ToolChains/Darwin.cpp
@@ -800,9 +800,15 @@ void darwin::Linker::ConstructJob(Compilation &C, const 
JobAction &JA,
 }
   }
 
-  // Add non-standard, platform-specific search paths

[clang] [clang][Darwin] Remove legacy framework search path logic in the frontend (PR #120149)

2024-12-16 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang-driver

Author: Louis Dionne (ldionne)


Changes

This removes a long standing piece of technical debt. Most other platforms have 
moved all their header search path logic to the driver, but Darwin still had 
some logic for setting framework search paths present in the frontend. This 
patch moves that logic to the driver alongside existing logic that already 
handles part of these search paths.

To achieve parity with the previous search path order, this patch introduces 
the -internal-iframework flag which is used to pass system framework paths from 
the driver to the frontend. These paths are handled specially in that they are 
added after normal framework search paths, which preserves the old frontend 
behavior for system frameworks.

This patch is a re-application of 
https://github.com/llvm/llvm-project/pull/75841 which was reverted in d34901f30 
because it broke framework search paths. In fact, the original patch was only 
adding framework search paths to the linker job, but was not adding search 
paths for finding headers. That issue is resolved in this version of the patch, 
with added tests.

Fixes #75638

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


8 Files Affected:

- (modified) clang/include/clang/Driver/Options.td (+5) 
- (modified) clang/lib/Driver/Job.cpp (+1-1) 
- (modified) clang/lib/Driver/ToolChains/Darwin.cpp (+36-13) 
- (modified) clang/lib/Frontend/CompilerInvocation.cpp (+5-2) 
- (modified) clang/lib/Lex/InitHeaderSearch.cpp (+3-16) 
- (added) clang/test/Driver/darwin-framework-search-paths.c (+26) 
- (removed) clang/test/Driver/darwin-subframeworks.c (-18) 
- (modified) clang/test/Preprocessor/cuda-macos-includes.cu (+3-10) 


``diff
diff --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index 88862ae9edb29d..8692d5d7eabe1c 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -8265,6 +8265,11 @@ def internal_externc_isystem : Separate<["-"], 
"internal-externc-isystem">,
"implicit extern \"C\" semantics; these are assumed to not be "
"user-provided and are used to model system and standard headers' "
"paths.">;
+def internal_iframework : Separate<["-"], "internal-iframework">,
+  MetaVarName<"">,
+  HelpText<"Add directory to the internal system framework include search 
path; these "
+   "are assumed to not be user-provided and are used to model system "
+   "and standard frameworks' paths.">;
 
 } // let Visibility = [CC1Option]
 
diff --git a/clang/lib/Driver/Job.cpp b/clang/lib/Driver/Job.cpp
index ae2f1cd1f56c99..07d2d371c5626b 100644
--- a/clang/lib/Driver/Job.cpp
+++ b/clang/lib/Driver/Job.cpp
@@ -73,7 +73,7 @@ static bool skipArgs(const char *Flag, bool HaveCrashVFS, int 
&SkipNum,
 .Cases("-internal-externc-isystem", "-iprefix", true)
 .Cases("-iwithprefixbefore", "-isystem", "-iquote", true)
 .Cases("-isysroot", "-I", "-F", "-resource-dir", true)
-.Cases("-iframework", "-include-pch", true)
+.Cases("-internal-iframework", "-iframework", "-include-pch", true)
 .Default(false);
   if (IsInclude)
 return !HaveCrashVFS;
diff --git a/clang/lib/Driver/ToolChains/Darwin.cpp 
b/clang/lib/Driver/ToolChains/Darwin.cpp
index cdb6d21a0148b6..76d6244daff920 100644
--- a/clang/lib/Driver/ToolChains/Darwin.cpp
+++ b/clang/lib/Driver/ToolChains/Darwin.cpp
@@ -800,9 +800,15 @@ void darwin::Linker::ConstructJob(Compilation &C, const 
JobAction &JA,
 }
   }
 
-  // Add non-standard, platform-specific search paths, e.g., for DriverKit:
-  //  -L/System/DriverKit/usr/lib
-  //  -F/System/DriverKit/System/Library/Framework
+  // Add framework include paths and library search paths.
+  // There are two flavors:
+  // 1. The "non-standard" paths, e.g. for DriverKit:
+  //  -L/System/DriverKit/usr/lib
+  //  -F/System/DriverKit/System/Library/Frameworks
+  // 2. The "standard" paths, e.g. for macOS and iOS:
+  //  -F/System/Library/Frameworks
+  //  -F/System/Library/SubFrameworks
+  //  -F/Library/Frameworks
   {
 bool NonStandardSearchPath = false;
 const auto &Triple = getToolChain().getTriple();
@@ -813,18 +819,23 @@ void darwin::Linker::ConstructJob(Compilation &C, const 
JobAction &JA,
   (Version.getMajor() == 605 && Version.getMinor().value_or(0) < 1);
 }
 
-if (NonStandardSearchPath) {
-  if (auto *Sysroot = Args.getLastArg(options::OPT_isysroot)) {
-auto AddSearchPath = [&](StringRef Flag, StringRef SearchPath) {
-  SmallString<128> P(Sysroot->getValue());
-  AppendPlatformPrefix(P, Triple);
-  llvm::sys::path::append(P, SearchPath);
-  if (getToolChain().getVFS().exists(P)) {
-CmdArgs.push_back(Args.MakeArgString(Flag + P));
-  }
-};
+if (auto *Sysroot = Args.getLastArg(options::OPT_isysroot)) {
+  auto AddSearchPath = [&

[clang] [clang][Darwin] Remove legacy framework search path logic in the frontend (PR #120149)

2024-12-16 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang

Author: Louis Dionne (ldionne)


Changes

This removes a long standing piece of technical debt. Most other platforms have 
moved all their header search path logic to the driver, but Darwin still had 
some logic for setting framework search paths present in the frontend. This 
patch moves that logic to the driver alongside existing logic that already 
handles part of these search paths.

To achieve parity with the previous search path order, this patch introduces 
the -internal-iframework flag which is used to pass system framework paths from 
the driver to the frontend. These paths are handled specially in that they are 
added after normal framework search paths, which preserves the old frontend 
behavior for system frameworks.

This patch is a re-application of 
https://github.com/llvm/llvm-project/pull/75841 which was reverted in d34901f30 
because it broke framework search paths. In fact, the original patch was only 
adding framework search paths to the linker job, but was not adding search 
paths for finding headers. That issue is resolved in this version of the patch, 
with added tests.

Fixes #75638

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


8 Files Affected:

- (modified) clang/include/clang/Driver/Options.td (+5) 
- (modified) clang/lib/Driver/Job.cpp (+1-1) 
- (modified) clang/lib/Driver/ToolChains/Darwin.cpp (+36-13) 
- (modified) clang/lib/Frontend/CompilerInvocation.cpp (+5-2) 
- (modified) clang/lib/Lex/InitHeaderSearch.cpp (+3-16) 
- (added) clang/test/Driver/darwin-framework-search-paths.c (+26) 
- (removed) clang/test/Driver/darwin-subframeworks.c (-18) 
- (modified) clang/test/Preprocessor/cuda-macos-includes.cu (+3-10) 


``diff
diff --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index 88862ae9edb29d..8692d5d7eabe1c 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -8265,6 +8265,11 @@ def internal_externc_isystem : Separate<["-"], 
"internal-externc-isystem">,
"implicit extern \"C\" semantics; these are assumed to not be "
"user-provided and are used to model system and standard headers' "
"paths.">;
+def internal_iframework : Separate<["-"], "internal-iframework">,
+  MetaVarName<"">,
+  HelpText<"Add directory to the internal system framework include search 
path; these "
+   "are assumed to not be user-provided and are used to model system "
+   "and standard frameworks' paths.">;
 
 } // let Visibility = [CC1Option]
 
diff --git a/clang/lib/Driver/Job.cpp b/clang/lib/Driver/Job.cpp
index ae2f1cd1f56c99..07d2d371c5626b 100644
--- a/clang/lib/Driver/Job.cpp
+++ b/clang/lib/Driver/Job.cpp
@@ -73,7 +73,7 @@ static bool skipArgs(const char *Flag, bool HaveCrashVFS, int 
&SkipNum,
 .Cases("-internal-externc-isystem", "-iprefix", true)
 .Cases("-iwithprefixbefore", "-isystem", "-iquote", true)
 .Cases("-isysroot", "-I", "-F", "-resource-dir", true)
-.Cases("-iframework", "-include-pch", true)
+.Cases("-internal-iframework", "-iframework", "-include-pch", true)
 .Default(false);
   if (IsInclude)
 return !HaveCrashVFS;
diff --git a/clang/lib/Driver/ToolChains/Darwin.cpp 
b/clang/lib/Driver/ToolChains/Darwin.cpp
index cdb6d21a0148b6..76d6244daff920 100644
--- a/clang/lib/Driver/ToolChains/Darwin.cpp
+++ b/clang/lib/Driver/ToolChains/Darwin.cpp
@@ -800,9 +800,15 @@ void darwin::Linker::ConstructJob(Compilation &C, const 
JobAction &JA,
 }
   }
 
-  // Add non-standard, platform-specific search paths, e.g., for DriverKit:
-  //  -L/System/DriverKit/usr/lib
-  //  -F/System/DriverKit/System/Library/Framework
+  // Add framework include paths and library search paths.
+  // There are two flavors:
+  // 1. The "non-standard" paths, e.g. for DriverKit:
+  //  -L/System/DriverKit/usr/lib
+  //  -F/System/DriverKit/System/Library/Frameworks
+  // 2. The "standard" paths, e.g. for macOS and iOS:
+  //  -F/System/Library/Frameworks
+  //  -F/System/Library/SubFrameworks
+  //  -F/Library/Frameworks
   {
 bool NonStandardSearchPath = false;
 const auto &Triple = getToolChain().getTriple();
@@ -813,18 +819,23 @@ void darwin::Linker::ConstructJob(Compilation &C, const 
JobAction &JA,
   (Version.getMajor() == 605 && Version.getMinor().value_or(0) < 1);
 }
 
-if (NonStandardSearchPath) {
-  if (auto *Sysroot = Args.getLastArg(options::OPT_isysroot)) {
-auto AddSearchPath = [&](StringRef Flag, StringRef SearchPath) {
-  SmallString<128> P(Sysroot->getValue());
-  AppendPlatformPrefix(P, Triple);
-  llvm::sys::path::append(P, SearchPath);
-  if (getToolChain().getVFS().exists(P)) {
-CmdArgs.push_back(Args.MakeArgString(Flag + P));
-  }
-};
+if (auto *Sysroot = Args.getLastArg(options::OPT_isysroot)) {
+  auto AddSearchPath = [&](Strin

[clang] [Clang][Darwin] Centralize framework search paths for headers & libraries. (PR #118543)

2024-12-16 Thread Louis Dionne via cfe-commits


@@ -339,13 +340,11 @@ void InitHeaderSearch::AddDefaultIncludePaths(
   if (triple.isOSDarwin()) {

ldionne wrote:

I'm trying to revive this as https://github.com/llvm/llvm-project/pull/120149

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


[clang] [clang][Darwin] Remove legacy framework search path logic in the frontend (PR #75841)

2024-12-16 Thread Louis Dionne via cfe-commits

ldionne wrote:

@brad0 Revived as https://github.com/llvm/llvm-project/pull/120149

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


[clang] [clang][Darwin] Remove legacy framework search path logic in the frontend (PR #120149)

2024-12-16 Thread via cfe-commits

github-actions[bot] wrote:




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



You can test this locally with the following command:


``bash
git-clang-format --diff b21fa18b44dd73284bd1c6551b8046c94f84f9f3 
e578bd75d82a5ff16168222e4f30c32f9aa5e6bd --extensions cpp,c -- 
clang/test/Driver/darwin-framework-search-paths.c clang/lib/Driver/Job.cpp 
clang/lib/Driver/ToolChains/Darwin.cpp 
clang/lib/Frontend/CompilerInvocation.cpp clang/lib/Lex/InitHeaderSearch.cpp
``





View the diff from clang-format here.


``diff
diff --git a/clang/lib/Driver/Job.cpp b/clang/lib/Driver/Job.cpp
index 07d2d371c5..8bdc53732e 100644
--- a/clang/lib/Driver/Job.cpp
+++ b/clang/lib/Driver/Job.cpp
@@ -67,14 +67,15 @@ static bool skipArgs(const char *Flag, bool HaveCrashVFS, 
int &SkipNum,
 return true;
 
   // Some include flags shouldn't be skipped if we have a crash VFS
-  IsInclude = llvm::StringSwitch(Flag)
-.Cases("-include", "-header-include-file", true)
-.Cases("-idirafter", "-internal-isystem", "-iwithprefix", true)
-.Cases("-internal-externc-isystem", "-iprefix", true)
-.Cases("-iwithprefixbefore", "-isystem", "-iquote", true)
-.Cases("-isysroot", "-I", "-F", "-resource-dir", true)
-.Cases("-internal-iframework", "-iframework", "-include-pch", true)
-.Default(false);
+  IsInclude =
+  llvm::StringSwitch(Flag)
+  .Cases("-include", "-header-include-file", true)
+  .Cases("-idirafter", "-internal-isystem", "-iwithprefix", true)
+  .Cases("-internal-externc-isystem", "-iprefix", true)
+  .Cases("-iwithprefixbefore", "-isystem", "-iquote", true)
+  .Cases("-isysroot", "-I", "-F", "-resource-dir", true)
+  .Cases("-internal-iframework", "-iframework", "-include-pch", true)
+  .Default(false);
   if (IsInclude)
 return !HaveCrashVFS;
 
diff --git a/clang/lib/Driver/ToolChains/Darwin.cpp 
b/clang/lib/Driver/ToolChains/Darwin.cpp
index 76d6244daf..735ddc3d65 100644
--- a/clang/lib/Driver/ToolChains/Darwin.cpp
+++ b/clang/lib/Driver/ToolChains/Darwin.cpp
@@ -2552,7 +2552,7 @@ void DarwinClang::AddClangSystemIncludeArgs(const 
llvm::opt::ArgList &DriverArgs
   }
 
   // Add default framework search paths
-  auto addFrameworkInclude = [&](auto ...Path) {
+  auto addFrameworkInclude = [&](auto... Path) {
 SmallString<128> P(Sysroot);
 llvm::sys::path::append(P, Path...);
 
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp 
b/clang/lib/Frontend/CompilerInvocation.cpp
index 4713fea5a2..728163b0ca 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -3413,7 +3413,8 @@ static bool ParseHeaderSearchArgs(HeaderSearchOptions 
&Opts, ArgList &Args,
 
   // Add the internal paths from a driver that detects standard include paths.
   for (const auto *A :
-   Args.filtered(OPT_internal_isystem, OPT_internal_externc_isystem, 
OPT_internal_iframework)) {
+   Args.filtered(OPT_internal_isystem, OPT_internal_externc_isystem,
+ OPT_internal_iframework)) {
 frontend::IncludeDirGroup Group = frontend::System;
 bool IsFramework = false;
 if (A->getOption().matches(OPT_internal_externc_isystem))

``




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


[clang] [clang][Darwin] Remove legacy framework search path logic in the frontend (PR #75841)

2024-12-16 Thread Louis Dionne via cfe-commits

ldionne wrote:

Sorry for the spurious request for review here, this is the wrong PR.

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


[clang] [llvm] [Driver][clang-linker-wrapper] Add initial support for OpenMP offloading to generic SPIR-V (PR #120145)

2024-12-16 Thread Nick Sarnie via cfe-commits

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


[clang] [clang][Darwin] Remove legacy framework search path logic in the frontend (PR #120149)

2024-12-16 Thread Louis Dionne via cfe-commits


@@ -1,13 +1,6 @@
-// RUN: %clang -cc1 -fcuda-is-device -isysroot /var/empty \
-// RUN:   -triple nvptx-nvidia-cuda -aux-triple i386-apple-macosx \
-// RUN:   -E -fcuda-is-device -v -o /dev/null -x cuda %s 2>&1 | FileCheck %s
-
-// RUN: %clang -cc1 -isysroot /var/empty \
-// RUN:   -triple i386-apple-macosx -aux-triple nvptx-nvidia-cuda \
-// RUN:   -E -fcuda-is-device -v -o /dev/null -x cuda %s 2>&1 | FileCheck %s
-
 // Check that when we do CUDA host and device compiles on MacOS, we check for
 // includes in /System/Library/Frameworks and /Library/Frameworks.
 
-// CHECK-DAG: ignoring nonexistent directory 
"/var/empty/System/Library/Frameworks"
-// CHECK-DAG: ignoring nonexistent directory "/var/empty/Library/Frameworks"
+// RUN: %clang -isysroot /var/empty -target unknown-nvidia-cuda -v 
-fsyntax-only -x cuda %s -### 2>&1 | FileCheck %s

ldionne wrote:

@jhuber6 Pinging you for Cuda questions, feel free to let me know if I should 
be asking someone else instead.

This test doesn't pass with the current patch. It looks like the Cuda driver 
isn't calling the Darwin toolchain driver when setting up search paths. 
Previously this was all done in the frontend so that wasn't a problem, but I 
don't understand how that's supposed to work. Do you have familiarity with this 
part of Clang?

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


[clang] 38099d0 - [AArch64] Implement intrinsics for SME FP8 FMLAL/FMLALL (Indexed) (#118549)

2024-12-16 Thread via cfe-commits

Author: SpencerAbson
Date: 2024-12-16T21:45:38Z
New Revision: 38099d0608342ddff0737a048ca5fa325c4b0749

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

LOG: [AArch64] Implement intrinsics for SME FP8 FMLAL/FMLALL (Indexed) (#118549)

This patch implements the following intrinsics:

Multi-vector 8-bit floating-point multiply-add long.
``` c
  // Only if __ARM_FEATURE_SME_F8F16 != 0
  void svmla_lane_za16[_mf8]_vg2x1_fpm(uint32_t slice, svmfloat8_t zn,
   svmfloat8_t zm, uint64_t imm_idx,
   fpm_t fpm)  __arm_streaming 
__arm_inout("za");

  void svmla_lane_za16[_mf8]_vg2x2_fpm(uint32_t slice, svmfloat8x2_t zn,
   svmfloat8_t zm, uint64_t imm_idx,
   fpm_t fpm)  __arm_streaming 
__arm_inout("za");

  void svmla_lane_za16[_mf8]_vg2x4_fpm(uint32_t slice, svmfloat8x4_t zn,
   svmfloat8_t zm, uint64_t imm_idx
   fpm_t fpm) __arm_streaming 
__arm_inout("za");

// Only if __ARM_FEATURE_SME_F8F32 != 0
  void svmla_lane_za32[_mf8]_vg4x1_fpm(uint32_t slice, svmfloat8_t zn,
   svmfloat8_t zm, uint64_t imm_idx,
   fpm_t fpm)__arm_streaming 
__arm_inout("za");

  void svmla_lane_za32[_mf8]_vg4x2_fpm(uint32_t slice, svmfloat8x2_t zn,
   svmfloat8_t zm, uint64_t imm_idx,
   fpm_t fpm)__arm_streaming 
__arm_inout("za");

  void svmla_lane_za32[_mf8]_vg4x4_fpm(uint32_t slice, svmfloat8x4_t zn,
   svmfloat8_t zm, uint64_t imm_idx,
   fpm_t fpm)__arm_streaming 
__arm_inout("za");
```
In accordance with: https://github.com/ARM-software/acle/pull/323

Added: 
clang/test/CodeGen/AArch64/fp8-intrinsics/acle_sme2_fp8_mla.c
clang/test/Sema/aarch64-fp8-intrinsics/acle_sme2_fp8_mla.c
llvm/test/CodeGen/AArch64/sme2-fp8-intrinsics-mla.ll

Modified: 
clang/include/clang/Basic/arm_sme.td
clang/test/Sema/aarch64-fp8-intrinsics/acle_sme2_fp8_imm.c
llvm/include/llvm/IR/IntrinsicsAArch64.td
llvm/lib/Target/AArch64/AArch64SMEInstrInfo.td
llvm/lib/Target/AArch64/SMEInstrFormats.td

Removed: 




diff  --git a/clang/include/clang/Basic/arm_sme.td 
b/clang/include/clang/Basic/arm_sme.td
index 7d506642ce2e8d..372cc1103d179b 100644
--- a/clang/include/clang/Basic/arm_sme.td
+++ b/clang/include/clang/Basic/arm_sme.td
@@ -859,11 +859,25 @@ let SMETargetGuard = "sme-lutv2" in {
 let SMETargetGuard = "sme-f8f32" in {
   def SVMOPA_FP8_ZA32 : Inst<"svmopa_za32[_mf8]_m_fpm", "viPPdd>", "m", 
MergeNone, "aarch64_sme_fp8_fmopa_za32",
  [IsStreaming, IsInOutZA, SetsFPMR, 
IsOverloadNone], [ImmCheck<0, ImmCheck0_3>]>;
+   // FMLALL (indexed)
+  def SVMLA_FP8_ZA32_VG4x1 : Inst<"svmla_lane_za32[_mf8]_vg4x1_fpm", "vmddi>", 
"m", MergeNone, "aarch64_sme_fp8_fmlall_lane_za32_vg4x1",
+  [IsStreaming, IsInOutZA, SetsFPMR, 
IsOverloadNone], [ImmCheck<3, ImmCheck0_15>]>;
+  def SVMLA_FP8_ZA32_VG4x2 : Inst<"svmla_lane_za32[_mf8]_vg4x2_fpm", "vm2di>", 
"m", MergeNone, "aarch64_sme_fp8_fmlall_lane_za32_vg4x2",
+  [IsStreaming, IsInOutZA, SetsFPMR, 
IsOverloadNone], [ImmCheck<3, ImmCheck0_15>]>;
+  def SVMLA_FP8_ZA16_VG4x4 : Inst<"svmla_lane_za32[_mf8]_vg4x4_fpm", "vm4di>", 
"m", MergeNone, "aarch64_sme_fp8_fmlall_lane_za32_vg4x4",
+  [IsStreaming, IsInOutZA, SetsFPMR, 
IsOverloadNone], [ImmCheck<3, ImmCheck0_15>]>;
 }
 
 let SMETargetGuard = "sme-f8f16" in {
   def SVMOPA_FP8_ZA16 : Inst<"svmopa_za16[_mf8]_m_fpm", "viPPdd>", "m", 
MergeNone, "aarch64_sme_fp8_fmopa_za16",
  [IsStreaming, IsInOutZA, SetsFPMR, 
IsOverloadNone], [ImmCheck<0, ImmCheck0_1>]>;
+  // FMLAL (indexed)
+  def SVMLA_FP8_ZA16_VG2x1 : Inst<"svmla_lane_za16[_mf8]_vg2x1_fpm", "vmddi>", 
"m", MergeNone, "aarch64_sme_fp8_fmlal_lane_za16_vg2x1",
+  [IsStreaming, IsInOutZA, SetsFPMR, 
IsOverloadNone], [ImmCheck<3, ImmCheck0_15>]>;
+  def SVMLA_FP8_ZA16_VG2x2 : Inst<"svmla_lane_za16[_mf8]_vg2x2_fpm", "vm2di>", 
"m", MergeNone, "aarch64_sme_fp8_fmlal_lane_za16_vg2x2",
+  [IsStreaming, IsInOutZA, SetsFPMR, 
IsOverloadNone], [ImmCheck<3, ImmCheck0_15>]>;
+  def SVMLA_FP8_ZA16_VG2x4 : Inst<"svmla_lane_za16[_mf8]_vg2x4_fpm", "vm4di>", 
"m", MergeNone, "aarch64_sme_fp8_fmlal_lane_za16_vg2x4",
+  [IsStreaming, IsInOutZA, SetsFPMR, 
IsOverloadNone], [ImmCheck<3, ImmCheck0_15>]>;
 }
 
 } // let 

[clang] [llvm] [AArch64] Implement intrinsics for SME FP8 FMLAL/FMLALL (Indexed) (PR #118549)

2024-12-16 Thread via cfe-commits

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


[clang] [clang-format] extend clang-format directive with options to prevent formatting for one line (PR #118566)

2024-12-16 Thread Oleksandr T. via cfe-commits

https://github.com/a-tarasyuk updated 
https://github.com/llvm/llvm-project/pull/118566

>From 75da343b0bd6e3b0f3219b349f6be4c882947820 Mon Sep 17 00:00:00 2001
From: Oleksandr T 
Date: Wed, 4 Dec 2024 02:24:12 +0200
Subject: [PATCH 1/4] [clang-format] extend clang-format directive with options
 to prevent formatting for one line

---
 clang/include/clang/Format/Format.h   | 11 +++-
 clang/lib/Format/DefinitionBlockSeparator.cpp |  3 +-
 clang/lib/Format/Format.cpp   | 59 +--
 clang/lib/Format/FormatTokenLexer.cpp | 39 +---
 clang/lib/Format/FormatTokenLexer.h   |  8 ++-
 .../Format/IntegerLiteralSeparatorFixer.cpp   |  4 +-
 clang/lib/Format/SortJavaScriptImports.cpp| 10 +++-
 clang/lib/Format/TokenAnnotator.cpp   |  4 +-
 clang/unittests/Format/FormatTest.cpp | 53 +
 .../unittests/Format/SortImportsTestJava.cpp  |  9 +++
 10 files changed, 165 insertions(+), 35 deletions(-)

diff --git a/clang/include/clang/Format/Format.h 
b/clang/include/clang/Format/Format.h
index 6383934afa2c40..b25d190178247d 100644
--- a/clang/include/clang/Format/Format.h
+++ b/clang/include/clang/Format/Format.h
@@ -5620,8 +5620,15 @@ inline StringRef 
getLanguageName(FormatStyle::LanguageKind Language) {
   }
 }
 
-bool isClangFormatOn(StringRef Comment);
-bool isClangFormatOff(StringRef Comment);
+enum class ClangFormatDirective {
+  None,
+  Off,
+  On,
+  OffLine,
+  OffNextLine,
+};
+
+ClangFormatDirective parseClangFormatDirective(StringRef Comment);
 
 } // end namespace format
 } // end namespace clang
diff --git a/clang/lib/Format/DefinitionBlockSeparator.cpp 
b/clang/lib/Format/DefinitionBlockSeparator.cpp
index 319236d3bd618c..709ad5e776cc5a 100644
--- a/clang/lib/Format/DefinitionBlockSeparator.cpp
+++ b/clang/lib/Format/DefinitionBlockSeparator.cpp
@@ -144,7 +144,8 @@ void DefinitionBlockSeparator::separateBlocks(
 return false;
 
   if (const auto *Tok = OperateLine->First;
-  Tok->is(tok::comment) && !isClangFormatOn(Tok->TokenText)) {
+  Tok->is(tok::comment) && parseClangFormatDirective(Tok->TokenText) ==
+   ClangFormatDirective::None) {
 return true;
   }
 
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index dcaac4b0d42cc5..11802e8f5b3738 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -3266,10 +3266,11 @@ tooling::Replacements sortCppIncludes(const FormatStyle 
&Style, StringRef Code,
   FormattingOff = false;
 
 bool IsBlockComment = false;
+ClangFormatDirective CFD = parseClangFormatDirective(Trimmed);
 
-if (isClangFormatOff(Trimmed)) {
+if (CFD == ClangFormatDirective::Off) {
   FormattingOff = true;
-} else if (isClangFormatOn(Trimmed)) {
+} else if (CFD == ClangFormatDirective::On) {
   FormattingOff = false;
 } else if (Trimmed.starts_with("/*")) {
   IsBlockComment = true;
@@ -3452,9 +3453,10 @@ tooling::Replacements sortJavaImports(const FormatStyle 
&Style, StringRef Code,
 Code.substr(Prev, (Pos != StringRef::npos ? Pos : Code.size()) - Prev);
 
 StringRef Trimmed = Line.trim();
-if (isClangFormatOff(Trimmed))
+ClangFormatDirective CFD = parseClangFormatDirective(Trimmed);
+if (CFD == ClangFormatDirective::Off)
   FormattingOff = true;
-else if (isClangFormatOn(Trimmed))
+else if (CFD == ClangFormatDirective::On)
   FormattingOff = false;
 
 if (ImportRegex.match(Line, &Matches)) {
@@ -4190,24 +4192,45 @@ Expected getStyle(StringRef StyleName, 
StringRef FileName,
   return FallbackStyle;
 }
 
-static bool isClangFormatOnOff(StringRef Comment, bool On) {
-  if (Comment == (On ? "/* clang-format on */" : "/* clang-format off */"))
-return true;
+static unsigned skipWhitespace(unsigned Pos, StringRef Str, unsigned Length) {
+  while (Pos < Length && isspace(Str[Pos]))
+++Pos;
+  return Pos;
+}
 
-  static const char ClangFormatOn[] = "// clang-format on";
-  static const char ClangFormatOff[] = "// clang-format off";
-  const unsigned Size = (On ? sizeof ClangFormatOn : sizeof ClangFormatOff) - 
1;
+ClangFormatDirective parseClangFormatDirective(StringRef Comment) {
+  size_t Pos = std::min(Comment.find("/*"), Comment.find("//"));
+  unsigned Length = Comment.size();
+  if (Pos == StringRef::npos)
+return ClangFormatDirective::None;
 
-  return Comment.starts_with(On ? ClangFormatOn : ClangFormatOff) &&
- (Comment.size() == Size || Comment[Size] == ':');
-}
+  Pos = skipWhitespace(Pos + 2, Comment, Length);
+  StringRef ClangFormatDirectiveName = "clang-format";
 
-bool isClangFormatOn(StringRef Comment) {
-  return isClangFormatOnOff(Comment, /*On=*/true);
-}
+  if (Comment.substr(Pos, ClangFormatDirectiveName.size()) ==
+  ClangFormatDirectiveName) {
+Pos =
+skipWhitespace(Pos + ClangFormatDirectiveName.size(), Comment, Length);
+
+unsigned EndDi

[clang] [clang][Darwin] Remove legacy framework search path logic in the frontend (PR #120149)

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


@@ -1,13 +1,6 @@
-// RUN: %clang -cc1 -fcuda-is-device -isysroot /var/empty \
-// RUN:   -triple nvptx-nvidia-cuda -aux-triple i386-apple-macosx \
-// RUN:   -E -fcuda-is-device -v -o /dev/null -x cuda %s 2>&1 | FileCheck %s
-
-// RUN: %clang -cc1 -isysroot /var/empty \
-// RUN:   -triple i386-apple-macosx -aux-triple nvptx-nvidia-cuda \
-// RUN:   -E -fcuda-is-device -v -o /dev/null -x cuda %s 2>&1 | FileCheck %s
-
 // Check that when we do CUDA host and device compiles on MacOS, we check for
 // includes in /System/Library/Frameworks and /Library/Frameworks.
 
-// CHECK-DAG: ignoring nonexistent directory 
"/var/empty/System/Library/Frameworks"
-// CHECK-DAG: ignoring nonexistent directory "/var/empty/Library/Frameworks"
+// RUN: %clang -isysroot /var/empty -target unknown-nvidia-cuda -v 
-fsyntax-only -x cuda %s -### 2>&1 | FileCheck %s

jhuber6 wrote:

When we detect CUDA mode we create a CUDAToolChain which is a separate 
offloading ToolChain that handles the device-side compile. That contains the 
`HostTC` which should be Darwin in this case, the calls to get the include 
headers should then be routed through the CUDA ToolChain to that one I believe.

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


[clang] [clang][Darwin] Remove legacy framework search path logic in the frontend (PR #120149)

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

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


[clang] [llvm] [NFC] [RISCV] Refactor class RISCVExtension (PR #120040)

2024-12-16 Thread Pengcheng Wang via cfe-commits


@@ -12,21 +12,32 @@
 
 // Subclass of SubtargetFeature to be used when the feature is also a RISC-V
 // extension. Extensions have a version and may be experimental.
+// NOTE: The extension name must start with
+//   - "FeatureStdExt" for standard extensions
+//   - "FeatureVendor" for vendor-specific extensions
 //
-// name  - Name of the extension in lower case.
 // major - Major version of extension.
 // minor - Minor version of extension.
-// desc  - Description of extension.
 // implies   - Extensions or features implied by this extension.
 // fieldname - name of field to create in RISCVSubtarget. By default replaces
 // uses the record name by replacing Feature with Has.
 // value - Value to assign to the field in RISCVSubtarget when this
 // extension is enabled. Usually "true", but can be changed.
-class RISCVExtension implies = [],
  string fieldname = !subst("Feature", "Has", NAME),
- string value = "true">
-: SubtargetFeature {
+ string value = "true", bit IsExperimental = false>
+: SubtargetFeature<"", fieldname, value, "", implies> {
+  defvar N = !subst("FeatureVendor", "", !subst("FeatureStdExt", "", NAME));

wangpc-pp wrote:

These globals start with captical letter I think, but not for locals.

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


[clang] [C++20][Modules] Load function body from the module that gives canonical decl (PR #111992)

2024-12-16 Thread Chuanqi Xu via cfe-commits

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

LGTM. Thanks for the long term waiting.

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


[clang] 92a4f4d - [Tooling/Inclusion] Update std symbol mapping (#118174)

2024-12-16 Thread via cfe-commits

Author: Vadim D.
Date: 2024-12-16T10:11:22+01:00
New Revision: 92a4f4dda5796049b6dbeb5ed89384380bff97d9

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

LOG: [Tooling/Inclusion] Update std symbol mapping (#118174)

This adds new symbols to the generated mapping and removes special
mappings for missing symbols introduced in #113612, as these symbols are
now included in the generated mapping.

Added: 


Modified: 
clang/lib/Tooling/Inclusions/Stdlib/StdSpecialSymbolMap.inc
clang/lib/Tooling/Inclusions/Stdlib/StdSymbolMap.inc

Removed: 




diff  --git a/clang/lib/Tooling/Inclusions/Stdlib/StdSpecialSymbolMap.inc 
b/clang/lib/Tooling/Inclusions/Stdlib/StdSpecialSymbolMap.inc
index 8f20ce98152f08..9179217dd6ca8b 100644
--- a/clang/lib/Tooling/Inclusions/Stdlib/StdSpecialSymbolMap.inc
+++ b/clang/lib/Tooling/Inclusions/Stdlib/StdSpecialSymbolMap.inc
@@ -261,6 +261,11 @@ SYMBOL(data, std::ranges::, )
 SYMBOL(data, std::ranges::, )
 SYMBOL(cdata, std::ranges::, )
 SYMBOL(cdata, std::ranges::, )
+// https://eel.is/c++draft/tuple.general#2:
+// In addition to being available via inclusion of the  header,
+// ignore ... is available when  ... is included.
+SYMBOL(ignore, std::, )
+SYMBOL(ignore, std::, )
 
 // Ignore specializations
 SYMBOL(hash, std::, )
@@ -389,18 +394,10 @@ SYMBOL(make_error_condition, std::, /*no headers*/)
 SYMBOL(erase, std::, /*no headers*/)
 SYMBOL(erase_if, std::, /*no headers*/)
 
-// cppreference symbol index page was missing these symbols.
-// Remove them when the cppreference offline archive catches up.
-SYMBOL(regular_invocable, std::, )
-
 // Symbols missing from the generated symbol map as reported by users.
 // Remove when the generator starts producing them.
 SYMBOL(div, std::, )
 SYMBOL(abort, std::, )
-SYMBOL(atomic_wait, std::, )
-SYMBOL(atomic_wait_explicit, std::, )
-SYMBOL(move_backward, std::, )
-SYMBOL(month_weekday, std::chrono::, )
 
 SYMBOL(binary_search, std::ranges::, )
 SYMBOL(equal_range, std::ranges::, )

diff  --git a/clang/lib/Tooling/Inclusions/Stdlib/StdSymbolMap.inc 
b/clang/lib/Tooling/Inclusions/Stdlib/StdSymbolMap.inc
index b4afd0228694ff..c1927180d33976 100644
--- a/clang/lib/Tooling/Inclusions/Stdlib/StdSymbolMap.inc
+++ b/clang/lib/Tooling/Inclusions/Stdlib/StdSymbolMap.inc
@@ -6,7 +6,7 @@
 // This file was generated automatically by
 // clang/tools/include-mapping/gen_std.py, DO NOT EDIT!
 //
-// Generated from cppreference offline HTML book (modified on 2024-06-10).
+// Generated from cppreference offline HTML book (modified on 2024-11-10).
 
//===--===//
 
 SYMBOL(ATOMIC_BOOL_LOCK_FREE, None, )
@@ -578,6 +578,7 @@ SYMBOL(add_pointer, std::, )
 SYMBOL(add_pointer_t, std::, )
 SYMBOL(add_rvalue_reference, std::, )
 SYMBOL(add_rvalue_reference_t, std::, )
+SYMBOL(add_sat, std::, )
 SYMBOL(add_volatile, std::, )
 SYMBOL(add_volatile_t, std::, )
 SYMBOL(addressof, std::, )
@@ -699,6 +700,10 @@ SYMBOL(atomic_fetch_add, std::, )
 SYMBOL(atomic_fetch_add_explicit, std::, )
 SYMBOL(atomic_fetch_and, std::, )
 SYMBOL(atomic_fetch_and_explicit, std::, )
+SYMBOL(atomic_fetch_max, std::, )
+SYMBOL(atomic_fetch_max_explicit, std::, )
+SYMBOL(atomic_fetch_min, std::, )
+SYMBOL(atomic_fetch_min_explicit, std::, )
 SYMBOL(atomic_fetch_or, std::, )
 SYMBOL(atomic_fetch_or_explicit, std::, )
 SYMBOL(atomic_fetch_sub, std::, )
@@ -727,6 +732,8 @@ SYMBOL(atomic_signal_fence, std::, )
 SYMBOL(atomic_store, std::, )
 SYMBOL(atomic_store_explicit, std::, )
 SYMBOL(atomic_thread_fence, std::, )
+SYMBOL(atomic_wait, std::, )
+SYMBOL(atomic_wait_explicit, std::, )
 SYMBOL(atto, std::, )
 SYMBOL(auto_ptr, std::, )
 SYMBOL(back_insert_iterator, std::, )
@@ -829,6 +836,8 @@ SYMBOL(boolalpha, std::, )
 SYMBOL(boolalpha, std::, )
 SYMBOL(boyer_moore_horspool_searcher, std::, )
 SYMBOL(boyer_moore_searcher, std::, )
+SYMBOL(breakpoint, std::, )
+SYMBOL(breakpoint_if_debugging, std::, )
 SYMBOL(bsearch, std::, )
 SYMBOL(bsearch, None, )
 SYMBOL(bsearch, None, )
@@ -951,6 +960,7 @@ SYMBOL(copy_constructible, std::, )
 SYMBOL(copy_if, std::, )
 SYMBOL(copy_n, std::, )
 SYMBOL(copyable, std::, )
+SYMBOL(copyable_function, std::, )
 SYMBOL(copysign, std::, )
 SYMBOL(copysign, None, )
 SYMBOL(copysign, None, )
@@ -1048,12 +1058,14 @@ SYMBOL(dextents, std::, )
 SYMBOL(
diff time, std::, )
 SYMBOL(
diff time, None, )
 SYMBOL(
diff time, None, )
+SYMBOL(dims, std::, )
 SYMBOL(disable_sized_sentinel_for, std::, )
 SYMBOL(discard_block_engine, std::, )
 SYMBOL(discrete_distribution, std::, )
 SYMBOL(disjunction, std::, )
 SYMBOL(disjunction_v, std::, )
 SYMBOL(distance, std::, )
+SYMBOL(div_sat, std::, )
 SYMBOL(div_t, std::, )
 SYMBOL(div_t, None, )
 SYMBOL(div_t, None, )
@@ -1077,6 +1089,7 @@ 

[clang] [Tooling/Inclusion] Update std symbol mapping (PR #118174)

2024-12-16 Thread Haojian Wu via cfe-commits

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


[clang] [Tooling/Inclusion] Update std symbol mapping (PR #118174)

2024-12-16 Thread Haojian Wu via cfe-commits

hokein wrote:

> @hokein, can you commit this, please? I don't have the permissions

sure, done.

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


[clang] [C++20][Modules] Load function body from the module that gives canonical decl (PR #111992)

2024-12-16 Thread Chuanqi Xu via cfe-commits

ChuanqiXu9 wrote:

@ilya-biryukov I remember last time, the codes you shared to me actually based 
an open source project. I am wondering if you can open source some use for such 
projects (even for testing purpose). I think it will be pretty helpful to 
speedup the overall development process.

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


[clang] [Tooling/Inclusion] Update std symbol mapping (PR #118174)

2024-12-16 Thread Vadim D. via cfe-commits

vvd170501 wrote:

@hokein, can you commit this, please? I don't have the permissions

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


[clang] [llvm] [NFC] [RISCV] Refactor class RISCVExtension (PR #120040)

2024-12-16 Thread Shao-Ce SUN via cfe-commits


@@ -12,21 +12,32 @@
 
 // Subclass of SubtargetFeature to be used when the feature is also a RISC-V
 // extension. Extensions have a version and may be experimental.
+// NOTE: The extension name must start with
+//   - "FeatureStdExt" for standard extensions
+//   - "FeatureVendor" for vendor-specific extensions
 //
-// name  - Name of the extension in lower case.
 // major - Major version of extension.
 // minor - Minor version of extension.
-// desc  - Description of extension.

sunshaoce wrote:

Done. Thanks!

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


[clang] [clang][Darwin] Remove legacy framework search path logic in the frontend (PR #120149)

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


@@ -1,13 +1,6 @@
-// RUN: %clang -cc1 -fcuda-is-device -isysroot /var/empty \
-// RUN:   -triple nvptx-nvidia-cuda -aux-triple i386-apple-macosx \
-// RUN:   -E -fcuda-is-device -v -o /dev/null -x cuda %s 2>&1 | FileCheck %s
-
-// RUN: %clang -cc1 -isysroot /var/empty \
-// RUN:   -triple i386-apple-macosx -aux-triple nvptx-nvidia-cuda \
-// RUN:   -E -fcuda-is-device -v -o /dev/null -x cuda %s 2>&1 | FileCheck %s
-
 // Check that when we do CUDA host and device compiles on MacOS, we check for
 // includes in /System/Library/Frameworks and /Library/Frameworks.
 
-// CHECK-DAG: ignoring nonexistent directory 
"/var/empty/System/Library/Frameworks"
-// CHECK-DAG: ignoring nonexistent directory "/var/empty/Library/Frameworks"
+// RUN: %clang -isysroot /var/empty -target unknown-nvidia-cuda -v 
-fsyntax-only -x cuda %s -### 2>&1 | FileCheck %s

jhuber6 wrote:

@Artem-B Does NVIDIA even support CUDA on MAC anymore?

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


[clang] [compiler-rt] [libcxx] [libcxxabi] [llvm] [libc++] Replace LIBCXX_ENABLE_STATIC_ABI_LIBRARY & friends by a new LIBCXX_CXX_ABI choice (PR #112978)

2024-12-16 Thread Louis Dionne via cfe-commits

https://github.com/ldionne updated 
https://github.com/llvm/llvm-project/pull/112978

>From 7b8f1538b452d6c16874d0f076baa2d54abb66b0 Mon Sep 17 00:00:00 2001
From: Louis Dionne 
Date: Fri, 13 May 2022 09:26:01 -0400
Subject: [PATCH 1/2] [libc++] Replace LIBCXX_ENABLE_STATIC_ABI_LIBRARY &
 friends by a new LIBCXX_CXX_ABI choice

Instead of having complicated options like LIBCXX_ENABLE_STATIC_ABI_LIBRARY
and LIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY, introduce a more general
mechanism to select the ABI library used by libc++. The new mechanism allows
specifying the ABI library for the static libc++ and the shared libc++
separately, and allows selecting a "merged" flavor of libc++ for both
the in-tree libc++abi and any external static ABI library.

As an example, one can now specify arbitrary combinations like
   -DLIBCXX_ABILIB_FOR_SHARED="shared-libcxxabi"
   -DLIBCXX_ABILIB_FOR_STATIC="merged-libcxxabi"

which would have been impossible or very brittle in the past. In theory,
one can even select an entirely different ABI library for the static and
the shared libc++ (e.g. libc++abi vs libsupc++), although supporting that
is not a primary goal of this patch but merely a result of the general
mechanism.

Closes #77655
Fixes #57759

Differential Revision: https://reviews.llvm.org/D125683
---
 clang/cmake/caches/Android.cmake  |   4 +-
 clang/cmake/caches/CrossWinToARMLinux.cmake   |  12 +-
 clang/cmake/caches/Fuchsia-stage2.cmake   |   8 +-
 clang/cmake/caches/Fuchsia.cmake  |   4 +-
 compiler-rt/cmake/Modules/AddCompilerRT.cmake |   3 +-
 libcxx/CMakeLists.txt |  68 +++--
 libcxx/cmake/Modules/HandleLibCXXABI.cmake| 279 +-
 libcxx/cmake/caches/AMDGPU.cmake  |   4 +-
 libcxx/cmake/caches/AndroidNDK.cmake  |   2 +-
 libcxx/cmake/caches/Generic-merged.cmake  |   3 +-
 libcxx/cmake/caches/MinGW.cmake   |   4 +-
 libcxx/cmake/caches/NVPTX.cmake   |   4 +-
 libcxx/docs/ReleaseNotes/20.rst   |   6 +-
 libcxx/docs/VendorDocumentation.rst   |  24 +-
 libcxx/include/CMakeLists.txt |   2 +-
 libcxx/src/CMakeLists.txt |  19 +-
 libcxx/utils/ci/run-buildbot  |   4 -
 libcxxabi/src/CMakeLists.txt  |  15 +
 .../docs/HowToBuildWindowsItaniumPrograms.rst |  28 +-
 19 files changed, 252 insertions(+), 241 deletions(-)

diff --git a/clang/cmake/caches/Android.cmake b/clang/cmake/caches/Android.cmake
index d5ca6b50d4ada7..dbf66539591394 100644
--- a/clang/cmake/caches/Android.cmake
+++ b/clang/cmake/caches/Android.cmake
@@ -21,8 +21,8 @@ if (LIBCXX_ENABLE_ABI_LINKER_SCRIPT)
   list(APPEND EXTRA_ARGS 
-DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=${LIBCXX_ENABLE_ABI_LINKER_SCRIPT})
 endif()
 
-if (LIBCXX_ENABLE_STATIC_ABI_LIBRARY)
-  list(APPEND EXTRA_ARGS 
-DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=${LIBCXX_ENABLE_STATIC_ABI_LIBRARY})
+if (LIBCXX_CXX_ABI)
+  list(APPEND EXTRA_ARGS -DLIBCXX_CXX_ABI=${LIBCXX_CXX_ABI})
 endif()
 
 if (LLVM_BUILD_EXTERNAL_COMPILER_RT)
diff --git a/clang/cmake/caches/CrossWinToARMLinux.cmake 
b/clang/cmake/caches/CrossWinToARMLinux.cmake
index c47c4ac3bb73ec..411315a2d38b23 100644
--- a/clang/cmake/caches/CrossWinToARMLinux.cmake
+++ b/clang/cmake/caches/CrossWinToARMLinux.cmake
@@ -21,7 +21,7 @@
 #  cmake -G Ninja ^
 #   -DTOOLCHAIN_TARGET_TRIPLE=aarch64-unknown-linux-gnu ^
 #   -DTOOLCHAIN_TARGET_SYSROOTFS= ^
-#   -DTOOLCHAIN_SHARED_LIBS=OFF ^ 
+#   -DTOOLCHAIN_SHARED_LIBS=OFF ^
 #   -DCMAKE_INSTALL_PREFIX=../install ^
 #   -DCMAKE_CXX_FLAGS="-D__OPTIMIZE__" ^
 #   -DREMOTE_TEST_HOST="" ^
@@ -205,7 +205,7 @@ 
set(RUNTIMES_${TOOLCHAIN_TARGET_TRIPLE}_COMPILER_RT_CXX_LIBRARY
 # The compiler-rt tests disable the clang configuration files during the 
execution by setting CLANG_NO_DEFAULT_CONFIG=1
 # and drops out the --sysroot from there. Provide it explicity via the test 
flags here if target sysroot has been specified.
 set(RUNTIMES_${TOOLCHAIN_TARGET_TRIPLE}_COMPILER_RT_TEST_COMPILER_CFLAGS   
   "--stdlib=libc++ ${sysroot_flags}" CACHE STRING "")
-  
+
 set(RUNTIMES_${TOOLCHAIN_TARGET_TRIPLE}_LIBUNWIND_USE_COMPILER_RT  
   ON CACHE BOOL "")
 set(RUNTIMES_${TOOLCHAIN_TARGET_TRIPLE}_LIBUNWIND_ENABLE_SHARED
   ${TOOLCHAIN_SHARED_LIBS} CACHE BOOL "")
 
@@ -218,10 +218,12 @@ 
set(RUNTIMES_${TOOLCHAIN_TARGET_TRIPLE}_LIBCXXABI_ENABLE_SHARED
 set(RUNTIMES_${TOOLCHAIN_TARGET_TRIPLE}_LIBCXX_USE_COMPILER_RT 
   ON CACHE BOOL "")
 set(RUNTIMES_${TOOLCHAIN_TARGET_TRIPLE}_LIBCXX_ENABLE_SHARED   
   ${TOOLCHAIN_SHARED_LIBS} CACHE BOOL "")
 set(RUNTIMES_${TOOLCHAIN_TARGET_TRIPLE}_LIBCXX_ABI_VERSION 
   ${LIBCXX_ABI_VERSION} CACHE STRING "")
-set(RUNTIMES_${TOOLCHAIN_TARGET_TRIPLE}_LIBCXX_CXX_ABI 
   "libcxxabi" CACHE STRING "")#!!!
+if (TOOLCHAIN_USE_STATIC_LIBS)
+  set(RUNTIMES_${TOOLCHAI

[clang] Add concepts for Structured buffers (PR #119643)

2024-12-16 Thread Joshua Batista via cfe-commits

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


[clang] 8c16323 - [OpenACC/NFC] Make 'trailing objects' use private inheritence.

2024-12-16 Thread via cfe-commits

Author: erichkeane
Date: 2024-12-16T14:31:03-08:00
New Revision: 8c163237573df097a99b65a83280757d1b39062c

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

LOG: [OpenACC/NFC] Make 'trailing objects' use private inheritence.

I noticed this while working on something else, these are supposed to be
privately inherited.

Added: 


Modified: 
clang/include/clang/AST/OpenACCClause.h
clang/include/clang/AST/StmtOpenACC.h

Removed: 




diff  --git a/clang/include/clang/AST/OpenACCClause.h 
b/clang/include/clang/AST/OpenACCClause.h
index 7a1b17cc4e44e3..51db58d484a25f 100644
--- a/clang/include/clang/AST/OpenACCClause.h
+++ b/clang/include/clang/AST/OpenACCClause.h
@@ -191,8 +191,9 @@ using DeviceTypeArgument = std::pair;
 /// an identifier. The 'asterisk' means 'the rest'.
 class OpenACCDeviceTypeClause final
 : public OpenACCClauseWithParams,
-  public llvm::TrailingObjects {
+  friend TrailingObjects;
   // Data stored in trailing objects as IdentifierInfo* /SourceLocation pairs. 
A
   // nullptr IdentifierInfo* represents an asterisk.
   unsigned NumArchs;
@@ -377,7 +378,8 @@ class OpenACCClauseWithExprs : public 
OpenACCClauseWithParams {
 // Represents the 'devnum' and expressions lists for the 'wait' clause.
 class OpenACCWaitClause final
 : public OpenACCClauseWithExprs,
-  public llvm::TrailingObjects {
+  private llvm::TrailingObjects {
+  friend TrailingObjects;
   SourceLocation QueuesLoc;
   OpenACCWaitClause(SourceLocation BeginLoc, SourceLocation LParenLoc,
 Expr *DevNumExpr, SourceLocation QueuesLoc,
@@ -419,7 +421,8 @@ class OpenACCWaitClause final
 
 class OpenACCNumGangsClause final
 : public OpenACCClauseWithExprs,
-  public llvm::TrailingObjects {
+  private llvm::TrailingObjects {
+  friend TrailingObjects;
 
   OpenACCNumGangsClause(SourceLocation BeginLoc, SourceLocation LParenLoc,
 ArrayRef IntExprs, SourceLocation EndLoc)
@@ -449,7 +452,8 @@ class OpenACCNumGangsClause final
 
 class OpenACCTileClause final
 : public OpenACCClauseWithExprs,
-  public llvm::TrailingObjects {
+  private llvm::TrailingObjects {
+  friend TrailingObjects;
   OpenACCTileClause(SourceLocation BeginLoc, SourceLocation LParenLoc,
 ArrayRef SizeExprs, SourceLocation EndLoc)
   : OpenACCClauseWithExprs(OpenACCClauseKind::Tile, BeginLoc, LParenLoc,
@@ -503,7 +507,8 @@ class OpenACCClauseWithSingleIntExpr : public 
OpenACCClauseWithExprs {
 
 class OpenACCGangClause final
 : public OpenACCClauseWithExprs,
-  public llvm::TrailingObjects 
{
+  private llvm::TrailingObjects {
+  friend TrailingObjects;
 protected:
   OpenACCGangClause(SourceLocation BeginLoc, SourceLocation LParenLoc,
 ArrayRef GangKinds,
@@ -658,7 +663,8 @@ class OpenACCClauseWithVarList : public 
OpenACCClauseWithExprs {
 
 class OpenACCPrivateClause final
 : public OpenACCClauseWithVarList,
-  public llvm::TrailingObjects {
+  private llvm::TrailingObjects {
+  friend TrailingObjects;
 
   OpenACCPrivateClause(SourceLocation BeginLoc, SourceLocation LParenLoc,
ArrayRef VarList, SourceLocation EndLoc)
@@ -680,7 +686,8 @@ class OpenACCPrivateClause final
 
 class OpenACCFirstPrivateClause final
 : public OpenACCClauseWithVarList,
-  public llvm::TrailingObjects {
+  private llvm::TrailingObjects {
+  friend TrailingObjects;
 
   OpenACCFirstPrivateClause(SourceLocation BeginLoc, SourceLocation LParenLoc,
 ArrayRef VarList, SourceLocation EndLoc)
@@ -702,7 +709,8 @@ class OpenACCFirstPrivateClause final
 
 class OpenACCDevicePtrClause final
 : public OpenACCClauseWithVarList,
-  public llvm::TrailingObjects {
+  private llvm::TrailingObjects {
+  friend TrailingObjects;
 
   OpenACCDevicePtrClause(SourceLocation BeginLoc, SourceLocation LParenLoc,
  ArrayRef VarList, SourceLocation EndLoc)
@@ -724,7 +732,8 @@ class OpenACCDevicePtrClause final
 
 class OpenACCAttachClause final
 : public OpenACCClauseWithVarList,
-  public llvm::TrailingObjects {
+  private llvm::TrailingObjects {
+  friend TrailingObjects;
 
   OpenACCAttachClause(SourceLocation BeginLoc, SourceLocation LParenLoc,
   ArrayRef VarList, SourceLocation EndLoc)
@@ -746,7 +755,8 @@ class OpenACCAttachClause final
 
 class OpenACCDetachClause final
 : public OpenACCClauseWithVarList,
-  public llvm::TrailingObjects {
+  private llvm::TrailingObjects {
+  friend TrailingObjects;
 
   OpenACCDetachClause(SourceLocation BeginLoc, SourceLocation LParenLoc,
   ArrayRef VarList, SourceLocation EndLoc)
@@ -768,7 +778,8 @@ class OpenACCDetachClause fi

[clang] Reland [Clang] skip default argument instantiation for non-defining friend declarations to meet [dcl.fct.default] p4 (PR #115487)

2024-12-16 Thread Erich Keane via cfe-commits


@@ -4692,6 +4692,17 @@ bool Sema::InstantiateDefaultArgument(SourceLocation 
CallLoc, FunctionDecl *FD,
   ParmVarDecl *Param) {
   assert(Param->hasUninstantiatedDefaultArg());
 
+  // FIXME: We don't track member specialization info for non-defining
+  // friend declarations, so we will not be able to later find the function
+  // pattern. As a workaround, don't instantiate the default argument in this
+  // case. This is correct per wording and only an error recovery issue, as per

erichkeane wrote:

I messed with this for a little bit and can't come up with any good way to hit 
this with a recoveryexpr/etc, so I think I'm probably ok leaving this as a 
'fixme'.  I think we could/do better here someday if we can come up with an 
example, but nothing I can conceive now.

@a-tarasyuk : feel free to merge this now, and revisit if/when you think of a 
good repro here that we can examine/improve.

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


[clang] [llvm] [HLSL] Implement `WaveActiveAllTrue` Intrinsic (PR #117245)

2024-12-16 Thread Ashley Coleman via cfe-commits

https://github.com/V-FEXrt updated 
https://github.com/llvm/llvm-project/pull/117245

>From 1156d98a0ba25a92b4edbacb7c17e5ad6bb2b522 Mon Sep 17 00:00:00 2001
From: Ashley Coleman 
Date: Thu, 21 Nov 2024 08:42:31 -0700
Subject: [PATCH 1/2] [HLSL] Implement WaveActiveAllTrue Intrinsic

---
 clang/include/clang/Basic/Builtins.td |  6 ++
 clang/lib/CodeGen/CGBuiltin.cpp   | 10 +
 clang/lib/CodeGen/CGHLSLRuntime.h |  1 +
 clang/lib/Headers/hlsl/hlsl_intrinsics.h  |  9 
 .../builtins/WaveActiveAllTrue.hlsl   | 17 +++
 .../BuiltIns/WaveActiveAllTrue-errors.hlsl| 21 +++
 llvm/include/llvm/IR/IntrinsicsDirectX.td |  1 +
 llvm/include/llvm/IR/IntrinsicsSPIRV.td   |  1 +
 llvm/lib/Target/DirectX/DXIL.td   |  8 +++
 .../Target/SPIRV/SPIRVInstructionSelector.cpp |  2 ++
 .../test/CodeGen/DirectX/WaveActiveAllTrue.ll | 10 +
 .../hlsl-intrinsics/WaveActiveAllTrue.ll  | 21 +++
 12 files changed, 107 insertions(+)
 create mode 100644 clang/test/CodeGenHLSL/builtins/WaveActiveAllTrue.hlsl
 create mode 100644 clang/test/SemaHLSL/BuiltIns/WaveActiveAllTrue-errors.hlsl
 create mode 100644 llvm/test/CodeGen/DirectX/WaveActiveAllTrue.ll
 create mode 100644 llvm/test/CodeGen/SPIRV/hlsl-intrinsics/WaveActiveAllTrue.ll

diff --git a/clang/include/clang/Basic/Builtins.td 
b/clang/include/clang/Basic/Builtins.td
index 32a09e2ceb3857..d64a66fc9d9cf7 100644
--- a/clang/include/clang/Basic/Builtins.td
+++ b/clang/include/clang/Basic/Builtins.td
@@ -4762,6 +4762,12 @@ def HLSLAsDouble : LangBuiltin<"HLSL_LANG"> {
   let Prototype = "void(...)";
 }
 
+def HLSLWaveActiveAllTrue : LangBuiltin<"HLSL_LANG"> {
+  let Spellings = ["__builtin_hlsl_wave_active_all_true"];
+  let Attributes = [NoThrow, Const];
+  let Prototype = "bool(bool)";
+}
+
 def HLSLWaveActiveAnyTrue : LangBuiltin<"HLSL_LANG"> {
   let Spellings = ["__builtin_hlsl_wave_active_any_true"];
   let Attributes = [NoThrow, Const];
diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index c2e983eebebc10..06d7aaf9badc07 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -19419,6 +19419,16 @@ case Builtin::BI__builtin_hlsl_elementwise_isinf: {
 /*ReturnType=*/Op0->getType(), CGM.getHLSLRuntime().getStepIntrinsic(),
 ArrayRef{Op0, Op1}, nullptr, "hlsl.step");
   }
+  case Builtin::BI__builtin_hlsl_wave_active_all_true: {
+Value *Op = EmitScalarExpr(E->getArg(0));
+llvm::Type *Ty = Op->getType();
+assert(Ty->isIntegerTy(1) &&
+   "Intrinsic WaveActiveAllTrue operand must be a bool");
+
+Intrinsic::ID ID = CGM.getHLSLRuntime().getWaveActiveAllTrueIntrinsic();
+return EmitRuntimeCall(
+Intrinsic::getOrInsertDeclaration(&CGM.getModule(), ID), {Op});
+  }
   case Builtin::BI__builtin_hlsl_wave_active_any_true: {
 Value *Op = EmitScalarExpr(E->getArg(0));
 assert(Op->getType()->isIntegerTy(1) &&
diff --git a/clang/lib/CodeGen/CGHLSLRuntime.h 
b/clang/lib/CodeGen/CGHLSLRuntime.h
index bb120c8b5e9e60..1260bb4bc9001b 100644
--- a/clang/lib/CodeGen/CGHLSLRuntime.h
+++ b/clang/lib/CodeGen/CGHLSLRuntime.h
@@ -91,6 +91,7 @@ class CGHLSLRuntime {
   GENERATE_HLSL_INTRINSIC_FUNCTION(UDot, udot)
   GENERATE_HLSL_INTRINSIC_FUNCTION(Dot4AddI8Packed, dot4add_i8packed)
   GENERATE_HLSL_INTRINSIC_FUNCTION(Dot4AddU8Packed, dot4add_u8packed)
+  GENERATE_HLSL_INTRINSIC_FUNCTION(WaveActiveAllTrue, wave_all)
   GENERATE_HLSL_INTRINSIC_FUNCTION(WaveActiveAnyTrue, wave_any)
   GENERATE_HLSL_INTRINSIC_FUNCTION(WaveActiveCountBits, wave_active_countbits)
   GENERATE_HLSL_INTRINSIC_FUNCTION(WaveIsFirstLane, wave_is_first_lane)
diff --git a/clang/lib/Headers/hlsl/hlsl_intrinsics.h 
b/clang/lib/Headers/hlsl/hlsl_intrinsics.h
index 1126e13600f8af..b745997f1d5a2b 100644
--- a/clang/lib/Headers/hlsl/hlsl_intrinsics.h
+++ b/clang/lib/Headers/hlsl/hlsl_intrinsics.h
@@ -2241,6 +2241,15 @@ float4 trunc(float4);
 // Wave* builtins
 
//===--===//
 
+/// \brief Returns true if the expression is true in all active lanes in the
+/// current wave.
+///
+/// \param Val The boolean expression to evaluate.
+/// \return True if the expression is true in all lanes.
+_HLSL_AVAILABILITY(shadermodel, 6.0)
+_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_all_true)
+__attribute__((convergent)) bool WaveActiveAllTrue(bool Val);
+
 /// \brief Returns true if the expression is true in any active lane in the
 /// current wave.
 ///
diff --git a/clang/test/CodeGenHLSL/builtins/WaveActiveAllTrue.hlsl 
b/clang/test/CodeGenHLSL/builtins/WaveActiveAllTrue.hlsl
new file mode 100644
index 00..df530a9cee561a
--- /dev/null
+++ b/clang/test/CodeGenHLSL/builtins/WaveActiveAllTrue.hlsl
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 -finclude-default-header -fnative-half-type -triple \
+// RUN:   dxil-pc-shadermodel6.3-co

[clang] [clang][Darwin] Remove legacy framework search path logic in the frontend (PR #120149)

2024-12-16 Thread Artem Belevich via cfe-commits


@@ -1,13 +1,6 @@
-// RUN: %clang -cc1 -fcuda-is-device -isysroot /var/empty \
-// RUN:   -triple nvptx-nvidia-cuda -aux-triple i386-apple-macosx \
-// RUN:   -E -fcuda-is-device -v -o /dev/null -x cuda %s 2>&1 | FileCheck %s
-
-// RUN: %clang -cc1 -isysroot /var/empty \
-// RUN:   -triple i386-apple-macosx -aux-triple nvptx-nvidia-cuda \
-// RUN:   -E -fcuda-is-device -v -o /dev/null -x cuda %s 2>&1 | FileCheck %s
-
 // Check that when we do CUDA host and device compiles on MacOS, we check for
 // includes in /System/Library/Frameworks and /Library/Frameworks.
 
-// CHECK-DAG: ignoring nonexistent directory 
"/var/empty/System/Library/Frameworks"
-// CHECK-DAG: ignoring nonexistent directory "/var/empty/Library/Frameworks"
+// RUN: %clang -isysroot /var/empty -target unknown-nvidia-cuda -v 
-fsyntax-only -x cuda %s -### 2>&1 | FileCheck %s

Artem-B wrote:

Nope. I believe they've dropped MacOS in CUDA-11. 10.2 was the last one.
https://docs.nvidia.com/cuda/archive/10.2/cuda-toolkit-release-notes/index.html#cuda-general-new-features

```
CUDA 10.2 (Toolkit and NVIDIA driver) is the last release to support macOS for 
developing and running CUDA applications. Support for macOS will not be 
available starting with the next release of CUDA.
```

CUDA on MAC has never been properly supported. It kind-of-sort-of worked, but 
nobody owned or maintained it beyond whatever happened to be touched by LLVM 
tests.
By now, I think we can remove cuda-on-mac tests and related code.

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


[clang] Add concepts for Structured buffers (PR #119643)

2024-12-16 Thread Joshua Batista via cfe-commits

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


[clang] [Clang] Fix crash in __builtin_assume_aligned (PR #114217)

2024-12-16 Thread Shafik Yaghmour via cfe-commits

shafik wrote:

ping on this we have another regression linked to the original change: 
https://github.com/llvm/llvm-project/issues/120086 

We really should land a fix ASAP, this is now three regression linked to the 
same change.

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


[clang] [lldb] [clang][DebugInfo][gmodules] Set runtimeLang on ObjC forward declarations (PR #120154)

2024-12-16 Thread via cfe-commits

llvmbot wrote:



@llvm/pr-subscribers-lldb

@llvm/pr-subscribers-clang

Author: Michael Buch (Michael137)


Changes

In Objective-C, forward declarations are currently represented as:
```
DW_TAG_structure_type
  DW_AT_name("Foo")
  DW_AT_declaration (true)
  DW_AT_APPLE_runtime_class (DW_LANG_ObjC)
```
However, when compiling with `-gmodules`, when a class definition is turned 
into a forward declaration within a `DW_TAG_module`, the DIE for the forward 
declaration looks as follows:
```
DW_TAG_structure_type
  DW_AT_name("Foo")
  DW_AT_declaration (true)
```

Note the absence of `DW_AT_APPLE_runtime_class`. With recent changes in LLDB, 
not being able to differentiate between C++ and Objective-C forward 
declarations has become problematic (see attached test-case and explanation in 
https://github.com/llvm/llvm-project/pull/119860).

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


4 Files Affected:

- (modified) clang/lib/CodeGen/CGDebugInfo.cpp (+6-5) 
- (modified) clang/test/Modules/ExtDebugInfo.m (+2-1) 
- (modified) clang/test/Modules/ModuleDebugInfo.m (+1) 
- (added) lldb/test/Shell/SymbolFile/DWARF/objc-gmodules-class-extension.test 
(+34) 


``diff
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp 
b/clang/lib/CodeGen/CGDebugInfo.cpp
index 60f32f76109e9a..ff27690d47b080 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -2995,20 +2995,21 @@ llvm::DIType *CGDebugInfo::CreateType(const 
ObjCInterfaceType *Ty,
   if (!ID)
 return nullptr;
 
+  auto RuntimeLang =
+  static_cast(TheCU->getSourceLanguage());
+
   // Return a forward declaration if this type was imported from a clang 
module,
   // and this is not the compile unit with the implementation of the type 
(which
   // may contain hidden ivars).
   if (DebugTypeExtRefs && ID->isFromASTFile() && ID->getDefinition() &&
   !ID->getImplementation())
-return DBuilder.createForwardDecl(llvm::dwarf::DW_TAG_structure_type,
-  ID->getName(),
-  getDeclContextDescriptor(ID), Unit, 0);
+return DBuilder.createForwardDecl(
+llvm::dwarf::DW_TAG_structure_type, ID->getName(),
+getDeclContextDescriptor(ID), Unit, 0, RuntimeLang);
 
   // Get overall information about the record type for the debug info.
   llvm::DIFile *DefUnit = getOrCreateFile(ID->getLocation());
   unsigned Line = getLineNumber(ID->getLocation());
-  auto RuntimeLang =
-  static_cast(TheCU->getSourceLanguage());
 
   // If this is just a forward declaration return a special forward-declaration
   // debug type since we won't be able to lay out the entire type.
diff --git a/clang/test/Modules/ExtDebugInfo.m 
b/clang/test/Modules/ExtDebugInfo.m
index b6a8b2676e5ba4..e2611ae5300634 100644
--- a/clang/test/Modules/ExtDebugInfo.m
+++ b/clang/test/Modules/ExtDebugInfo.m
@@ -75,7 +75,8 @@ int foo(ObjCClass *c) {
 
 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "ObjCClass",
 // CHECK-SAME: scope: ![[MOD]],
-// CHECK-SAME: flags: DIFlagFwdDecl)
+// CHECK-SAME: flags: DIFlagFwdDecl,
+// CHECK-SAME: runtimeLang: DW_LANG_ObjC)
 
 // CHECK-NOT: !DICompositeType(tag: DW_TAG_structure_type,
 // CHECK: !DICompositeType(tag: DW_TAG_enumeration_type,
diff --git a/clang/test/Modules/ModuleDebugInfo.m 
b/clang/test/Modules/ModuleDebugInfo.m
index 62c6fd68dd8546..c527c43a0f4a2c 100644
--- a/clang/test/Modules/ModuleDebugInfo.m
+++ b/clang/test/Modules/ModuleDebugInfo.m
@@ -39,6 +39,7 @@
 
 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "FwdDecl",
 // CHECK-SAME: scope: ![[MODULE]],
+// CHECK-SAME: runtimeLang: DW_LANG_ObjC
 
 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "ObjCClass",
 // CHECK-SAME: scope: ![[MODULE]],
diff --git 
a/lldb/test/Shell/SymbolFile/DWARF/objc-gmodules-class-extension.test 
b/lldb/test/Shell/SymbolFile/DWARF/objc-gmodules-class-extension.test
new file mode 100644
index 00..330a6b338c4723
--- /dev/null
+++ b/lldb/test/Shell/SymbolFile/DWARF/objc-gmodules-class-extension.test
@@ -0,0 +1,34 @@
+# REQUIRES: system-darwin
+
+# Test that we can set a breakpoint in a method of a class extension.
+# This requires us to parse the method into an AST type, and the context
+# too (which in DWARF is just a forward declaration).
+#
+# RUN: split-file %s %t
+# RUN: %clangxx_host %t/lib.m  -c -g -gmodules -fmodules -o %t/lib.o
+# RUN: %clangxx_host %t/main.m -g -gmodules -fmodules %t/lib.o -o %t/a.out 
-framework Foundation
+#
+# RUN: %lldb %t/a.out -o "breakpoint set -f lib.m -l 6" -o exit | FileCheck %s
+
+# CHECK: (lldb) breakpoint set -f lib.m -l 6
+# CHECK: Breakpoint 1: where = a.out`-[NSObject(Foo) func]
+
+#--- main.m
+int main() {
+  return 0;
+}
+
+#--- lib.m
+#import 
+
+@implementation NSObject (Foo)
+- (NSError *)func {
+N

[clang] [lldb] [clang][DebugInfo][gmodules] Set runtimeLang on ObjC forward declarations (PR #120154)

2024-12-16 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang-modules

Author: Michael Buch (Michael137)


Changes

In Objective-C, forward declarations are currently represented as:
```
DW_TAG_structure_type
  DW_AT_name("Foo")
  DW_AT_declaration (true)
  DW_AT_APPLE_runtime_class (DW_LANG_ObjC)
```
However, when compiling with `-gmodules`, when a class definition is turned 
into a forward declaration within a `DW_TAG_module`, the DIE for the forward 
declaration looks as follows:
```
DW_TAG_structure_type
  DW_AT_name("Foo")
  DW_AT_declaration (true)
```

Note the absence of `DW_AT_APPLE_runtime_class`. With recent changes in LLDB, 
not being able to differentiate between C++ and Objective-C forward 
declarations has become problematic (see attached test-case and explanation in 
https://github.com/llvm/llvm-project/pull/119860).

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


4 Files Affected:

- (modified) clang/lib/CodeGen/CGDebugInfo.cpp (+6-5) 
- (modified) clang/test/Modules/ExtDebugInfo.m (+2-1) 
- (modified) clang/test/Modules/ModuleDebugInfo.m (+1) 
- (added) lldb/test/Shell/SymbolFile/DWARF/objc-gmodules-class-extension.test 
(+34) 


``diff
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp 
b/clang/lib/CodeGen/CGDebugInfo.cpp
index 60f32f76109e9a..ff27690d47b080 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -2995,20 +2995,21 @@ llvm::DIType *CGDebugInfo::CreateType(const 
ObjCInterfaceType *Ty,
   if (!ID)
 return nullptr;
 
+  auto RuntimeLang =
+  static_cast(TheCU->getSourceLanguage());
+
   // Return a forward declaration if this type was imported from a clang 
module,
   // and this is not the compile unit with the implementation of the type 
(which
   // may contain hidden ivars).
   if (DebugTypeExtRefs && ID->isFromASTFile() && ID->getDefinition() &&
   !ID->getImplementation())
-return DBuilder.createForwardDecl(llvm::dwarf::DW_TAG_structure_type,
-  ID->getName(),
-  getDeclContextDescriptor(ID), Unit, 0);
+return DBuilder.createForwardDecl(
+llvm::dwarf::DW_TAG_structure_type, ID->getName(),
+getDeclContextDescriptor(ID), Unit, 0, RuntimeLang);
 
   // Get overall information about the record type for the debug info.
   llvm::DIFile *DefUnit = getOrCreateFile(ID->getLocation());
   unsigned Line = getLineNumber(ID->getLocation());
-  auto RuntimeLang =
-  static_cast(TheCU->getSourceLanguage());
 
   // If this is just a forward declaration return a special forward-declaration
   // debug type since we won't be able to lay out the entire type.
diff --git a/clang/test/Modules/ExtDebugInfo.m 
b/clang/test/Modules/ExtDebugInfo.m
index b6a8b2676e5ba4..e2611ae5300634 100644
--- a/clang/test/Modules/ExtDebugInfo.m
+++ b/clang/test/Modules/ExtDebugInfo.m
@@ -75,7 +75,8 @@ int foo(ObjCClass *c) {
 
 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "ObjCClass",
 // CHECK-SAME: scope: ![[MOD]],
-// CHECK-SAME: flags: DIFlagFwdDecl)
+// CHECK-SAME: flags: DIFlagFwdDecl,
+// CHECK-SAME: runtimeLang: DW_LANG_ObjC)
 
 // CHECK-NOT: !DICompositeType(tag: DW_TAG_structure_type,
 // CHECK: !DICompositeType(tag: DW_TAG_enumeration_type,
diff --git a/clang/test/Modules/ModuleDebugInfo.m 
b/clang/test/Modules/ModuleDebugInfo.m
index 62c6fd68dd8546..c527c43a0f4a2c 100644
--- a/clang/test/Modules/ModuleDebugInfo.m
+++ b/clang/test/Modules/ModuleDebugInfo.m
@@ -39,6 +39,7 @@
 
 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "FwdDecl",
 // CHECK-SAME: scope: ![[MODULE]],
+// CHECK-SAME: runtimeLang: DW_LANG_ObjC
 
 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "ObjCClass",
 // CHECK-SAME: scope: ![[MODULE]],
diff --git 
a/lldb/test/Shell/SymbolFile/DWARF/objc-gmodules-class-extension.test 
b/lldb/test/Shell/SymbolFile/DWARF/objc-gmodules-class-extension.test
new file mode 100644
index 00..330a6b338c4723
--- /dev/null
+++ b/lldb/test/Shell/SymbolFile/DWARF/objc-gmodules-class-extension.test
@@ -0,0 +1,34 @@
+# REQUIRES: system-darwin
+
+# Test that we can set a breakpoint in a method of a class extension.
+# This requires us to parse the method into an AST type, and the context
+# too (which in DWARF is just a forward declaration).
+#
+# RUN: split-file %s %t
+# RUN: %clangxx_host %t/lib.m  -c -g -gmodules -fmodules -o %t/lib.o
+# RUN: %clangxx_host %t/main.m -g -gmodules -fmodules %t/lib.o -o %t/a.out 
-framework Foundation
+#
+# RUN: %lldb %t/a.out -o "breakpoint set -f lib.m -l 6" -o exit | FileCheck %s
+
+# CHECK: (lldb) breakpoint set -f lib.m -l 6
+# CHECK: Breakpoint 1: where = a.out`-[NSObject(Foo) func]
+
+#--- main.m
+int main() {
+  return 0;
+}
+
+#--- lib.m
+#import 
+
+@implementation NSObject (Foo)
+- (NSError *)func {
+NSLog(@"Hello, Worl

[clang] [lldb] [clang][DebugInfo][gmodules] Set runtimeLang on ObjC forward declarations (PR #120154)

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

https://github.com/Michael137 created 
https://github.com/llvm/llvm-project/pull/120154

In Objective-C, forward declarations are currently represented as:
```
DW_TAG_structure_type
  DW_AT_name("Foo")
  DW_AT_declaration (true)
  DW_AT_APPLE_runtime_class (DW_LANG_ObjC)
```
However, when compiling with `-gmodules`, when a class definition is turned 
into a forward declaration within a `DW_TAG_module`, the DIE for the forward 
declaration looks as follows:
```
DW_TAG_structure_type
  DW_AT_name("Foo")
  DW_AT_declaration (true)
```

Note the absence of `DW_AT_APPLE_runtime_class`. With recent changes in LLDB, 
not being able to differentiate between C++ and Objective-C forward 
declarations has become problematic (see attached test-case and explanation in 
https://github.com/llvm/llvm-project/pull/119860).

>From 7c7fd60563244585adb8517bbd414ed45c249af7 Mon Sep 17 00:00:00 2001
From: Michael Buch 
Date: Mon, 16 Dec 2024 22:27:08 +
Subject: [PATCH] [clang][DebugInfo][gmodules] Set runtimeLang on ObjC forward
 declarations

In Objective-C, forward declarations are currently represented as:
```
DW_TAG_structure_type
  DW_AT_name("Foo")
  DW_AT_declaration (true)
  DW_AT_APPLE_runtime_class (DW_LANG_ObjC)
```
However, when compiling with `-gmodules`, when a class definition
is turned into a forward declaration within a `DW_TAG_module`, the
DIE for the forward declaration looks as follows:
```
DW_TAG_structure_type
  DW_AT_name("Foo")
  DW_AT_declaration (true)
```

Note the absence of `DW_AT_APPLE_runtime_class`. With recent changes in
LLDB, not being able to differentiate between C++ and Objective-C
forward declarations has become problematic (see attached test-case
and explanation in https://github.com/llvm/llvm-project/pull/119860).
---
 clang/lib/CodeGen/CGDebugInfo.cpp | 11 +++---
 clang/test/Modules/ExtDebugInfo.m |  3 +-
 clang/test/Modules/ModuleDebugInfo.m  |  1 +
 .../DWARF/objc-gmodules-class-extension.test  | 34 +++
 4 files changed, 43 insertions(+), 6 deletions(-)
 create mode 100644 
lldb/test/Shell/SymbolFile/DWARF/objc-gmodules-class-extension.test

diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp 
b/clang/lib/CodeGen/CGDebugInfo.cpp
index 60f32f76109e9a..ff27690d47b080 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -2995,20 +2995,21 @@ llvm::DIType *CGDebugInfo::CreateType(const 
ObjCInterfaceType *Ty,
   if (!ID)
 return nullptr;
 
+  auto RuntimeLang =
+  static_cast(TheCU->getSourceLanguage());
+
   // Return a forward declaration if this type was imported from a clang 
module,
   // and this is not the compile unit with the implementation of the type 
(which
   // may contain hidden ivars).
   if (DebugTypeExtRefs && ID->isFromASTFile() && ID->getDefinition() &&
   !ID->getImplementation())
-return DBuilder.createForwardDecl(llvm::dwarf::DW_TAG_structure_type,
-  ID->getName(),
-  getDeclContextDescriptor(ID), Unit, 0);
+return DBuilder.createForwardDecl(
+llvm::dwarf::DW_TAG_structure_type, ID->getName(),
+getDeclContextDescriptor(ID), Unit, 0, RuntimeLang);
 
   // Get overall information about the record type for the debug info.
   llvm::DIFile *DefUnit = getOrCreateFile(ID->getLocation());
   unsigned Line = getLineNumber(ID->getLocation());
-  auto RuntimeLang =
-  static_cast(TheCU->getSourceLanguage());
 
   // If this is just a forward declaration return a special forward-declaration
   // debug type since we won't be able to lay out the entire type.
diff --git a/clang/test/Modules/ExtDebugInfo.m 
b/clang/test/Modules/ExtDebugInfo.m
index b6a8b2676e5ba4..e2611ae5300634 100644
--- a/clang/test/Modules/ExtDebugInfo.m
+++ b/clang/test/Modules/ExtDebugInfo.m
@@ -75,7 +75,8 @@ int foo(ObjCClass *c) {
 
 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "ObjCClass",
 // CHECK-SAME: scope: ![[MOD]],
-// CHECK-SAME: flags: DIFlagFwdDecl)
+// CHECK-SAME: flags: DIFlagFwdDecl,
+// CHECK-SAME: runtimeLang: DW_LANG_ObjC)
 
 // CHECK-NOT: !DICompositeType(tag: DW_TAG_structure_type,
 // CHECK: !DICompositeType(tag: DW_TAG_enumeration_type,
diff --git a/clang/test/Modules/ModuleDebugInfo.m 
b/clang/test/Modules/ModuleDebugInfo.m
index 62c6fd68dd8546..c527c43a0f4a2c 100644
--- a/clang/test/Modules/ModuleDebugInfo.m
+++ b/clang/test/Modules/ModuleDebugInfo.m
@@ -39,6 +39,7 @@
 
 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "FwdDecl",
 // CHECK-SAME: scope: ![[MODULE]],
+// CHECK-SAME: runtimeLang: DW_LANG_ObjC
 
 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "ObjCClass",
 // CHECK-SAME: scope: ![[MODULE]],
diff --git 
a/lldb/test/Shell/SymbolFile/DWARF/objc-gmodules-class-exte

[clang] [lldb] [clang][DebugInfo][gmodules] Set runtimeLang on ObjC forward declarations (PR #120154)

2024-12-16 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang-codegen

Author: Michael Buch (Michael137)


Changes

In Objective-C, forward declarations are currently represented as:
```
DW_TAG_structure_type
  DW_AT_name("Foo")
  DW_AT_declaration (true)
  DW_AT_APPLE_runtime_class (DW_LANG_ObjC)
```
However, when compiling with `-gmodules`, when a class definition is turned 
into a forward declaration within a `DW_TAG_module`, the DIE for the forward 
declaration looks as follows:
```
DW_TAG_structure_type
  DW_AT_name("Foo")
  DW_AT_declaration (true)
```

Note the absence of `DW_AT_APPLE_runtime_class`. With recent changes in LLDB, 
not being able to differentiate between C++ and Objective-C forward 
declarations has become problematic (see attached test-case and explanation in 
https://github.com/llvm/llvm-project/pull/119860).

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


4 Files Affected:

- (modified) clang/lib/CodeGen/CGDebugInfo.cpp (+6-5) 
- (modified) clang/test/Modules/ExtDebugInfo.m (+2-1) 
- (modified) clang/test/Modules/ModuleDebugInfo.m (+1) 
- (added) lldb/test/Shell/SymbolFile/DWARF/objc-gmodules-class-extension.test 
(+34) 


``diff
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp 
b/clang/lib/CodeGen/CGDebugInfo.cpp
index 60f32f76109e9a..ff27690d47b080 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -2995,20 +2995,21 @@ llvm::DIType *CGDebugInfo::CreateType(const 
ObjCInterfaceType *Ty,
   if (!ID)
 return nullptr;
 
+  auto RuntimeLang =
+  static_cast(TheCU->getSourceLanguage());
+
   // Return a forward declaration if this type was imported from a clang 
module,
   // and this is not the compile unit with the implementation of the type 
(which
   // may contain hidden ivars).
   if (DebugTypeExtRefs && ID->isFromASTFile() && ID->getDefinition() &&
   !ID->getImplementation())
-return DBuilder.createForwardDecl(llvm::dwarf::DW_TAG_structure_type,
-  ID->getName(),
-  getDeclContextDescriptor(ID), Unit, 0);
+return DBuilder.createForwardDecl(
+llvm::dwarf::DW_TAG_structure_type, ID->getName(),
+getDeclContextDescriptor(ID), Unit, 0, RuntimeLang);
 
   // Get overall information about the record type for the debug info.
   llvm::DIFile *DefUnit = getOrCreateFile(ID->getLocation());
   unsigned Line = getLineNumber(ID->getLocation());
-  auto RuntimeLang =
-  static_cast(TheCU->getSourceLanguage());
 
   // If this is just a forward declaration return a special forward-declaration
   // debug type since we won't be able to lay out the entire type.
diff --git a/clang/test/Modules/ExtDebugInfo.m 
b/clang/test/Modules/ExtDebugInfo.m
index b6a8b2676e5ba4..e2611ae5300634 100644
--- a/clang/test/Modules/ExtDebugInfo.m
+++ b/clang/test/Modules/ExtDebugInfo.m
@@ -75,7 +75,8 @@ int foo(ObjCClass *c) {
 
 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "ObjCClass",
 // CHECK-SAME: scope: ![[MOD]],
-// CHECK-SAME: flags: DIFlagFwdDecl)
+// CHECK-SAME: flags: DIFlagFwdDecl,
+// CHECK-SAME: runtimeLang: DW_LANG_ObjC)
 
 // CHECK-NOT: !DICompositeType(tag: DW_TAG_structure_type,
 // CHECK: !DICompositeType(tag: DW_TAG_enumeration_type,
diff --git a/clang/test/Modules/ModuleDebugInfo.m 
b/clang/test/Modules/ModuleDebugInfo.m
index 62c6fd68dd8546..c527c43a0f4a2c 100644
--- a/clang/test/Modules/ModuleDebugInfo.m
+++ b/clang/test/Modules/ModuleDebugInfo.m
@@ -39,6 +39,7 @@
 
 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "FwdDecl",
 // CHECK-SAME: scope: ![[MODULE]],
+// CHECK-SAME: runtimeLang: DW_LANG_ObjC
 
 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "ObjCClass",
 // CHECK-SAME: scope: ![[MODULE]],
diff --git 
a/lldb/test/Shell/SymbolFile/DWARF/objc-gmodules-class-extension.test 
b/lldb/test/Shell/SymbolFile/DWARF/objc-gmodules-class-extension.test
new file mode 100644
index 00..330a6b338c4723
--- /dev/null
+++ b/lldb/test/Shell/SymbolFile/DWARF/objc-gmodules-class-extension.test
@@ -0,0 +1,34 @@
+# REQUIRES: system-darwin
+
+# Test that we can set a breakpoint in a method of a class extension.
+# This requires us to parse the method into an AST type, and the context
+# too (which in DWARF is just a forward declaration).
+#
+# RUN: split-file %s %t
+# RUN: %clangxx_host %t/lib.m  -c -g -gmodules -fmodules -o %t/lib.o
+# RUN: %clangxx_host %t/main.m -g -gmodules -fmodules %t/lib.o -o %t/a.out 
-framework Foundation
+#
+# RUN: %lldb %t/a.out -o "breakpoint set -f lib.m -l 6" -o exit | FileCheck %s
+
+# CHECK: (lldb) breakpoint set -f lib.m -l 6
+# CHECK: Breakpoint 1: where = a.out`-[NSObject(Foo) func]
+
+#--- main.m
+int main() {
+  return 0;
+}
+
+#--- lib.m
+#import 
+
+@implementation NSObject (Foo)
+- (NSError *)func {
+NSLog(@"Hello, Worl

[clang] [lldb] [clang][DebugInfo][gmodules] Set runtimeLang on ObjC forward declarations (PR #120154)

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


@@ -2995,20 +2995,21 @@ llvm::DIType *CGDebugInfo::CreateType(const 
ObjCInterfaceType *Ty,
   if (!ID)
 return nullptr;
 
+  auto RuntimeLang =
+  static_cast(TheCU->getSourceLanguage());
+
   // Return a forward declaration if this type was imported from a clang 
module,
   // and this is not the compile unit with the implementation of the type 
(which
   // may contain hidden ivars).
   if (DebugTypeExtRefs && ID->isFromASTFile() && ID->getDefinition() &&
   !ID->getImplementation())
-return DBuilder.createForwardDecl(llvm::dwarf::DW_TAG_structure_type,
-  ID->getName(),
-  getDeclContextDescriptor(ID), Unit, 0);
+return DBuilder.createForwardDecl(
+llvm::dwarf::DW_TAG_structure_type, ID->getName(),
+getDeclContextDescriptor(ID), Unit, 0, RuntimeLang);

adrian-prantl wrote:

Two things:
1. Shouldn't we do this only for ObjC class types?
2. Shouldn't — even in an ObjC++ CU — the runtimelang on an ObjC class be ObjC?

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


[clang] [lldb] [clang][DebugInfo][gmodules] Set runtimeLang on ObjC forward declarations (PR #120154)

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


@@ -2995,20 +2995,21 @@ llvm::DIType *CGDebugInfo::CreateType(const 
ObjCInterfaceType *Ty,
   if (!ID)
 return nullptr;
 
+  auto RuntimeLang =
+  static_cast(TheCU->getSourceLanguage());
+
   // Return a forward declaration if this type was imported from a clang 
module,
   // and this is not the compile unit with the implementation of the type 
(which
   // may contain hidden ivars).
   if (DebugTypeExtRefs && ID->isFromASTFile() && ID->getDefinition() &&
   !ID->getImplementation())
-return DBuilder.createForwardDecl(llvm::dwarf::DW_TAG_structure_type,
-  ID->getName(),
-  getDeclContextDescriptor(ID), Unit, 0);
+return DBuilder.createForwardDecl(
+llvm::dwarf::DW_TAG_structure_type, ID->getName(),
+getDeclContextDescriptor(ID), Unit, 0, RuntimeLang);

Michael137 wrote:

This overload is specifically for `const ObjCInterfaceType *Ty`. So we're 
always dealing with ObjC classes here.

On line `3021` we're setting the RuntimeLang in the same way. I think we should 
stay consistent with whatever we attach to a definition. All the places in 
`dsymutil` and `LLDB` that read `DW_AT_APPLE_runtime_class` check for both 
`ObjC` and `ObjC++`. So looks like both are valid

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


[clang] Reland [Clang] skip default argument instantiation for non-defining friend declarations to meet [dcl.fct.default] p4 (PR #115487)

2024-12-16 Thread Matheus Izvekov via cfe-commits


@@ -4692,6 +4692,17 @@ bool Sema::InstantiateDefaultArgument(SourceLocation 
CallLoc, FunctionDecl *FD,
   ParmVarDecl *Param) {
   assert(Param->hasUninstantiatedDefaultArg());
 
+  // FIXME: We don't track member specialization info for non-defining
+  // friend declarations, so we will not be able to later find the function
+  // pattern. As a workaround, don't instantiate the default argument in this
+  // case. This is correct per wording and only an error recovery issue, as per

mizvekov wrote:

The tests for this error recovery issue is already there, it was suggested and 
included in the original PR.
See test case marked with FIXME.

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


[clang] Reapply "[Driver][OHOS] Fix lld link issue for OHOS (#118192)" (PR #120159)

2024-12-16 Thread Peng Huang via cfe-commits

https://github.com/phuang created 
https://github.com/llvm/llvm-project/pull/120159

The problem in original change is because OHOS::getCompilerRT()
pickes a wrong builtin runtime 
(./lib/clang/20/lib/linux/libclang_rt.builtins-x86_64.a),
if ./lib/clang/20/lib/linux/libclang_rt.builtins-x86_64.a does exist on
the test filesystem. Address the problem by adding a env suffix
"-ohos" into the runtime library file.

>From db61f4b2fdc31d162a9a3b07e32dae8caa476152 Mon Sep 17 00:00:00 2001
From: Peng Huang 
Date: Mon, 16 Dec 2024 10:07:02 -0500
Subject: [PATCH 1/2] Reapply "[Driver][OHOS] Fix lld link issue for OHOS
 (#118192)"

This reverts commit 1911919682c863643787b30286bb67359c7932f4.
---
 clang/lib/Driver/ToolChains/OHOS.cpp | 60 
 1 file changed, 26 insertions(+), 34 deletions(-)

diff --git a/clang/lib/Driver/ToolChains/OHOS.cpp 
b/clang/lib/Driver/ToolChains/OHOS.cpp
index 6e1a09ae908b2f..c9a532771b99e5 100644
--- a/clang/lib/Driver/ToolChains/OHOS.cpp
+++ b/clang/lib/Driver/ToolChains/OHOS.cpp
@@ -19,8 +19,8 @@
 #include "llvm/ProfileData/InstrProf.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/Path.h"
-#include "llvm/Support/VirtualFileSystem.h"
 #include "llvm/Support/ScopedPrinter.h"
+#include "llvm/Support/VirtualFileSystem.h"
 
 using namespace clang::driver;
 using namespace clang::driver::toolchains;
@@ -58,11 +58,9 @@ static bool findOHOSMuslMultilibs(const Driver &D,
   return false;
 }
 
-static bool findOHOSMultilibs(const Driver &D,
-  const ToolChain &TC,
-  const llvm::Triple &TargetTriple,
-  StringRef Path, const ArgList &Args,
-  DetectedMultilibs &Result) {
+static bool findOHOSMultilibs(const Driver &D, const ToolChain &TC,
+  const llvm::Triple &TargetTriple, StringRef Path,
+  const ArgList &Args, DetectedMultilibs &Result) {
   Multilib::flags_list Flags;
   bool IsA7 = false;
   if (const Arg *A = Args.getLastArg(options::OPT_mcpu_EQ))
@@ -172,8 +170,7 @@ OHOS::OHOS(const Driver &D, const llvm::Triple &Triple, 
const ArgList &Args)
   Paths);
 }
 
-ToolChain::RuntimeLibType OHOS::GetRuntimeLibType(
-const ArgList &Args) const {
+ToolChain::RuntimeLibType OHOS::GetRuntimeLibType(const ArgList &Args) const {
   if (Arg *A = Args.getLastArg(clang::driver::options::OPT_rtlib_EQ)) {
 StringRef Value = A->getValue();
 if (Value != "compiler-rt")
@@ -184,20 +181,19 @@ ToolChain::RuntimeLibType OHOS::GetRuntimeLibType(
   return ToolChain::RLT_CompilerRT;
 }
 
-ToolChain::CXXStdlibType
-OHOS::GetCXXStdlibType(const ArgList &Args) const {
+ToolChain::CXXStdlibType OHOS::GetCXXStdlibType(const ArgList &Args) const {
   if (Arg *A = Args.getLastArg(options::OPT_stdlib_EQ)) {
 StringRef Value = A->getValue();
 if (Value != "libc++")
   getDriver().Diag(diag::err_drv_invalid_stdlib_name)
-<< A->getAsString(Args);
+  << A->getAsString(Args);
   }
 
   return ToolChain::CST_Libcxx;
 }
 
 void OHOS::AddClangSystemIncludeArgs(const ArgList &DriverArgs,
-ArgStringList &CC1Args) const {
+ ArgStringList &CC1Args) const {
   const Driver &D = getDriver();
   const llvm::Triple &Triple = getTriple();
   std::string SysRoot = computeSysRoot();
@@ -258,7 +254,7 @@ void OHOS::AddClangCXXStdlibIncludeArgs(const ArgList 
&DriverArgs,
 }
 
 void OHOS::AddCXXStdlibLibArgs(const ArgList &Args,
-  ArgStringList &CmdArgs) const {
+   ArgStringList &CmdArgs) const {
   switch (GetCXXStdlibType(Args)) {
   case ToolChain::CST_Libcxx:
 CmdArgs.push_back("-lc++");
@@ -291,7 +287,8 @@ ToolChain::path_list OHOS::getRuntimePaths() const {
 
   // First try the triple passed to driver as --target=.
   P.assign(D.ResourceDir);
-  llvm::sys::path::append(P, "lib", D.getTargetTriple(), 
SelectedMultilib.gccSuffix());
+  llvm::sys::path::append(P, "lib", D.getTargetTriple(),
+  SelectedMultilib.gccSuffix());
   Paths.push_back(P.c_str());
 
   // Second try the normalized triple.
@@ -340,26 +337,20 @@ std::string OHOS::getDynamicLinker(const ArgList &Args) 
const {
 
 std::string OHOS::getCompilerRT(const ArgList &Args, StringRef Component,
 FileType Type) const {
+  std::string CRTBasename =
+  buildCompilerRTBasename(Args, Component, Type, /*AddArch=*/false);
+
   SmallString<128> Path(getDriver().ResourceDir);
   llvm::sys::path::append(Path, "lib", getMultiarchTriple(getTriple()),
-  SelectedMultilib.gccSuffix());
-  const char *Prefix =
-  Type == ToolChain::FT_Object ? "" : "lib";
-  const char *Suffix;
-  switch (Type) {
-  case ToolChain::FT_Object:
-Suffix = ".o";
-break;
-  case ToolChain::FT_Stati

[clang] Reapply "[Driver][OHOS] Fix lld link issue for OHOS (#118192)" (PR #120159)

2024-12-16 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang-driver

Author: Peng Huang (phuang)


Changes

The problem in original change is because OHOS::getCompilerRT()
pickes a wrong builtin runtime 
(./lib/clang/20/lib/linux/libclang_rt.builtins-x86_64.a),
if ./lib/clang/20/lib/linux/libclang_rt.builtins-x86_64.a does exist on
the test filesystem. Address the problem by adding a env suffix
"-ohos" into the runtime library file.

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


2 Files Affected:

- (modified) clang/lib/Driver/ToolChain.cpp (+7-1) 
- (modified) clang/lib/Driver/ToolChains/OHOS.cpp (+26-34) 


``diff
diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
index 9f174fbda398b5..f12a2744391e9a 100644
--- a/clang/lib/Driver/ToolChain.cpp
+++ b/clang/lib/Driver/ToolChain.cpp
@@ -745,7 +745,13 @@ std::string ToolChain::buildCompilerRTBasename(const 
llvm::opt::ArgList &Args,
   std::string ArchAndEnv;
   if (AddArch) {
 StringRef Arch = getArchNameForCompilerRTLib(*this, Args);
-const char *Env = TT.isAndroid() ? "-android" : "";
+const char *Env = NULL;
+if (TT.isAndroid())
+  Env = "-android";
+else if (TT.isOHOSFamily())
+  Env = "-ohos";
+else
+  Env = "";
 ArchAndEnv = ("-" + Arch + Env).str();
   }
   return (Prefix + Twine("clang_rt.") + Component + ArchAndEnv + Suffix).str();
diff --git a/clang/lib/Driver/ToolChains/OHOS.cpp 
b/clang/lib/Driver/ToolChains/OHOS.cpp
index 6e1a09ae908b2f..c9a532771b99e5 100644
--- a/clang/lib/Driver/ToolChains/OHOS.cpp
+++ b/clang/lib/Driver/ToolChains/OHOS.cpp
@@ -19,8 +19,8 @@
 #include "llvm/ProfileData/InstrProf.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/Path.h"
-#include "llvm/Support/VirtualFileSystem.h"
 #include "llvm/Support/ScopedPrinter.h"
+#include "llvm/Support/VirtualFileSystem.h"
 
 using namespace clang::driver;
 using namespace clang::driver::toolchains;
@@ -58,11 +58,9 @@ static bool findOHOSMuslMultilibs(const Driver &D,
   return false;
 }
 
-static bool findOHOSMultilibs(const Driver &D,
-  const ToolChain &TC,
-  const llvm::Triple &TargetTriple,
-  StringRef Path, const ArgList &Args,
-  DetectedMultilibs &Result) {
+static bool findOHOSMultilibs(const Driver &D, const ToolChain &TC,
+  const llvm::Triple &TargetTriple, StringRef Path,
+  const ArgList &Args, DetectedMultilibs &Result) {
   Multilib::flags_list Flags;
   bool IsA7 = false;
   if (const Arg *A = Args.getLastArg(options::OPT_mcpu_EQ))
@@ -172,8 +170,7 @@ OHOS::OHOS(const Driver &D, const llvm::Triple &Triple, 
const ArgList &Args)
   Paths);
 }
 
-ToolChain::RuntimeLibType OHOS::GetRuntimeLibType(
-const ArgList &Args) const {
+ToolChain::RuntimeLibType OHOS::GetRuntimeLibType(const ArgList &Args) const {
   if (Arg *A = Args.getLastArg(clang::driver::options::OPT_rtlib_EQ)) {
 StringRef Value = A->getValue();
 if (Value != "compiler-rt")
@@ -184,20 +181,19 @@ ToolChain::RuntimeLibType OHOS::GetRuntimeLibType(
   return ToolChain::RLT_CompilerRT;
 }
 
-ToolChain::CXXStdlibType
-OHOS::GetCXXStdlibType(const ArgList &Args) const {
+ToolChain::CXXStdlibType OHOS::GetCXXStdlibType(const ArgList &Args) const {
   if (Arg *A = Args.getLastArg(options::OPT_stdlib_EQ)) {
 StringRef Value = A->getValue();
 if (Value != "libc++")
   getDriver().Diag(diag::err_drv_invalid_stdlib_name)
-<< A->getAsString(Args);
+  << A->getAsString(Args);
   }
 
   return ToolChain::CST_Libcxx;
 }
 
 void OHOS::AddClangSystemIncludeArgs(const ArgList &DriverArgs,
-ArgStringList &CC1Args) const {
+ ArgStringList &CC1Args) const {
   const Driver &D = getDriver();
   const llvm::Triple &Triple = getTriple();
   std::string SysRoot = computeSysRoot();
@@ -258,7 +254,7 @@ void OHOS::AddClangCXXStdlibIncludeArgs(const ArgList 
&DriverArgs,
 }
 
 void OHOS::AddCXXStdlibLibArgs(const ArgList &Args,
-  ArgStringList &CmdArgs) const {
+   ArgStringList &CmdArgs) const {
   switch (GetCXXStdlibType(Args)) {
   case ToolChain::CST_Libcxx:
 CmdArgs.push_back("-lc++");
@@ -291,7 +287,8 @@ ToolChain::path_list OHOS::getRuntimePaths() const {
 
   // First try the triple passed to driver as --target=.
   P.assign(D.ResourceDir);
-  llvm::sys::path::append(P, "lib", D.getTargetTriple(), 
SelectedMultilib.gccSuffix());
+  llvm::sys::path::append(P, "lib", D.getTargetTriple(),
+  SelectedMultilib.gccSuffix());
   Paths.push_back(P.c_str());
 
   // Second try the normalized triple.
@@ -340,26 +337,20 @@ std::string OHOS::getDynamicLinker(const ArgList &Args) 
const {
 
 std::string OHOS::getCompilerRT(const ArgList 

[clang] Fix lld link issue for OHOS (PR #118192)

2024-12-16 Thread Peng Huang via cfe-commits

phuang wrote:

I still cannot repro the problem locally, but base on th log in 
http://45.33.8.238/linux/155432/step_6.txt . Looks like clang tries to search 
runtime library at 
"/usr/local/google/home/thakis/src/llvm-project/out/gn/lib/clang/20/lib/linux/libclang_rt.builtins-x86_64.a"
 (It is the OldPath in 
https://github.com/llvm/llvm-project/blob/main/clang/lib/Driver/ToolChain.cpp#L771).
 Not sure why the file does exist on the gn bot. Maybe it is not a clean build. 
I workarounded the problem by adding "-ohos" suffix in the runtime library like 
android. 

@kpdev  @nico , could you please take a look the new PR 
https://github.com/llvm/llvm-project/pull/120159

Thanks.

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


[clang] [llvm] [AArch64] Implement intrinsics for FMLAL/FMLALL (single) (PR #119568)

2024-12-16 Thread via cfe-commits

https://github.com/SpencerAbson updated 
https://github.com/llvm/llvm-project/pull/119568

>From 99f84f987992dcfa4bd32891b7fd5152ba92eca3 Mon Sep 17 00:00:00 2001
From: Spencer Abson 
Date: Wed, 11 Dec 2024 14:01:06 +
Subject: [PATCH] [AArch64] Implement intrinsics for FMLAL/FMLALL (single)

---
 clang/include/clang/Basic/arm_sme.td  |  38 +++--
 .../fp8-intrinsics/acle_sme2_fp8_mla.c| 130 --
 .../acle_sme2_fp8_mla.c   |  18 +++
 llvm/include/llvm/IR/IntrinsicsAArch64.td |  25 
 .../lib/Target/AArch64/AArch64SMEInstrInfo.td |  56 
 llvm/lib/Target/AArch64/SMEInstrFormats.td|  57 
 .../AArch64/sme2-fp8-intrinsics-mla.ll| 101 +-
 7 files changed, 354 insertions(+), 71 deletions(-)

diff --git a/clang/include/clang/Basic/arm_sme.td 
b/clang/include/clang/Basic/arm_sme.td
index 372cc1103d179b..859d5fdfea504d 100644
--- a/clang/include/clang/Basic/arm_sme.td
+++ b/clang/include/clang/Basic/arm_sme.td
@@ -860,24 +860,38 @@ let SMETargetGuard = "sme-f8f32" in {
   def SVMOPA_FP8_ZA32 : Inst<"svmopa_za32[_mf8]_m_fpm", "viPPdd>", "m", 
MergeNone, "aarch64_sme_fp8_fmopa_za32",
  [IsStreaming, IsInOutZA, SetsFPMR, 
IsOverloadNone], [ImmCheck<0, ImmCheck0_3>]>;
// FMLALL (indexed)
-  def SVMLA_FP8_ZA32_VG4x1 : Inst<"svmla_lane_za32[_mf8]_vg4x1_fpm", "vmddi>", 
"m", MergeNone, "aarch64_sme_fp8_fmlall_lane_za32_vg4x1",
-  [IsStreaming, IsInOutZA, SetsFPMR, 
IsOverloadNone], [ImmCheck<3, ImmCheck0_15>]>;
-  def SVMLA_FP8_ZA32_VG4x2 : Inst<"svmla_lane_za32[_mf8]_vg4x2_fpm", "vm2di>", 
"m", MergeNone, "aarch64_sme_fp8_fmlall_lane_za32_vg4x2",
-  [IsStreaming, IsInOutZA, SetsFPMR, 
IsOverloadNone], [ImmCheck<3, ImmCheck0_15>]>;
-  def SVMLA_FP8_ZA16_VG4x4 : Inst<"svmla_lane_za32[_mf8]_vg4x4_fpm", "vm4di>", 
"m", MergeNone, "aarch64_sme_fp8_fmlall_lane_za32_vg4x4",
-  [IsStreaming, IsInOutZA, SetsFPMR, 
IsOverloadNone], [ImmCheck<3, ImmCheck0_15>]>;
+  def SVMLA_FP8_LANE_ZA32_VG4x1 : Inst<"svmla_lane_za32[_mf8]_vg4x1_fpm", 
"vmddi>", "m", MergeNone, "aarch64_sme_fp8_fmlall_lane_za32_vg4x1",
+   [IsStreaming, IsInOutZA, SetsFPMR, 
IsOverloadNone], [ImmCheck<3, ImmCheck0_15>]>;
+  def SVMLA_FP8_LANE_ZA32_VG4x2 : Inst<"svmla_lane_za32[_mf8]_vg4x2_fpm", 
"vm2di>", "m", MergeNone, "aarch64_sme_fp8_fmlall_lane_za32_vg4x2",
+   [IsStreaming, IsInOutZA, SetsFPMR, 
IsOverloadNone], [ImmCheck<3, ImmCheck0_15>]>;
+  def SVMLA_FP8_LANE_ZA16_VG4x4 : Inst<"svmla_lane_za32[_mf8]_vg4x4_fpm", 
"vm4di>", "m", MergeNone, "aarch64_sme_fp8_fmlall_lane_za32_vg4x4",
+   [IsStreaming, IsInOutZA, SetsFPMR, 
IsOverloadNone], [ImmCheck<3, ImmCheck0_15>]>;
+  // FMLALL (single)
+  def SVMLA_FP8_SINGLE_ZA32_VG4x1 : 
Inst<"svmla[_single]_za32[_mf8]_vg4x1_fpm", "vmdd>", "m", MergeNone, 
"aarch64_sme_fp8_fmlall_single_za32_vg4x1",
+ [IsStreaming, IsInOutZA, SetsFPMR, 
IsOverloadNone], []>;
+  def SVMLA_FP8_SINGLE_ZA32_VG4x2 : 
Inst<"svmla[_single]_za32[_mf8]_vg4x2_fpm", "vm2d>", "m", MergeNone, 
"aarch64_sme_fp8_fmlall_single_za32_vg4x2",
+ [IsStreaming, IsInOutZA, SetsFPMR, 
IsOverloadNone], []>;
+  def SVMLA_FP8_SINGLE_ZA32_VG4x4 : 
Inst<"svmla[_single]_za32[_mf8]_vg4x4_fpm", "vm4d>", "m", MergeNone, 
"aarch64_sme_fp8_fmlall_single_za32_vg4x4",
+ [IsStreaming, IsInOutZA, SetsFPMR, 
IsOverloadNone], []>;
 }
 
 let SMETargetGuard = "sme-f8f16" in {
   def SVMOPA_FP8_ZA16 : Inst<"svmopa_za16[_mf8]_m_fpm", "viPPdd>", "m", 
MergeNone, "aarch64_sme_fp8_fmopa_za16",
  [IsStreaming, IsInOutZA, SetsFPMR, 
IsOverloadNone], [ImmCheck<0, ImmCheck0_1>]>;
   // FMLAL (indexed)
-  def SVMLA_FP8_ZA16_VG2x1 : Inst<"svmla_lane_za16[_mf8]_vg2x1_fpm", "vmddi>", 
"m", MergeNone, "aarch64_sme_fp8_fmlal_lane_za16_vg2x1",
-  [IsStreaming, IsInOutZA, SetsFPMR, 
IsOverloadNone], [ImmCheck<3, ImmCheck0_15>]>;
-  def SVMLA_FP8_ZA16_VG2x2 : Inst<"svmla_lane_za16[_mf8]_vg2x2_fpm", "vm2di>", 
"m", MergeNone, "aarch64_sme_fp8_fmlal_lane_za16_vg2x2",
-  [IsStreaming, IsInOutZA, SetsFPMR, 
IsOverloadNone], [ImmCheck<3, ImmCheck0_15>]>;
-  def SVMLA_FP8_ZA16_VG2x4 : Inst<"svmla_lane_za16[_mf8]_vg2x4_fpm", "vm4di>", 
"m", MergeNone, "aarch64_sme_fp8_fmlal_lane_za16_vg2x4",
-  [IsStreaming, IsInOutZA, SetsFPMR, 
IsOverloadNone], [ImmCheck<3, ImmCheck0_15>]>;
+  def SVMLA_FP8_LANE_ZA16_VG2x1 : Inst<"svmla_lane_za16[_mf8]_vg2x1_fpm", 
"vmddi>", "m", MergeNone, "aarch64_sme_fp8_fmlal_lane_za16_vg2x1",
+   [IsStreaming, IsInOutZA, SetsFPMR, 
IsOverloadNone], [ImmCheck<3, ImmCheck0_15>]

[clang] Fix double-quotes in diagnostic when attempting to access a ext_vector of bools (PR #118186)

2024-12-16 Thread Erich Keane via cfe-commits


@@ -434,8 +434,11 @@ CheckExtVectorComponent(Sema &S, QualType baseType, 
ExprValueKind &VK,
   if (!HalvingSwizzle && *compStr) {
 // We didn't get to the end of the string. This means the component names
 // didn't come from the same set *or* we encountered an illegal name.
-S.Diag(OpLoc, diag::err_ext_vector_component_name_illegal)
-  << StringRef(compStr, 1) << SourceRange(CompLoc);
+size_t Offset = compStr - CompName->getNameStart() + 1;
+char Fmt[3] = {'\'', *compStr, '\''};
+S.Diag(OpLoc.getLocWithOffset(Offset),
+   diag::err_ext_vector_component_name_illegal)
+<< StringRef(Fmt, 3) << SourceRange(CompLoc);

erichkeane wrote:

Can someone explain how this works?  It looks like (both before and after) that 
we're treating the name length as being only 1 (and in this case, 3 after we're 
adding the single quote on both sides).  

BUT it seems in test 91 below that the 'wyx' works, but is 3 characters long.  
Why can't we just print the entirety of the `IdentifierInfo` above?

https://github.com/llvm/llvm-project/pull/118186
___
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] use local config in test cases (PR #120004)

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

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

>From b3b848df1a985754580ebbaa5f8136cb2c6bf3d6 Mon Sep 17 00:00:00 2001
From: Congcong Cai 
Date: Sun, 15 Dec 2024 12:19:55 +0800
Subject: [PATCH 1/2] [clang-tidy][NFC] use local config in test cases

follow up patch for #119948.
---
 .../clang-tidy/misc/IncludeCleanerCheck.cpp|  7 +++
 .../InconsistentDeclarationParameterNameCheck.h|  2 +-
 clang-tools-extra/docs/ReleaseNotes.rst|  4 
 .../checkers/bugprone/argument-comment-strict.cpp  |  2 +-
 .../cppcoreguidelines/pro-type-const-cast.cpp  |  2 +-
 .../pro-type-static-cast-downcast.cpp  |  2 +-
 .../checkers/misc/unused-parameters-strict.cpp |  2 +-
 .../checkers/modernize/use-std-format.cpp  |  4 ++--
 .../checkers/modernize/use-std-print-absl.cpp  |  4 ++--
 .../checkers/modernize/use-std-print.cpp   |  4 ++--
 .../unittests/clang-tidy/IncludeCleanerTest.cpp| 14 --
 11 files changed, 26 insertions(+), 21 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/misc/IncludeCleanerCheck.cpp 
b/clang-tools-extra/clang-tidy/misc/IncludeCleanerCheck.cpp
index 5e7a0e65690b7a..7638bbc103d16d 100644
--- a/clang-tools-extra/clang-tidy/misc/IncludeCleanerCheck.cpp
+++ b/clang-tools-extra/clang-tidy/misc/IncludeCleanerCheck.cpp
@@ -57,10 +57,9 @@ struct MissingIncludeInfo {
 IncludeCleanerCheck::IncludeCleanerCheck(StringRef Name,
  ClangTidyContext *Context)
 : ClangTidyCheck(Name, Context),
-  IgnoreHeaders(utils::options::parseStringList(
-  Options.getLocalOrGlobal("IgnoreHeaders", ""))),
-  DeduplicateFindings(
-  Options.getLocalOrGlobal("DeduplicateFindings", true)) {
+  IgnoreHeaders(
+  utils::options::parseStringList(Options.get("IgnoreHeaders", ""))),
+  DeduplicateFindings(Options.get("DeduplicateFindings", true)) {
   for (const auto &Header : IgnoreHeaders) {
 if (!llvm::Regex{Header}.isValid())
   configurationDiag("Invalid ignore headers regex '%0'") << Header;
diff --git 
a/clang-tools-extra/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.h
 
b/clang-tools-extra/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.h
index 1c526577b403f6..0c5ead860c161a 100644
--- 
a/clang-tools-extra/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.h
+++ 
b/clang-tools-extra/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.h
@@ -26,7 +26,7 @@ class InconsistentDeclarationParameterNameCheck : public 
ClangTidyCheck {
 ClangTidyContext *Context)
   : ClangTidyCheck(Name, Context),
 IgnoreMacros(Options.getLocalOrGlobal("IgnoreMacros", true)),
-Strict(Options.getLocalOrGlobal("Strict", false)) {}
+Strict(Options.get("Strict", false)) {}
 
   void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
   void registerMatchers(ast_matchers::MatchFinder *Finder) override;
diff --git a/clang-tools-extra/docs/ReleaseNotes.rst 
b/clang-tools-extra/docs/ReleaseNotes.rst
index 6803842106791b..9e588913675039 100644
--- a/clang-tools-extra/docs/ReleaseNotes.rst
+++ b/clang-tools-extra/docs/ReleaseNotes.rst
@@ -115,6 +115,10 @@ Improvements to clang-tidy
 - Improved :program:`run-clang-tidy.py` script. Fixed minor shutdown noise
   happening on certain platforms when interrupting the script.
 
+- Removed :program:`clang-tidy`'s global options for most of checks. All 
options
+  are changed to local options except `IncludeStyle`, `StrictMode` and
+  `IgnoreMacros`.
+
 New checks
 ^^
 
diff --git 
a/clang-tools-extra/test/clang-tidy/checkers/bugprone/argument-comment-strict.cpp
 
b/clang-tools-extra/test/clang-tidy/checkers/bugprone/argument-comment-strict.cpp
index c25d25ac5738fb..38d91f39846478 100644
--- 
a/clang-tools-extra/test/clang-tidy/checkers/bugprone/argument-comment-strict.cpp
+++ 
b/clang-tools-extra/test/clang-tidy/checkers/bugprone/argument-comment-strict.cpp
@@ -1,5 +1,5 @@
 // RUN: %check_clang_tidy %s bugprone-argument-comment %t -- \
-// RUN:   -config="{CheckOptions: {StrictMode: true}}" --
+// RUN:   -config="{CheckOptions: {bugprone-argument-comment.StrictMode: 
true}}" --
 
 void f(int _with_underscores_);
 void g(int x_);
diff --git 
a/clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/pro-type-const-cast.cpp
 
b/clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/pro-type-const-cast.cpp
index be70e3ba356991..a775334260e35c 100644
--- 
a/clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/pro-type-const-cast.cpp
+++ 
b/clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/pro-type-const-cast.cpp
@@ -1,4 +1,4 @@
-// RUN: %check_clang_tidy -check-suffix=STRICT  %s 
cppcoreguidelines-pro-type-const-cast %t -- -config="{CheckOptions: 
{StrictMode: true}}"
+// RUN: %check_clang_tidy -check-suffix=STRICT  %s 
cppcoreguid

[clang] [llvm] [NFC][AMDGPU] Pre-commit clang and llvm tests for dynamic allocas (PR #120063)

2024-12-16 Thread Matt Arsenault via cfe-commits


@@ -5,8 +5,46 @@ target datalayout = "A5"
 
 ; CHECK: in function test_dynamic_stackalloc{{.*}}: unsupported dynamic alloca
 
-define amdgpu_kernel void @test_dynamic_stackalloc(ptr addrspace(1) %out, i32 
%n) {
+define amdgpu_kernel void @test_dynamic_stackalloc(i32 %n) {
   %alloca = alloca i32, i32 %n, addrspace(5)
-  store volatile i32 0, ptr addrspace(5) %alloca
+  store volatile i32 123, ptr addrspace(5) %alloca
   ret void
 }
+
+; CHECK: in function test_dynamic_stackalloc{{.*}}: unsupported dynamic alloca
+
+define amdgpu_kernel void @test_dynamic_stackalloc_multiple_allocas(i32 %n) {
+  %alloca1 = alloca i32, i32 8, addrspace(5)
+  %alloca2 = alloca i32, i32 %n, addrspace(5)
+  %alloca3 = alloca i32, i32 10, addrspace(5)
+  store volatile i32 1, ptr addrspace(5) %alloca1
+  store volatile i32 2, ptr addrspace(5) %alloca2
+  store volatile i32 3, ptr addrspace(5) %alloca3
+  ret void
+}
+
+; CHECK: in function test_dynamic_stackalloc{{.*}}: unsupported dynamic alloca
+
+define amdgpu_kernel void @test_dynamic_stackalloc_custom_alignment(i32 %n) {

arsenm wrote:

Custom is the wrong term. Should test over aligned and underaligned cases 

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


[clang] [llvm] [NFC][AMDGPU] Pre-commit clang and llvm tests for dynamic allocas (PR #120063)

2024-12-16 Thread Matt Arsenault via cfe-commits


@@ -5,8 +5,46 @@ target datalayout = "A5"
 
 ; CHECK: in function test_dynamic_stackalloc{{.*}}: unsupported dynamic alloca
 
-define amdgpu_kernel void @test_dynamic_stackalloc(ptr addrspace(1) %out, i32 
%n) {
+define amdgpu_kernel void @test_dynamic_stackalloc(i32 %n) {
   %alloca = alloca i32, i32 %n, addrspace(5)
-  store volatile i32 0, ptr addrspace(5) %alloca
+  store volatile i32 123, ptr addrspace(5) %alloca
   ret void
 }
+
+; CHECK: in function test_dynamic_stackalloc{{.*}}: unsupported dynamic alloca
+
+define amdgpu_kernel void @test_dynamic_stackalloc_multiple_allocas(i32 %n) {
+  %alloca1 = alloca i32, i32 8, addrspace(5)
+  %alloca2 = alloca i32, i32 %n, addrspace(5)
+  %alloca3 = alloca i32, i32 10, addrspace(5)
+  store volatile i32 1, ptr addrspace(5) %alloca1
+  store volatile i32 2, ptr addrspace(5) %alloca2
+  store volatile i32 3, ptr addrspace(5) %alloca3
+  ret void
+}
+
+; CHECK: in function test_dynamic_stackalloc{{.*}}: unsupported dynamic alloca
+
+define amdgpu_kernel void @test_dynamic_stackalloc_custom_alignment(i32 %n) {
+  %alloca = alloca i32, i32 %n, align 128, addrspace(5)
+  store volatile i32 1, ptr addrspace(5) %alloca
+  ret void
+}
+
+; CHECK: in function test_dynamic_stackalloc{{.*}}: unsupported dynamic alloca
+
+define amdgpu_kernel void @test_dynamic_stackalloc_non_entry_block(i32 %n) {
+  entry:

arsenm wrote:

Indent is off 

https://github.com/llvm/llvm-project/pull/120063
___
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] use local config in test cases (PR #120004)

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

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

>From b3b848df1a985754580ebbaa5f8136cb2c6bf3d6 Mon Sep 17 00:00:00 2001
From: Congcong Cai 
Date: Sun, 15 Dec 2024 12:19:55 +0800
Subject: [PATCH 1/2] [clang-tidy][NFC] use local config in test cases

follow up patch for #119948.
---
 .../clang-tidy/misc/IncludeCleanerCheck.cpp|  7 +++
 .../InconsistentDeclarationParameterNameCheck.h|  2 +-
 clang-tools-extra/docs/ReleaseNotes.rst|  4 
 .../checkers/bugprone/argument-comment-strict.cpp  |  2 +-
 .../cppcoreguidelines/pro-type-const-cast.cpp  |  2 +-
 .../pro-type-static-cast-downcast.cpp  |  2 +-
 .../checkers/misc/unused-parameters-strict.cpp |  2 +-
 .../checkers/modernize/use-std-format.cpp  |  4 ++--
 .../checkers/modernize/use-std-print-absl.cpp  |  4 ++--
 .../checkers/modernize/use-std-print.cpp   |  4 ++--
 .../unittests/clang-tidy/IncludeCleanerTest.cpp| 14 --
 11 files changed, 26 insertions(+), 21 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/misc/IncludeCleanerCheck.cpp 
b/clang-tools-extra/clang-tidy/misc/IncludeCleanerCheck.cpp
index 5e7a0e65690b7a..7638bbc103d16d 100644
--- a/clang-tools-extra/clang-tidy/misc/IncludeCleanerCheck.cpp
+++ b/clang-tools-extra/clang-tidy/misc/IncludeCleanerCheck.cpp
@@ -57,10 +57,9 @@ struct MissingIncludeInfo {
 IncludeCleanerCheck::IncludeCleanerCheck(StringRef Name,
  ClangTidyContext *Context)
 : ClangTidyCheck(Name, Context),
-  IgnoreHeaders(utils::options::parseStringList(
-  Options.getLocalOrGlobal("IgnoreHeaders", ""))),
-  DeduplicateFindings(
-  Options.getLocalOrGlobal("DeduplicateFindings", true)) {
+  IgnoreHeaders(
+  utils::options::parseStringList(Options.get("IgnoreHeaders", ""))),
+  DeduplicateFindings(Options.get("DeduplicateFindings", true)) {
   for (const auto &Header : IgnoreHeaders) {
 if (!llvm::Regex{Header}.isValid())
   configurationDiag("Invalid ignore headers regex '%0'") << Header;
diff --git 
a/clang-tools-extra/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.h
 
b/clang-tools-extra/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.h
index 1c526577b403f6..0c5ead860c161a 100644
--- 
a/clang-tools-extra/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.h
+++ 
b/clang-tools-extra/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.h
@@ -26,7 +26,7 @@ class InconsistentDeclarationParameterNameCheck : public 
ClangTidyCheck {
 ClangTidyContext *Context)
   : ClangTidyCheck(Name, Context),
 IgnoreMacros(Options.getLocalOrGlobal("IgnoreMacros", true)),
-Strict(Options.getLocalOrGlobal("Strict", false)) {}
+Strict(Options.get("Strict", false)) {}
 
   void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
   void registerMatchers(ast_matchers::MatchFinder *Finder) override;
diff --git a/clang-tools-extra/docs/ReleaseNotes.rst 
b/clang-tools-extra/docs/ReleaseNotes.rst
index 6803842106791b..9e588913675039 100644
--- a/clang-tools-extra/docs/ReleaseNotes.rst
+++ b/clang-tools-extra/docs/ReleaseNotes.rst
@@ -115,6 +115,10 @@ Improvements to clang-tidy
 - Improved :program:`run-clang-tidy.py` script. Fixed minor shutdown noise
   happening on certain platforms when interrupting the script.
 
+- Removed :program:`clang-tidy`'s global options for most of checks. All 
options
+  are changed to local options except `IncludeStyle`, `StrictMode` and
+  `IgnoreMacros`.
+
 New checks
 ^^
 
diff --git 
a/clang-tools-extra/test/clang-tidy/checkers/bugprone/argument-comment-strict.cpp
 
b/clang-tools-extra/test/clang-tidy/checkers/bugprone/argument-comment-strict.cpp
index c25d25ac5738fb..38d91f39846478 100644
--- 
a/clang-tools-extra/test/clang-tidy/checkers/bugprone/argument-comment-strict.cpp
+++ 
b/clang-tools-extra/test/clang-tidy/checkers/bugprone/argument-comment-strict.cpp
@@ -1,5 +1,5 @@
 // RUN: %check_clang_tidy %s bugprone-argument-comment %t -- \
-// RUN:   -config="{CheckOptions: {StrictMode: true}}" --
+// RUN:   -config="{CheckOptions: {bugprone-argument-comment.StrictMode: 
true}}" --
 
 void f(int _with_underscores_);
 void g(int x_);
diff --git 
a/clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/pro-type-const-cast.cpp
 
b/clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/pro-type-const-cast.cpp
index be70e3ba356991..a775334260e35c 100644
--- 
a/clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/pro-type-const-cast.cpp
+++ 
b/clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/pro-type-const-cast.cpp
@@ -1,4 +1,4 @@
-// RUN: %check_clang_tidy -check-suffix=STRICT  %s 
cppcoreguidelines-pro-type-const-cast %t -- -config="{CheckOptions: 
{StrictMode: true}}"
+// RUN: %check_clang_tidy -check-suffix=STRICT  %s 
cppcoreguid

[clang] [llvm] [NFC][AMDGPU] Pre-commit clang and llvm tests for dynamic allocas (PR #120063)

2024-12-16 Thread Matt Arsenault via cfe-commits


@@ -418,3 +418,88 @@ define void @func_dynamic_stackalloc_sgpr_align32(ptr 
addrspace(1) %out) {
   store i32 0, ptr addrspace(5) %alloca
   ret void
 }
+
+define amdgpu_kernel void @kernel_non_entry_block_static_alloca(ptr 
addrspace(1) %out, i32 %arg.cond, i32 %in) {

arsenm wrote:

This case is tested already? 

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


[clang] [llvm] [NFC][AMDGPU] Pre-commit clang and llvm tests for dynamic allocas (PR #120063)

2024-12-16 Thread Matt Arsenault via cfe-commits


@@ -5,8 +5,46 @@ target datalayout = "A5"
 
 ; CHECK: in function test_dynamic_stackalloc{{.*}}: unsupported dynamic alloca
 
-define amdgpu_kernel void @test_dynamic_stackalloc(ptr addrspace(1) %out, i32 
%n) {
+define amdgpu_kernel void @test_dynamic_stackalloc(i32 %n) {
   %alloca = alloca i32, i32 %n, addrspace(5)
-  store volatile i32 0, ptr addrspace(5) %alloca
+  store volatile i32 123, ptr addrspace(5) %alloca
   ret void
 }
+
+; CHECK: in function test_dynamic_stackalloc{{.*}}: unsupported dynamic alloca
+
+define amdgpu_kernel void @test_dynamic_stackalloc_multiple_allocas(i32 %n) {
+  %alloca1 = alloca i32, i32 8, addrspace(5)
+  %alloca2 = alloca i32, i32 %n, addrspace(5)
+  %alloca3 = alloca i32, i32 10, addrspace(5)
+  store volatile i32 1, ptr addrspace(5) %alloca1
+  store volatile i32 2, ptr addrspace(5) %alloca2
+  store volatile i32 3, ptr addrspace(5) %alloca3
+  ret void
+}
+
+; CHECK: in function test_dynamic_stackalloc{{.*}}: unsupported dynamic alloca
+
+define amdgpu_kernel void @test_dynamic_stackalloc_custom_alignment(i32 %n) {
+  %alloca = alloca i32, i32 %n, align 128, addrspace(5)
+  store volatile i32 1, ptr addrspace(5) %alloca
+  ret void
+}
+
+; CHECK: in function test_dynamic_stackalloc{{.*}}: unsupported dynamic alloca
+
+define amdgpu_kernel void @test_dynamic_stackalloc_non_entry_block(i32 %n) {
+  entry:
+%cond = icmp eq i32 %n, 0
+br i1 %cond, label %bb.0, label %bb.1
+
+  bb.0:
+%alloca = alloca i32, i32 %n, align 64, addrspace(5)
+%gep1 = getelementptr i32, ptr addrspace(5) %alloca, i32 1
+store volatile i32 0, ptr addrspace(5) %alloca
+store volatile i32 1, ptr addrspace(5) %gep1
+br label %bb.1
+
+  bb.1:
+ret void
+}

arsenm wrote:

Should test with divergent size. Also from non-kernels 

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


[clang] [llvm] [AArch64] Add intrinsics for SME FP8 FVDOT, FVDOTB and FVDOTT intrinsics (PR #119922)

2024-12-16 Thread via cfe-commits

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

Thank you Jonathan for the patch!
LGTM!

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


[libunwind] [Libunwind] Don't XFAIL tests with msan (PR #120013)

2024-12-16 Thread Louis Dionne via cfe-commits

ldionne wrote:

Rebased onto `main` to re-trigger CI, which should solve the errors you were 
seeing.

I don't remember why these `XFAIL`s were added, but if the CI passes with them 
removed, I'm happy.

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


[clang-tools-extra] Added option to readability-implicit-bool-conversion check to allow implicit conversion *to bool* (PR #120087)

2024-12-16 Thread via cfe-commits

https://github.com/4m4n-x-B4w4ne created 
https://github.com/llvm/llvm-project/pull/120087

As given in the issue #36323 , I added two new options in the 
clang-tools-extra/clan-tidy/readibility/ImplicitBoolConversionCheck.cpp and 
header file.
I have also written new test cases to test these new options in 
test/readibility directory.

>From 03f536888ddc5b7be2514c2d880c6d3119b7f4ee Mon Sep 17 00:00:00 2001
From: 4m4n-x-B4w4ne <125849251+4m4n-x-b4w...@users.noreply.github.com>
Date: Mon, 16 Dec 2024 19:43:42 +0530
Subject: [PATCH 1/3] Update ImplicitBoolConversionCheck.cpp

Added new options in ImplicitBoolConversionCheck CheckConversionToBool and 
CheckConversionFromBool.
---
 .../readability/ImplicitBoolConversionCheck.cpp   | 15 +--
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git 
a/clang-tools-extra/clang-tidy/readability/ImplicitBoolConversionCheck.cpp 
b/clang-tools-extra/clang-tidy/readability/ImplicitBoolConversionCheck.cpp
index f9fd1d903e231e..517a5d2b982751 100644
--- a/clang-tools-extra/clang-tidy/readability/ImplicitBoolConversionCheck.cpp
+++ b/clang-tools-extra/clang-tidy/readability/ImplicitBoolConversionCheck.cpp
@@ -258,14 +258,17 @@ ImplicitBoolConversionCheck::ImplicitBoolConversionCheck(
 : ClangTidyCheck(Name, Context),
   AllowIntegerConditions(Options.get("AllowIntegerConditions", false)),
   AllowPointerConditions(Options.get("AllowPointerConditions", false)),
-  UseUpperCaseLiteralSuffix(
-  Options.get("UseUpperCaseLiteralSuffix", false)) {}
+  UseUpperCaseLiteralSuffix(Options.get("UseUpperCaseLiteralSuffix", 
false)),
+  CheckConversionsToBool(Options.get("CheckConversionsToBool",true)),
+  CheckConversionsFromBool(Options.get("CheckConversionsFromBool",true)) {}
 
 void ImplicitBoolConversionCheck::storeOptions(
 ClangTidyOptions::OptionMap &Opts) {
   Options.store(Opts, "AllowIntegerConditions", AllowIntegerConditions);
   Options.store(Opts, "AllowPointerConditions", AllowPointerConditions);
   Options.store(Opts, "UseUpperCaseLiteralSuffix", UseUpperCaseLiteralSuffix);
+  Options.store(Opts,"CheckConversionsToBool",CheckConversionsToBool);
+  Options.store(Opts,"CheckConversionsFromBool",CheckConversionsFromBool);
 }
 
 void ImplicitBoolConversionCheck::registerMatchers(MatchFinder *Finder) {
@@ -358,14 +361,14 @@ void 
ImplicitBoolConversionCheck::registerMatchers(MatchFinder *Finder) {
 void ImplicitBoolConversionCheck::check(
 const MatchFinder::MatchResult &Result) {
 
-  if (const auto *CastToBool =
-  Result.Nodes.getNodeAs("implicitCastToBool")) {
+  if (CheckConversionsToBool && (const auto *CastToBool =
+  Result.Nodes.getNodeAs("implicitCastToBool"))) {
 const auto *Parent = Result.Nodes.getNodeAs("parentStmt");
 return handleCastToBool(CastToBool, Parent, *Result.Context);
   }
 
-  if (const auto *CastFromBool =
-  Result.Nodes.getNodeAs("implicitCastFromBool")) {
+  if (CheckConversionsFromBool && (const auto *CastFromBool =
+  Result.Nodes.getNodeAs("implicitCastFromBool"))) {
 const auto *NextImplicitCast =
 Result.Nodes.getNodeAs("furtherImplicitCast");
 return handleCastFromBool(CastFromBool, NextImplicitCast, *Result.Context);

>From 16c7c95939b4c0c38ebccbbc6cd1da3739244a24 Mon Sep 17 00:00:00 2001
From: 4m4n-x-B4w4ne <125849251+4m4n-x-b4w...@users.noreply.github.com>
Date: Mon, 16 Dec 2024 19:45:37 +0530
Subject: [PATCH 2/3] Update ImplicitBoolConversionCheck.h

Added CheckConversionToBool and CheckConversionFromBool Options in the header
---
 .../clang-tidy/readability/ImplicitBoolConversionCheck.h| 2 ++
 1 file changed, 2 insertions(+)

diff --git 
a/clang-tools-extra/clang-tidy/readability/ImplicitBoolConversionCheck.h 
b/clang-tools-extra/clang-tidy/readability/ImplicitBoolConversionCheck.h
index 5947f7316e67cc..b0c3c2943e649c 100644
--- a/clang-tools-extra/clang-tidy/readability/ImplicitBoolConversionCheck.h
+++ b/clang-tools-extra/clang-tidy/readability/ImplicitBoolConversionCheck.h
@@ -37,6 +37,8 @@ class ImplicitBoolConversionCheck : public ClangTidyCheck {
   const bool AllowIntegerConditions;
   const bool AllowPointerConditions;
   const bool UseUpperCaseLiteralSuffix;
+  const bool CheckConversionsToBool;
+  const bool CheckConversionsFromBool;
 };
 
 } // namespace clang::tidy::readability

>From 0d6fae8b08a4a365c9295ac8a96de2aba9974c98 Mon Sep 17 00:00:00 2001
From: 4m4n-x-B4w4ne <125849251+4m4n-x-b4w...@users.noreply.github.com>
Date: Mon, 16 Dec 2024 19:48:48 +0530
Subject: [PATCH 3/3] Create implicit-bool-conversion-check.cpp

Added new test to check the new options added in the 
ImplicitBoolConversionCheck.cpp
---
 .../implicit-bool-conversion-check.cpp| 92 +++
 1 file changed, 92 insertions(+)
 create mode 100644 
clang-tools-extra/test/clang-tidy/checkers/readability/implicit-bool-conversion-check.cpp

diff --git 
a/clang-tools-extra/test/clang-tidy/checkers/readability/implicit-

[clang-tools-extra] Added option to readability-implicit-bool-conversion check to allow implicit conversion *to bool* (PR #120087)

2024-12-16 Thread via cfe-commits

llvmbot wrote:



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

@llvm/pr-subscribers-clang-tidy

Author: None (4m4n-x-B4w4ne)


Changes

As given in the issue #36323 , I added two new options in the 
clang-tools-extra/clan-tidy/readibility/ImplicitBoolConversionCheck.cpp and 
header file.
I have also written new test cases to test these new options in 
test/readibility directory.

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


3 Files Affected:

- (modified) 
clang-tools-extra/clang-tidy/readability/ImplicitBoolConversionCheck.cpp (+9-6) 
- (modified) 
clang-tools-extra/clang-tidy/readability/ImplicitBoolConversionCheck.h (+2) 
- (added) 
clang-tools-extra/test/clang-tidy/checkers/readability/implicit-bool-conversion-check.cpp
 (+92) 


``diff
diff --git 
a/clang-tools-extra/clang-tidy/readability/ImplicitBoolConversionCheck.cpp 
b/clang-tools-extra/clang-tidy/readability/ImplicitBoolConversionCheck.cpp
index f9fd1d903e231e..517a5d2b982751 100644
--- a/clang-tools-extra/clang-tidy/readability/ImplicitBoolConversionCheck.cpp
+++ b/clang-tools-extra/clang-tidy/readability/ImplicitBoolConversionCheck.cpp
@@ -258,14 +258,17 @@ ImplicitBoolConversionCheck::ImplicitBoolConversionCheck(
 : ClangTidyCheck(Name, Context),
   AllowIntegerConditions(Options.get("AllowIntegerConditions", false)),
   AllowPointerConditions(Options.get("AllowPointerConditions", false)),
-  UseUpperCaseLiteralSuffix(
-  Options.get("UseUpperCaseLiteralSuffix", false)) {}
+  UseUpperCaseLiteralSuffix(Options.get("UseUpperCaseLiteralSuffix", 
false)),
+  CheckConversionsToBool(Options.get("CheckConversionsToBool",true)),
+  CheckConversionsFromBool(Options.get("CheckConversionsFromBool",true)) {}
 
 void ImplicitBoolConversionCheck::storeOptions(
 ClangTidyOptions::OptionMap &Opts) {
   Options.store(Opts, "AllowIntegerConditions", AllowIntegerConditions);
   Options.store(Opts, "AllowPointerConditions", AllowPointerConditions);
   Options.store(Opts, "UseUpperCaseLiteralSuffix", UseUpperCaseLiteralSuffix);
+  Options.store(Opts,"CheckConversionsToBool",CheckConversionsToBool);
+  Options.store(Opts,"CheckConversionsFromBool",CheckConversionsFromBool);
 }
 
 void ImplicitBoolConversionCheck::registerMatchers(MatchFinder *Finder) {
@@ -358,14 +361,14 @@ void 
ImplicitBoolConversionCheck::registerMatchers(MatchFinder *Finder) {
 void ImplicitBoolConversionCheck::check(
 const MatchFinder::MatchResult &Result) {
 
-  if (const auto *CastToBool =
-  Result.Nodes.getNodeAs("implicitCastToBool")) {
+  if (CheckConversionsToBool && (const auto *CastToBool =
+  Result.Nodes.getNodeAs("implicitCastToBool"))) {
 const auto *Parent = Result.Nodes.getNodeAs("parentStmt");
 return handleCastToBool(CastToBool, Parent, *Result.Context);
   }
 
-  if (const auto *CastFromBool =
-  Result.Nodes.getNodeAs("implicitCastFromBool")) {
+  if (CheckConversionsFromBool && (const auto *CastFromBool =
+  Result.Nodes.getNodeAs("implicitCastFromBool"))) {
 const auto *NextImplicitCast =
 Result.Nodes.getNodeAs("furtherImplicitCast");
 return handleCastFromBool(CastFromBool, NextImplicitCast, *Result.Context);
diff --git 
a/clang-tools-extra/clang-tidy/readability/ImplicitBoolConversionCheck.h 
b/clang-tools-extra/clang-tidy/readability/ImplicitBoolConversionCheck.h
index 5947f7316e67cc..b0c3c2943e649c 100644
--- a/clang-tools-extra/clang-tidy/readability/ImplicitBoolConversionCheck.h
+++ b/clang-tools-extra/clang-tidy/readability/ImplicitBoolConversionCheck.h
@@ -37,6 +37,8 @@ class ImplicitBoolConversionCheck : public ClangTidyCheck {
   const bool AllowIntegerConditions;
   const bool AllowPointerConditions;
   const bool UseUpperCaseLiteralSuffix;
+  const bool CheckConversionsToBool;
+  const bool CheckConversionsFromBool;
 };
 
 } // namespace clang::tidy::readability
diff --git 
a/clang-tools-extra/test/clang-tidy/checkers/readability/implicit-bool-conversion-check.cpp
 
b/clang-tools-extra/test/clang-tidy/checkers/readability/implicit-bool-conversion-check.cpp
new file mode 100644
index 00..506769d5a57322
--- /dev/null
+++ 
b/clang-tools-extra/test/clang-tidy/checkers/readability/implicit-bool-conversion-check.cpp
@@ -0,0 +1,92 @@
+// RUN: %check_clang_tidy %s readability-implicit-bool-conversion %t
+
+// RUN: %check_clang_tidy %s readability-implicit-bool-conversion %t \
+// RUN: -- -config='{CheckOptions: [{key: 
readability-implicit-bool-conversion.CheckConversionsToBool, value: false}, 
{key: readability-implicit-bool-conversion.CheckConversionsFromBool, value: 
true}]}'
+
+// RUN: %check_clang_tidy %s readability-implicit-bool-conversion %t \
+// RUN: -- -config='{CheckOptions: [{key: 
readability-implicit-bool-conversion.CheckConversionsToBool, value: true}, 
{key: readability-implicit-bool-conversion.CheckConversionsFromBool, value: 
false}]}'
+
+// RUN: %check_clang_tidy %s readability-implicit-bool-conversion %t \

[clang-tools-extra] Added option to readability-implicit-bool-conversion check to allow implicit conversion *to bool* (PR #120087)

2024-12-16 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/120087
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libunwind] [Libunwind] Don't XFAIL tests with msan (PR #120013)

2024-12-16 Thread Louis Dionne via cfe-commits

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

LGTM if the CI is green.

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


[clang-tools-extra] Added options to readability-implicit-bool-conversion (PR #120087)

2024-12-16 Thread via cfe-commits

https://github.com/4m4n-x-B4w4ne edited 
https://github.com/llvm/llvm-project/pull/120087
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


  1   2   3   4   >