[clang] [llvm] [X86][MC] Added support for -msse2avx option in llvm-mc (PR #96860)

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


@@ -0,0 +1,88 @@
+# RUN: llvm-mc -triple x86_64 -x86-asm-syntax=intel -x86-sse2avx %s | 
FileCheck %s

MaskRay wrote:

Perhaps merge sse2avx-att.s sse2avx-intel.s. Keep the att version.

Add `llvm-mc -triple=x86_64 -output-asm-variant=1 %s | llvm-mc -triple=x86_64 
-x86-asm-syntax=intel -x86-sse2avx`
to test Intel syntax input.

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


[clang] RFC: [cmake] Export CLANG_RESOURCE_DIR in ClangConfig (PR #97197)

2024-07-12 Thread Kim Gräsman via cfe-commits

kimgr wrote:

I think at the time we started doing this, Clang's builtin includes lookup 
basically did `$dirname($0)/../lib/llvm-$version/clang/$version/include`. So 
when building `include-what-you-use` in a separate tree, the resulting binary 
didn't have the builtin headers in the right place, and we wouldn't be able to 
run tests.

We support three build modes:

* as part of LLVM+Clang with `LLVM_EXTERNAL_PROJECTS=iwyu` and 
`LLVM_EXTERNAL_IWYU_SOURCE_DIR`
* with `CMAKE_PREFIX_PATH` pointing to a package-installed LLVM+Clang
* with `CMAKE_PREFIX_PATH` pointing to an LLVM+Clang build tree

In the first case, depending on the `Headers` target makes sure all headers are 
copied into the build tree.

For the latter two we synthesize a `Headers` target (because it's not exported) 
based on the Clang resource dir.

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


[clang] [Work-in-Progress][Clang][RISCV] Create supporting intrinsics around RVV BFloat16 type (PR #72463)

2024-07-12 Thread Kito Cheng via cfe-commits

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


[clang] [Work-in-Progress][Clang][RISCV] Create supporting intrinsics around RVV BFloat16 type (PR #72463)

2024-07-12 Thread Kito Cheng via cfe-commits

kito-cheng wrote:

Done by https://github.com/llvm/llvm-project/pull/71140

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


[clang] [clang] Lower _BitInt(129+) to a different type in LLVM IR (PR #91364)

2024-07-12 Thread Nikita Popov via cfe-commits

nikic wrote:

> Okay, so x86_64 describes it in byte terms and says they're little-endian, 
> which is consistent with the overall target. Interestingly, it does not 
> guarantee the content of the excess bits. The code-generation in this patch 
> is consistent with that: the extension we do is unnecessary but allowed, and 
> then we truncate it away after load. If we ever add some way to tell the 
> backend that a truncation is known to be reversing a sign/zero-extension, 
> we'll need to not set it on this target.

FYI this already exists in the form of `trunc nuw` / `trunc nsw`. (Though it's 
not fully optimized yet.)

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


[clang] [clang-repl] Teach clang-repl how to load PCHs. (PR #94166)

2024-07-12 Thread Vassil Vassilev via cfe-commits

https://github.com/vgvassilev updated 
https://github.com/llvm/llvm-project/pull/94166

>From d2d533d0962e4260f052179c199a2e5ebe44edb1 Mon Sep 17 00:00:00 2001
From: Vassil Vassilev 
Date: Thu, 30 May 2024 05:05:41 +
Subject: [PATCH 1/2] [clang-repl] Teach clang-repl how to load PCHs.

---
 clang/include/clang/CodeGen/ModuleBuilder.h |  6 ++
 clang/lib/CodeGen/BackendConsumer.h |  5 -
 clang/lib/CodeGen/CodeGenAction.cpp |  6 +-
 clang/lib/CodeGen/ModuleBuilder.cpp |  8 
 clang/lib/Interpreter/IncrementalParser.cpp |  4 
 clang/test/Interpreter/execute-pch.cpp  | 14 ++
 6 files changed, 33 insertions(+), 10 deletions(-)
 create mode 100644 clang/test/Interpreter/execute-pch.cpp

diff --git a/clang/include/clang/CodeGen/ModuleBuilder.h 
b/clang/include/clang/CodeGen/ModuleBuilder.h
index 59b9840d02e08..f1b8229edd362 100644
--- a/clang/include/clang/CodeGen/ModuleBuilder.h
+++ b/clang/include/clang/CodeGen/ModuleBuilder.h
@@ -52,6 +52,12 @@ namespace CodeGen {
 class CodeGenerator : public ASTConsumer {
   virtual void anchor();
 
+protected:
+  /// True if we've finished generating IR. This prevents us from generating
+  /// additional LLVM IR after emitting output in HandleTranslationUnit. This
+  /// can happen when Clang plugins trigger additional AST deserialization.
+  bool IRGenFinished = false;
+
 public:
   /// Return an opaque reference to the CodeGenModule object, which can
   /// be used in various secondary APIs.  It is valid as long as the
diff --git a/clang/lib/CodeGen/BackendConsumer.h 
b/clang/lib/CodeGen/BackendConsumer.h
index a023d29cbd1d7..a4d737aa2e587 100644
--- a/clang/lib/CodeGen/BackendConsumer.h
+++ b/clang/lib/CodeGen/BackendConsumer.h
@@ -41,11 +41,6 @@ class BackendConsumer : public ASTConsumer {
   llvm::Timer LLVMIRGeneration;
   unsigned LLVMIRGenerationRefCount;
 
-  /// True if we've finished generating IR. This prevents us from generating
-  /// additional LLVM IR after emitting output in HandleTranslationUnit. This
-  /// can happen when Clang plugins trigger additional AST deserialization.
-  bool IRGenFinished = false;
-
   bool TimerIsEnabled = false;
 
   std::unique_ptr Gen;
diff --git a/clang/lib/CodeGen/CodeGenAction.cpp 
b/clang/lib/CodeGen/CodeGenAction.cpp
index e87226e60297c..0ffc5119f19c5 100644
--- a/clang/lib/CodeGen/CodeGenAction.cpp
+++ b/clang/lib/CodeGen/CodeGenAction.cpp
@@ -221,9 +221,7 @@ void 
BackendConsumer::HandleInlineFunctionDefinition(FunctionDecl *D) {
 }
 
 void BackendConsumer::HandleInterestingDecl(DeclGroupRef D) {
-  // Ignore interesting decls from the AST reader after IRGen is finished.
-  if (!IRGenFinished)
-HandleTopLevelDecl(D);
+  HandleTopLevelDecl(D);
 }
 
 // Links each entry in LinkModules into our module. Returns true on error.
@@ -280,8 +278,6 @@ void BackendConsumer::HandleTranslationUnit(ASTContext &C) {
   if (LLVMIRGenerationRefCount == 0)
 LLVMIRGeneration.stopTimer();
 }
-
-IRGenFinished = true;
   }
 
   // Silently ignore if we weren't initialized for some reason.
diff --git a/clang/lib/CodeGen/ModuleBuilder.cpp 
b/clang/lib/CodeGen/ModuleBuilder.cpp
index d4e0ab0339a8b..1be9f286ab932 100644
--- a/clang/lib/CodeGen/ModuleBuilder.cpp
+++ b/clang/lib/CodeGen/ModuleBuilder.cpp
@@ -138,6 +138,8 @@ namespace {
   assert(!M && "Replacing existing Module?");
   M.reset(new llvm::Module(ExpandModuleName(ModuleName, CodeGenOpts), C));
 
+  IRGenFinished = false;
+
   std::unique_ptr OldBuilder = std::move(Builder);
 
   Initialize(*Ctx);
@@ -179,6 +181,10 @@ namespace {
 }
 
 bool HandleTopLevelDecl(DeclGroupRef DG) override {
+  // Ignore interesting decls from the AST reader after IRGen is finished.
+  if (IRGenFinished)
+return true; // We can't CodeGen more but pass to other consumers.
+
   // FIXME: Why not return false and abort parsing?
   if (Diags.hasUnrecoverableErrorOccurred())
 return true;
@@ -282,6 +288,8 @@ namespace {
 }
 
 void HandleTranslationUnit(ASTContext &Ctx) override {
+  IRGenFinished = true;
+
   // Release the Builder when there is no error.
   if (!Diags.hasUnrecoverableErrorOccurred() && Builder)
 Builder->Release();
diff --git a/clang/lib/Interpreter/IncrementalParser.cpp 
b/clang/lib/Interpreter/IncrementalParser.cpp
index b7c809c45098c..831b99c814f32 100644
--- a/clang/lib/Interpreter/IncrementalParser.cpp
+++ b/clang/lib/Interpreter/IncrementalParser.cpp
@@ -219,6 +219,10 @@ IncrementalParser::IncrementalParser(Interpreter &Interp,
   Consumer = &CI->getASTConsumer();
   P.reset(
   new Parser(CI->getPreprocessor(), CI->getSema(), /*SkipBodies=*/false));
+
+  if (ExternalASTSource *External = CI->getASTContext().getExternalSource())
+External->StartTranslationUnit(Consumer);
+
   P->Initialize();
 
   // An initial PTU is needed as CUDA includes some headers automatically
diff --git a/clang/test/Interpreter/

[clang] [libcxx] [llvm] Reapply "[Clang] Implement resolution for CWG1835 (#92957)" (PR #98547)

2024-07-12 Thread Mike Hommey via cfe-commits

glandium wrote:

This broke building abseil-cpp (cd75cb4ae32c46c84cef9a9c78b42174f22ed0ac as of 
writing).

STR:
- Clone https://github.com/abseil/abseil-cpp
- `cmake -B build -S abseil-cpp -DCMAKE_CXX_COMPILER=clang++ -GNinja`
- `ninja -C build`

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


[clang] [libcxx] [llvm] Reapply "[Clang] Implement resolution for CWG1835 (#92957)" (PR #98547)

2024-07-12 Thread Mike Hommey via cfe-commits

glandium wrote:

Well, I guess this is working as intended, as adding `template` before 
`StorageT` fixes it.

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


[clang] [clang] Use different memory layout type for _BitInt(N) in LLVM IR (PR #91364)

2024-07-12 Thread Mariya Podchishchaeva via cfe-commits

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


[clang] [C2y] Add documentation to conform to WG14 N3262; NFC (PR #98146)

2024-07-12 Thread via cfe-commits

h-vetinari wrote:

Perhaps also update
https://github.com/llvm/llvm-project/blob/345861b186645f82c0b812427fdafe6ebd62a058/clang/www/c_status.html#L1283-L1285

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


[clang] [clang] Use different memory layout type for _BitInt(N) in LLVM IR (PR #91364)

2024-07-12 Thread Mariya Podchishchaeva via cfe-commits

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


[clang] [libclang/python] Refactor enum usage (PR #95608)

2024-07-12 Thread Jannick Kremer via cfe-commits

DeinAlptraum wrote:

CI is done, so could you merge this? Thanks for the reviews and support 
@Endilll!

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


[clang] [llvm] [X86][MC] Added support for -msse2avx option in llvm-mc (PR #96860)

2024-07-12 Thread via cfe-commits

https://github.com/JaydeepChauhan14 updated 
https://github.com/llvm/llvm-project/pull/96860

>From b4a534ad6f811cf0868b7fd1ee641fae8502e171 Mon Sep 17 00:00:00 2001
From: Chauhan Jaydeep Ashwinbhai 
Date: Thu, 27 Jun 2024 15:17:50 +0800
Subject: [PATCH 01/14] [X86][MC] Added support for -msse2avx option in llvm-mc

---
 llvm/include/llvm/MC/MCTargetOptions.h|  1 +
 .../llvm/MC/MCTargetOptionsCommandFlags.h |  2 +
 llvm/lib/MC/MCTargetOptions.cpp   |  2 +-
 llvm/lib/MC/MCTargetOptionsCommandFlags.cpp   |  6 ++
 .../lib/Target/X86/AsmParser/X86AsmParser.cpp | 20 +
 llvm/test/MC/AsmParser/sse2avx.s  | 74 +++
 .../utils/TableGen/X86InstrMappingEmitter.cpp | 28 +++
 7 files changed, 132 insertions(+), 1 deletion(-)
 create mode 100644 llvm/test/MC/AsmParser/sse2avx.s

diff --git a/llvm/include/llvm/MC/MCTargetOptions.h 
b/llvm/include/llvm/MC/MCTargetOptions.h
index 0cf2806bd4804..90fe356d47077 100644
--- a/llvm/include/llvm/MC/MCTargetOptions.h
+++ b/llvm/include/llvm/MC/MCTargetOptions.h
@@ -55,6 +55,7 @@ class MCTargetOptions {
   bool ShowMCEncoding : 1;
   bool ShowMCInst : 1;
   bool AsmVerbose : 1;
+  bool SSE2AVX : 1;
 
   /// Preserve Comments in Assembly.
   bool PreserveAsmComments : 1;
diff --git a/llvm/include/llvm/MC/MCTargetOptionsCommandFlags.h 
b/llvm/include/llvm/MC/MCTargetOptionsCommandFlags.h
index dc33f7461ab28..2b5f74fc6c1d8 100644
--- a/llvm/include/llvm/MC/MCTargetOptionsCommandFlags.h
+++ b/llvm/include/llvm/MC/MCTargetOptionsCommandFlags.h
@@ -41,6 +41,8 @@ bool getEmitCompactUnwindNonCanonical();
 
 bool getShowMCInst();
 
+bool getSSE2AVX();
+
 bool getFatalWarnings();
 
 bool getNoWarn();
diff --git a/llvm/lib/MC/MCTargetOptions.cpp b/llvm/lib/MC/MCTargetOptions.cpp
index bff4b8da2fb1b..227d9fc347e71 100644
--- a/llvm/lib/MC/MCTargetOptions.cpp
+++ b/llvm/lib/MC/MCTargetOptions.cpp
@@ -16,7 +16,7 @@ MCTargetOptions::MCTargetOptions()
   MCNoWarn(false), MCNoDeprecatedWarn(false), MCNoTypeCheck(false),
   MCSaveTempLabels(false), MCIncrementalLinkerCompatible(false),
   FDPIC(false), ShowMCEncoding(false), ShowMCInst(false), 
AsmVerbose(false),
-  PreserveAsmComments(true), Dwarf64(false),
+  SSE2AVX(false), PreserveAsmComments(true), Dwarf64(false),
   EmitDwarfUnwind(EmitDwarfUnwindType::Default),
   MCUseDwarfDirectory(DefaultDwarfDirectory),
   EmitCompactUnwindNonCanonical(false), PPCUseFullRegisterNames(false) {}
diff --git a/llvm/lib/MC/MCTargetOptionsCommandFlags.cpp 
b/llvm/lib/MC/MCTargetOptionsCommandFlags.cpp
index 2c378643797da..6de42fa981e6d 100644
--- a/llvm/lib/MC/MCTargetOptionsCommandFlags.cpp
+++ b/llvm/lib/MC/MCTargetOptionsCommandFlags.cpp
@@ -42,6 +42,7 @@ MCOPT(bool, Dwarf64)
 MCOPT(EmitDwarfUnwindType, EmitDwarfUnwind)
 MCOPT(bool, EmitCompactUnwindNonCanonical)
 MCOPT(bool, ShowMCInst)
+MCOPT(bool, SSE2AVX)
 MCOPT(bool, FatalWarnings)
 MCOPT(bool, NoWarn)
 MCOPT(bool, NoDeprecatedWarn)
@@ -107,6 +108,10 @@ 
llvm::mc::RegisterMCTargetOptionsFlags::RegisterMCTargetOptionsFlags() {
   cl::desc("Emit internal instruction representation to assembly file"));
   MCBINDOPT(ShowMCInst);
 
+  static cl::opt SSE2AVX(
+  "msse2avx", cl::desc("Convert SSE Instructions to AVX Instructions"));
+  MCBINDOPT(SSE2AVX);
+
   static cl::opt FatalWarnings("fatal-warnings",
  cl::desc("Treat warnings as errors"));
   MCBINDOPT(FatalWarnings);
@@ -156,6 +161,7 @@ MCTargetOptions llvm::mc::InitMCTargetOptionsFromFlags() {
   Options.Dwarf64 = getDwarf64();
   Options.DwarfVersion = getDwarfVersion();
   Options.ShowMCInst = getShowMCInst();
+  Options.SSE2AVX = getSSE2AVX();
   Options.ABIName = getABIName();
   Options.MCFatalWarnings = getFatalWarnings();
   Options.MCNoWarn = getNoWarn();
diff --git a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp 
b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
index dbea42d55b5fc..ab70fdbc70caa 100644
--- a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
+++ b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
@@ -58,6 +58,10 @@ static bool checkScale(unsigned Scale, StringRef &ErrMsg) {
 
 namespace {
 
+// Including the generated SSE2AVX compression tables.
+#define GET_X86_SSE2AVX_TABLE
+#include "X86GenInstrMapping.inc"
+
 static const char OpPrecedence[] = {
 0,  // IC_OR
 1,  // IC_XOR
@@ -4141,6 +4145,15 @@ unsigned X86AsmParser::checkTargetMatchPredicate(MCInst 
&Inst) {
   return Match_Success;
 }
 
+void ReplaceSSE2AVXOpcode(llvm::MCInst &Inst) {
+  ArrayRef Table{X86SSE2AVXTable};
+  unsigned Opcode = Inst.getOpcode();
+  const auto I = llvm::lower_bound(Table, Opcode);
+  if (I != Table.end() && I->OldOpc == Opcode) {
+Inst.setOpcode(I->NewOpc);
+  }
+}
+
 bool X86AsmParser::matchAndEmitATTInstruction(
 SMLoc IDLoc, unsigned &Opcode, MCInst &Inst, OperandVector &Operands,
 MCStreamer &Out, uint64_t &ErrorInfo, bool MatchingInlineAsm) {
@@ -4159,6 +4172,13 @@ bool X86AsmParser::mat

[clang] [llvm] [X86][MC] Added support for -msse2avx option in llvm-mc (PR #96860)

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

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

LGTM

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


[clang] [llvm] [X86][MC] Added support for -msse2avx option in llvm-mc (PR #96860)

2024-07-12 Thread via cfe-commits


@@ -3745,7 +3749,27 @@ bool X86AsmParser::ParseInstruction(ParseInstructionInfo 
&Info, StringRef Name,
   return false;
 }
 
+static void replaceSSE2AVXOpcode(MCInst &Inst) {
+  ArrayRef Table{X86SSE2AVXTable};
+  unsigned Opcode = Inst.getOpcode();
+  const auto I = llvm::lower_bound(Table, Opcode);
+  if (I != Table.end() && I->OldOpc == Opcode)
+Inst.setOpcode(I->NewOpc);
+
+  if (X86::isBLENDVPD(Opcode) || X86::isBLENDVPS(Opcode) ||
+  X86::isPBLENDVB(Opcode)) {
+unsigned RegNo = Inst.getOperand(2).getReg();
+Inst.addOperand(MCOperand::createReg(RegNo));
+  }
+}
+
 bool X86AsmParser::processInstruction(MCInst &Inst, const OperandVector &Ops) {
+  // When "-msse2avx" option is enabled replaceSSE2AVXOpcode method will
+  // replace SSE instruction with equivalent AVX instruction using mapping 
given
+  // in table GET_X86_SSE2AVX_TABLE

JaydeepChauhan14 wrote:

Done

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


[clang] [llvm] [X86][MC] Added support for -msse2avx option in llvm-mc (PR #96860)

2024-07-12 Thread via cfe-commits


@@ -3745,7 +3749,27 @@ bool X86AsmParser::ParseInstruction(ParseInstructionInfo 
&Info, StringRef Name,
   return false;
 }
 
+static void replaceSSE2AVXOpcode(MCInst &Inst) {
+  ArrayRef Table{X86SSE2AVXTable};
+  unsigned Opcode = Inst.getOpcode();
+  const auto I = llvm::lower_bound(Table, Opcode);
+  if (I != Table.end() && I->OldOpc == Opcode)
+Inst.setOpcode(I->NewOpc);
+
+  if (X86::isBLENDVPD(Opcode) || X86::isBLENDVPS(Opcode) ||
+  X86::isPBLENDVB(Opcode)) {
+unsigned RegNo = Inst.getOperand(2).getReg();
+Inst.addOperand(MCOperand::createReg(RegNo));
+  }
+}
+
 bool X86AsmParser::processInstruction(MCInst &Inst, const OperandVector &Ops) {
+  // When "-msse2avx" option is enabled replaceSSE2AVXOpcode method will
+  // replace SSE instruction with equivalent AVX instruction using mapping 
given
+  // in table GET_X86_SSE2AVX_TABLE
+  if (MCOptions.X86Sse2Avx)
+replaceSSE2AVXOpcode(Inst);

JaydeepChauhan14 wrote:

Done

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


[clang] [llvm] [X86][MC] Added support for -msse2avx option in llvm-mc (PR #96860)

2024-07-12 Thread via cfe-commits


@@ -8367,6 +8369,9 @@ void ClangAs::AddX86TargetArgs(const ArgList &Args,
   addX86AlignBranchArgs(getToolChain().getDriver(), Args, CmdArgs,
 /*IsLTO=*/false);
 
+  if (Args.hasArg(options::OPT_msse2avx))
+Args.AddLastArg(CmdArgs, options::OPT_msse2avx);
+

JaydeepChauhan14 wrote:

Done

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


[clang] [llvm] [X86][MC] Added support for -msse2avx option in llvm-mc (PR #96860)

2024-07-12 Thread via cfe-commits


@@ -140,6 +141,10 @@ 
llvm::mc::RegisterMCTargetOptionsFlags::RegisterMCTargetOptionsFlags() {
   cl::init(true));
   MCBINDOPT(X86RelaxRelocations);
 
+  static cl::opt X86Sse2Avx(
+  "x86-sse2avx", cl::desc("Convert SSE Instructions to AVX Instructions"));

JaydeepChauhan14 wrote:

Done

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


[clang] [llvm] [X86][MC] Added support for -msse2avx option in llvm-mc (PR #96860)

2024-07-12 Thread via cfe-commits


@@ -0,0 +1,3 @@
+// RUN: %clang -### -c -march=x86-64 -msse2avx %s 2>&1 | FileCheck %s

JaydeepChauhan14 wrote:

Done

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


[clang] [llvm] [X86][MC] Added support for -msse2avx option in llvm-mc (PR #96860)

2024-07-12 Thread via cfe-commits


@@ -0,0 +1,88 @@
+# RUN: llvm-mc -triple x86_64 -x86-asm-syntax=intel -x86-sse2avx %s | 
FileCheck %s

JaydeepChauhan14 wrote:

Done

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


[clang] [llvm] [X86][MC,Driver] Support -msse2avx to encode SSE instruction with VEX prefix (PR #96860)

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

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


[clang] [llvm] [X86][MC,Driver] Support -msse2avx to encode SSE instruction with VEX prefix (PR #96860)

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

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


[clang] [llvm] [X86][MC,Driver] Support -msse2avx to encode SSE instruction with VEX prefix (PR #96860)

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

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


[clang] [llvm] [AArch64] Make user-visible Arm architecture version strings consistent (PR #98550)

2024-07-12 Thread Tomas Matheson via cfe-commits

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


[clang] [llvm] [AArch64] Make user-visible Arm architecture version strings consistent (PR #98550)

2024-07-12 Thread Tomas Matheson via cfe-commits

https://github.com/tmatheson-arm approved this pull request.

LGTM. Seems like there are still many more inconsistencies that could be 
improved too.

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


[clang] [llvm] [AArch64] Make user-visible Arm architecture version strings consistent (PR #98550)

2024-07-12 Thread Tomas Matheson via cfe-commits


@@ -65,7 +65,7 @@ class ExtensionWithMArch<
 
 let ArchExtKindSpelling = "AEK_FP", UserVisibleName = "fp" in
 def FeatureFPARMv8 : ExtensionWithMArch<"fp-armv8", "FPARMv8", "FEAT_FP",
-  "Enable ARMv8">;
+  "Enable Armv8.0-A Floating Point Extensions">;

tmatheson-arm wrote:

We could drop the "Enable"

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


[clang] [llvm] [AArch64] Make user-visible Arm architecture version strings consistent (PR #98550)

2024-07-12 Thread Tomas Matheson via cfe-commits


@@ -210,29 +210,29 @@ def FeatureDotProd : ExtensionWithMArch<"dotprod", 
"DotProd", "FEAT_DotProd",
   "Enable dot product support", [FeatureNEON]>;
 
 def FeatureMPAM : Extension<"mpam", "MPAM", "FEAT_MPAM",
-  "Enable v8.4-A Memory system Partitioning and Monitoring extension">;
+  "Enable Armv8.4-A Memory system Partitioning and Monitoring extension">;
 
 def FeatureDIT : ExtensionWithMArch<"dit", "DIT", "FEAT_DIT",
-  "Enable v8.4-A Data Independent Timing instructions">;
+  "Enable Armv8.4-A Data Independent Timing instructions">;
 
 def FeatureTRACEV8_4 : Extension<"tracev8.4", "TRACEV8_4", "FEAT_TRF",
-  "Enable v8.4-A Trace extension">;
+  "Enable Armv8.4-A Trace extension">;
 
 def FeatureAM : Extension<"am", "AM", "FEAT_AMUv1",
-  "Enable v8.4-A Activity Monitors extension">;
+  "Enable Armv8.4-A Activity Monitors extension">;
 
 def FeatureSEL2 : Extension<"sel2", "SEL2", "FEAT_SEL2",
-  "Enable v8.4-A Secure Exception Level 2 extension">;
+  "Enable Armv8.4-A Secure Exception Level 2 extension">;
 
 def FeatureTLB_RMI : Extension<"tlb-rmi", "TLB_RMI",
   "FEAT_TLBIOS, FEAT_TLBIRANGE",
-  "Enable v8.4-A TLB Range and Maintenance Instructions">;
+  "Enable Armv8.4-A TLB Range and Maintenance Instructions">;

tmatheson-arm wrote:

"Instructions" vs "instructions"

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


[clang] [llvm] [AArch64] Make user-visible Arm architecture version strings consistent (PR #98550)

2024-07-12 Thread Tomas Matheson via cfe-commits


@@ -89,14 +89,14 @@ def FeatureCrypto : ExtensionWithMArch<"crypto", "Crypto", 
"FEAT_Crypto",
   "Enable cryptographic instructions", [FeatureNEON, FeatureSHA2, FeatureAES]>;
 
 def FeatureCRC : ExtensionWithMArch<"crc", "CRC", "FEAT_CRC32",
-  "Enable ARMv8 CRC-32 checksum instructions">;
+  "Enable Armv8.0-A CRC-32 checksum instructions">;
 
 // This SubtargetFeature is special. It controls only whether codegen will turn
 // `llvm.readcyclecounter()` into an access to a PMUv3 System Register. The
 // `FEAT_PMUv3*` system registers are always available for 
assembly/disassembly.
 let UserVisibleName = "pmuv3" in
 def FeaturePerfMon : ExtensionWithMArch<"perfmon", "PerfMon", "FEAT_PMUv3",
-  "Enable Code Generation for ARMv8 PMUv3 Performance Monitors extension">;
+  "Enable Armv8.0-A Code Generation for PMUv3 Performance Monitors extension">;

tmatheson-arm wrote:

```suggestion
  "Enable Armv8.0-A PMUv3 Performance Monitors extension">;
```


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


[clang] [llvm] [AArch64] Make user-visible Arm architecture version strings consistent (PR #98550)

2024-07-12 Thread Tomas Matheson via cfe-commits


@@ -106,24 +106,24 @@ def FeatureSpecRestrict : Extension<"specrestrict", 
"SpecRestrict", "FEAT_CSV2_2
 
//===--===//
 
 def FeatureLSE : ExtensionWithMArch<"lse", "LSE", "FEAT_LSE",
-  "Enable ARMv8.1 Large System Extension (LSE) atomic instructions">;
+  "Enable Armv8.1-A Large System Extension (LSE) atomic instructions">;
 
 let UserVisibleAlias = "rdma" in
 def FeatureRDM : ExtensionWithMArch<"rdm", "RDM", "FEAT_RDM",
-  "Enable ARMv8.1 Rounding Double Multiply Add/Subtract instructions",
+  "Enable Armv8.1-A Rounding Double Multiply Add/Subtract instructions",
   [FeatureNEON]>;
 
 def FeaturePAN : Extension<"pan", "PAN", "FEAT_PAN",
-  "Enables ARM v8.1 Privileged Access-Never extension">;
+  "Enable Armv8.1-A Privileged Access-Never extension">;

tmatheson-arm wrote:

"extension" vs "instructions"

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


[clang] [llvm] [AArch64] Make user-visible Arm architecture version strings consistent (PR #98550)

2024-07-12 Thread Tomas Matheson via cfe-commits


@@ -472,22 +472,22 @@ def FeatureFP8 : ExtensionWithMArch<"fp8", "FP8", 
"FEAT_FP8",
   "Enable FP8 instructions", [FeatureFAMINMAX, FeatureLUT, FeatureBF16]>;
   
 def FeatureFP8FMA : ExtensionWithMArch<"fp8fma", "FP8FMA", "FEAT_FP8FMA",
-  "Enable fp8 multiply-add instructions", [FeatureFP8]>;
+  "Enable FP8 multiply-add instructions", [FeatureFP8]>;

tmatheson-arm wrote:

No architecture for these ones?

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


[clang] [llvm] [X86][MC,Driver] Support -msse2avx to encode SSE instruction with VEX prefix (PR #96860)

2024-07-12 Thread Simon Pilgrim via cfe-commits

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

LGTM - cheers

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


[clang] f34a165 - [NFC][Clang] Move set functions out BranchProtectionInfo. (#98451)

2024-07-12 Thread via cfe-commits

Author: Daniel Kiss
Date: 2024-07-12T10:58:34+02:00
New Revision: f34a1654d6f7d1b072a01e690f2330cfb2ca07d8

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

LOG: [NFC][Clang] Move set functions out BranchProtectionInfo. (#98451)

To reduce build times move them to TargetCodeGenInfo.

Refactor of #98329

Added: 


Modified: 
clang/include/clang/Basic/TargetInfo.h
clang/lib/CodeGen/TargetInfo.cpp
clang/lib/CodeGen/TargetInfo.h
clang/lib/CodeGen/Targets/AArch64.cpp
clang/lib/CodeGen/Targets/ARM.cpp

Removed: 




diff  --git a/clang/include/clang/Basic/TargetInfo.h 
b/clang/include/clang/Basic/TargetInfo.h
index cf7628553647c..a58fb5f979272 100644
--- a/clang/include/clang/Basic/TargetInfo.h
+++ b/clang/include/clang/Basic/TargetInfo.h
@@ -32,9 +32,7 @@
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/StringSet.h"
 #include "llvm/Frontend/OpenMP/OMPGridValues.h"
-#include "llvm/IR/Attributes.h"
 #include "llvm/IR/DerivedTypes.h"
-#include "llvm/IR/Function.h"
 #include "llvm/Support/DataTypes.h"
 #include "llvm/Support/Error.h"
 #include "llvm/Support/VersionTuple.h"
@@ -1410,7 +1408,6 @@ class TargetInfo : public TransferrableTargetInfo,
 bool BranchProtectionPAuthLR;
 bool GuardedControlStack;
 
-  protected:
 const char *getSignReturnAddrStr() const {
   switch (SignReturnAddr) {
   case LangOptions::SignReturnAddressScopeKind::None:
@@ -1433,7 +1430,6 @@ class TargetInfo : public TransferrableTargetInfo,
   llvm_unreachable("Unexpected SignReturnAddressKeyKind");
 }
 
-  public:
 BranchProtectionInfo()
 : SignReturnAddr(LangOptions::SignReturnAddressScopeKind::None),
   SignKey(LangOptions::SignReturnAddressKeyKind::AKey),
@@ -1454,25 +1450,6 @@ class TargetInfo : public TransferrableTargetInfo,
   BranchProtectionPAuthLR = LangOpts.BranchProtectionPAuthLR;
   GuardedControlStack = LangOpts.GuardedControlStack;
 }
-
-void setFnAttributes(llvm::Function &F) {
-  llvm::AttrBuilder FuncAttrs(F.getContext());
-  setFnAttributes(FuncAttrs);
-  F.addFnAttrs(FuncAttrs);
-}
-
-void setFnAttributes(llvm::AttrBuilder &FuncAttrs) {
-  if (SignReturnAddr != LangOptions::SignReturnAddressScopeKind::None) {
-FuncAttrs.addAttribute("sign-return-address", getSignReturnAddrStr());
-FuncAttrs.addAttribute("sign-return-address-key", getSignKeyStr());
-  }
-  if (BranchTargetEnforcement)
-FuncAttrs.addAttribute("branch-target-enforcement");
-  if (BranchProtectionPAuthLR)
-FuncAttrs.addAttribute("branch-protection-pauth-lr");
-  if (GuardedControlStack)
-FuncAttrs.addAttribute("guarded-control-stack");
-}
   };
 
   /// Determine if the Architecture in this TargetInfo supports branch

diff  --git a/clang/lib/CodeGen/TargetInfo.cpp 
b/clang/lib/CodeGen/TargetInfo.cpp
index 60224d458f6a2..38faa50cf19cf 100644
--- a/clang/lib/CodeGen/TargetInfo.cpp
+++ b/clang/lib/CodeGen/TargetInfo.cpp
@@ -19,6 +19,7 @@
 #include "clang/CodeGen/CGFunctionInfo.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/Twine.h"
+#include "llvm/IR/Function.h"
 #include "llvm/IR/Type.h"
 #include "llvm/Support/raw_ostream.h"
 
@@ -206,6 +207,27 @@ llvm::Value *TargetCodeGenInfo::createEnqueuedBlockKernel(
   return F;
 }
 
+void TargetCodeGenInfo::setBranchProtectionFnAttributes(
+const TargetInfo::BranchProtectionInfo &BPI, llvm::Function &F) {
+  llvm::AttrBuilder FuncAttrs(F.getContext());
+  setBranchProtectionFnAttributes(BPI, FuncAttrs);
+  F.addFnAttrs(FuncAttrs);
+}
+
+void TargetCodeGenInfo::setBranchProtectionFnAttributes(
+const TargetInfo::BranchProtectionInfo &BPI, llvm::AttrBuilder &FuncAttrs) 
{
+  if (BPI.SignReturnAddr != LangOptions::SignReturnAddressScopeKind::None) {
+FuncAttrs.addAttribute("sign-return-address", BPI.getSignReturnAddrStr());
+FuncAttrs.addAttribute("sign-return-address-key", BPI.getSignKeyStr());
+  }
+  if (BPI.BranchTargetEnforcement)
+FuncAttrs.addAttribute("branch-target-enforcement");
+  if (BPI.BranchProtectionPAuthLR)
+FuncAttrs.addAttribute("branch-protection-pauth-lr");
+  if (BPI.GuardedControlStack)
+FuncAttrs.addAttribute("guarded-control-stack");
+}
+
 namespace {
 class DefaultTargetCodeGenInfo : public TargetCodeGenInfo {
 public:

diff  --git a/clang/lib/CodeGen/TargetInfo.h b/clang/lib/CodeGen/TargetInfo.h
index f242d9e36ed40..0925609cc74aa 100644
--- a/clang/lib/CodeGen/TargetInfo.h
+++ b/clang/lib/CodeGen/TargetInfo.h
@@ -15,11 +15,12 @@
 #define LLVM_CLANG_LIB_CODEGEN_TARGETINFO_H
 
 #include "CGBuilder.h"
-#include "CodeGenModule.h"
 #include "CGValue.h"
+#include "CodeGenModule.h"
 #include "clang/AST/Type.h"
 #include "clang/Basic/LLVM.h"
 #include "clang/Basic/SyncSc

[clang] [NFC][Clang] Move set functions out BranchProtectionInfo. (PR #98451)

2024-07-12 Thread Daniel Kiss via cfe-commits

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


[clang] [Clang][AST] Move NamespaceDecl bits to DeclContext (PR #98567)

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

Endilll wrote:

Worth noting I've been investigating in the background whether we can do the 
opposite transformation, i.e. move members of `*Bits` back to their respective 
classes without increasing size of AST nodes. If anything, for the sake of 
debugging experience. The prototype is here: https://godbolt.org/z/4b7Gv9Eb8, 
but there's still some work to do before the deployment, because it uncovered 
false-positives in our diagnostics.

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


[clang] a4cdd94 - [libclang/python] Refactor enum usage (#95608)

2024-07-12 Thread via cfe-commits

Author: Jannick Kremer
Date: 2024-07-12T13:03:17+04:00
New Revision: a4cdd94ed0afe76854f837ce3c49c74e712d721d

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

LOG: [libclang/python] Refactor enum usage (#95608)

Use Python's builtin enum class instead of writing our own.

This is preparation for passing a strict type check in PR #78114 ,
fixing 927 out of 1341 strict typing errors

-

Co-authored-by: Jannick Kremer 
Co-authored-by: Vlad Serebrennikov 

Added: 


Modified: 
clang/bindings/python/clang/cindex.py
clang/bindings/python/tests/cindex/test_enums.py
clang/bindings/python/tests/cindex/test_token_kind.py
clang/docs/ReleaseNotes.rst

Removed: 
clang/bindings/python/clang/enumerations.py



diff  --git a/clang/bindings/python/clang/cindex.py 
b/clang/bindings/python/clang/cindex.py
index b3d51e4d2a668..1d3ab89190407 100644
--- a/clang/bindings/python/clang/cindex.py
+++ b/clang/bindings/python/clang/cindex.py
@@ -64,10 +64,9 @@
 
 from ctypes import *
 
-import clang.enumerations
-
 import collections.abc
 import os
+from enum import Enum
 
 
 # Python 3 strings are unicode, translate them to/from utf8 for C-interop.
@@ -572,107 +571,51 @@ def get_tokens(tu, extent):
 yield token
 
 
-class TokenKind:
-"""Describes a specific type of a Token."""
-
-_value_map = {}  # int -> TokenKind
-
-def __init__(self, value, name):
-"""Create a new TokenKind instance from a numeric value and a name."""
-self.value = value
-self.name = name
-
-def __repr__(self):
-return "TokenKind.%s" % (self.name,)
-
-@staticmethod
-def from_value(value):
-"""Obtain a registered TokenKind instance from its value."""
-result = TokenKind._value_map.get(value, None)
-
-if result is None:
-raise ValueError("Unknown TokenKind: %d" % value)
-
-return result
-
-@staticmethod
-def register(value, name):
-"""Register a new TokenKind enumeration.
-
-This should only be called at module load time by code within this
-package.
-"""
-if value in TokenKind._value_map:
-raise ValueError("TokenKind already registered: %d" % value)
-
-kind = TokenKind(value, name)
-TokenKind._value_map[value] = kind
-setattr(TokenKind, name, kind)
-
-
 ### Cursor Kinds ###
-class BaseEnumeration:
+class BaseEnumeration(Enum):
 """
 Common base class for named enumerations held in sync with Index.h values.
-
-Subclasses must define their own _kinds and _name_map members, as:
-_kinds = []
-_name_map = None
-These values hold the per-subclass instances and value-to-name mappings,
-respectively.
-
 """
 
-def __init__(self, value):
-if value >= len(self.__class__._kinds):
-self.__class__._kinds += [None] * (value - 
len(self.__class__._kinds) + 1)
-if self.__class__._kinds[value] is not None:
-raise ValueError(
-"{0} value {1} already loaded".format(str(self.__class__), 
value)
-)
-self.value = value
-self.__class__._kinds[value] = self
-self.__class__._name_map = None
 
 def from_param(self):
 return self.value
 
-@property
-def name(self):
-"""Get the enumeration name of this cursor kind."""
-if self._name_map is None:
-self._name_map = {}
-for key, value in self.__class__.__dict__.items():
-if isinstance(value, self.__class__):
-self._name_map[value] = key
-return self._name_map[self]
-
 @classmethod
 def from_id(cls, id):
-if id < 0 or id >= len(cls._kinds) or cls._kinds[id] is None:
-raise ValueError("Unknown template argument kind %d" % id)
-return cls._kinds[id]
+return cls(id)
 
 def __repr__(self):
 return "%s.%s" % (
-self.__class__,
+self.__class__.__name__,
 self.name,
 )
 
 
+class TokenKind(BaseEnumeration):
+"""Describes a specific type of a Token."""
+
+@classmethod
+def from_value(cls, value):
+"""Obtain a registered TokenKind instance from its value."""
+return cls.from_id(value)
+
+PUNCTUATION = 0
+KEYWORD = 1
+IDENTIFIER = 2
+LITERAL = 3
+COMMENT = 4
+
+
 class CursorKind(BaseEnumeration):
 """
 A CursorKind describes the kind of entity that a cursor points to.
 """
 
-# The required BaseEnumeration declarations.
-_kinds = []
-_name_map = None
-
 @staticmethod
 def get_all_kinds():
 """Return all CursorKind enumeration instances."""
-return [x for x in CursorKind._kinds if not x is None

[clang] [libclang/python] Refactor enum usage (PR #95608)

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

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


[clang] Retrieve BinaryOperator::getOpcode and BinaryOperator::getOpcodeStr via libclang and its python interface (PR #98489)

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

Endilll wrote:

#95608 has been merged.

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


[clang] [Clang][ARM][AArch64] Add branch protection attributes to the defaults. (PR #83277)

2024-07-12 Thread Daniel Kiss via cfe-commits

https://github.com/DanielKristofKiss updated 
https://github.com/llvm/llvm-project/pull/83277

>From 0c3118713387246dc1c503f3792ba5af82e6b5eb Mon Sep 17 00:00:00 2001
From: Daniel Kiss 
Date: Wed, 28 Feb 2024 15:18:31 +0100
Subject: [PATCH 1/8] Add branch protection attributes to the defaults.

These attributes are no longer inherited from the module flags,
therefore need to be added for synthetic functions.
---
 clang/lib/CodeGen/CGCall.cpp  | 16 ++
 .../CodeGenCXX/arm64-generated-fn-attr.cpp| 30 +++
 2 files changed, 46 insertions(+)
 create mode 100644 clang/test/CodeGenCXX/arm64-generated-fn-attr.cpp

diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index 7e7b2b395f7d6..7b93f6d2dded1 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -2030,6 +2030,22 @@ static void getTrivialDefaultFunctionAttributes(
 std::tie(Var, Value) = Attr.split('=');
 FuncAttrs.addAttribute(Var, Value);
   }
+
+  TargetInfo::BranchProtectionInfo BPI(LangOpts);
+
+  if (BPI.SignReturnAddr != LangOptions::SignReturnAddressScopeKind::None) {
+FuncAttrs.addAttribute("sign-return-address", BPI.getSignReturnAddrStr());
+FuncAttrs.addAttribute(
+"sign-return-address-key",
+BPI.SignKey == LangOptions::SignReturnAddressKeyKind::AKey ? "a_key"
+   : "b_key");
+  }
+  if (BPI.BranchTargetEnforcement)
+FuncAttrs.addAttribute("branch-target-enforcement", "true");
+  if (BPI.BranchProtectionPAuthLR)
+FuncAttrs.addAttribute("branch-protection-pauth-lr", "true");
+  if (BPI.GuardedControlStack)
+FuncAttrs.addAttribute("guarded-control-stack", "true");
 }
 
 /// Merges `target-features` from \TargetOpts and \F, and sets the result in
diff --git a/clang/test/CodeGenCXX/arm64-generated-fn-attr.cpp 
b/clang/test/CodeGenCXX/arm64-generated-fn-attr.cpp
new file mode 100644
index 0..8daf44abd4f91
--- /dev/null
+++ b/clang/test/CodeGenCXX/arm64-generated-fn-attr.cpp
@@ -0,0 +1,30 @@
+// RUN: %clang_cc1 -triple aarch64-none-none -mbranch-target-enforce 
-msign-return-address=all -fcxx-exceptions -fexceptions -emit-llvm %s -o - | 
FileCheck %s --check-prefixes=CHECK
+
+// Check that functions generated by clang have the correct attributes
+
+class Example {
+public:
+  Example();
+  int fn();
+};
+
+// Initialization of var1 causes __cxx_global_var_init and __tls_init to be 
generated
+thread_local Example var1;
+extern thread_local Example var2;
+extern void fn();
+
+int testfn() noexcept {
+  // Calling fn in a noexcept function causes __clang_call_terminate to be 
generated
+  fn();
+  // Use of var1 and var2 causes TLS wrapper functions to be generated
+  return var1.fn() + var2.fn();
+}
+
+// CHECK: define {{.*}} @__cxx_global_var_init() [[ATTR1:#[0-9]+]]
+// CHECK: define {{.*}} @__clang_call_terminate({{.*}}) [[ATTR2:#[0-9]+]]
+// CHECK: define {{.*}} @_ZTW4var1() [[ATTR1]]
+// CHECK: define {{.*}} @_ZTW4var2() [[ATTR1]]
+// CHECK: define {{.*}} @__tls_init() [[ATTR1]]
+
+// CHECK: attributes [[ATTR1]] = { 
{{.*}}"branch-target-enforcement"="true"{{.*}}"sign-return-address"="all" 
"sign-return-address-key"="a_key"
+// CHECK: attributes [[ATTR2]] = { 
{{.*}}"branch-target-enforcement"="true"{{.*}}"sign-return-address"="all" 
"sign-return-address-key"="a_key"

>From 0e2a9e129bcb4f569a443494b9266ae482c73c94 Mon Sep 17 00:00:00 2001
From: Daniel Kiss 
Date: Wed, 28 Feb 2024 17:38:49 +0100
Subject: [PATCH 2/8] fixup! [Clang][Arm][AArch64] Add branch protection
 attributes to the defaults.

---
 clang/lib/CodeGen/CGCall.cpp | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index 7b93f6d2dded1..131666d732b3d 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -2035,10 +2035,7 @@ static void getTrivialDefaultFunctionAttributes(
 
   if (BPI.SignReturnAddr != LangOptions::SignReturnAddressScopeKind::None) {
 FuncAttrs.addAttribute("sign-return-address", BPI.getSignReturnAddrStr());
-FuncAttrs.addAttribute(
-"sign-return-address-key",
-BPI.SignKey == LangOptions::SignReturnAddressKeyKind::AKey ? "a_key"
-   : "b_key");
+FuncAttrs.addAttribute("sign-return-address-key", BPI.getSignKeyStr());
   }
   if (BPI.BranchTargetEnforcement)
 FuncAttrs.addAttribute("branch-target-enforcement", "true");

>From 735d24d5fe8bb4f37d87cb2345cbe45d53b1ba42 Mon Sep 17 00:00:00 2001
From: Daniel Kiss 
Date: Mon, 4 Mar 2024 17:31:31 +0100
Subject: [PATCH 3/8] Move TargetInfo changes over.

Dropping restrictions on the member functions.
---
 clang/include/clang/Basic/TargetInfo.h | 15 ---
 1 file changed, 15 deletions(-)

diff --git a/clang/include/clang/Basic/TargetInfo.h 
b/clang/include/clang/Basic/TargetInfo.h
index 1f208b40f92cb..d8075ee97972e 1

[clang] [llvm] [RISCV][FMV] Support target_clones (PR #85786)

2024-07-12 Thread Piyou Chen via cfe-commits

https://github.com/BeMg updated https://github.com/llvm/llvm-project/pull/85786

>From 38e5bef5d20d7e81170720eb56354c0392f5c902 Mon Sep 17 00:00:00 2001
From: Piyou Chen 
Date: Wed, 5 Jun 2024 01:17:03 -0700
Subject: [PATCH 1/3] [RISCV] Add groupid/bitmask for RISC-V extension

Base on https://github.com/riscv-non-isa/riscv-c-api-doc/pull/74.

This patch defines the groupid/bitmask in RISCVFeatures.td and generates the 
corresponding table in RISCVTargetParserDef.inc.

The groupid/bitmask of extensions provides an abstraction layer between the 
compiler and runtime functions.
---
 .../llvm/TargetParser/RISCVTargetParser.h |   8 ++
 llvm/lib/Target/RISCV/RISCVFeatures.td| 131 --
 llvm/lib/TargetParser/RISCVTargetParser.cpp   |  32 +
 llvm/test/TableGen/riscv-target-def.td|  18 ++-
 llvm/utils/TableGen/RISCVTargetDefEmitter.cpp |  37 +
 5 files changed, 183 insertions(+), 43 deletions(-)

diff --git a/llvm/include/llvm/TargetParser/RISCVTargetParser.h 
b/llvm/include/llvm/TargetParser/RISCVTargetParser.h
index 5b1494efe7bdc..e998bc4ca59ee 100644
--- a/llvm/include/llvm/TargetParser/RISCVTargetParser.h
+++ b/llvm/include/llvm/TargetParser/RISCVTargetParser.h
@@ -24,6 +24,14 @@ class Triple;
 
 namespace RISCV {
 
+namespace RISCVExtensionBitmaskTable {
+struct RISCVExtensionBitmask {
+  const char *Name;
+  unsigned GroupID;
+  unsigned BitPosition;
+};
+} // namespace RISCVExtensionBitmaskTable
+
 // We use 64 bits as the known part in the scalable vector types.
 static constexpr unsigned RVVBitsPerBlock = 64;
 
diff --git a/llvm/lib/Target/RISCV/RISCVFeatures.td 
b/llvm/lib/Target/RISCV/RISCVFeatures.td
index d3cb2aeab41cb..125e9e2f53953 100644
--- a/llvm/lib/Target/RISCV/RISCVFeatures.td
+++ b/llvm/lib/Target/RISCV/RISCVFeatures.td
@@ -37,6 +37,15 @@ class RISCVExtension groupID, int bitmaskShift> {
+int GroupID = groupID;
+int BitPos = bitmaskShift;
+}
+
 // Version of RISCVExtension to be used for Experimental extensions. This
 // sets the Experimental flag and prepends experimental- to the -mattr name.
 class RISCVExperimentalExtension;
+ "'I' (Base Integer Instruction Set)">,
+  RISCVExtensionBitmask<0, 8>;
 
 def FeatureStdExtE
 : RISCVExtension<"e", 2, 0,
@@ -78,7 +88,8 @@ def HasStdExtZicbop : 
Predicate<"Subtarget->hasStdExtZicbop()">,
 
 def FeatureStdExtZicboz
 : RISCVExtension<"zicboz", 1, 0,
- "'Zicboz' (Cache-Block Zero Instructions)">;
+ "'Zicboz' (Cache-Block Zero Instructions)">,
+  RISCVExtensionBitmask<0, 37>;
 def HasStdExtZicboz : Predicate<"Subtarget->hasStdExtZicboz()">,
   AssemblerPredicate<(all_of FeatureStdExtZicboz),
   "'Zicboz' (Cache-Block Zero Instructions)">;
@@ -113,7 +124,8 @@ def FeatureStdExtZicntr
 
 def FeatureStdExtZicond
 : RISCVExtension<"zicond", 1, 0,
- "'Zicond' (Integer Conditional Operations)">;
+ "'Zicond' (Integer Conditional Operations)">,
+  RISCVExtensionBitmask<0, 38>;
 def HasStdExtZicond : Predicate<"Subtarget->hasStdExtZicond()">,
   AssemblerPredicate<(all_of FeatureStdExtZicond),
   "'Zicond' (Integer Conditional Operations)">;
@@ -134,7 +146,8 @@ def HasStdExtZihintpause : 
Predicate<"Subtarget->hasStdExtZihintpause()">,
 
 def FeatureStdExtZihintntl
 : RISCVExtension<"zihintntl", 1, 0,
- "'Zihintntl' (Non-Temporal Locality Hints)">;
+ "'Zihintntl' (Non-Temporal Locality Hints)">,
+  RISCVExtensionBitmask<0, 39>;
 def HasStdExtZihintntl : Predicate<"Subtarget->hasStdExtZihintntl()">,
  AssemblerPredicate<(all_of FeatureStdExtZihintntl),
  "'Zihintntl' (Non-Temporal Locality Hints)">;
@@ -181,7 +194,8 @@ def HasStdExtZmmul : 
Predicate<"Subtarget->hasStdExtZmmul()">,
 def FeatureStdExtM
 : RISCVExtension<"m", 2, 0,
  "'M' (Integer Multiplication and Division)",
- [FeatureStdExtZmmul]>;
+ [FeatureStdExtZmmul]>,
+  RISCVExtensionBitmask<0, 12>;
 def HasStdExtM : Predicate<"Subtarget->hasStdExtM()">,
  AssemblerPredicate<(all_of FeatureStdExtM),
  "'M' (Integer Multiplication and Division)">;
@@ -190,14 +204,16 @@ def HasStdExtM : Predicate<"Subtarget->hasStdExtM()">,
 
 def FeatureStdExtA
 : RISCVExtension<"a", 2, 1,
- "'A' (Atomic Instructions)">;
+ "'A' (Atomic Instructions)">,
+  RISCVExtensionBitmask<0, 0>;
 def HasStdExtA : Predicate<"Subtarget->hasStdExtA()">,
  AssemblerPredicate<(all_of FeatureStdExtA),
 "'A' (Atomic Instructions)">;
 
 def FeatureStdExtZtso
 : RISCVExtension<"ztso", 1, 0,
- "'Ztso' (Memory Model - Total Store Order)">;
+ "'Zt

[clang-tools-extra] [clang-doc] modify basic-project test (PR #97684)

2024-07-12 Thread via cfe-commits

https://github.com/PeterChou1 updated 
https://github.com/llvm/llvm-project/pull/97684

>From 778f43dd6505c41d4175c1fe717b8cf79d7a43fc Mon Sep 17 00:00:00 2001
From: PeterChou1 
Date: Thu, 4 Jul 2024 02:52:11 -0400
Subject: [PATCH 1/2] [clang-doc] modify basic-project test

---
 .../test/clang-doc/basic-project.test | 543 --
 1 file changed, 243 insertions(+), 300 deletions(-)

diff --git a/clang-tools-extra/test/clang-doc/basic-project.test 
b/clang-tools-extra/test/clang-doc/basic-project.test
index bab5f8e1761bc..2e708aa97bdef 100644
--- a/clang-tools-extra/test/clang-doc/basic-project.test
+++ b/clang-tools-extra/test/clang-doc/basic-project.test
@@ -54,306 +54,249 @@
 // JSON-INDEX-NEXT: };
 // JSON-INDEX-NEXT: }
 
-// HTML-SHAPE: 
-// HTML-SHAPE-NEXT: 
-// HTML-SHAPE-NEXT: class Shape
-// HTML-SHAPE-NEXT: 
-// HTML-SHAPE-NEXT: 
-// HTML-SHAPE-NEXT: 
-// HTML-SHAPE-NEXT: 
-// HTML-SHAPE-NEXT: 
-// HTML-SHAPE-NEXT:   
-// HTML-SHAPE-NEXT:   
-// HTML-SHAPE-NEXT: class Shape
-// HTML-SHAPE-NEXT: Defined at line 8 of file {{.*}}Shape.h
-// HTML-SHAPE-NEXT: 
-// HTML-SHAPE-NEXT:   
-// HTML-SHAPE-NEXT:  Provides a common interface for different 
types of shapes.
-// HTML-SHAPE-NEXT:   
-// HTML-SHAPE-NEXT: 
-// HTML-SHAPE-NEXT: Functions
-// HTML-SHAPE-NEXT: 
-// HTML-SHAPE-NEXT:   ~Shape
-// HTML-SHAPE-NEXT:   public void ~Shape()
-// HTML-SHAPE-NEXT:   Defined at line 13 of file {{.*}}Shape.h
-// HTML-SHAPE-NEXT:   
-// HTML-SHAPE-NEXT: 
-// HTML-SHAPE-NEXT:   
-// HTML-SHAPE-NEXT:   area
-// HTML-SHAPE-NEXT:   public double area()
-// HTML-SHAPE-NEXT:   
-// HTML-SHAPE-NEXT: 
-// HTML-SHAPE-NEXT:   
-// HTML-SHAPE-NEXT:   perimeter
-// HTML-SHAPE-NEXT:   public double perimeter()
-// HTML-SHAPE-NEXT:   
-// HTML-SHAPE-NEXT: 
-// HTML-SHAPE-NEXT:   
-// HTML-SHAPE-NEXT: 
-// HTML-SHAPE-NEXT:   
-// HTML-SHAPE-NEXT:   
-// HTML-SHAPE-NEXT: 
-// HTML-SHAPE-NEXT:   
-// HTML-SHAPE-NEXT: 
-// HTML-SHAPE-NEXT:   Functions
-// HTML-SHAPE-NEXT: 
-// HTML-SHAPE-NEXT: 
-// HTML-SHAPE-NEXT:   
-// HTML-SHAPE-NEXT: 
-// HTML-SHAPE-NEXT:   ~Shape
-// HTML-SHAPE-NEXT: 
-// HTML-SHAPE-NEXT:   
-// HTML-SHAPE-NEXT:   
-// HTML-SHAPE-NEXT: 
-// HTML-SHAPE-NEXT:   area
-// HTML-SHAPE-NEXT: 
-// HTML-SHAPE-NEXT:   
-// HTML-SHAPE-NEXT:   
-// HTML-SHAPE-NEXT: 
-// HTML-SHAPE-NEXT:   perimeter
-// HTML-SHAPE-NEXT: 
-// HTML-SHAPE-NEXT:   
-// HTML-SHAPE-NEXT: 
-// HTML-SHAPE-NEXT:   
-// HTML-SHAPE-NEXT: 
-// HTML-SHAPE-NEXT:   
-// HTML-SHAPE-NEXT: 
+// HTML-SHAPE: class Shape
+// HTML-SHAPE: Defined at line 8 of file {{.*}}Shape.h
+// HTML-SHAPE: 
+// HTML-SHAPE:   
+// HTML-SHAPE:  Provides a common interface for different types of 
shapes.
+// HTML-SHAPE:   
+// HTML-SHAPE: 
+// HTML-SHAPE: Functions
+// HTML-SHAPE: 
+// HTML-SHAPE:   ~Shape
+// HTML-SHAPE:   public void ~Shape()
+// HTML-SHAPE:   Defined at line 13 of file {{.*}}Shape.h
+// HTML-SHAPE:   
+// HTML-SHAPE: 
+// HTML-SHAPE:   
+// HTML-SHAPE:   area
+// HTML-SHAPE:   public double area()
+// HTML-SHAPE:   
+// HTML-SHAPE: 
+// HTML-SHAPE:   
+// HTML-SHAPE:   perimeter
+// HTML-SHAPE:   public double perimeter()
+// HTML-SHAPE:   
+// HTML-SHAPE: 
+// HTML-SHAPE:   
+// HTML-SHAPE: 
 
-// HTML-CALC: 
-// HTML-CALC-NEXT: 
-// HTML-CALC-NEXT: class Calculator
-// HTML-CALC-NEXT: 
-// HTML-CALC-NEXT: 
-// HTML-CALC-NEXT: 
-// HTML-CALC-NEXT: 
-// HTML-CALC-NEXT: 
-// HTML-CALC-NEXT:   
-// HTML-CALC-NEXT:   
-// HTML-CALC-NEXT: class Calculator
-// HTML-CALC-NEXT: Defined at line 8 of file {{.*}}Calculator.h
-// HTML-CALC-NEXT: 
-// HTML-CALC-NEXT:   
-// HTML-CALC-NEXT:  Provides basic arithmetic operations.
-// HTML-CALC-NEXT:   
-// HTML-CALC-NEXT: 
-// HTML-CALC-NEXT: Functions
-// HTML-CALC-NEXT: 
-// HTML-CALC-NEXT:   add
-// HTML-CALC-NEXT:   public int add(int a, int b)
-// HTML-CALC-NEXT:   Defined at line 3 of file {{.*}}Calculator.cpp
-// HTML-CALC-NEXT:   
-// HTML-CALC-NEXT: 
-// HTML-CALC-NEXT:   
-// HTML-CALC-NEXT:   subtract
-// HTML-CALC-NEXT:   public int subtract(int a, int b)
-// HTML-CALC-NEXT:   Defined at line 7 of file {{.*}}Calculator.cpp
-// HTML-CALC-NEXT:   
-// HTML-CALC-NEXT: 
-// HTML-CALC-NEXT:   
-// HTML-CALC-NEXT:   multiply
-// HTML-CALC-NEXT:   public int multiply(int a, int b)
-// HTML-CALC-NEXT:   Defined at line 11 of file {{.*}}Calculator.cpp
-// HTML-CALC-NEXT:   
-// HTML-CALC-NEXT: 
-// HTML-CALC-NEXT:   
-// HTML-CALC-NEXT:   divide
-// HTML-CALC-NEXT:   public double divide(int a, int b)
-// HTML-CALC-NEXT:   D

[clang] [llvm] [RISCV][FMV] Support target_clones (PR #85786)

2024-07-12 Thread via cfe-commits

github-actions[bot] wrote:




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



You can test this locally with the following command:


``bash
git-clang-format --diff 74b933c28e777fdc04e50f5f96e4f7a4ad1e79a6 
0a873d0897fbbf94d46e6fbf129aee3090b4b9c1 --extensions cpp,h,c -- 
clang/test/CodeGen/attr-target-clones-riscv-invaild.c 
clang/test/CodeGen/attr-target-clones-riscv.c 
clang/test/CodeGenCXX/attr-target-clones-riscv.cpp 
clang/test/SemaCXX/attr-target-clones-riscv.cpp 
clang/include/clang/Basic/TargetInfo.h clang/lib/AST/ASTContext.cpp 
clang/lib/CodeGen/CGBuiltin.cpp clang/lib/CodeGen/CodeGenFunction.cpp 
clang/lib/CodeGen/CodeGenFunction.h clang/lib/CodeGen/CodeGenModule.cpp 
clang/lib/CodeGen/Targets/RISCV.cpp clang/lib/Sema/SemaDeclAttr.cpp 
llvm/include/llvm/TargetParser/RISCVTargetParser.h 
llvm/lib/TargetParser/RISCVTargetParser.cpp 
llvm/utils/TableGen/RISCVTargetDefEmitter.cpp
``





View the diff from clang-format here.


``diff
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp 
b/clang/lib/CodeGen/CodeGenFunction.cpp
index 27305e0f4b..f2b2915878 100644
--- a/clang/lib/CodeGen/CodeGenFunction.cpp
+++ b/clang/lib/CodeGen/CodeGenFunction.cpp
@@ -2906,9 +2906,9 @@ void CodeGenFunction::EmitRISCVMultiVersionResolver(
   unsigned MaxGroupIDUsed = 0;
   llvm::SmallVector CurrTargetAttrFeats;
 
-  for (auto Feat: TargetAttrFeats)
+  for (auto Feat : TargetAttrFeats)
 CurrTargetAttrFeats.push_back(StringRef(Feat).substr(1));
-  
+
   llvm::Value *SecondCondition =
   EmitRISCVCpuSupports(CurrTargetAttrFeats, MaxGroupIDUsed);
 

``




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


[clang] [llvm] [RISCV][FMV] Support target_clones (PR #85786)

2024-07-12 Thread Piyou Chen via cfe-commits

https://github.com/BeMg updated https://github.com/llvm/llvm-project/pull/85786

>From 38e5bef5d20d7e81170720eb56354c0392f5c902 Mon Sep 17 00:00:00 2001
From: Piyou Chen 
Date: Wed, 5 Jun 2024 01:17:03 -0700
Subject: [PATCH 1/4] [RISCV] Add groupid/bitmask for RISC-V extension

Base on https://github.com/riscv-non-isa/riscv-c-api-doc/pull/74.

This patch defines the groupid/bitmask in RISCVFeatures.td and generates the 
corresponding table in RISCVTargetParserDef.inc.

The groupid/bitmask of extensions provides an abstraction layer between the 
compiler and runtime functions.
---
 .../llvm/TargetParser/RISCVTargetParser.h |   8 ++
 llvm/lib/Target/RISCV/RISCVFeatures.td| 131 --
 llvm/lib/TargetParser/RISCVTargetParser.cpp   |  32 +
 llvm/test/TableGen/riscv-target-def.td|  18 ++-
 llvm/utils/TableGen/RISCVTargetDefEmitter.cpp |  37 +
 5 files changed, 183 insertions(+), 43 deletions(-)

diff --git a/llvm/include/llvm/TargetParser/RISCVTargetParser.h 
b/llvm/include/llvm/TargetParser/RISCVTargetParser.h
index 5b1494efe7bdc..e998bc4ca59ee 100644
--- a/llvm/include/llvm/TargetParser/RISCVTargetParser.h
+++ b/llvm/include/llvm/TargetParser/RISCVTargetParser.h
@@ -24,6 +24,14 @@ class Triple;
 
 namespace RISCV {
 
+namespace RISCVExtensionBitmaskTable {
+struct RISCVExtensionBitmask {
+  const char *Name;
+  unsigned GroupID;
+  unsigned BitPosition;
+};
+} // namespace RISCVExtensionBitmaskTable
+
 // We use 64 bits as the known part in the scalable vector types.
 static constexpr unsigned RVVBitsPerBlock = 64;
 
diff --git a/llvm/lib/Target/RISCV/RISCVFeatures.td 
b/llvm/lib/Target/RISCV/RISCVFeatures.td
index d3cb2aeab41cb..125e9e2f53953 100644
--- a/llvm/lib/Target/RISCV/RISCVFeatures.td
+++ b/llvm/lib/Target/RISCV/RISCVFeatures.td
@@ -37,6 +37,15 @@ class RISCVExtension groupID, int bitmaskShift> {
+int GroupID = groupID;
+int BitPos = bitmaskShift;
+}
+
 // Version of RISCVExtension to be used for Experimental extensions. This
 // sets the Experimental flag and prepends experimental- to the -mattr name.
 class RISCVExperimentalExtension;
+ "'I' (Base Integer Instruction Set)">,
+  RISCVExtensionBitmask<0, 8>;
 
 def FeatureStdExtE
 : RISCVExtension<"e", 2, 0,
@@ -78,7 +88,8 @@ def HasStdExtZicbop : 
Predicate<"Subtarget->hasStdExtZicbop()">,
 
 def FeatureStdExtZicboz
 : RISCVExtension<"zicboz", 1, 0,
- "'Zicboz' (Cache-Block Zero Instructions)">;
+ "'Zicboz' (Cache-Block Zero Instructions)">,
+  RISCVExtensionBitmask<0, 37>;
 def HasStdExtZicboz : Predicate<"Subtarget->hasStdExtZicboz()">,
   AssemblerPredicate<(all_of FeatureStdExtZicboz),
   "'Zicboz' (Cache-Block Zero Instructions)">;
@@ -113,7 +124,8 @@ def FeatureStdExtZicntr
 
 def FeatureStdExtZicond
 : RISCVExtension<"zicond", 1, 0,
- "'Zicond' (Integer Conditional Operations)">;
+ "'Zicond' (Integer Conditional Operations)">,
+  RISCVExtensionBitmask<0, 38>;
 def HasStdExtZicond : Predicate<"Subtarget->hasStdExtZicond()">,
   AssemblerPredicate<(all_of FeatureStdExtZicond),
   "'Zicond' (Integer Conditional Operations)">;
@@ -134,7 +146,8 @@ def HasStdExtZihintpause : 
Predicate<"Subtarget->hasStdExtZihintpause()">,
 
 def FeatureStdExtZihintntl
 : RISCVExtension<"zihintntl", 1, 0,
- "'Zihintntl' (Non-Temporal Locality Hints)">;
+ "'Zihintntl' (Non-Temporal Locality Hints)">,
+  RISCVExtensionBitmask<0, 39>;
 def HasStdExtZihintntl : Predicate<"Subtarget->hasStdExtZihintntl()">,
  AssemblerPredicate<(all_of FeatureStdExtZihintntl),
  "'Zihintntl' (Non-Temporal Locality Hints)">;
@@ -181,7 +194,8 @@ def HasStdExtZmmul : 
Predicate<"Subtarget->hasStdExtZmmul()">,
 def FeatureStdExtM
 : RISCVExtension<"m", 2, 0,
  "'M' (Integer Multiplication and Division)",
- [FeatureStdExtZmmul]>;
+ [FeatureStdExtZmmul]>,
+  RISCVExtensionBitmask<0, 12>;
 def HasStdExtM : Predicate<"Subtarget->hasStdExtM()">,
  AssemblerPredicate<(all_of FeatureStdExtM),
  "'M' (Integer Multiplication and Division)">;
@@ -190,14 +204,16 @@ def HasStdExtM : Predicate<"Subtarget->hasStdExtM()">,
 
 def FeatureStdExtA
 : RISCVExtension<"a", 2, 1,
- "'A' (Atomic Instructions)">;
+ "'A' (Atomic Instructions)">,
+  RISCVExtensionBitmask<0, 0>;
 def HasStdExtA : Predicate<"Subtarget->hasStdExtA()">,
  AssemblerPredicate<(all_of FeatureStdExtA),
 "'A' (Atomic Instructions)">;
 
 def FeatureStdExtZtso
 : RISCVExtension<"ztso", 1, 0,
- "'Ztso' (Memory Model - Total Store Order)">;
+ "'Zt

[clang-tools-extra] [clang-doc] add nested namespace test case (PR #97681)

2024-07-12 Thread via cfe-commits

https://github.com/PeterChou1 updated 
https://github.com/llvm/llvm-project/pull/97681

>From f9d5cc074e4b65a92703bd09e62696a29fed1237 Mon Sep 17 00:00:00 2001
From: PeterChou1 
Date: Thu, 4 Jul 2024 01:31:13 -0400
Subject: [PATCH 1/3] [clang-doc] add nested naemspace

---
 .../test/clang-doc/namespace.cpp  | 340 ++
 1 file changed, 340 insertions(+)
 create mode 100644 clang-tools-extra/test/clang-doc/namespace.cpp

diff --git a/clang-tools-extra/test/clang-doc/namespace.cpp 
b/clang-tools-extra/test/clang-doc/namespace.cpp
new file mode 100644
index 0..6fb91c9aa3c51
--- /dev/null
+++ b/clang-tools-extra/test/clang-doc/namespace.cpp
@@ -0,0 +1,340 @@
+// RUN: clang-doc --format=html --output=%t/docs --executor=standalone %s
+// RUN: clang-doc --format=md --output=%t/docs --executor=standalone %s
+// RUN: FileCheck %s -input-file=%t/docs/index_json.js -check-prefix=JSON-INDEX
+// RUN: FileCheck %s -input-file=%t/docs/@nonymous_namespace/AnonClass.html 
-check-prefix=HTML-ANON-CLASS
+// RUN: FileCheck %s -input-file=%t/docs/@nonymous_namespace/index.html 
-check-prefix=HTML-ANON-INDEX
+// RUN: FileCheck %s 
-input-file=%t/docs/AnotherNamespace/ClassInAnotherNamespace.html 
-check-prefix=HTML-ANOTHER-CLASS
+// RUN: FileCheck %s -input-file=%t/docs/AnotherNamespace/index.html 
-check-prefix=HTML-ANOTHER-INDEX
+// RUN: FileCheck %s -input-file=%t/docs/GlobalNamespace/index.html 
-check-prefix=HTML-GLOBAL-INDEX
+// RUN: FileCheck %s 
-input-file=%t/docs/PrimaryNamespace/NestedNamespace/ClassInNestedNamespace.html
 -check-prefix=HTML-NESTED-CLASS
+// RUN: FileCheck %s 
-input-file=%t/docs/PrimaryNamespace/NestedNamespace/index.html 
-check-prefix=HTML-NESTED-INDEX
+// RUN: FileCheck %s -input-file=%t/docs/PrimaryNamespace/index.html 
-check-prefix=HTML-PRIMARY-INDEX
+// RUN: FileCheck %s 
-input-file=%t/docs/PrimaryNamespace/ClassInPrimaryNamespace.html 
-check-prefix=HTML-PRIMARY-CLASS
+// RUN: FileCheck %s -input-file=%t/docs/@nonymous_namespace/AnonClass.md 
-check-prefix=MD-ANON-CLASS
+// RUN: FileCheck %s -input-file=%t/docs/@nonymous_namespace/index.md 
-check-prefix=MD-ANON-INDEX
+// RUN: FileCheck %s 
-input-file=%t/docs/AnotherNamespace/ClassInAnotherNamespace.md 
-check-prefix=MD-ANOTHER-CLASS
+// RUN: FileCheck %s -input-file=%t/docs/AnotherNamespace/index.md 
-check-prefix=MD-ANOTHER-INDEX
+// RUN: FileCheck %s -input-file=%t/docs/GlobalNamespace/index.md 
-check-prefix=MD-GLOBAL-INDEX
+// RUN: FileCheck %s 
-input-file=%t/docs/PrimaryNamespace/NestedNamespace/ClassInNestedNamespace.md 
-check-prefix=MD-NESTED-CLASS
+// RUN: FileCheck %s 
-input-file=%t/docs/PrimaryNamespace/NestedNamespace/index.md 
-check-prefix=MD-NESTED-INDEX
+// RUN: FileCheck %s -input-file=%t/docs/PrimaryNamespace/index.md 
-check-prefix=MD-PRIMARY-INDEX
+// RUN: FileCheck %s 
-input-file=%t/docs/PrimaryNamespace/ClassInPrimaryNamespace.md 
-check-prefix=MD-PRIMARY-CLASS
+// RUN: FileCheck %s -input-file=%t/docs/all_files.md 
-check-prefix=MD-ALL-FILES
+// RUN: FileCheck %s -input-file=%t/docs/index.md -check-prefix=MD-INDEX
+
+// Anonymous Namespace
+namespace
+{
+void anonFunction() {}
+class AnonClass {};
+}
+
+// Primary Namespace
+namespace PrimaryNamespace {
+// Function in PrimaryNamespace
+void functionInPrimaryNamespace() {}
+
+// Class in PrimaryNamespace
+class ClassInPrimaryNamespace {};
+
+// Nested namespace
+namespace NestedNamespace {
+// Function in NestedNamespace
+void functionInNestedNamespace() {}
+// Class in NestedNamespace
+class ClassInNestedNamespace {};
+}
+}
+
+// AnotherNamespace
+namespace AnotherNamespace {
+// Function in AnotherNamespace
+void functionInAnotherNamespace() {}
+// Class in AnotherNamespace
+class ClassInAnotherNamespace {};
+}
+
+// JSON-INDEX: async function LoadIndex() {
+// JSON-INDEX-NEXT: return{
+// JSON-INDEX-NEXT:   "USR": "{{([0-9A-F]{40})}}",
+// JSON-INDEX-NEXT:   "Name": "",
+// JSON-INDEX-NEXT:   "RefType": "default",
+// JSON-INDEX-NEXT:   "Path": "",
+// JSON-INDEX-NEXT:   "Children": [
+// JSON-INDEX-NEXT: {
+// JSON-INDEX-NEXT:   "USR": "{{([0-9A-F]{40})}}",
+// JSON-INDEX-NEXT:   "Name": "@nonymous_namespace",
+// JSON-INDEX-NEXT:   "RefType": "namespace",
+// JSON-INDEX-NEXT:   "Path": "@nonymous_namespace",
+// JSON-INDEX-NEXT:   "Children": [
+// JSON-INDEX-NEXT: {
+// JSON-INDEX-NEXT:   "USR": "{{([0-9A-F]{40})}}",
+// JSON-INDEX-NEXT:   "Name": "AnonClass",
+// JSON-INDEX-NEXT:   "RefType": "record",
+// JSON-INDEX-NEXT:   "Path": "@nonymous_namespace",
+// JSON-INDEX-NEXT:   "Children": []
+// JSON-INDEX-NEXT: }
+// JSON-INDEX-NEXT:   ]
+// JSON-INDEX-NEXT: },
+// JSON-INDEX-NEXT: {
+// JSON-INDEX-NEXT:   "USR": "{{([0-9A-F]{40})}}",
+// JSON-INDEX-NEXT:   "Name": "AnotherNamespace",
+// JSON-INDEX-NEXT:   "RefType": "namespace",
+

[clang-tools-extra] [clang-doc] add enum test (PR #97679)

2024-07-12 Thread via cfe-commits

https://github.com/PeterChou1 updated 
https://github.com/llvm/llvm-project/pull/97679

>From b5e0335199541225a1b0eb5eaf661cd4df55dbd7 Mon Sep 17 00:00:00 2001
From: PeterChou1 
Date: Thu, 4 Jul 2024 01:14:11 -0400
Subject: [PATCH 1/4] [clang-doc] add enum test

---
 clang-tools-extra/test/clang-doc/enum.cpp | 38 +++
 1 file changed, 38 insertions(+)
 create mode 100644 clang-tools-extra/test/clang-doc/enum.cpp

diff --git a/clang-tools-extra/test/clang-doc/enum.cpp 
b/clang-tools-extra/test/clang-doc/enum.cpp
new file mode 100644
index 0..2f25eaf4e44e2
--- /dev/null
+++ b/clang-tools-extra/test/clang-doc/enum.cpp
@@ -0,0 +1,38 @@
+// RUN: clang-doc --format=html --doxygen --output=%t/docs 
--executor=standalone %s
+// RUN: clang-doc --format=md --doxygen --output=%t/docs --executor=standalone 
%s
+// RUN: FileCheck %s -input-file=%t/docs/GlobalNamespace/index.html 
-check-prefix=HTML-INDEX
+// RUN: FileCheck %s -input-file=%t/docs/GlobalNamespace/index.md 
-check-prefix=MD-INDEX
+
+/**
+ * @brief For specifying RGB colors
+ */
+enum Color {
+  Red, // Red enums
+  Green, // Green enums
+  Blue // Blue enums
+};
+
+// HTML-INDEX: Global Namespace
+// HTML-INDEX: Enums
+// HTML-INDEX: 
+// HTML-INDEX:   enum Color
+// HTML-INDEX:   
+// HTML-INDEX: Red
+// HTML-INDEX: Green
+// HTML-INDEX: Blue
+// HTML-INDEX:   
+// HTML-INDEX:   Defined at line 11 of file 
{{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}enum.cpp
+// HTML-INDEX:   
+// HTML-INDEX: 
+// HTML-INDEX:   
+// HTML-INDEX: 
+
+// MD-INDEX: # Global Namespace
+// MD-INDEX: ## Enums
+// MD-INDEX: | enum Color |
+// MD-INDEX: --
+// MD-INDEX: | Red |
+// MD-INDEX: | Green |
+// MD-INDEX: | Blue |
+// MD-INDEX: *Defined at 
{{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}enum.cpp#11*
+// MD-INDEX: **brief** For specifying RGB colors
\ No newline at end of file

>From c10f9d42c26e6d26833a35824216529ab25e7fe8 Mon Sep 17 00:00:00 2001
From: PeterChou1 
Date: Thu, 4 Jul 2024 01:53:19 -0400
Subject: [PATCH 2/4] [clang-doc] update defined at line

---
 clang-tools-extra/test/clang-doc/enum.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang-tools-extra/test/clang-doc/enum.cpp 
b/clang-tools-extra/test/clang-doc/enum.cpp
index 2f25eaf4e44e2..1e7dd6e4c5b0c 100644
--- a/clang-tools-extra/test/clang-doc/enum.cpp
+++ b/clang-tools-extra/test/clang-doc/enum.cpp
@@ -21,7 +21,7 @@ enum Color {
 // HTML-INDEX: Green
 // HTML-INDEX: Blue
 // HTML-INDEX:   
-// HTML-INDEX:   Defined at line 11 of file 
{{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}enum.cpp
+// HTML-INDEX:   Defined at line 9 of file 
{{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}enum.cpp
 // HTML-INDEX:   
 // HTML-INDEX: 
 // HTML-INDEX:   

>From 8709091091b0ca889ca7911e06b7a4dae61a3581 Mon Sep 17 00:00:00 2001
From: PeterChou1 
Date: Thu, 4 Jul 2024 02:06:08 -0400
Subject: [PATCH 3/4] [clang-doc] fix lines

---
 clang-tools-extra/test/clang-doc/enum.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang-tools-extra/test/clang-doc/enum.cpp 
b/clang-tools-extra/test/clang-doc/enum.cpp
index 1e7dd6e4c5b0c..5a1452788a55f 100644
--- a/clang-tools-extra/test/clang-doc/enum.cpp
+++ b/clang-tools-extra/test/clang-doc/enum.cpp
@@ -34,5 +34,5 @@ enum Color {
 // MD-INDEX: | Red |
 // MD-INDEX: | Green |
 // MD-INDEX: | Blue |
-// MD-INDEX: *Defined at 
{{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}enum.cpp#11*
+// MD-INDEX: *Defined at 
{{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}enum.cpp#9*
 // MD-INDEX: **brief** For specifying RGB colors
\ No newline at end of file

>From 6b7dbe5b3bf2ceb7fe72ec061e3d9bc3e2609299 Mon Sep 17 00:00:00 2001
From: PeterChou1 
Date: Fri, 12 Jul 2024 05:28:15 -0400
Subject: [PATCH 4/4] [clang-doc] address pr

---
 clang-tools-extra/test/clang-doc/enum.cpp | 28 +--
 1 file changed, 11 insertions(+), 17 deletions(-)

diff --git a/clang-tools-extra/test/clang-doc/enum.cpp 
b/clang-tools-extra/test/clang-doc/enum.cpp
index 5a1452788a55f..971d63e590f2d 100644
--- a/clang-tools-extra/test/clang-doc/enum.cpp
+++ b/clang-tools-extra/test/clang-doc/enum.cpp
@@ -1,31 +1,25 @@
+// RUN: rm -rf %t && mkdir -p %t
 // RUN: clang-doc --format=html --doxygen --output=%t/docs 
--executor=standalone %s
 // RUN: clang-doc --format=md --doxygen --output=%t/docs --executor=standalone 
%s
-// RUN: FileCheck %s -input-file=%t/docs/GlobalNamespace/index.html 
-check-prefix=HTML-INDEX
-// RUN: FileCheck %s -input-file=%t/docs/GlobalNamespace/index.md 
-check-prefix=MD-INDEX
+// RUN: FileCheck %s < %t/docs/GlobalNamespace/index.html 
-check-prefix=HTML-INDEX
+// RUN: FileCheck %s < %t/docs/GlobalNamespace/index.md -check-prefix=MD-INDEX
 
 /**
  * @brief For specifying RGB colors
  */
 enum Color {
-  Red, // Red enums
-  Green, // Green enums
-  Blue // Blue enums
+  Red,
+  Green,
+  Blue
 };
 

[clang-tools-extra] [clang-doc] Add another test project to clang-doc (PR #97518)

2024-07-12 Thread via cfe-commits

PeterChou1 wrote:

> I'm a bit confused by the "advanced project", as it largely seems to be minor 
> extensions to the `basic project`. I would expect that an "advanced project" 
> would use a complicated structure and be much larger. IMO if you're only 
> adding some more language features, then they should be added to the existing 
> `basic_project` already in tree.
Ok, I'll close this pr and another pr once 
https://github.com/llvm/llvm-project/pull/97684 is merged

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


[clang-tools-extra] [clang-doc] Add another test project to clang-doc (PR #97518)

2024-07-12 Thread via cfe-commits

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


[clang] [Clang][Driver] Warn about `-c/-S` with `-fsyntax-only` (PR #98607)

2024-07-12 Thread Dmitriy Chestnykh via cfe-commits

https://github.com/chestnykh created 
https://github.com/llvm/llvm-project/pull/98607

Emit warning that `-S` and/or `-c` arguments are not used if `-fsyntax-only` is 
also passed to clang
`addPGOAndCoverageFlags` is not the right place
to produce this warning
Now `-fsyntax-only -c/-S` combination handles like `-fsyntax-only -E` in 
`BuildJobs()` driver function

>From ae43fc67b7d9db848ec8c4ecbcab1db6af7fcb01 Mon Sep 17 00:00:00 2001
From: Dmitry Chestnykh 
Date: Fri, 12 Jul 2024 12:25:16 +0300
Subject: [PATCH] [Clang][Driver] Warn about `-c/-S` with `-fsyntax-only`

Emit warning that `-S` and/or `-c` arguments are not used
if `-fsyntax-only` is also passed to clang
`addPGOAndCoverageFlags` is not the right place
to produce this warning
Now `-fsyntax-only -c/-S` combination handles like
`-fsyntax-only -E` in `BuildJobs()` driver function
---
 clang/lib/Driver/ToolChains/Clang.cpp | 4 
 clang/test/Driver/warn-fsyntax-only-c-S.c | 9 +
 2 files changed, 9 insertions(+), 4 deletions(-)
 create mode 100644 clang/test/Driver/warn-fsyntax-only-c-S.c

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index 4a674f67b8e1b..4440725ccd923 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -794,10 +794,6 @@ static void addPGOAndCoverageFlags(const ToolChain &TC, 
Compilation &C,
   Args.hasArg(options::OPT_coverage))
 FProfileDir = Args.getLastArg(options::OPT_fprofile_dir);
 
-  // TODO: Don't claim -c/-S to warn about -fsyntax-only -c/-S, -E -c/-S,
-  // like we warn about -fsyntax-only -E.
-  (void)(Args.hasArg(options::OPT_c) || Args.hasArg(options::OPT_S));
-
   // Put the .gcno and .gcda files (if needed) next to the primary output file,
   // or fall back to a file in the current directory for `clang -c --coverage
   // d/a.c` in the absence of -o.
diff --git a/clang/test/Driver/warn-fsyntax-only-c-S.c 
b/clang/test/Driver/warn-fsyntax-only-c-S.c
new file mode 100644
index 0..bb1cd5fd1183c
--- /dev/null
+++ b/clang/test/Driver/warn-fsyntax-only-c-S.c
@@ -0,0 +1,9 @@
+// RUN: %clang -fsyntax-only -S %s 2>&1 | FileCheck %s --check-prefix=CHECK-ASM
+// RUN: %clang -fsyntax-only -c %s 2>&1 | FileCheck %s --check-prefix=CHECK-OBJ
+// RUN: %clang -fsyntax-only -S -c %s 2>&1 | FileCheck %s 
--check-prefix=CHECK-BOTH
+
+// CHECK-ASM: warning: argument unused during compilation: '-S' 
[-Wunused-command-line-argument]
+// CHECK-OBJ: warning: argument unused during compilation: '-c' 
[-Wunused-command-line-argument]
+
+// CHECK-BOTH: warning: argument unused during compilation: '-S' 
[-Wunused-command-line-argument]
+// CHECK-NEXT: warning: argument unused during compilation: '-c' 
[-Wunused-command-line-argument]

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


[clang] [Clang][Driver] Warn about `-c/-S` with `-fsyntax-only` (PR #98607)

2024-07-12 Thread via cfe-commits

llvmbot wrote:



@llvm/pr-subscribers-clang

@llvm/pr-subscribers-clang-driver

Author: Dmitriy Chestnykh (chestnykh)


Changes

Emit warning that `-S` and/or `-c` arguments are not used if `-fsyntax-only` is 
also passed to clang
`addPGOAndCoverageFlags` is not the right place
to produce this warning
Now `-fsyntax-only -c/-S` combination handles like `-fsyntax-only -E` in 
`BuildJobs()` driver function

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


2 Files Affected:

- (modified) clang/lib/Driver/ToolChains/Clang.cpp (-4) 
- (added) clang/test/Driver/warn-fsyntax-only-c-S.c (+9) 


``diff
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index 4a674f67b8e1b..4440725ccd923 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -794,10 +794,6 @@ static void addPGOAndCoverageFlags(const ToolChain &TC, 
Compilation &C,
   Args.hasArg(options::OPT_coverage))
 FProfileDir = Args.getLastArg(options::OPT_fprofile_dir);
 
-  // TODO: Don't claim -c/-S to warn about -fsyntax-only -c/-S, -E -c/-S,
-  // like we warn about -fsyntax-only -E.
-  (void)(Args.hasArg(options::OPT_c) || Args.hasArg(options::OPT_S));
-
   // Put the .gcno and .gcda files (if needed) next to the primary output file,
   // or fall back to a file in the current directory for `clang -c --coverage
   // d/a.c` in the absence of -o.
diff --git a/clang/test/Driver/warn-fsyntax-only-c-S.c 
b/clang/test/Driver/warn-fsyntax-only-c-S.c
new file mode 100644
index 0..bb1cd5fd1183c
--- /dev/null
+++ b/clang/test/Driver/warn-fsyntax-only-c-S.c
@@ -0,0 +1,9 @@
+// RUN: %clang -fsyntax-only -S %s 2>&1 | FileCheck %s --check-prefix=CHECK-ASM
+// RUN: %clang -fsyntax-only -c %s 2>&1 | FileCheck %s --check-prefix=CHECK-OBJ
+// RUN: %clang -fsyntax-only -S -c %s 2>&1 | FileCheck %s 
--check-prefix=CHECK-BOTH
+
+// CHECK-ASM: warning: argument unused during compilation: '-S' 
[-Wunused-command-line-argument]
+// CHECK-OBJ: warning: argument unused during compilation: '-c' 
[-Wunused-command-line-argument]
+
+// CHECK-BOTH: warning: argument unused during compilation: '-S' 
[-Wunused-command-line-argument]
+// CHECK-NEXT: warning: argument unused during compilation: '-c' 
[-Wunused-command-line-argument]

``




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


[clang] [Clang][Driver] Warn about `-c/-S` with `-fsyntax-only` (PR #98607)

2024-07-12 Thread Dmitriy Chestnykh via cfe-commits

chestnykh wrote:

CC: @shafik @ChuanqiXu9

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


[clang] [clang][CGRecordLayout] Remove dependency on isZeroSize (PR #96422)

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

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

>From 07e603f7afc98e5af31962a5b1f44f4e4c079ebb Mon Sep 17 00:00:00 2001
From: Michael Buch 
Date: Fri, 21 Jun 2024 12:15:07 +0100
Subject: [PATCH 01/19] [clang][CGRecordLayout] Remove dependency on isZeroSize

This is a follow-up from the conversation starting at
https://github.com/llvm/llvm-project/pull/93809#issuecomment-2173729801

The root problem that motivated the change are external AST
sources that compute `ASTRecordLayout`s themselves instead of
letting Clang compute them from the AST. One such examples is
LLDB using DWARF to get the definitive offsets and sizes of C++
structures. Such layouts should be considered correct (modulo
buggy DWARF), but various assertions and lowering logic around
the `CGRecordLayoutBuilder` relies on the AST having
`[[no_unique_address]]` attached to them. This is a layout-altering
attribute which is not encoded in DWARF. This causes us LLDB to trip
over the various LLVM<->Clang layout consistency checks. There has been
precedent for avoiding such layout-altering attributes to affect
lowering with externally-provided layouts (e.g., packed structs).

This patch proposes to replace the `isZeroSize` checks in
`CGRecordLayoutBuilder` (which roughly means "empty field
with [[no_unique_address]]") with checks for
`CodeGen::isEmptyField`/`CodeGen::isEmptyRecord`.
---
 clang/lib/CodeGen/ABIInfoImpl.cpp |  6 ++---
 clang/lib/CodeGen/ABIInfoImpl.h   |  6 ++---
 clang/lib/CodeGen/CGExpr.cpp  |  3 ++-
 clang/lib/CodeGen/CGRecordLayoutBuilder.cpp   | 14 ++--
 clang/test/CodeGen/X86/x86_64-vaarg.c |  3 ++-
 clang/test/CodeGen/debug-info-packed-struct.c |  2 +-
 clang/test/CodeGen/paren-list-agg-init.cpp| 15 +
 .../CodeGenCXX/2011-12-19-init-list-ctor.cpp  |  6 ++---
 clang/test/CodeGenCXX/auto-var-init.cpp   | 10 -
 .../test/CodeGenCXX/bitfield-access-empty.cpp | 16 +++---
 clang/test/CodeGenCXX/class-layout.cpp|  2 +-
 clang/test/CodeGenCXX/compound-literals.cpp   |  2 +-
 clang/test/CodeGenCXX/exceptions.cpp  |  7 +++---
 .../lambda-deterministic-captures.cpp |  4 +---
 clang/test/CodeGenCXX/ms_struct.cpp   |  4 +---
 clang/test/CodeGenCXX/partial-destruction.cpp | 11 --
 clang/test/CodeGenCXX/pr18962.cpp |  5 ++---
 clang/test/CodeGenCXX/references.cpp  |  4 +---
 clang/test/CodeGenCXX/temporaries.cpp | 12 +-
 clang/test/CodeGenObjCXX/lambda-to-block.mm   |  9 
 clang/test/OpenMP/irbuilder_for_iterator.cpp  | 10 -
 clang/test/OpenMP/irbuilder_for_rangefor.cpp  | 14 +---
 .../test/OpenMP/task_member_call_codegen.cpp  | 22 ---
 clang/test/Sema/ms_class_layout.cpp   | 14 ++--
 24 files changed, 85 insertions(+), 116 deletions(-)

diff --git a/clang/lib/CodeGen/ABIInfoImpl.cpp 
b/clang/lib/CodeGen/ABIInfoImpl.cpp
index e9a26abb77837..92fcc3bc2c5f4 100644
--- a/clang/lib/CodeGen/ABIInfoImpl.cpp
+++ b/clang/lib/CodeGen/ABIInfoImpl.cpp
@@ -248,7 +248,7 @@ Address CodeGen::emitMergePHI(CodeGenFunction &CGF, Address 
Addr1,
   return Address(PHI, Addr1.getElementType(), Align);
 }
 
-bool CodeGen::isEmptyField(ASTContext &Context, const FieldDecl *FD,
+bool CodeGen::isEmptyField(const ASTContext &Context, const FieldDecl *FD,
bool AllowArrays, bool AsIfNoUniqueAddr) {
   if (FD->isUnnamedBitField())
 return true;
@@ -289,8 +289,8 @@ bool CodeGen::isEmptyField(ASTContext &Context, const 
FieldDecl *FD,
   return isEmptyRecord(Context, FT, AllowArrays, AsIfNoUniqueAddr);
 }
 
-bool CodeGen::isEmptyRecord(ASTContext &Context, QualType T, bool AllowArrays,
-bool AsIfNoUniqueAddr) {
+bool CodeGen::isEmptyRecord(const ASTContext &Context, QualType T,
+bool AllowArrays, bool AsIfNoUniqueAddr) {
   const RecordType *RT = T->getAs();
   if (!RT)
 return false;
diff --git a/clang/lib/CodeGen/ABIInfoImpl.h b/clang/lib/CodeGen/ABIInfoImpl.h
index 92986fb431646..e3f373e39c35a 100644
--- a/clang/lib/CodeGen/ABIInfoImpl.h
+++ b/clang/lib/CodeGen/ABIInfoImpl.h
@@ -126,15 +126,15 @@ Address emitMergePHI(CodeGenFunction &CGF, Address Addr1,
 /// is an unnamed bit-field or an (array of) empty record(s). If
 /// AsIfNoUniqueAddr is true, then C++ record fields are considered empty if
 /// the [[no_unique_address]] attribute would have made them empty.
-bool isEmptyField(ASTContext &Context, const FieldDecl *FD, bool AllowArrays,
-  bool AsIfNoUniqueAddr = false);
+bool isEmptyField(const ASTContext &Context, const FieldDecl *FD,
+  bool AllowArrays, bool AsIfNoUniqueAddr = false);
 
 /// isEmptyRecord - Return true iff a structure contains only empty
 /// fields. Note that a structure with a flexible array member is not
 /// considered empty. If AsIfNoUniqueAddr is true, then C++

[clang] [Clang] Fix parsing of invalid type-requirement (PR #98545)

2024-07-12 Thread via cfe-commits


@@ -11698,6 +11698,13 @@ Sema::ActOnTypenameType(Scope *S, SourceLocation 
TypenameLoc,
 // Construct a dependent template specialization type.
 assert(DTN && "dependent template has non-dependent name?");
 assert(DTN->getQualifier() == SS.getScopeRep());
+

cor3ntin wrote:

In a function called `ActOnTypenameType`?

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


[clang] 70f57d2 - [clang] Catch missing format attributes (#70024)

2024-07-12 Thread via cfe-commits

Author: Budimir Aranđelović
Date: 2024-07-12T11:57:22+02:00
New Revision: 70f57d25743ca7230bcad3cae7e3072f0aded6f7

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

LOG: [clang] Catch missing format attributes (#70024)

Enable flag -Wmissing-format-attribute to catch missing attributes.

Fixes #60718

Added: 
clang/test/Sema/attr-format-missing.c
clang/test/Sema/attr-format-missing.cpp

Modified: 
clang/docs/ReleaseNotes.rst
clang/include/clang/Basic/DiagnosticGroups.td
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/include/clang/Sema/Attr.h
clang/include/clang/Sema/Sema.h
clang/lib/Sema/SemaDecl.cpp
clang/lib/Sema/SemaDeclAttr.cpp

Removed: 




diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index c9b7d4e6d75e0..15439e70c67d4 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -714,6 +714,9 @@ Improvements to Clang's diagnostics
 
 - Clang now diagnoses integer constant expressions that are folded to a 
constant value as an extension in more circumstances. Fixes #GH59863
 
+- Clang now diagnoses missing format attributes for non-template functions and
+  class/struct/union members. Fixes #GH60718
+
 Improvements to Clang's time-trace
 --
 

diff  --git a/clang/include/clang/Basic/DiagnosticGroups.td 
b/clang/include/clang/Basic/DiagnosticGroups.td
index 2241f8481484e..da6a3b2fe3571 100644
--- a/clang/include/clang/Basic/DiagnosticGroups.td
+++ b/clang/include/clang/Basic/DiagnosticGroups.td
@@ -525,7 +525,6 @@ def MainReturnType : DiagGroup<"main-return-type">;
 def MaxUnsignedZero : DiagGroup<"max-unsigned-zero">;
 def MissingBraces : DiagGroup<"missing-braces">;
 def MissingDeclarations: DiagGroup<"missing-declarations">;
-def : DiagGroup<"missing-format-attribute">;
 def MissingIncludeDirs : DiagGroup<"missing-include-dirs">;
 def MissingNoreturn : DiagGroup<"missing-noreturn">;
 def MultiChar : DiagGroup<"multichar">;

diff  --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td 
b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index 0ea3677355169..f5c18edb65217 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -1031,6 +1031,9 @@ def err_opencl_invalid_param : Error<
 def err_opencl_invalid_return : Error<
   "declaring function return value of type %0 is not allowed %select{; did you 
forget * ?|}1">;
 def warn_enum_value_overflow : Warning<"overflow in enumeration value">;
+def warn_missing_format_attribute : Warning<
+  "diagnostic behavior may be improved by adding the %0 format attribute to 
the declaration of %1">,
+  InGroup>, DefaultIgnore;
 def warn_pragma_options_align_reset_failed : Warning<
   "#pragma options align=reset failed: %0">,
   InGroup;

diff  --git a/clang/include/clang/Sema/Attr.h b/clang/include/clang/Sema/Attr.h
index 3f0b10212789a..37c124ca7b454 100644
--- a/clang/include/clang/Sema/Attr.h
+++ b/clang/include/clang/Sema/Attr.h
@@ -123,6 +123,13 @@ inline bool isInstanceMethod(const Decl *D) {
   return false;
 }
 
+inline bool checkIfMethodHasImplicitObjectParameter(const Decl *D) {
+  if (const auto *MethodDecl = dyn_cast(D))
+return MethodDecl->isInstance() &&
+   !MethodDecl->hasCXXExplicitFunctionObjectParameter();
+  return false;
+}
+
 /// Diagnose mutually exclusive attributes when present on a given
 /// declaration. Returns true if diagnosed.
 template 

diff  --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index 6be6f6725e5b7..e30252749d2c3 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -4594,6 +4594,10 @@ class Sema final : public SemaBase {
 
   enum class RetainOwnershipKind { NS, CF, OS };
 
+  void DiagnoseMissingFormatAttributes(Stmt *Body, const FunctionDecl *FDecl);
+  std::vector
+  GetMissingFormatAttributes(Stmt *Body, const FunctionDecl *FDecl);
+
   UuidAttr *mergeUuidAttr(Decl *D, const AttributeCommonInfo &CI,
   StringRef UuidAsWritten, MSGuidDecl *GuidDecl);
 

diff  --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 80b5a8cd4bae6..0039df2a21bc6 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -15934,6 +15934,8 @@ Decl *Sema::ActOnFinishFunctionBody(Decl *dcl, Stmt 
*Body,
 }
   }
 
+  DiagnoseMissingFormatAttributes(Body, FD);
+
   // We might not have found a prototype because we didn't wish to warn on
   // the lack of a missing prototype. Try again without the checks for
   // whether we want to warn on the missing prototype.

diff  --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp
index f2cd46d1e7c93..5166e61bb41d4 100644
---

[clang] [clang] Catch missing format attributes (PR #70024)

2024-07-12 Thread Djordje Todorovic via cfe-commits

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


[clang] [llvm] [AArch64] Make user-visible Arm architecture version strings consistent (PR #98550)

2024-07-12 Thread Sam Elliott via cfe-commits


@@ -89,14 +89,14 @@ def FeatureCrypto : ExtensionWithMArch<"crypto", "Crypto", 
"FEAT_Crypto",
   "Enable cryptographic instructions", [FeatureNEON, FeatureSHA2, FeatureAES]>;
 
 def FeatureCRC : ExtensionWithMArch<"crc", "CRC", "FEAT_CRC32",
-  "Enable ARMv8 CRC-32 checksum instructions">;
+  "Enable Armv8.0-A CRC-32 checksum instructions">;
 
 // This SubtargetFeature is special. It controls only whether codegen will turn
 // `llvm.readcyclecounter()` into an access to a PMUv3 System Register. The
 // `FEAT_PMUv3*` system registers are always available for 
assembly/disassembly.
 let UserVisibleName = "pmuv3" in
 def FeaturePerfMon : ExtensionWithMArch<"perfmon", "PerfMon", "FEAT_PMUv3",
-  "Enable Code Generation for ARMv8 PMUv3 Performance Monitors extension">;
+  "Enable Armv8.0-A Code Generation for PMUv3 Performance Monitors extension">;

lenary wrote:

This feature is different to the rest. the system registers for PMUv3 are 
always enabled for asm/disasm, this feature just says whether some intrinsics 
generate system register accesses. 

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


[clang] [libcxx] [llvm] Reapply "[Clang] Implement resolution for CWG1835 (#92957)" (PR #98547)

2024-07-12 Thread Krystian Stasiowski via cfe-commits

sdkrystian wrote:

@glandium Yes, clang considers `std::move(*this)` to be dependent so `template` 
is required there.

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


[clang] [clang] Catch missing format attributes (PR #70024)

2024-07-12 Thread LLVM Continuous Integration via cfe-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder 
`llvm-clang-x86_64-sie-ubuntu-fast` running on `sie-linux-worker` while 
building `clang` at step 6 "test-build-unified-tree-check-all".

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

Here is the relevant piece of the build log for the reference:
```
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
 TEST 'Clang :: Sema/attr-format-missing.c' FAILED 

Exit Code: 1

Command Output (stderr):
--
RUN: at line 1: 
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/bin/clang 
-cc1 -internal-isystem 
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/lib/clang/19/include
 -nostdsysteminc -fsyntax-only -verify=expected,c_diagnostics 
-Wmissing-format-attribute 
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang/test/Sema/attr-format-missing.c
+ 
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/bin/clang 
-cc1 -internal-isystem 
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/lib/clang/19/include
 -nostdsysteminc -fsyntax-only -verify=expected,c_diagnostics 
-Wmissing-format-attribute 
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang/test/Sema/attr-format-missing.c
error: 'c_diagnostics-warning' diagnostics seen but not expected: 
  File 
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang/test/Sema/attr-format-missing.c
 Line 391: incompatible pointer types passing 'char *' to parameter of type 
'struct __va_list_tag *'
error: 'c_diagnostics-note' diagnostics seen but not expected: 
  File 
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang/test/Sema/attr-format-missing.c
 Line 30: passing argument to parameter here
2 errors generated.

--




```

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


[clang] [clang] Catch missing format attributes (PR #70024)

2024-07-12 Thread LLVM Continuous Integration via cfe-commits

llvm-ci wrote:

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

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

Here is the relevant piece of the build log for the reference:
```
Step 7 (test-build-unified-tree-check-all) failure: test (failure)
 TEST 'Clang :: Sema/attr-format-missing.c' FAILED 

Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
z:\b\llvm-clang-x86_64-sie-win\build\bin\clang.exe -cc1 -internal-isystem 
Z:\b\llvm-clang-x86_64-sie-win\build\lib\clang\19\include -nostdsysteminc 
-fsyntax-only -verify=expected,c_diagnostics -Wmissing-format-attribute 
Z:\b\llvm-clang-x86_64-sie-win\llvm-project\clang\test\Sema\attr-format-missing.c
# executed command: 'z:\b\llvm-clang-x86_64-sie-win\build\bin\clang.exe' -cc1 
-internal-isystem 'Z:\b\llvm-clang-x86_64-sie-win\build\lib\clang\19\include' 
-nostdsysteminc -fsyntax-only -verify=expected,c_diagnostics 
-Wmissing-format-attribute 
'Z:\b\llvm-clang-x86_64-sie-win\llvm-project\clang\test\Sema\attr-format-missing.c'
# .---command stderr
# | error: 'c_diagnostics-warning' diagnostics seen but not expected: 
# |   File 
Z:\b\llvm-clang-x86_64-sie-win\llvm-project\clang\test\Sema\attr-format-missing.c
 Line 391: incompatible pointer types passing 'char *' to parameter of type 
'struct __va_list_tag *'
# | error: 'c_diagnostics-note' diagnostics seen but not expected: 
# |   File 
Z:\b\llvm-clang-x86_64-sie-win\llvm-project\clang\test\Sema\attr-format-missing.c
 Line 30: passing argument to parameter here
# | 2 errors generated.
# `-
# error: command failed with exit status: 1

--




```

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


[clang] Retrieve BinaryOperator::getOpcode and BinaryOperator::getOpcodeStr via libclang and its python interface (PR #98489)

2024-07-12 Thread Thomas Wucher via cfe-commits

thomaswucher wrote:

Thanks for your note @Endilll! I've rebased my changes to the latest main 
branch. Could you give this a review? Thanks in advance!

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


[clang] [llvm] [AArch64] Make user-visible Arm architecture version strings consistent (PR #98550)

2024-07-12 Thread Jack Styles via cfe-commits


@@ -106,24 +106,24 @@ def FeatureSpecRestrict : Extension<"specrestrict", 
"SpecRestrict", "FEAT_CSV2_2
 
//===--===//
 
 def FeatureLSE : ExtensionWithMArch<"lse", "LSE", "FEAT_LSE",
-  "Enable ARMv8.1 Large System Extension (LSE) atomic instructions">;
+  "Enable Armv8.1-A Large System Extension (LSE) atomic instructions">;
 
 let UserVisibleAlias = "rdma" in
 def FeatureRDM : ExtensionWithMArch<"rdm", "RDM", "FEAT_RDM",
-  "Enable ARMv8.1 Rounding Double Multiply Add/Subtract instructions",
+  "Enable Armv8.1-A Rounding Double Multiply Add/Subtract instructions",
   [FeatureNEON]>;
 
 def FeaturePAN : Extension<"pan", "PAN", "FEAT_PAN",
-  "Enables ARM v8.1 Privileged Access-Never extension">;
+  "Enable Armv8.1-A Privileged Access-Never extension">;

Stylie777 wrote:

I personally prefer `extensions` to `instructions` in these cases, and these 
should be consistent for all features.

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


[clang] [llvm] [AArch64] Make user-visible Arm architecture version strings consistent (PR #98550)

2024-07-12 Thread Tomas Matheson via cfe-commits

tmatheson-arm wrote:

> Seems like there are still many more inconsistencies that could be improved 
> too.

To be clear, I'm not suggesting you need to do them in this PR.

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


[clang] [clang-tools-extra] [Clang][AST] Move NamespaceDecl bits to DeclContext (PR #98567)

2024-07-12 Thread Krystian Stasiowski via cfe-commits

https://github.com/sdkrystian updated 
https://github.com/llvm/llvm-project/pull/98567

>From 63a9c69cc5c4d6f8048918addfb01de6dc212524 Mon Sep 17 00:00:00 2001
From: Krystian Stasiowski 
Date: Thu, 20 Jun 2024 11:44:53 -0400
Subject: [PATCH 1/2] [Clang][AST] Move NamespaceDecl bits to DeclContext

---
 clang/include/clang/AST/Decl.h| 67 +--
 clang/include/clang/AST/DeclBase.h| 24 
 clang/lib/AST/ASTContext.cpp  |  8 +--
 clang/lib/AST/DeclBase.cpp|  3 +-
 clang/lib/AST/DeclCXX.cpp | 31 ++-
 clang/lib/AST/ItaniumMangle.cpp   |  2 +-
 clang/lib/AST/JSONNodeDumper.cpp  |  5 +-
 clang/lib/AST/TextNodeDumper.cpp  |  4 +-
 clang/lib/Sema/SemaCodeComplete.cpp   |  2 +-
 clang/lib/Sema/SemaLookup.cpp |  2 +-
 clang/lib/Serialization/ASTReaderDecl.cpp | 16 +-
 clang/lib/Serialization/ASTWriterDecl.cpp |  2 +-
 12 files changed, 57 insertions(+), 109 deletions(-)

diff --git a/clang/include/clang/AST/Decl.h b/clang/include/clang/AST/Decl.h
index 5957f14098363..561a9d872acfb 100644
--- a/clang/include/clang/AST/Decl.h
+++ b/clang/include/clang/AST/Decl.h
@@ -542,12 +542,9 @@ class LabelDecl : public NamedDecl {
 };
 
 /// Represent a C++ namespace.
-class NamespaceDecl : public NamedDecl, public DeclContext,
-  public Redeclarable
-{
-
-  enum Flags : unsigned { F_Inline = 1 << 0, F_Nested = 1 << 1 };
-
+class NamespaceDecl : public NamedDecl,
+  public DeclContext,
+  public Redeclarable {
   /// The starting location of the source range, pointing
   /// to either the namespace or the inline keyword.
   SourceLocation LocStart;
@@ -555,12 +552,8 @@ class NamespaceDecl : public NamedDecl, public DeclContext,
   /// The ending location of the source range.
   SourceLocation RBraceLoc;
 
-  /// A pointer to either the anonymous namespace that lives just inside
-  /// this namespace or to the first namespace in the chain (the latter case
-  /// only when this is not the first in the chain), along with a
-  /// boolean value indicating whether this is an inline namespace.
-  llvm::PointerIntPair
-  AnonOrFirstNamespaceAndFlags;
+  /// The unnamed namespace that inhabits this namespace, if any.
+  NamespaceDecl *AnonymousNamespace = nullptr;
 
   NamespaceDecl(ASTContext &C, DeclContext *DC, bool Inline,
 SourceLocation StartLoc, SourceLocation IdLoc,
@@ -607,35 +600,19 @@ class NamespaceDecl : public NamedDecl, public 
DeclContext,
   }
 
   /// Returns true if this is an inline namespace declaration.
-  bool isInline() const {
-return AnonOrFirstNamespaceAndFlags.getInt() & F_Inline;
-  }
+  bool isInline() const { return NamespaceDeclBits.IsInline; }
 
   /// Set whether this is an inline namespace declaration.
-  void setInline(bool Inline) {
-unsigned F = AnonOrFirstNamespaceAndFlags.getInt();
-if (Inline)
-  AnonOrFirstNamespaceAndFlags.setInt(F | F_Inline);
-else
-  AnonOrFirstNamespaceAndFlags.setInt(F & ~F_Inline);
-  }
+  void setInline(bool Inline) { NamespaceDeclBits.IsInline = Inline; }
 
   /// Returns true if this is a nested namespace declaration.
   /// \code
   /// namespace outer::nested { }
   /// \endcode
-  bool isNested() const {
-return AnonOrFirstNamespaceAndFlags.getInt() & F_Nested;
-  }
+  bool isNested() const { return NamespaceDeclBits.IsNested; }
 
   /// Set whether this is a nested namespace declaration.
-  void setNested(bool Nested) {
-unsigned F = AnonOrFirstNamespaceAndFlags.getInt();
-if (Nested)
-  AnonOrFirstNamespaceAndFlags.setInt(F | F_Nested);
-else
-  AnonOrFirstNamespaceAndFlags.setInt(F & ~F_Nested);
-  }
+  void setNested(bool Nested) { NamespaceDeclBits.IsNested = Nested; }
 
   /// Returns true if the inline qualifier for \c Name is redundant.
   bool isRedundantInlineQualifierFor(DeclarationName Name) const {
@@ -649,34 +626,18 @@ class NamespaceDecl : public NamedDecl, public 
DeclContext,
   std::distance(Y.begin(), Y.end());
   }
 
-  /// Get the original (first) namespace declaration.
-  NamespaceDecl *getOriginalNamespace();
-
-  /// Get the original (first) namespace declaration.
-  const NamespaceDecl *getOriginalNamespace() const;
-
-  /// Return true if this declaration is an original (first) declaration
-  /// of the namespace. This is false for non-original (subsequent) namespace
-  /// declarations and anonymous namespaces.
-  bool isOriginalNamespace() const;
-
-  /// Retrieve the anonymous namespace nested inside this namespace,
-  /// if any.
+  /// Retrieve the anonymous namespace that inhabits this namespace, if any.
   NamespaceDecl *getAnonymousNamespace() const {
-return getOriginalNamespace()->AnonOrFirstNamespaceAndFlags.getPointer();
+return getFirstDecl()->AnonymousNamespace;
   }
 
   void setAnonymousNamespace(NamespaceDecl *D) {
-getOriginalNamespace()->AnonOrFi

[clang] [llvm] [AArch64] Make user-visible Arm architecture version strings consistent (PR #98550)

2024-07-12 Thread Jack Styles via cfe-commits

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

Agree with @tmatheson-arm that there is more standardisation we can do here, 
but probably out of scope for this PR.

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


[clang-tools-extra] [clang-doc] add ftime profiling (PR #97644)

2024-07-12 Thread via cfe-commits

https://github.com/PeterChou1 updated 
https://github.com/llvm/llvm-project/pull/97644

>From cbb9d73b4827206ea7f5da58cc4a765a9297d620 Mon Sep 17 00:00:00 2001
From: PeterChou1 
Date: Thu, 4 Jul 2024 03:39:22 -0400
Subject: [PATCH 1/3] [clang-doc] add ftime trace

---
 clang-tools-extra/clang-doc/BitcodeReader.cpp |  8 +++
 clang-tools-extra/clang-doc/Mapper.cpp|  9 
 .../clang-doc/Representation.cpp  |  2 +
 clang-tools-extra/clang-doc/Representation.h  |  5 +-
 .../clang-doc/tool/ClangDocMain.cpp   | 54 +--
 5 files changed, 72 insertions(+), 6 deletions(-)

diff --git a/clang-tools-extra/clang-doc/BitcodeReader.cpp 
b/clang-tools-extra/clang-doc/BitcodeReader.cpp
index bfb04e7407b38..eef8c1b6e7f0a 100644
--- a/clang-tools-extra/clang-doc/BitcodeReader.cpp
+++ b/clang-tools-extra/clang-doc/BitcodeReader.cpp
@@ -9,6 +9,7 @@
 #include "BitcodeReader.h"
 #include "llvm/ADT/IndexedMap.h"
 #include "llvm/Support/Error.h"
+#include "llvm/Support/TimeProfiler.h"
 #include "llvm/Support/raw_ostream.h"
 #include 
 
@@ -670,6 +671,7 @@ llvm::Error ClangDocBitcodeReader::readRecord(unsigned ID, 
T I) {
 
 template <>
 llvm::Error ClangDocBitcodeReader::readRecord(unsigned ID, Reference *I) {
+  llvm::TimeTraceScope("clang-doc", "readRecord Reference");
   Record R;
   llvm::StringRef Blob;
   llvm::Expected MaybeRecID = Stream.readRecord(ID, R, &Blob);
@@ -681,6 +683,7 @@ llvm::Error ClangDocBitcodeReader::readRecord(unsigned ID, 
Reference *I) {
 // Read a block of records into a single info.
 template 
 llvm::Error ClangDocBitcodeReader::readBlock(unsigned ID, T I) {
+  llvm::TimeTraceScope("readBlock", "ClangDocBitcodeReader");
   if (llvm::Error Err = Stream.EnterSubBlock(ID))
 return Err;
 
@@ -711,6 +714,7 @@ llvm::Error ClangDocBitcodeReader::readBlock(unsigned ID, T 
I) {
 
 template 
 llvm::Error ClangDocBitcodeReader::readSubBlock(unsigned ID, T I) {
+  llvm::TimeTraceScope("readSubBlock", "ClangDocBitcodeReader");
   switch (ID) {
   // Blocks can only have certain types of sub blocks.
   case BI_COMMENT_BLOCK_ID: {
@@ -817,6 +821,7 @@ llvm::Error ClangDocBitcodeReader::readSubBlock(unsigned 
ID, T I) {
 
 ClangDocBitcodeReader::Cursor
 ClangDocBitcodeReader::skipUntilRecordOrBlock(unsigned &BlockOrRecordID) {
+  llvm::TimeTraceScope("skipUntilRecordOrBlock", "ClangDocBitcodeReader");
   BlockOrRecordID = 0;
 
   while (!Stream.AtEndOfStream()) {
@@ -878,6 +883,7 @@ llvm::Error ClangDocBitcodeReader::validateStream() {
 }
 
 llvm::Error ClangDocBitcodeReader::readBlockInfoBlock() {
+  llvm::TimeTraceScope("readBlockInfoBlock", "ClangDocBitcodeReader");
   Expected> MaybeBlockInfo =
   Stream.ReadBlockInfoBlock();
   if (!MaybeBlockInfo)
@@ -894,6 +900,7 @@ llvm::Error ClangDocBitcodeReader::readBlockInfoBlock() {
 template 
 llvm::Expected>
 ClangDocBitcodeReader::createInfo(unsigned ID) {
+  llvm::TimeTraceScope("createInfo", "ClangDocBitcodeReader");
   std::unique_ptr I = std::make_unique();
   if (auto Err = readBlock(ID, static_cast(I.get(
 return std::move(Err);
@@ -902,6 +909,7 @@ ClangDocBitcodeReader::createInfo(unsigned ID) {
 
 llvm::Expected>
 ClangDocBitcodeReader::readBlockToInfo(unsigned ID) {
+  llvm::TimeTraceScope("readBlockToInfo", "ClangDocBitcodeReader");
   switch (ID) {
   case BI_NAMESPACE_BLOCK_ID:
 return createInfo(ID);
diff --git a/clang-tools-extra/clang-doc/Mapper.cpp 
b/clang-tools-extra/clang-doc/Mapper.cpp
index bb8b7952980ac..4a9e8721c9ff4 100644
--- a/clang-tools-extra/clang-doc/Mapper.cpp
+++ b/clang-tools-extra/clang-doc/Mapper.cpp
@@ -13,12 +13,17 @@
 #include "clang/Index/USRGeneration.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/Support/Error.h"
+#include "llvm/Support/TimeProfiler.h"
 
 namespace clang {
 namespace doc {
 
 void MapASTVisitor::HandleTranslationUnit(ASTContext &Context) {
+  if (CDCtx.FTimeTrace)
+llvm::timeTraceProfilerInitialize(CDCtx.Granularity, "clang-doc");
   TraverseDecl(Context.getTranslationUnitDecl());
+  if (CDCtx.FTimeTrace)
+llvm::timeTraceProfilerFinishThread();
 }
 
 template  bool MapASTVisitor::mapDecl(const T *D) {
@@ -30,6 +35,7 @@ template  bool MapASTVisitor::mapDecl(const T *D) 
{
   if (D->getParentFunctionOrMethod())
 return true;
 
+  llvm::timeTraceProfilerBegin("emit info phase", "emit info");
   llvm::SmallString<128> USR;
   // If there is an error generating a USR for the decl, skip this decl.
   if (index::generateUSRForDecl(D, USR))
@@ -40,7 +46,9 @@ template  bool MapASTVisitor::mapDecl(const T *D) 
{
   auto I = serialize::emitInfo(D, getComment(D, D->getASTContext()),
getLine(D, D->getASTContext()), File,
IsFileInRootDir, CDCtx.PublicOnly);
+  llvm::timeTraceProfilerEnd();
 
+  llvm::timeTraceProfilerBegin("serializing info", "serializing");
   // A null in place of I indicates that the serializer is skipping this decl
   // for some reason (e.g. we're only rep

[clang] [llvm] [llvm][AArch64] apple-m4 is armv9.2-a (PR #98267)

2024-07-12 Thread LLVM Continuous Integration via cfe-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `lld-x86_64-ubuntu-fast` 
running on `as-builder-4` while building `clang,llvm` at step 6 
"test-build-unified-tree-check-all".

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

Here is the relevant piece of the build log for the reference:
```
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
 TEST 'lld :: ELF/basic-sparcv9.s' FAILED 

Exit Code: 1

Command Output (stderr):
--
RUN: at line 2: 
/home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/build/bin/llvm-mc 
-filetype=obj -triple=sparc64-unknown-openbsd 
/home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/llvm-project/lld/test/ELF/basic-sparcv9.s
 -o 
/home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/build/tools/lld/test/ELF/Output/basic-sparcv9.s.tmp
+ /home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/build/bin/llvm-mc 
-filetype=obj -triple=sparc64-unknown-openbsd 
/home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/llvm-project/lld/test/ELF/basic-sparcv9.s
 -o 
/home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/build/tools/lld/test/ELF/Output/basic-sparcv9.s.tmp
RUN: at line 3: 
/home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/build/bin/ld.lld 
/home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/build/tools/lld/test/ELF/Output/basic-sparcv9.s.tmp
 -o 
/home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/build/tools/lld/test/ELF/Output/basic-sparcv9.s.tmp2
+ /home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/build/bin/ld.lld 
/home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/build/tools/lld/test/ELF/Output/basic-sparcv9.s.tmp
 -o 
/home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/build/tools/lld/test/ELF/Output/basic-sparcv9.s.tmp2
RUN: at line 4: 
/home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/build/bin/llvm-readobj 
--file-headers --sections -l --symbols 
/home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/build/tools/lld/test/ELF/Output/basic-sparcv9.s.tmp2
| /home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/build/bin/FileCheck 
/home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/llvm-project/lld/test/ELF/basic-sparcv9.s
+ /home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/build/bin/llvm-readobj 
--file-headers --sections -l --symbols 
/home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/build/tools/lld/test/ELF/Output/basic-sparcv9.s.tmp2
+ /home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/build/bin/FileCheck 
/home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/llvm-project/lld/test/ELF/basic-sparcv9.s
/home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/llvm-project/lld/test/ELF/basic-sparcv9.s:20:15:
 error: CHECK-NEXT: expected string not found in input
# CHECK-NEXT: OS/ABI: SystemV (0x0)
  ^
:12:16: note: scanning from here
 FileVersion: 1
   ^
:13:2: note: possible intended match here
 OS/ABI: OpenBSD (0xC)
 ^

Input file: 
Check file: 
/home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/llvm-project/lld/test/ELF/basic-sparcv9.s

-dump-input=help explains the following input dump.

Input was:
<<
   .
   .
   .
   7: ElfHeader { 
   8:  Ident { 
   9:  Magic: (7F 45 4C 46) 
  10:  Class: 64-bit (0x2) 
  11:  DataEncoding: BigEndian (0x2) 
  12:  FileVersion: 1 
next:20'0X error: no match found
  13:  OS/ABI: OpenBSD (0xC) 
next:20'0 ~~~
next:20'1  ?  possible intended match
  14:  ABIVersion: 0 
next:20'0 ~~~
  15:  Unused: (00 00 00 00 00 00 00) 
next:20'0 
  16:  } 
next:20'0 ~~~
  17:  Type: Executable (0x2) 
next:20'0 
...

```

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


[clang] [clang] Catch missing format attributes (PR #70024)

2024-07-12 Thread LLVM Continuous Integration via cfe-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `clang-aarch64-quick` 
running on `linaro-clang-aarch64-quick` while building `clang` at step 5 "ninja 
check 1".

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

Here is the relevant piece of the build log for the reference:
```
Step 5 (ninja check 1) failure: stage 1 checked (failure)
 TEST 'Clang :: Sema/attr-format-missing.c' FAILED 

Exit Code: 1

Command Output (stderr):
--
RUN: at line 1: /home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/bin/clang 
-cc1 -internal-isystem 
/home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/lib/clang/19/include 
-nostdsysteminc -fsyntax-only -verify=expected,c_diagnostics 
-Wmissing-format-attribute 
/home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/clang/test/Sema/attr-format-missing.c
+ /home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/bin/clang -cc1 
-internal-isystem 
/home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/lib/clang/19/include 
-nostdsysteminc -fsyntax-only -verify=expected,c_diagnostics 
-Wmissing-format-attribute 
/home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/clang/test/Sema/attr-format-missing.c
error: 'c_diagnostics-error' diagnostics seen but not expected: 
  File 
/home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/clang/test/Sema/attr-format-missing.c
 Line 87: subscripted value is not an array, pointer, or vector
  File 
/home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/clang/test/Sema/attr-format-missing.c
 Line 95: subscripted value is not an array, pointer, or vector
  File 
/home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/clang/test/Sema/attr-format-missing.c
 Line 96: subscripted value is not an array, pointer, or vector
  File 
/home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/clang/test/Sema/attr-format-missing.c
 Line 391: passing 'char *' to parameter of incompatible type 
'__builtin_va_list'
error: 'c_diagnostics-warning' diagnostics expected but not seen: 
  File 
/home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/clang/test/Sema/attr-format-missing.c
 Line 83 (directive at 
/home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/clang/test/Sema/attr-format-missing.c:87):
 diagnostic behavior may be improved by adding the 'scanf' format attribute to 
the declaration of 'f7'
  File 
/home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/clang/test/Sema/attr-format-missing.c
 Line 111 (directive at 
/home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/clang/test/Sema/attr-format-missing.c:113):
 incompatible pointer types passing 'const wchar_t *' (aka 'const int *') to 
parameter of type 'const char *'
  File 
/home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/clang/test/Sema/attr-format-missing.c
 Line 141 (directive at 
/home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/clang/test/Sema/attr-format-missing.c:143):
 incompatible pointer types passing 'const wchar_t *' (aka 'const int *') to 
parameter of type 'const char *'
error: 'c_diagnostics-warning' diagnostics seen but not expected: 
  File 
/home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/clang/test/Sema/attr-format-missing.c
 Line 111: incompatible pointer types passing 'const wchar_t *' (aka 'const 
unsigned int *') to parameter of type 'const char *'
  File 
/home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/clang/test/Sema/attr-format-missing.c
 Line 141: incompatible pointer types passing 'const wchar_t *' (aka 'const 
unsigned int *') to parameter of type 'const char *'
  File 
/home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/clang/test/Sema/attr-format-missing.c
 Line 387: diagnostic behavior may be improved by adding the 'printf' format 
attribute to the declaration of 'f41'
error: 'c_diagnostics-note' diagnostics seen but not expected: 
  File 
/home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/clang/test/Sema/attr-format-missing.c
 Line 30: passing argument to parameter here
11 errors generated.

--




```

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


[clang] [clang] Catch missing format attributes (PR #70024)

2024-07-12 Thread LLVM Continuous Integration via cfe-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `clang-armv8-quick` running 
on `linaro-clang-armv8-quick` while building `clang` at step 5 "ninja check 1".

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

Here is the relevant piece of the build log for the reference:
```
Step 5 (ninja check 1) failure: stage 1 checked (failure)
 TEST 'Clang :: Sema/attr-format-missing.c' FAILED 

Exit Code: 1

Command Output (stderr):
--
RUN: at line 1: /home/tcwg-buildbot/worker/clang-armv8-quick/stage1/bin/clang 
-cc1 -internal-isystem 
/home/tcwg-buildbot/worker/clang-armv8-quick/stage1/lib/clang/19/include 
-nostdsysteminc -fsyntax-only -verify=expected,c_diagnostics 
-Wmissing-format-attribute 
/home/tcwg-buildbot/worker/clang-armv8-quick/llvm/clang/test/Sema/attr-format-missing.c
+ /home/tcwg-buildbot/worker/clang-armv8-quick/stage1/bin/clang -cc1 
-internal-isystem 
/home/tcwg-buildbot/worker/clang-armv8-quick/stage1/lib/clang/19/include 
-nostdsysteminc -fsyntax-only -verify=expected,c_diagnostics 
-Wmissing-format-attribute 
/home/tcwg-buildbot/worker/clang-armv8-quick/llvm/clang/test/Sema/attr-format-missing.c
error: 'c_diagnostics-error' diagnostics seen but not expected: 
  File 
/home/tcwg-buildbot/worker/clang-armv8-quick/llvm/clang/test/Sema/attr-format-missing.c
 Line 87: subscripted value is not an array, pointer, or vector
  File 
/home/tcwg-buildbot/worker/clang-armv8-quick/llvm/clang/test/Sema/attr-format-missing.c
 Line 95: subscripted value is not an array, pointer, or vector
  File 
/home/tcwg-buildbot/worker/clang-armv8-quick/llvm/clang/test/Sema/attr-format-missing.c
 Line 96: subscripted value is not an array, pointer, or vector
  File 
/home/tcwg-buildbot/worker/clang-armv8-quick/llvm/clang/test/Sema/attr-format-missing.c
 Line 391: passing 'char *' to parameter of incompatible type 
'__builtin_va_list'
error: 'c_diagnostics-warning' diagnostics expected but not seen: 
  File 
/home/tcwg-buildbot/worker/clang-armv8-quick/llvm/clang/test/Sema/attr-format-missing.c
 Line 83 (directive at 
/home/tcwg-buildbot/worker/clang-armv8-quick/llvm/clang/test/Sema/attr-format-missing.c:87):
 diagnostic behavior may be improved by adding the 'scanf' format attribute to 
the declaration of 'f7'
  File 
/home/tcwg-buildbot/worker/clang-armv8-quick/llvm/clang/test/Sema/attr-format-missing.c
 Line 111 (directive at 
/home/tcwg-buildbot/worker/clang-armv8-quick/llvm/clang/test/Sema/attr-format-missing.c:113):
 incompatible pointer types passing 'const wchar_t *' (aka 'const int *') to 
parameter of type 'const char *'
  File 
/home/tcwg-buildbot/worker/clang-armv8-quick/llvm/clang/test/Sema/attr-format-missing.c
 Line 141 (directive at 
/home/tcwg-buildbot/worker/clang-armv8-quick/llvm/clang/test/Sema/attr-format-missing.c:143):
 incompatible pointer types passing 'const wchar_t *' (aka 'const int *') to 
parameter of type 'const char *'
error: 'c_diagnostics-warning' diagnostics seen but not expected: 
  File 
/home/tcwg-buildbot/worker/clang-armv8-quick/llvm/clang/test/Sema/attr-format-missing.c
 Line 111: incompatible pointer types passing 'const wchar_t *' (aka 'const 
unsigned int *') to parameter of type 'const char *'
  File 
/home/tcwg-buildbot/worker/clang-armv8-quick/llvm/clang/test/Sema/attr-format-missing.c
 Line 141: incompatible pointer types passing 'const wchar_t *' (aka 'const 
unsigned int *') to parameter of type 'const char *'
  File 
/home/tcwg-buildbot/worker/clang-armv8-quick/llvm/clang/test/Sema/attr-format-missing.c
 Line 387: diagnostic behavior may be improved by adding the 'printf' format 
attribute to the declaration of 'f41'
error: 'c_diagnostics-note' diagnostics seen but not expected: 
  File 
/home/tcwg-buildbot/worker/clang-armv8-quick/llvm/clang/test/Sema/attr-format-missing.c
 Line 30: passing argument to parameter here
11 errors generated.

--




```

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


[clang] [clang] Catch missing format attributes (PR #70024)

2024-07-12 Thread LLVM Continuous Integration via cfe-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `sanitizer-x86_64-linux` 
running on `sanitizer-buildbot1` while building `clang` at step 2 "annotate".

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

Here is the relevant piece of the build log for the reference:
```
Step 2 (annotate) failure: 'python 
../sanitizer_buildbot/sanitizers/zorg/buildbot/builders/sanitizers/buildbot_selector.py'
 (failure)
...
[78/248] Building CXX object 
tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseTemplate.cpp.o
[79/248] Building CXX object 
tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseStmtAsm.cpp.o
[80/248] Building CXX object 
tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/Parser.cpp.o
[81/248] Building CXX object 
tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseExprCXX.cpp.o
[82/248] Building CXX object 
tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaObjCProperty.cpp.o
[83/248] Building CXX object 
tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaAPINotes.cpp.o
[84/248] Building CXX object 
tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaExprMember.cpp.o
[85/248] Building CXX object 
tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaAttr.cpp.o
[86/248] Building CXX object 
tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaObjC.cpp.o
[87/248] Building CXX object 
tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaDeclAttr.cpp.o
FAILED: tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaDeclAttr.cpp.o 
CCACHE_CPP2=yes CCACHE_HASHDIR=yes /usr/bin/ccache 
/b/sanitizer-x86_64-linux/build/llvm_build0/bin/clang++ -DGTEST_HAS_RTTI=0 
-D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS 
-D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS 
-I/b/sanitizer-x86_64-linux/build/build_symbolizer/tools/clang/lib/Sema 
-I/b/sanitizer-x86_64-linux/build/llvm-project/clang/lib/Sema 
-I/b/sanitizer-x86_64-linux/build/llvm-project/clang/include 
-I/b/sanitizer-x86_64-linux/build/build_symbolizer/tools/clang/include 
-I/b/sanitizer-x86_64-linux/build/build_symbolizer/include 
-I/b/sanitizer-x86_64-linux/build/llvm-project/llvm/include -fPIC 
-fno-semantic-interposition -fvisibility-inlines-hidden -Werror 
-Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra 
-Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers 
-pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough 
-Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor 
-Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion 
-Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color 
-ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual 
-Wno-nested-anon-types -O3 -DNDEBUG -std=c++17  -fno-exceptions -funwind-tables 
-fno-rtti -UNDEBUG -MD -MT 
tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaDeclAttr.cpp.o -MF 
tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaDeclAttr.cpp.o.d -o 
tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaDeclAttr.cpp.o -c 
/b/sanitizer-x86_64-linux/build/llvm-project/clang/lib/Sema/SemaDeclAttr.cpp
/b/sanitizer-x86_64-linux/build/llvm-project/clang/lib/Sema/SemaDeclAttr.cpp:5529:38:
 error: comparison of integers of different signs: 'int' and 'unsigned int' 
[-Werror,-Wsign-compare]
 5529 |  Attr->getFirstArg() == FirstToCheck;
  |  ~~~ ^  
/b/sanitizer-x86_64-linux/build/llvm-project/clang/lib/Sema/SemaDeclAttr.cpp:5528:39:
 error: comparison of integers of different signs: 'int' and 'unsigned int' 
[-Werror,-Wsign-compare]
 5528 |  Attr->getFormatIdx() == StringIndex &&
  |   ^  ~~~
2 errors generated.
[88/248] Linking CXX executable bin/apinotes-test
[89/248] Building CXX object 
tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseExpr.cpp.o
[90/248] Building CXX object 
tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseDeclCXX.cpp.o
[91/248] Building CXX object 
tools/clang/tools/diagtool/CMakeFiles/diagtool.dir/ListWarnings.cpp.o
[92/248] Building CXX object 
tools/clang/tools/diagtool/CMakeFiles/diagtool.dir/FindDiagnosticID.cpp.o
[93/248] Building CXX object 
tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaWasm.cpp.o
[94/248] Building CXX object 
tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseOpenMP.cpp.o
[95/248] Building CXX object 
tools/clang/tools/diagtool/CMakeFiles/diagtool.dir/DiagnosticNames.cpp.o
[96/248] Building CXX object 
tools/clang/tools/diagtool/CMakeFiles/diagtool.dir/TreeView.cpp.o
[97/248] Building CXX object 
tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaX86.cpp.o
[98/248] Building CXX object 
tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParsePragma.cpp.o
[99/248] Building CXX object 
tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaInit.cpp.o
[100/248] Building CXX object 
tools/clang/lib/Sema/CMakeFiles/obj.clan

[clang] [clang] Catch missing format attributes (PR #70024)

2024-07-12 Thread LLVM Continuous Integration via cfe-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `sanitizer-aarch64-linux` 
running on `sanitizer-buildbot8` while building `clang` at step 2 "annotate".

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

Here is the relevant piece of the build log for the reference:
```
Step 2 (annotate) failure: 'python 
../sanitizer_buildbot/sanitizers/zorg/buildbot/builders/sanitizers/buildbot_selector.py'
 (failure)
...
[52/247] Building CXX object 
tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseTemplate.cpp.o
[53/247] Building CXX object 
tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaCUDA.cpp.o
[54/247] Building CXX object 
tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseObjc.cpp.o
[55/247] Building CXX object 
tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseStmt.cpp.o
[56/247] Building CXX object 
tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaAPINotes.cpp.o
[57/247] Building CXX object 
tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseCXXInlineMethods.cpp.o
[58/247] Building CXX object 
tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaARM.cpp.o
[59/247] Building CXX object 
tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseExpr.cpp.o
[60/247] Building CXX object 
tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaAttr.cpp.o
[61/247] Building CXX object 
tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaDeclAttr.cpp.o
FAILED: tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaDeclAttr.cpp.o 
CCACHE_CPP2=yes CCACHE_HASHDIR=yes /usr/bin/ccache 
/b/sanitizer-aarch64-linux/build/llvm_build0/bin/clang++ -DGTEST_HAS_RTTI=0 
-D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS 
-D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS 
-I/b/sanitizer-aarch64-linux/build/build_symbolizer/tools/clang/lib/Sema 
-I/b/sanitizer-aarch64-linux/build/llvm-project/clang/lib/Sema 
-I/b/sanitizer-aarch64-linux/build/llvm-project/clang/include 
-I/b/sanitizer-aarch64-linux/build/build_symbolizer/tools/clang/include 
-I/b/sanitizer-aarch64-linux/build/build_symbolizer/include 
-I/b/sanitizer-aarch64-linux/build/llvm-project/llvm/include -fPIC 
-fno-semantic-interposition -fvisibility-inlines-hidden -Werror 
-Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra 
-Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers 
-pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough 
-Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor 
-Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion 
-Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color 
-ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual 
-Wno-nested-anon-types -O3 -DNDEBUG -std=c++17  -fno-exceptions -funwind-tables 
-fno-rtti -UNDEBUG -MD -MT 
tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaDeclAttr.cpp.o -MF 
tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaDeclAttr.cpp.o.d -o 
tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaDeclAttr.cpp.o -c 
/b/sanitizer-aarch64-linux/build/llvm-project/clang/lib/Sema/SemaDeclAttr.cpp
/b/sanitizer-aarch64-linux/build/llvm-project/clang/lib/Sema/SemaDeclAttr.cpp:5529:38:
 error: comparison of integers of different signs: 'int' and 'unsigned int' 
[-Werror,-Wsign-compare]
 5529 |  Attr->getFirstArg() == FirstToCheck;
  |  ~~~ ^  
/b/sanitizer-aarch64-linux/build/llvm-project/clang/lib/Sema/SemaDeclAttr.cpp:5528:39:
 error: comparison of integers of different signs: 'int' and 'unsigned int' 
[-Werror,-Wsign-compare]
 5528 |  Attr->getFormatIdx() == StringIndex &&
  |   ^  ~~~
2 errors generated.
[62/247] Building CXX object 
tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseStmtAsm.cpp.o
[63/247] Building CXX object 
tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaCast.cpp.o
[64/247] Building CXX object 
tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseDeclCXX.cpp.o
[65/247] Building CXX object 
tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseOpenMP.cpp.o
[66/247] Building CXX object 
tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaM68k.cpp.o
[67/247] Building CXX object 
tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaExceptionSpec.cpp.o
[68/247] Building CXX object 
tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaMSP430.cpp.o
[69/247] Building CXX object 
tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParsePragma.cpp.o
[70/247] Building CXX object 
tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseDecl.cpp.o
[71/247] Building CXX object 
tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaHexagon.cpp.o
[72/247] Building CXX object 
tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/ParsedAttr.cpp.o
[73/247] Building CXX object 
tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaFixItUtils.cpp.o
[74/247] Bui

[clang-tools-extra] [clang-doc] add ftime profiling (PR #97644)

2024-07-12 Thread via cfe-commits


@@ -99,6 +100,16 @@ URL of repository that hosts code.
 Used for links to definition locations.)"),
   llvm::cl::cat(ClangDocCategory));
 
+static llvm::cl::opt FTimeTrace("ftime-trace", llvm::cl::desc(R"(
+Turn on time profiler. Generates clang-doc-tracing.json)"),
+  llvm::cl::init(false),
+  llvm::cl::cat(ClangDocCategory));
+
+static llvm::cl::opt FTimeGranularity("ftime-gran", llvm::cl::desc(R"(

PeterChou1 wrote:

I thought it be useful to set granularity for ftime trace, I've adjusted the pr 
to just set it as a constant

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


[clang-tools-extra] [clang-doc] add ftime profiling (PR #97644)

2024-07-12 Thread via cfe-commits


@@ -681,6 +683,7 @@ llvm::Error ClangDocBitcodeReader::readRecord(unsigned ID, 
Reference *I) {
 // Read a block of records into a single info.
 template 
 llvm::Error ClangDocBitcodeReader::readBlock(unsigned ID, T I) {
+  llvm::TimeTraceScope("readBlock", "ClangDocBitcodeReader");

PeterChou1 wrote:

there's really no logic I've updated the pr, so that it follow the convention 
of naming it after the scope or method the timescope is in


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


[clang-tools-extra] [clang-doc] add ftime profiling (PR #97644)

2024-07-12 Thread via cfe-commits

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


[clang] [clang] Catch missing format attributes (PR #70024)

2024-07-12 Thread LLVM Continuous Integration via cfe-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder 
`ppc64le-lld-multistage-test` running on `ppc64le-lld-multistage-test` while 
building `clang` at step 12 "build-stage2-unified-tree".

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

Here is the relevant piece of the build log for the reference:
```
Step 12 (build-stage2-unified-tree) failure: build (failure)
...
454.834 [181/569/5420] Building CXX object 
tools/llvm-mca/CMakeFiles/llvm-mca.dir/Views/BottleneckAnalysis.cpp.o
454.893 [181/568/5421] Building CXX object 
tools/lld/ELF/CMakeFiles/lldELF.dir/Arch/X86.cpp.o
454.986 [181/567/5422] Building CXX object 
tools/lld/MachO/CMakeFiles/lldMachO.dir/ICF.cpp.o
455.266 [181/566/5423] Building CXX object 
tools/llvm-reduce/CMakeFiles/llvm-reduce.dir/deltas/ReduceGlobalVars.cpp.o
455.430 [181/565/5424] Building C object 
tools/clang/tools/clang-fuzzer/dictionary/CMakeFiles/clang-fuzzer-dictionary.dir/dictionary.c.o
455.449 [181/564/5425] Building CXX object 
unittests/MC/CMakeFiles/MCTests.dir/StringTableBuilderTest.cpp.o
455.467 [181/563/5426] Building CXX object 
lib/Target/AMDGPU/MCA/CMakeFiles/LLVMAMDGPUTargetMCA.dir/AMDGPUCustomBehaviour.cpp.o
455.521 [181/562/5427] Building CXX object 
tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaLookup.cpp.o
455.534 [181/561/5428] Building CXX object 
tools/llvm-reduce/CMakeFiles/llvm-reduce.dir/deltas/ReduceSpecialGlobals.cpp.o
455.554 [181/560/5429] Building CXX object 
tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaDeclAttr.cpp.o
FAILED: tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaDeclAttr.cpp.o 
ccache 
/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/install/stage1/bin/clang++
 -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE 
-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS 
-I/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/build/stage2/tools/clang/lib/Sema
 
-I/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/clang/lib/Sema
 
-I/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/clang/include
 
-I/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/build/stage2/tools/clang/include
 
-I/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/build/stage2/include
 
-I/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/llvm/include
 -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror 
-Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra 
-Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers 
-pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough 
-Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor 
-Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion 
-Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color 
-ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual 
-Wno-nested-anon-types -O3 -DNDEBUG -std=c++17  -fno-exceptions -funwind-tables 
-fno-rtti -UNDEBUG -MD -MT 
tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaDeclAttr.cpp.o -MF 
tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaDeclAttr.cpp.o.d -o 
tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaDeclAttr.cpp.o -c 
/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/clang/lib/Sema/SemaDeclAttr.cpp
/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/clang/lib/Sema/SemaDeclAttr.cpp:5529:38:
 error: comparison of integers of different signs: 'int' and 'unsigned int' 
[-Werror,-Wsign-compare]
 5529 |  Attr->getFirstArg() == FirstToCheck;
  |  ~~~ ^  
/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/clang/lib/Sema/SemaDeclAttr.cpp:5528:39:
 error: comparison of integers of different signs: 'int' and 'unsigned int' 
[-Werror,-Wsign-compare]
 5528 |  Attr->getFormatIdx() == StringIndex &&
  |   ^  ~~~
2 errors generated.
455.610 [181/559/5430] Building CXX object 
tools/bugpoint/CMakeFiles/bugpoint.dir/ExecutionDriver.cpp.o
455.701 [181/558/5431] Building CXX object 
tools/clang/lib/AST/CMakeFiles/obj.clangAST.dir/ASTImporterLookupTable.cpp.o
455.744 [181/557/5432] Building CXX object 
tools/llvm-objdump/CMakeFiles/llvm-objdump.dir/OffloadDump.cpp.o
455.767 [181/556/5433] Building CXX object 
tools/dsymutil/CMakeFiles/dsymutil.dir/Binary

[clang] [clang] Catch missing format attributes (PR #70024)

2024-07-12 Thread LLVM Continuous Integration via cfe-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `sanitizer-ppc64le-linux` 
running on `ppc64le-sanitizer` while building `clang` at step 2 "annotate".

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

Here is the relevant piece of the build log for the reference:
```
Step 2 (annotate) failure: 'python 
../sanitizer_buildbot/sanitizers/zorg/buildbot/builders/sanitizers/buildbot_selector.py'
 (failure)
...
[110/221] Building CXX object 
tools/clang/lib/Frontend/CMakeFiles/obj.clangFrontend.dir/ChainedIncludesSource.cpp.o
[111/221] Building CXX object 
tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaCast.cpp.o
[112/221] Building CXX object 
tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaAPINotes.cpp.o
[113/221] Building CXX object 
tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseExpr.cpp.o
[114/221] Building CXX object 
tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseObjc.cpp.o
[115/221] Building CXX object 
tools/clang/lib/Interpreter/CMakeFiles/obj.clangInterpreter.dir/CodeCompletion.cpp.o
[116/221] Building CXX object 
tools/clang/tools/c-index-test/CMakeFiles/c-index-test.dir/core_main.cpp.o
[117/221] Building CXX object 
tools/clang/lib/Frontend/CMakeFiles/obj.clangFrontend.dir/ASTUnit.cpp.o
[118/221] Building CXX object 
tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaTemplateInstantiate.cpp.o
[119/221] Building CXX object 
tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaDeclAttr.cpp.o
FAILED: tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaDeclAttr.cpp.o 
CCACHE_CPP2=yes CCACHE_HASHDIR=yes /usr/bin/ccache 
/home/buildbots/llvm-external-buildbots/workers/ppc64le-sanitizer/sanitizer-ppc64le/build/llvm_build0/bin/clang++
 -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE 
-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS 
-I/home/buildbots/llvm-external-buildbots/workers/ppc64le-sanitizer/sanitizer-ppc64le/build/build_debug/tools/clang/lib/Sema
 
-I/home/buildbots/llvm-external-buildbots/workers/ppc64le-sanitizer/sanitizer-ppc64le/build/llvm-project/clang/lib/Sema
 
-I/home/buildbots/llvm-external-buildbots/workers/ppc64le-sanitizer/sanitizer-ppc64le/build/llvm-project/clang/include
 
-I/home/buildbots/llvm-external-buildbots/workers/ppc64le-sanitizer/sanitizer-ppc64le/build/build_debug/tools/clang/include
 
-I/home/buildbots/llvm-external-buildbots/workers/ppc64le-sanitizer/sanitizer-ppc64le/build/build_debug/include
 
-I/home/buildbots/llvm-external-buildbots/workers/ppc64le-sanitizer/sanitizer-ppc64le/build/llvm-project/llvm/include
 -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror 
-Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra 
-Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers 
-pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough 
-Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor 
-Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion 
-Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color 
-ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual 
-Wno-nested-anon-types -O3 -DNDEBUG -std=c++17  -fno-exceptions -funwind-tables 
-fno-rtti -UNDEBUG -MD -MT 
tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaDeclAttr.cpp.o -MF 
tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaDeclAttr.cpp.o.d -o 
tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaDeclAttr.cpp.o -c 
/home/buildbots/llvm-external-buildbots/workers/ppc64le-sanitizer/sanitizer-ppc64le/build/llvm-project/clang/lib/Sema/SemaDeclAttr.cpp
/home/buildbots/llvm-external-buildbots/workers/ppc64le-sanitizer/sanitizer-ppc64le/build/llvm-project/clang/lib/Sema/SemaDeclAttr.cpp:5529:38:
 error: comparison of integers of different signs: 'int' and 'unsigned int' 
[-Werror,-Wsign-compare]
 5529 |  Attr->getFirstArg() == FirstToCheck;
  |  ~~~ ^  
/home/buildbots/llvm-external-buildbots/workers/ppc64le-sanitizer/sanitizer-ppc64le/build/llvm-project/clang/lib/Sema/SemaDeclAttr.cpp:5528:39:
 error: comparison of integers of different signs: 'int' and 'unsigned int' 
[-Werror,-Wsign-compare]
 5528 |  Attr->getFormatIdx() == StringIndex &&
  |   ^  ~~~
2 errors generated.
[120/221] Building CXX object 
tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParsePragma.cpp.o
[121/221] Building CXX object 
tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseOpenMP.cpp.o
[122/221] Building CXX object 
tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseDeclCXX.cpp.o
[123/221] Building CXX object 
tools/clang/lib/Serialization/CMakeFiles/obj.clangSerialization.dir/ASTWriterStmt.cpp.o
[124/221] Building CXX object 
tools/clang/lib/Frontend/CMakeFiles/obj.clangFrontend.dir/FrontendAction.cpp.o
[125/221] Building CXX object 
tools/clang/lib/To

[clang] [clang][NFC] Fix a warning (PR #98611)

2024-07-12 Thread Piotr Fusik via cfe-commits

https://github.com/pfusik created 
https://github.com/llvm/llvm-project/pull/98611

enumerated and non-enumerated type in conditional expression

>From d8d44d1eff37bc7e2632fb64b087aac270742ac6 Mon Sep 17 00:00:00 2001
From: Piotr Fusik 
Date: Fri, 12 Jul 2024 11:34:26 +0200
Subject: [PATCH] [clang][NFC] Fix a warning

enumerated and non-enumerated type in conditional expression
---
 clang/lib/CodeGen/CGExpr.cpp | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index 039f60c774591..ddb82571f53d7 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/lib/CodeGen/CGExpr.cpp
@@ -3842,9 +3842,10 @@ void CodeGenFunction::EmitTrapCheck(llvm::Value *Checked,
 
 llvm::CallInst *TrapCall = Builder.CreateCall(
 CGM.getIntrinsic(llvm::Intrinsic::ubsantrap),
-llvm::ConstantInt::get(CGM.Int8Ty, ClSanitizeDebugDeoptimization
-   ? TrapBB->getParent()->size()
-   : CheckHandlerID));
+llvm::ConstantInt::get(CGM.Int8Ty,
+   ClSanitizeDebugDeoptimization
+   ? TrapBB->getParent()->size()
+   : static_cast(CheckHandlerID)));
 
 if (!CGM.getCodeGenOpts().TrapFuncName.empty()) {
   auto A = llvm::Attribute::get(getLLVMContext(), "trap-func-name",

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


[clang] [clang][NFC] Fix a warning (PR #98611)

2024-07-12 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang-codegen

Author: Piotr Fusik (pfusik)


Changes

enumerated and non-enumerated type in conditional expression

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


1 Files Affected:

- (modified) clang/lib/CodeGen/CGExpr.cpp (+4-3) 


``diff
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index 039f60c774591..ddb82571f53d7 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/lib/CodeGen/CGExpr.cpp
@@ -3842,9 +3842,10 @@ void CodeGenFunction::EmitTrapCheck(llvm::Value *Checked,
 
 llvm::CallInst *TrapCall = Builder.CreateCall(
 CGM.getIntrinsic(llvm::Intrinsic::ubsantrap),
-llvm::ConstantInt::get(CGM.Int8Ty, ClSanitizeDebugDeoptimization
-   ? TrapBB->getParent()->size()
-   : CheckHandlerID));
+llvm::ConstantInt::get(CGM.Int8Ty,
+   ClSanitizeDebugDeoptimization
+   ? TrapBB->getParent()->size()
+   : static_cast(CheckHandlerID)));
 
 if (!CGM.getCodeGenOpts().TrapFuncName.empty()) {
   auto A = llvm::Attribute::get(getLLVMContext(), "trap-func-name",

``




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


[clang] [clang][NFC] Fix a warning (PR #98611)

2024-07-12 Thread Piotr Fusik via cfe-commits

pfusik wrote:

This fixes one of the very few warnings when building clang with Ubuntu 22.04's 
gcc.

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


[clang] [clang-tools-extra] [Clang][AST] Move NamespaceDecl bits to DeclContext (PR #98567)

2024-07-12 Thread Krystian Stasiowski via cfe-commits

https://github.com/sdkrystian updated 
https://github.com/llvm/llvm-project/pull/98567

>From 63a9c69cc5c4d6f8048918addfb01de6dc212524 Mon Sep 17 00:00:00 2001
From: Krystian Stasiowski 
Date: Thu, 20 Jun 2024 11:44:53 -0400
Subject: [PATCH 1/3] [Clang][AST] Move NamespaceDecl bits to DeclContext

---
 clang/include/clang/AST/Decl.h| 67 +--
 clang/include/clang/AST/DeclBase.h| 24 
 clang/lib/AST/ASTContext.cpp  |  8 +--
 clang/lib/AST/DeclBase.cpp|  3 +-
 clang/lib/AST/DeclCXX.cpp | 31 ++-
 clang/lib/AST/ItaniumMangle.cpp   |  2 +-
 clang/lib/AST/JSONNodeDumper.cpp  |  5 +-
 clang/lib/AST/TextNodeDumper.cpp  |  4 +-
 clang/lib/Sema/SemaCodeComplete.cpp   |  2 +-
 clang/lib/Sema/SemaLookup.cpp |  2 +-
 clang/lib/Serialization/ASTReaderDecl.cpp | 16 +-
 clang/lib/Serialization/ASTWriterDecl.cpp |  2 +-
 12 files changed, 57 insertions(+), 109 deletions(-)

diff --git a/clang/include/clang/AST/Decl.h b/clang/include/clang/AST/Decl.h
index 5957f14098363..561a9d872acfb 100644
--- a/clang/include/clang/AST/Decl.h
+++ b/clang/include/clang/AST/Decl.h
@@ -542,12 +542,9 @@ class LabelDecl : public NamedDecl {
 };
 
 /// Represent a C++ namespace.
-class NamespaceDecl : public NamedDecl, public DeclContext,
-  public Redeclarable
-{
-
-  enum Flags : unsigned { F_Inline = 1 << 0, F_Nested = 1 << 1 };
-
+class NamespaceDecl : public NamedDecl,
+  public DeclContext,
+  public Redeclarable {
   /// The starting location of the source range, pointing
   /// to either the namespace or the inline keyword.
   SourceLocation LocStart;
@@ -555,12 +552,8 @@ class NamespaceDecl : public NamedDecl, public DeclContext,
   /// The ending location of the source range.
   SourceLocation RBraceLoc;
 
-  /// A pointer to either the anonymous namespace that lives just inside
-  /// this namespace or to the first namespace in the chain (the latter case
-  /// only when this is not the first in the chain), along with a
-  /// boolean value indicating whether this is an inline namespace.
-  llvm::PointerIntPair
-  AnonOrFirstNamespaceAndFlags;
+  /// The unnamed namespace that inhabits this namespace, if any.
+  NamespaceDecl *AnonymousNamespace = nullptr;
 
   NamespaceDecl(ASTContext &C, DeclContext *DC, bool Inline,
 SourceLocation StartLoc, SourceLocation IdLoc,
@@ -607,35 +600,19 @@ class NamespaceDecl : public NamedDecl, public 
DeclContext,
   }
 
   /// Returns true if this is an inline namespace declaration.
-  bool isInline() const {
-return AnonOrFirstNamespaceAndFlags.getInt() & F_Inline;
-  }
+  bool isInline() const { return NamespaceDeclBits.IsInline; }
 
   /// Set whether this is an inline namespace declaration.
-  void setInline(bool Inline) {
-unsigned F = AnonOrFirstNamespaceAndFlags.getInt();
-if (Inline)
-  AnonOrFirstNamespaceAndFlags.setInt(F | F_Inline);
-else
-  AnonOrFirstNamespaceAndFlags.setInt(F & ~F_Inline);
-  }
+  void setInline(bool Inline) { NamespaceDeclBits.IsInline = Inline; }
 
   /// Returns true if this is a nested namespace declaration.
   /// \code
   /// namespace outer::nested { }
   /// \endcode
-  bool isNested() const {
-return AnonOrFirstNamespaceAndFlags.getInt() & F_Nested;
-  }
+  bool isNested() const { return NamespaceDeclBits.IsNested; }
 
   /// Set whether this is a nested namespace declaration.
-  void setNested(bool Nested) {
-unsigned F = AnonOrFirstNamespaceAndFlags.getInt();
-if (Nested)
-  AnonOrFirstNamespaceAndFlags.setInt(F | F_Nested);
-else
-  AnonOrFirstNamespaceAndFlags.setInt(F & ~F_Nested);
-  }
+  void setNested(bool Nested) { NamespaceDeclBits.IsNested = Nested; }
 
   /// Returns true if the inline qualifier for \c Name is redundant.
   bool isRedundantInlineQualifierFor(DeclarationName Name) const {
@@ -649,34 +626,18 @@ class NamespaceDecl : public NamedDecl, public 
DeclContext,
   std::distance(Y.begin(), Y.end());
   }
 
-  /// Get the original (first) namespace declaration.
-  NamespaceDecl *getOriginalNamespace();
-
-  /// Get the original (first) namespace declaration.
-  const NamespaceDecl *getOriginalNamespace() const;
-
-  /// Return true if this declaration is an original (first) declaration
-  /// of the namespace. This is false for non-original (subsequent) namespace
-  /// declarations and anonymous namespaces.
-  bool isOriginalNamespace() const;
-
-  /// Retrieve the anonymous namespace nested inside this namespace,
-  /// if any.
+  /// Retrieve the anonymous namespace that inhabits this namespace, if any.
   NamespaceDecl *getAnonymousNamespace() const {
-return getOriginalNamespace()->AnonOrFirstNamespaceAndFlags.getPointer();
+return getFirstDecl()->AnonymousNamespace;
   }
 
   void setAnonymousNamespace(NamespaceDecl *D) {
-getOriginalNamespace()->AnonOrFi

[clang] [clang] Add option to opt out of the missing_dependent_template_keyword diagnostic (PR #98613)

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

https://github.com/hokein created 
https://github.com/llvm/llvm-project/pull/98613

After commit ce4aada6e2135e29839f672a6599db628b53295d, we observed many 
warnings in our internal codebase. It is 
 infeasible to fix all at once.

Currently, there is no way to disable this warning. This patch provides a way 
to disable it using the `-Wno-missing-dependent-template-keyword` flag.

>From d22741375619b2b134509049aad7958348abcc30 Mon Sep 17 00:00:00 2001
From: Haojian Wu 
Date: Fri, 12 Jul 2024 12:26:07 +0200
Subject: [PATCH] [clang] Allow to opt out the
 missing_dependent_template_keyword diagnostic.

---
 clang/include/clang/Basic/DiagnosticParseKinds.td | 3 ++-
 clang/test/Misc/warning-flags.c   | 3 +--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/clang/include/clang/Basic/DiagnosticParseKinds.td 
b/clang/include/clang/Basic/DiagnosticParseKinds.td
index 0bd2e35bf2e31..e00cd47411cb3 100644
--- a/clang/include/clang/Basic/DiagnosticParseKinds.td
+++ b/clang/include/clang/Basic/DiagnosticParseKinds.td
@@ -896,7 +896,8 @@ def missing_template_arg_list_after_template_kw : Extension<
   DefaultError;
 
 def ext_missing_dependent_template_keyword : ExtWarn<
-  "use 'template' keyword to treat '%0' as a dependent template name">;
+  "use 'template' keyword to treat '%0' as a dependent template name">,
+  InGroup>;
 
 def ext_extern_template : Extension<
   "extern templates are a C++11 extension">, InGroup;
diff --git a/clang/test/Misc/warning-flags.c b/clang/test/Misc/warning-flags.c
index 651a86fb6e226..7b993f6849363 100644
--- a/clang/test/Misc/warning-flags.c
+++ b/clang/test/Misc/warning-flags.c
@@ -18,10 +18,9 @@ This test serves two purposes:
 
 The list of warnings below should NEVER grow.  It should gradually shrink to 0.
 
-CHECK: Warnings without flags (65):
+CHECK: Warnings without flags (64):
 
 CHECK-NEXT:   ext_expected_semi_decl_list
-CHECK-NEXT:   ext_missing_dependent_template_keyword
 CHECK-NEXT:   ext_missing_whitespace_after_macro_name
 CHECK-NEXT:   ext_new_paren_array_nonconst
 CHECK-NEXT:   ext_plain_complex

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


[clang] [clang] Add option to opt out of the missing_dependent_template_keyword diagnostic (PR #98613)

2024-07-12 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang

Author: Haojian Wu (hokein)


Changes

After commit ce4aada6e2135e29839f672a6599db628b53295d, we observed many 
warnings in our internal codebase. It is 
 infeasible to fix all at once.

Currently, there is no way to disable this warning. This patch provides a way 
to disable it using the `-Wno-missing-dependent-template-keyword` flag.

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


2 Files Affected:

- (modified) clang/include/clang/Basic/DiagnosticParseKinds.td (+2-1) 
- (modified) clang/test/Misc/warning-flags.c (+1-2) 


``diff
diff --git a/clang/include/clang/Basic/DiagnosticParseKinds.td 
b/clang/include/clang/Basic/DiagnosticParseKinds.td
index 0bd2e35bf2e31..e00cd47411cb3 100644
--- a/clang/include/clang/Basic/DiagnosticParseKinds.td
+++ b/clang/include/clang/Basic/DiagnosticParseKinds.td
@@ -896,7 +896,8 @@ def missing_template_arg_list_after_template_kw : Extension<
   DefaultError;
 
 def ext_missing_dependent_template_keyword : ExtWarn<
-  "use 'template' keyword to treat '%0' as a dependent template name">;
+  "use 'template' keyword to treat '%0' as a dependent template name">,
+  InGroup>;
 
 def ext_extern_template : Extension<
   "extern templates are a C++11 extension">, InGroup;
diff --git a/clang/test/Misc/warning-flags.c b/clang/test/Misc/warning-flags.c
index 651a86fb6e226..7b993f6849363 100644
--- a/clang/test/Misc/warning-flags.c
+++ b/clang/test/Misc/warning-flags.c
@@ -18,10 +18,9 @@ This test serves two purposes:
 
 The list of warnings below should NEVER grow.  It should gradually shrink to 0.
 
-CHECK: Warnings without flags (65):
+CHECK: Warnings without flags (64):
 
 CHECK-NEXT:   ext_expected_semi_decl_list
-CHECK-NEXT:   ext_missing_dependent_template_keyword
 CHECK-NEXT:   ext_missing_whitespace_after_macro_name
 CHECK-NEXT:   ext_new_paren_array_nonconst
 CHECK-NEXT:   ext_plain_complex

``




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


[clang-tools-extra] [clang-doc] add ftime profiling (PR #97644)

2024-07-12 Thread via cfe-commits

https://github.com/PeterChou1 updated 
https://github.com/llvm/llvm-project/pull/97644

>From cbb9d73b4827206ea7f5da58cc4a765a9297d620 Mon Sep 17 00:00:00 2001
From: PeterChou1 
Date: Thu, 4 Jul 2024 03:39:22 -0400
Subject: [PATCH 1/4] [clang-doc] add ftime trace

---
 clang-tools-extra/clang-doc/BitcodeReader.cpp |  8 +++
 clang-tools-extra/clang-doc/Mapper.cpp|  9 
 .../clang-doc/Representation.cpp  |  2 +
 clang-tools-extra/clang-doc/Representation.h  |  5 +-
 .../clang-doc/tool/ClangDocMain.cpp   | 54 +--
 5 files changed, 72 insertions(+), 6 deletions(-)

diff --git a/clang-tools-extra/clang-doc/BitcodeReader.cpp 
b/clang-tools-extra/clang-doc/BitcodeReader.cpp
index bfb04e7407b38..eef8c1b6e7f0a 100644
--- a/clang-tools-extra/clang-doc/BitcodeReader.cpp
+++ b/clang-tools-extra/clang-doc/BitcodeReader.cpp
@@ -9,6 +9,7 @@
 #include "BitcodeReader.h"
 #include "llvm/ADT/IndexedMap.h"
 #include "llvm/Support/Error.h"
+#include "llvm/Support/TimeProfiler.h"
 #include "llvm/Support/raw_ostream.h"
 #include 
 
@@ -670,6 +671,7 @@ llvm::Error ClangDocBitcodeReader::readRecord(unsigned ID, 
T I) {
 
 template <>
 llvm::Error ClangDocBitcodeReader::readRecord(unsigned ID, Reference *I) {
+  llvm::TimeTraceScope("clang-doc", "readRecord Reference");
   Record R;
   llvm::StringRef Blob;
   llvm::Expected MaybeRecID = Stream.readRecord(ID, R, &Blob);
@@ -681,6 +683,7 @@ llvm::Error ClangDocBitcodeReader::readRecord(unsigned ID, 
Reference *I) {
 // Read a block of records into a single info.
 template 
 llvm::Error ClangDocBitcodeReader::readBlock(unsigned ID, T I) {
+  llvm::TimeTraceScope("readBlock", "ClangDocBitcodeReader");
   if (llvm::Error Err = Stream.EnterSubBlock(ID))
 return Err;
 
@@ -711,6 +714,7 @@ llvm::Error ClangDocBitcodeReader::readBlock(unsigned ID, T 
I) {
 
 template 
 llvm::Error ClangDocBitcodeReader::readSubBlock(unsigned ID, T I) {
+  llvm::TimeTraceScope("readSubBlock", "ClangDocBitcodeReader");
   switch (ID) {
   // Blocks can only have certain types of sub blocks.
   case BI_COMMENT_BLOCK_ID: {
@@ -817,6 +821,7 @@ llvm::Error ClangDocBitcodeReader::readSubBlock(unsigned 
ID, T I) {
 
 ClangDocBitcodeReader::Cursor
 ClangDocBitcodeReader::skipUntilRecordOrBlock(unsigned &BlockOrRecordID) {
+  llvm::TimeTraceScope("skipUntilRecordOrBlock", "ClangDocBitcodeReader");
   BlockOrRecordID = 0;
 
   while (!Stream.AtEndOfStream()) {
@@ -878,6 +883,7 @@ llvm::Error ClangDocBitcodeReader::validateStream() {
 }
 
 llvm::Error ClangDocBitcodeReader::readBlockInfoBlock() {
+  llvm::TimeTraceScope("readBlockInfoBlock", "ClangDocBitcodeReader");
   Expected> MaybeBlockInfo =
   Stream.ReadBlockInfoBlock();
   if (!MaybeBlockInfo)
@@ -894,6 +900,7 @@ llvm::Error ClangDocBitcodeReader::readBlockInfoBlock() {
 template 
 llvm::Expected>
 ClangDocBitcodeReader::createInfo(unsigned ID) {
+  llvm::TimeTraceScope("createInfo", "ClangDocBitcodeReader");
   std::unique_ptr I = std::make_unique();
   if (auto Err = readBlock(ID, static_cast(I.get(
 return std::move(Err);
@@ -902,6 +909,7 @@ ClangDocBitcodeReader::createInfo(unsigned ID) {
 
 llvm::Expected>
 ClangDocBitcodeReader::readBlockToInfo(unsigned ID) {
+  llvm::TimeTraceScope("readBlockToInfo", "ClangDocBitcodeReader");
   switch (ID) {
   case BI_NAMESPACE_BLOCK_ID:
 return createInfo(ID);
diff --git a/clang-tools-extra/clang-doc/Mapper.cpp 
b/clang-tools-extra/clang-doc/Mapper.cpp
index bb8b7952980ac..4a9e8721c9ff4 100644
--- a/clang-tools-extra/clang-doc/Mapper.cpp
+++ b/clang-tools-extra/clang-doc/Mapper.cpp
@@ -13,12 +13,17 @@
 #include "clang/Index/USRGeneration.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/Support/Error.h"
+#include "llvm/Support/TimeProfiler.h"
 
 namespace clang {
 namespace doc {
 
 void MapASTVisitor::HandleTranslationUnit(ASTContext &Context) {
+  if (CDCtx.FTimeTrace)
+llvm::timeTraceProfilerInitialize(CDCtx.Granularity, "clang-doc");
   TraverseDecl(Context.getTranslationUnitDecl());
+  if (CDCtx.FTimeTrace)
+llvm::timeTraceProfilerFinishThread();
 }
 
 template  bool MapASTVisitor::mapDecl(const T *D) {
@@ -30,6 +35,7 @@ template  bool MapASTVisitor::mapDecl(const T *D) 
{
   if (D->getParentFunctionOrMethod())
 return true;
 
+  llvm::timeTraceProfilerBegin("emit info phase", "emit info");
   llvm::SmallString<128> USR;
   // If there is an error generating a USR for the decl, skip this decl.
   if (index::generateUSRForDecl(D, USR))
@@ -40,7 +46,9 @@ template  bool MapASTVisitor::mapDecl(const T *D) 
{
   auto I = serialize::emitInfo(D, getComment(D, D->getASTContext()),
getLine(D, D->getASTContext()), File,
IsFileInRootDir, CDCtx.PublicOnly);
+  llvm::timeTraceProfilerEnd();
 
+  llvm::timeTraceProfilerBegin("serializing info", "serializing");
   // A null in place of I indicates that the serializer is skipping this decl
   // for some reason (e.g. we're only rep

[clang] [llvm] [llvm][AArch64] apple-m4 is armv9.2-a (PR #98267)

2024-07-12 Thread Tomas Matheson via cfe-commits


@@ -161,14 +161,10 @@ struct CpuInfo {
   StringRef Name; // Name, as written for -mcpu.
   const ArchInfo &Arch;
   AArch64::ExtensionBitset
-  DefaultExtensions; // Default extensions for this CPU. These will be
- // ORd with the architecture defaults.
+  DefaultExtensions; // Default extensions for this CPU.
 
   AArch64::ExtensionBitset getImpliedExtensions() const {
-AArch64::ExtensionBitset ImpliedExts;
-ImpliedExts |= DefaultExtensions;
-ImpliedExts |= Arch.DefaultExts;
-return ImpliedExts;
+return DefaultExtensions;

tmatheson-arm wrote:

Not sure I follow... Do you mean `-march=` has no effect if you specify 
`-mcpu`? That should probably be at least a warning.

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


[clang] [clang] Add option to opt out of the missing_dependent_template_keyword diagnostic (PR #98613)

2024-07-12 Thread Krystian Stasiowski via cfe-commits

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

Reasonable, LGTM.

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


[clang] [clang] Add option to opt out of the missing_dependent_template_keyword diagnostic (PR #98613)

2024-07-12 Thread Krystian Stasiowski via cfe-commits

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


[clang] [clang] Catch missing format attributes (PR #70024)

2024-07-12 Thread LLVM Continuous Integration via cfe-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `clang-solaris11-sparcv9` 
running on `solaris11-sparcv9` while building `clang` at step 5 "ninja check 1".

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

Here is the relevant piece of the build log for the reference:
```
Step 5 (ninja check 1) failure: stage 1 checked (failure)
 TEST 'Clang :: Sema/attr-format-missing.c' FAILED 

Exit Code: 1

Command Output (stderr):
--
RUN: at line 1: 
/opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/stage1/bin/clang
 -cc1 -internal-isystem 
/opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/stage1/lib/clang/19/include
 -nostdsysteminc -fsyntax-only -verify=expected,c_diagnostics 
-Wmissing-format-attribute 
/opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/llvm/clang/test/Sema/attr-format-missing.c
+ 
/opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/stage1/bin/clang
 -cc1 -internal-isystem 
/opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/stage1/lib/clang/19/include
 -nostdsysteminc -fsyntax-only -verify=expected,c_diagnostics 
-Wmissing-format-attribute 
/opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/llvm/clang/test/Sema/attr-format-missing.c
RUN: at line 2: 
/opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/stage1/bin/clang
 -cc1 -internal-isystem 
/opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/stage1/lib/clang/19/include
 -nostdsysteminc -fsyntax-only -Wmissing-format-attribute 
-fdiagnostics-parseable-fixits 
/opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/llvm/clang/test/Sema/attr-format-missing.c
 2>&1 | 
/opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/stage1/bin/FileCheck
 
/opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/llvm/clang/test/Sema/attr-format-missing.c
 --check-prefixes=CHECK,C-CHECK
+ 
/opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/stage1/bin/clang
 -cc1 -internal-isystem 
/opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/stage1/lib/clang/19/include
 -nostdsysteminc -fsyntax-only -Wmissing-format-attribute 
-fdiagnostics-parseable-fixits 
/opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/llvm/clang/test/Sema/attr-format-missing.c
+ 
/opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/stage1/bin/FileCheck
 
/opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/llvm/clang/test/Sema/attr-format-missing.c
 --check-prefixes=CHECK,C-CHECK
RUN: at line 3: 
/opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/stage1/bin/clang
 -cc1 -internal-isystem 
/opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/stage1/lib/clang/19/include
 -nostdsysteminc -fsyntax-only -x c++ -verify=expected,cpp_diagnostics 
-Wmissing-format-attribute 
/opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/llvm/clang/test/Sema/attr-format-missing.c
+ 
/opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/stage1/bin/clang
 -cc1 -internal-isystem 
/opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/stage1/lib/clang/19/include
 -nostdsysteminc -fsyntax-only -x c++ -verify=expected,cpp_diagnostics 
-Wmissing-format-attribute 
/opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/llvm/clang/test/Sema/attr-format-missing.c
error: 'cpp_diagnostics-error' diagnostics seen but not expected: 
  File 
/opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/llvm/clang/test/Sema/attr-format-missing.c
 Line 87: subscript of pointer to incomplete type 'void'
  File 
/opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/llvm/clang/test/Sema/attr-format-missing.c
 Line 95: subscript of pointer to incomplete type 'void'
  File 
/opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/llvm/clang/test/Sema/attr-format-missing.c
 Line 96: subscript of pointer to incomplete type 'void'
error: 'cpp_diagnostics-warning' diagnostics expected but not seen: 
  File 
/opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/llvm/clang/test/Sema/attr-format-missing.c
 Line 83 (directive at 
/opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/llvm/clang/test/Sema/attr-format-missing.c:87):
 diagnostic behavior may be improved by adding the 'scanf' format attribute to 
the declaration of 'f7'
4 errors generated.

--




```

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


[clang] [clang] Catch missing format attributes (PR #70024)

2024-07-12 Thread LLVM Continuous Integration via cfe-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `llvm-clang-x86_64-darwin` 
running on `doug-worker-3` while building `clang` at step 6 
"test-build-unified-tree-check-all".

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

Here is the relevant piece of the build log for the reference:
```
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
 TEST 'Clang :: Sema/attr-format-missing.c' FAILED 

Exit Code: 1

Command Output (stderr):
--
RUN: at line 1: /Volumes/RAMDisk/buildbot-root/x86_64-darwin/build/bin/clang 
-cc1 -internal-isystem 
/Volumes/RAMDisk/buildbot-root/x86_64-darwin/build/lib/clang/19/include 
-nostdsysteminc -fsyntax-only -verify=expected,c_diagnostics 
-Wmissing-format-attribute 
/Volumes/RAMDisk/buildbot-root/x86_64-darwin/llvm-project/clang/test/Sema/attr-format-missing.c
+ /Volumes/RAMDisk/buildbot-root/x86_64-darwin/build/bin/clang -cc1 
-internal-isystem 
/Volumes/RAMDisk/buildbot-root/x86_64-darwin/build/lib/clang/19/include 
-nostdsysteminc -fsyntax-only -verify=expected,c_diagnostics 
-Wmissing-format-attribute 
/Volumes/RAMDisk/buildbot-root/x86_64-darwin/llvm-project/clang/test/Sema/attr-format-missing.c
error: 'c_diagnostics-warning' diagnostics seen but not expected: 
  File 
/Volumes/RAMDisk/buildbot-root/x86_64-darwin/llvm-project/clang/test/Sema/attr-format-missing.c
 Line 391: incompatible pointer types passing 'char *' to parameter of type 
'struct __va_list_tag *'
error: 'c_diagnostics-note' diagnostics seen but not expected: 
  File 
/Volumes/RAMDisk/buildbot-root/x86_64-darwin/llvm-project/clang/test/Sema/attr-format-missing.c
 Line 30: passing argument to parameter here
2 errors generated.

--




```

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


[clang] [clang] Catch missing format attributes (PR #70024)

2024-07-12 Thread LLVM Continuous Integration via cfe-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `llvm-clang-win-x-aarch64` 
running on `as-builder-2` while building `clang` at step 9 "test-check-clang".

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

Here is the relevant piece of the build log for the reference:
```
Step 9 (test-check-clang) failure: Test just built components for check-clang 
completed (failure)
 TEST 'Clang :: Sema/attr-format-missing.c' FAILED 

Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
c:\buildbot\as-builder-2\x-aarch64\build\bin\clang.exe -cc1 -internal-isystem 
C:\buildbot\as-builder-2\x-aarch64\build\lib\clang\19\include -nostdsysteminc 
-fsyntax-only -verify=expected,c_diagnostics -Wmissing-format-attribute 
C:\buildbot\as-builder-2\x-aarch64\llvm-project\clang\test\Sema\attr-format-missing.c
# executed command: 'c:\buildbot\as-builder-2\x-aarch64\build\bin\clang.exe' 
-cc1 -internal-isystem 
'C:\buildbot\as-builder-2\x-aarch64\build\lib\clang\19\include' -nostdsysteminc 
-fsyntax-only -verify=expected,c_diagnostics -Wmissing-format-attribute 
'C:\buildbot\as-builder-2\x-aarch64\llvm-project\clang\test\Sema\attr-format-missing.c'
# .---command stderr
# | error: 'c_diagnostics-error' diagnostics seen but not expected: 
# |   File 
C:\buildbot\as-builder-2\x-aarch64\llvm-project\clang\test\Sema\attr-format-missing.c
 Line 87: subscripted value is not an array, pointer, or vector
# |   File 
C:\buildbot\as-builder-2\x-aarch64\llvm-project\clang\test\Sema\attr-format-missing.c
 Line 95: subscripted value is not an array, pointer, or vector
# |   File 
C:\buildbot\as-builder-2\x-aarch64\llvm-project\clang\test\Sema\attr-format-missing.c
 Line 96: subscripted value is not an array, pointer, or vector
# |   File 
C:\buildbot\as-builder-2\x-aarch64\llvm-project\clang\test\Sema\attr-format-missing.c
 Line 391: passing 'char *' to parameter of incompatible type 
'__builtin_va_list'
# | error: 'c_diagnostics-warning' diagnostics expected but not seen: 
# |   File 
C:\buildbot\as-builder-2\x-aarch64\llvm-project\clang\test\Sema\attr-format-missing.c
 Line 83 (directive at 
C:\buildbot\as-builder-2\x-aarch64\llvm-project\clang\test\Sema\attr-format-missing.c:87):
 diagnostic behavior may be improved by adding the 'scanf' format attribute to 
the declaration of 'f7'
# |   File 
C:\buildbot\as-builder-2\x-aarch64\llvm-project\clang\test\Sema\attr-format-missing.c
 Line 111 (directive at 
C:\buildbot\as-builder-2\x-aarch64\llvm-project\clang\test\Sema\attr-format-missing.c:113):
 incompatible pointer types passing 'const wchar_t *' (aka 'const int *') to 
parameter of type 'const char *'
# |   File 
C:\buildbot\as-builder-2\x-aarch64\llvm-project\clang\test\Sema\attr-format-missing.c
 Line 141 (directive at 
C:\buildbot\as-builder-2\x-aarch64\llvm-project\clang\test\Sema\attr-format-missing.c:143):
 incompatible pointer types passing 'const wchar_t *' (aka 'const int *') to 
parameter of type 'const char *'
# | error: 'c_diagnostics-warning' diagnostics seen but not expected: 
# |   File 
C:\buildbot\as-builder-2\x-aarch64\llvm-project\clang\test\Sema\attr-format-missing.c
 Line 111: incompatible pointer types passing 'const wchar_t *' (aka 'const 
unsigned int *') to parameter of type 'const char *'
# |   File 
C:\buildbot\as-builder-2\x-aarch64\llvm-project\clang\test\Sema\attr-format-missing.c
 Line 141: incompatible pointer types passing 'const wchar_t *' (aka 'const 
unsigned int *') to parameter of type 'const char *'
# |   File 
C:\buildbot\as-builder-2\x-aarch64\llvm-project\clang\test\Sema\attr-format-missing.c
 Line 387: diagnostic behavior may be improved by adding the 'printf' format 
attribute to the declaration of 'f41'
# | error: 'c_diagnostics-note' diagnostics seen but not expected: 
# |   File 
C:\buildbot\as-builder-2\x-aarch64\llvm-project\clang\test\Sema\attr-format-missing.c
 Line 30: passing argument to parameter here
# | 11 errors generated.
# `-
# error: command failed with exit status: 1

--




```

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


[clang-tools-extra] [clang-doc] add nested namespace test case (PR #97681)

2024-07-12 Thread via cfe-commits

https://github.com/PeterChou1 updated 
https://github.com/llvm/llvm-project/pull/97681

>From f9d5cc074e4b65a92703bd09e62696a29fed1237 Mon Sep 17 00:00:00 2001
From: PeterChou1 
Date: Thu, 4 Jul 2024 01:31:13 -0400
Subject: [PATCH 1/4] [clang-doc] add nested naemspace

---
 .../test/clang-doc/namespace.cpp  | 340 ++
 1 file changed, 340 insertions(+)
 create mode 100644 clang-tools-extra/test/clang-doc/namespace.cpp

diff --git a/clang-tools-extra/test/clang-doc/namespace.cpp 
b/clang-tools-extra/test/clang-doc/namespace.cpp
new file mode 100644
index 0..6fb91c9aa3c51
--- /dev/null
+++ b/clang-tools-extra/test/clang-doc/namespace.cpp
@@ -0,0 +1,340 @@
+// RUN: clang-doc --format=html --output=%t/docs --executor=standalone %s
+// RUN: clang-doc --format=md --output=%t/docs --executor=standalone %s
+// RUN: FileCheck %s -input-file=%t/docs/index_json.js -check-prefix=JSON-INDEX
+// RUN: FileCheck %s -input-file=%t/docs/@nonymous_namespace/AnonClass.html 
-check-prefix=HTML-ANON-CLASS
+// RUN: FileCheck %s -input-file=%t/docs/@nonymous_namespace/index.html 
-check-prefix=HTML-ANON-INDEX
+// RUN: FileCheck %s 
-input-file=%t/docs/AnotherNamespace/ClassInAnotherNamespace.html 
-check-prefix=HTML-ANOTHER-CLASS
+// RUN: FileCheck %s -input-file=%t/docs/AnotherNamespace/index.html 
-check-prefix=HTML-ANOTHER-INDEX
+// RUN: FileCheck %s -input-file=%t/docs/GlobalNamespace/index.html 
-check-prefix=HTML-GLOBAL-INDEX
+// RUN: FileCheck %s 
-input-file=%t/docs/PrimaryNamespace/NestedNamespace/ClassInNestedNamespace.html
 -check-prefix=HTML-NESTED-CLASS
+// RUN: FileCheck %s 
-input-file=%t/docs/PrimaryNamespace/NestedNamespace/index.html 
-check-prefix=HTML-NESTED-INDEX
+// RUN: FileCheck %s -input-file=%t/docs/PrimaryNamespace/index.html 
-check-prefix=HTML-PRIMARY-INDEX
+// RUN: FileCheck %s 
-input-file=%t/docs/PrimaryNamespace/ClassInPrimaryNamespace.html 
-check-prefix=HTML-PRIMARY-CLASS
+// RUN: FileCheck %s -input-file=%t/docs/@nonymous_namespace/AnonClass.md 
-check-prefix=MD-ANON-CLASS
+// RUN: FileCheck %s -input-file=%t/docs/@nonymous_namespace/index.md 
-check-prefix=MD-ANON-INDEX
+// RUN: FileCheck %s 
-input-file=%t/docs/AnotherNamespace/ClassInAnotherNamespace.md 
-check-prefix=MD-ANOTHER-CLASS
+// RUN: FileCheck %s -input-file=%t/docs/AnotherNamespace/index.md 
-check-prefix=MD-ANOTHER-INDEX
+// RUN: FileCheck %s -input-file=%t/docs/GlobalNamespace/index.md 
-check-prefix=MD-GLOBAL-INDEX
+// RUN: FileCheck %s 
-input-file=%t/docs/PrimaryNamespace/NestedNamespace/ClassInNestedNamespace.md 
-check-prefix=MD-NESTED-CLASS
+// RUN: FileCheck %s 
-input-file=%t/docs/PrimaryNamespace/NestedNamespace/index.md 
-check-prefix=MD-NESTED-INDEX
+// RUN: FileCheck %s -input-file=%t/docs/PrimaryNamespace/index.md 
-check-prefix=MD-PRIMARY-INDEX
+// RUN: FileCheck %s 
-input-file=%t/docs/PrimaryNamespace/ClassInPrimaryNamespace.md 
-check-prefix=MD-PRIMARY-CLASS
+// RUN: FileCheck %s -input-file=%t/docs/all_files.md 
-check-prefix=MD-ALL-FILES
+// RUN: FileCheck %s -input-file=%t/docs/index.md -check-prefix=MD-INDEX
+
+// Anonymous Namespace
+namespace
+{
+void anonFunction() {}
+class AnonClass {};
+}
+
+// Primary Namespace
+namespace PrimaryNamespace {
+// Function in PrimaryNamespace
+void functionInPrimaryNamespace() {}
+
+// Class in PrimaryNamespace
+class ClassInPrimaryNamespace {};
+
+// Nested namespace
+namespace NestedNamespace {
+// Function in NestedNamespace
+void functionInNestedNamespace() {}
+// Class in NestedNamespace
+class ClassInNestedNamespace {};
+}
+}
+
+// AnotherNamespace
+namespace AnotherNamespace {
+// Function in AnotherNamespace
+void functionInAnotherNamespace() {}
+// Class in AnotherNamespace
+class ClassInAnotherNamespace {};
+}
+
+// JSON-INDEX: async function LoadIndex() {
+// JSON-INDEX-NEXT: return{
+// JSON-INDEX-NEXT:   "USR": "{{([0-9A-F]{40})}}",
+// JSON-INDEX-NEXT:   "Name": "",
+// JSON-INDEX-NEXT:   "RefType": "default",
+// JSON-INDEX-NEXT:   "Path": "",
+// JSON-INDEX-NEXT:   "Children": [
+// JSON-INDEX-NEXT: {
+// JSON-INDEX-NEXT:   "USR": "{{([0-9A-F]{40})}}",
+// JSON-INDEX-NEXT:   "Name": "@nonymous_namespace",
+// JSON-INDEX-NEXT:   "RefType": "namespace",
+// JSON-INDEX-NEXT:   "Path": "@nonymous_namespace",
+// JSON-INDEX-NEXT:   "Children": [
+// JSON-INDEX-NEXT: {
+// JSON-INDEX-NEXT:   "USR": "{{([0-9A-F]{40})}}",
+// JSON-INDEX-NEXT:   "Name": "AnonClass",
+// JSON-INDEX-NEXT:   "RefType": "record",
+// JSON-INDEX-NEXT:   "Path": "@nonymous_namespace",
+// JSON-INDEX-NEXT:   "Children": []
+// JSON-INDEX-NEXT: }
+// JSON-INDEX-NEXT:   ]
+// JSON-INDEX-NEXT: },
+// JSON-INDEX-NEXT: {
+// JSON-INDEX-NEXT:   "USR": "{{([0-9A-F]{40})}}",
+// JSON-INDEX-NEXT:   "Name": "AnotherNamespace",
+// JSON-INDEX-NEXT:   "RefType": "namespace",
+

[clang-tools-extra] [clang-doc] add enum test (PR #97679)

2024-07-12 Thread via cfe-commits

https://github.com/PeterChou1 updated 
https://github.com/llvm/llvm-project/pull/97679

>From b5e0335199541225a1b0eb5eaf661cd4df55dbd7 Mon Sep 17 00:00:00 2001
From: PeterChou1 
Date: Thu, 4 Jul 2024 01:14:11 -0400
Subject: [PATCH 1/5] [clang-doc] add enum test

---
 clang-tools-extra/test/clang-doc/enum.cpp | 38 +++
 1 file changed, 38 insertions(+)
 create mode 100644 clang-tools-extra/test/clang-doc/enum.cpp

diff --git a/clang-tools-extra/test/clang-doc/enum.cpp 
b/clang-tools-extra/test/clang-doc/enum.cpp
new file mode 100644
index 0..2f25eaf4e44e2
--- /dev/null
+++ b/clang-tools-extra/test/clang-doc/enum.cpp
@@ -0,0 +1,38 @@
+// RUN: clang-doc --format=html --doxygen --output=%t/docs 
--executor=standalone %s
+// RUN: clang-doc --format=md --doxygen --output=%t/docs --executor=standalone 
%s
+// RUN: FileCheck %s -input-file=%t/docs/GlobalNamespace/index.html 
-check-prefix=HTML-INDEX
+// RUN: FileCheck %s -input-file=%t/docs/GlobalNamespace/index.md 
-check-prefix=MD-INDEX
+
+/**
+ * @brief For specifying RGB colors
+ */
+enum Color {
+  Red, // Red enums
+  Green, // Green enums
+  Blue // Blue enums
+};
+
+// HTML-INDEX: Global Namespace
+// HTML-INDEX: Enums
+// HTML-INDEX: 
+// HTML-INDEX:   enum Color
+// HTML-INDEX:   
+// HTML-INDEX: Red
+// HTML-INDEX: Green
+// HTML-INDEX: Blue
+// HTML-INDEX:   
+// HTML-INDEX:   Defined at line 11 of file 
{{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}enum.cpp
+// HTML-INDEX:   
+// HTML-INDEX: 
+// HTML-INDEX:   
+// HTML-INDEX: 
+
+// MD-INDEX: # Global Namespace
+// MD-INDEX: ## Enums
+// MD-INDEX: | enum Color |
+// MD-INDEX: --
+// MD-INDEX: | Red |
+// MD-INDEX: | Green |
+// MD-INDEX: | Blue |
+// MD-INDEX: *Defined at 
{{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}enum.cpp#11*
+// MD-INDEX: **brief** For specifying RGB colors
\ No newline at end of file

>From c10f9d42c26e6d26833a35824216529ab25e7fe8 Mon Sep 17 00:00:00 2001
From: PeterChou1 
Date: Thu, 4 Jul 2024 01:53:19 -0400
Subject: [PATCH 2/5] [clang-doc] update defined at line

---
 clang-tools-extra/test/clang-doc/enum.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang-tools-extra/test/clang-doc/enum.cpp 
b/clang-tools-extra/test/clang-doc/enum.cpp
index 2f25eaf4e44e2..1e7dd6e4c5b0c 100644
--- a/clang-tools-extra/test/clang-doc/enum.cpp
+++ b/clang-tools-extra/test/clang-doc/enum.cpp
@@ -21,7 +21,7 @@ enum Color {
 // HTML-INDEX: Green
 // HTML-INDEX: Blue
 // HTML-INDEX:   
-// HTML-INDEX:   Defined at line 11 of file 
{{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}enum.cpp
+// HTML-INDEX:   Defined at line 9 of file 
{{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}enum.cpp
 // HTML-INDEX:   
 // HTML-INDEX: 
 // HTML-INDEX:   

>From 8709091091b0ca889ca7911e06b7a4dae61a3581 Mon Sep 17 00:00:00 2001
From: PeterChou1 
Date: Thu, 4 Jul 2024 02:06:08 -0400
Subject: [PATCH 3/5] [clang-doc] fix lines

---
 clang-tools-extra/test/clang-doc/enum.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang-tools-extra/test/clang-doc/enum.cpp 
b/clang-tools-extra/test/clang-doc/enum.cpp
index 1e7dd6e4c5b0c..5a1452788a55f 100644
--- a/clang-tools-extra/test/clang-doc/enum.cpp
+++ b/clang-tools-extra/test/clang-doc/enum.cpp
@@ -34,5 +34,5 @@ enum Color {
 // MD-INDEX: | Red |
 // MD-INDEX: | Green |
 // MD-INDEX: | Blue |
-// MD-INDEX: *Defined at 
{{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}enum.cpp#11*
+// MD-INDEX: *Defined at 
{{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}enum.cpp#9*
 // MD-INDEX: **brief** For specifying RGB colors
\ No newline at end of file

>From 6b7dbe5b3bf2ceb7fe72ec061e3d9bc3e2609299 Mon Sep 17 00:00:00 2001
From: PeterChou1 
Date: Fri, 12 Jul 2024 05:28:15 -0400
Subject: [PATCH 4/5] [clang-doc] address pr

---
 clang-tools-extra/test/clang-doc/enum.cpp | 28 +--
 1 file changed, 11 insertions(+), 17 deletions(-)

diff --git a/clang-tools-extra/test/clang-doc/enum.cpp 
b/clang-tools-extra/test/clang-doc/enum.cpp
index 5a1452788a55f..971d63e590f2d 100644
--- a/clang-tools-extra/test/clang-doc/enum.cpp
+++ b/clang-tools-extra/test/clang-doc/enum.cpp
@@ -1,31 +1,25 @@
+// RUN: rm -rf %t && mkdir -p %t
 // RUN: clang-doc --format=html --doxygen --output=%t/docs 
--executor=standalone %s
 // RUN: clang-doc --format=md --doxygen --output=%t/docs --executor=standalone 
%s
-// RUN: FileCheck %s -input-file=%t/docs/GlobalNamespace/index.html 
-check-prefix=HTML-INDEX
-// RUN: FileCheck %s -input-file=%t/docs/GlobalNamespace/index.md 
-check-prefix=MD-INDEX
+// RUN: FileCheck %s < %t/docs/GlobalNamespace/index.html 
-check-prefix=HTML-INDEX
+// RUN: FileCheck %s < %t/docs/GlobalNamespace/index.md -check-prefix=MD-INDEX
 
 /**
  * @brief For specifying RGB colors
  */
 enum Color {
-  Red, // Red enums
-  Green, // Green enums
-  Blue // Blue enums
+  Red,
+  Green,
+  Blue
 };
 

[clang] 0913547 - [C2y] Claim partial conformance to WG14 N3244 (#98525)

2024-07-12 Thread via cfe-commits

Author: Aaron Ballman
Date: 2024-07-12T06:54:42-04:00
New Revision: 0913547d0e3939cc420e88ecd037240f33736820

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

LOG: [C2y] Claim partial conformance to WG14 N3244 (#98525)

This paper had several changes within it, and Clang implements some of
the changes, but not others. This updates the status accordingly.

Added: 
clang/test/C/C2y/n3244.c

Modified: 
clang/www/c_status.html

Removed: 




diff  --git a/clang/test/C/C2y/n3244.c b/clang/test/C/C2y/n3244.c
new file mode 100644
index 0..c1f62d59d2690
--- /dev/null
+++ b/clang/test/C/C2y/n3244.c
@@ -0,0 +1,83 @@
+// RUN: %clang_cc1 -std=c2y %s -verify -Wno-gnu-alignof-expression
+
+/* WG14 N3244: Partial
+ * Slay Some Earthly Demons I
+ *
+ * NB: the committee adopted:
+ *   Annex J Item 21 (including additional change) -- no, we lack explicit 
documentation
+ *   Annex J Item 56 -- yes
+ *   Annex J Item 57 Option 1 -- yes
+ *   Annex J Item 67 -- no
+ *   Annex J Item 69 (alternative wording for semantics) -- no
+ */
+
+void reg_array(void) {
+  // Decay of an array with the register storage class specifier has gone from
+  // explicit undefined behavior to be implementation defined instead. Clang
+  // does not support this.
+  register int array[10];
+  (void)sizeof(array); // okay
+  int *vp = array;// expected-error {{address of register variable 
requested}}
+  int val = array[0]; // expected-error {{address of register variable 
requested}}
+}
+
+struct F;  // expected-note {{forward declaration of 'struct F'}}
+void incomplete_no_linkage(struct F); // okay
+void incomplete_no_linkage(struct F f) { // expected-error {{variable has 
incomplete type 'struct F'}}
+  struct G g; // expected-error {{variable has incomplete type 'struct G'}} \
+ expected-note {{forward declaration of 'struct G'}}
+  int i[];// expected-error {{definition of variable with array type needs 
an explicit size or an initializer}}
+}
+
+void block_scope_non_extern_func_decl(void) {
+  static void f(void); // expected-error {{function declared in block scope 
cannot have 'static' storage class}}
+  extern void g(void); // okay
+  __private_extern__ void h(void); // okay
+}
+
+// FIXME: this function should be diagnosed as it is never defined in the TU.
+extern inline void never_defined_extern_inline(void);
+
+// While this declaration is fine because the function is defined within the 
TU.
+extern inline void is_defined_extern_inline(void);
+extern inline void is_defined_extern_inline(void) {}
+
+int NoAlignmentOnOriginalDecl;
+// FIXME: the original declaration has no alignment specifier, so the
+// declaration below should be diagnosed due to the incompatible alignment
+// specifier.
+_Alignas(8) int NoAlignmentOnOriginalDecl;
+_Static_assert(_Alignof(NoAlignmentOnOriginalDecl) == 8, "");
+
+_Alignas(8) int AlignmentOnOriginalDecl; // expected-note {{declared with 
'_Alignas' attribute here}}
+// FIXME: this should be accepted because the redeclaration has no alignment
+// specifier.
+int AlignmentOnOriginalDecl; // expected-error {{'_Alignas' must be specified 
on definition if it is specified on any declaration}}
+_Static_assert(_Alignof(AlignmentOnOriginalDecl) == 8, "");
+
+long long CompatibleAlignment;
+_Static_assert(_Alignof(CompatibleAlignment) == _Alignof(long long), "");
+_Alignas(_Alignof(long long)) long long CompatibleAlignment; // Okay, 
alignment is the same as the implied alignment
+
+_Alignas(_Alignof(long long)) long long CompatibleAlignment2; // expected-note 
{{declared with '_Alignas' attribute here}}
+// FIXME: this should be accepted because the redeclaration has no alignment
+// specifier.
+long long CompatibleAlignment2; // expected-error {{'_Alignas' must be 
specified on definition if it is specified on any declaration}}
+
+// FIXME: this should be accepted because the definition specifies the
+// alignment and a subsequent declaration does not specify any alignment.
+_Alignas(8) long long DefnWithInit = 12; // expected-note {{declared with 
'_Alignas' attribute here}}
+long long DefnWithInit; // expected-error {{'_Alignas' must be specified on 
definition if it is specified on any declaration}}
+
+// This is accepted because the definition has an alignment specifier and the
+// subsequent redeclaration does not specify an alignment.
+_Alignas(8) long long DefnWithInit2 = 12;
+extern long long DefnWithInit2;
+
+// FIXME: this should be accepted because the definition specifies the
+// alignment and a subsequent declaration specifies a compatible alignment.
+long long DefnWithInit3 = 12; // expected-error {{'_Alignas' must be specified 
on definition if it is specified on any declaration}}
+_Alignas(_Alignof(long long)) long long DefnWithIni

[clang] [C2y] Claim partial conformance to WG14 N3244 (PR #98525)

2024-07-12 Thread Aaron Ballman via cfe-commits

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


[clang] 2369a54 - Finish deleting the le32/le64 targets (#98497)

2024-07-12 Thread via cfe-commits

Author: Aaron Ballman
Date: 2024-07-12T06:55:49-04:00
New Revision: 2369a54fbeb61f965a3a425e660c878ae8b962c3

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

LOG: Finish deleting the le32/le64 targets (#98497)

This is a revert of ef5e7f90ea4d5063ce68b952c5de473e610afc02 which was a
temporary partial revert of 77ac823fd285973cfb3517932c09d82e6a32f46d.
The le32 and le64 targets are no longer necessary to retain, so this
removes them entirely.

Added: 


Modified: 
clang/docs/ReleaseNotes.rst
clang/docs/tools/clang-formatted-files.txt
clang/lib/Basic/CMakeLists.txt
clang/lib/Basic/Targets.cpp
clang/lib/Basic/Targets/OSTargets.h
clang/lib/CodeGen/CodeGenModule.cpp
clang/lib/CodeGen/ItaniumCXXABI.cpp
clang/lib/Driver/ToolChains/Clang.cpp
clang/test/CodeGen/bitfield-access-pad.c
clang/test/CodeGen/bitfield-access-unit.c
clang/test/CodeGenCXX/bitfield-access-empty.cpp
clang/test/CodeGenCXX/bitfield-access-tail.cpp
clang/test/Preprocessor/predefined-macros-no-warnings.c
llvm/include/llvm/TargetParser/Triple.h
llvm/lib/TargetParser/Triple.cpp
llvm/utils/gn/secondary/clang/lib/Basic/BUILD.gn

Removed: 
clang/lib/Basic/Targets/Le64.cpp
clang/lib/Basic/Targets/Le64.h



diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 15439e70c67d4..afcd3c655f0f6 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -40,6 +40,8 @@ code bases.
 - Setting the deprecated CMake variable ``GCC_INSTALL_PREFIX`` (which sets the
   default ``--gcc-toolchain=``) now leads to a fatal error.
 
+- The ``le32`` and ``le64`` targets have been removed.
+
 C/C++ Language Potentially Breaking Changes
 ---
 

diff  --git a/clang/docs/tools/clang-formatted-files.txt 
b/clang/docs/tools/clang-formatted-files.txt
index a8ee8f1fcb87c..62871133a6807 100644
--- a/clang/docs/tools/clang-formatted-files.txt
+++ b/clang/docs/tools/clang-formatted-files.txt
@@ -362,7 +362,6 @@ clang/lib/Basic/Targets/BPF.cpp
 clang/lib/Basic/Targets/BPF.h
 clang/lib/Basic/Targets/Hexagon.h
 clang/lib/Basic/Targets/Lanai.h
-clang/lib/Basic/Targets/Le64.h
 clang/lib/Basic/Targets/M68k.h
 clang/lib/Basic/Targets/MSP430.h
 clang/lib/Basic/Targets/NVPTX.cpp

diff  --git a/clang/lib/Basic/CMakeLists.txt b/clang/lib/Basic/CMakeLists.txt
index f30680552e0f5..e7ebc8f191aa6 100644
--- a/clang/lib/Basic/CMakeLists.txt
+++ b/clang/lib/Basic/CMakeLists.txt
@@ -102,7 +102,6 @@ add_clang_library(clangBasic
   Targets/DirectX.cpp
   Targets/Hexagon.cpp
   Targets/Lanai.cpp
-  Targets/Le64.cpp
   Targets/LoongArch.cpp
   Targets/M68k.cpp
   Targets/MSP430.cpp

diff  --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp
index 29133f9ee8fce..0b8e565345b6a 100644
--- a/clang/lib/Basic/Targets.cpp
+++ b/clang/lib/Basic/Targets.cpp
@@ -23,7 +23,6 @@
 #include "Targets/DirectX.h"
 #include "Targets/Hexagon.h"
 #include "Targets/Lanai.h"
-#include "Targets/Le64.h"
 #include "Targets/LoongArch.h"
 #include "Targets/M68k.h"
 #include "Targets/MSP430.h"
@@ -344,17 +343,6 @@ std::unique_ptr AllocateTarget(const 
llvm::Triple &Triple,
   return std::make_unique(Triple, Opts);
 }
 
-  case llvm::Triple::le32:
-switch (os) {
-case llvm::Triple::NaCl:
-  return std::make_unique>(Triple, Opts);
-default:
-  return nullptr;
-}
-
-  case llvm::Triple::le64:
-return std::make_unique(Triple, Opts);
-
   case llvm::Triple::ppc:
 switch (os) {
 case llvm::Triple::Linux:

diff  --git a/clang/lib/Basic/Targets/Le64.cpp 
b/clang/lib/Basic/Targets/Le64.cpp
deleted file mode 100644
index f7afa0e747d67..0
--- a/clang/lib/Basic/Targets/Le64.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-//===--- Le64.cpp - Implement Le64 target feature support 
-===//
-//
-// 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 implements Le64 TargetInfo objects.
-//
-//===--===//
-
-#include "Le64.h"
-#include "Targets.h"
-#include "clang/Basic/Builtins.h"
-#include "clang/Basic/MacroBuilder.h"
-#include "clang/Basic/TargetBuiltins.h"
-
-using namespace clang;
-using namespace clang::targets;
-
-ArrayRef Le64TargetInfo::getTargetBuiltins() const {
-  return {};
-}
-
-void Le64TargetInfo::getTargetDefines(const LangOptions &Opts,
-  MacroBuilder &Builder) const {
-  DefineStd(Builder, "unix", Opts);
-  defineCPUMacros(Builder, "le64", 

[clang] [llvm] Finish deleting the le32/le64 targets (PR #98497)

2024-07-12 Thread Aaron Ballman via cfe-commits

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


[clang] [clang] Add option to opt out of the missing_dependent_template_keyword diagnostic (PR #98613)

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

https://github.com/hokein updated 
https://github.com/llvm/llvm-project/pull/98613

>From d22741375619b2b134509049aad7958348abcc30 Mon Sep 17 00:00:00 2001
From: Haojian Wu 
Date: Fri, 12 Jul 2024 12:26:07 +0200
Subject: [PATCH 1/2] [clang] Allow to opt out the
 missing_dependent_template_keyword diagnostic.

---
 clang/include/clang/Basic/DiagnosticParseKinds.td | 3 ++-
 clang/test/Misc/warning-flags.c   | 3 +--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/clang/include/clang/Basic/DiagnosticParseKinds.td 
b/clang/include/clang/Basic/DiagnosticParseKinds.td
index 0bd2e35bf2e31..e00cd47411cb3 100644
--- a/clang/include/clang/Basic/DiagnosticParseKinds.td
+++ b/clang/include/clang/Basic/DiagnosticParseKinds.td
@@ -896,7 +896,8 @@ def missing_template_arg_list_after_template_kw : Extension<
   DefaultError;
 
 def ext_missing_dependent_template_keyword : ExtWarn<
-  "use 'template' keyword to treat '%0' as a dependent template name">;
+  "use 'template' keyword to treat '%0' as a dependent template name">,
+  InGroup>;
 
 def ext_extern_template : Extension<
   "extern templates are a C++11 extension">, InGroup;
diff --git a/clang/test/Misc/warning-flags.c b/clang/test/Misc/warning-flags.c
index 651a86fb6e226..7b993f6849363 100644
--- a/clang/test/Misc/warning-flags.c
+++ b/clang/test/Misc/warning-flags.c
@@ -18,10 +18,9 @@ This test serves two purposes:
 
 The list of warnings below should NEVER grow.  It should gradually shrink to 0.
 
-CHECK: Warnings without flags (65):
+CHECK: Warnings without flags (64):
 
 CHECK-NEXT:   ext_expected_semi_decl_list
-CHECK-NEXT:   ext_missing_dependent_template_keyword
 CHECK-NEXT:   ext_missing_whitespace_after_macro_name
 CHECK-NEXT:   ext_new_paren_array_nonconst
 CHECK-NEXT:   ext_plain_complex

>From 2c474db9145ef66af17e09ac68343a1666fa0877 Mon Sep 17 00:00:00 2001
From: Haojian Wu 
Date: Fri, 12 Jul 2024 12:57:48 +0200
Subject: [PATCH 2/2] Add release note

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

diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index c9b7d4e6d75e0..a0e15975744d8 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -313,6 +313,7 @@ Resolutions to C++ Defect Reports
 
 - Clang now correctly implements lookup for the terminal name of a 
member-qualified nested-name-specifier.
   (`CWG1835: Dependent member lookup before < 
`_).
+  The warning can be disabled via `-Wno-missing-dependent-template-keyword`.
 
 C Language Changes
 --

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


[clang] [clang] Add option to opt out of the missing_dependent_template_keyword diagnostic (PR #98613)

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

hokein wrote:

> Reasonable, LGTM. Perhaps a release note should be added?

Thanks for the review. Done.

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


[clang] 9d10172 - Revert "[clang] Catch missing format attributes" (#98617)

2024-07-12 Thread via cfe-commits

Author: Aaron Ballman
Date: 2024-07-12T06:58:43-04:00
New Revision: 9d1017204a253782a82d1b7d16c59eea3f811a11

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

LOG: Revert "[clang] Catch missing format attributes" (#98617)

Reverts llvm/llvm-project#70024

It broke several post-commit bots:
https://lab.llvm.org/buildbot/#/builders/193/builds/896
https://lab.llvm.org/buildbot/#/builders/23/builds/925
https://lab.llvm.org/buildbot/#/builders/13/builds/686
and others

Added: 


Modified: 
clang/docs/ReleaseNotes.rst
clang/include/clang/Basic/DiagnosticGroups.td
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/include/clang/Sema/Attr.h
clang/include/clang/Sema/Sema.h
clang/lib/Sema/SemaDecl.cpp
clang/lib/Sema/SemaDeclAttr.cpp

Removed: 
clang/test/Sema/attr-format-missing.c
clang/test/Sema/attr-format-missing.cpp



diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index afcd3c655f0f6..781fc8ab1de1e 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -716,9 +716,6 @@ Improvements to Clang's diagnostics
 
 - Clang now diagnoses integer constant expressions that are folded to a 
constant value as an extension in more circumstances. Fixes #GH59863
 
-- Clang now diagnoses missing format attributes for non-template functions and
-  class/struct/union members. Fixes #GH60718
-
 Improvements to Clang's time-trace
 --
 

diff  --git a/clang/include/clang/Basic/DiagnosticGroups.td 
b/clang/include/clang/Basic/DiagnosticGroups.td
index da6a3b2fe3571..2241f8481484e 100644
--- a/clang/include/clang/Basic/DiagnosticGroups.td
+++ b/clang/include/clang/Basic/DiagnosticGroups.td
@@ -525,6 +525,7 @@ def MainReturnType : DiagGroup<"main-return-type">;
 def MaxUnsignedZero : DiagGroup<"max-unsigned-zero">;
 def MissingBraces : DiagGroup<"missing-braces">;
 def MissingDeclarations: DiagGroup<"missing-declarations">;
+def : DiagGroup<"missing-format-attribute">;
 def MissingIncludeDirs : DiagGroup<"missing-include-dirs">;
 def MissingNoreturn : DiagGroup<"missing-noreturn">;
 def MultiChar : DiagGroup<"multichar">;

diff  --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td 
b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index f5c18edb65217..0ea3677355169 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -1031,9 +1031,6 @@ def err_opencl_invalid_param : Error<
 def err_opencl_invalid_return : Error<
   "declaring function return value of type %0 is not allowed %select{; did you 
forget * ?|}1">;
 def warn_enum_value_overflow : Warning<"overflow in enumeration value">;
-def warn_missing_format_attribute : Warning<
-  "diagnostic behavior may be improved by adding the %0 format attribute to 
the declaration of %1">,
-  InGroup>, DefaultIgnore;
 def warn_pragma_options_align_reset_failed : Warning<
   "#pragma options align=reset failed: %0">,
   InGroup;

diff  --git a/clang/include/clang/Sema/Attr.h b/clang/include/clang/Sema/Attr.h
index 37c124ca7b454..3f0b10212789a 100644
--- a/clang/include/clang/Sema/Attr.h
+++ b/clang/include/clang/Sema/Attr.h
@@ -123,13 +123,6 @@ inline bool isInstanceMethod(const Decl *D) {
   return false;
 }
 
-inline bool checkIfMethodHasImplicitObjectParameter(const Decl *D) {
-  if (const auto *MethodDecl = dyn_cast(D))
-return MethodDecl->isInstance() &&
-   !MethodDecl->hasCXXExplicitFunctionObjectParameter();
-  return false;
-}
-
 /// Diagnose mutually exclusive attributes when present on a given
 /// declaration. Returns true if diagnosed.
 template 

diff  --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index e30252749d2c3..6be6f6725e5b7 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -4594,10 +4594,6 @@ class Sema final : public SemaBase {
 
   enum class RetainOwnershipKind { NS, CF, OS };
 
-  void DiagnoseMissingFormatAttributes(Stmt *Body, const FunctionDecl *FDecl);
-  std::vector
-  GetMissingFormatAttributes(Stmt *Body, const FunctionDecl *FDecl);
-
   UuidAttr *mergeUuidAttr(Decl *D, const AttributeCommonInfo &CI,
   StringRef UuidAsWritten, MSGuidDecl *GuidDecl);
 

diff  --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 0039df2a21bc6..80b5a8cd4bae6 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -15934,8 +15934,6 @@ Decl *Sema::ActOnFinishFunctionBody(Decl *dcl, Stmt 
*Body,
 }
   }
 
-  DiagnoseMissingFormatAttributes(Body, FD);
-
   // We might not have found a prototype because we didn't wish to warn on
   // the lack of a missing prototype. Try again without the checks for
   // whether we

[clang] Revert "[clang] Catch missing format attributes" (PR #98617)

2024-07-12 Thread Aaron Ballman via cfe-commits

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


[clang] Revert "[clang] Catch missing format attributes" (PR #98617)

2024-07-12 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang

Author: Aaron Ballman (AaronBallman)


Changes

Reverts llvm/llvm-project#70024

It broke several post-commit bots:
https://lab.llvm.org/buildbot/#/builders/193/builds/896
https://lab.llvm.org/buildbot/#/builders/23/builds/925
https://lab.llvm.org/buildbot/#/builders/13/builds/686
and others

---

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


9 Files Affected:

- (modified) clang/docs/ReleaseNotes.rst (-3) 
- (modified) clang/include/clang/Basic/DiagnosticGroups.td (+1) 
- (modified) clang/include/clang/Basic/DiagnosticSemaKinds.td (-3) 
- (modified) clang/include/clang/Sema/Attr.h (-7) 
- (modified) clang/include/clang/Sema/Sema.h (-4) 
- (modified) clang/lib/Sema/SemaDecl.cpp (-2) 
- (modified) clang/lib/Sema/SemaDeclAttr.cpp (+2-217) 
- (removed) clang/test/Sema/attr-format-missing.c (-403) 
- (removed) clang/test/Sema/attr-format-missing.cpp (-174) 


``diff
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index afcd3c655f0f6..781fc8ab1de1e 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -716,9 +716,6 @@ Improvements to Clang's diagnostics
 
 - Clang now diagnoses integer constant expressions that are folded to a 
constant value as an extension in more circumstances. Fixes #GH59863
 
-- Clang now diagnoses missing format attributes for non-template functions and
-  class/struct/union members. Fixes #GH60718
-
 Improvements to Clang's time-trace
 --
 
diff --git a/clang/include/clang/Basic/DiagnosticGroups.td 
b/clang/include/clang/Basic/DiagnosticGroups.td
index da6a3b2fe3571..2241f8481484e 100644
--- a/clang/include/clang/Basic/DiagnosticGroups.td
+++ b/clang/include/clang/Basic/DiagnosticGroups.td
@@ -525,6 +525,7 @@ def MainReturnType : DiagGroup<"main-return-type">;
 def MaxUnsignedZero : DiagGroup<"max-unsigned-zero">;
 def MissingBraces : DiagGroup<"missing-braces">;
 def MissingDeclarations: DiagGroup<"missing-declarations">;
+def : DiagGroup<"missing-format-attribute">;
 def MissingIncludeDirs : DiagGroup<"missing-include-dirs">;
 def MissingNoreturn : DiagGroup<"missing-noreturn">;
 def MultiChar : DiagGroup<"multichar">;
diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td 
b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index f5c18edb65217..0ea3677355169 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -1031,9 +1031,6 @@ def err_opencl_invalid_param : Error<
 def err_opencl_invalid_return : Error<
   "declaring function return value of type %0 is not allowed %select{; did you 
forget * ?|}1">;
 def warn_enum_value_overflow : Warning<"overflow in enumeration value">;
-def warn_missing_format_attribute : Warning<
-  "diagnostic behavior may be improved by adding the %0 format attribute to 
the declaration of %1">,
-  InGroup>, DefaultIgnore;
 def warn_pragma_options_align_reset_failed : Warning<
   "#pragma options align=reset failed: %0">,
   InGroup;
diff --git a/clang/include/clang/Sema/Attr.h b/clang/include/clang/Sema/Attr.h
index 37c124ca7b454..3f0b10212789a 100644
--- a/clang/include/clang/Sema/Attr.h
+++ b/clang/include/clang/Sema/Attr.h
@@ -123,13 +123,6 @@ inline bool isInstanceMethod(const Decl *D) {
   return false;
 }
 
-inline bool checkIfMethodHasImplicitObjectParameter(const Decl *D) {
-  if (const auto *MethodDecl = dyn_cast(D))
-return MethodDecl->isInstance() &&
-   !MethodDecl->hasCXXExplicitFunctionObjectParameter();
-  return false;
-}
-
 /// Diagnose mutually exclusive attributes when present on a given
 /// declaration. Returns true if diagnosed.
 template 
diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index e30252749d2c3..6be6f6725e5b7 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -4594,10 +4594,6 @@ class Sema final : public SemaBase {
 
   enum class RetainOwnershipKind { NS, CF, OS };
 
-  void DiagnoseMissingFormatAttributes(Stmt *Body, const FunctionDecl *FDecl);
-  std::vector
-  GetMissingFormatAttributes(Stmt *Body, const FunctionDecl *FDecl);
-
   UuidAttr *mergeUuidAttr(Decl *D, const AttributeCommonInfo &CI,
   StringRef UuidAsWritten, MSGuidDecl *GuidDecl);
 
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 0039df2a21bc6..80b5a8cd4bae6 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -15934,8 +15934,6 @@ Decl *Sema::ActOnFinishFunctionBody(Decl *dcl, Stmt 
*Body,
 }
   }
 
-  DiagnoseMissingFormatAttributes(Body, FD);
-
   // We might not have found a prototype because we didn't wish to warn on
   // the lack of a missing prototype. Try again without the checks for
   // whether we want to warn on the missing prototype.
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib

[clang-tools-extra] [clang-doc] add enum test (PR #97679)

2024-07-12 Thread via cfe-commits


@@ -0,0 +1,38 @@
+// RUN: clang-doc --format=html --doxygen --output=%t/docs 
--executor=standalone %s
+// RUN: clang-doc --format=md --doxygen --output=%t/docs --executor=standalone 
%s

PeterChou1 wrote:

sorry I've realize originally that we didn't need to explicitly mkdir but its 
probably better to explicitly specify it

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


[clang-tools-extra] [clang-doc] add enum test (PR #97679)

2024-07-12 Thread via cfe-commits

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


[clang-tools-extra] [clang-doc] add ftime profiling (PR #97644)

2024-07-12 Thread via cfe-commits

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


  1   2   3   4   5   >