[clang] [clang] pointer to member with qualified-id enclosed in parentheses in unevaluated context should be invalid (PR #89713)
@@ -27,3 +26,20 @@ namespace rdar10544564 { X (Y::*func_mem_ptr1)() = &Y::memfunc1; X (Y::*func_mem_ptr2)() = &Y::memfunc2; } + +namespace test2 { + struct A { +int val; +void func() {} + }; + + void test() { +decltype(&(A::val)) ptr1; // expected-error {{invalid use of non-static data member 'val'}} +int A::* ptr2 = &(A::val); // expected-error {{invalid use of non-static data member 'val'}} + +// FIXME: Error messages in these cases are less than clear, we can do +// better. +int size = sizeof(&(A::func)); // expected-error {{call to non-static member function without an object argument}} +void (A::* ptr3)() = &(A::func); // expected-error {{call to non-static member function without an object argument}} cor3ntin wrote: I think creating an issue, or a new PR is the way to go. Would that work for you? https://github.com/llvm/llvm-project/pull/89713 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [libcxx] [llvm] Triple::normalize: Use none as OS for XX-none-ABI (PR #89638)
https://github.com/wzssyqa edited https://github.com/llvm/llvm-project/pull/89638 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] pointer to member with qualified-id enclosed in parentheses in unevaluated context should be invalid (PR #89713)
https://github.com/cor3ntin approved this pull request. Sorry for the delayed reply. LGTM, thank you for your contribution! https://github.com/llvm/llvm-project/pull/89713 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [z/OS] treat text files as text files so auto-conversion is done (PR #90128)
@@ -413,8 +413,9 @@ static bool format(StringRef FileName, bool ErrorOnIncompleteFormat = false) { // On Windows, overwriting a file with an open file mapping doesn't work, // so read the whole file into memory when formatting in-place. ErrorOr> CodeOrErr = - !OutputXML && Inplace ? MemoryBuffer::getFileAsStream(FileName) -: MemoryBuffer::getFileOrSTDIN(FileName); + !OutputXML && Inplace + ? MemoryBuffer::getFileAsStream(FileName) + : MemoryBuffer::getFileOrSTDIN(FileName, /*IsText=*/true); owenca wrote: I tested it on Windows and didn't have a problem. I used LF only, CRLF only, and mixed line endings for the following: ``` int i; int j; ``` Running clang-format through all values of the `LineEnding` option, with and without in-place, seemed ok. https://github.com/llvm/llvm-project/pull/90128 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC][HLSL] Cleanup TargetInfo handling (PR #90694)
https://github.com/bogner approved this pull request. https://github.com/llvm/llvm-project/pull/90694 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 9a9cff1 - [Modules] Process include files changes (#90319)
Author: Ivan Murashko Date: 2024-05-01T09:07:57+01:00 New Revision: 9a9cff15a15b103ae1dc1efa98b53901cdda78f1 URL: https://github.com/llvm/llvm-project/commit/9a9cff15a15b103ae1dc1efa98b53901cdda78f1 DIFF: https://github.com/llvm/llvm-project/commit/9a9cff15a15b103ae1dc1efa98b53901cdda78f1.diff LOG: [Modules] Process include files changes (#90319) There were two diffs that introduced some options useful when you build modules externally and cannot rely on file modification time as the key for detecting input file changes: - [D67249](https://reviews.llvm.org/D67249) introduced the `-fmodules-validate-input-files-content` option, which allows the use of file content hash in addition to the modification time. - [D141632](https://reviews.llvm.org/D141632) propagated the use of `-fno-pch-timestamps` with Clang modules. There is a problem when the size of the input file (header) is not modified but the content is. In this case, Clang cannot detect the file change when the `-fno-pch-timestamps` option is used. The `-fmodules-validate-input-files-content` option should help, but there is an issue with its application: it's not applied when the modification time is stored as zero that is the case for `-fno-pch-timestamps`. The issue can be fixed using the same trick that was applied during the processing of `ForceCheckCXX20ModulesInputFiles`: ``` // When ForceCheckCXX20ModulesInputFiles and ValidateASTInputFilesContent // enabled, it is better to check the contents of the inputs. Since we can't // get correct modified time information for inputs from overriden inputs. if (HSOpts.ForceCheckCXX20ModulesInputFiles && ValidateASTInputFilesContent && F.StandardCXXModule && FileChange.Kind == Change::None) FileChange = HasInputContentChanged(FileChange); ``` The patch suggests the solution similar to the presented above and includes a LIT test to verify it. Added: clang/test/Modules/implicit-module-no-timestamp.cpp Modified: clang/lib/Serialization/ASTReader.cpp Removed: diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp index 143fbc7feb3ab7..29b81c1a753cf5 100644 --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -2630,6 +2630,14 @@ InputFile ASTReader::getInputFile(ModuleFile &F, unsigned ID, bool Complain) { F.StandardCXXModule && FileChange.Kind == Change::None) FileChange = HasInputContentChanged(FileChange); + // When we have StoredTime equal to zero and ValidateASTInputFilesContent, + // it is better to check the content of the input files because we cannot rely + // on the file modification time, which will be the same (zero) for these + // files. + if (!StoredTime && ValidateASTInputFilesContent && + FileChange.Kind == Change::None) +FileChange = HasInputContentChanged(FileChange); + // For an overridden file, there is nothing to validate. if (!Overridden && FileChange.Kind != Change::None) { if (Complain && !Diags.isDiagnosticInFlight()) { diff --git a/clang/test/Modules/implicit-module-no-timestamp.cpp b/clang/test/Modules/implicit-module-no-timestamp.cpp new file mode 100644 index 00..1b681a610bab22 --- /dev/null +++ b/clang/test/Modules/implicit-module-no-timestamp.cpp @@ -0,0 +1,34 @@ +// UNSUPPORTED: system-windows +// RUN: rm -rf %t +// RUN: split-file %s %t +// RUN: cd %t +// +// RUN: cp a1.h a.h +// RUN: %clang_cc1 -fmodules -fvalidate-ast-input-files-content -fno-pch-timestamp -fmodule-map-file=module.modulemap -fmodules-cache-path=%t test1.cpp +// RUN: cp a2.h a.h +// RUN: %clang_cc1 -fmodules -fvalidate-ast-input-files-content -fno-pch-timestamp -fmodule-map-file=module.modulemap -fmodules-cache-path=%t test2.cpp + +//--- a1.h +#define FOO + +//--- a2.h +#define BAR + +//--- module.modulemap +module a { + header "a.h" +} + +//--- test1.cpp +#include "a.h" + +#ifndef FOO +#error foo +#endif + +//--- test2.cpp +#include "a.h" + +#ifndef BAR +#error bar +#endif ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Modules] Process include files changes with -fmodules-validate-input-files-content and -fno-pch-timestamp options (PR #90319)
https://github.com/ivanmurashko closed https://github.com/llvm/llvm-project/pull/90319 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] Update FEAT_PAuth_LR behaviour for AArch64 (PR #90614)
https://github.com/Stylie777 updated https://github.com/llvm/llvm-project/pull/90614 >From fa5d76b2d6d095abad76d892e59751727ac2e556 Mon Sep 17 00:00:00 2001 From: Jack Styles Date: Wed, 17 Apr 2024 14:17:51 +0100 Subject: [PATCH 1/3] [NFC] Add Extension Lookup to AArch64TargetParser Currently, an extension cannot be found using the ExtID. To address this, the function `lookupExtensionByID` has been added to the `ExtensionSet` Class so it can be targeted from outside the function. This will allow for the Extensions Information to be searched for and stored externally to the ExtensionSet Class. This enables being able to search for if Architecture Features have been enabled by the user in the command line. --- llvm/include/llvm/TargetParser/AArch64TargetParser.h | 2 ++ llvm/lib/TargetParser/AArch64TargetParser.cpp| 5 + 2 files changed, 7 insertions(+) diff --git a/llvm/include/llvm/TargetParser/AArch64TargetParser.h b/llvm/include/llvm/TargetParser/AArch64TargetParser.h index f372cee7633f61..866711a632c600 100644 --- a/llvm/include/llvm/TargetParser/AArch64TargetParser.h +++ b/llvm/include/llvm/TargetParser/AArch64TargetParser.h @@ -858,6 +858,8 @@ inline constexpr Alias CpuAliases[] = {{"cobalt-100", "neoverse-n2"}, inline constexpr Alias ExtAliases[] = {{"rdma", "rdm"}}; +const ExtensionInfo &getExtensionByID(ArchExtKind(ExtID)); + bool getExtensionFeatures( const AArch64::ExtensionBitset &Extensions, std::vector &Features); diff --git a/llvm/lib/TargetParser/AArch64TargetParser.cpp b/llvm/lib/TargetParser/AArch64TargetParser.cpp index 71099462d5ecff..026214e7e2eac5 100644 --- a/llvm/lib/TargetParser/AArch64TargetParser.cpp +++ b/llvm/lib/TargetParser/AArch64TargetParser.cpp @@ -280,3 +280,8 @@ bool AArch64::ExtensionSet::parseModifier(StringRef Modifier) { } return false; } + +const AArch64::ExtensionInfo & +AArch64::getExtensionByID(AArch64::ArchExtKind ExtID) { + return lookupExtensionByID(ExtID); +} >From ff848b0183afc0184fbf9cdfb64281b51b23cd42 Mon Sep 17 00:00:00 2001 From: Jack Styles Date: Wed, 17 Apr 2024 14:35:43 +0100 Subject: [PATCH 2/3] [AArch64] Enable PAuthLR by default for standard branch protection when the feature is available Currently, LLVM implements the `standard` option as `bti+pac-ret` for ARM and AArch64. Following discussions with the GNU developemnt team within Arm it was decided to align the behaviour of `standard` to match across the different compilers. To ensure the behaviour is aligned. LLVM has been updated to implement `standard` as `bti+pac-ret+pc` by default when `+pauth-lr` is passed as part of the `-march` argument. --- clang/lib/Basic/Targets/AArch64.cpp| 2 +- clang/lib/Driver/ToolChains/Clang.cpp | 18 +- .../Preprocessor/aarch64-target-features.c | 4 llvm/docs/ReleaseNotes.rst | 5 + .../llvm/TargetParser/ARMTargetParserCommon.h | 2 +- .../lib/TargetParser/ARMTargetParserCommon.cpp | 3 ++- 6 files changed, 30 insertions(+), 4 deletions(-) diff --git a/clang/lib/Basic/Targets/AArch64.cpp b/clang/lib/Basic/Targets/AArch64.cpp index c8d243a8fb7aea..5a46a3e6c6fd3e 100644 --- a/clang/lib/Basic/Targets/AArch64.cpp +++ b/clang/lib/Basic/Targets/AArch64.cpp @@ -224,7 +224,7 @@ bool AArch64TargetInfo::validateBranchProtection(StringRef Spec, StringRef, BranchProtectionInfo &BPI, StringRef &Err) const { llvm::ARM::ParsedBranchProtection PBP; - if (!llvm::ARM::parseBranchProtection(Spec, PBP, Err)) + if (!llvm::ARM::parseBranchProtection(Spec, PBP, Err, HasPAuthLR)) return false; BPI.SignReturnAddr = diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index 1f08c5958dfb60..63e04bfbf93c07 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -1511,7 +1511,23 @@ static void CollectARMPACBTIOptions(const ToolChain &TC, const ArgList &Args, } else { StringRef DiagMsg; llvm::ARM::ParsedBranchProtection PBP; -if (!llvm::ARM::parseBranchProtection(A->getValue(), PBP, DiagMsg)) + +// To know if we need to enable PAuth-LR As part of the standard branch +// protection option, it needs to be determined if the feature has been +// activated in the `march` argument. This information is stored within the +// CmdArgs variable and can be found using a search. +if (isAArch64) { + auto isPAuthLR = [](const char *member) { +llvm::AArch64::ExtensionInfo pauthlr_extension = +llvm::AArch64::getExtensionByID(llvm::AArch64::AEK_PAUTHLR); +return (pauthlr_extension.Feature.compare(member) == 0); + }; + + if (std::any_of(CmdArgs.begin(), CmdArgs.end(), isPAuthLR)) +EnablePAuthLR = true; +} +if (!llvm::ARM::parseBranchProtection(A->getValue(), PBP, DiagMsg, +
[clang] [Modules] No transitive source location change (PR #86912)
rorth wrote: This is certainly a case of unaligned access. In a local build, I've run the first failing `clang` invocation under `truss` (the Solaris syscall tracer). For ``` /var/llvm/dist-sparcv9-release-stage2-A-flang-clang18/tools/clang/stage2-bins/bin/clang -cc1 -internal-isystem /var/llvm/dist-sparcv9-release-stage2-A-flang-clang18/tools/clang/stage2-bins/lib/clang/19/include -nostdsysteminc -fmodules -Wno-private-module -fimplicit-module-maps -fmodules-cache-path=/var/llvm/dist-sparcv9-release-stage2-A-flang-clang18/tools/clang/stage2-bins/tools/clang/test/APINotes/Output/availability.m.tmp/ModulesCache -fapinotes-modules -fsyntax-only -I /vol/llvm/src/llvm-project/dist/clang/test/APINotes/Inputs/Headers -F /vol/llvm/src/llvm-project/dist/clang/test/APINotes/Inputs/Frameworks /vol/llvm/src/llvm-project/dist/clang/test/APINotes/availability.m -verify ``` this reveals ``` 14552: Incurred fault #5, FLTACCESS %pc = 0x1083824E0 14552:siginfo: SIGBUS BUS_ADRALN addr=0x7F5E7B6C 14552: Received signal #10, SIGBUS [caught] 14552:siginfo: SIGBUS BUS_ADRALN addr=0x7F5E7B6C ``` `gdb` shows exactly that: ``` Thread 2 received signal SIGBUS, Bus error. [Switching to Thread 1 (LWP 1)] 0x0001083824e0 in clang::ASTReader::DeclCursorForID(clang::GlobalDeclID, clang::SourceLocation&) () 1: x/i $pc => 0x1083824e0 <_ZN5clang9ASTReader15DeclCursorForIDENS_12GlobalDeclIDERNS_14SourceLocationE+168>: ldx [ %i5 + %i1 ], %o2 (gdb) p/x $i5 $1 = 0x7f5e7b4c (gdb) p/x $i1 $2 = 0x20 ``` The `ldx` insn (Load Extended Word) takes a doubleword address with natural (64-bit) alignment. https://github.com/llvm/llvm-project/pull/86912 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC] Use `const&` avoiding copies (PR #90334)
https://github.com/SimplyDanny updated https://github.com/llvm/llvm-project/pull/90334 From 5b74f02a766d66cfdd97adf4e89c091b9aa1823d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danny=20M=C3=B6sch?= Date: Sat, 27 Apr 2024 11:38:20 +0200 Subject: [PATCH] [NFC] Use const& avoiding copies --- clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp b/clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp index d58f5bb0919906..f8dced5dbafb60 100644 --- a/clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp +++ b/clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp @@ -295,7 +295,7 @@ class InterfaceStubFunctionsConsumer : public ASTConsumer { OS << "Symbols:\n"; for (const auto &E : Symbols) { const MangledSymbol &Symbol = E.second; -for (auto Name : Symbol.Names) { +for (const auto &Name : Symbol.Names) { OS << " - { Name: \"" << (Symbol.ParentName.empty() || Instance.getLangOpts().CPlusPlus ? "" ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] Update FEAT_PAuth_LR behaviour for AArch64 (PR #90614)
https://github.com/jthackray approved this pull request. LGTM. https://github.com/llvm/llvm-project/pull/90614 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 3a3bdd8 - [clang] Fix crash when destructor definition is preceded with '=' (#90220)
Author: Vlad Serebrennikov Date: 2024-05-01T12:43:10+04:00 New Revision: 3a3bdd8fb63ffb49741a9c32b3a5a789ce4c3b91 URL: https://github.com/llvm/llvm-project/commit/3a3bdd8fb63ffb49741a9c32b3a5a789ce4c3b91 DIFF: https://github.com/llvm/llvm-project/commit/3a3bdd8fb63ffb49741a9c32b3a5a789ce4c3b91.diff LOG: [clang] Fix crash when destructor definition is preceded with '=' (#90220) Fixes #89544 Added: Modified: clang/docs/ReleaseNotes.rst clang/include/clang/AST/ExprCXX.h clang/lib/AST/Expr.cpp clang/test/SemaCXX/destructor.cpp Removed: diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index c11f117cd6e8b4..2c5308fbcb319a 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -472,6 +472,9 @@ Bug Fixes in This Version - Clang now correctly generates overloads for bit-precise integer types for builtin operators in C++. Fixes #GH82998. +- Fix crash when destructor definition is preceded with an equals sign. + Fixes (#GH89544). + - When performing mixed arithmetic between ``_Complex`` floating-point types and integers, Clang now correctly promotes the integer to its corresponding real floating-point type only rather than to the complex type (e.g. ``_Complex float / int`` is now evaluated diff --git a/clang/include/clang/AST/ExprCXX.h b/clang/include/clang/AST/ExprCXX.h index a915745d2d7322..ab3f810b45192b 100644 --- a/clang/include/clang/AST/ExprCXX.h +++ b/clang/include/clang/AST/ExprCXX.h @@ -1482,6 +1482,8 @@ class CXXTemporary { /// const S &s_ref = S(); // Requires a CXXBindTemporaryExpr. /// } /// \endcode +/// +/// Destructor might be null if destructor declaration is not valid. class CXXBindTemporaryExpr : public Expr { CXXTemporary *Temp = nullptr; Stmt *SubExpr = nullptr; diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp index d2e40be59d6f3b..ac0b1b38f0162f 100644 --- a/clang/lib/AST/Expr.cpp +++ b/clang/lib/AST/Expr.cpp @@ -3893,9 +3893,14 @@ namespace { } void VisitCXXBindTemporaryExpr(const CXXBindTemporaryExpr *E) { - if (E->getTemporary()->getDestructor()->isTrivial()) { -Inherited::VisitStmt(E); -return; + // Destructor of the temporary might be null if destructor declaration + // is not valid. + if (const CXXDestructorDecl *DtorDecl = + E->getTemporary()->getDestructor()) { +if (DtorDecl->isTrivial()) { + Inherited::VisitStmt(E); + return; +} } NonTrivial = true; diff --git a/clang/test/SemaCXX/destructor.cpp b/clang/test/SemaCXX/destructor.cpp index beac50e449e96d..028bc7cc196989 100644 --- a/clang/test/SemaCXX/destructor.cpp +++ b/clang/test/SemaCXX/destructor.cpp @@ -565,4 +565,16 @@ struct Foo : public Baz { // expected-error {{cannot override a non-deleted func }; } +namespace GH89544 { +class Foo { + ~Foo() = {} + // expected-error@-1 {{initializer on function does not look like a pure-specifier}} + // expected-error@-2 {{expected ';' at end of declaration list}} +}; + +static_assert(!__is_trivially_constructible(Foo), ""); +static_assert(!__is_trivially_constructible(Foo, const Foo &), ""); +static_assert(!__is_trivially_constructible(Foo, Foo &&), ""); +} // namespace GH89544 + #endif // BE_THE_HEADER ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] Fix crash when destructor definition is preceded with '=' (PR #90220)
https://github.com/Endilll closed https://github.com/llvm/llvm-project/pull/90220 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] fix(85447): clang 18.1.0 crashes in clang::ASTContext::getTypeInfoImpl (PR #89850)
a-tarasyuk wrote: @cor3ntin Thanks for pointing this out. I've updated the PR description. Were you referring to this changelog, or is there something else I should add? https://github.com/llvm/llvm-project/pull/89850 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [z/OS] treat text files as text files so auto-conversion is done (PR #90128)
@@ -413,8 +413,9 @@ static bool format(StringRef FileName, bool ErrorOnIncompleteFormat = false) { // On Windows, overwriting a file with an open file mapping doesn't work, // so read the whole file into memory when formatting in-place. ErrorOr> CodeOrErr = - !OutputXML && Inplace ? MemoryBuffer::getFileAsStream(FileName) -: MemoryBuffer::getFileOrSTDIN(FileName); + !OutputXML && Inplace + ? MemoryBuffer::getFileAsStream(FileName) + : MemoryBuffer::getFileOrSTDIN(FileName, /*IsText=*/true); mydeveloperday wrote: Yes I also was able to confirm there was no impact on windows i just wasn't sure so needed to prove it to myself, I'm ok if you want to commit this into clang-format, if you break stuff... we'll simply revert it ;-) https://github.com/llvm/llvm-project/pull/90128 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [z/OS] treat text files as text files so auto-conversion is done (PR #90128)
mydeveloperday wrote: > > We don't normally commit in clang-format with a unit test > > I assume you mean "without a unit test". In this case the unit test is the > existing test cases. Some fail on z/OS because the files are not read in as > text. It's not really possible to detect this issue on other platforms. I > can't think of a new unit test that wouldn't duplicate what we already have. No its ok.. we kind of have a rule witrh clang-format that all commits need some form of test, but again I can understand this is hard to test. Go ahead. https://github.com/llvm/llvm-project/pull/90128 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Modules] No transitive source location change (PR #86912)
ChuanqiXu9 wrote: thanks, it is pretty helpful. https://github.com/llvm/llvm-project/pull/86912 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang][Sema] fix a bug on constraint check with template friend function (PR #90646)
jcsxky wrote: Windows CI failed with some unrelated files. https://github.com/llvm/llvm-project/pull/90646 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [libcxx] [llvm] Triple::normalize: Use none as OS for XX-none-ABI (PR #89638)
DavidSpickett wrote: I'm checking the picolib libcxx build right now so please hold off on landing this. https://github.com/llvm/llvm-project/pull/89638 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [libcxx] [llvm] Triple::normalize: Use none as OS for XX-none-ABI (PR #89638)
@@ -217,7 +217,7 @@ function test-armv7m-picolibc() { "${@}" ${NINJA} -vC "${BUILD_DIR}/compiler-rt" install -mv "${BUILD_DIR}/install/lib/armv7m-none-unknown-eabi"/* "${BUILD_DIR}/install/lib" +mv "${BUILD_DIR}/install/lib/armv7m-unknown-none-eabi"/* "${BUILD_DIR}/install/lib" peterwaller-arm wrote: This triple is 'used' by the version of the clang on the builder. Please remove this update, I'm in touch with @DavidSpickett who will make sure it gets updated at the right time. https://github.com/llvm/llvm-project/pull/89638 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [libcxx] [llvm] Triple::normalize: Use none as OS for XX-none-ABI (PR #89638)
https://github.com/peterwaller-arm requested changes to this pull request. Thanks for doing this and waiting for RFC comments. I think this can be merged, the one thing which needs fixing is removing the change I've commented on so that the picolibc builder can succeed (it uses a version of clang on the builder, which @DavidSpickett will update at the right time). https://github.com/llvm/llvm-project/pull/89638 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [libcxx] [llvm] Triple::normalize: Use none as OS for XX-none-ABI (PR #89638)
https://github.com/peterwaller-arm edited https://github.com/llvm/llvm-project/pull/89638 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang][CodeGen] Optimised LLVM IR for atomic increments/decrements on floats (PR #89362)
Krishna-13-cyber wrote: Hi @RKSimon, any more changes required for this!? https://github.com/llvm/llvm-project/pull/89362 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][PGO] Apply artificial DebugLoc to llvm.instrprof.increment instructions (PR #90717)
https://github.com/Michael137 created https://github.com/llvm/llvm-project/pull/90717 Prior to this change the debug-location for the `llvm.instrprof.increment` intrinsic was set to whatever the current DIBuilder's current debug location was set to. This meant that for switch-statements, a counter's location was set to the previous case's debug-location, causing confusing stepping behaviour in debuggers. This patch makes sure we attach a dummy debug-location for the increment instructions. rdar://123050737 >From 94c812abc4e528d3d3cb96fa3c3b7f78b6a87a91 Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Wed, 1 May 2024 11:03:08 +0100 Subject: [PATCH] [clang][PGO] Apply artificial DebugLoc to llvm.instrprof.increment instructions Prior to this change the debug-location for the `llvm.instrprof.increment` intrinsic was set to whatever the current DIBuilder's current debug location was set to. This meant that for switch-statements, a counter's location was set to the previous case's debug-location, causing confusing stepping behaviour in debuggers. This patch makes sure we attach a dummy debug-location for the increment instructions. rdar://123050737 --- clang/lib/CodeGen/CodeGenFunction.h | 4 +- .../debug-info-instr_profile_switch.cpp | 40 +++ 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 clang/test/Profile/debug-info-instr_profile_switch.cpp diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h index ff1873325d409f..8a1c2ea0326c35 100644 --- a/clang/lib/CodeGen/CodeGenFunction.h +++ b/clang/lib/CodeGen/CodeGenFunction.h @@ -1587,8 +1587,10 @@ class CodeGenFunction : public CodeGenTypeCache { void incrementProfileCounter(const Stmt *S, llvm::Value *StepV = nullptr) { if (CGM.getCodeGenOpts().hasProfileClangInstr() && !CurFn->hasFnAttribute(llvm::Attribute::NoProfile) && -!CurFn->hasFnAttribute(llvm::Attribute::SkipProfile)) +!CurFn->hasFnAttribute(llvm::Attribute::SkipProfile)) { + auto AL = ApplyDebugLocation::CreateArtificial(*this); PGO.emitCounterSetOrIncrement(Builder, S, StepV); +} PGO.setCurrentStmt(S); } diff --git a/clang/test/Profile/debug-info-instr_profile_switch.cpp b/clang/test/Profile/debug-info-instr_profile_switch.cpp new file mode 100644 index 00..09edf9a96b0167 --- /dev/null +++ b/clang/test/Profile/debug-info-instr_profile_switch.cpp @@ -0,0 +1,40 @@ +// Tests that we don't attach misleading debug locations to llvm.instrprof.increment +// counters. + +// RUN: %clang_cc1 -x c++ %s -debug-info-kind=standalone -triple %itanium_abi_triple -main-file-name debug-info-instr_profile_switch.cpp -std=c++11 -o - -emit-llvm -fprofile-instrument=clang | FileCheck %s + +int main(int argc, const char *argv[]) { + switch(argc) { +case 0: + return 0; +case 1: + return 1; + } +} + +// CHECK: define noundef i32 @main(i32 noundef %argc, ptr noundef %argv) #0 !dbg ![[MAIN_SCOPE:[0-9]+]] + +// CHECK:switch i32 {{.*}}, label {{.*}} [ +// CHECK-NEXT: i32 0, label %[[CASE1_LBL:[a-z0-9.]+]] +// CHECK-NEXT: i32 1, label %[[CASE2_LBL:[a-z0-9.]+]] +// CHECK-NEXT: ], !dbg ![[SWITCH_LOC:[0-9]+]] + +// CHECK: [[CASE1_LBL]]: +// CHECK-NEXT: %{{.*}} = load i64, ptr getelementptr inbounds ({{.*}}, ptr @__profc_main, {{.*}}), align {{.*}}, !dbg ![[CTR_LOC:[0-9]+]] +// CHECK-NEXT: %{{.*}} = add {{.*}}, !dbg ![[CTR_LOC]] +// CHECK-NEXT: store i64 {{.*}}, ptr getelementptr inbounds ({{.*}}, ptr @__profc_main, {{.*}}), align {{.*}}, !dbg ![[CTR_LOC]] +// CHECK-NEXT: store i32 0, {{.*}} !dbg ![[CASE1_LOC:[0-9]+]] +// CHECK-NEXT: br label {{.*}}, !dbg ![[CASE1_LOC]] + +// CHECK: [[CASE2_LBL]]: +// CHECK-NEXT: %{{.*}} = load i64, ptr getelementptr inbounds ({{.*}}, ptr @__profc_main, {{.*}}), align {{.*}}, !dbg ![[CTR_LOC]] +// CHECK-NEXT: %{{.*}} = add {{.*}}, !dbg ![[CTR_LOC]] +// CHECK-NEXT: store i64 {{.*}}, ptr getelementptr inbounds ({{.*}}, ptr @__profc_main, {{.*}}), align {{.*}}, !dbg ![[CTR_LOC]] +// CHECK-NEXT: store i32 1, {{.*}} !dbg ![[CASE2_LOC:[0-9]+]] +// CHECK-NEXT: br label {{.*}}, !dbg ![[CASE2_LOC]] + +// CHECK: ![[SWITCH_LOC]] = !DILocation({{.*}}, scope: ![[MAIN_SCOPE]]) +// CHECK: ![[CTR_LOC]] = !DILocation(line: 0, scope: ![[BLOCK_SCOPE:[0-9]+]]) +// CHECK: ![[BLOCK_SCOPE]] = distinct !DILexicalBlock(scope: ![[MAIN_SCOPE]] +// CHECK: ![[CASE1_LOC]] = !DILocation(line: {{.*}}, column: {{.*}}, scope: ![[BLOCK_SCOPE]]) +// CHECK: ![[CASE2_LOC]] = !DILocation(line: {{.*}}, column: {{.*}}, scope: ![[BLOCK_SCOPE]]) ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][PGO] Apply artificial DebugLoc to llvm.instrprof.increment instructions (PR #90717)
llvmbot wrote: @llvm/pr-subscribers-clang-codegen Author: Michael Buch (Michael137) Changes Prior to this change the debug-location for the `llvm.instrprof.increment` intrinsic was set to whatever the current DIBuilder's current debug location was set to. This meant that for switch-statements, a counter's location was set to the previous case's debug-location, causing confusing stepping behaviour in debuggers. This patch makes sure we attach a dummy debug-location for the increment instructions. rdar://123050737 --- Full diff: https://github.com/llvm/llvm-project/pull/90717.diff 2 Files Affected: - (modified) clang/lib/CodeGen/CodeGenFunction.h (+3-1) - (added) clang/test/Profile/debug-info-instr_profile_switch.cpp (+40) ``diff diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h index ff1873325d409f..8a1c2ea0326c35 100644 --- a/clang/lib/CodeGen/CodeGenFunction.h +++ b/clang/lib/CodeGen/CodeGenFunction.h @@ -1587,8 +1587,10 @@ class CodeGenFunction : public CodeGenTypeCache { void incrementProfileCounter(const Stmt *S, llvm::Value *StepV = nullptr) { if (CGM.getCodeGenOpts().hasProfileClangInstr() && !CurFn->hasFnAttribute(llvm::Attribute::NoProfile) && -!CurFn->hasFnAttribute(llvm::Attribute::SkipProfile)) +!CurFn->hasFnAttribute(llvm::Attribute::SkipProfile)) { + auto AL = ApplyDebugLocation::CreateArtificial(*this); PGO.emitCounterSetOrIncrement(Builder, S, StepV); +} PGO.setCurrentStmt(S); } diff --git a/clang/test/Profile/debug-info-instr_profile_switch.cpp b/clang/test/Profile/debug-info-instr_profile_switch.cpp new file mode 100644 index 00..09edf9a96b0167 --- /dev/null +++ b/clang/test/Profile/debug-info-instr_profile_switch.cpp @@ -0,0 +1,40 @@ +// Tests that we don't attach misleading debug locations to llvm.instrprof.increment +// counters. + +// RUN: %clang_cc1 -x c++ %s -debug-info-kind=standalone -triple %itanium_abi_triple -main-file-name debug-info-instr_profile_switch.cpp -std=c++11 -o - -emit-llvm -fprofile-instrument=clang | FileCheck %s + +int main(int argc, const char *argv[]) { + switch(argc) { +case 0: + return 0; +case 1: + return 1; + } +} + +// CHECK: define noundef i32 @main(i32 noundef %argc, ptr noundef %argv) #0 !dbg ![[MAIN_SCOPE:[0-9]+]] + +// CHECK:switch i32 {{.*}}, label {{.*}} [ +// CHECK-NEXT: i32 0, label %[[CASE1_LBL:[a-z0-9.]+]] +// CHECK-NEXT: i32 1, label %[[CASE2_LBL:[a-z0-9.]+]] +// CHECK-NEXT: ], !dbg ![[SWITCH_LOC:[0-9]+]] + +// CHECK: [[CASE1_LBL]]: +// CHECK-NEXT: %{{.*}} = load i64, ptr getelementptr inbounds ({{.*}}, ptr @__profc_main, {{.*}}), align {{.*}}, !dbg ![[CTR_LOC:[0-9]+]] +// CHECK-NEXT: %{{.*}} = add {{.*}}, !dbg ![[CTR_LOC]] +// CHECK-NEXT: store i64 {{.*}}, ptr getelementptr inbounds ({{.*}}, ptr @__profc_main, {{.*}}), align {{.*}}, !dbg ![[CTR_LOC]] +// CHECK-NEXT: store i32 0, {{.*}} !dbg ![[CASE1_LOC:[0-9]+]] +// CHECK-NEXT: br label {{.*}}, !dbg ![[CASE1_LOC]] + +// CHECK: [[CASE2_LBL]]: +// CHECK-NEXT: %{{.*}} = load i64, ptr getelementptr inbounds ({{.*}}, ptr @__profc_main, {{.*}}), align {{.*}}, !dbg ![[CTR_LOC]] +// CHECK-NEXT: %{{.*}} = add {{.*}}, !dbg ![[CTR_LOC]] +// CHECK-NEXT: store i64 {{.*}}, ptr getelementptr inbounds ({{.*}}, ptr @__profc_main, {{.*}}), align {{.*}}, !dbg ![[CTR_LOC]] +// CHECK-NEXT: store i32 1, {{.*}} !dbg ![[CASE2_LOC:[0-9]+]] +// CHECK-NEXT: br label {{.*}}, !dbg ![[CASE2_LOC]] + +// CHECK: ![[SWITCH_LOC]] = !DILocation({{.*}}, scope: ![[MAIN_SCOPE]]) +// CHECK: ![[CTR_LOC]] = !DILocation(line: 0, scope: ![[BLOCK_SCOPE:[0-9]+]]) +// CHECK: ![[BLOCK_SCOPE]] = distinct !DILexicalBlock(scope: ![[MAIN_SCOPE]] +// CHECK: ![[CASE1_LOC]] = !DILocation(line: {{.*}}, column: {{.*}}, scope: ![[BLOCK_SCOPE]]) +// CHECK: ![[CASE2_LOC]] = !DILocation(line: {{.*}}, column: {{.*}}, scope: ![[BLOCK_SCOPE]]) `` https://github.com/llvm/llvm-project/pull/90717 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang][CodeGen] Optimised LLVM IR for atomic increments/decrements on floats (PR #89362)
https://github.com/RKSimon edited https://github.com/llvm/llvm-project/pull/89362 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] fix(85447): clang 18.1.0 crashes in clang::ASTContext::getTypeInfoImpl (PR #89850)
cor3ntin wrote: @a-tarasyuk in `clang/docs/ReleaseNotes.rst`, you should add an entry in the "Bug Fixes to C++ Support" section. it should be a short description indicating `Fixes (#GH85447)` https://github.com/llvm/llvm-project/pull/89850 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang] [C++26] Implement P2573R2: `= delete("should have a reason");` (PR #86526)
@@ -2280,18 +2294,18 @@ class FunctionDecl : public DeclaratorDecl, /// Returns whether this specific declaration of the function has a body. bool doesThisDeclarationHaveABody() const { -return (!FunctionDeclBits.HasDefaultedFunctionInfo && Body) || +return (!FunctionDeclBits.HasDefaultedOrDeletedInfo && Body) || isLateTemplateParsed(); } void setBody(Stmt *B); void setLazyBody(uint64_t Offset) { -FunctionDeclBits.HasDefaultedFunctionInfo = false; +FunctionDeclBits.HasDefaultedOrDeletedInfo = false; Body = LazyDeclStmtPtr(Offset); } - void setDefaultedFunctionInfo(DefaultedFunctionInfo *Info); - DefaultedFunctionInfo *getDefaultedFunctionInfo() const; + void setDefaultedOrDeletedInfo(DefaultedOrDeletedFunctionInfo *Info); + DefaultedOrDeletedFunctionInfo *getDefalutedOrDeletedInfo() const; MitalAshok wrote: @Sirraide There's no reason we can't change this name to fix this typo right? https://github.com/llvm/llvm-project/pull/86526 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang] Implement P2809: Trivial infinite loops are not Undefined Behavior (PR #90066)
@@ -908,6 +908,74 @@ void CodeGenFunction::EmitIfStmt(const IfStmt &S) { incrementProfileCounter(&S); } +bool CodeGenFunction::checkIfLoopMustProgress(const Expr *ControllingExpression, + bool IsTrivialCXXLoop) { + if (CGM.getCodeGenOpts().getFiniteLoops() == + CodeGenOptions::FiniteLoopsKind::Never) +return false; + + if (CGM.getCodeGenOpts().getFiniteLoops() == + CodeGenOptions::FiniteLoopsKind::Always && + !getLangOpts().CPlusPlus11) cor3ntin wrote: Done! https://github.com/llvm/llvm-project/pull/90066 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang] [C++26] Implement P2573R2: `= delete("should have a reason");` (PR #86526)
@@ -2280,18 +2294,18 @@ class FunctionDecl : public DeclaratorDecl, /// Returns whether this specific declaration of the function has a body. bool doesThisDeclarationHaveABody() const { -return (!FunctionDeclBits.HasDefaultedFunctionInfo && Body) || +return (!FunctionDeclBits.HasDefaultedOrDeletedInfo && Body) || isLateTemplateParsed(); } void setBody(Stmt *B); void setLazyBody(uint64_t Offset) { -FunctionDeclBits.HasDefaultedFunctionInfo = false; +FunctionDeclBits.HasDefaultedOrDeletedInfo = false; Body = LazyDeclStmtPtr(Offset); } - void setDefaultedFunctionInfo(DefaultedFunctionInfo *Info); - DefaultedFunctionInfo *getDefaultedFunctionInfo() const; + void setDefaultedOrDeletedInfo(DefaultedOrDeletedFunctionInfo *Info); + DefaultedOrDeletedFunctionInfo *getDefalutedOrDeletedInfo() const; cor3ntin wrote: That can be fixed as NFC commit. I missed it https://github.com/llvm/llvm-project/pull/86526 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang][CodeGen] Optimised LLVM IR for atomic increments/decrements on floats (PR #89362)
@@ -0,0 +1,69 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 4 +// RUN: %clang_cc1 -triple x86_64-linux-gnu -target-cpu core2 %s -S -emit-llvm -o - | FileCheck -check-prefixes=CHECK,CHECK64 %s +// RUN: %clang_cc1 -triple i686-linux-gnu -target-cpu core2 %s -S -emit-llvm -o - | FileCheck -check-prefixes=CHECK,CHECK32 %s + + +// CHECK-LABEL: define dso_local i32 @test_int_inc( +// CHECK-SAME: ) #[[ATTR0:[0-9]+]] { +// CHECK-NEXT: entry: +// CHECK-NEXT:[[TMP0:%.*]] = atomicrmw add ptr @test_int_inc.n, i32 1 seq_cst, align 4 +// CHECK-NEXT:ret i32 [[TMP0]] +// +int test_int_inc() +{ +static _Atomic int n; +return n++; +} + +// CHECK-LABEL: define dso_local float @test_float_post_inc( +// CHECK-SAME: ) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT:[[TMP0:%.*]] = atomicrmw fadd ptr @test_float_post_inc.n, float 1.00e+00 seq_cst, align 4 +// CHECK-NEXT:ret float [[TMP0]] +// +float test_float_post_inc() +{ +static _Atomic float n; +return n++; +} + +// CHECK-LABEL: define dso_local float @test_float_post_dc( +// CHECK-SAME: ) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT:[[TMP0:%.*]] = atomicrmw fsub ptr @test_float_post_dc.n, float -1.00e+00 seq_cst, align 4 RKSimon wrote: `fsub x, -1.0`? Should it be `fsub x, 1.0`? https://github.com/llvm/llvm-project/pull/89362 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [libcxx] [llvm] Triple::normalize: Use none as OS for XX-none-ABI (PR #89638)
@@ -217,7 +217,7 @@ function test-armv7m-picolibc() { "${@}" ${NINJA} -vC "${BUILD_DIR}/compiler-rt" install -mv "${BUILD_DIR}/install/lib/armv7m-none-unknown-eabi"/* "${BUILD_DIR}/install/lib" +mv "${BUILD_DIR}/install/lib/armv7m-unknown-none-eabi"/* "${BUILD_DIR}/install/lib" DavidSpickett wrote: https://github.com/llvm/llvm-project/pull/90722 You can remove all changes to this file. https://github.com/llvm/llvm-project/pull/89638 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [libcxx] [llvm] Triple::normalize: Use none as OS for XX-none-ABI (PR #89638)
DavidSpickett wrote: Also this change should be release noted with a tip that build scripts may want to change to asking clang for the triple instead. https://github.com/llvm/llvm-project/pull/89638 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] df241b1 - [z/OS] add support for z/OS system headers to clang std header wrappers (#89995)
Author: Sean Perry Date: 2024-05-01T07:48:57-04:00 New Revision: df241b19c952b904eec755d9f090737aed437986 URL: https://github.com/llvm/llvm-project/commit/df241b19c952b904eec755d9f090737aed437986 DIFF: https://github.com/llvm/llvm-project/commit/df241b19c952b904eec755d9f090737aed437986.diff LOG: [z/OS] add support for z/OS system headers to clang std header wrappers (#89995) Update the wrappers for the C std headers so that they always forward to the z/OS system headers. Added: clang/lib/Headers/zos_wrappers/builtins.h Modified: clang/lib/Headers/CMakeLists.txt clang/lib/Headers/builtins.h clang/lib/Headers/float.h clang/lib/Headers/inttypes.h clang/lib/Headers/iso646.h clang/lib/Headers/limits.h clang/lib/Headers/stdalign.h clang/lib/Headers/stdarg.h clang/lib/Headers/stdbool.h clang/lib/Headers/stddef.h clang/lib/Headers/stdint.h clang/lib/Headers/stdnoreturn.h clang/lib/Headers/varargs.h Removed: diff --git a/clang/lib/Headers/CMakeLists.txt b/clang/lib/Headers/CMakeLists.txt index e6ae4e19e81db9..3416811e39de27 100644 --- a/clang/lib/Headers/CMakeLists.txt +++ b/clang/lib/Headers/CMakeLists.txt @@ -335,6 +335,10 @@ set(llvm_libc_wrapper_files llvm_libc_wrappers/time.h ) +set(zos_wrapper_files + zos_wrappers/builtins.h +) + include(GetClangResourceDir) get_clang_resource_dir(output_dir PREFIX ${LLVM_LIBRARY_OUTPUT_INTDIR}/.. SUBDIR include) set(out_files) @@ -370,7 +374,7 @@ endfunction(clang_generate_header) # Copy header files from the source directory to the build directory foreach( f ${files} ${cuda_wrapper_files} ${cuda_wrapper_bits_files} - ${ppc_wrapper_files} ${openmp_wrapper_files} ${hlsl_files} + ${ppc_wrapper_files} ${openmp_wrapper_files} ${zos_wrapper_files} ${hlsl_files} ${llvm_libc_wrapper_files}) copy_header_to_output_dir(${CMAKE_CURRENT_SOURCE_DIR} ${f}) endforeach( f ) @@ -487,7 +491,7 @@ add_header_target("mips-resource-headers" "${mips_msa_files}") add_header_target("ppc-resource-headers" "${ppc_files};${ppc_wrapper_files}") add_header_target("ppc-htm-resource-headers" "${ppc_htm_files}") add_header_target("riscv-resource-headers" "${riscv_files};${riscv_generated_files}") -add_header_target("systemz-resource-headers" "${systemz_files}") +add_header_target("systemz-resource-headers" "${systemz_files};${zos_wrapper_files}") add_header_target("ve-resource-headers" "${ve_files}") add_header_target("webassembly-resource-headers" "${webassembly_files}") add_header_target("x86-resource-headers" "${x86_files}") @@ -538,6 +542,11 @@ install( DESTINATION ${header_install_dir}/openmp_wrappers COMPONENT clang-resource-headers) +install( + FILES ${zos_wrapper_files} + DESTINATION ${header_install_dir}/zos_wrappers + COMPONENT clang-resource-headers) + # # Install rules for separate header lists install( @@ -642,6 +651,12 @@ install( EXCLUDE_FROM_ALL COMPONENT systemz-resource-headers) +install( + FILES ${zos_wrapper_files} + DESTINATION ${header_install_dir}/zos_wrappers + EXCLUDE_FROM_ALL + COMPONENT systemz-resource-headers) + install( FILES ${ve_files} DESTINATION ${header_install_dir} diff --git a/clang/lib/Headers/builtins.h b/clang/lib/Headers/builtins.h index 65095861ca9b1c..1e534e632c8ead 100644 --- a/clang/lib/Headers/builtins.h +++ b/clang/lib/Headers/builtins.h @@ -13,4 +13,7 @@ #ifndef __BUILTINS_H #define __BUILTINS_H +#if defined(__MVS__) && __has_include_next() +#include_next +#endif /* __MVS__ */ #endif /* __BUILTINS_H */ diff --git a/clang/lib/Headers/float.h b/clang/lib/Headers/float.h index 0e73bca0a2d6e4..642c8f06cc9386 100644 --- a/clang/lib/Headers/float.h +++ b/clang/lib/Headers/float.h @@ -10,6 +10,10 @@ #ifndef __CLANG_FLOAT_H #define __CLANG_FLOAT_H +#if defined(__MVS__) && __has_include_next() +#include_next +#else + /* If we're on MinGW, fall back to the system's float.h, which might have * additional definitions provided for Windows. * For more details see http://msdn.microsoft.com/en-us/library/y0ybw9fy.aspx @@ -165,4 +169,5 @@ # define FLT16_TRUE_MIN__FLT16_TRUE_MIN__ #endif /* __STDC_WANT_IEC_60559_TYPES_EXT__ */ +#endif /* __MVS__ */ #endif /* __CLANG_FLOAT_H */ diff --git a/clang/lib/Headers/inttypes.h b/clang/lib/Headers/inttypes.h index 1c894c4aca4975..5150d22f8b2e4e 100644 --- a/clang/lib/Headers/inttypes.h +++ b/clang/lib/Headers/inttypes.h @@ -13,6 +13,9 @@ #if !defined(_AIX) || !defined(_STD_TYPES_T) #define __CLANG_INTTYPES_H #endif +#if defined(__MVS__) && __has_include_next() +#include_next +#else #if defined(_MSC_VER) && _MSC_VER < 1800 #error MSVC does not have inttypes.h prior to Visual Studio 2013 @@ -94,4 +97,5 @@ #define SCNxFAST32 "x" #endif +#endif /* __MVS__ */ #endif /* __CLANG_INTTYPES_H */
[clang] [z/OS] add support for z/OS system headers to clang std header wrappers (PR #89995)
https://github.com/abhina-sree closed https://github.com/llvm/llvm-project/pull/89995 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang] Ensure "=default"ed function can be deleted when used as an extension in C++03 (PR #90725)
https://github.com/MitalAshok created https://github.com/llvm/llvm-project/pull/90725 Fixes #90605 >From 0793795ba7d5d5974b1403cd6ead0221fc20c5bb Mon Sep 17 00:00:00 2001 From: Mital Ashok Date: Wed, 1 May 2024 12:45:54 +0100 Subject: [PATCH] [Clang] Ensure "=default"ed function can be deleted when used as an extension in C++03 Fixes #90605 --- clang/lib/Sema/SemaDeclCXX.cpp| 4 ++- .../SemaCXX/cxx0x-cursory-default-delete.cpp | 34 +-- .../SemaCXX/cxx0x-defaulted-functions.cpp | 13 +++ 3 files changed, 47 insertions(+), 4 deletions(-) diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index 157d42c09cfcd8..e3c90c8ee1d644 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -9767,7 +9767,9 @@ bool Sema::ShouldDeleteSpecialMember(CXXMethodDecl *MD, return false; CXXRecordDecl *RD = MD->getParent(); assert(!RD->isDependentType() && "do deletion after instantiation"); - if (!LangOpts.CPlusPlus || (!LangOpts.CPlusPlus11 && !RD->isLambda()) || + if (!LangOpts.CPlusPlus || + (!LangOpts.CPlusPlus11 && !RD->isLambda() && + !MD->isExplicitlyDefaulted()) || RD->isInvalidDecl()) return false; diff --git a/clang/test/SemaCXX/cxx0x-cursory-default-delete.cpp b/clang/test/SemaCXX/cxx0x-cursory-default-delete.cpp index 6ae146f0d08c7d..f884725a234671 100644 --- a/clang/test/SemaCXX/cxx0x-cursory-default-delete.cpp +++ b/clang/test/SemaCXX/cxx0x-cursory-default-delete.cpp @@ -1,4 +1,11 @@ // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++03 -Wno-c++11-extensions -fsyntax-only -verify %s + +#if __cplusplus < 201103L +#define static_assert _Static_assert +#define nullptr 0 +#define noexcept throw() +#endif struct non_copiable { non_copiable(const non_copiable&) = delete; // expected-note {{marked deleted here}} @@ -25,10 +32,12 @@ void fn1 () { non_const_copy ncc; non_const_copy ncc2 = ncc; ncc = ncc2; +#if __cplusplus >= 201103L const non_const_copy cncc{}; +#endif const non_const_copy cncc1; // expected-error {{default initialization of an object of const type 'const non_const_copy' without a user-provided default constructor}} - non_const_copy ncc3 = cncc; // expected-error {{no matching}} - ncc = cncc; // expected-error {{no viable overloaded}} + non_const_copy ncc3 = cncc1; // expected-error {{no matching}} + ncc = cncc1; // expected-error {{no viable overloaded}} }; struct no_fields { }; @@ -196,7 +205,7 @@ struct except_spec_d_match : except_spec_a, except_spec_b { struct S { S(); }; S::S() __attribute((noreturn)) = default; -using size_t = decltype(sizeof(0)); +using size_t = __SIZE_TYPE__; void *operator new(size_t) = delete; // expected-error {{deleted definition must be first declaration}} expected-note {{implicit}} void operator delete(void *) noexcept = delete; // expected-error {{deleted definition must be first declaration}} expected-note {{implicit}} @@ -217,3 +226,22 @@ namespace deleted_overrides_deleted { template struct B : A { virtual void f() = delete; }; template struct B; } + +namespace GH90605 { +struct Element { +Element& operator=(const Element&) = delete; // #GH90605-Element-assign +}; + +struct S { +Element i; // #GH90605-i + +S& operator=(const S&) = default; +// expected-warning@-1 {{explicitly defaulted copy assignment operator is implicitly deleted}} +// expected-note@#GH90605-i {{copy assignment operator of 'S' is implicitly deleted because field 'i' has a deleted copy assignment operator}} +// expected-note@#GH90605-Element-assign {{'operator=' has been explicitly marked deleted here}} +// expected-note@-4 {{replace 'default' with 'delete'}} +}; + +static_assert(!__is_trivially_assignable(S&, const S&), ""); +static_assert(!__is_assignable(S&, const S&), ""); +} diff --git a/clang/test/SemaCXX/cxx0x-defaulted-functions.cpp b/clang/test/SemaCXX/cxx0x-defaulted-functions.cpp index 0c3dd1ea7aa274..30d54920a1a686 100644 --- a/clang/test/SemaCXX/cxx0x-defaulted-functions.cpp +++ b/clang/test/SemaCXX/cxx0x-defaulted-functions.cpp @@ -1,4 +1,9 @@ // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify -fcxx-exceptions -Wno-deprecated-builtins %s +// RUN: %clang_cc1 -std=c++03 -Wno-c++11-extensions -fsyntax-only -verify -fcxx-exceptions -Wno-deprecated-builtins %s + +#if __cplusplus < 201103L +#define static_assert _Static_assert +#endif void fn() = default; // expected-error {{only special member}} struct foo { @@ -43,6 +48,7 @@ void tester() { b = c; } +#if __cplusplus >= 201103L template struct S : T { constexpr S() = default; // expected-note {{previous declaration is here}} constexpr S(const S&) = default; // expected-note {{previous declaration is here}} @@ -118,6 +124,7 @@ namespace DefaultedFnExceptionSpec { *p = *p; // expected-note {{instantiation of}} } } +#endif namespace PR13527 { struct X { @@ -1
[clang] [Clang] Ensure "=default"ed function can be deleted when used as an extension in C++03 (PR #90725)
llvmbot wrote: @llvm/pr-subscribers-clang Author: Mital Ashok (MitalAshok) Changes Fixes #90605 --- Full diff: https://github.com/llvm/llvm-project/pull/90725.diff 3 Files Affected: - (modified) clang/lib/Sema/SemaDeclCXX.cpp (+3-1) - (modified) clang/test/SemaCXX/cxx0x-cursory-default-delete.cpp (+31-3) - (modified) clang/test/SemaCXX/cxx0x-defaulted-functions.cpp (+13) ``diff diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index 157d42c09cfcd8..e3c90c8ee1d644 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -9767,7 +9767,9 @@ bool Sema::ShouldDeleteSpecialMember(CXXMethodDecl *MD, return false; CXXRecordDecl *RD = MD->getParent(); assert(!RD->isDependentType() && "do deletion after instantiation"); - if (!LangOpts.CPlusPlus || (!LangOpts.CPlusPlus11 && !RD->isLambda()) || + if (!LangOpts.CPlusPlus || + (!LangOpts.CPlusPlus11 && !RD->isLambda() && + !MD->isExplicitlyDefaulted()) || RD->isInvalidDecl()) return false; diff --git a/clang/test/SemaCXX/cxx0x-cursory-default-delete.cpp b/clang/test/SemaCXX/cxx0x-cursory-default-delete.cpp index 6ae146f0d08c7d..f884725a234671 100644 --- a/clang/test/SemaCXX/cxx0x-cursory-default-delete.cpp +++ b/clang/test/SemaCXX/cxx0x-cursory-default-delete.cpp @@ -1,4 +1,11 @@ // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++03 -Wno-c++11-extensions -fsyntax-only -verify %s + +#if __cplusplus < 201103L +#define static_assert _Static_assert +#define nullptr 0 +#define noexcept throw() +#endif struct non_copiable { non_copiable(const non_copiable&) = delete; // expected-note {{marked deleted here}} @@ -25,10 +32,12 @@ void fn1 () { non_const_copy ncc; non_const_copy ncc2 = ncc; ncc = ncc2; +#if __cplusplus >= 201103L const non_const_copy cncc{}; +#endif const non_const_copy cncc1; // expected-error {{default initialization of an object of const type 'const non_const_copy' without a user-provided default constructor}} - non_const_copy ncc3 = cncc; // expected-error {{no matching}} - ncc = cncc; // expected-error {{no viable overloaded}} + non_const_copy ncc3 = cncc1; // expected-error {{no matching}} + ncc = cncc1; // expected-error {{no viable overloaded}} }; struct no_fields { }; @@ -196,7 +205,7 @@ struct except_spec_d_match : except_spec_a, except_spec_b { struct S { S(); }; S::S() __attribute((noreturn)) = default; -using size_t = decltype(sizeof(0)); +using size_t = __SIZE_TYPE__; void *operator new(size_t) = delete; // expected-error {{deleted definition must be first declaration}} expected-note {{implicit}} void operator delete(void *) noexcept = delete; // expected-error {{deleted definition must be first declaration}} expected-note {{implicit}} @@ -217,3 +226,22 @@ namespace deleted_overrides_deleted { template struct B : A { virtual void f() = delete; }; template struct B; } + +namespace GH90605 { +struct Element { +Element& operator=(const Element&) = delete; // #GH90605-Element-assign +}; + +struct S { +Element i; // #GH90605-i + +S& operator=(const S&) = default; +// expected-warning@-1 {{explicitly defaulted copy assignment operator is implicitly deleted}} +// expected-note@#GH90605-i {{copy assignment operator of 'S' is implicitly deleted because field 'i' has a deleted copy assignment operator}} +// expected-note@#GH90605-Element-assign {{'operator=' has been explicitly marked deleted here}} +// expected-note@-4 {{replace 'default' with 'delete'}} +}; + +static_assert(!__is_trivially_assignable(S&, const S&), ""); +static_assert(!__is_assignable(S&, const S&), ""); +} diff --git a/clang/test/SemaCXX/cxx0x-defaulted-functions.cpp b/clang/test/SemaCXX/cxx0x-defaulted-functions.cpp index 0c3dd1ea7aa274..30d54920a1a686 100644 --- a/clang/test/SemaCXX/cxx0x-defaulted-functions.cpp +++ b/clang/test/SemaCXX/cxx0x-defaulted-functions.cpp @@ -1,4 +1,9 @@ // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify -fcxx-exceptions -Wno-deprecated-builtins %s +// RUN: %clang_cc1 -std=c++03 -Wno-c++11-extensions -fsyntax-only -verify -fcxx-exceptions -Wno-deprecated-builtins %s + +#if __cplusplus < 201103L +#define static_assert _Static_assert +#endif void fn() = default; // expected-error {{only special member}} struct foo { @@ -43,6 +48,7 @@ void tester() { b = c; } +#if __cplusplus >= 201103L template struct S : T { constexpr S() = default; // expected-note {{previous declaration is here}} constexpr S(const S&) = default; // expected-note {{previous declaration is here}} @@ -118,6 +124,7 @@ namespace DefaultedFnExceptionSpec { *p = *p; // expected-note {{instantiation of}} } } +#endif namespace PR13527 { struct X { @@ -135,6 +142,7 @@ namespace PR13527 { X &X::operator=(X&&) = default; // expected-error {{redefinition}} X::~X() = default; // expected-error {{redefinition}} +#if __cplusplus >= 201
[clang] Fix Twine usage (PR #90728)
https://github.com/MagentaTreehouse created https://github.com/llvm/llvm-project/pull/90728 Construct `Twine`s before concatenation. >From ad0384030a78be7d91851c565db41af1b161378f Mon Sep 17 00:00:00 2001 From: Mingyi Chen Date: Wed, 1 May 2024 08:10:27 -0400 Subject: [PATCH] Fix Twine usage --- clang/lib/Driver/ToolChains/HIPUtility.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/clang/lib/Driver/ToolChains/HIPUtility.cpp b/clang/lib/Driver/ToolChains/HIPUtility.cpp index 08c647dfcb6f72..e696d43bb3211b 100644 --- a/clang/lib/Driver/ToolChains/HIPUtility.cpp +++ b/clang/lib/Driver/ToolChains/HIPUtility.cpp @@ -106,9 +106,8 @@ class HIPUndefinedFatBinSymbols { std::string ID = IA->getId().str(); if (!ID.empty()) { ID = llvm::utohexstr(llvm::MD5Hash(ID), /*LowerCase=*/true); - FatBinSymbols.insert(Twine(FatBinPrefix + "_" + ID).str()); - GPUBinHandleSymbols.insert( - Twine(GPUBinHandlePrefix + "_" + ID).str()); + FatBinSymbols.insert((Twine(FatBinPrefix) + '_' + ID).str()); + GPUBinHandleSymbols.insert((Twine(GPUBinHandlePrefix) + '_' + ID).str()); continue; } if (IA->getInputArg().getNumValues() == 0) ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] Fix Twine usage (PR #90728)
llvmbot wrote: @llvm/pr-subscribers-clang @llvm/pr-subscribers-clang-driver Author: None (MagentaTreehouse) Changes Construct `Twine`s before concatenation. --- Full diff: https://github.com/llvm/llvm-project/pull/90728.diff 1 Files Affected: - (modified) clang/lib/Driver/ToolChains/HIPUtility.cpp (+2-3) ``diff diff --git a/clang/lib/Driver/ToolChains/HIPUtility.cpp b/clang/lib/Driver/ToolChains/HIPUtility.cpp index 08c647dfcb6f72..e696d43bb3211b 100644 --- a/clang/lib/Driver/ToolChains/HIPUtility.cpp +++ b/clang/lib/Driver/ToolChains/HIPUtility.cpp @@ -106,9 +106,8 @@ class HIPUndefinedFatBinSymbols { std::string ID = IA->getId().str(); if (!ID.empty()) { ID = llvm::utohexstr(llvm::MD5Hash(ID), /*LowerCase=*/true); - FatBinSymbols.insert(Twine(FatBinPrefix + "_" + ID).str()); - GPUBinHandleSymbols.insert( - Twine(GPUBinHandlePrefix + "_" + ID).str()); + FatBinSymbols.insert((Twine(FatBinPrefix) + '_' + ID).str()); + GPUBinHandleSymbols.insert((Twine(GPUBinHandlePrefix) + '_' + ID).str()); continue; } if (IA->getInputArg().getNumValues() == 0) `` https://github.com/llvm/llvm-project/pull/90728 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] Fix Twine usage (PR #90728)
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 576261ac8f803e5142fd8634805e48d0063de4e1 ad0384030a78be7d91851c565db41af1b161378f -- clang/lib/Driver/ToolChains/HIPUtility.cpp `` View the diff from clang-format here. ``diff diff --git a/clang/lib/Driver/ToolChains/HIPUtility.cpp b/clang/lib/Driver/ToolChains/HIPUtility.cpp index e696d43bb3..e535b9f2f3 100644 --- a/clang/lib/Driver/ToolChains/HIPUtility.cpp +++ b/clang/lib/Driver/ToolChains/HIPUtility.cpp @@ -107,7 +107,8 @@ private: if (!ID.empty()) { ID = llvm::utohexstr(llvm::MD5Hash(ID), /*LowerCase=*/true); FatBinSymbols.insert((Twine(FatBinPrefix) + '_' + ID).str()); - GPUBinHandleSymbols.insert((Twine(GPUBinHandlePrefix) + '_' + ID).str()); + GPUBinHandleSymbols.insert( + (Twine(GPUBinHandlePrefix) + '_' + ID).str()); continue; } if (IA->getInputArg().getNumValues() == 0) `` https://github.com/llvm/llvm-project/pull/90728 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang] Ensure "=default"ed function can be deleted when used as an extension in C++03 (PR #90725)
https://github.com/cor3ntin edited https://github.com/llvm/llvm-project/pull/90725 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang] Ensure "=default"ed function can be deleted when used as an extension in C++03 (PR #90725)
https://github.com/cor3ntin commented: Can you add a changelog entry? https://github.com/llvm/llvm-project/pull/90725 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang] Ensure "=default"ed function can be deleted when used as an extension in C++03 (PR #90725)
@@ -9767,7 +9767,9 @@ bool Sema::ShouldDeleteSpecialMember(CXXMethodDecl *MD, return false; CXXRecordDecl *RD = MD->getParent(); assert(!RD->isDependentType() && "do deletion after instantiation"); - if (!LangOpts.CPlusPlus || (!LangOpts.CPlusPlus11 && !RD->isLambda()) || + if (!LangOpts.CPlusPlus || cor3ntin wrote: are there cases where `!LangOpts.CPlusPlus` is true here? https://github.com/llvm/llvm-project/pull/90725 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] Fix Twine usage (PR #90728)
https://github.com/MagentaTreehouse updated https://github.com/llvm/llvm-project/pull/90728 >From ad0384030a78be7d91851c565db41af1b161378f Mon Sep 17 00:00:00 2001 From: Mingyi Chen Date: Wed, 1 May 2024 08:10:27 -0400 Subject: [PATCH 1/2] Fix Twine usage --- clang/lib/Driver/ToolChains/HIPUtility.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/clang/lib/Driver/ToolChains/HIPUtility.cpp b/clang/lib/Driver/ToolChains/HIPUtility.cpp index 08c647dfcb6f72..e696d43bb3211b 100644 --- a/clang/lib/Driver/ToolChains/HIPUtility.cpp +++ b/clang/lib/Driver/ToolChains/HIPUtility.cpp @@ -106,9 +106,8 @@ class HIPUndefinedFatBinSymbols { std::string ID = IA->getId().str(); if (!ID.empty()) { ID = llvm::utohexstr(llvm::MD5Hash(ID), /*LowerCase=*/true); - FatBinSymbols.insert(Twine(FatBinPrefix + "_" + ID).str()); - GPUBinHandleSymbols.insert( - Twine(GPUBinHandlePrefix + "_" + ID).str()); + FatBinSymbols.insert((Twine(FatBinPrefix) + '_' + ID).str()); + GPUBinHandleSymbols.insert((Twine(GPUBinHandlePrefix) + '_' + ID).str()); continue; } if (IA->getInputArg().getNumValues() == 0) >From 4c74628025115a7d004725c3254f38d32bd25627 Mon Sep 17 00:00:00 2001 From: Mingyi Chen Date: Wed, 1 May 2024 08:33:39 -0400 Subject: [PATCH 2/2] Fix formatting --- clang/lib/Driver/ToolChains/HIPUtility.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/clang/lib/Driver/ToolChains/HIPUtility.cpp b/clang/lib/Driver/ToolChains/HIPUtility.cpp index e696d43bb3211b..e535b9f2f3502b 100644 --- a/clang/lib/Driver/ToolChains/HIPUtility.cpp +++ b/clang/lib/Driver/ToolChains/HIPUtility.cpp @@ -107,7 +107,8 @@ class HIPUndefinedFatBinSymbols { if (!ID.empty()) { ID = llvm::utohexstr(llvm::MD5Hash(ID), /*LowerCase=*/true); FatBinSymbols.insert((Twine(FatBinPrefix) + '_' + ID).str()); - GPUBinHandleSymbols.insert((Twine(GPUBinHandlePrefix) + '_' + ID).str()); + GPUBinHandleSymbols.insert( + (Twine(GPUBinHandlePrefix) + '_' + ID).str()); continue; } if (IA->getInputArg().getNumValues() == 0) ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] Fix Twine usage (PR #90728)
https://github.com/MagentaTreehouse converted_to_draft https://github.com/llvm/llvm-project/pull/90728 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [libcxx] [llvm] Triple::normalize: Use none as OS for XX-none-ABI (PR #89638)
https://github.com/wzssyqa updated https://github.com/llvm/llvm-project/pull/89638 >From 3cec71e178264b69e43c4842302b61465271d735 Mon Sep 17 00:00:00 2001 From: YunQiang Su Date: Sat, 27 Apr 2024 10:55:38 +0800 Subject: [PATCH 1/2] Triple::normalize: Use none as OS for XX-none-ABI When parsing a 3-component triple, after we determine Arch and Env, if the middle component is "none", treat it as OS instead of Vendor. Fixes: #89582. --- clang/docs/Multilib.rst | 4 ++-- libcxx/utils/ci/run-buildbot | 2 +- llvm/lib/TargetParser/Triple.cpp | 6 ++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/clang/docs/Multilib.rst b/clang/docs/Multilib.rst index ab737e43b97d23..063fe9a336f2fe 100644 --- a/clang/docs/Multilib.rst +++ b/clang/docs/Multilib.rst @@ -188,9 +188,9 @@ For a more comprehensive example see - Dir: thumb/v6-m # List of one or more normalized command line options, as generated by Clang # from the command line options or from Mappings below. -# Here, if the flags are a superset of {target=thumbv6m-none-unknown-eabi} +# Here, if the flags are a superset of {target=thumbv6m-unknown-none-eabi} # then this multilib variant will be considered a match. -Flags: [--target=thumbv6m-none-unknown-eabi] +Flags: [--target=thumbv6m-unknown-none-eabi] # Similarly, a multilib variant targeting Arm v7-M with an FPU (floating # point unit). diff --git a/libcxx/utils/ci/run-buildbot b/libcxx/utils/ci/run-buildbot index 60307a7d4f350a..3523a29e4f4613 100755 --- a/libcxx/utils/ci/run-buildbot +++ b/libcxx/utils/ci/run-buildbot @@ -217,7 +217,7 @@ function test-armv7m-picolibc() { "${@}" ${NINJA} -vC "${BUILD_DIR}/compiler-rt" install -mv "${BUILD_DIR}/install/lib/armv7m-none-unknown-eabi"/* "${BUILD_DIR}/install/lib" +mv "${BUILD_DIR}/install/lib/armv7m-unknown-none-eabi"/* "${BUILD_DIR}/install/lib" check-runtimes } diff --git a/llvm/lib/TargetParser/Triple.cpp b/llvm/lib/TargetParser/Triple.cpp index 2c5aee3dfb2f3e..f3f244c814e7ee 100644 --- a/llvm/lib/TargetParser/Triple.cpp +++ b/llvm/lib/TargetParser/Triple.cpp @@ -1151,6 +1151,12 @@ std::string Triple::normalize(StringRef Str) { } } + // If "none" is in the middle component in a three-component triple, treat it + // as the OS (Components[2]) instead of the vendor (Components[1]). + if (Found[0] && !Found[1] && !Found[2] && Found[3] && + Components[1] == "none" && Components[2].empty()) +std::swap(Components[1], Components[2]); + // Replace empty components with "unknown" value. for (StringRef &C : Components) if (C.empty()) >From f5aca8b7cdb97b7ad1f8665401ee21caef8f61b4 Mon Sep 17 00:00:00 2001 From: YunQiang Su Date: Wed, 1 May 2024 08:44:09 +0800 Subject: [PATCH 2/2] fix test failures --- clang/test/Driver/arm-ias-Wa.s| 2 +- clang/test/Driver/arm-triple.c| 10 +-- .../Driver/baremetal-multilib-layered.yaml| 2 +- clang/test/Driver/baremetal-multilib.yaml | 64 +-- clang/test/Driver/baremetal-sysroot.cpp | 2 +- clang/test/Driver/baremetal.cpp | 2 +- .../test/Driver/print-multi-selection-flags.c | 14 ++-- .../IncrementalCompilerBuilderTest.cpp| 2 +- llvm/unittests/TargetParser/TripleTest.cpp| 2 +- 9 files changed, 50 insertions(+), 50 deletions(-) diff --git a/clang/test/Driver/arm-ias-Wa.s b/clang/test/Driver/arm-ias-Wa.s index b82ce8dfb31ab3..5e9518ed2dc423 100644 --- a/clang/test/Driver/arm-ias-Wa.s +++ b/clang/test/Driver/arm-ias-Wa.s @@ -71,7 +71,7 @@ // RUN: %clang -target armv7r-none-eabi -c %s -### 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-R-PROFILE %s -// CHECK-R-PROFILE: "-triple" "armv7r-none-unknown-eabi" +// CHECK-R-PROFILE: "-triple" "armv7r-unknown-none-eabi" // RUN: %clang -target armv7m-none-eabi -c %s -### 2>&1 \ // RUN: %clang -target thumbv7m-none-eabi -c %s -### 2>&1 \ diff --git a/clang/test/Driver/arm-triple.c b/clang/test/Driver/arm-triple.c index fa9f7b189c8278..1fb2b5afe22a51 100644 --- a/clang/test/Driver/arm-triple.c +++ b/clang/test/Driver/arm-triple.c @@ -7,7 +7,7 @@ // RUN: %clang -print-effective-triple \ // RUN: --target=arm-none-eabihf -march=armv4t -mfloat-abi=softfp \ // RUN: | FileCheck %s --check-prefix=CHECK-DEFAULT -// CHECK-DEFAULT: armv4t-none-unknown-eabi +// CHECK-DEFAULT: armv4t-unknown-none-eabi // RUN: %clang -print-effective-triple \ // RUN: --target=armeb-none-eabi \ @@ -15,7 +15,7 @@ // RUN: %clang -print-effective-triple \ // RUN: --target=arm-none-eabi -mbig-endian \ // RUN: | FileCheck %s --check-prefix=CHECK-EB -// CHECK-EB: armebv4t-none-unknown-eabi +// CHECK-EB: armebv4t-unknown-none-eabi // RUN: %clang -print-effective-triple \ // RUN: --target=arm-none-eabihf -march=armv4t \ @@ -23,7 +23,7 @@ // RUN: %clang -print-effective-triple \ // RUN: --target=arm-none-eabi -mfloat-abi=hard \ // RUN: | FileCheck %s --check-
[clang] [libcxx] [llvm] Triple::normalize: Use none as OS for XX-none-ABI (PR #89638)
https://github.com/wzssyqa updated https://github.com/llvm/llvm-project/pull/89638 >From 2315aa6db326a5b6508e3e9730007fb44c179421 Mon Sep 17 00:00:00 2001 From: YunQiang Su Date: Sat, 27 Apr 2024 10:55:38 +0800 Subject: [PATCH 1/2] Triple::normalize: Use none as OS for XX-none-ABI When parsing a 3-component triple, after we determine Arch and Env, if the middle component is "none", treat it as OS instead of Vendor. Fixes: #89582. --- clang/docs/Multilib.rst | 4 ++-- libcxx/utils/ci/run-buildbot | 2 +- llvm/lib/TargetParser/Triple.cpp | 6 ++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/clang/docs/Multilib.rst b/clang/docs/Multilib.rst index ab737e43b97d23..063fe9a336f2fe 100644 --- a/clang/docs/Multilib.rst +++ b/clang/docs/Multilib.rst @@ -188,9 +188,9 @@ For a more comprehensive example see - Dir: thumb/v6-m # List of one or more normalized command line options, as generated by Clang # from the command line options or from Mappings below. -# Here, if the flags are a superset of {target=thumbv6m-none-unknown-eabi} +# Here, if the flags are a superset of {target=thumbv6m-unknown-none-eabi} # then this multilib variant will be considered a match. -Flags: [--target=thumbv6m-none-unknown-eabi] +Flags: [--target=thumbv6m-unknown-none-eabi] # Similarly, a multilib variant targeting Arm v7-M with an FPU (floating # point unit). diff --git a/libcxx/utils/ci/run-buildbot b/libcxx/utils/ci/run-buildbot index 60307a7d4f350a..23a2a1bbbc63fa 100755 --- a/libcxx/utils/ci/run-buildbot +++ b/libcxx/utils/ci/run-buildbot @@ -217,7 +217,7 @@ function test-armv7m-picolibc() { "${@}" ${NINJA} -vC "${BUILD_DIR}/compiler-rt" install -mv "${BUILD_DIR}/install/lib/armv7m-none-unknown-eabi"/* "${BUILD_DIR}/install/lib" +mv "${BUILD_DIR}/install/lib/armv7m-none-eabi"/* "${BUILD_DIR}/install/lib" check-runtimes } diff --git a/llvm/lib/TargetParser/Triple.cpp b/llvm/lib/TargetParser/Triple.cpp index 2c5aee3dfb2f3e..f3f244c814e7ee 100644 --- a/llvm/lib/TargetParser/Triple.cpp +++ b/llvm/lib/TargetParser/Triple.cpp @@ -1151,6 +1151,12 @@ std::string Triple::normalize(StringRef Str) { } } + // If "none" is in the middle component in a three-component triple, treat it + // as the OS (Components[2]) instead of the vendor (Components[1]). + if (Found[0] && !Found[1] && !Found[2] && Found[3] && + Components[1] == "none" && Components[2].empty()) +std::swap(Components[1], Components[2]); + // Replace empty components with "unknown" value. for (StringRef &C : Components) if (C.empty()) >From d21b4ff131630c016334f574ef307d43ef588840 Mon Sep 17 00:00:00 2001 From: YunQiang Su Date: Wed, 1 May 2024 08:44:09 +0800 Subject: [PATCH 2/2] fix test failures --- clang/test/Driver/arm-ias-Wa.s| 2 +- clang/test/Driver/arm-triple.c| 10 +-- .../Driver/baremetal-multilib-layered.yaml| 2 +- clang/test/Driver/baremetal-multilib.yaml | 64 +-- clang/test/Driver/baremetal-sysroot.cpp | 2 +- clang/test/Driver/baremetal.cpp | 2 +- .../test/Driver/print-multi-selection-flags.c | 14 ++-- .../IncrementalCompilerBuilderTest.cpp| 2 +- llvm/unittests/TargetParser/TripleTest.cpp| 2 +- 9 files changed, 50 insertions(+), 50 deletions(-) diff --git a/clang/test/Driver/arm-ias-Wa.s b/clang/test/Driver/arm-ias-Wa.s index b82ce8dfb31ab3..5e9518ed2dc423 100644 --- a/clang/test/Driver/arm-ias-Wa.s +++ b/clang/test/Driver/arm-ias-Wa.s @@ -71,7 +71,7 @@ // RUN: %clang -target armv7r-none-eabi -c %s -### 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-R-PROFILE %s -// CHECK-R-PROFILE: "-triple" "armv7r-none-unknown-eabi" +// CHECK-R-PROFILE: "-triple" "armv7r-unknown-none-eabi" // RUN: %clang -target armv7m-none-eabi -c %s -### 2>&1 \ // RUN: %clang -target thumbv7m-none-eabi -c %s -### 2>&1 \ diff --git a/clang/test/Driver/arm-triple.c b/clang/test/Driver/arm-triple.c index fa9f7b189c8278..1fb2b5afe22a51 100644 --- a/clang/test/Driver/arm-triple.c +++ b/clang/test/Driver/arm-triple.c @@ -7,7 +7,7 @@ // RUN: %clang -print-effective-triple \ // RUN: --target=arm-none-eabihf -march=armv4t -mfloat-abi=softfp \ // RUN: | FileCheck %s --check-prefix=CHECK-DEFAULT -// CHECK-DEFAULT: armv4t-none-unknown-eabi +// CHECK-DEFAULT: armv4t-unknown-none-eabi // RUN: %clang -print-effective-triple \ // RUN: --target=armeb-none-eabi \ @@ -15,7 +15,7 @@ // RUN: %clang -print-effective-triple \ // RUN: --target=arm-none-eabi -mbig-endian \ // RUN: | FileCheck %s --check-prefix=CHECK-EB -// CHECK-EB: armebv4t-none-unknown-eabi +// CHECK-EB: armebv4t-unknown-none-eabi // RUN: %clang -print-effective-triple \ // RUN: --target=arm-none-eabihf -march=armv4t \ @@ -23,7 +23,7 @@ // RUN: %clang -print-effective-triple \ // RUN: --target=arm-none-eabi -mfloat-abi=hard \ // RUN: | FileCheck %s --check-prefix=CH
[clang] [llvm] Triple::normalize: Use none as OS for XX-none-ABI (PR #89638)
https://github.com/wzssyqa updated https://github.com/llvm/llvm-project/pull/89638 >From d8c9a636b3fbcdcfef6f934780e6cb042a84b23b Mon Sep 17 00:00:00 2001 From: YunQiang Su Date: Sat, 27 Apr 2024 10:55:38 +0800 Subject: [PATCH 1/2] Triple::normalize: Use none as OS for XX-none-ABI When parsing a 3-component triple, after we determine Arch and Env, if the middle component is "none", treat it as OS instead of Vendor. Fixes: #89582. --- clang/docs/Multilib.rst | 4 ++-- llvm/lib/TargetParser/Triple.cpp | 6 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/clang/docs/Multilib.rst b/clang/docs/Multilib.rst index ab737e43b97d23..063fe9a336f2fe 100644 --- a/clang/docs/Multilib.rst +++ b/clang/docs/Multilib.rst @@ -188,9 +188,9 @@ For a more comprehensive example see - Dir: thumb/v6-m # List of one or more normalized command line options, as generated by Clang # from the command line options or from Mappings below. -# Here, if the flags are a superset of {target=thumbv6m-none-unknown-eabi} +# Here, if the flags are a superset of {target=thumbv6m-unknown-none-eabi} # then this multilib variant will be considered a match. -Flags: [--target=thumbv6m-none-unknown-eabi] +Flags: [--target=thumbv6m-unknown-none-eabi] # Similarly, a multilib variant targeting Arm v7-M with an FPU (floating # point unit). diff --git a/llvm/lib/TargetParser/Triple.cpp b/llvm/lib/TargetParser/Triple.cpp index 2c5aee3dfb2f3e..f3f244c814e7ee 100644 --- a/llvm/lib/TargetParser/Triple.cpp +++ b/llvm/lib/TargetParser/Triple.cpp @@ -1151,6 +1151,12 @@ std::string Triple::normalize(StringRef Str) { } } + // If "none" is in the middle component in a three-component triple, treat it + // as the OS (Components[2]) instead of the vendor (Components[1]). + if (Found[0] && !Found[1] && !Found[2] && Found[3] && + Components[1] == "none" && Components[2].empty()) +std::swap(Components[1], Components[2]); + // Replace empty components with "unknown" value. for (StringRef &C : Components) if (C.empty()) >From 8128b3c6a911b60b7be2dfd93e42b2c726eaa4b1 Mon Sep 17 00:00:00 2001 From: YunQiang Su Date: Wed, 1 May 2024 08:44:09 +0800 Subject: [PATCH 2/2] fix test failures --- clang/test/Driver/arm-ias-Wa.s| 2 +- clang/test/Driver/arm-triple.c| 10 +-- .../Driver/baremetal-multilib-layered.yaml| 2 +- clang/test/Driver/baremetal-multilib.yaml | 64 +-- clang/test/Driver/baremetal-sysroot.cpp | 2 +- clang/test/Driver/baremetal.cpp | 2 +- .../test/Driver/print-multi-selection-flags.c | 14 ++-- .../IncrementalCompilerBuilderTest.cpp| 2 +- llvm/unittests/TargetParser/TripleTest.cpp| 2 +- 9 files changed, 50 insertions(+), 50 deletions(-) diff --git a/clang/test/Driver/arm-ias-Wa.s b/clang/test/Driver/arm-ias-Wa.s index b82ce8dfb31ab3..5e9518ed2dc423 100644 --- a/clang/test/Driver/arm-ias-Wa.s +++ b/clang/test/Driver/arm-ias-Wa.s @@ -71,7 +71,7 @@ // RUN: %clang -target armv7r-none-eabi -c %s -### 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-R-PROFILE %s -// CHECK-R-PROFILE: "-triple" "armv7r-none-unknown-eabi" +// CHECK-R-PROFILE: "-triple" "armv7r-unknown-none-eabi" // RUN: %clang -target armv7m-none-eabi -c %s -### 2>&1 \ // RUN: %clang -target thumbv7m-none-eabi -c %s -### 2>&1 \ diff --git a/clang/test/Driver/arm-triple.c b/clang/test/Driver/arm-triple.c index fa9f7b189c8278..1fb2b5afe22a51 100644 --- a/clang/test/Driver/arm-triple.c +++ b/clang/test/Driver/arm-triple.c @@ -7,7 +7,7 @@ // RUN: %clang -print-effective-triple \ // RUN: --target=arm-none-eabihf -march=armv4t -mfloat-abi=softfp \ // RUN: | FileCheck %s --check-prefix=CHECK-DEFAULT -// CHECK-DEFAULT: armv4t-none-unknown-eabi +// CHECK-DEFAULT: armv4t-unknown-none-eabi // RUN: %clang -print-effective-triple \ // RUN: --target=armeb-none-eabi \ @@ -15,7 +15,7 @@ // RUN: %clang -print-effective-triple \ // RUN: --target=arm-none-eabi -mbig-endian \ // RUN: | FileCheck %s --check-prefix=CHECK-EB -// CHECK-EB: armebv4t-none-unknown-eabi +// CHECK-EB: armebv4t-unknown-none-eabi // RUN: %clang -print-effective-triple \ // RUN: --target=arm-none-eabihf -march=armv4t \ @@ -23,7 +23,7 @@ // RUN: %clang -print-effective-triple \ // RUN: --target=arm-none-eabi -mfloat-abi=hard \ // RUN: | FileCheck %s --check-prefix=CHECK-HF -// CHECK-HF: armv4t-none-unknown-eabihf +// CHECK-HF: armv4t-unknown-none-eabihf // RUN: %clang -print-effective-triple \ // RUN: --target=armeb-none-eabihf -march=armv4t \ @@ -37,7 +37,7 @@ // RUN: %clang -print-effective-triple \ // RUN: --target=arm-none-eabi -mbig-endian -mfloat-abi=hard \ // RUN: | FileCheck %s --check-prefix=CHECK-EB-HF -// CHECK-EB-HF: armebv4t-none-unknown-eabihf +// CHECK-EB-HF: armebv4t-unknown-none-eabihf // RUN: %clang -print-effective-triple \ // RUN: --target=arm-none-eabi -march=armv8m
[clang] [clang] fix(85447): clang 18.1.0 crashes in clang::ASTContext::getTypeInfoImpl (PR #89850)
https://github.com/a-tarasyuk updated https://github.com/llvm/llvm-project/pull/89850 >From f4e4e7b91e85d12c861063e1461b160b9bd22da6 Mon Sep 17 00:00:00 2001 From: Oleksandr T Date: Mon, 29 Apr 2024 01:53:47 +0300 Subject: [PATCH 1/2] fix(85447): refine handling of incomplete anonymous struct declarations --- clang/lib/Sema/SemaDecl.cpp| 3 +++ clang/test/Sema/incomplete-struct-decl.cpp | 10 ++ 2 files changed, 13 insertions(+) create mode 100644 clang/test/Sema/incomplete-struct-decl.cpp diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 671752b56e01f4..d3871bb7447405 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -5789,6 +5789,9 @@ Decl *Sema::BuildAnonymousStructOrUnion(Scope *S, DeclSpec &DS, Anon = VarDecl::Create(Context, Owner, DS.getBeginLoc(), Record->getLocation(), /*IdentifierInfo=*/nullptr, Context.getTypeDeclType(Record), TInfo, SC); +if (Invalid) + Anon->setInvalidDecl(); + ProcessDeclAttributes(S, Anon, Dc); // Default-initialize the implicit variable. This initialization will be diff --git a/clang/test/Sema/incomplete-struct-decl.cpp b/clang/test/Sema/incomplete-struct-decl.cpp new file mode 100644 index 00..bc3bd6b2eae2f0 --- /dev/null +++ b/clang/test/Sema/incomplete-struct-decl.cpp @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -x c++ -fsyntax-only -verify=cxx,expected %s + +template using __impl_of = a; // expected-note {{'__impl_of' declared here}} \ + expected-note {{template is declared here}} +struct {// expected-error {{anonymous structs and classes must be class members}} \ + expected-note {{to match this '{'}} + __impl_; // expected-error {{no template named '__impl_'; did you mean '__impl_of'?}} \ + expected-error {{cannot specify deduction guide for alias template '__impl_of'}} \ + expected-error {{expected ';' after struct}} +// expected-error {{expected '}'}} >From b6ea2516c966be1ed1f432fecc37f0a5b464a747 Mon Sep 17 00:00:00 2001 From: Oleksandr T Date: Wed, 1 May 2024 15:47:32 +0300 Subject: [PATCH 2/2] update changelog --- clang/docs/ReleaseNotes.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 64a523a6f25fc2..5c7a9db4a5ad9c 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -590,6 +590,7 @@ Bug Fixes to C++ Support - Fixed a use-after-free bug in parsing of type constraints with default arguments that involve lambdas. (#GH67235) - Fixed bug in which the body of a consteval lambda within a template was not parsed as within an immediate function context. +- Fix crash caused by missing invocation of ``setInvalidDecl()`` for invalid ``Anon`` declarations. (#GH85447) Bug Fixes to AST Handling ^ ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [DirectX] Start documenting DXIL Resource handling (PR #90553)
@@ -0,0 +1,799 @@ +== +DXIL Resource Handling +== + +.. contents:: + :local: + +.. toctree:: + :hidden: + +Introduction + + +Resources in DXIL are represented via ``TargetExtType`` in LLVM IR and +eventually lowered by the DirectX backend into metadata in DXIL. + +In DXC and DXIL, static resources are represented as lists of SRVs (Shader +Resource Views), UAVs (Uniform Access Views), CBVs (Constant Bffer Views), and +Samplers. This metadata consists of a "resource record ID" which uniquely +identifies a resource and type information. As of shader model 6.6, there are +also dynamic resources, which forgo the metadata and are described via +``annotateHandle`` operations in the instruction stream instead. + +In LLVM we attempt to unify some of the alternative representations that are +present in DXC, with the aim of making handling of resources in the middle end +of the compiler simpler and more consistent. + +Resource Type Information and Properties + + +There are a number of properties associated with a resource in DXIL. + +`Resource ID` + An arbitrary ID that must be unique per resource type (SRV, UAV, etc). + + In LLVM we don't bother representing this, instead opting to generate it at + DXIL lowering time. + +`Binding information` + Information about where the resource comes from. This is either (a) a + binding space, lower bound in that space, and size of the binding, or (b) an + index into a dynamic resource heap. + + In LLVM we represent binding information in the arguments of the python3kgae wrote: How does an array of resources work? Always initialize the first element with createHandleFromBinding in clang codeGen to make sure the binding is saved? https://github.com/llvm/llvm-project/pull/90553 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] fix(85447): clang 18.1.0 crashes in clang::ASTContext::getTypeInfoImpl (PR #89850)
https://github.com/a-tarasyuk updated https://github.com/llvm/llvm-project/pull/89850 >From f4e4e7b91e85d12c861063e1461b160b9bd22da6 Mon Sep 17 00:00:00 2001 From: Oleksandr T Date: Mon, 29 Apr 2024 01:53:47 +0300 Subject: [PATCH 1/2] fix(85447): refine handling of incomplete anonymous struct declarations --- clang/lib/Sema/SemaDecl.cpp| 3 +++ clang/test/Sema/incomplete-struct-decl.cpp | 10 ++ 2 files changed, 13 insertions(+) create mode 100644 clang/test/Sema/incomplete-struct-decl.cpp diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 671752b56e01f4..d3871bb7447405 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -5789,6 +5789,9 @@ Decl *Sema::BuildAnonymousStructOrUnion(Scope *S, DeclSpec &DS, Anon = VarDecl::Create(Context, Owner, DS.getBeginLoc(), Record->getLocation(), /*IdentifierInfo=*/nullptr, Context.getTypeDeclType(Record), TInfo, SC); +if (Invalid) + Anon->setInvalidDecl(); + ProcessDeclAttributes(S, Anon, Dc); // Default-initialize the implicit variable. This initialization will be diff --git a/clang/test/Sema/incomplete-struct-decl.cpp b/clang/test/Sema/incomplete-struct-decl.cpp new file mode 100644 index 00..bc3bd6b2eae2f0 --- /dev/null +++ b/clang/test/Sema/incomplete-struct-decl.cpp @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -x c++ -fsyntax-only -verify=cxx,expected %s + +template using __impl_of = a; // expected-note {{'__impl_of' declared here}} \ + expected-note {{template is declared here}} +struct {// expected-error {{anonymous structs and classes must be class members}} \ + expected-note {{to match this '{'}} + __impl_; // expected-error {{no template named '__impl_'; did you mean '__impl_of'?}} \ + expected-error {{cannot specify deduction guide for alias template '__impl_of'}} \ + expected-error {{expected ';' after struct}} +// expected-error {{expected '}'}} >From b6ea2516c966be1ed1f432fecc37f0a5b464a747 Mon Sep 17 00:00:00 2001 From: Oleksandr T Date: Wed, 1 May 2024 15:47:32 +0300 Subject: [PATCH 2/2] update changelog --- clang/docs/ReleaseNotes.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 64a523a6f25fc2..5c7a9db4a5ad9c 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -590,6 +590,7 @@ Bug Fixes to C++ Support - Fixed a use-after-free bug in parsing of type constraints with default arguments that involve lambdas. (#GH67235) - Fixed bug in which the body of a consteval lambda within a template was not parsed as within an immediate function context. +- Fix crash caused by missing invocation of ``setInvalidDecl()`` for invalid ``Anon`` declarations. (#GH85447) Bug Fixes to AST Handling ^ ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] Fix Twine usage (PR #90728)
https://github.com/MagentaTreehouse updated https://github.com/llvm/llvm-project/pull/90728 >From ad0384030a78be7d91851c565db41af1b161378f Mon Sep 17 00:00:00 2001 From: Mingyi Chen Date: Wed, 1 May 2024 08:10:27 -0400 Subject: [PATCH 1/3] Fix Twine usage --- clang/lib/Driver/ToolChains/HIPUtility.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/clang/lib/Driver/ToolChains/HIPUtility.cpp b/clang/lib/Driver/ToolChains/HIPUtility.cpp index 08c647dfcb6f72..e696d43bb3211b 100644 --- a/clang/lib/Driver/ToolChains/HIPUtility.cpp +++ b/clang/lib/Driver/ToolChains/HIPUtility.cpp @@ -106,9 +106,8 @@ class HIPUndefinedFatBinSymbols { std::string ID = IA->getId().str(); if (!ID.empty()) { ID = llvm::utohexstr(llvm::MD5Hash(ID), /*LowerCase=*/true); - FatBinSymbols.insert(Twine(FatBinPrefix + "_" + ID).str()); - GPUBinHandleSymbols.insert( - Twine(GPUBinHandlePrefix + "_" + ID).str()); + FatBinSymbols.insert((Twine(FatBinPrefix) + '_' + ID).str()); + GPUBinHandleSymbols.insert((Twine(GPUBinHandlePrefix) + '_' + ID).str()); continue; } if (IA->getInputArg().getNumValues() == 0) >From 4c74628025115a7d004725c3254f38d32bd25627 Mon Sep 17 00:00:00 2001 From: Mingyi Chen Date: Wed, 1 May 2024 08:33:39 -0400 Subject: [PATCH 2/3] Fix formatting --- clang/lib/Driver/ToolChains/HIPUtility.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/clang/lib/Driver/ToolChains/HIPUtility.cpp b/clang/lib/Driver/ToolChains/HIPUtility.cpp index e696d43bb3211b..e535b9f2f3502b 100644 --- a/clang/lib/Driver/ToolChains/HIPUtility.cpp +++ b/clang/lib/Driver/ToolChains/HIPUtility.cpp @@ -107,7 +107,8 @@ class HIPUndefinedFatBinSymbols { if (!ID.empty()) { ID = llvm::utohexstr(llvm::MD5Hash(ID), /*LowerCase=*/true); FatBinSymbols.insert((Twine(FatBinPrefix) + '_' + ID).str()); - GPUBinHandleSymbols.insert((Twine(GPUBinHandlePrefix) + '_' + ID).str()); + GPUBinHandleSymbols.insert( + (Twine(GPUBinHandlePrefix) + '_' + ID).str()); continue; } if (IA->getInputArg().getNumValues() == 0) >From 975e77ec2ade943359603e2b5e3b905bfdcb72fb Mon Sep 17 00:00:00 2001 From: Mingyi Chen Date: Wed, 1 May 2024 08:49:35 -0400 Subject: [PATCH 3/3] Explicitly construct from char --- clang/lib/Driver/ToolChains/HIPUtility.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clang/lib/Driver/ToolChains/HIPUtility.cpp b/clang/lib/Driver/ToolChains/HIPUtility.cpp index e535b9f2f3502b..0a1783835bb1b0 100644 --- a/clang/lib/Driver/ToolChains/HIPUtility.cpp +++ b/clang/lib/Driver/ToolChains/HIPUtility.cpp @@ -106,9 +106,9 @@ class HIPUndefinedFatBinSymbols { std::string ID = IA->getId().str(); if (!ID.empty()) { ID = llvm::utohexstr(llvm::MD5Hash(ID), /*LowerCase=*/true); - FatBinSymbols.insert((Twine(FatBinPrefix) + '_' + ID).str()); + FatBinSymbols.insert((FatBinPrefix + Twine('_') + ID).str()); GPUBinHandleSymbols.insert( - (Twine(GPUBinHandlePrefix) + '_' + ID).str()); + (GPUBinHandlePrefix + Twine('_') + ID).str()); continue; } if (IA->getInputArg().getNumValues() == 0) ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang] [C++26] Implement P2573R2: `= delete("should have a reason");` (PR #86526)
@@ -2280,18 +2294,18 @@ class FunctionDecl : public DeclaratorDecl, /// Returns whether this specific declaration of the function has a body. bool doesThisDeclarationHaveABody() const { -return (!FunctionDeclBits.HasDefaultedFunctionInfo && Body) || +return (!FunctionDeclBits.HasDefaultedOrDeletedInfo && Body) || isLateTemplateParsed(); } void setBody(Stmt *B); void setLazyBody(uint64_t Offset) { -FunctionDeclBits.HasDefaultedFunctionInfo = false; +FunctionDeclBits.HasDefaultedOrDeletedInfo = false; Body = LazyDeclStmtPtr(Offset); } - void setDefaultedFunctionInfo(DefaultedFunctionInfo *Info); - DefaultedFunctionInfo *getDefaultedFunctionInfo() const; + void setDefaultedOrDeletedInfo(DefaultedOrDeletedFunctionInfo *Info); + DefaultedOrDeletedFunctionInfo *getDefalutedOrDeletedInfo() const; Sirraide wrote: > @Sirraide There's no reason we can't change this name to fix this typo right? Ah, my bad, yeah, that should just be a NFC fix. https://github.com/llvm/llvm-project/pull/86526 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [mlir] [Clang][CodeGen] Start migrating away from assuming the Default AS is 0 (PR #88182)
@@ -0,0 +1,288 @@ +// RUN: %clang_cc1 %s -triple=spirv64-unknown-unknown -fsycl-is-device -std=c++11 -emit-llvm -o %t.ll -O1 -disable-llvm-passes -fms-extensions -fstrict-vtable-pointers +// FIXME: Assume load should not require -fstrict-vtable-pointers + +// RUN: FileCheck --check-prefix=CHECK1 --input-file=%t.ll %s AlexVlx wrote: If you do not mind, I will take it up as a subsequent activity, as I'd have to figure out the rationale of the test to see how to collapse it. For now, it would be nice to not tickle the dragon too much, this has already grown quite a bit beyond its initial state:) https://github.com/llvm/llvm-project/pull/88182 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] Fix Twine usage (PR #90728)
https://github.com/MagentaTreehouse updated https://github.com/llvm/llvm-project/pull/90728 >From 7591c8fb13cfa4a6f4a48f234564e221ed1d4689 Mon Sep 17 00:00:00 2001 From: Mingyi Chen Date: Wed, 1 May 2024 08:10:27 -0400 Subject: [PATCH 1/3] Fix Twine usage --- clang/lib/Driver/ToolChains/HIPUtility.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/clang/lib/Driver/ToolChains/HIPUtility.cpp b/clang/lib/Driver/ToolChains/HIPUtility.cpp index 08c647dfcb6f72..e696d43bb3211b 100644 --- a/clang/lib/Driver/ToolChains/HIPUtility.cpp +++ b/clang/lib/Driver/ToolChains/HIPUtility.cpp @@ -106,9 +106,8 @@ class HIPUndefinedFatBinSymbols { std::string ID = IA->getId().str(); if (!ID.empty()) { ID = llvm::utohexstr(llvm::MD5Hash(ID), /*LowerCase=*/true); - FatBinSymbols.insert(Twine(FatBinPrefix + "_" + ID).str()); - GPUBinHandleSymbols.insert( - Twine(GPUBinHandlePrefix + "_" + ID).str()); + FatBinSymbols.insert((Twine(FatBinPrefix) + '_' + ID).str()); + GPUBinHandleSymbols.insert((Twine(GPUBinHandlePrefix) + '_' + ID).str()); continue; } if (IA->getInputArg().getNumValues() == 0) >From cba0d5735350668edb912e3c35507ca4bf1e90d3 Mon Sep 17 00:00:00 2001 From: Mingyi Chen Date: Wed, 1 May 2024 08:33:39 -0400 Subject: [PATCH 2/3] Fix formatting --- clang/lib/Driver/ToolChains/HIPUtility.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/clang/lib/Driver/ToolChains/HIPUtility.cpp b/clang/lib/Driver/ToolChains/HIPUtility.cpp index e696d43bb3211b..e535b9f2f3502b 100644 --- a/clang/lib/Driver/ToolChains/HIPUtility.cpp +++ b/clang/lib/Driver/ToolChains/HIPUtility.cpp @@ -107,7 +107,8 @@ class HIPUndefinedFatBinSymbols { if (!ID.empty()) { ID = llvm::utohexstr(llvm::MD5Hash(ID), /*LowerCase=*/true); FatBinSymbols.insert((Twine(FatBinPrefix) + '_' + ID).str()); - GPUBinHandleSymbols.insert((Twine(GPUBinHandlePrefix) + '_' + ID).str()); + GPUBinHandleSymbols.insert( + (Twine(GPUBinHandlePrefix) + '_' + ID).str()); continue; } if (IA->getInputArg().getNumValues() == 0) >From 7c66c539cfd5cab79499cc397e54ce7ff0559e37 Mon Sep 17 00:00:00 2001 From: Mingyi Chen Date: Wed, 1 May 2024 08:49:35 -0400 Subject: [PATCH 3/3] Explicitly construct from char --- clang/lib/Driver/ToolChains/HIPUtility.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clang/lib/Driver/ToolChains/HIPUtility.cpp b/clang/lib/Driver/ToolChains/HIPUtility.cpp index e535b9f2f3502b..0a1783835bb1b0 100644 --- a/clang/lib/Driver/ToolChains/HIPUtility.cpp +++ b/clang/lib/Driver/ToolChains/HIPUtility.cpp @@ -106,9 +106,9 @@ class HIPUndefinedFatBinSymbols { std::string ID = IA->getId().str(); if (!ID.empty()) { ID = llvm::utohexstr(llvm::MD5Hash(ID), /*LowerCase=*/true); - FatBinSymbols.insert((Twine(FatBinPrefix) + '_' + ID).str()); + FatBinSymbols.insert((FatBinPrefix + Twine('_') + ID).str()); GPUBinHandleSymbols.insert( - (Twine(GPUBinHandlePrefix) + '_' + ID).str()); + (GPUBinHandlePrefix + Twine('_') + ID).str()); continue; } if (IA->getInputArg().getNumValues() == 0) ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang][Sema] fix a bug on constraint check with template friend function (PR #90646)
https://github.com/erichkeane commented: This seems reasonable, @mizvekov is doing more work in this area, so I'd like him to make sure this isn't something he's fixed elsewhere. https://github.com/llvm/llvm-project/pull/90646 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [mlir] [Clang][CodeGen] Start migrating away from assuming the Default AS is 0 (PR #88182)
@@ -1370,7 +1370,7 @@ let IntrProperties = [IntrNoMem, IntrSpeculatable, IntrWillReturn] in { // The result of eh.typeid.for depends on the enclosing function, but inside a // given function it is 'const' and may be CSE'd etc. -def int_eh_typeid_for : Intrinsic<[llvm_i32_ty], [llvm_ptr_ty], [IntrNoMem]>; +def int_eh_typeid_for : Intrinsic<[llvm_i32_ty], [llvm_anyptr_ty], [IntrNoMem]>; def int_eh_return_i32 : Intrinsic<[], [llvm_i32_ty, llvm_ptr_ty]>; AlexVlx wrote: Possibly, but it's a slightly different matter which I should probably deal with in another PR, wherein we handle the fact that the Program AS needn't be 0. AFAICT these intrinsics are here to support GCC's `__builtin_eh_return`, and the pointer arg is supposed to point to a handler function in the Program AS. I think it's preferable to handle that topic independently since it'll spawn its own lively discussion, no doubt. https://github.com/llvm/llvm-project/pull/88182 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang][Sema] fix a bug on constraint check with template friend function (PR #90646)
sdkrystian wrote: ```cpp template concept D = sizeof(T) == sizeof(U); template struct A { template requires D static void f(); }; template struct B { template struct C { friend void A::f(); }; }; template struct B::C; extern template void A::f(); // crash here ``` https://github.com/llvm/llvm-project/pull/90646 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang][CodeGen] Optimised LLVM IR for atomic increments/decrements on floats (PR #89362)
https://github.com/Krishna-13-cyber updated https://github.com/llvm/llvm-project/pull/89362 >From 4e649d105a2af038e6dbd0e93b457eebea2e543a Mon Sep 17 00:00:00 2001 From: Krishna-13-cyber Date: Fri, 19 Apr 2024 15:09:26 +0530 Subject: [PATCH 1/4] Add optimised LLVM IR for atomic increments/decrements on floats --- clang/lib/CodeGen/CGExprScalar.cpp| 13 + clang/test/CodeGen/X86/x86-atomic-float.c | 97 +++ .../test/CodeGen/X86/x86-atomic-long_double.c | 609 +- 3 files changed, 410 insertions(+), 309 deletions(-) create mode 100644 clang/test/CodeGen/X86/x86-atomic-float.c diff --git a/clang/lib/CodeGen/CGExprScalar.cpp b/clang/lib/CodeGen/CGExprScalar.cpp index 1f18e0d5ba409a..e97bb5c7e9dd16 100644 --- a/clang/lib/CodeGen/CGExprScalar.cpp +++ b/clang/lib/CodeGen/CGExprScalar.cpp @@ -2792,6 +2792,19 @@ ScalarExprEmitter::EmitScalarPrePostIncDec(const UnaryOperator *E, LValue LV, llvm::AtomicOrdering::SequentiallyConsistent); return isPre ? Builder.CreateBinOp(op, old, amt) : old; } +// Special case for atomic increment/decrement on floats +if (type->isFloatingType()) { + llvm::AtomicRMWInst::BinOp aop = + isInc ? llvm::AtomicRMWInst::FAdd : llvm::AtomicRMWInst::FSub; + llvm::Instruction::BinaryOps op = + isInc ? llvm::Instruction::FAdd : llvm::Instruction::FSub; + llvm::Value *amt = llvm::ConstantFP::get( + VMContext, llvm::APFloat(static_cast(amount))); + llvm::Value *old = + Builder.CreateAtomicRMW(aop, LV.getAddress(CGF), amt, + llvm::AtomicOrdering::SequentiallyConsistent); + return isPre ? Builder.CreateBinOp(op, old, amt) : old; +} value = EmitLoadOfLValue(LV, E->getExprLoc()); input = value; // For every other atomic operation, we need to emit a load-op-cmpxchg loop diff --git a/clang/test/CodeGen/X86/x86-atomic-float.c b/clang/test/CodeGen/X86/x86-atomic-float.c new file mode 100644 index 00..89a2605ed44461 --- /dev/null +++ b/clang/test/CodeGen/X86/x86-atomic-float.c @@ -0,0 +1,97 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 4 +// RUN: %clang_cc1 -triple x86_64-linux-gnu -target-cpu core2 %s -S -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 -triple i686-linux-gnu -target-cpu core2 %s -S -emit-llvm -o - | FileCheck -check-prefix=CHECK32 %s + +// CHECK-LABEL: define dso_local i32 @test_int_inc( +// CHECK-SAME: ) #[[ATTR0:[0-9]+]] { +// CHECK-NEXT: entry: +// CHECK-NEXT:[[TMP0:%.*]] = atomicrmw add ptr @test_int_inc.n, i32 1 seq_cst, align 4 +// CHECK-NEXT:ret i32 [[TMP0]] +// +// CHECK32-LABEL: define dso_local i32 @test_int_inc( +// CHECK32-SAME: ) #[[ATTR0:[0-9]+]] { +// CHECK32-NEXT: entry: +// CHECK32-NEXT:[[TMP0:%.*]] = atomicrmw add ptr @test_int_inc.n, i32 1 seq_cst, align 4 +// CHECK32-NEXT:ret i32 [[TMP0]] +// +int test_int_inc() +{ +static _Atomic int n; +return n++; +} + +// CHECK-LABEL: define dso_local float @test_float_post_inc( +// CHECK-SAME: ) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT:[[TMP0:%.*]] = atomicrmw fadd ptr @test_float_post_inc.n, float 1.00e+00 seq_cst, align 4 +// CHECK-NEXT:ret float [[TMP0]] +// +// CHECK32-LABEL: define dso_local float @test_float_post_inc( +// CHECK32-SAME: ) #[[ATTR0]] { +// CHECK32-NEXT: entry: +// CHECK32-NEXT:[[TMP0:%.*]] = atomicrmw fadd ptr @test_float_post_inc.n, float 1.00e+00 seq_cst, align 4 +// CHECK32-NEXT:ret float [[TMP0]] +// +float test_float_post_inc() +{ +static _Atomic float n; +return n++; +} + +// CHECK-LABEL: define dso_local float @test_float_post_dc( +// CHECK-SAME: ) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT:[[TMP0:%.*]] = atomicrmw fsub ptr @test_float_post_dc.n, float -1.00e+00 seq_cst, align 4 +// CHECK-NEXT:ret float [[TMP0]] +// +// CHECK32-LABEL: define dso_local float @test_float_post_dc( +// CHECK32-SAME: ) #[[ATTR0]] { +// CHECK32-NEXT: entry: +// CHECK32-NEXT:[[TMP0:%.*]] = atomicrmw fsub ptr @test_float_post_dc.n, float -1.00e+00 seq_cst, align 4 +// CHECK32-NEXT:ret float [[TMP0]] +// +float test_float_post_dc() +{ +static _Atomic float n; +return n--; +} + +// CHECK-LABEL: define dso_local float @test_float_pre_dc( +// CHECK-SAME: ) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT:[[TMP0:%.*]] = atomicrmw fsub ptr @test_float_pre_dc.n, float -1.00e+00 seq_cst, align 4 +// CHECK-NEXT:[[TMP1:%.*]] = fsub float [[TMP0]], -1.00e+00 +// CHECK-NEXT:ret float [[TMP1]] +// +// CHECK32-LABEL: define dso_local float @test_float_pre_dc( +// CHECK32-SAME: ) #[[ATTR0]] { +// CHECK32-NEXT: entry: +// CHECK32-NEXT:[[TMP0:%.*]] = atomicrmw fsub ptr @test_float_pre_dc.n, float -1.00e+00 seq_cst, align 4 +// CHECK32-NEXT:[[TMP1:%.*]] = fsub float [[TMP0]], -1.00e+00 +// CHECK32-NEXT:
[clang] [Clang][Sema] fix a bug on constraint check with template friend function (PR #90646)
jcsxky wrote: > ```c++ > template > concept D = sizeof(T) == sizeof(U); > > template > struct A > { > template requires D > static void f(); > }; > > template > struct B > { > template > struct C > { > friend void A::f(); > }; > }; > > template struct B::C; > > extern template void A::f(); // crash here > ``` > > @jcsxky causes crash with and without this patch applied. Thanks for your feedback! This may be another issue. clang trunk crashes with this case. https://github.com/llvm/llvm-project/pull/90646 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [flang] [flang][draft] Improve debug info generation. (PR #84202)
https://github.com/abidh closed https://github.com/llvm/llvm-project/pull/84202 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] fix(85447): clang 18.1.0 crashes in clang::ASTContext::getTypeInfoImpl (PR #89850)
@@ -630,6 +630,7 @@ Bug Fixes to C++ Support - Fix a bug on template partial specialization with issue on deduction of nontype template parameter whose type is `decltype(auto)`. Fixes (#GH68885). - Clang now correctly treats the noexcept-specifier of a friend function to be a complete-class context. +- Fix crash caused by missing invocation of ``setInvalidDecl()`` for invalid ``Anon`` declarations. (#GH85447) cor3ntin wrote: Maybe "Fix an assertion failure when parsing an invalid members of an anonymous class" (the changelog is user facing) https://github.com/llvm/llvm-project/pull/89850 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] fix(85447): clang 18.1.0 crashes in clang::ASTContext::getTypeInfoImpl (PR #89850)
https://github.com/a-tarasyuk updated https://github.com/llvm/llvm-project/pull/89850 >From f4e4e7b91e85d12c861063e1461b160b9bd22da6 Mon Sep 17 00:00:00 2001 From: Oleksandr T Date: Mon, 29 Apr 2024 01:53:47 +0300 Subject: [PATCH 1/2] fix(85447): refine handling of incomplete anonymous struct declarations --- clang/lib/Sema/SemaDecl.cpp| 3 +++ clang/test/Sema/incomplete-struct-decl.cpp | 10 ++ 2 files changed, 13 insertions(+) create mode 100644 clang/test/Sema/incomplete-struct-decl.cpp diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 671752b56e01f4..d3871bb7447405 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -5789,6 +5789,9 @@ Decl *Sema::BuildAnonymousStructOrUnion(Scope *S, DeclSpec &DS, Anon = VarDecl::Create(Context, Owner, DS.getBeginLoc(), Record->getLocation(), /*IdentifierInfo=*/nullptr, Context.getTypeDeclType(Record), TInfo, SC); +if (Invalid) + Anon->setInvalidDecl(); + ProcessDeclAttributes(S, Anon, Dc); // Default-initialize the implicit variable. This initialization will be diff --git a/clang/test/Sema/incomplete-struct-decl.cpp b/clang/test/Sema/incomplete-struct-decl.cpp new file mode 100644 index 00..bc3bd6b2eae2f0 --- /dev/null +++ b/clang/test/Sema/incomplete-struct-decl.cpp @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -x c++ -fsyntax-only -verify=cxx,expected %s + +template using __impl_of = a; // expected-note {{'__impl_of' declared here}} \ + expected-note {{template is declared here}} +struct {// expected-error {{anonymous structs and classes must be class members}} \ + expected-note {{to match this '{'}} + __impl_; // expected-error {{no template named '__impl_'; did you mean '__impl_of'?}} \ + expected-error {{cannot specify deduction guide for alias template '__impl_of'}} \ + expected-error {{expected ';' after struct}} +// expected-error {{expected '}'}} >From fedc5eab0765ae999d849a49eba88a995f558405 Mon Sep 17 00:00:00 2001 From: Oleksandr T Date: Wed, 1 May 2024 16:35:17 +0300 Subject: [PATCH 2/2] update changelog --- clang/docs/ReleaseNotes.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 2c5308fbcb319a..a146dedb125a34 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -630,6 +630,7 @@ Bug Fixes to C++ Support - Fix a bug on template partial specialization with issue on deduction of nontype template parameter whose type is `decltype(auto)`. Fixes (#GH68885). - Clang now correctly treats the noexcept-specifier of a friend function to be a complete-class context. +- Fix an assertion failure when parsing an invalid members of an anonymous class. (#GH85447) Bug Fixes to AST Handling ^ ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] fix(85447): clang 18.1.0 crashes in clang::ASTContext::getTypeInfoImpl (PR #89850)
@@ -630,6 +630,7 @@ Bug Fixes to C++ Support - Fix a bug on template partial specialization with issue on deduction of nontype template parameter whose type is `decltype(auto)`. Fixes (#GH68885). - Clang now correctly treats the noexcept-specifier of a friend function to be a complete-class context. +- Fix crash caused by missing invocation of ``setInvalidDecl()`` for invalid ``Anon`` declarations. (#GH85447) a-tarasyuk wrote: Oke https://github.com/llvm/llvm-project/pull/89850 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] Fix Twine usage (PR #90728)
https://github.com/MagentaTreehouse updated https://github.com/llvm/llvm-project/pull/90728 >From 8932159c7b8a44a984295ad3069af02ead1dd083 Mon Sep 17 00:00:00 2001 From: Mingyi Chen Date: Wed, 1 May 2024 09:39:56 -0400 Subject: [PATCH] [NFC] Construct Twines before concatenation --- clang/lib/Driver/ToolChains/HIPUtility.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clang/lib/Driver/ToolChains/HIPUtility.cpp b/clang/lib/Driver/ToolChains/HIPUtility.cpp index 08c647dfcb6f72..0a1783835bb1b0 100644 --- a/clang/lib/Driver/ToolChains/HIPUtility.cpp +++ b/clang/lib/Driver/ToolChains/HIPUtility.cpp @@ -106,9 +106,9 @@ class HIPUndefinedFatBinSymbols { std::string ID = IA->getId().str(); if (!ID.empty()) { ID = llvm::utohexstr(llvm::MD5Hash(ID), /*LowerCase=*/true); - FatBinSymbols.insert(Twine(FatBinPrefix + "_" + ID).str()); + FatBinSymbols.insert((FatBinPrefix + Twine('_') + ID).str()); GPUBinHandleSymbols.insert( - Twine(GPUBinHandlePrefix + "_" + ID).str()); + (GPUBinHandlePrefix + Twine('_') + ID).str()); continue; } if (IA->getInputArg().getNumValues() == 0) ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC] Construct Twines before concatenation (PR #90728)
https://github.com/MagentaTreehouse edited https://github.com/llvm/llvm-project/pull/90728 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] fix(85447): clang 18.1.0 crashes in clang::ASTContext::getTypeInfoImpl (PR #89850)
https://github.com/a-tarasyuk deleted https://github.com/llvm/llvm-project/pull/89850 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] fix(85447): clang 18.1.0 crashes in clang::ASTContext::getTypeInfoImpl (PR #89850)
@@ -630,6 +630,7 @@ Bug Fixes to C++ Support - Fix a bug on template partial specialization with issue on deduction of nontype template parameter whose type is `decltype(auto)`. Fixes (#GH68885). - Clang now correctly treats the noexcept-specifier of a friend function to be a complete-class context. +- Fix crash caused by missing invocation of ``setInvalidDecl()`` for invalid ``Anon`` declarations. (#GH85447) a-tarasyuk wrote: Oke, thanks https://github.com/llvm/llvm-project/pull/89850 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang][CodeGen] Optimised LLVM IR for atomic increments/decrements on floats (PR #89362)
https://github.com/RKSimon approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/89362 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [Driver] Restore compiler-rt arch suffix for PS and Windows (PR #89775)
https://github.com/pogo59 updated https://github.com/llvm/llvm-project/pull/89775 >From c8b04739159fcd4775656aabb4b964272add8c36 Mon Sep 17 00:00:00 2001 From: Paul Robinson Date: Tue, 23 Apr 2024 08:10:47 -0700 Subject: [PATCH 1/2] [Driver] Restore arch suffix for PS and Windows Commit b876596 corrected default compiler-rt library names for many targets, this patch restores the arch suffix for PlayStation and Windows which both distribute these libraries with the arch suffix. --- clang/lib/Driver/ToolChain.cpp | 4 +++- clang/test/Driver/cl-link.c| 16 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp index 237092ed07e5dc..d104570491203b 100644 --- a/clang/lib/Driver/ToolChain.cpp +++ b/clang/lib/Driver/ToolChain.cpp @@ -684,7 +684,9 @@ std::string ToolChain::getCompilerRT(const ArgList &Args, StringRef Component, if (Path.empty()) Path = P; } - if (getTriple().isOSAIX()) + // Some targets default to the old layout. + if (getTriple().isOSAIX() || getTriple().isPS() || + getTriple().isWindowsMSVCEnvironment()) Path.clear(); // Check the filename for the old layout if the new one does not exist. diff --git a/clang/test/Driver/cl-link.c b/clang/test/Driver/cl-link.c index ffd0b5ac4bade8..444f0c01b3f999 100644 --- a/clang/test/Driver/cl-link.c +++ b/clang/test/Driver/cl-link.c @@ -13,20 +13,20 @@ // ASAN: link.exe // ASAN: "-debug" // ASAN: "-incremental:no" -// ASAN: "{{[^"]*}}clang_rt.asan.lib" -// ASAN: "-wholearchive:{{.*}}clang_rt.asan.lib" -// ASAN: "{{[^"]*}}clang_rt.asan_cxx.lib" -// ASAN: "-wholearchive:{{.*}}clang_rt.asan_cxx.lib" +// ASAN: "{{[^"]*}}clang_rt.asan-i386.lib" +// ASAN: "-wholearchive:{{.*}}clang_rt.asan-i386.lib" +// ASAN: "{{[^"]*}}clang_rt.asan_cxx-i386.lib" +// ASAN: "-wholearchive:{{.*}}clang_rt.asan_cxx-i386.lib" // ASAN: "{{.*}}cl-link{{.*}}.obj" // RUN: %clang_cl -m32 -arch:IA32 --target=i386-pc-win32 /MD /Tc%s -fuse-ld=link -### -fsanitize=address 2>&1 | FileCheck --check-prefix=ASAN-MD %s // ASAN-MD: link.exe // ASAN-MD: "-debug" // ASAN-MD: "-incremental:no" -// ASAN-MD: "{{.*}}clang_rt.asan_dynamic.lib" -// ASAN-MD: "{{[^"]*}}clang_rt.asan_dynamic_runtime_thunk.lib" +// ASAN-MD: "{{.*}}clang_rt.asan_dynamic-i386.lib" +// ASAN-MD: "{{[^"]*}}clang_rt.asan_dynamic_runtime_thunk-i386.lib" // ASAN-MD: "-include:___asan_seh_interceptor" -// ASAN-MD: "-wholearchive:{{.*}}clang_rt.asan_dynamic_runtime_thunk.lib" +// ASAN-MD: "-wholearchive:{{.*}}clang_rt.asan_dynamic_runtime_thunk-i386.lib" // ASAN-MD: "{{.*}}cl-link{{.*}}.obj" // RUN: %clang_cl /LD -fuse-ld=link -### /Tc%s 2>&1 | FileCheck --check-prefix=DLL %s @@ -40,7 +40,7 @@ // ASAN-DLL: "-dll" // ASAN-DLL: "-debug" // ASAN-DLL: "-incremental:no" -// ASAN-DLL: "{{.*}}clang_rt.asan_dll_thunk.lib" +// ASAN-DLL: "{{.*}}clang_rt.asan_dll_thunk-i386.lib" // ASAN-DLL: "{{.*}}cl-link{{.*}}.obj" // RUN: %clang_cl /Zi /Tc%s -fuse-ld=link -### 2>&1 | FileCheck --check-prefix=DEBUG %s >From 26ff8b1d3371bc9df13769c77be4214e646eeb50 Mon Sep 17 00:00:00 2001 From: Paul Robinson Date: Wed, 1 May 2024 06:47:22 -0700 Subject: [PATCH 2/2] Base the decision on the CMake variable instead --- clang/lib/Driver/ToolChain.cpp| 3 +- clang/test/Driver/arm-compiler-rt.c | 39 ++-- clang/test/Driver/cl-link.c | 27 +-- clang/test/Driver/compiler-rt-unwind.c| 35 ++-- clang/test/Driver/coverage-ld.c | 3 +- clang/test/Driver/fuchsia.c | 1 + clang/test/Driver/instrprof-ld.c | 1 + clang/test/Driver/lit.local.cfg | 4 + clang/test/Driver/mingw-sanitizers.c | 24 ++- clang/test/Driver/msp430-toolchain.c | 1 + .../Driver/print-libgcc-file-name-clangrt.c | 38 ++-- clang/test/Driver/sanitizer-ld.c | 188 ++ clang/test/Driver/wasm-toolchain.c| 38 ++-- clang/test/Driver/wasm-toolchain.cpp | 34 ++-- clang/test/Driver/windows-cross.c | 40 ++-- clang/test/Driver/zos-ld.c| 1 + clang/test/lit.site.cfg.py.in | 1 + llvm/include/llvm/Config/llvm-config.h.cmake | 3 + 18 files changed, 270 insertions(+), 211 deletions(-) diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp index d104570491203b..b266cee0a54457 100644 --- a/clang/lib/Driver/ToolChain.cpp +++ b/clang/lib/Driver/ToolChain.cpp @@ -685,8 +685,7 @@ std::string ToolChain::getCompilerRT(const ArgList &Args, StringRef Component, Path = P; } // Some targets default to the old layout. - if (getTriple().isOSAIX() || getTriple().isPS() || - getTriple().isWindowsMSVCEnvironment()) + if (getTriple().isOSAIX() || !LLVM_ENABLE_PER_TARGET_RUNTIME_DIR) Path.clear(); // Check the filename for the old layout if the new one does not exist. diff --
[clang] [llvm] [Driver] Restore compiler-rt arch suffix for PS and Windows (PR #89775)
pogo59 wrote: I've redone the decision to be based on the setting of LLVM_ENABLE_PER_TARGET_RUNTIME_DIR and updated the tests to work with either setting as much as possible. Tests that explicitly look for the per-target _directory_ are enabled only if the CMake variable is ON. https://github.com/llvm/llvm-project/pull/89775 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] fix(85447): clang 18.1.0 crashes in clang::ASTContext::getTypeInfoImpl (PR #89850)
https://github.com/cor3ntin approved this pull request. LGTM. Congratulations on your first contribution! Will you need me to merge that PR for you? https://github.com/llvm/llvm-project/pull/89850 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] Adjust MSVC version range for ARM64 build performance regression (PR #90731)
https://github.com/lxbndr created https://github.com/llvm/llvm-project/pull/90731 This is follow up for #65215 Mentioned regression was fixed in MSVC 19.39 (VS 17.9.0), so it makes sense to not apply fix for that (and newer) compiler versions. Same as original change, this patch is narrowly scoped to not affect any other compiler. >From ff8c63595aca6aca603deb109c3684e7df59e61b Mon Sep 17 00:00:00 2001 From: Alexander Smarus Date: Wed, 1 May 2024 16:43:04 +0300 Subject: [PATCH] Adjust MSVC version range for ARM64 build performance regression --- clang/lib/CodeGen/CMakeLists.txt | 1 + clang/lib/Tooling/Inclusions/Stdlib/CMakeLists.txt | 1 + 2 files changed, 2 insertions(+) diff --git a/clang/lib/CodeGen/CMakeLists.txt b/clang/lib/CodeGen/CMakeLists.txt index 52216d93a302bb..760fc540f7fa8e 100644 --- a/clang/lib/CodeGen/CMakeLists.txt +++ b/clang/lib/CodeGen/CMakeLists.txt @@ -39,6 +39,7 @@ set(LLVM_LINK_COMPONENTS # our goal is to disable the /Og flag while retaining the other optimizations from the /O1|/O2 set if(MSVC AND NOT CMAKE_CXX_COMPILER_ID MATCHES Clang AND MSVC_VERSION VERSION_GREATER_EQUAL 1932 +AND MSVC_VERSION VERSION_LESS 1939 AND CMAKE_SYSTEM_PROCESSOR MATCHES "ARM64") string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE) diff --git a/clang/lib/Tooling/Inclusions/Stdlib/CMakeLists.txt b/clang/lib/Tooling/Inclusions/Stdlib/CMakeLists.txt index ed323ab3528b10..4d01a0850a074b 100644 --- a/clang/lib/Tooling/Inclusions/Stdlib/CMakeLists.txt +++ b/clang/lib/Tooling/Inclusions/Stdlib/CMakeLists.txt @@ -4,6 +4,7 @@ # our goal is to disable the /Og flag while retaining the other optimizations from the /O1|/O2 set if(MSVC AND NOT CMAKE_CXX_COMPILER_ID MATCHES Clang AND MSVC_VERSION VERSION_GREATER_EQUAL 1932 +AND MSVC_VERSION VERSION_LESS 1939 AND CMAKE_SYSTEM_PROCESSOR MATCHES "ARM64") string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE) ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] Adjust MSVC version range for ARM64 build performance regression (PR #90731)
llvmbot wrote: @llvm/pr-subscribers-clang-codegen Author: Alexander Smarus (lxbndr) Changes This is follow up for #65215 Mentioned regression was fixed in MSVC 19.39 (VS 17.9.0), so it makes sense to not apply fix for that (and newer) compiler versions. Same as original change, this patch is narrowly scoped to not affect any other compiler. --- Full diff: https://github.com/llvm/llvm-project/pull/90731.diff 2 Files Affected: - (modified) clang/lib/CodeGen/CMakeLists.txt (+1) - (modified) clang/lib/Tooling/Inclusions/Stdlib/CMakeLists.txt (+1) ``diff diff --git a/clang/lib/CodeGen/CMakeLists.txt b/clang/lib/CodeGen/CMakeLists.txt index 52216d93a302bb..760fc540f7fa8e 100644 --- a/clang/lib/CodeGen/CMakeLists.txt +++ b/clang/lib/CodeGen/CMakeLists.txt @@ -39,6 +39,7 @@ set(LLVM_LINK_COMPONENTS # our goal is to disable the /Og flag while retaining the other optimizations from the /O1|/O2 set if(MSVC AND NOT CMAKE_CXX_COMPILER_ID MATCHES Clang AND MSVC_VERSION VERSION_GREATER_EQUAL 1932 +AND MSVC_VERSION VERSION_LESS 1939 AND CMAKE_SYSTEM_PROCESSOR MATCHES "ARM64") string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE) diff --git a/clang/lib/Tooling/Inclusions/Stdlib/CMakeLists.txt b/clang/lib/Tooling/Inclusions/Stdlib/CMakeLists.txt index ed323ab3528b10..4d01a0850a074b 100644 --- a/clang/lib/Tooling/Inclusions/Stdlib/CMakeLists.txt +++ b/clang/lib/Tooling/Inclusions/Stdlib/CMakeLists.txt @@ -4,6 +4,7 @@ # our goal is to disable the /Og flag while retaining the other optimizations from the /O1|/O2 set if(MSVC AND NOT CMAKE_CXX_COMPILER_ID MATCHES Clang AND MSVC_VERSION VERSION_GREATER_EQUAL 1932 +AND MSVC_VERSION VERSION_LESS 1939 AND CMAKE_SYSTEM_PROCESSOR MATCHES "ARM64") string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE) `` https://github.com/llvm/llvm-project/pull/90731 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] bad error message on incorrect string literal #18079 (PR #81670)
ldrumm wrote: Should we be looking for `\r` as well? If the testcase is checked out with DOS line endings (e.g. on a windows machine), then the test clang/test/Lexer/raw-string-dlim-invalid.cpp fails I don't know what the C++ spec says, but I think this diagnostic should work for both common end of line styles. Something like this: ```diff diff --git a/clang/lib/Lex/Lexer.cpp b/clang/lib/Lex/Lexer.cpp index c98645993abe..80495e0677a0 100644 --- a/clang/lib/Lex/Lexer.cpp +++ b/clang/lib/Lex/Lexer.cpp @@ -2258,7 +2258,7 @@ bool Lexer::LexRawStringLiteral(Token &Result, const char *CurPtr, if (!isLexingRawMode()) Diag(BufferPtr, diag::warn_cxx98_compat_raw_string_literal); - +i unsigned PrefixLen = 0; while (PrefixLen != 16 && isRawStringDelimBody(CurPtr[PrefixLen])) @@ -2270,7 +2270,7 @@ bool Lexer::LexRawStringLiteral(Token &Result, const char *CurPtr, const char *PrefixEnd = &CurPtr[PrefixLen]; if (PrefixLen == 16) { Diag(PrefixEnd, diag::err_raw_delim_too_long); - } else if (*PrefixEnd == '\n') { + } else if ((*PrefixEnd == '\r' && PrefixEnd[1] == '\n') || *PrefixEnd == '\n') { Diag(PrefixEnd, diag::err_invalid_newline_raw_delim); } else { Diag(PrefixEnd, diag::err_invalid_char_raw_delim) ``` ? https://github.com/llvm/llvm-project/pull/81670 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC] Construct Twines before concatenation (PR #90728)
https://github.com/MagentaTreehouse ready_for_review https://github.com/llvm/llvm-project/pull/90728 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] Triple::normalize: Use none as OS for XX-none-ABI (PR #89638)
https://github.com/peterwaller-arm approved this pull request. LGTM, thanks for supplying a quick fix and iterating this, and thanks for waiting for input on the RFC. https://github.com/llvm/llvm-project/pull/89638 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] fix(85447): clang 18.1.0 crashes in clang::ASTContext::getTypeInfoImpl (PR #89850)
a-tarasyuk wrote: If no additional feedback is needed, it would be great if you could proceed with the merge. thanks https://github.com/llvm/llvm-project/pull/89850 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] Triple::normalize: Use none as OS for XX-none-ABI (PR #89638)
DavidSpickett wrote: libcxx is sorted, and I will write up the release note given that I suggested it and have been fixing some builds myself. https://github.com/llvm/llvm-project/pull/89638 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang] Ensure "=default"ed function can be deleted when used as an extension in C++03 (PR #90725)
philnik777 wrote: Note that this is also a problem with an implicit assignment operator: https://godbolt.org/z/jrh5novMo. I'm not 100% sure it's not a bug, but it definitely looks to me like one. It's definitely a mismatch between C++03 and C++11, which I wouldn't expect given that `= delete` a C++11 extension. https://github.com/llvm/llvm-project/pull/90725 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] fix(85447): clang 18.1.0 crashes in clang::ASTContext::getTypeInfoImpl (PR #89850)
a-tarasyuk wrote: @cor3ntin If no additional feedback is needed, it would be great if you could proceed with the merge. thanks https://github.com/llvm/llvm-project/pull/89850 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [CUDA] make kernel stub ICF-proof (PR #90155)
https://github.com/yxsamliu closed https://github.com/llvm/llvm-project/pull/90155 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] be5075a - [CUDA] make kernel stub ICF-proof (#90155)
Author: Yaxun (Sam) Liu Date: 2024-05-01T10:24:23-04:00 New Revision: be5075ab8daf58a0e981e6bda9579a86fba9a748 URL: https://github.com/llvm/llvm-project/commit/be5075ab8daf58a0e981e6bda9579a86fba9a748 DIFF: https://github.com/llvm/llvm-project/commit/be5075ab8daf58a0e981e6bda9579a86fba9a748.diff LOG: [CUDA] make kernel stub ICF-proof (#90155) MSVC linker merges functions having comdat which have identical set of instructions. CUDA uses kernel stub function as key to look up kernels in device executables. If kernel stub function for different kernels are merged by ICF, incorrect kernels will be launched. To prevent ICF from merging kernel stub functions, an unique global variable is created for each kernel stub function having comdat and a store is added to the kernel stub function. This makes the set of instructions in each kernel function unique. Fixes: https://github.com/llvm/llvm-project/issues/3 Added: Modified: clang/lib/CodeGen/CGCUDANV.cpp clang/test/CodeGenCUDA/kernel-stub-name.cu Removed: diff --git a/clang/lib/CodeGen/CGCUDANV.cpp b/clang/lib/CodeGen/CGCUDANV.cpp index 370642cb3d5364..670bc4bf72cecb 100644 --- a/clang/lib/CodeGen/CGCUDANV.cpp +++ b/clang/lib/CodeGen/CGCUDANV.cpp @@ -424,6 +424,33 @@ void CGNVCUDARuntime::emitDeviceStubBodyNew(CodeGenFunction &CGF, CGM.CreateRuntimeFunction(FTy, LaunchKernelName); CGF.EmitCall(FI, CGCallee::forDirect(cudaLaunchKernelFn), ReturnValueSlot(), LaunchKernelArgs); + + // To prevent CUDA device stub functions from being merged by ICF in MSVC + // environment, create an unique global variable for each kernel and write to + // the variable in the device stub. + if (CGM.getContext().getTargetInfo().getCXXABI().isMicrosoft() && + !CGF.getLangOpts().HIP) { +llvm::Function *KernelFunction = llvm::cast(Kernel); +std::string GlobalVarName = (KernelFunction->getName() + ".id").str(); + +llvm::GlobalVariable *HandleVar = +CGM.getModule().getNamedGlobal(GlobalVarName); +if (!HandleVar) { + HandleVar = new llvm::GlobalVariable( + CGM.getModule(), CGM.Int8Ty, + /*Constant=*/false, KernelFunction->getLinkage(), + llvm::ConstantInt::get(CGM.Int8Ty, 0), GlobalVarName); + HandleVar->setDSOLocal(KernelFunction->isDSOLocal()); + HandleVar->setVisibility(KernelFunction->getVisibility()); + if (KernelFunction->hasComdat()) +HandleVar->setComdat(CGM.getModule().getOrInsertComdat(GlobalVarName)); +} + +CGF.Builder.CreateAlignedStore(llvm::ConstantInt::get(CGM.Int8Ty, 1), + HandleVar, CharUnits::One(), + /*IsVolatile=*/true); + } + CGF.EmitBranch(EndBlock); CGF.EmitBlock(EndBlock); diff --git a/clang/test/CodeGenCUDA/kernel-stub-name.cu b/clang/test/CodeGenCUDA/kernel-stub-name.cu index 23df7f5d721b56..0faea75cbbe536 100644 --- a/clang/test/CodeGenCUDA/kernel-stub-name.cu +++ b/clang/test/CodeGenCUDA/kernel-stub-name.cu @@ -2,7 +2,7 @@ // RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm %s \ // RUN: -fcuda-include-gpubinary %t -o - -x hip\ -// RUN: | FileCheck -check-prefixes=CHECK,GNU %s +// RUN: | FileCheck -check-prefixes=CHECK,GNU,GNU-HIP,HIP %s // RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm %s \ // RUN: -fcuda-include-gpubinary %t -o - -x hip\ @@ -11,7 +11,12 @@ // RUN: %clang_cc1 -triple x86_64-pc-windows-msvc -emit-llvm %s \ // RUN: -aux-triple amdgcn-amd-amdhsa -fcuda-include-gpubinary \ // RUN: %t -o - -x hip\ -// RUN: | FileCheck -check-prefixes=CHECK,MSVC %s +// RUN: | FileCheck -check-prefixes=CHECK,MSVC,MSVC-HIP,HIP %s + +// RUN: %clang_cc1 -triple x86_64-pc-windows-msvc -emit-llvm %s \ +// RUN: -aux-triple nvptx64 -fcuda-include-gpubinary \ +// RUN: %t -target-sdk-version=9.2 -o - \ +// RUN: | FileCheck -check-prefixes=CHECK,MSVC,CUDA %s // RUN: %clang_cc1 -triple x86_64-pc-windows-msvc -emit-llvm %s \ // RUN: -aux-triple amdgcn-amd-amdhsa -fcuda-include-gpubinary \ @@ -22,19 +27,23 @@ // Check kernel handles are emitted for non-MSVC target but not for MSVC target. -// GNU: @[[HCKERN:ckernel]] = constant ptr @[[CSTUB:__device_stub__ckernel]], align 8 -// GNU: @[[HNSKERN:_ZN2ns8nskernelEv]] = constant ptr @[[NSSTUB:_ZN2ns23__device_stub__nskernelEv]], align 8 -// GNU: @[[HTKERN:_Z10kernelfuncIiEvv]] = linkonce_odr constant ptr @[[TSTUB:_Z25__device_stub__kernelfuncIiEvv]], comdat, align 8 -// GNU: @[[HDKERN:_Z11kernel_declv]] = external constant ptr, align 8 -// GNU: @[[HTDKERN:_Z20template_kernel_declIiEvT_]] = external constant ptr, align 8 - -// MSVC: @[[HCKERN:ckernel]] = dso_local constant ptr @[[CSTUB:__device_stub__ckernel]], align 8 -// MSVC: @[[HNSKERN:"\?nskernel@ns@@YAXXZ.*"]] = dso_local constant ptr @[[NSSTUB:"\?__device_stub__nskernel@ns@@YAXXZ"]], align 8 -//
[clang] [alpha.webkit.UncountedLocalVarsChecker] Don't warning on inlined functions (PR #90733)
https://github.com/mikhailramalho created https://github.com/llvm/llvm-project/pull/90733 As per the guidelines, trivial inline functions shouldn't be changed to adopt smart pointers. >From a8c7e012a576fd01d6a6bdcb23a43e6669b005e8 Mon Sep 17 00:00:00 2001 From: "Mikhail R. Gadelha" Date: Wed, 1 May 2024 11:23:11 -0300 Subject: [PATCH] [alpha.webkit.UncountedLocalVarsChecker] Don't warning on inlined functions As per the guidelines, trivial inline functions shouldn't be changed to adopt smart pointers --- .../Checkers/WebKit/UncountedLocalVarsChecker.cpp| 5 + 1 file changed, 5 insertions(+) diff --git a/clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedLocalVarsChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedLocalVarsChecker.cpp index 6036ad58cf253c..f64e29089f0b78 100644 --- a/clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedLocalVarsChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedLocalVarsChecker.cpp @@ -178,6 +178,11 @@ class UncountedLocalVarsChecker if (shouldSkipVarDecl(V)) return; +if (auto *FD = dyn_cast(V->getDeclContext())) { + if (FD->isInlined()) +return; +} + const auto *ArgType = V->getType().getTypePtr(); if (!ArgType) return; ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [alpha.webkit.UncountedLocalVarsChecker] Don't warning on inlined functions (PR #90733)
llvmbot wrote: @llvm/pr-subscribers-clang Author: Mikhail R. Gadelha (mikhailramalho) Changes As per the guidelines, trivial inline functions shouldn't be changed to adopt smart pointers. --- Full diff: https://github.com/llvm/llvm-project/pull/90733.diff 1 Files Affected: - (modified) clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedLocalVarsChecker.cpp (+5) ``diff diff --git a/clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedLocalVarsChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedLocalVarsChecker.cpp index 6036ad58cf253c..f64e29089f0b78 100644 --- a/clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedLocalVarsChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedLocalVarsChecker.cpp @@ -178,6 +178,11 @@ class UncountedLocalVarsChecker if (shouldSkipVarDecl(V)) return; +if (auto *FD = dyn_cast(V->getDeclContext())) { + if (FD->isInlined()) +return; +} + const auto *ArgType = V->getType().getTypePtr(); if (!ArgType) return; `` https://github.com/llvm/llvm-project/pull/90733 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [OpenMP][TR12] change property of map-type modifier. (PR #90499)
https://github.com/jyu2-git closed https://github.com/llvm/llvm-project/pull/90499 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] f050660 - [OpenMP][TR12] change property of map-type modifier. (#90499)
Author: jyu2-git Date: 2024-05-01T07:34:10-07:00 New Revision: f050660f4a60415cd840f7fba7ac3698c38376d0 URL: https://github.com/llvm/llvm-project/commit/f050660f4a60415cd840f7fba7ac3698c38376d0 DIFF: https://github.com/llvm/llvm-project/commit/f050660f4a60415cd840f7fba7ac3698c38376d0.diff LOG: [OpenMP][TR12] change property of map-type modifier. (#90499) map-type change to "default" instead "ultimate" from [OpenMP5.2] The change is allowed map-type to be placed any locations within map modifiers, besides the last location in the modifiers-list, also map-type can be omitted afterward. Added: Modified: clang/include/clang/Basic/DiagnosticParseKinds.td clang/lib/Parse/ParseOpenMP.cpp clang/test/OpenMP/target_ast_print.cpp clang/test/OpenMP/target_map_messages.cpp Removed: diff --git a/clang/include/clang/Basic/DiagnosticParseKinds.td b/clang/include/clang/Basic/DiagnosticParseKinds.td index fdffb35ea0d955..44bc4e0e130de8 100644 --- a/clang/include/clang/Basic/DiagnosticParseKinds.td +++ b/clang/include/clang/Basic/DiagnosticParseKinds.td @@ -1438,6 +1438,9 @@ def err_omp_decl_in_declare_simd_variant : Error< def err_omp_sink_and_source_iteration_not_allowd: Error<" '%0 %select{sink:|source:}1' must be with '%select{omp_cur_iteration - 1|omp_cur_iteration}1'">; def err_omp_unknown_map_type : Error< "incorrect map type, expected one of 'to', 'from', 'tofrom', 'alloc', 'release', or 'delete'">; +def err_omp_more_one_map_type : Error<"map type is already specified">; +def note_previous_map_type_specified_here +: Note<"map type '%0' is previous specified here">; def err_omp_unknown_map_type_modifier : Error< "incorrect map type modifier, expected one of: 'always', 'close', 'mapper'" "%select{|, 'present'|, 'present', 'iterator'}0%select{|, 'ompx_hold'}1">; @@ -1445,6 +1448,8 @@ def err_omp_map_type_missing : Error< "missing map type">; def err_omp_map_type_modifier_missing : Error< "missing map type modifier">; +def err_omp_map_modifier_specification_list : Error< + "empty modifier-specification-list is not allowed">; def err_omp_declare_simd_inbranch_notinbranch : Error< "unexpected '%0' clause, '%1' is specified already">; def err_omp_expected_clause_argument diff --git a/clang/lib/Parse/ParseOpenMP.cpp b/clang/lib/Parse/ParseOpenMP.cpp index 480201bc06f613..53d89ce2fa3e99 100644 --- a/clang/lib/Parse/ParseOpenMP.cpp +++ b/clang/lib/Parse/ParseOpenMP.cpp @@ -4228,13 +4228,20 @@ bool Parser::parseMapperModifier(SemaOpenMP::OpenMPVarListDataTy &Data) { return T.consumeClose(); } +static OpenMPMapClauseKind isMapType(Parser &P); + /// Parse map-type-modifiers in map clause. -/// map([ [map-type-modifier[,] [map-type-modifier[,] ...] map-type : ] list) +/// map([ [map-type-modifier[,] [map-type-modifier[,] ...] [map-type] : ] list) /// where, map-type-modifier ::= always | close | mapper(mapper-identifier) | /// present +/// where, map-type ::= alloc | delete | from | release | to | tofrom bool Parser::parseMapTypeModifiers(SemaOpenMP::OpenMPVarListDataTy &Data) { + bool HasMapType = false; + SourceLocation PreMapLoc = Tok.getLocation(); + StringRef PreMapName = ""; while (getCurToken().isNot(tok::colon)) { OpenMPMapModifierKind TypeModifier = isMapModifier(*this); +OpenMPMapClauseKind MapKind = isMapType(*this); if (TypeModifier == OMPC_MAP_MODIFIER_always || TypeModifier == OMPC_MAP_MODIFIER_close || TypeModifier == OMPC_MAP_MODIFIER_present || @@ -4257,6 +4264,19 @@ bool Parser::parseMapTypeModifiers(SemaOpenMP::OpenMPVarListDataTy &Data) { Diag(Data.MapTypeModifiersLoc.back(), diag::err_omp_missing_comma) << "map type modifier"; +} else if (getLangOpts().OpenMP >= 60 && MapKind != OMPC_MAP_unknown) { + if (!HasMapType) { +HasMapType = true; +Data.ExtraModifier = MapKind; +MapKind = OMPC_MAP_unknown; +PreMapLoc = Tok.getLocation(); +PreMapName = Tok.getIdentifierInfo()->getName(); + } else { +Diag(Tok, diag::err_omp_more_one_map_type); +Diag(PreMapLoc, diag::note_previous_map_type_specified_here) +<< PreMapName; + } + ConsumeToken(); } else { // For the case of unknown map-type-modifier or a map-type. // Map-type is followed by a colon; the function returns when it @@ -4267,8 +4287,14 @@ bool Parser::parseMapTypeModifiers(SemaOpenMP::OpenMPVarListDataTy &Data) { continue; } // Potential map-type token as it is followed by a colon. - if (PP.LookAhead(0).is(tok::colon)) -return false; + if (PP.LookAhead(0).is(tok::colon)) { +if (getLangOpts().OpenMP >= 60) { + break; +} else { + return false; +} + } + Diag(Tok, diag::err_omp_unknown_map_type_modifier) << (getLangOpts().Open
[clang] [alpha.webkit.UncountedLocalVarsChecker] Don't warning on inlined functions (PR #90733)
mikhailramalho wrote: @rniwa we noticed quite a drop in the warnings when using this patch, but we understand that there is another approach to handle inline functions: to add the `SUPPRESS_UNCOUNTED_LOCAL` to local variables inside these functions, like it was done here: https://github.com/WebKit/WebKit/pull/27870/files#diff-33ee084014f64a3d61fecb03211318d0d48dfa8f5b4ef6f4364fc2ab0364f9ebL137 Please let me know what you think of these approaches. If you prefer the macro one, I can close this PR and open another one. https://github.com/llvm/llvm-project/pull/90733 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [z/OS] treat text files as text files so auto-conversion is done (PR #90128)
perry-ca wrote: @owenca @mydeveloperday Thanks for testing on Windows and taking the time to review the PR. https://github.com/llvm/llvm-project/pull/90128 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] e22ce61 - [z/OS] treat text files as text files so auto-conversion is done (#90128)
Author: Sean Perry Date: 2024-05-01T10:39:41-04:00 New Revision: e22ce615fe31a78857a8574c12a32bddc6da465e URL: https://github.com/llvm/llvm-project/commit/e22ce615fe31a78857a8574c12a32bddc6da465e DIFF: https://github.com/llvm/llvm-project/commit/e22ce615fe31a78857a8574c12a32bddc6da465e.diff LOG: [z/OS] treat text files as text files so auto-conversion is done (#90128) To support auto-conversion on z/OS text files need to be opened as text files. These changes will fix a number of LIT failures due to text files not being converted to the internal code page. update a number of tools so they open the text files as text files add support in the cat.py to open a text file as a text file (Windows will continue to treat all files as binary so new lines are handled correctly) add env var definitions to enable auto-conversion in the lit config file. Added: Modified: clang/tools/clang-format/ClangFormat.cpp llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp llvm/tools/llvm-cxxmap/llvm-cxxmap.cpp llvm/tools/yaml2obj/yaml2obj.cpp llvm/utils/lit/lit/builtin_commands/cat.py llvm/utils/lit/lit/llvm/config.py Removed: diff --git a/clang/tools/clang-format/ClangFormat.cpp b/clang/tools/clang-format/ClangFormat.cpp index feb733fe3c9e0b..01f7c6047726e2 100644 --- a/clang/tools/clang-format/ClangFormat.cpp +++ b/clang/tools/clang-format/ClangFormat.cpp @@ -413,8 +413,9 @@ static bool format(StringRef FileName, bool ErrorOnIncompleteFormat = false) { // On Windows, overwriting a file with an open file mapping doesn't work, // so read the whole file into memory when formatting in-place. ErrorOr> CodeOrErr = - !OutputXML && Inplace ? MemoryBuffer::getFileAsStream(FileName) -: MemoryBuffer::getFileOrSTDIN(FileName); + !OutputXML && Inplace + ? MemoryBuffer::getFileAsStream(FileName) + : MemoryBuffer::getFileOrSTDIN(FileName, /*IsText=*/true); if (std::error_code EC = CodeOrErr.getError()) { errs() << EC.message() << "\n"; return true; @@ -558,7 +559,7 @@ static int dumpConfig() { // Read in the code in case the filename alone isn't enough to detect the // language. ErrorOr> CodeOrErr = -MemoryBuffer::getFileOrSTDIN(FileNames[0]); +MemoryBuffer::getFileOrSTDIN(FileNames[0], /*IsText=*/true); if (std::error_code EC = CodeOrErr.getError()) { llvm::errs() << EC.message() << "\n"; return 1; diff --git a/llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp b/llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp index c3015d895230ea..40ee59c014b09f 100644 --- a/llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp +++ b/llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp @@ -95,7 +95,8 @@ static std::vector getSearchPaths(opt::InputArgList *Args, // Opens a file. Path has to be resolved already. (used for def file) std::unique_ptr openFile(const Twine &Path) { - ErrorOr> MB = MemoryBuffer::getFile(Path); + ErrorOr> MB = + MemoryBuffer::getFile(Path, /*IsText=*/true); if (std::error_code EC = MB.getError()) { llvm::errs() << "cannot open file " << Path << ": " << EC.message() << "\n"; diff --git a/llvm/tools/llvm-cxxmap/llvm-cxxmap.cpp b/llvm/tools/llvm-cxxmap/llvm-cxxmap.cpp index 6a5646965df2cf..c5ccd64f116539 100644 --- a/llvm/tools/llvm-cxxmap/llvm-cxxmap.cpp +++ b/llvm/tools/llvm-cxxmap/llvm-cxxmap.cpp @@ -144,15 +144,18 @@ int main(int argc, const char *argv[]) { cl::HideUnrelatedOptions({&CXXMapCategory, &getColorCategory()}); cl::ParseCommandLineOptions(argc, argv, "LLVM C++ mangled name remapper\n"); - auto OldSymbolBufOrError = MemoryBuffer::getFileOrSTDIN(OldSymbolFile); + auto OldSymbolBufOrError = + MemoryBuffer::getFileOrSTDIN(OldSymbolFile, /*IsText=*/true); if (!OldSymbolBufOrError) exitWithErrorCode(OldSymbolBufOrError.getError(), OldSymbolFile); - auto NewSymbolBufOrError = MemoryBuffer::getFileOrSTDIN(NewSymbolFile); + auto NewSymbolBufOrError = + MemoryBuffer::getFileOrSTDIN(NewSymbolFile, /*IsText=*/true); if (!NewSymbolBufOrError) exitWithErrorCode(NewSymbolBufOrError.getError(), NewSymbolFile); - auto RemappingBufOrError = MemoryBuffer::getFileOrSTDIN(RemappingFile); + auto RemappingBufOrError = + MemoryBuffer::getFileOrSTDIN(RemappingFile, /*IsText=*/true); if (!RemappingBufOrError) exitWithErrorCode(RemappingBufOrError.getError(), RemappingFile); diff --git a/llvm/tools/yaml2obj/yaml2obj.cpp b/llvm/tools/yaml2obj/yaml2obj.cpp index b7f5356e22a9e6..4a060e1aad427f 100644 --- a/llvm/tools/yaml2obj/yaml2obj.cpp +++ b/llvm/tools/yaml2obj/yaml2obj.cpp @@ -130,7 +130,7 @@ int main(int argc, char **argv) { } ErrorOr> Buf = - MemoryBuffer::getFileOrSTDIN(Input); + MemoryBuffer::getFileOrSTDIN(Input, /*IsText=*/true); if (!Buf) return 1; diff --git a/llvm/utils/lit/lit/builtin_commands/c
[clang] [llvm] [z/OS] treat text files as text files so auto-conversion is done (PR #90128)
https://github.com/abhina-sree closed https://github.com/llvm/llvm-project/pull/90128 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][Docs] Add release note for *-none-* triple normalization changes (PR #90734)
https://github.com/DavidSpickett created https://github.com/llvm/llvm-project/pull/90734 That were implemented by https://github.com/llvm/llvm-project/pull/89638. >From 2d4d5e1885cc8e722b9ebaab81caf2d39c9994da Mon Sep 17 00:00:00 2001 From: David Spickett Date: Wed, 1 May 2024 15:39:31 +0100 Subject: [PATCH] [clang][Docs] Add release note for *-none-* triple normalization changes That were implemented by https://github.com/llvm/llvm-project/pull/89638. --- clang/docs/ReleaseNotes.rst | 19 +++ 1 file changed, 19 insertions(+) diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 2c5308fbcb319a..6f62daba6af081 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -85,6 +85,25 @@ Clang Frontend Potentially Breaking Changes of ``-Wno-gnu-binary-literal`` will no longer silence this pedantic warning, which may break existing uses with ``-Werror``. +- The normalization of 3 element target triples where ``-none-`` is the middle + element has changed. For example, ``armv7m-none-eabi`` previously normalized + to ``armv7m-none-unknown-eabi``, with ``none`` for the vendor and ``unknown`` + for the operating system. It now normalizes to ``armv7m-unknown-none-eabi``, + which has ``unknown`` vendor and ``none`` operating system. + + The affected triples are primarily for bare metal Arm where it is intended + that ``none`` means that there is no operating system. As opposed to an unknown + type of operating system. + + This change my cause clang to not find libraries, or libraries to be built at + different file system locations. This can be fixed by changing your builds to + use the new normalized triple. However, we recommend instead getting the + normalized triple from clang itself, as this will make your builds more + robust in case of future changes:: + +$ clang --target= -print-target-triple + + What's New in Clang |release|? == Some of the major new features and improvements to Clang are listed ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][Docs] Add release note for *-none-* triple normalization changes (PR #90734)
llvmbot wrote: @llvm/pr-subscribers-clang Author: David Spickett (DavidSpickett) Changes That were implemented by https://github.com/llvm/llvm-project/pull/89638. --- Full diff: https://github.com/llvm/llvm-project/pull/90734.diff 1 Files Affected: - (modified) clang/docs/ReleaseNotes.rst (+19) ``diff diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 2c5308fbcb319a..6f62daba6af081 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -85,6 +85,25 @@ Clang Frontend Potentially Breaking Changes of ``-Wno-gnu-binary-literal`` will no longer silence this pedantic warning, which may break existing uses with ``-Werror``. +- The normalization of 3 element target triples where ``-none-`` is the middle + element has changed. For example, ``armv7m-none-eabi`` previously normalized + to ``armv7m-none-unknown-eabi``, with ``none`` for the vendor and ``unknown`` + for the operating system. It now normalizes to ``armv7m-unknown-none-eabi``, + which has ``unknown`` vendor and ``none`` operating system. + + The affected triples are primarily for bare metal Arm where it is intended + that ``none`` means that there is no operating system. As opposed to an unknown + type of operating system. + + This change my cause clang to not find libraries, or libraries to be built at + different file system locations. This can be fixed by changing your builds to + use the new normalized triple. However, we recommend instead getting the + normalized triple from clang itself, as this will make your builds more + robust in case of future changes:: + +$ clang --target= -print-target-triple + + What's New in Clang |release|? == Some of the major new features and improvements to Clang are listed `` https://github.com/llvm/llvm-project/pull/90734 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][Docs] Add release note for {target}-none-{environment} triple normalization changes (PR #90734)
https://github.com/DavidSpickett edited https://github.com/llvm/llvm-project/pull/90734 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] [clang-tidy] Handle expr with side-effects in readability-static-accessed-through-instance (PR #90736)
https://github.com/PiotrZSL created https://github.com/llvm/llvm-project/pull/90736 Improved readability-static-accessed-through-instance check to support expressions with side-effects. Originally calls to overloaded operator were ignored by check, in fear of possible side-effects. This change remove that restriction, and enables fix-its for expressions with side-effect via --fix-notes. Closes #75163 >From 026b6ea48a697282ce8d18b2efe48499016276cc Mon Sep 17 00:00:00 2001 From: Piotr Zegar Date: Wed, 1 May 2024 14:44:08 + Subject: [PATCH] [clang-tidy] Handle expr with side-effects in readability-static-accessed-through-instance Improved readability-static-accessed-through-instance check to support expressions with side-effects. Originally calls to overloaded operator were ignored by check, in fear of possible side-effects. This change remove that restriction, and enables fix-its for expressions with side-effect via --fix-notes. Closes #75163 --- .../StaticAccessedThroughInstanceCheck.cpp| 37 +++--- clang-tools-extra/docs/ReleaseNotes.rst | 5 +++ .../static-accessed-through-instance.rst | 3 ++ .../static-accessed-through-instance.cpp | 38 +++ 4 files changed, 62 insertions(+), 21 deletions(-) diff --git a/clang-tools-extra/clang-tidy/readability/StaticAccessedThroughInstanceCheck.cpp b/clang-tools-extra/clang-tidy/readability/StaticAccessedThroughInstanceCheck.cpp index 65356cc3929c54..08adc7134cfea2 100644 --- a/clang-tools-extra/clang-tidy/readability/StaticAccessedThroughInstanceCheck.cpp +++ b/clang-tools-extra/clang-tidy/readability/StaticAccessedThroughInstanceCheck.cpp @@ -59,10 +59,6 @@ void StaticAccessedThroughInstanceCheck::check( const Expr *BaseExpr = MemberExpression->getBase(); - // Do not warn for overloaded -> operators. - if (isa(BaseExpr)) -return; - const QualType BaseType = BaseExpr->getType()->isPointerType() ? BaseExpr->getType()->getPointeeType().getUnqualifiedType() @@ -89,17 +85,30 @@ void StaticAccessedThroughInstanceCheck::check( return; SourceLocation MemberExprStartLoc = MemberExpression->getBeginLoc(); - auto Diag = - diag(MemberExprStartLoc, "static member accessed through instance"); - - if (BaseExpr->HasSideEffects(*AstContext) || - getNameSpecifierNestingLevel(BaseType) > NameSpecifierNestingThreshold) -return; + auto CreateFix = [&] { +return FixItHint::CreateReplacement( +CharSourceRange::getCharRange(MemberExprStartLoc, + MemberExpression->getMemberLoc()), +BaseTypeName + "::"); + }; + + { +auto Diag = +diag(MemberExprStartLoc, "static member accessed through instance"); + +if (getNameSpecifierNestingLevel(BaseType) > NameSpecifierNestingThreshold) + return; + +if (!BaseExpr->HasSideEffects(*AstContext, + /* IncludePossibleEffects =*/true)) { + Diag << CreateFix(); + return; +} + } - Diag << FixItHint::CreateReplacement( - CharSourceRange::getCharRange(MemberExprStartLoc, -MemberExpression->getMemberLoc()), - BaseTypeName + "::"); + diag(MemberExprStartLoc, "member base expression may carry some side effects", + DiagnosticIDs::Level::Note) + << BaseExpr->getSourceRange() << CreateFix(); } } // namespace clang::tidy::readability diff --git a/clang-tools-extra/docs/ReleaseNotes.rst b/clang-tools-extra/docs/ReleaseNotes.rst index 3038d2b125f20d..1f3e2c6953c2a4 100644 --- a/clang-tools-extra/docs/ReleaseNotes.rst +++ b/clang-tools-extra/docs/ReleaseNotes.rst @@ -331,6 +331,11 @@ Changes in existing checks ` check to properly emit warnings for static data member with an in-class initializer. +- Improved :doc:`readability-static-accessed-through-instance + ` check to + support calls to overloaded operators as base expression and provide fixes to + expressions with side-effects. + - Improved :doc:`readability-static-definition-in-anonymous-namespace ` check by resolving fix-it overlaps in template code by disregarding implicit diff --git a/clang-tools-extra/docs/clang-tidy/checks/readability/static-accessed-through-instance.rst b/clang-tools-extra/docs/clang-tidy/checks/readability/static-accessed-through-instance.rst index 23d12f41836640..ffb3738bf72c92 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/readability/static-accessed-through-instance.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/readability/static-accessed-through-instance.rst @@ -35,3 +35,6 @@ is changed to: C::E1; C::E2; +The `--fix` commandline option provides default support for safe fixes, whereas +`--fix-notes` enables fixes that may replace expressions with side effects, +potentially altering the program's behavior. diff --git a/clang-tools-extra/test/clang-tidy/checkers/readability/static-accessed-through-instance.cpp b/clang-tools
[clang-tools-extra] [clang-tidy] Handle expr with side-effects in readability-static-accessed-through-instance (PR #90736)
llvmbot wrote: @llvm/pr-subscribers-clang-tidy Author: Piotr Zegar (PiotrZSL) Changes Improved readability-static-accessed-through-instance check to support expressions with side-effects. Originally calls to overloaded operator were ignored by check, in fear of possible side-effects. This change remove that restriction, and enables fix-its for expressions with side-effect via --fix-notes. Closes #75163 --- Full diff: https://github.com/llvm/llvm-project/pull/90736.diff 4 Files Affected: - (modified) clang-tools-extra/clang-tidy/readability/StaticAccessedThroughInstanceCheck.cpp (+23-14) - (modified) clang-tools-extra/docs/ReleaseNotes.rst (+5) - (modified) clang-tools-extra/docs/clang-tidy/checks/readability/static-accessed-through-instance.rst (+3) - (modified) clang-tools-extra/test/clang-tidy/checkers/readability/static-accessed-through-instance.cpp (+31-7) ``diff diff --git a/clang-tools-extra/clang-tidy/readability/StaticAccessedThroughInstanceCheck.cpp b/clang-tools-extra/clang-tidy/readability/StaticAccessedThroughInstanceCheck.cpp index 65356cc3929c54..08adc7134cfea2 100644 --- a/clang-tools-extra/clang-tidy/readability/StaticAccessedThroughInstanceCheck.cpp +++ b/clang-tools-extra/clang-tidy/readability/StaticAccessedThroughInstanceCheck.cpp @@ -59,10 +59,6 @@ void StaticAccessedThroughInstanceCheck::check( const Expr *BaseExpr = MemberExpression->getBase(); - // Do not warn for overloaded -> operators. - if (isa(BaseExpr)) -return; - const QualType BaseType = BaseExpr->getType()->isPointerType() ? BaseExpr->getType()->getPointeeType().getUnqualifiedType() @@ -89,17 +85,30 @@ void StaticAccessedThroughInstanceCheck::check( return; SourceLocation MemberExprStartLoc = MemberExpression->getBeginLoc(); - auto Diag = - diag(MemberExprStartLoc, "static member accessed through instance"); - - if (BaseExpr->HasSideEffects(*AstContext) || - getNameSpecifierNestingLevel(BaseType) > NameSpecifierNestingThreshold) -return; + auto CreateFix = [&] { +return FixItHint::CreateReplacement( +CharSourceRange::getCharRange(MemberExprStartLoc, + MemberExpression->getMemberLoc()), +BaseTypeName + "::"); + }; + + { +auto Diag = +diag(MemberExprStartLoc, "static member accessed through instance"); + +if (getNameSpecifierNestingLevel(BaseType) > NameSpecifierNestingThreshold) + return; + +if (!BaseExpr->HasSideEffects(*AstContext, + /* IncludePossibleEffects =*/true)) { + Diag << CreateFix(); + return; +} + } - Diag << FixItHint::CreateReplacement( - CharSourceRange::getCharRange(MemberExprStartLoc, -MemberExpression->getMemberLoc()), - BaseTypeName + "::"); + diag(MemberExprStartLoc, "member base expression may carry some side effects", + DiagnosticIDs::Level::Note) + << BaseExpr->getSourceRange() << CreateFix(); } } // namespace clang::tidy::readability diff --git a/clang-tools-extra/docs/ReleaseNotes.rst b/clang-tools-extra/docs/ReleaseNotes.rst index 3038d2b125f20d..1f3e2c6953c2a4 100644 --- a/clang-tools-extra/docs/ReleaseNotes.rst +++ b/clang-tools-extra/docs/ReleaseNotes.rst @@ -331,6 +331,11 @@ Changes in existing checks ` check to properly emit warnings for static data member with an in-class initializer. +- Improved :doc:`readability-static-accessed-through-instance + ` check to + support calls to overloaded operators as base expression and provide fixes to + expressions with side-effects. + - Improved :doc:`readability-static-definition-in-anonymous-namespace ` check by resolving fix-it overlaps in template code by disregarding implicit diff --git a/clang-tools-extra/docs/clang-tidy/checks/readability/static-accessed-through-instance.rst b/clang-tools-extra/docs/clang-tidy/checks/readability/static-accessed-through-instance.rst index 23d12f41836640..ffb3738bf72c92 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/readability/static-accessed-through-instance.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/readability/static-accessed-through-instance.rst @@ -35,3 +35,6 @@ is changed to: C::E1; C::E2; +The `--fix` commandline option provides default support for safe fixes, whereas +`--fix-notes` enables fixes that may replace expressions with side effects, +potentially altering the program's behavior. diff --git a/clang-tools-extra/test/clang-tidy/checkers/readability/static-accessed-through-instance.cpp b/clang-tools-extra/test/clang-tidy/checkers/readability/static-accessed-through-instance.cpp index 81c1cecf607f66..202fe9be6d00c5 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/readability/static-accessed-through-instance.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/readability/static-accessed-through-instance.cpp @@ -1,4 +1,4 @@ -// RUN: %check_clang_tidy %
[clang] [Clang] Ensure "=default"ed function can be deleted when used as an extension in C++03 (PR #90725)
https://github.com/MitalAshok updated https://github.com/llvm/llvm-project/pull/90725 >From 0793795ba7d5d5974b1403cd6ead0221fc20c5bb Mon Sep 17 00:00:00 2001 From: Mital Ashok Date: Wed, 1 May 2024 12:45:54 +0100 Subject: [PATCH 1/2] [Clang] Ensure "=default"ed function can be deleted when used as an extension in C++03 Fixes #90605 --- clang/lib/Sema/SemaDeclCXX.cpp| 4 ++- .../SemaCXX/cxx0x-cursory-default-delete.cpp | 34 +-- .../SemaCXX/cxx0x-defaulted-functions.cpp | 13 +++ 3 files changed, 47 insertions(+), 4 deletions(-) diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index 157d42c09cfcd8..e3c90c8ee1d644 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -9767,7 +9767,9 @@ bool Sema::ShouldDeleteSpecialMember(CXXMethodDecl *MD, return false; CXXRecordDecl *RD = MD->getParent(); assert(!RD->isDependentType() && "do deletion after instantiation"); - if (!LangOpts.CPlusPlus || (!LangOpts.CPlusPlus11 && !RD->isLambda()) || + if (!LangOpts.CPlusPlus || + (!LangOpts.CPlusPlus11 && !RD->isLambda() && + !MD->isExplicitlyDefaulted()) || RD->isInvalidDecl()) return false; diff --git a/clang/test/SemaCXX/cxx0x-cursory-default-delete.cpp b/clang/test/SemaCXX/cxx0x-cursory-default-delete.cpp index 6ae146f0d08c7d..f884725a234671 100644 --- a/clang/test/SemaCXX/cxx0x-cursory-default-delete.cpp +++ b/clang/test/SemaCXX/cxx0x-cursory-default-delete.cpp @@ -1,4 +1,11 @@ // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++03 -Wno-c++11-extensions -fsyntax-only -verify %s + +#if __cplusplus < 201103L +#define static_assert _Static_assert +#define nullptr 0 +#define noexcept throw() +#endif struct non_copiable { non_copiable(const non_copiable&) = delete; // expected-note {{marked deleted here}} @@ -25,10 +32,12 @@ void fn1 () { non_const_copy ncc; non_const_copy ncc2 = ncc; ncc = ncc2; +#if __cplusplus >= 201103L const non_const_copy cncc{}; +#endif const non_const_copy cncc1; // expected-error {{default initialization of an object of const type 'const non_const_copy' without a user-provided default constructor}} - non_const_copy ncc3 = cncc; // expected-error {{no matching}} - ncc = cncc; // expected-error {{no viable overloaded}} + non_const_copy ncc3 = cncc1; // expected-error {{no matching}} + ncc = cncc1; // expected-error {{no viable overloaded}} }; struct no_fields { }; @@ -196,7 +205,7 @@ struct except_spec_d_match : except_spec_a, except_spec_b { struct S { S(); }; S::S() __attribute((noreturn)) = default; -using size_t = decltype(sizeof(0)); +using size_t = __SIZE_TYPE__; void *operator new(size_t) = delete; // expected-error {{deleted definition must be first declaration}} expected-note {{implicit}} void operator delete(void *) noexcept = delete; // expected-error {{deleted definition must be first declaration}} expected-note {{implicit}} @@ -217,3 +226,22 @@ namespace deleted_overrides_deleted { template struct B : A { virtual void f() = delete; }; template struct B; } + +namespace GH90605 { +struct Element { +Element& operator=(const Element&) = delete; // #GH90605-Element-assign +}; + +struct S { +Element i; // #GH90605-i + +S& operator=(const S&) = default; +// expected-warning@-1 {{explicitly defaulted copy assignment operator is implicitly deleted}} +// expected-note@#GH90605-i {{copy assignment operator of 'S' is implicitly deleted because field 'i' has a deleted copy assignment operator}} +// expected-note@#GH90605-Element-assign {{'operator=' has been explicitly marked deleted here}} +// expected-note@-4 {{replace 'default' with 'delete'}} +}; + +static_assert(!__is_trivially_assignable(S&, const S&), ""); +static_assert(!__is_assignable(S&, const S&), ""); +} diff --git a/clang/test/SemaCXX/cxx0x-defaulted-functions.cpp b/clang/test/SemaCXX/cxx0x-defaulted-functions.cpp index 0c3dd1ea7aa274..30d54920a1a686 100644 --- a/clang/test/SemaCXX/cxx0x-defaulted-functions.cpp +++ b/clang/test/SemaCXX/cxx0x-defaulted-functions.cpp @@ -1,4 +1,9 @@ // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify -fcxx-exceptions -Wno-deprecated-builtins %s +// RUN: %clang_cc1 -std=c++03 -Wno-c++11-extensions -fsyntax-only -verify -fcxx-exceptions -Wno-deprecated-builtins %s + +#if __cplusplus < 201103L +#define static_assert _Static_assert +#endif void fn() = default; // expected-error {{only special member}} struct foo { @@ -43,6 +48,7 @@ void tester() { b = c; } +#if __cplusplus >= 201103L template struct S : T { constexpr S() = default; // expected-note {{previous declaration is here}} constexpr S(const S&) = default; // expected-note {{previous declaration is here}} @@ -118,6 +124,7 @@ namespace DefaultedFnExceptionSpec { *p = *p; // expected-note {{instantiation of}} } } +#endif namespace PR13527 { struct X { @@ -135,6 +142,
[clang] [Clang] Ensure "=default"ed function can be deleted when used as an extension in C++03 (PR #90725)
https://github.com/MitalAshok converted_to_draft https://github.com/llvm/llvm-project/pull/90725 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [clang backend] In AArch64's DataLayout, specify a minimum function alignment of 4. (PR #90702)
https://github.com/dougsonos updated https://github.com/llvm/llvm-project/pull/90702 >From 4c312af7af5d0e419269c5b2304b0f898363bb85 Mon Sep 17 00:00:00 2001 From: Doug Wyatt Date: Tue, 30 Apr 2024 21:43:16 -0700 Subject: [PATCH 1/3] In AArch64's DataLayout, specify a minimum function alignment of 4. This addresses an issue where the explicit alignment of 2 (for C++ ABI reasons) was being propagated to the back end and causing under-aligned functions (in special sections). (#90358) --- clang/lib/Basic/Targets/AArch64.cpp | 12 ++-- llvm/lib/IR/AutoUpgrade.cpp | 8 llvm/lib/Target/AArch64/AArch64TargetMachine.cpp | 8 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/clang/lib/Basic/Targets/AArch64.cpp b/clang/lib/Basic/Targets/AArch64.cpp index c8d243a8fb7aea..a5dd803f636b90 100644 --- a/clang/lib/Basic/Targets/AArch64.cpp +++ b/clang/lib/Basic/Targets/AArch64.cpp @@ -1480,11 +1480,11 @@ AArch64leTargetInfo::AArch64leTargetInfo(const llvm::Triple &Triple, void AArch64leTargetInfo::setDataLayout() { if (getTriple().isOSBinFormatMachO()) { if(getTriple().isArch32Bit()) - resetDataLayout("e-m:o-p:32:32-i64:64-i128:128-n32:64-S128", "_"); + resetDataLayout("e-m:o-p:32:32-Fn32-i64:64-i128:128-n32:64-S128", "_"); else - resetDataLayout("e-m:o-i64:64-i128:128-n32:64-S128", "_"); + resetDataLayout("e-m:o-Fn32-i64:64-i128:128-n32:64-S128", "_"); } else -resetDataLayout("e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"); + resetDataLayout("e-m:e-Fn32-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"); } void AArch64leTargetInfo::getTargetDefines(const LangOptions &Opts, @@ -1507,7 +1507,7 @@ void AArch64beTargetInfo::getTargetDefines(const LangOptions &Opts, void AArch64beTargetInfo::setDataLayout() { assert(!getTriple().isOSBinFormatMachO()); - resetDataLayout("E-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"); + resetDataLayout("E-m:e-Fn32-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"); } WindowsARM64TargetInfo::WindowsARM64TargetInfo(const llvm::Triple &Triple, @@ -1530,8 +1530,8 @@ WindowsARM64TargetInfo::WindowsARM64TargetInfo(const llvm::Triple &Triple, void WindowsARM64TargetInfo::setDataLayout() { resetDataLayout(Triple.isOSBinFormatMachO() - ? "e-m:o-i64:64-i128:128-n32:64-S128" - : "e-m:w-p:64:64-i32:32-i64:64-i128:128-n32:64-S128", + ? "e-m:o-Fn32-i64:64-i128:128-n32:64-S128" + : "e-m:w-p:64:64-Fn32-i32:32-i64:64-i128:128-n32:64-S128", Triple.isOSBinFormatMachO() ? "_" : ""); } diff --git a/llvm/lib/IR/AutoUpgrade.cpp b/llvm/lib/IR/AutoUpgrade.cpp index 634b2dd5119e8d..eed946dc36580e 100644 --- a/llvm/lib/IR/AutoUpgrade.cpp +++ b/llvm/lib/IR/AutoUpgrade.cpp @@ -5387,6 +5387,14 @@ std::string llvm::UpgradeDataLayoutString(StringRef DL, StringRef TT) { return Res; } + // AArch64 data layout upgrades. + if (T.isAArch64()) { +// Add "-Fn32" +if (!DL.contains("-Fn32")) + Res.append("-Fn32"); +return Res; + } + if (!T.isX86()) return Res; diff --git a/llvm/lib/Target/AArch64/AArch64TargetMachine.cpp b/llvm/lib/Target/AArch64/AArch64TargetMachine.cpp index 7ef78cbba352a5..4ff5fb94162a93 100644 --- a/llvm/lib/Target/AArch64/AArch64TargetMachine.cpp +++ b/llvm/lib/Target/AArch64/AArch64TargetMachine.cpp @@ -275,15 +275,15 @@ static std::string computeDataLayout(const Triple &TT, bool LittleEndian) { if (TT.isOSBinFormatMachO()) { if (TT.getArch() == Triple::aarch64_32) - return "e-m:o-p:32:32-i64:64-i128:128-n32:64-S128"; -return "e-m:o-i64:64-i128:128-n32:64-S128"; + return "e-m:o-p:32:32-Fn32-i64:64-i128:128-n32:64-S128"; +return "e-m:o-Fn32-i64:64-i128:128-n32:64-S128"; } if (TT.isOSBinFormatCOFF()) -return "e-m:w-p:64:64-i32:32-i64:64-i128:128-n32:64-S128"; +return "e-m:w-p:64:64-Fn32-i32:32-i64:64-i128:128-n32:64-S128"; std::string Endian = LittleEndian ? "e" : "E"; std::string Ptr32 = TT.getEnvironment() == Triple::GNUILP32 ? "-p:32:32" : ""; return Endian + "-m:e" + Ptr32 + - "-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"; + "-Fn32-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"; } static StringRef computeDefaultCPU(const Triple &TT, StringRef CPU) { >From 5a2b9e1b0444c52cd7f7cf9a3ddbb573403101a5 Mon Sep 17 00:00:00 2001 From: Doug Wyatt Date: Wed, 1 May 2024 07:27:11 -0700 Subject: [PATCH 2/3] Move "-Fn32" to the end of the data layout strings, to make the auto-upgrade simplest. --- clang/lib/Basic/Targets/AArch64.cpp | 12 ++-- llvm/lib/Target/AArch64/AArch64TargetMachine.cpp | 8 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/clang/lib/Basic/Targets/AArch64.cpp b/clang/lib/Basic/Targets/AArch64.cpp index a5dd803f636b90..1a02520d7bd1f8 100
[clang] [llvm] [clang backend] In AArch64's DataLayout, specify a minimum function alignment of 4. (PR #90702)
dougsonos wrote: > I'd expect regression tests for the autoupgrade, and a test that clang isn't > generating the alignment markings anymore. I just pushed: - the `-Fn32` is at the end of the data layout strings - the 6 tests that failed for me locally (testing only AArch64) are fixed That includes a change to CodeGen/CodeGenCXX/member-alignment.cpp, which checks for alignment / no alignment on C++ methods, depending on target. I'm not clear on when the autoupgrade runs and how to test it. Is there an example I can follow? Thanks! https://github.com/llvm/llvm-project/pull/90702 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits