[clang] [llvm] [LLVM][Clang][AArch64] Implement AArch64 build attributes (PR #118771)

2025-01-13 Thread Oliver Stannard via cfe-commits


@@ -0,0 +1,50 @@
+// RUN: llvm-mc -triple=aarch64 %s -o - | FileCheck %s --check-prefix=ASM
+// RUN: llvm-mc -triple=aarch64 -filetype=obj %s -o - | llvm-readelf 
--hex-dump=.ARM.attributes - | FileCheck %s --check-prefix=ELF
+
+// ASM: .aeabi_subsection  private_subsection_1, optional, uleb128
+// ASM: .aeabi_attribute 12, 257
+// ASM: .aeabi_subsection  private_subsection_2, required, uleb128
+// ASM: .aeabi_attribute 76, 257
+// ASM: .aeabi_subsection  private_subsection_3, optional, ntbs
+// ASM: .aeabi_attribute 34, hello_llvm
+// ASM: .aeabi_subsection  private_subsection_4, required, ntbs
+// ASM: .aeabi_attribute 777, hello_llvm
+// ASM: .aeabi_subsection  private_subsection_1, optional, uleb128
+// ASM: .aeabi_attribute 876, 257
+// ASM: .aeabi_subsection  private_subsection_2, required, uleb128
+// ASM: .aeabi_attribute 876, 257
+// ASM: .aeabi_subsection private_subsection_3, optional, ntbs
+// ASM: .aeabi_attribute 876, hello_llvm
+// ASM: .aeabi_subsection  private_subsection_4, required, ntbs
+// ASM: .aeabi_attribute 876, hello_llvm
+
+// ELF: Hex dump of section '.ARM.attributes':
+// ELF-NEXT: 0x 4122 00707269 76617465 5f737562 A"...private_sub
+// ELF-NEXT: 0x0010 73656374 696f6e5f 31000100 0c8102ec section_1...
+// ELF-NEXT: 0x0020 06810222 0070 72697661 74655f73 ..."...private_s
+// ELF-NEXT: 0x0030 75627365 6374696f 6e5f3200 4c81 ubsection_2...L.
+// ELF-NEXT: 0x0040 02ec0681 0234 00707269 76617465 .4...private
+// ELF-NEXT: 0x0050 5f737562 73656374 696f6e5f 33000101 _subsection_3...
+// ELF-NEXT: 0x0060 2268656c 6c6f5f6c 6c766d00 ec066865 "hello_llvm...he
+// ELF-NEXT: 0x0070 6c6c6f5f 6c6c766d 0035 00707269 llo_llvm.5...pri
+// ELF-NEXT: 0x0080 76617465 5f737562 73656374 696f6e5f vate_subsection_
+// ELF-NEXT: 0x0090 3401 89066865 6c6c6f5f 6c6c766d 4.hello_llvm
+// ELF-NEXT: 0x00a0 00ec0668 656c6c6f 5f6c6c76 6d00 ...hello_llvm.
+
+
+.aeabi_subsection private_subsection_1, optional, uleb128
+.aeabi_attribute 12, 257
+.aeabi_subsection private_subsection_2, required, uleb128
+.aeabi_attribute 76, 257
+.aeabi_subsection private_subsection_3, optional, ntbs
+.aeabi_attribute 34, hello_llvm

ostannard wrote:

I think the string value should be `"hello_llvm"` with quotes, not as an 
identifier, because there are lots of valid strings which are not identifiers. 
We could also accept unquoted identifiers, there is precedent for that in the 
first argument of the `.section` directive.

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


[clang] [llvm] [LLVM][Clang][AArch64] Implement AArch64 build attributes (PR #118771)

2025-01-13 Thread Oliver Stannard via cfe-commits


@@ -148,13 +150,177 @@ class AArch64TargetAsmStreamer : public 
AArch64TargetStreamer {
 OS << "\t.seh_save_any_reg_px\tq" << Reg << ", " << Offset << "\n";
   }
 
+  void emitAttribute(StringRef VendorName, unsigned Tag, unsigned Value,
+ std::string String, bool Override) override {
+
+// AArch64 build attributes for assembly attribute form:
+// .aeabi_attribute tag, value
+if (unsigned(-1) == Value && "" == String) {
+  assert(0 && "Arguments error");
+  return;
+}
+
+unsigned VendorID = AArch64BuildAttributes::getVendorID(VendorName);
+
+switch (VendorID) {
+default:
+  assert(0 && "Subsection name error");
+  break;
+case AArch64BuildAttributes::VENDOR_UNKNOWN:
+  if (unsigned(-1) != Value) {
+OS << "\t." << AArch64BuildAttributes::getAttrTag() << "\t" << Tag
+   << ", " << Value;
+AArch64TargetStreamer::emitAttribute(VendorName, Tag, Value, "",
+ Override);
+  }
+  if ("" != String) {
+OS << "\t." << AArch64BuildAttributes::getAttrTag() << "\t" << Tag
+   << ", " << String;
+AArch64TargetStreamer::emitAttribute(VendorName, Tag, unsigned(-1),
+ String, Override);
+  }
+  break;
+// Note: AEABI_FEATURE_AND_BITS takes only unsigned values
+case AArch64BuildAttributes::AEABI_FEATURE_AND_BITS:
+  switch (Tag) {
+  default: // allow emitting any attribute by number
+OS << "\t." << AArch64BuildAttributes::getAttrTag() << "\t" << Tag
+   << ", " << Value;
+// Keep the data structure consistent with the case of ELF emission
+// (important for llvm-mc asm parsing)
+AArch64TargetStreamer::emitAttribute(VendorName, Tag, Value, "",
+ Override);
+break;
+  case AArch64BuildAttributes::TAG_FEATURE_BTI:
+OS << "\t." << AArch64BuildAttributes::getAttrTag() << "\t"
+   << AArch64BuildAttributes::getFeatureAndBitsTagsStr(

ostannard wrote:

Since we've got a function to convert the enum value to a string, could these 
three cases be folded together?

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


[clang] [llvm] [LLVM][Clang][AArch64] Implement AArch64 build attributes (PR #118771)

2025-01-13 Thread Oliver Stannard via cfe-commits


@@ -7806,6 +7815,261 @@ bool 
AArch64AsmParser::parseDirectiveSEHSaveAnyReg(SMLoc L, bool Paired,
   return false;
 }
 
+bool AArch64AsmParser::parseDirectiveAeabiSubSectionHeader(SMLoc L) {
+  // Expecting 3 AsmToken::Identifier after '.aeabi_subsection', a name and 2
+  // parameters, e.g.: .aeabi_subsection (1)aeabi_feature_and_bits, 
(2)optional,
+  // (3)uleb128 separated by 2 commas.
+  MCAsmParser &Parser = getParser();
+
+  bool HasActiveSubsection = true;
+  std::unique_ptr ActiveSubsection =
+  getTargetStreamer().getActiveAtributesSubsection();
+  if (nullptr == ActiveSubsection) {
+HasActiveSubsection = false;
+  }
+
+  // Consume the name (subsection name)
+  StringRef SubsectionName;
+  AArch64BuildAttributes::VendorID SubsectionNameID;
+  if (Parser.getTok().is(AsmToken::Identifier)) {
+SubsectionName = Parser.getTok().getIdentifier();
+SubsectionNameID = AArch64BuildAttributes::getVendorID(SubsectionName);
+  } else {
+Error(Parser.getTok().getLoc(), "Expecting subsection name");
+return true;
+  }
+  Parser.Lex();
+  // consume a comma
+  // parseComma() return *false* on success, and call Lex(), no need to call
+  // Lex() again.
+  if (Parser.parseComma()) {
+return true;
+  }
+
+  // Consume the first parameter (optionality parameter)
+  AArch64BuildAttributes::SubsectionOptional IsOptional;
+  // options: optional/required
+  if (Parser.getTok().is(AsmToken::Identifier)) {
+StringRef Optinality = Parser.getTok().getIdentifier();
+IsOptional = AArch64BuildAttributes::getOptionalID(Optinality);
+if (AArch64BuildAttributes::OPTIONAL_NOT_FOUND == IsOptional) {
+  Error(Parser.getTok().getLoc(),
+AArch64BuildAttributes::getSubsectionOptionalUnknownError() + ": " 
+
+Optinality);
+  return true;
+}
+if (HasActiveSubsection &&
+(SubsectionName == ActiveSubsection->VendorName)) {
+  if (IsOptional != ActiveSubsection->IsOptional) {
+Error(Parser.getTok().getLoc(),
+  "Optinality mismatch! Subsection " + SubsectionName +
+  " allready exists with optinality defined as '" +
+  Twine(ActiveSubsection->IsOptional) + "' and not '" +
+  Twine(IsOptional) + "'! (0: required, 1: optional)");
+return true;
+  }
+}
+  } else {
+Error(
+Parser.getTok().getLoc(),
+"Expecitng optionality parameter \n Hint: use 'optional' | 
'required'");
+return true;
+  }
+  // Check for possible IsOptional unaccepted values for known subsections
+  if (AArch64BuildAttributes::AEABI_FEATURE_AND_BITS == SubsectionNameID) {
+if (AArch64BuildAttributes::REQUIRED == IsOptional) {
+  Error(Parser.getTok().getLoc(),
+"aeabi_feature_and_bits must be marked as optional");
+  return true;
+}
+  }
+  if (AArch64BuildAttributes::AEABI_PAUTHABI == SubsectionNameID) {
+if (AArch64BuildAttributes::OPTIONAL == IsOptional) {
+  Error(Parser.getTok().getLoc(),
+"aeabi_pauthabi must be marked as required");
+  return true;
+}
+  }
+  Parser.Lex();
+  // consume a comma
+  if (Parser.parseComma()) {
+return true;
+  }
+
+  // Consume the second parameter (type parameter)
+  AArch64BuildAttributes::SubsectionType Type;
+  if (Parser.getTok().is(AsmToken::Identifier)) {
+StringRef Name = Parser.getTok().getIdentifier();
+Type = AArch64BuildAttributes::getTypeID(Name);
+if (AArch64BuildAttributes::TYPE_NOT_FOUND == Type) {
+  Error(Parser.getTok().getLoc(),
+AArch64BuildAttributes::getSubsectionTypeUnknownError() + ": " +
+Name);
+  return true;
+}
+if (HasActiveSubsection &&
+(SubsectionName == ActiveSubsection->VendorName)) {
+  if (Type != ActiveSubsection->ParameterType) {
+Error(Parser.getTok().getLoc(),
+  "Type mismatch! Subsection " + SubsectionName +
+  " allready exists with Type defined as '" +
+  Twine(ActiveSubsection->ParameterType) + "' and not '" +
+  Twine(Type) + "'! (0: uleb128, 1: ntbs)");
+return true;
+  }
+}
+  } else {
+Error(Parser.getTok().getLoc(), "Expecitng type parameter");
+return true;
+  }
+  // Check for possible Type unaccepted values for known subsections
+  if (AArch64BuildAttributes::AEABI_FEATURE_AND_BITS == SubsectionNameID ||
+  AArch64BuildAttributes::AEABI_PAUTHABI == SubsectionNameID) {
+if (AArch64BuildAttributes::NTBS == Type) {
+  Error(Parser.getTok().getLoc(),
+SubsectionName + " must be marked as ULEB128");
+  return true;
+}
+  }
+  Parser.Lex();
+  // Parsing finished, check for trailing tokens.
+  if (Parser.getTok().isNot(llvm::AsmToken::EndOfStatement)) {
+Error(Parser.getTok().getLoc(), "unexpected token for AArch64 build "
+"attributes subsection header directive");
+return true;

[clang] [llvm] [LLVM][Clang][AArch64] Implement AArch64 build attributes (PR #118771)

2025-01-13 Thread Oliver Stannard via cfe-commits


@@ -7806,6 +7815,261 @@ bool 
AArch64AsmParser::parseDirectiveSEHSaveAnyReg(SMLoc L, bool Paired,
   return false;
 }
 
+bool AArch64AsmParser::parseDirectiveAeabiSubSectionHeader(SMLoc L) {
+  // Expecting 3 AsmToken::Identifier after '.aeabi_subsection', a name and 2
+  // parameters, e.g.: .aeabi_subsection (1)aeabi_feature_and_bits, 
(2)optional,
+  // (3)uleb128 separated by 2 commas.
+  MCAsmParser &Parser = getParser();
+
+  bool HasActiveSubsection = true;
+  std::unique_ptr ActiveSubsection =
+  getTargetStreamer().getActiveAtributesSubsection();
+  if (nullptr == ActiveSubsection) {
+HasActiveSubsection = false;
+  }
+
+  // Consume the name (subsection name)
+  StringRef SubsectionName;
+  AArch64BuildAttributes::VendorID SubsectionNameID;
+  if (Parser.getTok().is(AsmToken::Identifier)) {
+SubsectionName = Parser.getTok().getIdentifier();
+SubsectionNameID = AArch64BuildAttributes::getVendorID(SubsectionName);
+  } else {
+Error(Parser.getTok().getLoc(), "Expecting subsection name");
+return true;
+  }
+  Parser.Lex();
+  // consume a comma
+  // parseComma() return *false* on success, and call Lex(), no need to call
+  // Lex() again.
+  if (Parser.parseComma()) {
+return true;
+  }
+
+  // Consume the first parameter (optionality parameter)
+  AArch64BuildAttributes::SubsectionOptional IsOptional;
+  // options: optional/required
+  if (Parser.getTok().is(AsmToken::Identifier)) {
+StringRef Optinality = Parser.getTok().getIdentifier();
+IsOptional = AArch64BuildAttributes::getOptionalID(Optinality);
+if (AArch64BuildAttributes::OPTIONAL_NOT_FOUND == IsOptional) {
+  Error(Parser.getTok().getLoc(),
+AArch64BuildAttributes::getSubsectionOptionalUnknownError() + ": " 
+
+Optinality);
+  return true;
+}
+if (HasActiveSubsection &&
+(SubsectionName == ActiveSubsection->VendorName)) {
+  if (IsOptional != ActiveSubsection->IsOptional) {
+Error(Parser.getTok().getLoc(),
+  "Optinality mismatch! Subsection " + SubsectionName +
+  " allready exists with optinality defined as '" +
+  Twine(ActiveSubsection->IsOptional) + "' and not '" +
+  Twine(IsOptional) + "'! (0: required, 1: optional)");
+return true;
+  }
+}
+  } else {
+Error(
+Parser.getTok().getLoc(),
+"Expecitng optionality parameter \n Hint: use 'optional' | 
'required'");
+return true;
+  }
+  // Check for possible IsOptional unaccepted values for known subsections
+  if (AArch64BuildAttributes::AEABI_FEATURE_AND_BITS == SubsectionNameID) {
+if (AArch64BuildAttributes::REQUIRED == IsOptional) {
+  Error(Parser.getTok().getLoc(),
+"aeabi_feature_and_bits must be marked as optional");
+  return true;
+}
+  }
+  if (AArch64BuildAttributes::AEABI_PAUTHABI == SubsectionNameID) {
+if (AArch64BuildAttributes::OPTIONAL == IsOptional) {
+  Error(Parser.getTok().getLoc(),
+"aeabi_pauthabi must be marked as required");
+  return true;
+}
+  }
+  Parser.Lex();
+  // consume a comma
+  if (Parser.parseComma()) {
+return true;
+  }
+
+  // Consume the second parameter (type parameter)
+  AArch64BuildAttributes::SubsectionType Type;
+  if (Parser.getTok().is(AsmToken::Identifier)) {
+StringRef Name = Parser.getTok().getIdentifier();
+Type = AArch64BuildAttributes::getTypeID(Name);
+if (AArch64BuildAttributes::TYPE_NOT_FOUND == Type) {
+  Error(Parser.getTok().getLoc(),
+AArch64BuildAttributes::getSubsectionTypeUnknownError() + ": " +
+Name);
+  return true;
+}
+if (HasActiveSubsection &&
+(SubsectionName == ActiveSubsection->VendorName)) {
+  if (Type != ActiveSubsection->ParameterType) {
+Error(Parser.getTok().getLoc(),
+  "Type mismatch! Subsection " + SubsectionName +
+  " allready exists with Type defined as '" +
+  Twine(ActiveSubsection->ParameterType) + "' and not '" +
+  Twine(Type) + "'! (0: uleb128, 1: ntbs)");
+return true;
+  }
+}
+  } else {
+Error(Parser.getTok().getLoc(), "Expecitng type parameter");
+return true;
+  }
+  // Check for possible Type unaccepted values for known subsections
+  if (AArch64BuildAttributes::AEABI_FEATURE_AND_BITS == SubsectionNameID ||
+  AArch64BuildAttributes::AEABI_PAUTHABI == SubsectionNameID) {
+if (AArch64BuildAttributes::NTBS == Type) {
+  Error(Parser.getTok().getLoc(),
+SubsectionName + " must be marked as ULEB128");
+  return true;
+}
+  }
+  Parser.Lex();
+  // Parsing finished, check for trailing tokens.
+  if (Parser.getTok().isNot(llvm::AsmToken::EndOfStatement)) {
+Error(Parser.getTok().getLoc(), "unexpected token for AArch64 build "
+"attributes subsection header directive");
+return true;

[clang] [llvm] [LLVM][Clang][AArch64] Implement AArch64 build attributes (PR #118771)

2025-01-13 Thread Oliver Stannard via cfe-commits


@@ -0,0 +1,80 @@
+// RUN: not llvm-mc -triple=aarch64 %s -o %t > %t.out 2>&1
+// RUN: FileCheck --input-file=%t.out --check-prefix=ERR %s 
+
+.aeabi_subsection aeabi_pauthabi, optional, uleb128
+// ERR: error: aeabi_pauthabi must be marked as required
+// ERR-NEXT: .aeabi_subsection aeabi_pauthabi, optional, uleb128
+
+.aeabi_subsection aeabi_pauthabi, required, ntbs
+// ERR: error: aeabi_pauthabi must be marked as ULEB128
+// ERR-NEXT: .aeabi_subsection aeabi_pauthabi, required, ntbs
+
+.aeabi_subsection aeabi_feature_and_bits, required, uleb128
+// ERR: error: aeabi_feature_and_bits must be marked as optional
+// ERR-NEXT: .aeabi_subsection aeabi_feature_and_bits, required, uleb128
+
+.aeabi_subsection aeabi_feature_and_bits, optional, ntbs
+// ERR: error: aeabi_feature_and_bits must be marked as ULEB128
+// ERR-NEXT: .aeabi_subsection aeabi_feature_and_bits, optional, ntbs
+
+.aeabi_subsection 1, required, uleb128
+// ERR: error: Expecting subsection name
+// ERR-NEXT: .aeabi_subsection 1, required, uleb128
+
+.aeabi_subsection , required, uleb128
+// ERR: error: Expecting subsection name
+// ERR-NEXT: .aeabi_subsection , required, uleb128
+
+.aeabi_subsection required, uleb128
+// ERR: error: unknown AArch64 build attributes optionality, expecting 
required|optional: uleb128
+// ERR-NEXT: .aeabi_subsection required, uleb128
+
+.aeabi_subsection aeabi_pauthabi, a, uleb128
+// ERR: error: unknown AArch64 build attributes optionality, expecting 
required|optional: a
+// ERR-NEXT: .aeabi_subsection aeabi_pauthabi, a, uleb128
+
+.aeabi_subsection aeabi_pauthabi, 1, uleb128
+// ERR: error: Expecitng optionality parameter
+// ERR-NEXT: Hint: use 'optional' | 'required'
+// ERR-NEXT: .aeabi_subsection aeabi_pauthabi, 1, uleb128
+
+.aeabi_subsection aeabi_pauthabi, ,uleb128
+// ERR: error: Expecitng optionality parameter
+// ERR-NEXT: Hint: use 'optional' | 'required'
+// ERR-NEXT: .aeabi_subsection aeabi_pauthabi, ,uleb128
+
+.aeabi_subsection aeabi_pauthabi,uleb128
+// ERR: error: unknown AArch64 build attributes optionality, expecting 
required|optional: uleb128
+// ERR-NEXT: .aeabi_subsection aeabi_pauthabi,uleb128
+
+.aeabi_subsection aeabi_pauthabi uleb128
+// ERR: expected comma
+// ERR-NEXT: .aeabi_subsection aeabi_pauthabi uleb128
+
+.aeabi_subsection aeabi_pauthabi, required
+// ERR: error: expected comma
+// ERR-NEXT: .aeabi_subsection aeabi_pauthabi, required
+
+.aeabi_subsection aeabi_pauthabi, required,
+// ERR: error: Expecitng type parameter
+// ERR-NEXT: .aeabi_subsection aeabi_pauthabi, required,
+
+.aeabi_subsection aeabi_pauthabi, required, a
+// ERR: error: unknown AArch64 build attributes type, expecting uleb128|ntbs: a
+// ERR-NEXT: .aeabi_subsection aeabi_pauthabi, required, a
+
+.aeabi_subsection aeabi_pauthabi, required, 1
+// ERR: error: Expecitng type parameter

ostannard wrote:

Spelling: `expecting`. Also these errors randomly use "expected" or 
"expecting", I think "expected" would be more consistent with other messages.

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


[clang] [llvm] [LLVM][Clang][AArch64] Implement AArch64 build attributes (PR #118771)

2025-01-13 Thread Oliver Stannard via cfe-commits


@@ -0,0 +1,140 @@
+//===-- AArch64BuildAttributes.cpp - AArch64 Build Attributes 
-===//
+//
+// 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 "llvm/Support/AArch64BuildAttributes.h"
+
+namespace llvm {
+namespace AArch64BuildAttributes {
+// AArch64 build attributes
+StringRef getSubsectionTag() { return "aeabi_subsection"; }
+StringRef getAttrTag() { return "aeabi_attribute"; }
+
+StringRef getVendorName(unsigned Vendor) {
+  switch (Vendor) {
+  case AEABI_FEATURE_AND_BITS:
+return VendorName[AEABI_FEATURE_AND_BITS];
+  case AEABI_PAUTHABI:
+return VendorName[AEABI_PAUTHABI];
+  case VENDOR_UNKNOWN:
+return "";
+  default:
+assert(0 && "Vendor name error");
+return "";
+  }
+}
+VendorID getVendorID(StringRef Vendor) {
+  if (Vendor == VendorName[AEABI_FEATURE_AND_BITS]) {
+return AEABI_FEATURE_AND_BITS;
+  }
+  if (Vendor == VendorName[AEABI_PAUTHABI]) {
+return AEABI_PAUTHABI;
+  }
+  return VENDOR_UNKNOWN;
+}
+
+StringRef getOptionalStr(unsigned Optional) {
+  switch (Optional) {
+  case REQUIRED:
+return OptionalStr[REQUIRED];
+  case OPTIONAL:
+return OptionalStr[OPTIONAL];
+  case OPTIONAL_NOT_FOUND:
+[[fallthrough]];
+  default:
+return "";
+  }
+}
+SubsectionOptional getOptionalID(StringRef Optional) {
+  if (Optional == OptionalStr[REQUIRED])
+return REQUIRED;
+  if (Optional == OptionalStr[OPTIONAL])
+return OPTIONAL;
+  return OPTIONAL_NOT_FOUND;
+}
+StringRef getSubsectionOptionalUnknownError() {
+  return "unknown AArch64 build attributes optionality, expecting "
+ "required|optional";
+}
+
+StringRef getTypeStr(unsigned Type) {
+  switch (Type) {
+  case ULEB128:
+return TypeStr[ULEB128];
+  case NTBS:
+return TypeStr[NTBS];
+  case TYPE_NOT_FOUND:
+[[fallthrough]];
+  default:
+return "";
+  }
+}
+SubsectionType getTypeID(StringRef Type) {
+  if (Type == TypeStr[ULEB128] || Type == (TypeStr[ULEB128].upper()))
+return ULEB128;
+  if (Type == TypeStr[NTBS] || Type == (TypeStr[NTBS].upper()))
+return NTBS;
+  return TYPE_NOT_FOUND;
+}
+StringRef getSubsectionTypeUnknownError() {
+  return "unknown AArch64 build attributes type, expecting uleb128|ntbs";
+}
+
+StringRef getPauthABITagsStr(unsigned PauthABITag) {
+  switch (PauthABITag) {
+  case TAG_PAUTH_PLATFORM:
+return PauthABITagsStr[TAG_PAUTH_PLATFORM - 1]; // Tag_PAuth_Platform = 1 
in
+// accordance with the spec
+  case TAG_PAUTH_SCHEMA:
+return PauthABITagsStr[TAG_PAUTH_SCHEMA - 1]; // Tag_PAuth_Schema = 2 in
+  // accordance with the spec
+  case PAUTHABI_TAG_NOT_FOUND:
+[[fallthrough]];
+  default:
+return "";
+  }
+}
+PauthABITags getPauthABITagsID(StringRef PauthABITag) {
+  if (PauthABITag == PauthABITagsStr[TAG_PAUTH_PLATFORM - 1])
+return TAG_PAUTH_PLATFORM;
+  if (PauthABITag == PauthABITagsStr[TAG_PAUTH_SCHEMA - 1])
+return TAG_PAUTH_SCHEMA;
+  return PAUTHABI_TAG_NOT_FOUND;
+}
+StringRef getPauthabiTagError() {

ostannard wrote:

Unused.

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


[clang] [llvm] [LLVM][Clang][AArch64] Implement AArch64 build attributes (PR #118771)

2025-01-13 Thread Oliver Stannard via cfe-commits


@@ -0,0 +1,88 @@
+//===-- AArch64BuildAttributes.h - AARch64 Build Attributes -*- 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 contains enumerations and support routines for AArch64 build
+// attributes as defined in Build Attributes for the AArch64 document.
+//
+// Build Attributes for the Arm® 64-bit Architecture (AArch64) 2024Q1
+//
+// 
https://github.com/ARM-software/abi-aa/blob/ada00cc8e04f421cce657e8d9f3a439c69437cf4/buildattr64/buildattr64.rst

ostannard wrote:

I think this URL points to an un-committed PR, so I don't know if it will 
remain live after the PR is merged. It would be better to get the spec 
committed before landing this, but if that's not possible then I think it would 
be better to link to the PR here 
(https://github.com/ARM-software/abi-aa/pull/230/) because that URL will last 
longer.

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


[clang] [llvm] [LLVM][Clang][AArch64] Implement AArch64 build attributes (PR #118771)

2025-01-13 Thread Oliver Stannard via cfe-commits


@@ -0,0 +1,140 @@
+//===-- AArch64BuildAttributes.cpp - AArch64 Build Attributes 
-===//
+//
+// 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 "llvm/Support/AArch64BuildAttributes.h"
+
+namespace llvm {
+namespace AArch64BuildAttributes {
+// AArch64 build attributes
+StringRef getSubsectionTag() { return "aeabi_subsection"; }
+StringRef getAttrTag() { return "aeabi_attribute"; }
+
+StringRef getVendorName(unsigned Vendor) {
+  switch (Vendor) {
+  case AEABI_FEATURE_AND_BITS:

ostannard wrote:

These switch statements will need updating every time a new enum value is 
added, so I don't think the `VendorName` array is adding much, and you could 
just return string literals directly here.

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


[clang] [llvm] [LLVM][Clang][AArch64] Implement AArch64 build attributes (PR #118771)

2025-01-13 Thread Oliver Stannard via cfe-commits


@@ -0,0 +1,80 @@
+// RUN: not llvm-mc -triple=aarch64 %s -o %t > %t.out 2>&1
+// RUN: FileCheck --input-file=%t.out --check-prefix=ERR %s 
+
+.aeabi_subsection aeabi_pauthabi, optional, uleb128
+// ERR: error: aeabi_pauthabi must be marked as required
+// ERR-NEXT: .aeabi_subsection aeabi_pauthabi, optional, uleb128
+
+.aeabi_subsection aeabi_pauthabi, required, ntbs
+// ERR: error: aeabi_pauthabi must be marked as ULEB128
+// ERR-NEXT: .aeabi_subsection aeabi_pauthabi, required, ntbs
+
+.aeabi_subsection aeabi_feature_and_bits, required, uleb128
+// ERR: error: aeabi_feature_and_bits must be marked as optional
+// ERR-NEXT: .aeabi_subsection aeabi_feature_and_bits, required, uleb128
+
+.aeabi_subsection aeabi_feature_and_bits, optional, ntbs
+// ERR: error: aeabi_feature_and_bits must be marked as ULEB128
+// ERR-NEXT: .aeabi_subsection aeabi_feature_and_bits, optional, ntbs
+
+.aeabi_subsection 1, required, uleb128
+// ERR: error: Expecting subsection name
+// ERR-NEXT: .aeabi_subsection 1, required, uleb128
+
+.aeabi_subsection , required, uleb128
+// ERR: error: Expecting subsection name
+// ERR-NEXT: .aeabi_subsection , required, uleb128
+
+.aeabi_subsection required, uleb128
+// ERR: error: unknown AArch64 build attributes optionality, expecting 
required|optional: uleb128
+// ERR-NEXT: .aeabi_subsection required, uleb128
+
+.aeabi_subsection aeabi_pauthabi, a, uleb128
+// ERR: error: unknown AArch64 build attributes optionality, expecting 
required|optional: a
+// ERR-NEXT: .aeabi_subsection aeabi_pauthabi, a, uleb128
+
+.aeabi_subsection aeabi_pauthabi, 1, uleb128
+// ERR: error: Expecitng optionality parameter

ostannard wrote:

Spelling: `expecting`.

Some of these errors have a hint on the second line, and some have expected 
values on the first line, please be consistent.

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


[clang] [llvm] [LLVM][Clang][AArch64] Implement AArch64 build attributes (PR #118771)

2025-01-13 Thread Oliver Stannard via cfe-commits


@@ -0,0 +1,62 @@
+// RUN: not llvm-mc -triple=aarch64 %s -o %t > %t.out 2>&1
+// RUN: FileCheck --input-file=%t.out --check-prefix=ERR %s 
+
+.aeabi_subsection aeabi_pauthabi, required, uleb128
+.aeabi_attribute Tag_Feature_BTI, 1
+// ERR: error: Unknown AArch64 build attribute 'Tag_Feature_BTI' for 
subsection 'aeabi_pauthabi'

ostannard wrote:

Error messages should start with a lower-case letter.

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


[clang] [llvm] [LLVM][Clang][AArch64] Implement AArch64 build attributes (PR #118771)

2025-01-13 Thread Oliver Stannard via cfe-commits


@@ -7806,6 +7815,261 @@ bool 
AArch64AsmParser::parseDirectiveSEHSaveAnyReg(SMLoc L, bool Paired,
   return false;
 }
 
+bool AArch64AsmParser::parseDirectiveAeabiSubSectionHeader(SMLoc L) {
+  // Expecting 3 AsmToken::Identifier after '.aeabi_subsection', a name and 2
+  // parameters, e.g.: .aeabi_subsection (1)aeabi_feature_and_bits, 
(2)optional,
+  // (3)uleb128 separated by 2 commas.
+  MCAsmParser &Parser = getParser();
+
+  bool HasActiveSubsection = true;
+  std::unique_ptr ActiveSubsection =
+  getTargetStreamer().getActiveAtributesSubsection();
+  if (nullptr == ActiveSubsection) {
+HasActiveSubsection = false;
+  }
+
+  // Consume the name (subsection name)
+  StringRef SubsectionName;
+  AArch64BuildAttributes::VendorID SubsectionNameID;
+  if (Parser.getTok().is(AsmToken::Identifier)) {
+SubsectionName = Parser.getTok().getIdentifier();
+SubsectionNameID = AArch64BuildAttributes::getVendorID(SubsectionName);
+  } else {
+Error(Parser.getTok().getLoc(), "Expecting subsection name");
+return true;
+  }
+  Parser.Lex();
+  // consume a comma
+  // parseComma() return *false* on success, and call Lex(), no need to call
+  // Lex() again.
+  if (Parser.parseComma()) {
+return true;
+  }
+
+  // Consume the first parameter (optionality parameter)
+  AArch64BuildAttributes::SubsectionOptional IsOptional;
+  // options: optional/required
+  if (Parser.getTok().is(AsmToken::Identifier)) {
+StringRef Optinality = Parser.getTok().getIdentifier();
+IsOptional = AArch64BuildAttributes::getOptionalID(Optinality);
+if (AArch64BuildAttributes::OPTIONAL_NOT_FOUND == IsOptional) {
+  Error(Parser.getTok().getLoc(),
+AArch64BuildAttributes::getSubsectionOptionalUnknownError() + ": " 
+
+Optinality);
+  return true;
+}
+if (HasActiveSubsection &&
+(SubsectionName == ActiveSubsection->VendorName)) {
+  if (IsOptional != ActiveSubsection->IsOptional) {
+Error(Parser.getTok().getLoc(),
+  "Optinality mismatch! Subsection " + SubsectionName +
+  " allready exists with optinality defined as '" +
+  Twine(ActiveSubsection->IsOptional) + "' and not '" +
+  Twine(IsOptional) + "'! (0: required, 1: optional)");
+return true;
+  }
+}
+  } else {
+Error(
+Parser.getTok().getLoc(),
+"Expecitng optionality parameter \n Hint: use 'optional' | 
'required'");
+return true;
+  }
+  // Check for possible IsOptional unaccepted values for known subsections
+  if (AArch64BuildAttributes::AEABI_FEATURE_AND_BITS == SubsectionNameID) {
+if (AArch64BuildAttributes::REQUIRED == IsOptional) {
+  Error(Parser.getTok().getLoc(),
+"aeabi_feature_and_bits must be marked as optional");
+  return true;
+}
+  }
+  if (AArch64BuildAttributes::AEABI_PAUTHABI == SubsectionNameID) {
+if (AArch64BuildAttributes::OPTIONAL == IsOptional) {
+  Error(Parser.getTok().getLoc(),
+"aeabi_pauthabi must be marked as required");
+  return true;
+}
+  }
+  Parser.Lex();
+  // consume a comma
+  if (Parser.parseComma()) {
+return true;
+  }
+
+  // Consume the second parameter (type parameter)
+  AArch64BuildAttributes::SubsectionType Type;
+  if (Parser.getTok().is(AsmToken::Identifier)) {
+StringRef Name = Parser.getTok().getIdentifier();
+Type = AArch64BuildAttributes::getTypeID(Name);
+if (AArch64BuildAttributes::TYPE_NOT_FOUND == Type) {
+  Error(Parser.getTok().getLoc(),
+AArch64BuildAttributes::getSubsectionTypeUnknownError() + ": " +
+Name);
+  return true;
+}
+if (HasActiveSubsection &&
+(SubsectionName == ActiveSubsection->VendorName)) {
+  if (Type != ActiveSubsection->ParameterType) {
+Error(Parser.getTok().getLoc(),
+  "Type mismatch! Subsection " + SubsectionName +
+  " allready exists with Type defined as '" +
+  Twine(ActiveSubsection->ParameterType) + "' and not '" +
+  Twine(Type) + "'! (0: uleb128, 1: ntbs)");
+return true;
+  }
+}
+  } else {
+Error(Parser.getTok().getLoc(), "Expecitng type parameter");
+return true;
+  }
+  // Check for possible Type unaccepted values for known subsections
+  if (AArch64BuildAttributes::AEABI_FEATURE_AND_BITS == SubsectionNameID ||
+  AArch64BuildAttributes::AEABI_PAUTHABI == SubsectionNameID) {
+if (AArch64BuildAttributes::NTBS == Type) {
+  Error(Parser.getTok().getLoc(),
+SubsectionName + " must be marked as ULEB128");
+  return true;
+}
+  }
+  Parser.Lex();
+  // Parsing finished, check for trailing tokens.
+  if (Parser.getTok().isNot(llvm::AsmToken::EndOfStatement)) {
+Error(Parser.getTok().getLoc(), "unexpected token for AArch64 build "
+"attributes subsection header directive");
+return true;

[clang] [llvm] [LLVM][Clang][AArch64] Implement AArch64 build attributes (PR #118771)

2025-01-13 Thread Oliver Stannard via cfe-commits


@@ -148,13 +150,177 @@ class AArch64TargetAsmStreamer : public 
AArch64TargetStreamer {
 OS << "\t.seh_save_any_reg_px\tq" << Reg << ", " << Offset << "\n";
   }
 
+  void emitAttribute(StringRef VendorName, unsigned Tag, unsigned Value,
+ std::string String, bool Override) override {
+
+// AArch64 build attributes for assembly attribute form:
+// .aeabi_attribute tag, value
+if (unsigned(-1) == Value && "" == String) {
+  assert(0 && "Arguments error");
+  return;
+}
+
+unsigned VendorID = AArch64BuildAttributes::getVendorID(VendorName);
+
+switch (VendorID) {
+default:
+  assert(0 && "Subsection name error");
+  break;
+case AArch64BuildAttributes::VENDOR_UNKNOWN:
+  if (unsigned(-1) != Value) {
+OS << "\t." << AArch64BuildAttributes::getAttrTag() << "\t" << Tag
+   << ", " << Value;
+AArch64TargetStreamer::emitAttribute(VendorName, Tag, Value, "",
+ Override);
+  }
+  if ("" != String) {
+OS << "\t." << AArch64BuildAttributes::getAttrTag() << "\t" << Tag
+   << ", " << String;
+AArch64TargetStreamer::emitAttribute(VendorName, Tag, unsigned(-1),
+ String, Override);
+  }
+  break;
+// Note: AEABI_FEATURE_AND_BITS takes only unsigned values
+case AArch64BuildAttributes::AEABI_FEATURE_AND_BITS:
+  switch (Tag) {
+  default: // allow emitting any attribute by number
+OS << "\t." << AArch64BuildAttributes::getAttrTag() << "\t" << Tag
+   << ", " << Value;
+// Keep the data structure consistent with the case of ELF emission
+// (important for llvm-mc asm parsing)
+AArch64TargetStreamer::emitAttribute(VendorName, Tag, Value, "",
+ Override);
+break;
+  case AArch64BuildAttributes::TAG_FEATURE_BTI:
+OS << "\t." << AArch64BuildAttributes::getAttrTag() << "\t"
+   << AArch64BuildAttributes::getFeatureAndBitsTagsStr(
+  AArch64BuildAttributes::TAG_FEATURE_BTI)
+   << ", " << Value;
+AArch64TargetStreamer::emitAttribute(VendorName, Tag, Value, "",
+ Override);
+break;
+  case AArch64BuildAttributes::TAG_FEATURE_GCS:
+OS << "\t." << AArch64BuildAttributes::getAttrTag() << "\t"
+   << AArch64BuildAttributes::getFeatureAndBitsTagsStr(
+  AArch64BuildAttributes::TAG_FEATURE_GCS)
+   << ", " << Value;
+AArch64TargetStreamer::emitAttribute(VendorName, Tag, Value, "",
+ Override);
+break;
+  case AArch64BuildAttributes::TAG_FEATURE_PAC:
+OS << "\t." << AArch64BuildAttributes::getAttrTag() << "\t"
+   << AArch64BuildAttributes::getFeatureAndBitsTagsStr(
+  AArch64BuildAttributes::TAG_FEATURE_PAC)
+   << ", " << Value;
+AArch64TargetStreamer::emitAttribute(VendorName, Tag, Value, "",
+ Override);
+break;
+  }
+  break;
+// Note: AEABI_PAUTHABI takes only unsigned values
+case AArch64BuildAttributes::AEABI_PAUTHABI:
+  switch (Tag) {
+  default: // allow emitting any attribute by number
+OS << "\t." << AArch64BuildAttributes::getAttrTag() << "\t" << Tag
+   << ", " << Value;
+// Keep the data structure consistent with the case of ELF emission
+// (important for llvm-mc asm parsing)
+AArch64TargetStreamer::emitAttribute(VendorName, Tag, Value, "",
+ Override);
+break;
+  case AArch64BuildAttributes::TAG_PAUTH_PLATFORM:

ostannard wrote:

Again, can these be folded together?

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


[clang] [llvm] [LLVM][Clang][AArch64] Implement AArch64 build attributes (PR #118771)

2025-01-13 Thread Oliver Stannard via cfe-commits


@@ -7806,6 +7815,261 @@ bool 
AArch64AsmParser::parseDirectiveSEHSaveAnyReg(SMLoc L, bool Paired,
   return false;
 }
 
+bool AArch64AsmParser::parseDirectiveAeabiSubSectionHeader(SMLoc L) {
+  // Expecting 3 AsmToken::Identifier after '.aeabi_subsection', a name and 2
+  // parameters, e.g.: .aeabi_subsection (1)aeabi_feature_and_bits, 
(2)optional,
+  // (3)uleb128 separated by 2 commas.
+  MCAsmParser &Parser = getParser();
+
+  bool HasActiveSubsection = true;
+  std::unique_ptr ActiveSubsection =
+  getTargetStreamer().getActiveAtributesSubsection();
+  if (nullptr == ActiveSubsection) {
+HasActiveSubsection = false;
+  }
+
+  // Consume the name (subsection name)
+  StringRef SubsectionName;
+  AArch64BuildAttributes::VendorID SubsectionNameID;
+  if (Parser.getTok().is(AsmToken::Identifier)) {
+SubsectionName = Parser.getTok().getIdentifier();
+SubsectionNameID = AArch64BuildAttributes::getVendorID(SubsectionName);
+  } else {
+Error(Parser.getTok().getLoc(), "Expecting subsection name");
+return true;
+  }
+  Parser.Lex();
+  // consume a comma
+  // parseComma() return *false* on success, and call Lex(), no need to call
+  // Lex() again.
+  if (Parser.parseComma()) {
+return true;
+  }
+
+  // Consume the first parameter (optionality parameter)
+  AArch64BuildAttributes::SubsectionOptional IsOptional;
+  // options: optional/required
+  if (Parser.getTok().is(AsmToken::Identifier)) {
+StringRef Optinality = Parser.getTok().getIdentifier();
+IsOptional = AArch64BuildAttributes::getOptionalID(Optinality);
+if (AArch64BuildAttributes::OPTIONAL_NOT_FOUND == IsOptional) {
+  Error(Parser.getTok().getLoc(),
+AArch64BuildAttributes::getSubsectionOptionalUnknownError() + ": " 
+
+Optinality);
+  return true;
+}
+if (HasActiveSubsection &&
+(SubsectionName == ActiveSubsection->VendorName)) {
+  if (IsOptional != ActiveSubsection->IsOptional) {
+Error(Parser.getTok().getLoc(),
+  "Optinality mismatch! Subsection " + SubsectionName +
+  " allready exists with optinality defined as '" +
+  Twine(ActiveSubsection->IsOptional) + "' and not '" +
+  Twine(IsOptional) + "'! (0: required, 1: optional)");
+return true;
+  }
+}
+  } else {
+Error(
+Parser.getTok().getLoc(),
+"Expecitng optionality parameter \n Hint: use 'optional' | 
'required'");
+return true;
+  }
+  // Check for possible IsOptional unaccepted values for known subsections
+  if (AArch64BuildAttributes::AEABI_FEATURE_AND_BITS == SubsectionNameID) {
+if (AArch64BuildAttributes::REQUIRED == IsOptional) {
+  Error(Parser.getTok().getLoc(),
+"aeabi_feature_and_bits must be marked as optional");
+  return true;
+}
+  }
+  if (AArch64BuildAttributes::AEABI_PAUTHABI == SubsectionNameID) {
+if (AArch64BuildAttributes::OPTIONAL == IsOptional) {
+  Error(Parser.getTok().getLoc(),
+"aeabi_pauthabi must be marked as required");
+  return true;
+}
+  }
+  Parser.Lex();
+  // consume a comma
+  if (Parser.parseComma()) {
+return true;
+  }
+
+  // Consume the second parameter (type parameter)
+  AArch64BuildAttributes::SubsectionType Type;
+  if (Parser.getTok().is(AsmToken::Identifier)) {
+StringRef Name = Parser.getTok().getIdentifier();
+Type = AArch64BuildAttributes::getTypeID(Name);
+if (AArch64BuildAttributes::TYPE_NOT_FOUND == Type) {
+  Error(Parser.getTok().getLoc(),
+AArch64BuildAttributes::getSubsectionTypeUnknownError() + ": " +
+Name);
+  return true;
+}
+if (HasActiveSubsection &&
+(SubsectionName == ActiveSubsection->VendorName)) {
+  if (Type != ActiveSubsection->ParameterType) {
+Error(Parser.getTok().getLoc(),
+  "Type mismatch! Subsection " + SubsectionName +
+  " allready exists with Type defined as '" +
+  Twine(ActiveSubsection->ParameterType) + "' and not '" +
+  Twine(Type) + "'! (0: uleb128, 1: ntbs)");
+return true;
+  }
+}
+  } else {
+Error(Parser.getTok().getLoc(), "Expecitng type parameter");
+return true;
+  }
+  // Check for possible Type unaccepted values for known subsections
+  if (AArch64BuildAttributes::AEABI_FEATURE_AND_BITS == SubsectionNameID ||
+  AArch64BuildAttributes::AEABI_PAUTHABI == SubsectionNameID) {
+if (AArch64BuildAttributes::NTBS == Type) {
+  Error(Parser.getTok().getLoc(),
+SubsectionName + " must be marked as ULEB128");
+  return true;
+}
+  }
+  Parser.Lex();
+  // Parsing finished, check for trailing tokens.
+  if (Parser.getTok().isNot(llvm::AsmToken::EndOfStatement)) {
+Error(Parser.getTok().getLoc(), "unexpected token for AArch64 build "

ostannard wrote:

Missing test.

https://github.com/llvm/llvm-project/pull/11877

[clang] [llvm] [LLVM][Clang][AArch64] Implement AArch64 build attributes (PR #118771)

2025-01-13 Thread Oliver Stannard via cfe-commits


@@ -7806,6 +7815,261 @@ bool 
AArch64AsmParser::parseDirectiveSEHSaveAnyReg(SMLoc L, bool Paired,
   return false;
 }
 
+bool AArch64AsmParser::parseDirectiveAeabiSubSectionHeader(SMLoc L) {
+  // Expecting 3 AsmToken::Identifier after '.aeabi_subsection', a name and 2
+  // parameters, e.g.: .aeabi_subsection (1)aeabi_feature_and_bits, 
(2)optional,
+  // (3)uleb128 separated by 2 commas.
+  MCAsmParser &Parser = getParser();
+
+  bool HasActiveSubsection = true;
+  std::unique_ptr ActiveSubsection =
+  getTargetStreamer().getActiveAtributesSubsection();
+  if (nullptr == ActiveSubsection) {
+HasActiveSubsection = false;
+  }
+
+  // Consume the name (subsection name)
+  StringRef SubsectionName;
+  AArch64BuildAttributes::VendorID SubsectionNameID;
+  if (Parser.getTok().is(AsmToken::Identifier)) {
+SubsectionName = Parser.getTok().getIdentifier();
+SubsectionNameID = AArch64BuildAttributes::getVendorID(SubsectionName);
+  } else {
+Error(Parser.getTok().getLoc(), "Expecting subsection name");
+return true;
+  }
+  Parser.Lex();
+  // consume a comma
+  // parseComma() return *false* on success, and call Lex(), no need to call
+  // Lex() again.
+  if (Parser.parseComma()) {
+return true;
+  }
+
+  // Consume the first parameter (optionality parameter)
+  AArch64BuildAttributes::SubsectionOptional IsOptional;
+  // options: optional/required
+  if (Parser.getTok().is(AsmToken::Identifier)) {
+StringRef Optinality = Parser.getTok().getIdentifier();
+IsOptional = AArch64BuildAttributes::getOptionalID(Optinality);
+if (AArch64BuildAttributes::OPTIONAL_NOT_FOUND == IsOptional) {
+  Error(Parser.getTok().getLoc(),
+AArch64BuildAttributes::getSubsectionOptionalUnknownError() + ": " 
+
+Optinality);
+  return true;
+}
+if (HasActiveSubsection &&
+(SubsectionName == ActiveSubsection->VendorName)) {
+  if (IsOptional != ActiveSubsection->IsOptional) {
+Error(Parser.getTok().getLoc(),
+  "Optinality mismatch! Subsection " + SubsectionName +
+  " allready exists with optinality defined as '" +
+  Twine(ActiveSubsection->IsOptional) + "' and not '" +
+  Twine(IsOptional) + "'! (0: required, 1: optional)");
+return true;
+  }
+}
+  } else {
+Error(
+Parser.getTok().getLoc(),
+"Expecitng optionality parameter \n Hint: use 'optional' | 
'required'");
+return true;
+  }
+  // Check for possible IsOptional unaccepted values for known subsections
+  if (AArch64BuildAttributes::AEABI_FEATURE_AND_BITS == SubsectionNameID) {
+if (AArch64BuildAttributes::REQUIRED == IsOptional) {
+  Error(Parser.getTok().getLoc(),
+"aeabi_feature_and_bits must be marked as optional");
+  return true;
+}
+  }
+  if (AArch64BuildAttributes::AEABI_PAUTHABI == SubsectionNameID) {
+if (AArch64BuildAttributes::OPTIONAL == IsOptional) {
+  Error(Parser.getTok().getLoc(),
+"aeabi_pauthabi must be marked as required");
+  return true;
+}
+  }
+  Parser.Lex();
+  // consume a comma
+  if (Parser.parseComma()) {
+return true;
+  }
+
+  // Consume the second parameter (type parameter)
+  AArch64BuildAttributes::SubsectionType Type;
+  if (Parser.getTok().is(AsmToken::Identifier)) {
+StringRef Name = Parser.getTok().getIdentifier();
+Type = AArch64BuildAttributes::getTypeID(Name);
+if (AArch64BuildAttributes::TYPE_NOT_FOUND == Type) {
+  Error(Parser.getTok().getLoc(),
+AArch64BuildAttributes::getSubsectionTypeUnknownError() + ": " +
+Name);
+  return true;
+}
+if (HasActiveSubsection &&
+(SubsectionName == ActiveSubsection->VendorName)) {
+  if (Type != ActiveSubsection->ParameterType) {
+Error(Parser.getTok().getLoc(),
+  "Type mismatch! Subsection " + SubsectionName +
+  " allready exists with Type defined as '" +
+  Twine(ActiveSubsection->ParameterType) + "' and not '" +
+  Twine(Type) + "'! (0: uleb128, 1: ntbs)");
+return true;
+  }
+}
+  } else {
+Error(Parser.getTok().getLoc(), "Expecitng type parameter");
+return true;
+  }
+  // Check for possible Type unaccepted values for known subsections
+  if (AArch64BuildAttributes::AEABI_FEATURE_AND_BITS == SubsectionNameID ||
+  AArch64BuildAttributes::AEABI_PAUTHABI == SubsectionNameID) {
+if (AArch64BuildAttributes::NTBS == Type) {
+  Error(Parser.getTok().getLoc(),
+SubsectionName + " must be marked as ULEB128");
+  return true;
+}
+  }
+  Parser.Lex();
+  // Parsing finished, check for trailing tokens.
+  if (Parser.getTok().isNot(llvm::AsmToken::EndOfStatement)) {
+Error(Parser.getTok().getLoc(), "unexpected token for AArch64 build "
+"attributes subsection header directive");
+return true;

[clang] [llvm] [LLVM][Clang][AArch64] Implement AArch64 build attributes (PR #118771)

2025-01-13 Thread Oliver Stannard via cfe-commits


@@ -54,6 +54,7 @@
 #include "llvm/MC/MCStreamer.h"
 #include "llvm/MC/MCSymbol.h"
 #include "llvm/MC/TargetRegistry.h"
+#include "llvm/Support/ARMBuildAttributes.h"

ostannard wrote:

What are we using from `ARMBuildAttributes.h` in this file, and can it be moved 
somewhere common?

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


[clang] [llvm] [LLVM][Clang][AArch64] Implement AArch64 build attributes (PR #118771)

2025-01-13 Thread Oliver Stannard via cfe-commits


@@ -151,3 +151,97 @@ llvm::createAArch64ObjectTargetStreamer(MCStreamer &S,
 MCTargetStreamer *llvm::createAArch64NullTargetStreamer(MCStreamer &S) {
   return new AArch64TargetStreamer(S);
 }
+
+void AArch64TargetStreamer::emitAtributesSubsection(
+StringRef VendorName, AArch64BuildAttributes::SubsectionOptional 
IsOptional,
+AArch64BuildAttributes::SubsectionType ParameterType) {
+
+  // If exists, return.
+  for (MCELFStreamer::AttributeSubSection &SubSection : AttributeSubSections) {
+if (VendorName == SubSection.VendorName) {
+  activateAtributesSubsection(VendorName);
+  return;
+}
+  }
+  // else, add the subsection
+  MCELFStreamer::AttributeSubSection AttSubSection;
+  AttSubSection.VendorName = VendorName;
+  AttSubSection.IsOptional = IsOptional;
+  AttSubSection.ParameterType = ParameterType;
+  AttributeSubSections.push_back(AttSubSection);
+  activateAtributesSubsection(VendorName);
+}
+
+std::unique_ptr
+AArch64TargetStreamer::getActiveAtributesSubsection() {
+  for (MCELFStreamer::AttributeSubSection &SubSection : AttributeSubSections) {
+if (SubSection.IsActive) {
+  return std::make_unique(SubSection);
+}
+  }
+  return nullptr;
+}
+
+void AArch64TargetStreamer::emitAttribute(StringRef VendorName, unsigned Tag,
+  unsigned Value, std::string String,
+  bool Override) {
+
+  if (unsigned(-1) == Value && "" == String) {
+assert(0 && "Arguments error");
+return;
+  }
+  if (AttributeSubSections.size() == 0) {
+assert(0 &&
+   "Can not add AArch64 build attribute: no AArch64 subsection 
exists");
+return;
+  }
+
+  for (MCELFStreamer::AttributeSubSection &SubSection : AttributeSubSections) {
+if (VendorName == SubSection.VendorName) {
+  if (!SubSection.IsActive) {
+assert(0 &&
+   "Can not add AArch64 build attribute: subsection is not 
active");
+return;
+  }
+  for (MCELFStreamer::AttributeItem &Item : SubSection.Content) {
+if (Item.Tag == Tag) {
+  if (!Override) {
+if ((unsigned(-1) != Value && Item.IntValue != Value) ||

ostannard wrote:

Both sides of this `if` statement do the same thing (just slightly different 
wording in the assert).

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


[clang] [llvm] [LLVM][Clang][AArch64] Implement AArch64 build attributes (PR #118771)

2025-01-13 Thread Oliver Stannard via cfe-commits


@@ -0,0 +1,140 @@
+//===-- AArch64BuildAttributes.cpp - AArch64 Build Attributes 
-===//
+//
+// 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 "llvm/Support/AArch64BuildAttributes.h"
+
+namespace llvm {
+namespace AArch64BuildAttributes {
+// AArch64 build attributes
+StringRef getSubsectionTag() { return "aeabi_subsection"; }
+StringRef getAttrTag() { return "aeabi_attribute"; }
+
+StringRef getVendorName(unsigned Vendor) {
+  switch (Vendor) {
+  case AEABI_FEATURE_AND_BITS:
+return VendorName[AEABI_FEATURE_AND_BITS];
+  case AEABI_PAUTHABI:
+return VendorName[AEABI_PAUTHABI];
+  case VENDOR_UNKNOWN:
+return "";
+  default:
+assert(0 && "Vendor name error");
+return "";
+  }
+}
+VendorID getVendorID(StringRef Vendor) {
+  if (Vendor == VendorName[AEABI_FEATURE_AND_BITS]) {

ostannard wrote:

For the string->enum functions, you can use `llvm::StringSwitch`: 
https://llvm.org/doxygen/classllvm_1_1StringSwitch.html

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


[clang] Fixed some warn-override tests in SemaCXX (PR #122680)

2025-01-13 Thread via cfe-commits

https://github.com/2LoS updated https://github.com/llvm/llvm-project/pull/122680

>From 3109461716e5e78b23bea7a2eb6aac3d34348612 Mon Sep 17 00:00:00 2001
From: LoS 
Date: Mon, 13 Jan 2025 11:21:46 +0100
Subject: [PATCH 1/3] Fixed some warn-override tests in SemaCXX

---
 ...e => warn-inconsistent-missing-destructor-override.cpp} | 0
 ...uctor-override => warn-suggest-destructor-override.cpp} | 0
 .../{warn-suggest-override => warn-suggest-override.cpp}   | 7 ---
 3 files changed, 4 insertions(+), 3 deletions(-)
 rename clang/test/SemaCXX/{warn-inconsistent-missing-destructor-override => 
warn-inconsistent-missing-destructor-override.cpp} (100%)
 rename clang/test/SemaCXX/{warn-suggest-destructor-override => 
warn-suggest-destructor-override.cpp} (100%)
 rename clang/test/SemaCXX/{warn-suggest-override => warn-suggest-override.cpp} 
(58%)

diff --git a/clang/test/SemaCXX/warn-inconsistent-missing-destructor-override 
b/clang/test/SemaCXX/warn-inconsistent-missing-destructor-override.cpp
similarity index 100%
rename from clang/test/SemaCXX/warn-inconsistent-missing-destructor-override
rename to clang/test/SemaCXX/warn-inconsistent-missing-destructor-override.cpp
diff --git a/clang/test/SemaCXX/warn-suggest-destructor-override 
b/clang/test/SemaCXX/warn-suggest-destructor-override.cpp
similarity index 100%
rename from clang/test/SemaCXX/warn-suggest-destructor-override
rename to clang/test/SemaCXX/warn-suggest-destructor-override.cpp
diff --git a/clang/test/SemaCXX/warn-suggest-override 
b/clang/test/SemaCXX/warn-suggest-override.cpp
similarity index 58%
rename from clang/test/SemaCXX/warn-suggest-override
rename to clang/test/SemaCXX/warn-suggest-override.cpp
index e06c939ff001fc..436a17d489693c 100644
--- a/clang/test/SemaCXX/warn-suggest-override
+++ b/clang/test/SemaCXX/warn-suggest-override.cpp
@@ -17,13 +17,13 @@ struct C {
 
 struct D : public C {
   void run();
-  // expected-warning@-1 {{'run()' overrides a member function but is not 
marked 'override'}}
+  // expected-warning@-1 {{'run' overrides a member function but is not marked 
'override'}}
   ~D();
 };
 
 struct E : public C {
   virtual void run();
-  // expected-warning@-1 {{'run()' overrides a member function but is not 
marked 'override'}}
+  // expected-warning@-1 {{'run' overrides a member function but is not marked 
'override'}}
   virtual ~E();
 };
 
@@ -32,7 +32,8 @@ struct F : public C {
   ~F() override;
 };
 
-struct G : public C {
+struct G : public C { // expected-note {{mark 'G' as 'final'}}
   void run() final;
   ~G() final;
+  // expected-warning@-1 {{class with destructor marked as 'final' can not be 
inherited from}}
 };

>From b9ef67561e235aa7d44b8cac3c46a001a08cbc75 Mon Sep 17 00:00:00 2001
From: LoS 
Date: Mon, 13 Jan 2025 11:58:13 +0100
Subject: [PATCH 2/3] Update warn-suggest-override.cpp

---
 clang/test/SemaCXX/warn-suggest-override.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/test/SemaCXX/warn-suggest-override.cpp 
b/clang/test/SemaCXX/warn-suggest-override.cpp
index 436a17d489693c..b1df5cf1224cf3 100644
--- a/clang/test/SemaCXX/warn-suggest-override.cpp
+++ b/clang/test/SemaCXX/warn-suggest-override.cpp
@@ -35,5 +35,5 @@ struct F : public C {
 struct G : public C { // expected-note {{mark 'G' as 'final'}}
   void run() final;
   ~G() final;
-  // expected-warning@-1 {{class with destructor marked as 'final' can not be 
inherited from}}
+  // expected-warning@-1 {{class with destructor marked 'final' can not be 
inherited from}}
 };

>From 24d6e1ec37c8e68ff6c521a6a5e8e236e6e80757 Mon Sep 17 00:00:00 2001
From: LoS 
Date: Mon, 13 Jan 2025 13:25:39 +0100
Subject: [PATCH 3/3] Update warn-suggest-override.cpp

---
 clang/test/SemaCXX/warn-suggest-override.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/test/SemaCXX/warn-suggest-override.cpp 
b/clang/test/SemaCXX/warn-suggest-override.cpp
index b1df5cf1224cf3..c4b5149c681a40 100644
--- a/clang/test/SemaCXX/warn-suggest-override.cpp
+++ b/clang/test/SemaCXX/warn-suggest-override.cpp
@@ -35,5 +35,5 @@ struct F : public C {
 struct G : public C { // expected-note {{mark 'G' as 'final'}}
   void run() final;
   ~G() final;
-  // expected-warning@-1 {{class with destructor marked 'final' can not be 
inherited from}}
+  // expected-warning@-1 {{class with destructor marked 'final' cannot be 
inherited from}}
 };

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


[clang] [Driver] Teach Barmetal toolchain about GCC installation(1/3) (PR #121829)

2025-01-13 Thread Garvit Gupta via cfe-commits

quic-garvgupt wrote:

Gentle Ping!

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


[clang] c2979c5 - [Clang] Add release note for pointer overflow optimization change (#122462)

2025-01-13 Thread via cfe-commits

Author: Nikita Popov
Date: 2025-01-13T11:24:02+01:00
New Revision: c2979c58d49bf3c7dc892ed9fb49cdca389130ee

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

LOG: [Clang] Add release note for pointer overflow optimization change (#122462)

Add a release note for optimization change related to pointer overflow
checks. I've put this in the breaking changes section to give it the
best chance of being seen.

Added: 


Modified: 
clang/docs/ReleaseNotes.rst

Removed: 




diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index a14fb189c8e132..8f4adbcd705181 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -58,6 +58,29 @@ code bases.
   containing strict-aliasing violations. The new default behavior can be
   disabled using ``-fno-pointer-tbaa``.
 
+- Clang will now more aggressively use undefined behavior on pointer addition
+  overflow for optimization purposes. For example, a check like
+  ``ptr + unsigned_offset < ptr`` will now optimize to ``false``, because
+  ``ptr + unsigned_offset`` will cause undefined behavior if it overflows (or
+  advances past the end of the object).
+
+  Previously, ``ptr + unsigned_offset < ptr`` was optimized (by both Clang and
+  GCC) to ``(ssize_t)unsigned_offset < 0``. This also results in an incorrect
+  overflow check, but in a way that is less apparent when only testing with
+  pointers in the low half of the address space.
+
+  To avoid pointer addition overflow, it is necessary to perform the addition
+  on integers, for example using
+  ``(uintptr_t)ptr + unsigned_offset < (uintptr_t)ptr``. Sometimes, it is also
+  possible to rewrite checks by only comparing the offset. For example,
+  ``ptr + offset < end_ptr && ptr + offset >= ptr`` can be written as
+  ``offset < (uintptr_t)(end_ptr - ptr)``.
+
+  Undefined behavior due to pointer addition overflow can be reliably detected
+  using ``-fsanitize=pointer-overflow``. It is also possible to use
+  ``-fno-strict-overflow`` to opt-in to a language dialect where signed integer
+  and pointer overflow are well-defined.
+
 C/C++ Language Potentially Breaking Changes
 ---
 



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


[clang] [APINotes] Avoid duplicated attributes for class template instantiations (PR #122516)

2025-01-13 Thread Gábor Horváth via cfe-commits


@@ -19493,7 +19493,11 @@ void Sema::ActOnFields(Scope *S, SourceLocation 
RecLoc, Decl *EnclosingDecl,
   CDecl->setIvarRBraceLoc(RBrac);
 }
   }
-  ProcessAPINotes(Record);
+
+  // If this is a class template instantiation, its API Notes attributes were
+  // added to the class template itself. Make sure they are not added twice.
+  if (!CXXRecord || !CXXRecord->getDescribedClassTemplate())

Xazax-hun wrote:

I am a bit confused. 
The PR description says:
>  don't try to add attributes from API Notes to concrete instantiations
 I'd expect this code to do the opposite. I'd expect 
`getDescribedClassTemplate` to return null for instantiations, so I'd expect us 
to take this branch when we process an instantiation. 

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


[clang] [APINotes] Avoid duplicated attributes for class template instantiations (PR #122516)

2025-01-13 Thread Gábor Horváth via cfe-commits

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


[clang] [Clang] Add release note for pointer overflow optimization change (PR #122462)

2025-01-13 Thread Nikita Popov via cfe-commits

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


[clang] Revert "[clang] Canonicalize absolute paths in dependency file" (PR #121638)

2025-01-13 Thread LLVM Continuous Integration via cfe-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder 
`openmp-offload-libc-amdgpu-runtime` running on `omp-vega20-1` while building 
`clang` at step 7 "Add check check-offload".

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


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

```
Step 7 (Add check check-offload) failure: test (failure)
 TEST 'libomptarget :: amdgcn-amd-amdhsa :: 
offloading/pgo1.c' FAILED 
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/./bin/clang 
-fopenmp-I 
/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.src/offload/test 
-I 
/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/openmp/runtime/src
 -L 
/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/offload
 -L /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/./lib -L 
/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/openmp/runtime/src
  -nogpulib 
-Wl,-rpath,/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/offload
 
-Wl,-rpath,/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/openmp/runtime/src
 
-Wl,-rpath,/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/./lib
  -fopenmp-targets=amdgcn-amd-amdhsa 
/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.src/offload/test/offloading/pgo1.c
 -o 
/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/offload/test/amdgcn-amd-amdhsa/offloading/Output/pgo1.c.tmp
 -Xoffload-linker -lc -Xoffload-linker -lm 
/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/./lib/libomptarget.devicertl.a
 -fprofile-instr-generate  -Xclang "-fprofile-instrument=clang"
# executed command: 
/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/./bin/clang 
-fopenmp -I 
/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.src/offload/test 
-I 
/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/openmp/runtime/src
 -L 
/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/offload
 -L /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/./lib -L 
/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/openmp/runtime/src
 -nogpulib 
-Wl,-rpath,/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/offload
 
-Wl,-rpath,/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/openmp/runtime/src
 
-Wl,-rpath,/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/./lib
 -fopenmp-targets=amdgcn-amd-amdhsa 
/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.src/offload/test/offloading/pgo1.c
 -o 
/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/offload/test/amdgcn-amd-amdhsa/offloading/Output/pgo1.c.tmp
 -Xoffload-linker -lc -Xoffload-linker -lm 
/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/./lib/libomptarget.devicertl.a
 -fprofile-instr-generate -Xclang -fprofile-instrument=clang
# RUN: at line 3
/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/offload/test/amdgcn-amd-amdhsa/offloading/Output/pgo1.c.tmp
 2>&1 | 
/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/./bin/FileCheck
 
/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.src/offload/test/offloading/pgo1.c
  --check-prefix="CLANG-PGO"
# executed command: 
/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/offload/test/amdgcn-amd-amdhsa/offloading/Output/pgo1.c.tmp
# executed command: 
/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/./bin/FileCheck
 
/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.src/offload/test/offloading/pgo1.c
 --check-prefix=CLANG-PGO
# .---command stderr
# | 
/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.src/offload/test/offloading/pgo1.c:32:20:
 error: CLANG-PGO-NEXT: expected string not found in input
# | // CLANG-PGO-NEXT: [ 0 11 20 ]
# |^
# | :3:28: note: scanning from here
# |  Counters =
# |^
# | :4:1: note: possible intended match here
# | [ 0 12 20 ]
# | ^
# | 
# | Input file: 
# | Check file: 
/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.src/offload/test/offloading/pgo1.c
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<
# |1: === GPU Profile === 
# |2: Target: amdgcn-amd-amdhsa 
# |3:  Counters = 
# | ne

[clang] 41a94de - [clang] Refactor attr diagnostics to use %select (#122473)

2025-01-13 Thread via cfe-commits

Author: Maksim Ivanov
Date: 2025-01-13T13:42:22+01:00
New Revision: 41a94de75caacb979070ec7a010dfe3c4e9f116f

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

LOG: [clang] Refactor attr diagnostics to use %select (#122473)

A cleanup follow-up to #118501 and #118567.

Added: 


Modified: 
clang/examples/Attribute/Attribute.cpp
clang/examples/CallSuperAttribute/CallSuperAttrInfo.cpp
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/include/clang/Sema/ParsedAttr.h
clang/lib/Parse/ParseDecl.cpp
clang/lib/Sema/SemaDeclAttr.cpp
clang/lib/Sema/SemaSwift.cpp
clang/lib/Sema/SemaType.cpp

Removed: 




diff  --git a/clang/examples/Attribute/Attribute.cpp 
b/clang/examples/Attribute/Attribute.cpp
index 3b90724ad22205..625f1645afbff6 100644
--- a/clang/examples/Attribute/Attribute.cpp
+++ b/clang/examples/Attribute/Attribute.cpp
@@ -42,8 +42,8 @@ struct ExampleAttrInfo : public ParsedAttrInfo {
 const Decl *D) const override {
 // This attribute appertains to functions only.
 if (!isa(D)) {
-  S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str)
-  << Attr << Attr.isRegularKeywordAttribute() << "functions";
+  S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type)
+  << Attr << Attr.isRegularKeywordAttribute() << ExpectedFunction;
   return false;
 }
 return true;
@@ -99,8 +99,9 @@ struct ExampleAttrInfo : public ParsedAttrInfo {
 const Stmt *St) const override {
 // This attribute appertains to for loop statements only.
 if (!isa(St)) {
-  S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str)
-  << Attr << Attr.isRegularKeywordAttribute() << "for loop statements";
+  S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type)
+  << Attr << Attr.isRegularKeywordAttribute()
+  << ExpectedForLoopStatement;
   return false;
 }
 return true;

diff  --git a/clang/examples/CallSuperAttribute/CallSuperAttrInfo.cpp 
b/clang/examples/CallSuperAttribute/CallSuperAttrInfo.cpp
index 12d4c311586e6f..f206a84ab1311d 100644
--- a/clang/examples/CallSuperAttribute/CallSuperAttrInfo.cpp
+++ b/clang/examples/CallSuperAttribute/CallSuperAttrInfo.cpp
@@ -168,8 +168,9 @@ struct CallSuperAttrInfo : public ParsedAttrInfo {
 const Decl *D) const override {
 const auto *TheMethod = dyn_cast_or_null(D);
 if (!TheMethod || !TheMethod->isVirtual()) {
-  S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str)
-  << Attr << Attr.isRegularKeywordAttribute() << "virtual functions";
+  S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type)
+  << Attr << Attr.isRegularKeywordAttribute()
+  << ExpectedVirtualFunction;
   return false;
 }
 MarkedMethods.insert(TheMethod);

diff  --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td 
b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index f04381a32a4158..8be4f946dce1cc 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -3799,7 +3799,14 @@ def warn_attribute_wrong_decl_type : Warning<
   "|types and namespaces"
   "|variables, functions and classes"
   "|kernel functions"
-  "|non-K&R-style functions}2">,
+  "|non-K&R-style functions"
+  "|for loop statements"
+  "|virtual functions"
+  "|parameters and implicit object parameters"
+  "|non-member functions"
+  "|functions, classes, or enumerations"
+  "|classes"
+  "|typedefs}2">,
   InGroup;
 def err_attribute_wrong_decl_type : 
Error;
 def warn_type_attribute_wrong_type : Warning<

diff  --git a/clang/include/clang/Sema/ParsedAttr.h 
b/clang/include/clang/Sema/ParsedAttr.h
index 4fa5fbdb5a7f63..e1faab205f647a 100644
--- a/clang/include/clang/Sema/ParsedAttr.h
+++ b/clang/include/clang/Sema/ParsedAttr.h
@@ -1099,6 +1099,13 @@ enum AttributeDeclKind {
   ExpectedFunctionVariableOrClass,
   ExpectedKernelFunction,
   ExpectedFunctionWithProtoType,
+  ExpectedForLoopStatement,
+  ExpectedVirtualFunction,
+  ExpectedParameterOrImplicitObjectParameter,
+  ExpectedNonMemberFunction,
+  ExpectedFunctionOrClassOrEnum,
+  ExpectedClass,
+  ExpectedTypedef,
 };
 
 inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB,

diff  --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp
index 7f3f6d568e28cf..f136d5007e8a5f 100644
--- a/clang/lib/Parse/ParseDecl.cpp
+++ b/clang/lib/Parse/ParseDecl.cpp
@@ -24,6 +24,7 @@
 #include "clang/Parse/RAIIObjectsForParser.h"
 #include "clang/Sema/EnterExpressionEvaluationContext.h"
 #include "clang/Sema/Lookup.h"
+#include "clang/Sema/ParsedAttr.h"
 #include "clang/Sema/ParsedTemplate.h"
 #include "

[clang] [clang] Refactor attr diagnostics to use %select (PR #122473)

2025-01-13 Thread Ilya Biryukov via cfe-commits

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


[clang] [NFC][analyzer][docs] Migrate 'annotations.html' to RST (PR #122246)

2025-01-13 Thread Kristóf Umann via cfe-commits

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

Shouldn't we leave a stub in the old HTML page that the docs were moved? Or we 
haven't done that in the past either?

I understand (and strongly agree with) you not making any meaningful changes to 
the docs page you moved. With that said, later down the line, we should make 
sure that checkers are called "checkers", and not "checks" (the latter is used 
in clang-tidy), and that `ownership_.*` attributes must be mentioned here as 
well.

Otherwise LGTM, thanks for the work!

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


[clang] [OpenMP] Allow OMP6.0 features. (PR #122108)

2025-01-13 Thread Saiyedul Islam via cfe-commits


@@ -19,6 +19,8 @@ typedef void *omp_depend_t;
 void foo() {}
 void tmainc(){
omp_depend_t obj;
+   int omp_all_memory;

saiislam wrote:

Do we need this new variable?

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


[clang] [OpenMP] Allow OMP6.0 features. (PR #122108)

2025-01-13 Thread Saiyedul Islam via cfe-commits


@@ -69,11 +80,11 @@ void c();
 
 void func() {} // expected-note {{'func' defined here}}
 
-#pragma omp declare target link(func) allocate(a) // expected-error {{function 
name is not allowed in 'link' clause}} omp45-error {{unexpected 'allocate' 
clause, only 'to' or 'link' clauses expected}} omp5-error {{unexpected 
'allocate' clause, only 'to', 'link' or 'device_type' clauses expected}} 
omp51-error {{unexpected 'allocate' clause, only 'to', 'link', 'device_type' or 
'indirect' clauses expected}} omp52-error {{unexpected 'allocate' clause, only 
'enter', 'link', 'device_type' or 'indirect' clauses expected}}
+#pragma omp declare target link(func) allocate(a) // expected-error {{function 
name is not allowed in 'link' clause}} omp45-error {{unexpected 'allocate' 
clause, only 'to' or 'link' clauses expected}} omp5-error {{unexpected 
'allocate' clause, only 'to', 'link' or 'device_type' clauses expected}} 
omp6-error {{unexpected 'allocate' clause, only 'enter', 'link', 'device_type' 
or 'indirect' clauses expected}} omp51-error {{unexpected 'allocate' clause, 
only 'to', 'link', 'device_type' or 'indirect' clauses expected}} omp52-error 
{{unexpected 'allocate' clause, only 'enter', 'link', 'device_type' or 
'indirect' clauses expected}}
 
 void bar();
 void baz() {bar();}
-#pragma omp declare target(bar) // omp5-warning {{declaration marked as 
declare target after first use, it may lead to incorrect results}} // 
omp51-warning {{declaration marked as declare target after first use, it may 
lead to incorrect results}} omp52-warning {{declaration marked as declare 
target after first use, it may lead to incorrect results}}
+#pragma omp declare target(bar) // omp5-warning {{declaration marked as 
declare target after first use, it may lead to incorrect results}} omp6-warning 
{{declaration marked as declare target after first use, it may lead to 
incorrect results}} // omp51-warning {{declaration marked as declare target 
after first use, it may lead to incorrect results}} omp52-warning {{declaration 
marked as declare target after first use, it may lead to incorrect results}}

saiislam wrote:

Please follow previous order (5, 51, 52) of adding warnings.

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


[clang] [OpenMP] Allow OMP6.0 features. (PR #122108)

2025-01-13 Thread Saiyedul Islam via cfe-commits


@@ -1,10 +1,10 @@
-// RUN: %clang_cc1 -verify -triple x86_64-apple-darwin10 -fopenmp -emit-llvm 
-o - %s | FileCheck %s
-// RUN: %clang_cc1 -fopenmp -triple x86_64-apple-darwin10 -x c++ -std=c++11 
-emit-pch -o %t %s
-// RUN: %clang_cc1 -fopenmp -triple x86_64-apple-darwin10 -std=c++11 
-include-pch %t -verify %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 -verify -triple x86_64-apple-darwin10 -fopenmp 
-fopenmp-version=50 -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -triple x86_64-apple-darwin10 
-x c++ -std=c++11 -emit-pch -o %t %s

saiislam wrote:

This is changing the test case from testing default (ver 5.1) to ver 5.0. If 
there is a divergence, please add a RUN and CHECK lines while guarding 
divergent lines.

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


[clang] [OpenMP] Allow OMP6.0 features. (PR #122108)

2025-01-13 Thread Saiyedul Islam via cfe-commits

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


[clang] [OpenMP] Allow OMP6.0 features. (PR #122108)

2025-01-13 Thread Saiyedul Islam via cfe-commits


@@ -68,15 +70,15 @@ int fun(int arg) {
   {}
 #pragma omp target map(mapper(aa :vv)   // 
expected-error {{use of undeclared identifier 'aa'}} expected-error {{expected 
')'}} expected-error {{call to undeclared function 'mapper'}} expected-note 
{{to match this '('}}
   {}
-#pragma omp target map(mapper(ab) :vv)  // 
expected-error {{missing map type}} expected-error {{cannot find a valid 
user-defined mapper for type 'struct vec' with name 'ab'}}
+#pragma omp target map(mapper(ab) :vv)  // 
omp50-error {{missing map type}} omp51-error {{missing map type}} omp52-error 
{{missing map type}} omp51-simd-error {{missing map type}} expected-error 
{{cannot find a valid user-defined mapper for type 'struct vec' with name 'ab'}}
   {}
-#pragma omp target map(mapper(ab) :arr[0:2])// 
expected-error {{missing map type}} expected-error {{cannot find a valid 
user-defined mapper for type 'struct vec' with name 'ab'}}
+#pragma omp target map(mapper(ab) :arr[0:2])// 
omp50-error {{missing map type}} omp51-error {{missing map type}} omp52-error 
{{missing map type}} omp51-simd-error {{missing map type}} expected-error 
{{cannot find a valid user-defined mapper for type 'struct vec' with name 'ab'}}

saiislam wrote:

If the behavior is different only for 6.0 then may be put it in a separate 
block guarded by `#ifndef OMP60` and `-DOMP60`

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


[clang] [OpenMP] Allow OMP6.0 features. (PR #122108)

2025-01-13 Thread Saiyedul Islam via cfe-commits


@@ -4,19 +4,19 @@
 // RUN: %clang_cc1 -verify -std=c++11 -fopenmp -ast-print %s 
-Wno-openmp-mapping -DOMP5 | FileCheck %s --check-prefix=CHECK 
--check-prefix=OMP50
 // RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -emit-pch -o %t %s -DOMP5
 // RUN: %clang_cc1 -fopenmp -std=c++11 -include-pch %t -verify %s -ast-print 
-Wno-openmp-mapping -DOMP5 | FileCheck %s --check-prefix=CHECK 
--check-prefix=OMP50
-// RUN: %clang_cc1 -verify -std=c++11 -fopenmp -fopenmp-version=51 -ast-print 
%s -Wno-openmp-mapping -DOMP51 | FileCheck %s --check-prefix=CHECK 
--check-prefix=OMP51
-// RUN: %clang_cc1 -fopenmp -fopenmp-version=51 -x c++ -std=c++11 -emit-pch -o 
%t %s -DOMP51
-// RUN: %clang_cc1 -fopenmp -fopenmp-version=51 -std=c++11 -include-pch %t 
-verify %s -ast-print -Wno-openmp-mapping -DOMP51 | FileCheck %s 
--check-prefix=CHECK --check-prefix=OMP51
+// RUN: %clang_cc1 -verify -std=c++11 -fopenmp -fopenmp-version=60 -ast-print 
%s -Wno-openmp-mapping -DOMP51 | FileCheck %s --check-prefix=CHECK 
--check-prefix=OMP51

saiislam wrote:

Please don't reduce existing testing for 5.1, instead add new tests for 6.0

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


[clang] [OpenMP] Allow OMP6.0 features. (PR #122108)

2025-01-13 Thread Saiyedul Islam via cfe-commits


@@ -25,16 +36,16 @@ __thread int t; // expected-note {{defined as threadprivate 
or thread local}}
 void f();
 #pragma omp end declare target shared(a) // expected-warning {{extra tokens at 
the end of '#pragma omp end declare target' are ignored}}
 
-#pragma omp declare target map(a) // omp45-error {{expected at least one 'to' 
or 'link' clause}} omp5-error {{expected at least one 'to' or 'link' clause}} 
omp51-error {{expected at least one 'to', 'link' or 'indirect' clause}} 
omp45-error {{unexpected 'map' clause, only 'to' or 'link' clauses expected}} 
omp5-error {{unexpected 'map' clause, only 'to', 'link' or 'device_type' 
clauses expected}} omp51-error {{unexpected 'map' clause, only 'to', 'link', 
'device_type' or 'indirect' clauses expected}} omp52-error {{unexpected 'map' 
clause, only 'enter', 'link', 'device_type' or 'indirect' clauses expected}} 
omp52-error {{expected at least one 'enter', 'link' or 'indirect' clause}}
+#pragma omp declare target map(a) // omp45-error {{expected at least one 'to' 
or 'link' clause}} omp5-error {{expected at least one 'to' or 'link' clause}} 
omp6-error {{unexpected 'map' clause, only 'enter', 'link', 'device_type' or 
'indirect' clauses expected}} omp6-error {{expected at least one 'enter', 
'link' or 'indirect' clause}} omp51-error {{expected at least one 'to', 'link' 
or 'indirect' clause}} omp45-error {{unexpected 'map' clause, only 'to' or 
'link' clauses expected}} omp5-error {{unexpected 'map' clause, only 'to', 
'link' or 'device_type' clauses expected}} omp51-error {{unexpected 'map' 
clause, only 'to', 'link', 'device_type' or 'indirect' clauses expected}} 
omp52-error {{unexpected 'map' clause, only 'enter', 'link', 'device_type' or 
'indirect' clauses expected}} omp52-error {{expected at least one 'enter', 
'link' or 'indirect' clause}}

saiislam wrote:

May be add the error for 60 in the end, after 45, 50, 51, and 52 errors.

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


[clang] [OpenMP] Allow OMP6.0 features. (PR #122108)

2025-01-13 Thread Saiyedul Islam via cfe-commits


@@ -63,22 +63,22 @@ class VV {
   // CHECK-NEXT: int add(int a, int b) __attribute__((cold)){
   // CHECK-NEXT: return a + b;
   // CHECK-NEXT: }
-  #pragma omp declare simd uniform(this, a) linear(val(b): a)
+  #pragma omp declare simd uniform(this, a) linear(b: a)

saiislam wrote:

Why do we need to remove val, ref, and uval clauses from these test cases? If 
they are not supported by 6.0 then please check them separately.

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


[clang] [OpenMP] Allow OMP6.0 features. (PR #122108)

2025-01-13 Thread Saiyedul Islam via cfe-commits

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


[clang] [NFC][analyzer][docs] Restore/remove orphaned images (PR #122481)

2025-01-13 Thread Kristóf Umann via cfe-commits

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

LGTM

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


[clang] [lldb] [clang][DebugInfo] Expand detection of structured bindings to account for std::get free function (PR #122265)

2025-01-13 Thread Michael Buch via cfe-commits

https://github.com/Michael137 updated 
https://github.com/llvm/llvm-project/pull/122265

>From b43ffd0c1bb6e4f1ca5b8458848f574480021b08 Mon Sep 17 00:00:00 2001
From: Michael Buch 
Date: Thu, 9 Jan 2025 10:01:31 +
Subject: [PATCH 1/5] [clang][DebugInfo] Expand detection of structured
 bindings to account for std::get free function

When we generate the debug-info for a `VarDecl` we try
to determine whether it was introduced as part of a structure
binding (aka a "holding var"). If it was,
we don't mark it as `artificial`.

The heuristic to determine a holding var uses
`IgnoreUnlessSpelledInSource` to unwrap the `VarDecl` initializer
until we hit a `DeclRefExpr` that refers to a `Decomposition`.
For "tuple-like decompositions", Clang will generate a call to
a `template Foo get(Bar)` function that retrieves the
`Ith` element from the tuple-like structure. If that function is a
member function, we get an AST that looks as follows:
```
VarDecl implicit used z1 'std::tuple_element<0, B>::type &&' cinit
`-ExprWithCleanups  'int' xvalue
  `-MaterializeTemporaryExpr  'int' xvalue extended by Var 0x11d110cf8 
'z1' 'std::tuple_element<0, B>::type &&'
`-CXXMemberCallExpr  'int'
  `-MemberExpr  '' .get 0x11d104390
`-ImplicitCastExpr  'B' xvalue 
  `-DeclRefExpr  'B' lvalue Decomposition 0x11d1100a8 '' 'B'
```
`IgnoreUnlessSpelledInSource` happily unwraps this down to the
`DeclRefExpr`. However, when the `get` helper is a free function
(which it is for `std::pair` in libc++ for example), then the AST
is:
```
VarDecl col:16 implicit used k 'std::tuple_element<0, const std::tuple>::type &' cinit
`-CallExpr  'const typename tuple_element<0UL, tuple>::type':'const int' lvalue adl
  |-ImplicitCastExpr  'const typename tuple_element<0UL, tuple>::type &(*)(const tuple &) noexcept' 
  | `-DeclRefExpr  'const typename tuple_element<0UL, tuple>::type &(const tuple &) noexcept' lvalue Function 0x1210262d8 
'get' 'const typename tuple_element<0UL, tuple>::type &(const 
tuple &) noexcept' (FunctionTemplate 0x11d068088 'get')
  `-DeclRefExpr  'const std::tuple' lvalue Decomposition 
0x121021518 '' 'const std::tuple &'
```
`IgnoreUnlessSpelledInSource` doesn't unwrap this `CallExpr`, so we
incorrectly mark the binding as `artificial` in debug-info.

This patch adjusts our heuristic to account for `CallExpr` nodes.

Fixes https://github.com/llvm/llvm-project/issues/122028
---
 clang/lib/CodeGen/CGDebugInfo.cpp | 28 ++-
 .../debug-info-structured-binding.cpp | 28 ++-
 .../TestStructuredBinding.py  | 11 +++
 .../API/lang/cpp/structured-binding/main.cpp  | 81 +--
 4 files changed, 140 insertions(+), 8 deletions(-)

diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp 
b/clang/lib/CodeGen/CGDebugInfo.cpp
index d7e5e95b7873a0..f49e759e50ea3d 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -85,12 +85,38 @@ static bool IsDecomposedVarDecl(VarDecl const *VD) {
   if (!Init)
 return false;
 
+  Init = Init->IgnoreUnlessSpelledInSource();
+  if (!Init)
+return false;
+
+  // For tuple-like decompositions, if the `get` function
+  // is not a member of the decomposed type, but instead a
+  // free function (e.g., how std::get is specialized for
+  // std::pair), then the initializer is a `CallExpr` and
+  // we need to dig into the argument before unwrapping it
+  // with IgnoreUnlessSpelledInSource.
+  if (auto const *CE = llvm::dyn_cast(Init)) {
+if (CE->getNumArgs() == 0)
+  return false;
+
+// The first argument will be the type we're decomposing.
+// Technically the getter could have more than 1 argument
+// (e.g., if they're defaulted arguments), but we don't care
+// about them because we just need to check whether the
+// first argument is a DecompositionDecl.
+auto const *Arg = CE->getArg(0);
+if (!Arg)
+  return false;
+
+Init = Arg;
+  }
+
   auto const *RefExpr =
   llvm::dyn_cast_or_null(Init->IgnoreUnlessSpelledInSource());
   if (!RefExpr)
 return false;
 
-  return llvm::dyn_cast_or_null(RefExpr->getDecl());
+  return llvm::isa_and_nonnull(RefExpr->getDecl());
 }
 
 /// Returns true if \ref VD is a compiler-generated variable
diff --git a/clang/test/CodeGenCXX/debug-info-structured-binding.cpp 
b/clang/test/CodeGenCXX/debug-info-structured-binding.cpp
index 5fbd54c16382c0..55a84a65015842 100644
--- a/clang/test/CodeGenCXX/debug-info-structured-binding.cpp
+++ b/clang/test/CodeGenCXX/debug-info-structured-binding.cpp
@@ -1,5 +1,6 @@
 // RUN: %clang_cc1 -emit-llvm -debug-info-kind=standalone -triple 
%itanium_abi_triple %s -o - | FileCheck %s --implicit-check-not="call void 
@llvm.dbg.declare"
 
+// CHECK: define noundef i32 @_Z1fv
 // CHECK: #dbg_declare(ptr %{{[a-z]+}}, ![[VAR_0:[0-9]+]], !DIExpression(),
 // CHECK: #dbg_declare(ptr %{{[0-9]+}}, ![[VAR_1:[0-9]+]], !DIExpression(),
 // CHECK: #dbg_declare(ptr %{{[0-9]+}}, ![[VAR_2:[0-9]+]], 
!DIExpre

[clang] [Clang] emit -Wignored-qualifiers diagnostic for cv-qualified base classes (PR #121419)

2025-01-13 Thread Louis Dionne via cfe-commits

ldionne wrote:

> > @erichkeane @ldionne should the `libcxx` tests 
> > ([common_reference.compile.pass.cpp](https://github.com/llvm/llvm-project/blob/main/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/common_reference.compile.pass.cpp),
> >  
> > [apply_extended_types.pass.cpp](https://github.com/llvm/llvm-project/blob/main/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.apply/apply_extended_types.pass.cpp))
> >  be updated or should the new warnings/errors be treated as the new 
> > baseline?
> 
> This is entirely a @ldionne question, though I see in github that he's on 
> vacation at the moment, so we'll have to wait until he returns.

Thanks for the ping. I've returned but Github doesn't clear the vacation status 
automatically - fixed now.

This seems reasonable to me, we should "fix" libc++. I think this should do it:

```diff
diff --git a/libcxx/include/tuple b/libcxx/include/tuple
index aca14ba408d3..90257e9bae0a 100644
--- a/libcxx/include/tuple
+++ b/libcxx/include/tuple
@@ -257,6 +257,7 @@ template 
 #  include <__type_traits/maybe_const.h>
 #  include <__type_traits/nat.h>
 #  include <__type_traits/negation.h>
+#  include <__type_traits/remove_cv.h>
 #  include <__type_traits/remove_cvref.h>
 #  include <__type_traits/remove_reference.h>
 #  include <__type_traits/unwrap_ref.h>
@@ -535,7 +536,7 @@ __memberwise_forward_assign(_Dest& __dest, _Source&& 
__source, __tuple_types<_Up
 
 template 
 class _LIBCPP_TEMPLATE_VIS tuple {
-  typedef __tuple_impl::type, 
_Tp...> _BaseT;
+  typedef __tuple_impl::type, 
__remove_cv_t<_Tp>...> _BaseT;
 
   _BaseT __base_;
 
```

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


[clang] [Clang] disallow the use of asterisks preceding constructor and destructor names (PR #122621)

2025-01-13 Thread Erich Keane via cfe-commits

https://github.com/erichkeane commented:

1 nit, else LGTM once @cor3ntin is happy.

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


[clang] [Clang] disallow the use of asterisks preceding constructor and destructor names (PR #122621)

2025-01-13 Thread Erich Keane via cfe-commits


@@ -2223,6 +2225,8 @@ def err_destructor_not_member : Error<
 def err_destructor_cannot_be : Error<"destructor cannot be declared '%0'">;
 def err_invalid_qualified_destructor : Error<
   "'%0' qualifier is not allowed on a destructor">;
+def err_invalid_destructor_decl : Error<

erichkeane wrote:

IMO, we should 'combined' the two diagnostics into `err_invalid_ctor_dtor_decl 
: Error<"invalid %select{constructor|destructor}0 declaration>`

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


[clang] [Clang] disallow the use of asterisks preceding constructor and destructor names (PR #122621)

2025-01-13 Thread Erich Keane via cfe-commits

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


[clang] 5e7d7fb - [AArch64] Fix aarch64-fujitsu-monaka.c test (#122716)

2025-01-13 Thread via cfe-commits

Author: Lukacma
Date: 2025-01-13T15:05:47Z
New Revision: 5e7d7fb1f0cefbb6f00bcd71867014ce8b71a11e

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

LOG: [AArch64] Fix aarch64-fujitsu-monaka.c test (#122716)

Added: 


Modified: 
clang/test/Driver/print-enabled-extensions/aarch64-fujitsu-monaka.c

Removed: 




diff  --git 
a/clang/test/Driver/print-enabled-extensions/aarch64-fujitsu-monaka.c 
b/clang/test/Driver/print-enabled-extensions/aarch64-fujitsu-monaka.c
index 3c74e3620df034..01a97a00de5421 100644
--- a/clang/test/Driver/print-enabled-extensions/aarch64-fujitsu-monaka.c
+++ b/clang/test/Driver/print-enabled-extensions/aarch64-fujitsu-monaka.c
@@ -28,8 +28,6 @@
 // CHECK-NEXT: FEAT_FP16  
Enable half-precision floating-point data processing
 // CHECK-NEXT: FEAT_FP8   
Enable FP8 instructions
 // CHECK-NEXT: FEAT_FP8DOT2   
Enable FP8 2-way dot instructions
-// CHECK-NEXT: FEAT_FP8DOT4   
Enable FP8 4-way dot instructions
-// CHECK-NEXT: FEAT_FP8FMA
Enable Armv9.5-A FP8 multiply-add instructions
 // CHECK-NEXT: FEAT_FPAC  
Enable Armv8.3-A Pointer Authentication Faulting enhancement
 // CHECK-NEXT: FEAT_FRINTTS   
Enable FRInt[32|64][Z|X] instructions that round a floating-point number to an 
integer (in FP format) forcing it to fit into a 32- or 64-bit int
 // CHECK-NEXT: FEAT_FlagM 
Enable Armv8.4-A Flag Manipulation instructions



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


[clang] [AArch64] Fix aarch64-fujitsu-monaka.c test (PR #122716)

2025-01-13 Thread via cfe-commits

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


[clang] Revert "[Multilib] Custom flags YAML parsing" (PR #122722)

2025-01-13 Thread Victor Campos via cfe-commits

https://github.com/vhscampos created 
https://github.com/llvm/llvm-project/pull/122722

Reverts llvm/llvm-project#110657

It seems that this patch is causing the sanitizer bot to fail. Reverting while 
I investigate

>From ad6c95a7c6e5e8d376225b42a3a71d5663aa7942 Mon Sep 17 00:00:00 2001
From: Victor Campos 
Date: Mon, 13 Jan 2025 15:07:18 +
Subject: [PATCH] Revert "[Multilib] Custom flags YAML parsing (#110657)"

This reverts commit d98ced1a9d641539d5bbb287bd16378ba3f5dba9.
---
 clang/include/clang/Driver/Multilib.h |  28 +---
 clang/lib/Driver/Multilib.cpp |  73 ++
 ...remetal-multilib-custom-flags-parsing.yaml | 133 --
 3 files changed, 11 insertions(+), 223 deletions(-)
 delete mode 100644 
clang/test/Driver/baremetal-multilib-custom-flags-parsing.yaml

diff --git a/clang/include/clang/Driver/Multilib.h 
b/clang/include/clang/Driver/Multilib.h
index 1dab45c062aeec..dbed70f4f9008f 100644
--- a/clang/include/clang/Driver/Multilib.h
+++ b/clang/include/clang/Driver/Multilib.h
@@ -101,25 +101,6 @@ class Multilib {
 
 raw_ostream &operator<<(raw_ostream &OS, const Multilib &M);
 
-namespace custom_flag {
-struct Declaration;
-using DeclarationPtr = std::shared_ptr;
-
-struct ValueDetail {
-  std::string Name;
-  std::optional> MacroDefines;
-  DeclarationPtr Decl;
-};
-
-struct Declaration {
-  std::string Name;
-  SmallVector ValueList;
-  std::optional DefaultValueIdx;
-};
-
-static constexpr StringRef Prefix = "-fmultilib-flag=";
-} // namespace custom_flag
-
 /// See also MultilibSetBuilder for combining multilibs into a set.
 class MultilibSet {
 public:
@@ -139,18 +120,15 @@ class MultilibSet {
 
 private:
   multilib_list Multilibs;
-  SmallVector FlagMatchers;
-  SmallVector CustomFlagDecls;
+  std::vector FlagMatchers;
   IncludeDirsFunc IncludeCallback;
   IncludeDirsFunc FilePathsCallback;
 
 public:
   MultilibSet() = default;
   MultilibSet(multilib_list &&Multilibs,
-  SmallVector &&FlagMatchers = {},
-  SmallVector &&CustomFlagDecls = {})
-  : Multilibs(std::move(Multilibs)), FlagMatchers(std::move(FlagMatchers)),
-CustomFlagDecls(std::move(CustomFlagDecls)) {}
+  std::vector &&FlagMatchers = {})
+  : Multilibs(Multilibs), FlagMatchers(FlagMatchers) {}
 
   const multilib_list &getMultilibs() { return Multilibs; }
 
diff --git a/clang/lib/Driver/Multilib.cpp b/clang/lib/Driver/Multilib.cpp
index b4b5dbd1bdb5e3..0207e0f2eb2ded 100644
--- a/clang/lib/Driver/Multilib.cpp
+++ b/clang/lib/Driver/Multilib.cpp
@@ -10,7 +10,6 @@
 #include "clang/Basic/LLVM.h"
 #include "clang/Driver/Driver.h"
 #include "llvm/ADT/DenseSet.h"
-#include "llvm/ADT/SmallSet.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Compiler.h"
 #include "llvm/Support/ErrorHandling.h"
@@ -202,20 +201,13 @@ struct MultilibGroupSerialization {
 
 struct MultilibSetSerialization {
   llvm::VersionTuple MultilibVersion;
-  SmallVector Groups;
-  SmallVector Multilibs;
-  SmallVector FlagMatchers;
-  SmallVector CustomFlagDeclarations;
+  std::vector Groups;
+  std::vector Multilibs;
+  std::vector FlagMatchers;
 };
 
 } // end anonymous namespace
 
-LLVM_YAML_IS_SEQUENCE_VECTOR(MultilibSerialization)
-LLVM_YAML_IS_SEQUENCE_VECTOR(MultilibGroupSerialization)
-LLVM_YAML_IS_SEQUENCE_VECTOR(MultilibSet::FlagMatcher)
-LLVM_YAML_IS_SEQUENCE_VECTOR(custom_flag::ValueDetail)
-LLVM_YAML_IS_SEQUENCE_VECTOR(custom_flag::DeclarationPtr)
-
 template <> struct llvm::yaml::MappingTraits {
   static void mapping(llvm::yaml::IO &io, MultilibSerialization &V) {
 io.mapOptional("Dir", V.Dir);
@@ -263,63 +255,11 @@ template <> struct 
llvm::yaml::MappingTraits {
   }
 };
 
-template <>
-struct llvm::yaml::MappingContextTraits> {
-  static void mapping(llvm::yaml::IO &io, custom_flag::ValueDetail &V,
-  llvm::SmallSet &) {
-io.mapRequired("Name", V.Name);
-io.mapOptional("MacroDefines", V.MacroDefines);
-  }
-  static std::string validate(IO &io, custom_flag::ValueDetail &V,
-  llvm::SmallSet &NameSet) {
-if (V.Name.empty())
-  return "custom flag value requires a name";
-if (!NameSet.insert(V.Name).second)
-  return "duplicate custom flag value name: \"" + V.Name + "\"";
-return {};
-  }
-};
-
-template <>
-struct llvm::yaml::MappingContextTraits> {
-  static void mapping(llvm::yaml::IO &io, custom_flag::DeclarationPtr &V,
-  llvm::SmallSet &NameSet) {
-assert(!V);
-V = std::make_shared();
-io.mapRequired("Name", V->Name);
-io.mapRequired("Values", V->ValueList, NameSet);
-std::string DefaultValueName;
-io.mapRequired("Default", DefaultValueName);
-
-for (auto [Idx, Value] : llvm::enumerate(V->ValueList)) {
-  Value.Decl = V;
-  if (Value.Name == DefaultValueName) {
-assert(!V->DefaultValueIdx);
-V->DefaultValueIdx = Idx;
-  }
-}
-  }
-  static std::string validate(IO &io, custom_flag:

[clang] Revert "[Multilib] Custom flags YAML parsing" (PR #122722)

2025-01-13 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang-driver

Author: Victor Campos (vhscampos)


Changes

Reverts llvm/llvm-project#110657

It seems that this patch is causing the sanitizer bot to fail. Reverting while 
I investigate

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


3 Files Affected:

- (modified) clang/include/clang/Driver/Multilib.h (+3-25) 
- (modified) clang/lib/Driver/Multilib.cpp (+8-65) 
- (removed) clang/test/Driver/baremetal-multilib-custom-flags-parsing.yaml 
(-133) 


``diff
diff --git a/clang/include/clang/Driver/Multilib.h 
b/clang/include/clang/Driver/Multilib.h
index 1dab45c062aeec..dbed70f4f9008f 100644
--- a/clang/include/clang/Driver/Multilib.h
+++ b/clang/include/clang/Driver/Multilib.h
@@ -101,25 +101,6 @@ class Multilib {
 
 raw_ostream &operator<<(raw_ostream &OS, const Multilib &M);
 
-namespace custom_flag {
-struct Declaration;
-using DeclarationPtr = std::shared_ptr;
-
-struct ValueDetail {
-  std::string Name;
-  std::optional> MacroDefines;
-  DeclarationPtr Decl;
-};
-
-struct Declaration {
-  std::string Name;
-  SmallVector ValueList;
-  std::optional DefaultValueIdx;
-};
-
-static constexpr StringRef Prefix = "-fmultilib-flag=";
-} // namespace custom_flag
-
 /// See also MultilibSetBuilder for combining multilibs into a set.
 class MultilibSet {
 public:
@@ -139,18 +120,15 @@ class MultilibSet {
 
 private:
   multilib_list Multilibs;
-  SmallVector FlagMatchers;
-  SmallVector CustomFlagDecls;
+  std::vector FlagMatchers;
   IncludeDirsFunc IncludeCallback;
   IncludeDirsFunc FilePathsCallback;
 
 public:
   MultilibSet() = default;
   MultilibSet(multilib_list &&Multilibs,
-  SmallVector &&FlagMatchers = {},
-  SmallVector &&CustomFlagDecls = {})
-  : Multilibs(std::move(Multilibs)), FlagMatchers(std::move(FlagMatchers)),
-CustomFlagDecls(std::move(CustomFlagDecls)) {}
+  std::vector &&FlagMatchers = {})
+  : Multilibs(Multilibs), FlagMatchers(FlagMatchers) {}
 
   const multilib_list &getMultilibs() { return Multilibs; }
 
diff --git a/clang/lib/Driver/Multilib.cpp b/clang/lib/Driver/Multilib.cpp
index b4b5dbd1bdb5e3..0207e0f2eb2ded 100644
--- a/clang/lib/Driver/Multilib.cpp
+++ b/clang/lib/Driver/Multilib.cpp
@@ -10,7 +10,6 @@
 #include "clang/Basic/LLVM.h"
 #include "clang/Driver/Driver.h"
 #include "llvm/ADT/DenseSet.h"
-#include "llvm/ADT/SmallSet.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Compiler.h"
 #include "llvm/Support/ErrorHandling.h"
@@ -202,20 +201,13 @@ struct MultilibGroupSerialization {
 
 struct MultilibSetSerialization {
   llvm::VersionTuple MultilibVersion;
-  SmallVector Groups;
-  SmallVector Multilibs;
-  SmallVector FlagMatchers;
-  SmallVector CustomFlagDeclarations;
+  std::vector Groups;
+  std::vector Multilibs;
+  std::vector FlagMatchers;
 };
 
 } // end anonymous namespace
 
-LLVM_YAML_IS_SEQUENCE_VECTOR(MultilibSerialization)
-LLVM_YAML_IS_SEQUENCE_VECTOR(MultilibGroupSerialization)
-LLVM_YAML_IS_SEQUENCE_VECTOR(MultilibSet::FlagMatcher)
-LLVM_YAML_IS_SEQUENCE_VECTOR(custom_flag::ValueDetail)
-LLVM_YAML_IS_SEQUENCE_VECTOR(custom_flag::DeclarationPtr)
-
 template <> struct llvm::yaml::MappingTraits {
   static void mapping(llvm::yaml::IO &io, MultilibSerialization &V) {
 io.mapOptional("Dir", V.Dir);
@@ -263,63 +255,11 @@ template <> struct 
llvm::yaml::MappingTraits {
   }
 };
 
-template <>
-struct llvm::yaml::MappingContextTraits> {
-  static void mapping(llvm::yaml::IO &io, custom_flag::ValueDetail &V,
-  llvm::SmallSet &) {
-io.mapRequired("Name", V.Name);
-io.mapOptional("MacroDefines", V.MacroDefines);
-  }
-  static std::string validate(IO &io, custom_flag::ValueDetail &V,
-  llvm::SmallSet &NameSet) {
-if (V.Name.empty())
-  return "custom flag value requires a name";
-if (!NameSet.insert(V.Name).second)
-  return "duplicate custom flag value name: \"" + V.Name + "\"";
-return {};
-  }
-};
-
-template <>
-struct llvm::yaml::MappingContextTraits> {
-  static void mapping(llvm::yaml::IO &io, custom_flag::DeclarationPtr &V,
-  llvm::SmallSet &NameSet) {
-assert(!V);
-V = std::make_shared();
-io.mapRequired("Name", V->Name);
-io.mapRequired("Values", V->ValueList, NameSet);
-std::string DefaultValueName;
-io.mapRequired("Default", DefaultValueName);
-
-for (auto [Idx, Value] : llvm::enumerate(V->ValueList)) {
-  Value.Decl = V;
-  if (Value.Name == DefaultValueName) {
-assert(!V->DefaultValueIdx);
-V->DefaultValueIdx = Idx;
-  }
-}
-  }
-  static std::string validate(IO &io, custom_flag::DeclarationPtr &V,
-  llvm::SmallSet &) {
-if (V->Name.empty())
-  return "custom flag requires a name";
-if (V->ValueList.empty())
-  return "custom flag must have at least one value";
-if (!V->DefaultValueIdx)
-  return "custom flag m

[clang] 7378afd - Revert "[Multilib] Custom flags YAML parsing" (#122722)

2025-01-13 Thread via cfe-commits

Author: Victor Campos
Date: 2025-01-13T15:11:40Z
New Revision: 7378afd167860083eaaf0d8e411c91a28a6605d6

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

LOG: Revert "[Multilib] Custom flags YAML parsing" (#122722)

Reverts llvm/llvm-project#110657

It seems that this patch is causing the sanitizer bot to fail. Reverting
while I investigate

Added: 


Modified: 
clang/include/clang/Driver/Multilib.h
clang/lib/Driver/Multilib.cpp

Removed: 
clang/test/Driver/baremetal-multilib-custom-flags-parsing.yaml



diff  --git a/clang/include/clang/Driver/Multilib.h 
b/clang/include/clang/Driver/Multilib.h
index 1dab45c062aeec..dbed70f4f9008f 100644
--- a/clang/include/clang/Driver/Multilib.h
+++ b/clang/include/clang/Driver/Multilib.h
@@ -101,25 +101,6 @@ class Multilib {
 
 raw_ostream &operator<<(raw_ostream &OS, const Multilib &M);
 
-namespace custom_flag {
-struct Declaration;
-using DeclarationPtr = std::shared_ptr;
-
-struct ValueDetail {
-  std::string Name;
-  std::optional> MacroDefines;
-  DeclarationPtr Decl;
-};
-
-struct Declaration {
-  std::string Name;
-  SmallVector ValueList;
-  std::optional DefaultValueIdx;
-};
-
-static constexpr StringRef Prefix = "-fmultilib-flag=";
-} // namespace custom_flag
-
 /// See also MultilibSetBuilder for combining multilibs into a set.
 class MultilibSet {
 public:
@@ -139,18 +120,15 @@ class MultilibSet {
 
 private:
   multilib_list Multilibs;
-  SmallVector FlagMatchers;
-  SmallVector CustomFlagDecls;
+  std::vector FlagMatchers;
   IncludeDirsFunc IncludeCallback;
   IncludeDirsFunc FilePathsCallback;
 
 public:
   MultilibSet() = default;
   MultilibSet(multilib_list &&Multilibs,
-  SmallVector &&FlagMatchers = {},
-  SmallVector &&CustomFlagDecls = {})
-  : Multilibs(std::move(Multilibs)), FlagMatchers(std::move(FlagMatchers)),
-CustomFlagDecls(std::move(CustomFlagDecls)) {}
+  std::vector &&FlagMatchers = {})
+  : Multilibs(Multilibs), FlagMatchers(FlagMatchers) {}
 
   const multilib_list &getMultilibs() { return Multilibs; }
 

diff  --git a/clang/lib/Driver/Multilib.cpp b/clang/lib/Driver/Multilib.cpp
index b4b5dbd1bdb5e3..0207e0f2eb2ded 100644
--- a/clang/lib/Driver/Multilib.cpp
+++ b/clang/lib/Driver/Multilib.cpp
@@ -10,7 +10,6 @@
 #include "clang/Basic/LLVM.h"
 #include "clang/Driver/Driver.h"
 #include "llvm/ADT/DenseSet.h"
-#include "llvm/ADT/SmallSet.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Compiler.h"
 #include "llvm/Support/ErrorHandling.h"
@@ -202,20 +201,13 @@ struct MultilibGroupSerialization {
 
 struct MultilibSetSerialization {
   llvm::VersionTuple MultilibVersion;
-  SmallVector Groups;
-  SmallVector Multilibs;
-  SmallVector FlagMatchers;
-  SmallVector CustomFlagDeclarations;
+  std::vector Groups;
+  std::vector Multilibs;
+  std::vector FlagMatchers;
 };
 
 } // end anonymous namespace
 
-LLVM_YAML_IS_SEQUENCE_VECTOR(MultilibSerialization)
-LLVM_YAML_IS_SEQUENCE_VECTOR(MultilibGroupSerialization)
-LLVM_YAML_IS_SEQUENCE_VECTOR(MultilibSet::FlagMatcher)
-LLVM_YAML_IS_SEQUENCE_VECTOR(custom_flag::ValueDetail)
-LLVM_YAML_IS_SEQUENCE_VECTOR(custom_flag::DeclarationPtr)
-
 template <> struct llvm::yaml::MappingTraits {
   static void mapping(llvm::yaml::IO &io, MultilibSerialization &V) {
 io.mapOptional("Dir", V.Dir);
@@ -263,63 +255,11 @@ template <> struct 
llvm::yaml::MappingTraits {
   }
 };
 
-template <>
-struct llvm::yaml::MappingContextTraits> {
-  static void mapping(llvm::yaml::IO &io, custom_flag::ValueDetail &V,
-  llvm::SmallSet &) {
-io.mapRequired("Name", V.Name);
-io.mapOptional("MacroDefines", V.MacroDefines);
-  }
-  static std::string validate(IO &io, custom_flag::ValueDetail &V,
-  llvm::SmallSet &NameSet) {
-if (V.Name.empty())
-  return "custom flag value requires a name";
-if (!NameSet.insert(V.Name).second)
-  return "duplicate custom flag value name: \"" + V.Name + "\"";
-return {};
-  }
-};
-
-template <>
-struct llvm::yaml::MappingContextTraits> {
-  static void mapping(llvm::yaml::IO &io, custom_flag::DeclarationPtr &V,
-  llvm::SmallSet &NameSet) {
-assert(!V);
-V = std::make_shared();
-io.mapRequired("Name", V->Name);
-io.mapRequired("Values", V->ValueList, NameSet);
-std::string DefaultValueName;
-io.mapRequired("Default", DefaultValueName);
-
-for (auto [Idx, Value] : llvm::enumerate(V->ValueList)) {
-  Value.Decl = V;
-  if (Value.Name == DefaultValueName) {
-assert(!V->DefaultValueIdx);
-V->DefaultValueIdx = Idx;
-  }
-}
-  }
-  static std::string validate(IO &io, custom_flag::DeclarationPtr &V,
-  llvm::SmallSet &) {

[clang] Revert "[Multilib] Custom flags YAML parsing" (PR #122722)

2025-01-13 Thread Victor Campos via cfe-commits

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


[clang] [llvm] [Clang] restrict use of attribute names reserved by the C++ standard (PR #106036)

2025-01-13 Thread Erich Keane via cfe-commits

erichkeane wrote:

> Oh, I see, you're suggesting we remove the `getStdNamespace` check from this 
> PR. Yeah, I think that's reasonable.

Yep, that is my suggestion, sorry I was insufficiently clear.

> But I'd somewhat question whether this PR and warning really has anything to 
> do with the attribute names being "reserved" at that point -- we're not 
> checking whether they're reserved or not, and it really doesn't matter. 
> Warning on a `#define` that clobbers the name of a standard attribute is just 
> generally a good thing to do, regardless of whether you're using the standard 
> library.

I agree with this 100%.  The link to the 'reserved by the standard' is I think 
a good additional justification.

I think the proposal, complaining about these as reserved, is a good idea/good 
patch.  BUT I think getting caught up in the "well, when is it technically NOT 
UB" is a waste of time, given that the warning is a good idea even without that 
justification.

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


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

2025-01-13 Thread Chuanqi Xu via cfe-commits

ChuanqiXu9 wrote:

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



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


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

2025-01-13 Thread Chuanqi Xu via cfe-commits

ChuanqiXu9 wrote:

> Should this be backported to older supported releases as well? (FWIW, I think 
> so.)

But I am not sure if there is still release there.

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


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

2025-01-13 Thread via cfe-commits

llvmbot wrote:

/pull-request llvm/llvm-project#122844

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


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

2025-01-13 Thread Chuanqi Xu via cfe-commits

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


[clang] [llvm] [Clang] restrict use of attribute names reserved by the C++ standard (PR #106036)

2025-01-13 Thread Richard Smith via cfe-commits

zygoloid wrote:

Oh, I see, you're suggesting we remove the `getStdNamespace` check from this 
PR. Yeah, I think that's reasonable.

But I'd somewhat question whether this PR and warning really has anything to do 
with the attribute names being "reserved" at that point -- we're not checking 
whether they're reserved or not, and it really doesn't matter. Warning on a 
`#define` that clobbers the name of a standard attribute is just generally a 
good thing to do, regardless of whether you're using the standard library.

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


[clang] [llvm] [HLSL][SPIRV][DXIL] Implement `WaveActiveSum` intrinsic (PR #118580)

2025-01-13 Thread Steven Perron via cfe-commits

https://github.com/s-perron approved this pull request.


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


[clang] [PAC] Re-sign a pointer to a noexcept member function when it is converted to a pointer to a member function without noexcept (PR #109056)

2025-01-13 Thread Akira Hatanaka via cfe-commits

ahatanak wrote:

This change isn't needed anymore as it was decided that `noexcept` shouldn't be 
used to compute discriminators of function and member function pointers (see 
https://github.com/llvm/llvm-project/issues/106487#issuecomment-2440364300).

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


[clang] [clang-tools-extra] [NFC] Add implicit cast kinds for function pointer conversions (PR #110048)

2025-01-13 Thread Akira Hatanaka via cfe-commits

ahatanak wrote:

This change isn't needed anymore as it was decided that noexcept shouldn't be 
used to compute discriminators of function and member function pointers (see 
https://github.com/llvm/llvm-project/issues/106487#issuecomment-2440364300).

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


[clang] [Sema] Note member decl when initializer list default constructs member (PR #121854)

2025-01-13 Thread Brian Foley via cfe-commits

https://github.com/bpfoley updated 
https://github.com/llvm/llvm-project/pull/121854

>From 10acf5fd8346d872e5f3110c03cea944f9062375 Mon Sep 17 00:00:00 2001
From: Brian Foley 
Date: Thu, 5 Dec 2024 14:35:25 -0800
Subject: [PATCH] [Sema] Note member decl when initializer list default
 constructs member

Recently I had a scenario where I had:
1. A class C with many members m_1...m_n of the same type T
2. T's default constructor was deleted
3. I accidentally omitted an explicitly constructed member in the
   initializer list C() : m_1(foo), m_2(bar), ... { }

Clang told me that T's default constructor was deleted, and told
me that the call to T() was in C() (which it implicitly was), but
didn't tell me which member was being default constructed.

It was difficult to fix this problem because I had no easy way to
list all the members of type T in C and C's superclasses which
would have let me find which member was missing,

clang/test/CXX/class/class.init/p1.cpp is a simplified version
of this problem (a2 is missing from the initializer list of B)
---
 clang/docs/ReleaseNotes.rst  |  5 +
 clang/include/clang/Basic/DiagnosticSemaKinds.td |  2 ++
 clang/lib/Sema/SemaInit.cpp  | 11 +++
 clang/test/CXX/class/class.init/p1.cpp   | 14 ++
 clang/test/CXX/dcl.decl/dcl.init/p14-0x.cpp  |  2 +-
 clang/test/SemaCUDA/inherited-ctor.cu|  2 +-
 6 files changed, 34 insertions(+), 2 deletions(-)
 create mode 100644 clang/test/CXX/class/class.init/p1.cpp

diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 9eeb872aa57d79..202aa5f37f18e4 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -788,6 +788,11 @@ Improvements to Clang's diagnostics
   require(scope); // Warning!  Requires mu1.
 }
 
+- Improve the diagnostics for deleted default constructor errors for C++ class
+  initializer lists that don't explicitly list a class member and thus attempt
+  to implicitly default construct that member.
+
+
 Improvements to Clang's time-trace
 --
 
diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td 
b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index 8be4f946dce1cc..9e1bda19e93074 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -6081,6 +6081,8 @@ def note_deleted_special_member_class_subobject : Note<
   "destructor}5"
   "%select{||s||}4"
   "|is an ObjC pointer}6">;
+def note_default_constructed_field
+: Note<"default constructed field %0 declared here">;
 def note_deleted_default_ctor_uninit_field : Note<
   "%select{default constructor of|constructor inherited by}0 "
   "%1 is implicitly deleted because field %2 of "
diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp
index 0dd5f468cf60bf..184c88cceb6fa8 100644
--- a/clang/lib/Sema/SemaInit.cpp
+++ b/clang/lib/Sema/SemaInit.cpp
@@ -9088,6 +9088,17 @@ bool InitializationSequence::Diagnose(Sema &S,
   << (Msg ? Msg->getString() : StringRef()) << ArgsRange;
 }
 
+// If it's a default constructed member, but it's not in the
+// constructor's initializer list, explicitly note where the member is
+// declared so the user can see which member is erroneously initialized
+// with a deleted default constructor.
+if (Kind.getKind() == InitializationKind::IK_Default &&
+(Entity.getKind() == InitializedEntity::EK_Member ||
+ Entity.getKind() == InitializedEntity::EK_ParenAggInitMember)) {
+  S.Diag(Entity.getDecl()->getLocation(),
+ diag::note_default_constructed_field)
+  << Entity.getDecl();
+}
 S.NoteDeletedFunction(Best->Function);
 break;
   }
diff --git a/clang/test/CXX/class/class.init/p1.cpp 
b/clang/test/CXX/class/class.init/p1.cpp
new file mode 100644
index 00..717dfba89763a7
--- /dev/null
+++ b/clang/test/CXX/class/class.init/p1.cpp
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+namespace test_deleted_ctor_note {
+struct A {
+  int a;
+  A() = delete; // expected-note {{'A' has been explicitly marked deleted 
here}}
+  A(int a_) : a(a_) { }
+};
+
+struct B {
+  A a1, a2, a3; // expected-note {{default constructed field 'a2' declared 
here}}
+  B(int a_) : a1(a_), a3(a_) { } // expected-error{{call to deleted 
constructor of 'A'}}
+};
+}
diff --git a/clang/test/CXX/dcl.decl/dcl.init/p14-0x.cpp 
b/clang/test/CXX/dcl.decl/dcl.init/p14-0x.cpp
index e7f501352168ce..d548f9c8c2fdf1 100644
--- a/clang/test/CXX/dcl.decl/dcl.init/p14-0x.cpp
+++ b/clang/test/CXX/dcl.decl/dcl.init/p14-0x.cpp
@@ -27,7 +27,7 @@ class Friend {
 
 
 class S {
-  NoDefault nd1;
+  NoDefault nd1; // expected-note {{default constructed field 'nd1' declared 
here}}
   NoDefault nd2 = 42;
   Explicit e1; // expected-note {{here}}
   Explicit e2 = 42; // expecte

[clang] [Sema] Note member decl when initializer list default constructs member (PR #121854)

2025-01-13 Thread Brian Foley via cfe-commits

https://github.com/bpfoley updated 
https://github.com/llvm/llvm-project/pull/121854

>From 72ffbe4ef6b4f8fe6fa31fef7fd3f5c961495c9f Mon Sep 17 00:00:00 2001
From: Brian Foley 
Date: Thu, 5 Dec 2024 14:35:25 -0800
Subject: [PATCH] [Sema] Note member decl when initializer list default
 constructs member

Recently I had a scenario where I had:
1. A class C with many members m_1...m_n of the same type T
2. T's default constructor was deleted
3. I accidentally omitted an explicitly constructed member in the
   initializer list C() : m_1(foo), m_2(bar), ... { }

Clang told me that T's default constructor was deleted, and told
me that the call to T() was in C() (which it implicitly was), but
didn't tell me which member was being default constructed.

It was difficult to fix this problem because I had no easy way to
list all the members of type T in C and C's superclasses which
would have let me find which member was missing,

clang/test/CXX/class/class.init/p1.cpp is a simplified version
of this problem (a2 is missing from the initializer list of B)
---
 clang/include/clang/Basic/DiagnosticSemaKinds.td |  2 ++
 clang/lib/Sema/SemaInit.cpp  | 11 +++
 clang/test/CXX/class/class.init/p1.cpp   | 14 ++
 clang/test/CXX/dcl.decl/dcl.init/p14-0x.cpp  |  2 +-
 clang/test/SemaCUDA/inherited-ctor.cu|  2 +-
 5 files changed, 29 insertions(+), 2 deletions(-)
 create mode 100644 clang/test/CXX/class/class.init/p1.cpp

diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td 
b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index 03fb7ca9bc3c3b..e98ad631b6d6ab 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -6069,6 +6069,8 @@ def note_deleted_special_member_class_subobject : Note<
   "destructor}5"
   "%select{||s||}4"
   "|is an ObjC pointer}6">;
+def note_default_constructed_field
+: Note<"default constructed field %0 declared here">;
 def note_deleted_default_ctor_uninit_field : Note<
   "%select{default constructor of|constructor inherited by}0 "
   "%1 is implicitly deleted because field %2 of "
diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp
index 0dd5f468cf60bf..184c88cceb6fa8 100644
--- a/clang/lib/Sema/SemaInit.cpp
+++ b/clang/lib/Sema/SemaInit.cpp
@@ -9088,6 +9088,17 @@ bool InitializationSequence::Diagnose(Sema &S,
   << (Msg ? Msg->getString() : StringRef()) << ArgsRange;
 }
 
+// If it's a default constructed member, but it's not in the
+// constructor's initializer list, explicitly note where the member is
+// declared so the user can see which member is erroneously initialized
+// with a deleted default constructor.
+if (Kind.getKind() == InitializationKind::IK_Default &&
+(Entity.getKind() == InitializedEntity::EK_Member ||
+ Entity.getKind() == InitializedEntity::EK_ParenAggInitMember)) {
+  S.Diag(Entity.getDecl()->getLocation(),
+ diag::note_default_constructed_field)
+  << Entity.getDecl();
+}
 S.NoteDeletedFunction(Best->Function);
 break;
   }
diff --git a/clang/test/CXX/class/class.init/p1.cpp 
b/clang/test/CXX/class/class.init/p1.cpp
new file mode 100644
index 00..717dfba89763a7
--- /dev/null
+++ b/clang/test/CXX/class/class.init/p1.cpp
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+namespace test_deleted_ctor_note {
+struct A {
+  int a;
+  A() = delete; // expected-note {{'A' has been explicitly marked deleted 
here}}
+  A(int a_) : a(a_) { }
+};
+
+struct B {
+  A a1, a2, a3; // expected-note {{default constructed field 'a2' declared 
here}}
+  B(int a_) : a1(a_), a3(a_) { } // expected-error{{call to deleted 
constructor of 'A'}}
+};
+}
diff --git a/clang/test/CXX/dcl.decl/dcl.init/p14-0x.cpp 
b/clang/test/CXX/dcl.decl/dcl.init/p14-0x.cpp
index e7f501352168ce..d548f9c8c2fdf1 100644
--- a/clang/test/CXX/dcl.decl/dcl.init/p14-0x.cpp
+++ b/clang/test/CXX/dcl.decl/dcl.init/p14-0x.cpp
@@ -27,7 +27,7 @@ class Friend {
 
 
 class S {
-  NoDefault nd1;
+  NoDefault nd1; // expected-note {{default constructed field 'nd1' declared 
here}}
   NoDefault nd2 = 42;
   Explicit e1; // expected-note {{here}}
   Explicit e2 = 42; // expected-error {{no viable conversion}}
diff --git a/clang/test/SemaCUDA/inherited-ctor.cu 
b/clang/test/SemaCUDA/inherited-ctor.cu
index 8ac59e7b539f37..ef3938555b9834 100644
--- a/clang/test/SemaCUDA/inherited-ctor.cu
+++ b/clang/test/SemaCUDA/inherited-ctor.cu
@@ -81,7 +81,7 @@ namespace DefaultCtorInvalid {
   };
 
   struct C {
-struct B b;
+struct B b; // expected-note{{default constructed field 'b' declared here}}
 C() {} // expected-error{{call to implicitly-deleted default constructor 
of 'struct B'}}
// expected-note@-6{{default constructor of 'B' is implicitly 
deleted because field 's' has a deleted default co

[clang] [llvm] [sanitizer][NFCI] Add Options parameter to LowerAllowCheckPass (PR #122765)

2025-01-13 Thread Thurston Dang via cfe-commits


@@ -20,13 +20,22 @@
 
 namespace llvm {
 
+struct LowerAllowCheckOptions {
+  std::vector placeholder; // TODO: cutoffs

thurstond wrote:

Done

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


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

2025-01-13 Thread Ben Boeckel via cfe-commits

mathstuf wrote:

Should this be backported to older supported releases as well? (FWIW, I think 
so.)

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


[clang] [llvm] [sanitizer][NFCI] Add Options parameter to LowerAllowCheckPass (PR #122765)

2025-01-13 Thread Thurston Dang via cfe-commits

https://github.com/thurstond updated 
https://github.com/llvm/llvm-project/pull/122765

>From 6c244a083b458637f35149547270ba25675ca417 Mon Sep 17 00:00:00 2001
From: Thurston Dang 
Date: Mon, 13 Jan 2025 18:38:14 +
Subject: [PATCH 1/3] [sanitizer][NFCI] Add Options to LowerAllowCheckPass

This is glue code to convert LowerAllowCheckPass from a FUNCTION_PASS to 
FUNCTION_PASS_WITH_PARAMS. The parameters are currently unused.

Future work will plumb `-fsanitize-skip-hot-cutoff`
(introduced in https://github.com/llvm/llvm-project/pull/121619) to
LowerAllowCheckOptions.
---
 clang/lib/CodeGen/BackendUtil.cpp  |  5 +++--
 .../Instrumentation/LowerAllowCheckPass.h  |  9 +
 llvm/lib/Passes/PassBuilder.cpp| 14 ++
 llvm/lib/Passes/PassRegistry.def   |  5 -
 4 files changed, 30 insertions(+), 3 deletions(-)

diff --git a/clang/lib/CodeGen/BackendUtil.cpp 
b/clang/lib/CodeGen/BackendUtil.cpp
index 79e6bf3d24dffb..456c400c609b0d 100644
--- a/clang/lib/CodeGen/BackendUtil.cpp
+++ b/clang/lib/CodeGen/BackendUtil.cpp
@@ -795,11 +795,12 @@ static void addSanitizers(const Triple &TargetTriple,
   }
 
   if (LowerAllowCheckPass::IsRequested()) {
+LowerAllowCheckOptions Opts;
 // We want to call it after inline, which is about 
OptimizerEarlyEPCallback.
-PB.registerOptimizerEarlyEPCallback([](ModulePassManager &MPM,
+PB.registerOptimizerEarlyEPCallback([&Opts](ModulePassManager &MPM,
OptimizationLevel Level,
ThinOrFullLTOPhase Phase) {
-  MPM.addPass(createModuleToFunctionPassAdaptor(LowerAllowCheckPass()));
+  
MPM.addPass(createModuleToFunctionPassAdaptor(LowerAllowCheckPass(Opts)));
 });
   }
 }
diff --git a/llvm/include/llvm/Transforms/Instrumentation/LowerAllowCheckPass.h 
b/llvm/include/llvm/Transforms/Instrumentation/LowerAllowCheckPass.h
index af974818fec5f3..cd5204eaacc790 100644
--- a/llvm/include/llvm/Transforms/Instrumentation/LowerAllowCheckPass.h
+++ b/llvm/include/llvm/Transforms/Instrumentation/LowerAllowCheckPass.h
@@ -20,13 +20,22 @@
 
 namespace llvm {
 
+struct LowerAllowCheckOptions {
+   std::vector placeholder; // TODO: cutoffs
+};
+
 // This pass is responsible for removing optional traps, like llvm.ubsantrap
 // from the hot code.
 class LowerAllowCheckPass : public PassInfoMixin {
 public:
+  explicit LowerAllowCheckPass(LowerAllowCheckOptions Options)
+  : Options(Options){};
   PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 
   static bool IsRequested();
+
+private:
+  LowerAllowCheckOptions Options;
 };
 
 } // namespace llvm
diff --git a/llvm/lib/Passes/PassBuilder.cpp b/llvm/lib/Passes/PassBuilder.cpp
index f923d5aabe0a0e..0e43112207ef97 100644
--- a/llvm/lib/Passes/PassBuilder.cpp
+++ b/llvm/lib/Passes/PassBuilder.cpp
@@ -821,6 +821,20 @@ Expected 
parseEmbedBitcodePassOptions(StringRef Params) {
   return Result;
 }
 
+Expected parseLowerAllowCheckPassOptions(StringRef 
Params) {
+  LowerAllowCheckOptions Result;
+  while (!Params.empty()) {
+StringRef ParamName;
+std::tie(ParamName, Params) = Params.split(';');
+
+return make_error(
+formatv("invalid LowerAllowCheck pass parameter '{0}' ", ParamName)
+.str(),
+inconvertibleErrorCode());
+  }
+  return Result;
+}
+
 Expected parseMSanPassOptions(StringRef Params) {
   MemorySanitizerOptions Result;
   while (!Params.empty()) {
diff --git a/llvm/lib/Passes/PassRegistry.def b/llvm/lib/Passes/PassRegistry.def
index 1021d7fcd92474..7cbea023f2129f 100644
--- a/llvm/lib/Passes/PassRegistry.def
+++ b/llvm/lib/Passes/PassRegistry.def
@@ -402,7 +402,6 @@ FUNCTION_PASS("loop-load-elim", LoopLoadEliminationPass())
 FUNCTION_PASS("loop-simplify", LoopSimplifyPass())
 FUNCTION_PASS("loop-sink", LoopSinkPass())
 FUNCTION_PASS("loop-versioning", LoopVersioningPass())
-FUNCTION_PASS("lower-allow-check", LowerAllowCheckPass())
 FUNCTION_PASS("lower-atomic", LowerAtomicPass())
 FUNCTION_PASS("lower-constant-intrinsics", LowerConstantIntrinsicsPass())
 FUNCTION_PASS("lower-expect", LowerExpectIntrinsicPass())
@@ -553,6 +552,10 @@ FUNCTION_PASS_WITH_PARAMS(
 parseLoopVectorizeOptions,
 
"no-interleave-forced-only;interleave-forced-only;no-vectorize-forced-only;"
 "vectorize-forced-only")
+FUNCTION_PASS_WITH_PARAMS(
+"lower-allow-check", "LowerAllowCheckPass",
+[](LowerAllowCheckOptions Opts) { return LowerAllowCheckPass(Opts); },
+parseLowerAllowCheckPassOptions, "")
 FUNCTION_PASS_WITH_PARAMS(
 "lower-matrix-intrinsics", "LowerMatrixIntrinsicsPass",
 [](bool Minimal) { return LowerMatrixIntrinsicsPass(Minimal); },

>From 2938d91b99e9918406d2d7c24312571d20aa3c73 Mon Sep 17 00:00:00 2001
From: Thurston Dang 
Date: Mon, 13 Jan 2025 18:43:05 +
Subject: [PATCH 2/3] clang-format

---
 clang/lib/CodeGen/BackendUtil.cpp | 4 ++--
 .../llvm/Tran

[clang] [llvm] [X86] Extend kCFI with a 3-bit arity indicator (PR #121070)

2025-01-13 Thread Scott Constable via cfe-commits

scottconstable wrote:

> > maurer: I think their point is that even if you are not changing the hash 
> > scheme, you are proposing breaking compatibility of the identifier with 
> > existing code. Since we don't want to do this many times, if we are 
> > breaking compatibility with existing code, they would like to batch it with 
> > another breaking update so that it doesn't need to be done again.
> > (This isn't me reviewing this PR, just trying to clear up some confusion.)
> 
> This:) Thanks for the explanation.
> 
> After my pending lld/MachO change, kcfi will be the only user of the legacy 
> `xxHash64`. I want to remove `xxHash64` from llvm-project.

Going back to @maurer 's comment about compatibility, I do not believe that 
this PR would break any compatibility with other compilers, or with other 
compiler versions. If a kernel is built with some of its functions having the 
3-bit arity extension and the rest of its functions not having the 3-bit arity 
extension (e.g., because the user's clang compiler has the extension, and their 
rust compiler does not), then the kernel will behave the same as it would if 
all functions or no functions have the 3-bit arity extension. If the kernel is 
hot-patched with the register hardening scheme in 
https://lkml.org/lkml/2024/9/27/982, then only the functions that have the 
3-bit arity extension will benefit from the register hardening scheme.

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


[clang] [llvm] [sanitizer][NFCI] Add Options parameter to LowerAllowCheckPass (PR #122765)

2025-01-13 Thread Thurston Dang via cfe-commits


@@ -20,13 +20,22 @@
 
 namespace llvm {
 
+struct LowerAllowCheckOptions {

thurstond wrote:

Done

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


[clang] [clang] Do not allow unorderable features in [[gnu::target{,_clones}]] (PR #98426)

2025-01-13 Thread Dan Klishch via cfe-commits

https://github.com/DanShaders updated 
https://github.com/llvm/llvm-project/pull/98426

>From 723205411efe18dbe8bb154839525b59963b1638 Mon Sep 17 00:00:00 2001
From: Dan Klishch 
Date: Wed, 10 Jul 2024 23:39:42 -0400
Subject: [PATCH 1/2] [clang] Do not allow unorderable features in
 [[gnu::target{,_clones}]]

This partially addresses #98244.
---
 clang/lib/Sema/SemaDecl.cpp  |  4 +++-
 clang/lib/Sema/SemaDeclAttr.cpp  |  3 ++-
 clang/test/Sema/attr-target-clones.c |  3 +++
 clang/test/Sema/attr-target-mv.c | 14 ++
 clang/test/Sema/attr-target.c|  2 ++
 5 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 5b7275c316f74a..e03e66f23e9a1e 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -11108,7 +11108,9 @@ static bool CheckMultiVersionValue(Sema &S, const 
FunctionDecl *FD) {
   }
 
   if (!TargetInfo.validateCpuSupports(BareFeat) ||
-  !TargetInfo.isValidFeatureName(BareFeat)) {
+  !TargetInfo.isValidFeatureName(BareFeat) ||
+  (BareFeat != "default" &&
+   TargetInfo.multiVersionSortPriority(BareFeat) == 0)) {
 S.Diag(FD->getLocation(), diag::err_bad_multiversion_option)
 << Feature << BareFeat;
 return true;
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp
index bb4d33560b93b8..256188e65d8aaa 100644
--- a/clang/lib/Sema/SemaDeclAttr.cpp
+++ b/clang/lib/Sema/SemaDeclAttr.cpp
@@ -3289,7 +3289,8 @@ bool Sema::checkTargetClonesAttrString(
   } else if (Cur == "default") {
 DefaultIsDupe = HasDefault;
 HasDefault = true;
-  } else if (!Context.getTargetInfo().isValidFeatureName(Cur))
+  } else if (!Context.getTargetInfo().isValidFeatureName(Cur) ||
+ Context.getTargetInfo().multiVersionSortPriority(Cur) == 0)
 return Diag(CurLoc, diag::warn_unsupported_target_attribute)
<< Unsupported << None << Cur << TargetClones;
   if (llvm::is_contained(StringsBuffer, Cur) || DefaultIsDupe)
diff --git a/clang/test/Sema/attr-target-clones.c 
b/clang/test/Sema/attr-target-clones.c
index e287fce7699b77..4597ea54d02bfe 100644
--- a/clang/test/Sema/attr-target-clones.c
+++ b/clang/test/Sema/attr-target-clones.c
@@ -122,3 +122,6 @@ void good_overload5(int) 
__attribute__((target_clones("mmx", "sse4.2", "default"
 void good_isa_level(int) __attribute__((target_clones("default", 
"arch=x86-64", "arch=x86-64-v2", "arch=x86-64-v3", "arch=x86-64-v4")));
 // expected-warning@+1 {{unsupported CPU 'x86-64-v5' in the 'target_clones' 
attribute string; 'target_clones' attribute ignored}}
 void bad_isa_level(int) __attribute__((target_clones("default", 
"arch=x86-64-v5")));
+
+// expected-warning@+1 {{unsupported 'sha' in the 'target_clones' attribute 
string; 'target_clones' attribute ignored}}
+void bad_feature(void) __attribute__((target_clones("default", "sse4.2", 
"sha")));
diff --git a/clang/test/Sema/attr-target-mv.c b/clang/test/Sema/attr-target-mv.c
index 8218771275e1bd..ddb1d82b02f098 100644
--- a/clang/test/Sema/attr-target-mv.c
+++ b/clang/test/Sema/attr-target-mv.c
@@ -170,3 +170,17 @@ int __attribute__((__overloadable__)) 
__attribute__((target("arch=sandybridge"))
 
 int __attribute__((__overloadable__)) __attribute__((target("sse4.2"))) 
good_overload7(void);
 int __attribute__((target("arch=sandybridge"))) good_overload7(int);
+
+// expected-error@+2 {{function multiversioning doesn't support feature 'sha'}}
+// expected-note@+2 {{function multiversioning caused by this declaration}}
+int __attribute__((target("sha"))) no_priority1(void);
+int __attribute__((target("default"))) no_priority1(void);
+
+int __attribute__((target("default"))) no_priority2(void);
+// expected-error@+1 {{function multiversioning doesn't support feature 'sha'}}
+int __attribute__((target("sha"))) no_priority2(void);
+
+int __attribute__((target("default"))) no_priority3(void);
+int __attribute__((target("avx2"))) no_priority3(void);
+// expected-error@+1 {{function multiversioning doesn't support feature 'sha'}}
+int __attribute__((target("sha"))) no_priority3(void);
diff --git a/clang/test/Sema/attr-target.c b/clang/test/Sema/attr-target.c
index 5328f056507a71..65ece3c27d2990 100644
--- a/clang/test/Sema/attr-target.c
+++ b/clang/test/Sema/attr-target.c
@@ -33,6 +33,8 @@ void __attribute__((target("x86-64"))) baseline(void) {}
 //expected-warning@+1 {{unsupported 'x86-64-v2' in the 'target' attribute 
string}}
 void __attribute__((target("x86-64-v2"))) v2(void) {}
 
+int __attribute__((target("sha"))) good_target_but_not_for_fmv() { return 5; }
+
 #elifdef __aarch64__
 
 int __attribute__((target("sve,arch=armv8-a"))) foo(void) { return 4; }

>From 7378d6241f4e829a3b69af2ceb9a70c9c0bcc56a Mon Sep 17 00:00:00 2001
From: Dan Klishch 
Date: Mon, 13 Jan 2025 16:57:19 -0500
Subject: [PATCH 2/2] fixup after #116257

---
 clang/lib/Sema/SemaDecl.c

[clang] [Clang] disallow the use of asterisks preceding constructor and destructor names (PR #122621)

2025-01-13 Thread Oleksandr T. via cfe-commits

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

>From b2c656afdf99eff52d019b68fcbbc6ce4bbdd7d3 Mon Sep 17 00:00:00 2001
From: Oleksandr T 
Date: Sun, 12 Jan 2025 00:51:47 +0200
Subject: [PATCH 1/8] [Clang] disallow the use of asterisks preceding
 constructor and destructor names

---
 clang/docs/ReleaseNotes.rst  |  1 +
 clang/include/clang/Basic/DiagnosticSemaKinds.td |  4 
 clang/lib/Sema/SemaDeclCXX.cpp   | 13 +
 clang/test/SemaCXX/constructor.cpp   | 10 ++
 clang/test/SemaCXX/destructor.cpp|  7 +++
 5 files changed, 35 insertions(+)

diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 197b3692b8a181..9e5bbbf6dc055a 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -764,6 +764,7 @@ Improvements to Clang's diagnostics
   scope.Unlock();
   require(scope); // Warning!  Requires mu1.
 }
+- Clang now disallows the use of asterisks preceding constructor and 
destructor names (#GH121706).
 
 Improvements to Clang's time-trace
 --
diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td 
b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index d4e897868f1a9a..ec0be4ea8b6ce0 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -2202,6 +2202,8 @@ def err_invalid_qualified_constructor : Error<
   "'%0' qualifier is not allowed on a constructor">;
 def err_ref_qualifier_constructor : Error<
   "ref-qualifier '%select{&&|&}0' is not allowed on a constructor">;
+def err_invalid_constructor_decl : Error<
+  "invalid constructor declaration">;
 
 def err_constructor_return_type : Error<
   "constructor cannot have a return type">;
@@ -2223,6 +2225,8 @@ def err_destructor_not_member : Error<
 def err_destructor_cannot_be : Error<"destructor cannot be declared '%0'">;
 def err_invalid_qualified_destructor : Error<
   "'%0' qualifier is not allowed on a destructor">;
+def err_invalid_destructor_decl : Error<
+  "invalid destructor declaration">;
 def err_ref_qualifier_destructor : Error<
   "ref-qualifier '%select{&&|&}0' is not allowed on a destructor">;
 def err_destructor_return_type : Error<"destructor cannot have a return type">;
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index c4bee44f5ec048..bb6f6e14713d9b 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -10757,6 +10757,17 @@ static void checkMethodTypeQualifiers(Sema &S, 
Declarator &D, unsigned DiagID) {
   }
 }
 
+static void checkMethodPointerType(Sema &S, Declarator &D, unsigned DiagID) {
+  if (D.getNumTypeObjects() > 0) {
+DeclaratorChunk &Chunk = D.getTypeObject(D.getNumTypeObjects() - 1);
+if (Chunk.Kind == DeclaratorChunk::Pointer) {
+  SourceLocation PointerLoc = Chunk.getSourceRange().getBegin();
+  S.Diag(PointerLoc, DiagID) << Chunk.getSourceRange();
+  D.setInvalidType();
+}
+  }
+}
+
 QualType Sema::CheckConstructorDeclarator(Declarator &D, QualType R,
   StorageClass &SC) {
   bool isVirtual = D.getDeclSpec().isVirtualSpecified();
@@ -10792,6 +10803,7 @@ QualType Sema::CheckConstructorDeclarator(Declarator 
&D, QualType R,
   }
 
   checkMethodTypeQualifiers(*this, D, diag::err_invalid_qualified_constructor);
+  checkMethodPointerType(*this, D, diag::err_invalid_constructor_decl);
 
   // C++0x [class.ctor]p4:
   //   A constructor shall not be declared with a ref-qualifier.
@@ -10958,6 +10970,7 @@ QualType Sema::CheckDestructorDeclarator(Declarator &D, 
QualType R,
   }
 
   checkMethodTypeQualifiers(*this, D, diag::err_invalid_qualified_destructor);
+  checkMethodPointerType(*this, D, diag::err_invalid_destructor_decl);
 
   // C++0x [class.dtor]p2:
   //   A destructor shall not be declared with a ref-qualifier.
diff --git a/clang/test/SemaCXX/constructor.cpp 
b/clang/test/SemaCXX/constructor.cpp
index abd7dbe18a0e6a..c6df7be25c1fac 100644
--- a/clang/test/SemaCXX/constructor.cpp
+++ b/clang/test/SemaCXX/constructor.cpp
@@ -96,3 +96,13 @@ namespace PR38286 {
   template struct C; // expected-note {{non-type declaration found}}
   template C::~C() {} // expected-error {{identifier 'C' after 
'~' in destructor name does not name a type}}
 }
+
+namespace GH121706 {
+struct S {
+  *S();  // expected-error {{invalid constructor declaration}}
+  **S(); // expected-error {{invalid constructor declaration}}
+
+  **S(const S &); // expected-error {{invalid constructor declaration}}
+  *S(S &&);   // expected-error {{invalid constructor declaration}}
+};
+}
diff --git a/clang/test/SemaCXX/destructor.cpp 
b/clang/test/SemaCXX/destructor.cpp
index dfcd1b033af5a2..f188e95c25d174 100644
--- a/clang/test/SemaCXX/destructor.cpp
+++ b/clang/test/SemaCXX/destructor.cpp
@@ -586,4 +586,11 @@ struct Y : X {} y1{ }; // expected-error 

[clang] [llvm] [SPIRV] add pre legalization instruction combine (PR #122839)

2025-01-13 Thread Farzon Lotfi via cfe-commits


@@ -1,33 +1,44 @@
-; RUN: llc -O0 -mtriple=spirv-unknown-unknown %s -o - | FileCheck %s

farzonl wrote:

changed line endings from crlf to lf.

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


[clang] [PAC] Re-sign a pointer to a noexcept member function when it is converted to a pointer to a member function without noexcept (PR #109056)

2025-01-13 Thread Akira Hatanaka via cfe-commits

https://github.com/ahatanak closed 
https://github.com/llvm/llvm-project/pull/109056
___
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)

2025-01-13 Thread Congcong Cai via cfe-commits

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

LGTM, please update release note

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


[clang] [clang-tools-extra] [NFC] Add implicit cast kinds for function pointer conversions (PR #110048)

2025-01-13 Thread Akira Hatanaka via cfe-commits

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


[clang] [PAC] Re-sign a pointer to a noexcept member function when it is converted to a pointer to a member function without noexcept (PR #109056)

2025-01-13 Thread Akira Hatanaka via cfe-commits

ahatanak wrote:

I meant to close https://github.com/llvm/llvm-project/pull/110048.

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


[clang] [PAC] Re-sign a pointer to a noexcept member function when it is converted to a pointer to a member function without noexcept (PR #109056)

2025-01-13 Thread Akira Hatanaka via cfe-commits

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


[clang-tools-extra] [clang-tidy][clangd] Fixed removeFunctionArgs don't remove comma for use-ranges check (PR #118568)

2025-01-13 Thread Richard Li via cfe-commits

https://github.com/chomosuke updated 
https://github.com/llvm/llvm-project/pull/118568

>From b43a2602025bdacea06ced5171904fb5d765de9f Mon Sep 17 00:00:00 2001
From: chomosuke 
Date: Tue, 3 Dec 2024 07:10:33 +
Subject: [PATCH 1/3] fixed removeFunctionArgs don't remove comma

---
 .../clang-tidy/utils/UseRangesCheck.cpp   | 19 ++-
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/utils/UseRangesCheck.cpp 
b/clang-tools-extra/clang-tidy/utils/UseRangesCheck.cpp
index aba4d17ccd035e..88cba70b931d5d 100644
--- a/clang-tools-extra/clang-tidy/utils/UseRangesCheck.cpp
+++ b/clang-tools-extra/clang-tidy/utils/UseRangesCheck.cpp
@@ -28,6 +28,7 @@
 #include "llvm/ADT/Twine.h"
 #include "llvm/Support/raw_ostream.h"
 #include 
+#include 
 #include 
 #include 
 
@@ -173,21 +174,21 @@ static void removeFunctionArgs(DiagnosticBuilder &Diag, 
const CallExpr &Call,
   for (unsigned Index : Sorted) {
 const Expr *Arg = Call.getArg(Index);
 if (Commas[Index]) {
-  if (Index >= Commas.size()) {
-Diag << FixItHint::CreateRemoval(Arg->getSourceRange());
-  } else {
+  if (Index + 1 < Call.getNumArgs()) {
 // Remove the next comma
 Commas[Index + 1] = true;
+const Expr *NextArg = Call.getArg(Index + 1);
 Diag << FixItHint::CreateRemoval(CharSourceRange::getTokenRange(
-{Arg->getBeginLoc(),
- Lexer::getLocForEndOfToken(
- Arg->getEndLoc(), 0, Ctx.getSourceManager(), 
Ctx.getLangOpts())
- .getLocWithOffset(1)}));
+{Arg->getBeginLoc(), 
NextArg->getBeginLoc().getLocWithOffset(-1)}));
+  } else {
+Diag << FixItHint::CreateRemoval(Arg->getSourceRange());
   }
 } else {
-  Diag << FixItHint::CreateRemoval(CharSourceRange::getTokenRange(
-  Arg->getBeginLoc().getLocWithOffset(-1), Arg->getEndLoc()));
+  // At this point we know Index > 0 because `Commas[0] = true` earlier
   Commas[Index] = true;
+  const Expr *PrevArg = Call.getArg(Index - 1);
+  Diag << FixItHint::CreateRemoval(CharSourceRange::getTokenRange(
+  PrevArg->getEndLoc().getLocWithOffset(1), Arg->getEndLoc()));
 }
   }
 }

>From 644c8491e0fba203e89595827781d0c2c0609081 Mon Sep 17 00:00:00 2001
From: chomosuke 
Date: Mon, 23 Dec 2024 05:17:08 +1100
Subject: [PATCH 2/3] find , and remove only ,

---
 .../clang-tidy/utils/UseRangesCheck.cpp   | 49 +++
 1 file changed, 40 insertions(+), 9 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/utils/UseRangesCheck.cpp 
b/clang-tools-extra/clang-tidy/utils/UseRangesCheck.cpp
index 88cba70b931d5d..8b8e44a9898fdd 100644
--- a/clang-tools-extra/clang-tidy/utils/UseRangesCheck.cpp
+++ b/clang-tools-extra/clang-tidy/utils/UseRangesCheck.cpp
@@ -28,7 +28,6 @@
 #include "llvm/ADT/Twine.h"
 #include "llvm/Support/raw_ostream.h"
 #include 
-#include 
 #include 
 #include 
 
@@ -165,6 +164,33 @@ void UseRangesCheck::registerMatchers(MatchFinder *Finder) 
{
 static void removeFunctionArgs(DiagnosticBuilder &Diag, const CallExpr &Call,
ArrayRef Indexes,
const ASTContext &Ctx) {
+  auto GetCommaLoc =
+  [&](SourceLocation BeginLoc,
+  SourceLocation EndLoc) -> std::optional {
+auto Invalid = false;
+auto SourceText = Lexer::getSourceText(
+CharSourceRange::getCharRange({BeginLoc, EndLoc}),
+Ctx.getSourceManager(), Ctx.getLangOpts(), &Invalid);
+assert(!Invalid);
+
+size_t I = 0;
+while (I < SourceText.size() && SourceText[I] != ',') {
+  I++;
+}
+
+if (I < SourceText.size()) {
+  // also remove space after ,
+  size_t J = I + 1;
+  while (J < SourceText.size() && SourceText[J] == ' ') {
+J++;
+  }
+
+  return std::make_optional(CharSourceRange::getCharRange(
+  {BeginLoc.getLocWithOffset(I), BeginLoc.getLocWithOffset(J)}));
+}
+return std::nullopt;
+  };
+
   llvm::SmallVector Sorted(Indexes);
   llvm::sort(Sorted);
   // Keep track of commas removed
@@ -176,20 +202,25 @@ static void removeFunctionArgs(DiagnosticBuilder &Diag, 
const CallExpr &Call,
 if (Commas[Index]) {
   if (Index + 1 < Call.getNumArgs()) {
 // Remove the next comma
-Commas[Index + 1] = true;
 const Expr *NextArg = Call.getArg(Index + 1);
-Diag << FixItHint::CreateRemoval(CharSourceRange::getTokenRange(
-{Arg->getBeginLoc(), 
NextArg->getBeginLoc().getLocWithOffset(-1)}));
-  } else {
-Diag << FixItHint::CreateRemoval(Arg->getSourceRange());
+auto CommaLoc = GetCommaLoc(Arg->getEndLoc().getLocWithOffset(1),
+NextArg->getBeginLoc());
+if (CommaLoc) {
+  Commas[Index + 1] = true;
+  Diag << FixItHint::CreateRemoval(*CommaLoc);
+}
   }
 } else {
   // At this point we know Index > 0 becau

[clang-tools-extra] [clang-tidy][clangd] Fixed removeFunctionArgs don't remove comma for use-ranges check (PR #118568)

2025-01-13 Thread Richard Li via cfe-commits

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


[clang] clang/limits.h: Avoid including limits.h twice (PR #120526)

2025-01-13 Thread YunQiang Su via cfe-commits

wzssyqa wrote:

You are right. My patch only fix the first problem: making a unit test of glibc 
happy.
The failure test case of glibc is:
* check-local-headers

See: https://github.com/llvm/llvm-project/pull/120673 also.

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


[clang] [clang-format] Add BreakBeforeTemplateClose option (PR #118046)

2025-01-13 Thread Owen Pan via cfe-commits


@@ -2252,6 +2252,25 @@ struct FormatStyle {
   /// \version 16
   BreakBeforeInlineASMColonStyle BreakBeforeInlineASMColon;
 
+  /// If ``true``, a line break will be placed before the ``>`` in a multiline
+  /// template declaration.
+  /// \code
+  ///true:
+  ///template <
+  ///typename Foo,
+  ///typename Bar,
+  ///typename Baz
+  ///>
+  ///
+  ///false:
+  ///template <
+  ///typename Foo,
+  ///typename Bar,
+  ///typename Baz>

owenca wrote:

I was asking whether you intended to also break _after_ the `>`, effectively 
forcing it to be on its own line.

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


[clang] [CodeGen] Migrate away from PointerUnion::dyn_cast (NFC) (PR #122653)

2025-01-13 Thread Nikita Popov via cfe-commits

nikic wrote:

> Literal migration would result in dyn_cast_if_present (see the definition of 
> PointerUnion::dyn_cast), but this patch uses dyn_cast because we expect 
> Prototype.P to be nonnull.

This comment doesn't seem to match the PR :)

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


[clang] [AST] Migrate away from PointerUnion::dyn_cast (NFC) (PR #122651)

2025-01-13 Thread Nikita Popov via cfe-commits

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


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


[clang] [Analysis] Migrate away from PointerUnion::dyn_cast (NFC) (PR #122652)

2025-01-13 Thread Nikita Popov via cfe-commits

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


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


[clang] b270525 - [clang][ASTImporter] Not using primary context in lookup table (#118466)

2025-01-13 Thread via cfe-commits

Author: Balázs Kéri
Date: 2025-01-13T09:46:45+01:00
New Revision: b270525f730be6e7196667925f5a9bfa153262e9

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

LOG: [clang][ASTImporter] Not using primary context in lookup table (#118466)

`ASTImporterLookupTable` did use the `getPrimaryContext` function to get
the declaration context of the inserted items. This is problematic
because the primary context can change during import of AST items, most
likely if a definition of a previously not defined class is imported.
(For any record the primary context is the definition if there is one.)
The use of primary context is really not important, only for namespaces
because these can be re-opened and lookup in one namespace block is not
enough. This special search is now moved into ASTImporter instead of
relying on the lookup table.

Added: 


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

Removed: 




diff  --git a/clang/lib/AST/ASTImporter.cpp b/clang/lib/AST/ASTImporter.cpp
index 26d33b0d94795f..dec4c7221bc776 100644
--- a/clang/lib/AST/ASTImporter.cpp
+++ b/clang/lib/AST/ASTImporter.cpp
@@ -3165,6 +3165,7 @@ ExpectedDecl ASTNodeImporter::VisitRecordDecl(RecordDecl 
*D) {
 if (Error Err = ImportImplicitMethods(DCXX, FoundCXX))
   return std::move(Err);
 }
+// FIXME: We can return FoundDef here.
   }
   PrevDecl = FoundRecord->getMostRecentDecl();
   break;
@@ -9064,9 +9065,26 @@ ASTImporter::findDeclsInToCtx(DeclContext *DC, 
DeclarationName Name) {
   // We can diagnose this only if we search in the redecl context.
   DeclContext *ReDC = DC->getRedeclContext();
   if (SharedState->getLookupTable()) {
-ASTImporterLookupTable::LookupResult LookupResult =
-SharedState->getLookupTable()->lookup(ReDC, Name);
-return FoundDeclsTy(LookupResult.begin(), LookupResult.end());
+if (ReDC->isNamespace()) {
+  // Namespaces can be reopened.
+  // Lookup table does not handle this, we must search here in all linked
+  // namespaces.
+  FoundDeclsTy Result;
+  SmallVector NSChain =
+  getCanonicalForwardRedeclChain(
+  dyn_cast(ReDC));
+  for (auto *D : NSChain) {
+ASTImporterLookupTable::LookupResult LookupResult =
+SharedState->getLookupTable()->lookup(dyn_cast(D),
+  Name);
+Result.append(LookupResult.begin(), LookupResult.end());
+  }
+  return Result;
+} else {
+  ASTImporterLookupTable::LookupResult LookupResult =
+  SharedState->getLookupTable()->lookup(ReDC, Name);
+  return FoundDeclsTy(LookupResult.begin(), LookupResult.end());
+}
   } else {
 DeclContext::lookup_result NoloadLookupResult = ReDC->noload_lookup(Name);
 FoundDeclsTy Result(NoloadLookupResult.begin(), NoloadLookupResult.end());

diff  --git a/clang/lib/AST/ASTImporterLookupTable.cpp 
b/clang/lib/AST/ASTImporterLookupTable.cpp
index 07d39dcee2583a..4ed3198d7ea62b 100644
--- a/clang/lib/AST/ASTImporterLookupTable.cpp
+++ b/clang/lib/AST/ASTImporterLookupTable.cpp
@@ -115,8 +115,9 @@ void ASTImporterLookupTable::remove(DeclContext *DC, 
NamedDecl *ND) {
 #ifndef NDEBUG
   if (!EraseResult) {
 std::string Message =
-llvm::formatv("Trying to remove not contained Decl '{0}' of type {1}",
-  Name.getAsString(), DC->getDeclKindName())
+llvm::formatv(
+"Trying to remove not contained Decl '{0}' of type {1} from a {2}",
+Name.getAsString(), ND->getDeclKindName(), DC->getDeclKindName())
 .str();
 llvm_unreachable(Message.c_str());
   }
@@ -125,18 +126,18 @@ void ASTImporterLookupTable::remove(DeclContext *DC, 
NamedDecl *ND) {
 
 void ASTImporterLookupTable::add(NamedDecl *ND) {
   assert(ND);
-  DeclContext *DC = ND->getDeclContext()->getPrimaryContext();
+  DeclContext *DC = ND->getDeclContext();
   add(DC, ND);
-  DeclContext *ReDC = DC->getRedeclContext()->getPrimaryContext();
+  DeclContext *ReDC = DC->getRedeclContext();
   if (DC != ReDC)
 add(ReDC, ND);
 }
 
 void ASTImporterLookupTable::remove(NamedDecl *ND) {
   assert(ND);
-  DeclContext *DC = ND->getDeclContext()->getPrimaryContext();
+  DeclContext *DC = ND->getDeclContext();
   remove(DC, ND);
-  DeclContext *ReDC = DC->getRedeclContext()->getPrimaryContext();
+  DeclContext *ReDC = DC->getRedeclContext();
   if (DC != ReDC)
 remove(ReDC, ND);
 }
@@ -161,7 +162,7 @@ void ASTImporterLookupTable::updateForced(NamedDecl *ND, 
DeclContext *OldDC) {
 
 ASTImporterLookupTable::LookupResult
 ASTImporterLookupTable::lookup(DeclContext *DC, DeclarationName Nam

[clang] [clang][ASTImporter] Not using primary context in lookup table (PR #118466)

2025-01-13 Thread Balázs Kéri via cfe-commits

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


[clang] [clang-format] Add BreakBeforeTemplateClose option (PR #118046)

2025-01-13 Thread Owen Pan via cfe-commits

owenca wrote:

Why doesn't it break before the `>` for the example (a.cc) below?
```cpp
template 
class C {
  void f() {}
};
```
Command line:
```
clang-format -style='{BreakBeforeTemplateCloser: Multiline, ColumnLimit: 26}' 
a.cc
```

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


[clang] [clang-tools-extra] Remove `StringLiteral` in favor of `StringRef` (PR #122366)

2025-01-13 Thread James Henderson via cfe-commits

jh7370 wrote:

> > > Do we care about performance on MSVC ?
> > 
> > 
> > Just responding to this point (although I accept it's moot in the current 
> > context): yes we care about performance when building with MSVC - our 
> > downstream toolchain is hosted on Windows. I'm sure we're not the only 
> > Windows client either.
> 
> Do you not bootstrap with clang-cl after building with MSVC? I'd expect that 
> might help at least put you on the same performance tradeoffs as other users, 
> if not be outright better.

I believe so (I'm not involved with the details of the full build process, so 
not entirely sure how it all fits together), but it still impacts how long the 
bootstrap build would take, plus internal users (like myself) don't always do 
the 2 stage build, since we just want a working compiler. Anyway, I'm sure 
there are others out there who don't do the bootstrap build for one reason or 
another.

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


[clang] [llvm] [RISCV] Add Qualcomm uC Xqciint (Interrupts) extension (PR #122256)

2025-01-13 Thread via cfe-commits

https://github.com/hchandel updated 
https://github.com/llvm/llvm-project/pull/122256

>From 0ab75584047081661a858e96f5525e557ada69e6 Mon Sep 17 00:00:00 2001
From: Harsh Chandel 
Date: Wed, 8 Jan 2025 18:08:48 +0530
Subject: [PATCH 1/5] [RISCV] Add Qualcomm uC Xqciint (Interrupts) extension
 This extension adds eleven instructions to accelerate interrupt servicing.

The current spec can be found at:
https://github.com/quic/riscv-unified-db/releases/latest

This patch adds assembler only support.

Change-Id: Ic3381f98709e947a8dd8c9e40cfe6bb42c359f77
---
 .../Driver/print-supported-extensions-riscv.c |   1 +
 llvm/docs/RISCVUsage.rst  |   3 +
 llvm/docs/ReleaseNotes.md |   2 +
 .../Target/RISCV/AsmParser/RISCVAsmParser.cpp |   3 +
 .../RISCV/Disassembler/RISCVDisassembler.cpp  |   4 +
 .../Target/RISCV/MCTargetDesc/RISCVBaseInfo.h |   1 +
 llvm/lib/Target/RISCV/RISCVFeatures.td|   8 ++
 llvm/lib/Target/RISCV/RISCVInstrInfoXqci.td   |  62 +++
 llvm/lib/TargetParser/RISCVISAInfo.cpp|   4 +-
 llvm/test/CodeGen/RISCV/attributes.ll |   2 +
 llvm/test/MC/RISCV/xqciint-invalid.s  | 105 ++
 llvm/test/MC/RISCV/xqciint-valid.s|  81 ++
 .../TargetParser/RISCVISAInfoTest.cpp |   3 +-
 13 files changed, 276 insertions(+), 3 deletions(-)
 create mode 100644 llvm/test/MC/RISCV/xqciint-invalid.s
 create mode 100644 llvm/test/MC/RISCV/xqciint-valid.s

diff --git a/clang/test/Driver/print-supported-extensions-riscv.c 
b/clang/test/Driver/print-supported-extensions-riscv.c
index a8d9fcd8569cfb..b28e0a07dad241 100644
--- a/clang/test/Driver/print-supported-extensions-riscv.c
+++ b/clang/test/Driver/print-supported-extensions-riscv.c
@@ -196,6 +196,7 @@
 // CHECK-NEXT: xqcicm   0.2   'Xqcicm' (Qualcomm uC 
Conditional Move Extension)
 // CHECK-NEXT: xqcics   0.2   'Xqcics' (Qualcomm uC 
Conditional Select Extension)
 // CHECK-NEXT: xqcicsr  0.2   'Xqcicsr' (Qualcomm uC CSR 
Extension)
+// CHECK-NEXT: xqciint  0.2   'Xqciint' (Qualcomm uC 
Interrupts Extension)
 // CHECK-NEXT: xqcilsm  0.2   'Xqcilsm' (Qualcomm uC Load 
Store Multiple Extension)
 // CHECK-NEXT: xqcisls  0.2   'Xqcisls' (Qualcomm uC 
Scaled Load Store Extension)
 // CHECK-EMPTY:
diff --git a/llvm/docs/RISCVUsage.rst b/llvm/docs/RISCVUsage.rst
index 0dc63f34806b4c..a1df0f7d686e62 100644
--- a/llvm/docs/RISCVUsage.rst
+++ b/llvm/docs/RISCVUsage.rst
@@ -447,6 +447,9 @@ The current vendor extensions supported are:
 ``experimental-Xqcicsr``
   LLVM implements `version 0.2 of the Qualcomm uC CSR extension specification 
`__ by Qualcomm.  All 
instructions are prefixed with `qc.` as described in the specification. These 
instructions are only available for riscv32.
 
+``experimental-Xqciint``
+  LLVM implements `version 0.2 of the Qualcomm uC Interrupts extension 
specification `__ by 
Qualcomm.  All instructions are prefixed with `qc.` as described in the 
specification. These instructions are only available for riscv32.
+
 ``experimental-Xqcilsm``
   LLVM implements `version 0.2 of the Qualcomm uC Load Store Multiple 
extension specification 
`__ by Qualcomm.  All 
instructions are prefixed with `qc.` as described in the specification. These 
instructions are only available for riscv32.
 
diff --git a/llvm/docs/ReleaseNotes.md b/llvm/docs/ReleaseNotes.md
index 159bd5cea973f8..22ef03427963af 100644
--- a/llvm/docs/ReleaseNotes.md
+++ b/llvm/docs/ReleaseNotes.md
@@ -234,6 +234,8 @@ Changes to the RISC-V Backend
   extension.
 * Adds experimental assembler support for the Qualcomm uC 'Xqcicm` (Conditonal 
Move)
   extension.
+* Adds experimental assembler support for the Qualcomm uC 'Xqciint` 
(Interrupts)
+  extension.
 * Added ``Sdext`` and ``Sdtrig`` extensions.
 
 Changes to the WebAssembly Backend
diff --git a/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp 
b/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
index 2205c67c2d21ba..8177280044bf44 100644
--- a/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
+++ b/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
@@ -717,6 +717,7 @@ struct RISCVOperand final : public MCParsedAsmOperand {
   bool isUImm6() const { return IsUImm<6>(); }
   bool isUImm7() const { return IsUImm<7>(); }
   bool isUImm8() const { return IsUImm<8>(); }
+  bool isUImm10() const { return IsUImm<10>(); }
   bool isUImm11() const { return IsUImm<11>(); }
   bool isUImm16() const { return IsUImm<16>(); }
   bool isUImm20() const { return IsUImm<20>(); }
@@ -1590,6 +1591,8 @@ bool RISCVAsmParser::matchAndEmitInstruction(SMLoc IDLoc, 
unsigned &Opcode,
 return generateImmOutOfRangeError(
 Operands, ErrorInfo, -(1 <

[clang] [clang][ASTImporter] Not using primary context in lookup table (PR #118466)

2025-01-13 Thread LLVM Continuous Integration via cfe-commits
=?utf-8?q?Balázs_Kéri?= 
Message-ID:
In-Reply-To: 


llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder 
`openmp-offload-libc-amdgpu-runtime` running on `omp-vega20-1` while building 
`clang` at step 7 "Add check check-offload".

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


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

```
Step 7 (Add check check-offload) failure: test (failure)
 TEST 'libomptarget :: amdgcn-amd-amdhsa :: 
offloading/pgo1.c' FAILED 
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/./bin/clang 
-fopenmp-I 
/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.src/offload/test 
-I 
/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/openmp/runtime/src
 -L 
/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/offload
 -L /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/./lib -L 
/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/openmp/runtime/src
  -nogpulib 
-Wl,-rpath,/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/offload
 
-Wl,-rpath,/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/openmp/runtime/src
 
-Wl,-rpath,/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/./lib
  -fopenmp-targets=amdgcn-amd-amdhsa 
/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.src/offload/test/offloading/pgo1.c
 -o 
/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/offload/test/amdgcn-amd-amdhsa/offloading/Output/pgo1.c.tmp
 -Xoffload-linker -lc -Xoffload-linker -lm 
/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/./lib/libomptarget.devicertl.a
 -fprofile-instr-generate  -Xclang "-fprofile-instrument=clang"
# executed command: 
/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/./bin/clang 
-fopenmp -I 
/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.src/offload/test 
-I 
/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/openmp/runtime/src
 -L 
/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/offload
 -L /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/./lib -L 
/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/openmp/runtime/src
 -nogpulib 
-Wl,-rpath,/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/offload
 
-Wl,-rpath,/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/openmp/runtime/src
 
-Wl,-rpath,/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/./lib
 -fopenmp-targets=amdgcn-amd-amdhsa 
/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.src/offload/test/offloading/pgo1.c
 -o 
/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/offload/test/amdgcn-amd-amdhsa/offloading/Output/pgo1.c.tmp
 -Xoffload-linker -lc -Xoffload-linker -lm 
/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/./lib/libomptarget.devicertl.a
 -fprofile-instr-generate -Xclang -fprofile-instrument=clang
# RUN: at line 3
/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/offload/test/amdgcn-amd-amdhsa/offloading/Output/pgo1.c.tmp
 2>&1 | 
/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/./bin/FileCheck
 
/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.src/offload/test/offloading/pgo1.c
  --check-prefix="CLANG-PGO"
# executed command: 
/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/offload/test/amdgcn-amd-amdhsa/offloading/Output/pgo1.c.tmp
# executed command: 
/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/./bin/FileCheck
 
/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.src/offload/test/offloading/pgo1.c
 --check-prefix=CLANG-PGO
# .---command stderr
# | 
/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.src/offload/test/offloading/pgo1.c:32:20:
 error: CLANG-PGO-NEXT: expected string not found in input
# | // CLANG-PGO-NEXT: [ 0 11 20 ]
# |^
# | :3:28: note: scanning from here
# |  Counters =
# |^
# | :4:1: note: possible intended match here
# | [ 0 12 20 ]
# | ^
# | 
# | Input file: 
# | Check file: 
/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.src/offload/test/offloading/pgo1.c
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<
# |1: === GPU Profile === 
# |2: Target: amdgcn-amd-amdhsa 
#

[clang] [clang-format] Fix greatergreater (PR #122282)

2025-01-13 Thread via cfe-commits

https://github.com/andergnet updated 
https://github.com/llvm/llvm-project/pull/122282

>From e2780f01d47518bb61a5c01c9ad4d9daddb5044a Mon Sep 17 00:00:00 2001
From: W123011 
Date: Thu, 9 Jan 2025 15:04:26 +0100
Subject: [PATCH 1/4] Fix >> behavior on continuation intenter

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

diff --git a/clang/lib/Format/ContinuationIndenter.cpp 
b/clang/lib/Format/ContinuationIndenter.cpp
index 554b55fa75c926..5e5c93e2a5286f 100644
--- a/clang/lib/Format/ContinuationIndenter.cpp
+++ b/clang/lib/Format/ContinuationIndenter.cpp
@@ -147,7 +147,8 @@ static bool startsNextOperand(const FormatToken &Current) {
 // Returns \c true if \c Current is a binary operation that must break.
 static bool mustBreakBinaryOperation(const FormatToken &Current,
  const FormatStyle &Style) {
-  return Style.BreakBinaryOperations != FormatStyle::BBO_Never &&
+  return Current.CanBreakBefore &&
+ Style.BreakBinaryOperations != FormatStyle::BBO_Never &&
  (Style.BreakBeforeBinaryOperators == FormatStyle::BOS_None
   ? startsNextOperand
   : isAlignableBinaryOperator)(Current);

>From 4a5a1368b8a2ae577cb6e142022b563a3c77d583 Mon Sep 17 00:00:00 2001
From: W123011 
Date: Thu, 9 Jan 2025 15:47:08 +0100
Subject: [PATCH 2/4] Unit test

---
 clang/unittests/Format/FormatTest.cpp | 72 +++
 1 file changed, 41 insertions(+), 31 deletions(-)

diff --git a/clang/unittests/Format/FormatTest.cpp 
b/clang/unittests/Format/FormatTest.cpp
index 4d48bcacddead8..c9cf03bff6acce 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -22301,16 +22301,16 @@ TEST_F(FormatTest, HandlesUTF8BOM) {
 #if !defined(_MSC_VER)
 
 TEST_F(FormatTest, CountsUTF8CharactersProperly) {
-  verifyFormat("\"Однажды в студёную зимнюю пору...\"",
+  verifyFormat("\"Однажды в ѝтудёную зимнюю пору...\"",
getLLVMStyleWithColumns(35));
-  verifyFormat("\"一 二 三 四 五 六 七 八 九 十\"",
+  verifyFormat("\"一 二 三 四 五 六 七 八 九 坝\"",
getLLVMStyleWithColumns(31));
-  verifyFormat("// Однажды в студёную зимнюю пору...",
+  verifyFormat("// Однажды в ѝтудёную зимнюю пору...",
getLLVMStyleWithColumns(36));
-  verifyFormat("// 一 二 三 四 五 六 七 八 九 十", getLLVMStyleWithColumns(32));
-  verifyFormat("/* Однажды в студёную зимнюю пору... */",
+  verifyFormat("// 一 二 三 四 五 六 七 八 九 坝", getLLVMStyleWithColumns(32));
+  verifyFormat("/* Однажды в ѝтудёную зимнюю пору... */",
getLLVMStyleWithColumns(39));
-  verifyFormat("/* 一 二 三 四 五 六 七 八 九 十 */",
+  verifyFormat("/* 一 二 三 四 五 六 七 八 九 坝 */",
getLLVMStyleWithColumns(35));
 }
 
@@ -22329,18 +22329,18 @@ TEST_F(FormatTest, SplitsUTF8Strings) {
 format("\"aaaÄ\xc2\x8d\";", getLLVMStyleWithColumns(10)));
   // FIXME: unstable test case
   EXPECT_EQ("\"Однажды, в \"\n"
-"\"студёную \"\n"
+"\"ѝтудёную \"\n"
 "\"зимнюю \"\n"
 "\"пору,\"",
-format("\"Однажды, в студёную зимнюю пору,\"",
+format("\"Однажды, в ѝтудёную зимнюю пору,\"",
getLLVMStyleWithColumns(13)));
   // FIXME: unstable test case
   EXPECT_EQ(
   "\"一 二 三 \"\n"
   "\"四 五六 \"\n"
   "\"七 八 九 \"\n"
-  "\"十\"",
-  format("\"一 二 三 四 五六 七 八 九 十\"", getLLVMStyleWithColumns(11)));
+  "\"坝\"",
+  format("\"一 二 三 四 五六 七 八 九 坝\"", getLLVMStyleWithColumns(11)));
   // FIXME: unstable test case
   EXPECT_EQ("\"一\t\"\n"
 "\"二 \t\"\n"
@@ -22348,8 +22348,8 @@ TEST_F(FormatTest, SplitsUTF8Strings) {
 "\"五\t\"\n"
 "\"六 \t\"\n"
 "\"七 \"\n"
-"\"八九十\tqq\"",
-format("\"一\t二 \t三 四 五\t六 \t七 八九十\tqq\"",
+"\"八九坝\tqq\"",
+format("\"一\t二 \t三 四 五\t六 \t七 八九坝\tqq\"",
getLLVMStyleWithColumns(11)));
 
   // UTF8 character in an escape sequence.
@@ -22362,44 +22362,44 @@ TEST_F(FormatTest, SplitsUTF8Strings) {
 TEST_F(FormatTest, HandlesDoubleWidthCharsInMultiLineStrings) {
   verifyFormat("const char *s =\n"
"\"一二三四五六七八\\\n"
-   " 九 十\";",
+   " 九 坝\";",
"const char *s = \"一二三四五六七八\\\n"
-   " 九 十\";",
+   " 九 坝\";",
getLLVMStyleWithColumns(30));
 }
 
 TEST_F(FormatTest, SplitsUTF8LineComments) {
   verifyFormat("// Ä\xc2\x8d", getLLVMStyleWithColumns(10));
-  verifyFormat("// Я из лесу\n"
+  verifyFormat("// Я из леѝу\n"
"// вышел; был\n"
-   "// сильный\n"
+   "// ѝильный\n"
"// мороз.",
-   "// Я из лесу вышел; был сильный мороз.",
+   "// Я из леѝу вышел; был ѝильный мороз.",
getLLVMStyleWithColumns(13));
   verifyFormat("// 一二三\n"
"// 四五六七\n"

[clang] Fixed some warn-override tests in SemaCXX (PR #122680)

2025-01-13 Thread via cfe-commits

https://github.com/2LoS updated https://github.com/llvm/llvm-project/pull/122680

>From 3109461716e5e78b23bea7a2eb6aac3d34348612 Mon Sep 17 00:00:00 2001
From: LoS 
Date: Mon, 13 Jan 2025 11:21:46 +0100
Subject: [PATCH 1/2] Fixed some warn-override tests in SemaCXX

---
 ...e => warn-inconsistent-missing-destructor-override.cpp} | 0
 ...uctor-override => warn-suggest-destructor-override.cpp} | 0
 .../{warn-suggest-override => warn-suggest-override.cpp}   | 7 ---
 3 files changed, 4 insertions(+), 3 deletions(-)
 rename clang/test/SemaCXX/{warn-inconsistent-missing-destructor-override => 
warn-inconsistent-missing-destructor-override.cpp} (100%)
 rename clang/test/SemaCXX/{warn-suggest-destructor-override => 
warn-suggest-destructor-override.cpp} (100%)
 rename clang/test/SemaCXX/{warn-suggest-override => warn-suggest-override.cpp} 
(58%)

diff --git a/clang/test/SemaCXX/warn-inconsistent-missing-destructor-override 
b/clang/test/SemaCXX/warn-inconsistent-missing-destructor-override.cpp
similarity index 100%
rename from clang/test/SemaCXX/warn-inconsistent-missing-destructor-override
rename to clang/test/SemaCXX/warn-inconsistent-missing-destructor-override.cpp
diff --git a/clang/test/SemaCXX/warn-suggest-destructor-override 
b/clang/test/SemaCXX/warn-suggest-destructor-override.cpp
similarity index 100%
rename from clang/test/SemaCXX/warn-suggest-destructor-override
rename to clang/test/SemaCXX/warn-suggest-destructor-override.cpp
diff --git a/clang/test/SemaCXX/warn-suggest-override 
b/clang/test/SemaCXX/warn-suggest-override.cpp
similarity index 58%
rename from clang/test/SemaCXX/warn-suggest-override
rename to clang/test/SemaCXX/warn-suggest-override.cpp
index e06c939ff001fc..436a17d489693c 100644
--- a/clang/test/SemaCXX/warn-suggest-override
+++ b/clang/test/SemaCXX/warn-suggest-override.cpp
@@ -17,13 +17,13 @@ struct C {
 
 struct D : public C {
   void run();
-  // expected-warning@-1 {{'run()' overrides a member function but is not 
marked 'override'}}
+  // expected-warning@-1 {{'run' overrides a member function but is not marked 
'override'}}
   ~D();
 };
 
 struct E : public C {
   virtual void run();
-  // expected-warning@-1 {{'run()' overrides a member function but is not 
marked 'override'}}
+  // expected-warning@-1 {{'run' overrides a member function but is not marked 
'override'}}
   virtual ~E();
 };
 
@@ -32,7 +32,8 @@ struct F : public C {
   ~F() override;
 };
 
-struct G : public C {
+struct G : public C { // expected-note {{mark 'G' as 'final'}}
   void run() final;
   ~G() final;
+  // expected-warning@-1 {{class with destructor marked as 'final' can not be 
inherited from}}
 };

>From b9ef67561e235aa7d44b8cac3c46a001a08cbc75 Mon Sep 17 00:00:00 2001
From: LoS 
Date: Mon, 13 Jan 2025 11:58:13 +0100
Subject: [PATCH 2/2] Update warn-suggest-override.cpp

---
 clang/test/SemaCXX/warn-suggest-override.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/test/SemaCXX/warn-suggest-override.cpp 
b/clang/test/SemaCXX/warn-suggest-override.cpp
index 436a17d489693c..b1df5cf1224cf3 100644
--- a/clang/test/SemaCXX/warn-suggest-override.cpp
+++ b/clang/test/SemaCXX/warn-suggest-override.cpp
@@ -35,5 +35,5 @@ struct F : public C {
 struct G : public C { // expected-note {{mark 'G' as 'final'}}
   void run() final;
   ~G() final;
-  // expected-warning@-1 {{class with destructor marked as 'final' can not be 
inherited from}}
+  // expected-warning@-1 {{class with destructor marked 'final' can not be 
inherited from}}
 };

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


[clang] [WIP] [Modules] Delay reading type source info of the preferred_name attribute. (PR #122250)

2025-01-13 Thread Ilya Biryukov via cfe-commits

ilya-biryukov wrote:

> A special handling for `PreferredName` looks slightly add-hoc to me. What I 
> thought is to delay the deserialization of `attributes` after the 
> deserialization of the declaration. If this is too optimistic, I am wondering 
> if we can delay reading of some sorts of attributes only, which is more 
> generic.

I don't have concrete examples in my head, but I would be cautious of doing 
this for **all** attributes. Intuitively, it feels that there must be existing 
attributes that we somehow would depend on in the code during serialization. 
However, it might be worth a try to actually find real examples from running 
tests (even if only to prove that my intuition is wrong).

That being said, having a concept for "sort of attributes that we can delay 
reading" seems like a really good idea. I am now highly suspicious of any 
attribute that stores `TypeSourceInfo`, they should probably hit the same bug 
in certain circumstances; there's no nothing specific to `preferred_name` 
itself other than the fact that it actually tends to end up recursively 
referencing its own type through a typedef more often than others.

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


[clang] [Clang] emit -Wignored-qualifiers diagnostic for cv-qualified base classes (PR #121419)

2025-01-13 Thread Erich Keane via cfe-commits

erichkeane wrote:

> @erichkeane @ldionne should the `libcxx` tests 
> ([common_reference.compile.pass.cpp](https://github.com/llvm/llvm-project/blob/main/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/common_reference.compile.pass.cpp),
>  
> [apply_extended_types.pass.cpp](https://github.com/llvm/llvm-project/blob/main/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.apply/apply_extended_types.pass.cpp))
>  be updated or should the new warnings/errors be treated as the new baseline?

This is entirely a @ldionne question, though I see in github that he's on 
vacation at the moment, so we'll have to wait until he returns.

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


[clang] [llvm] [OffloadBundler] Rework the ctor of `OffloadTargetInfo` to support AMDGPU's generic target (PR #122629)

2025-01-13 Thread Shilei Tian via cfe-commits

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


[clang] [llvm] [AArch64] Fix aarch64-fujitsu-monaka.c test (PR #122716)

2025-01-13 Thread via cfe-commits

llvmbot wrote:



@llvm/pr-subscribers-clang

@llvm/pr-subscribers-clang-driver

Author: None (Lukacma)


Changes



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


8 Files Affected:

- (modified) clang/test/CodeGen/AArch64/fp8-intrinsics/acle_sve2_fp8_fdot.c 
(+6-6) 
- (modified) clang/test/CodeGen/AArch64/sme2-intrinsics/acle_sme2_fp8_fdot.c 
(+5-5) 
- (modified) clang/test/CodeGen/AArch64/sme2-intrinsics/acle_sme2_fp8_fvdot.c 
(+5-5) 
- (modified) 
clang/test/Driver/print-enabled-extensions/aarch64-fujitsu-monaka.c (-2) 
- (modified) clang/test/Sema/aarch64-fp8-intrinsics/acle_sme2_fp8_imm.c (+1-1) 
- (modified) llvm/lib/Target/AArch64/AArch64Features.td (+5-5) 
- (modified) llvm/test/CodeGen/AArch64/fp8-sve-fdot.ll (+2-2) 
- (modified) llvm/unittests/TargetParser/TargetParserTest.cpp (+27-2) 


``diff
diff --git a/clang/test/CodeGen/AArch64/fp8-intrinsics/acle_sve2_fp8_fdot.c 
b/clang/test/CodeGen/AArch64/fp8-intrinsics/acle_sve2_fp8_fdot.c
index 950a19115811ec..2f3994df037848 100644
--- a/clang/test/CodeGen/AArch64/fp8-intrinsics/acle_sve2_fp8_fdot.c
+++ b/clang/test/CodeGen/AArch64/fp8-intrinsics/acle_sve2_fp8_fdot.c
@@ -1,12 +1,12 @@
 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py 
UTC_ARGS: --version 5
-// RUN: %clang_cc1-triple aarch64-none-linux-gnu -target-feature +sve 
-target-feature +sve2 -target-feature +fp8 -target-feature +fp8dot2 
-target-feature +fp8dot4 -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | 
opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s
-// RUN: %clang_cc1 -x c++ -triple aarch64-none-linux-gnu -target-feature +sme 
-target-feature +fp8 -target-feature +ssve-fp8dot2 -target-feature 
+ssve-fp8dot4 -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p 
mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CHECK-CXX
+// RUN: %clang_cc1-triple aarch64-none-linux-gnu -target-feature +sve 
-target-feature +sve2 -target-feature +fp8dot2 -target-feature +fp8dot4 
-disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p 
mem2reg,instcombine,tailcallelim | FileCheck %s
+// RUN: %clang_cc1 -x c++ -triple aarch64-none-linux-gnu -target-feature +sme 
-target-feature +ssve-fp8dot2 -target-feature +ssve-fp8dot4 -disable-O0-optnone 
-Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | 
FileCheck %s -check-prefix=CHECK-CXX
 
-// RUN: %clang_cc1-DSVE_OVERLOADED_FORMS -triple 
aarch64-none-linux-gnu -target-feature +sve -target-feature +sve2 
-target-feature +fp8 -target-feature +fp8dot2 -target-feature +fp8dot4 
-disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p 
mem2reg,instcombine,tailcallelim | FileCheck %s
-// RUN: %clang_cc1 -x c++ -DSVE_OVERLOADED_FORMS -triple 
aarch64-none-linux-gnu -target-feature +sme -target-feature +fp8 
-target-feature +ssve-fp8dot2 -target-feature +ssve-fp8dot4 -disable-O0-optnone 
-Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | 
FileCheck %s -check-prefix=CHECK-CXX
+// RUN: %clang_cc1-DSVE_OVERLOADED_FORMS -triple 
aarch64-none-linux-gnu -target-feature +sve -target-feature +sve2 
-target-feature +fp8dot2 -target-feature +fp8dot4 -disable-O0-optnone -Werror 
-Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | 
FileCheck %s
+// RUN: %clang_cc1 -x c++ -DSVE_OVERLOADED_FORMS -triple 
aarch64-none-linux-gnu -target-feature +sme -target-feature +ssve-fp8dot2 
-target-feature +ssve-fp8dot4 -disable-O0-optnone -Werror -Wall -emit-llvm -o - 
%s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s 
-check-prefix=CHECK-CXX
 
-// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve 
-target-feature +sve2 -target-feature +fp8 -target-feature +fp8dot2 
-target-feature +fp8dot4 -S -disable-O0-optnone -Werror -Wall -o /dev/null %s
-// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme 
-target-feature +sme2 -target-feature +fp8 -target-feature +ssve-fp8dot2 
-target-feature +ssve-fp8dot4 -S -disable-O0-optnone -Werror -Wall -o /dev/null 
%s
+// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve 
-target-feature +sve2 -target-feature +fp8dot2 -target-feature +fp8dot4 -S 
-disable-O0-optnone -Werror -Wall -o /dev/null %s
+// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme 
-target-feature +ssve-fp8dot2 -target-feature +ssve-fp8dot4 -S 
-disable-O0-optnone -Werror -Wall -o /dev/null %s
 
 // REQUIRES: aarch64-registered-target
 
diff --git a/clang/test/CodeGen/AArch64/sme2-intrinsics/acle_sme2_fp8_fdot.c 
b/clang/test/CodeGen/AArch64/sme2-intrinsics/acle_sme2_fp8_fdot.c
index a151d162e01085..2da4ab541869ed 100644
--- a/clang/test/CodeGen/AArch64/sme2-intrinsics/acle_sme2_fp8_fdot.c
+++ b/clang/test/CodeGen/AArch64/sme2-intrinsics/acle_sme2_fp8_fdot.c
@@ -1,11 +1,11 @@
 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py 
UTC_ARGS: --version 5
 // REQUI

[clang] [llvm] [AArch64] Fix aarch64-fujitsu-monaka.c test (PR #122716)

2025-01-13 Thread via cfe-commits

https://github.com/Lukacma created 
https://github.com/llvm/llvm-project/pull/122716

None

>From e3bc40234f8bd4c70d8822aadc6f42b6f738afba Mon Sep 17 00:00:00 2001
From: Marian Lukac 
Date: Thu, 9 Jan 2025 14:40:45 +
Subject: [PATCH 1/2] [AArch64] Change feature dependencies of fp8 features

---
 .../fp8-intrinsics/acle_sve2_fp8_fdot.c   | 12 
 .../sme2-intrinsics/acle_sme2_fp8_fdot.c  | 10 +++
 .../sme2-intrinsics/acle_sme2_fp8_fvdot.c | 10 +++
 .../acle_sme2_fp8_imm.c   |  2 +-
 llvm/lib/Target/AArch64/AArch64Features.td| 10 +++
 llvm/test/CodeGen/AArch64/fp8-sve-fdot.ll |  4 +--
 .../TargetParser/TargetParserTest.cpp | 29 +--
 7 files changed, 51 insertions(+), 26 deletions(-)

diff --git a/clang/test/CodeGen/AArch64/fp8-intrinsics/acle_sve2_fp8_fdot.c 
b/clang/test/CodeGen/AArch64/fp8-intrinsics/acle_sve2_fp8_fdot.c
index 950a19115811ec..2f3994df037848 100644
--- a/clang/test/CodeGen/AArch64/fp8-intrinsics/acle_sve2_fp8_fdot.c
+++ b/clang/test/CodeGen/AArch64/fp8-intrinsics/acle_sve2_fp8_fdot.c
@@ -1,12 +1,12 @@
 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py 
UTC_ARGS: --version 5
-// RUN: %clang_cc1-triple aarch64-none-linux-gnu -target-feature +sve 
-target-feature +sve2 -target-feature +fp8 -target-feature +fp8dot2 
-target-feature +fp8dot4 -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | 
opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s
-// RUN: %clang_cc1 -x c++ -triple aarch64-none-linux-gnu -target-feature +sme 
-target-feature +fp8 -target-feature +ssve-fp8dot2 -target-feature 
+ssve-fp8dot4 -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p 
mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CHECK-CXX
+// RUN: %clang_cc1-triple aarch64-none-linux-gnu -target-feature +sve 
-target-feature +sve2 -target-feature +fp8dot2 -target-feature +fp8dot4 
-disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p 
mem2reg,instcombine,tailcallelim | FileCheck %s
+// RUN: %clang_cc1 -x c++ -triple aarch64-none-linux-gnu -target-feature +sme 
-target-feature +ssve-fp8dot2 -target-feature +ssve-fp8dot4 -disable-O0-optnone 
-Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | 
FileCheck %s -check-prefix=CHECK-CXX
 
-// RUN: %clang_cc1-DSVE_OVERLOADED_FORMS -triple 
aarch64-none-linux-gnu -target-feature +sve -target-feature +sve2 
-target-feature +fp8 -target-feature +fp8dot2 -target-feature +fp8dot4 
-disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p 
mem2reg,instcombine,tailcallelim | FileCheck %s
-// RUN: %clang_cc1 -x c++ -DSVE_OVERLOADED_FORMS -triple 
aarch64-none-linux-gnu -target-feature +sme -target-feature +fp8 
-target-feature +ssve-fp8dot2 -target-feature +ssve-fp8dot4 -disable-O0-optnone 
-Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | 
FileCheck %s -check-prefix=CHECK-CXX
+// RUN: %clang_cc1-DSVE_OVERLOADED_FORMS -triple 
aarch64-none-linux-gnu -target-feature +sve -target-feature +sve2 
-target-feature +fp8dot2 -target-feature +fp8dot4 -disable-O0-optnone -Werror 
-Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | 
FileCheck %s
+// RUN: %clang_cc1 -x c++ -DSVE_OVERLOADED_FORMS -triple 
aarch64-none-linux-gnu -target-feature +sme -target-feature +ssve-fp8dot2 
-target-feature +ssve-fp8dot4 -disable-O0-optnone -Werror -Wall -emit-llvm -o - 
%s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s 
-check-prefix=CHECK-CXX
 
-// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve 
-target-feature +sve2 -target-feature +fp8 -target-feature +fp8dot2 
-target-feature +fp8dot4 -S -disable-O0-optnone -Werror -Wall -o /dev/null %s
-// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme 
-target-feature +sme2 -target-feature +fp8 -target-feature +ssve-fp8dot2 
-target-feature +ssve-fp8dot4 -S -disable-O0-optnone -Werror -Wall -o /dev/null 
%s
+// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve 
-target-feature +sve2 -target-feature +fp8dot2 -target-feature +fp8dot4 -S 
-disable-O0-optnone -Werror -Wall -o /dev/null %s
+// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme 
-target-feature +ssve-fp8dot2 -target-feature +ssve-fp8dot4 -S 
-disable-O0-optnone -Werror -Wall -o /dev/null %s
 
 // REQUIRES: aarch64-registered-target
 
diff --git a/clang/test/CodeGen/AArch64/sme2-intrinsics/acle_sme2_fp8_fdot.c 
b/clang/test/CodeGen/AArch64/sme2-intrinsics/acle_sme2_fp8_fdot.c
index a151d162e01085..2da4ab541869ed 100644
--- a/clang/test/CodeGen/AArch64/sme2-intrinsics/acle_sme2_fp8_fdot.c
+++ b/clang/test/CodeGen/AArch64/sme2-intrinsics/acle_sme2_fp8_fdot.c
@@ -1,11 +1,11 @@
 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py 
UTC_ARGS: --version 5
 // REQUIRES: aarch64-registered-target
 
-// RUN: %clang_cc1 -triple aarch64 -

[clang] [llvm] [AArch64] Fix aarch64-fujitsu-monaka.c test (PR #122716)

2025-01-13 Thread via cfe-commits

https://github.com/Lukacma updated 
https://github.com/llvm/llvm-project/pull/122716

>From e3bc40234f8bd4c70d8822aadc6f42b6f738afba Mon Sep 17 00:00:00 2001
From: Marian Lukac 
Date: Thu, 9 Jan 2025 14:40:45 +
Subject: [PATCH 1/2] [AArch64] Change feature dependencies of fp8 features

---
 .../fp8-intrinsics/acle_sve2_fp8_fdot.c   | 12 
 .../sme2-intrinsics/acle_sme2_fp8_fdot.c  | 10 +++
 .../sme2-intrinsics/acle_sme2_fp8_fvdot.c | 10 +++
 .../acle_sme2_fp8_imm.c   |  2 +-
 llvm/lib/Target/AArch64/AArch64Features.td| 10 +++
 llvm/test/CodeGen/AArch64/fp8-sve-fdot.ll |  4 +--
 .../TargetParser/TargetParserTest.cpp | 29 +--
 7 files changed, 51 insertions(+), 26 deletions(-)

diff --git a/clang/test/CodeGen/AArch64/fp8-intrinsics/acle_sve2_fp8_fdot.c 
b/clang/test/CodeGen/AArch64/fp8-intrinsics/acle_sve2_fp8_fdot.c
index 950a19115811ec..2f3994df037848 100644
--- a/clang/test/CodeGen/AArch64/fp8-intrinsics/acle_sve2_fp8_fdot.c
+++ b/clang/test/CodeGen/AArch64/fp8-intrinsics/acle_sve2_fp8_fdot.c
@@ -1,12 +1,12 @@
 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py 
UTC_ARGS: --version 5
-// RUN: %clang_cc1-triple aarch64-none-linux-gnu -target-feature +sve 
-target-feature +sve2 -target-feature +fp8 -target-feature +fp8dot2 
-target-feature +fp8dot4 -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | 
opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s
-// RUN: %clang_cc1 -x c++ -triple aarch64-none-linux-gnu -target-feature +sme 
-target-feature +fp8 -target-feature +ssve-fp8dot2 -target-feature 
+ssve-fp8dot4 -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p 
mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CHECK-CXX
+// RUN: %clang_cc1-triple aarch64-none-linux-gnu -target-feature +sve 
-target-feature +sve2 -target-feature +fp8dot2 -target-feature +fp8dot4 
-disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p 
mem2reg,instcombine,tailcallelim | FileCheck %s
+// RUN: %clang_cc1 -x c++ -triple aarch64-none-linux-gnu -target-feature +sme 
-target-feature +ssve-fp8dot2 -target-feature +ssve-fp8dot4 -disable-O0-optnone 
-Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | 
FileCheck %s -check-prefix=CHECK-CXX
 
-// RUN: %clang_cc1-DSVE_OVERLOADED_FORMS -triple 
aarch64-none-linux-gnu -target-feature +sve -target-feature +sve2 
-target-feature +fp8 -target-feature +fp8dot2 -target-feature +fp8dot4 
-disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p 
mem2reg,instcombine,tailcallelim | FileCheck %s
-// RUN: %clang_cc1 -x c++ -DSVE_OVERLOADED_FORMS -triple 
aarch64-none-linux-gnu -target-feature +sme -target-feature +fp8 
-target-feature +ssve-fp8dot2 -target-feature +ssve-fp8dot4 -disable-O0-optnone 
-Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | 
FileCheck %s -check-prefix=CHECK-CXX
+// RUN: %clang_cc1-DSVE_OVERLOADED_FORMS -triple 
aarch64-none-linux-gnu -target-feature +sve -target-feature +sve2 
-target-feature +fp8dot2 -target-feature +fp8dot4 -disable-O0-optnone -Werror 
-Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | 
FileCheck %s
+// RUN: %clang_cc1 -x c++ -DSVE_OVERLOADED_FORMS -triple 
aarch64-none-linux-gnu -target-feature +sme -target-feature +ssve-fp8dot2 
-target-feature +ssve-fp8dot4 -disable-O0-optnone -Werror -Wall -emit-llvm -o - 
%s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s 
-check-prefix=CHECK-CXX
 
-// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve 
-target-feature +sve2 -target-feature +fp8 -target-feature +fp8dot2 
-target-feature +fp8dot4 -S -disable-O0-optnone -Werror -Wall -o /dev/null %s
-// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme 
-target-feature +sme2 -target-feature +fp8 -target-feature +ssve-fp8dot2 
-target-feature +ssve-fp8dot4 -S -disable-O0-optnone -Werror -Wall -o /dev/null 
%s
+// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve 
-target-feature +sve2 -target-feature +fp8dot2 -target-feature +fp8dot4 -S 
-disable-O0-optnone -Werror -Wall -o /dev/null %s
+// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme 
-target-feature +ssve-fp8dot2 -target-feature +ssve-fp8dot4 -S 
-disable-O0-optnone -Werror -Wall -o /dev/null %s
 
 // REQUIRES: aarch64-registered-target
 
diff --git a/clang/test/CodeGen/AArch64/sme2-intrinsics/acle_sme2_fp8_fdot.c 
b/clang/test/CodeGen/AArch64/sme2-intrinsics/acle_sme2_fp8_fdot.c
index a151d162e01085..2da4ab541869ed 100644
--- a/clang/test/CodeGen/AArch64/sme2-intrinsics/acle_sme2_fp8_fdot.c
+++ b/clang/test/CodeGen/AArch64/sme2-intrinsics/acle_sme2_fp8_fdot.c
@@ -1,11 +1,11 @@
 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py 
UTC_ARGS: --version 5
 // REQUIRES: aarch64-registered-target
 
-// RUN: %clang_cc1 -triple aarch64 -target

[clang] [llvm] [AArch64] Fix aarch64-fujitsu-monaka.c test (PR #122716)

2025-01-13 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-backend-aarch64

Author: None (Lukacma)


Changes



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


8 Files Affected:

- (modified) clang/test/CodeGen/AArch64/fp8-intrinsics/acle_sve2_fp8_fdot.c 
(+6-6) 
- (modified) clang/test/CodeGen/AArch64/sme2-intrinsics/acle_sme2_fp8_fdot.c 
(+5-5) 
- (modified) clang/test/CodeGen/AArch64/sme2-intrinsics/acle_sme2_fp8_fvdot.c 
(+5-5) 
- (modified) 
clang/test/Driver/print-enabled-extensions/aarch64-fujitsu-monaka.c (-2) 
- (modified) clang/test/Sema/aarch64-fp8-intrinsics/acle_sme2_fp8_imm.c (+1-1) 
- (modified) llvm/lib/Target/AArch64/AArch64Features.td (+5-5) 
- (modified) llvm/test/CodeGen/AArch64/fp8-sve-fdot.ll (+2-2) 
- (modified) llvm/unittests/TargetParser/TargetParserTest.cpp (+27-2) 


``diff
diff --git a/clang/test/CodeGen/AArch64/fp8-intrinsics/acle_sve2_fp8_fdot.c 
b/clang/test/CodeGen/AArch64/fp8-intrinsics/acle_sve2_fp8_fdot.c
index 950a19115811ec..2f3994df037848 100644
--- a/clang/test/CodeGen/AArch64/fp8-intrinsics/acle_sve2_fp8_fdot.c
+++ b/clang/test/CodeGen/AArch64/fp8-intrinsics/acle_sve2_fp8_fdot.c
@@ -1,12 +1,12 @@
 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py 
UTC_ARGS: --version 5
-// RUN: %clang_cc1-triple aarch64-none-linux-gnu -target-feature +sve 
-target-feature +sve2 -target-feature +fp8 -target-feature +fp8dot2 
-target-feature +fp8dot4 -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | 
opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s
-// RUN: %clang_cc1 -x c++ -triple aarch64-none-linux-gnu -target-feature +sme 
-target-feature +fp8 -target-feature +ssve-fp8dot2 -target-feature 
+ssve-fp8dot4 -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p 
mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CHECK-CXX
+// RUN: %clang_cc1-triple aarch64-none-linux-gnu -target-feature +sve 
-target-feature +sve2 -target-feature +fp8dot2 -target-feature +fp8dot4 
-disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p 
mem2reg,instcombine,tailcallelim | FileCheck %s
+// RUN: %clang_cc1 -x c++ -triple aarch64-none-linux-gnu -target-feature +sme 
-target-feature +ssve-fp8dot2 -target-feature +ssve-fp8dot4 -disable-O0-optnone 
-Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | 
FileCheck %s -check-prefix=CHECK-CXX
 
-// RUN: %clang_cc1-DSVE_OVERLOADED_FORMS -triple 
aarch64-none-linux-gnu -target-feature +sve -target-feature +sve2 
-target-feature +fp8 -target-feature +fp8dot2 -target-feature +fp8dot4 
-disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p 
mem2reg,instcombine,tailcallelim | FileCheck %s
-// RUN: %clang_cc1 -x c++ -DSVE_OVERLOADED_FORMS -triple 
aarch64-none-linux-gnu -target-feature +sme -target-feature +fp8 
-target-feature +ssve-fp8dot2 -target-feature +ssve-fp8dot4 -disable-O0-optnone 
-Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | 
FileCheck %s -check-prefix=CHECK-CXX
+// RUN: %clang_cc1-DSVE_OVERLOADED_FORMS -triple 
aarch64-none-linux-gnu -target-feature +sve -target-feature +sve2 
-target-feature +fp8dot2 -target-feature +fp8dot4 -disable-O0-optnone -Werror 
-Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | 
FileCheck %s
+// RUN: %clang_cc1 -x c++ -DSVE_OVERLOADED_FORMS -triple 
aarch64-none-linux-gnu -target-feature +sme -target-feature +ssve-fp8dot2 
-target-feature +ssve-fp8dot4 -disable-O0-optnone -Werror -Wall -emit-llvm -o - 
%s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s 
-check-prefix=CHECK-CXX
 
-// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve 
-target-feature +sve2 -target-feature +fp8 -target-feature +fp8dot2 
-target-feature +fp8dot4 -S -disable-O0-optnone -Werror -Wall -o /dev/null %s
-// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme 
-target-feature +sme2 -target-feature +fp8 -target-feature +ssve-fp8dot2 
-target-feature +ssve-fp8dot4 -S -disable-O0-optnone -Werror -Wall -o /dev/null 
%s
+// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve 
-target-feature +sve2 -target-feature +fp8dot2 -target-feature +fp8dot4 -S 
-disable-O0-optnone -Werror -Wall -o /dev/null %s
+// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme 
-target-feature +ssve-fp8dot2 -target-feature +ssve-fp8dot4 -S 
-disable-O0-optnone -Werror -Wall -o /dev/null %s
 
 // REQUIRES: aarch64-registered-target
 
diff --git a/clang/test/CodeGen/AArch64/sme2-intrinsics/acle_sme2_fp8_fdot.c 
b/clang/test/CodeGen/AArch64/sme2-intrinsics/acle_sme2_fp8_fdot.c
index a151d162e01085..2da4ab541869ed 100644
--- a/clang/test/CodeGen/AArch64/sme2-intrinsics/acle_sme2_fp8_fdot.c
+++ b/clang/test/CodeGen/AArch64/sme2-intrinsics/acle_sme2_fp8_fdot.c
@@ -1,11 +1,11 @@
 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py 
UTC_ARGS: --version 5
 // REQUIRES: aarch64-registered-

[clang] [AArch64] Fix aarch64-fujitsu-monaka.c test (PR #122716)

2025-01-13 Thread via cfe-commits

https://github.com/Lukacma updated 
https://github.com/llvm/llvm-project/pull/122716

>From d1e1953d45be8fcc2d3665821a8ad43011d01c9d Mon Sep 17 00:00:00 2001
From: Marian Lukac 
Date: Mon, 13 Jan 2025 14:43:15 +
Subject: [PATCH] [AArch64] Fix aarch64-fujitsu-monaka.c test

---
 .../Driver/print-enabled-extensions/aarch64-fujitsu-monaka.c| 2 --
 1 file changed, 2 deletions(-)

diff --git 
a/clang/test/Driver/print-enabled-extensions/aarch64-fujitsu-monaka.c 
b/clang/test/Driver/print-enabled-extensions/aarch64-fujitsu-monaka.c
index 3c74e3620df034..01a97a00de5421 100644
--- a/clang/test/Driver/print-enabled-extensions/aarch64-fujitsu-monaka.c
+++ b/clang/test/Driver/print-enabled-extensions/aarch64-fujitsu-monaka.c
@@ -28,8 +28,6 @@
 // CHECK-NEXT: FEAT_FP16  
Enable half-precision floating-point data processing
 // CHECK-NEXT: FEAT_FP8   
Enable FP8 instructions
 // CHECK-NEXT: FEAT_FP8DOT2   
Enable FP8 2-way dot instructions
-// CHECK-NEXT: FEAT_FP8DOT4   
Enable FP8 4-way dot instructions
-// CHECK-NEXT: FEAT_FP8FMA
Enable Armv9.5-A FP8 multiply-add instructions
 // CHECK-NEXT: FEAT_FPAC  
Enable Armv8.3-A Pointer Authentication Faulting enhancement
 // CHECK-NEXT: FEAT_FRINTTS   
Enable FRInt[32|64][Z|X] instructions that round a floating-point number to an 
integer (in FP format) forcing it to fit into a 32- or 64-bit int
 // CHECK-NEXT: FEAT_FlagM 
Enable Armv8.4-A Flag Manipulation instructions

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


[clang] [Clang] raise extension warning for unknown namespaced attributes (PR #120925)

2025-01-13 Thread Erich Keane via cfe-commits


@@ -179,6 +179,8 @@ def err_opencl_unknown_type_specifier : Error<
 
 def warn_unknown_attribute_ignored : Warning<
   "unknown attribute %0 ignored">, InGroup;
+def ext_unknown_attribute_ignored : Extension<
+  "unknown attribute %0 ignored">, InGroup;

erichkeane wrote:

>Do we want to support a grouping like -Wno-unknown-attribute-namespace=frobble 
>where leaving off the = means we silence all unknown attribute namespaces?

I think that is a NEAT feature, but I fear one that is a lot of work for 
something that basically no one will figure out how to use (since people 
discover -Wno flags from our diagnostics), and thus no one will. If we DO 
something like that, I would want to see if we could do a note attached to it 
of:
`to disable this diagnostic for this namespace, use 
`-Wno-unknown-attribute-namespace=frobble`.  ALSO, we should support 
comma-delimited.

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


[clang] [BoundsSafety][Sema] Allow counted_by and counted_by_or_null on pointers where the pointee type is incomplete but potentially completable (PR #106321)

2025-01-13 Thread via cfe-commits

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


[clang] [Clang] Reapply CWG2369 "Ordering between constraints and substitution" (PR #122423)

2025-01-13 Thread Hans Wennborg via cfe-commits

zmodem wrote:

Confirmed Chromium on Windows builds with this patch.

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


[clang] [clang] Fix ASTWriter crash after merging named enums (PR #114240)

2025-01-13 Thread via cfe-commits

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


[clang] [clang] Fix ASTWriter crash after merging named enums (PR #114240)

2025-01-13 Thread via cfe-commits


@@ -2551,18 +2551,7 @@ void Sema::MergeTypedefNameDecl(Scope *S, 
TypedefNameDecl *New,
   // Make the old tag definition visible.
   makeMergedDefinitionVisible(Hidden);
 
-  // If this was an unscoped enumeration, yank all of its enumerators
-  // out of the scope.
-  if (isa(NewTag)) {
-Scope *EnumScope = getNonFieldDeclScope(S);
-for (auto *D : NewTag->decls()) {
-  auto *ED = cast(D);
-  assert(EnumScope->isDeclScope(ED));
-  EnumScope->RemoveDecl(ED);
-  IdResolver.RemoveDecl(ED);
-  ED->getLexicalDeclContext()->removeDecl(ED);

cor3ntin wrote:

I am not super confident about this change, is it related or could it be 
separate? @AaronBallman 

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


  1   2   3   4   5   >