[clang] [clang-tools-extra] [clang] Don't preserve the typo expr in the recovery expr for invalid VarDecls (PR #90948)
https://github.com/cor3ntin approved this pull request. https://github.com/llvm/llvm-project/pull/90948 ___ 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)
https://github.com/AlexVlx edited 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] [llvm] [mlir] [Clang][CodeGen] Start migrating away from assuming the Default AS is 0 (PR #88182)
https://github.com/AlexVlx commented: > Would be good to fold > clang/test/CodeGenCXX/vtable-assume-load-nonzero-default-address-space.cpp > into one of the files it was copied from, otherwise LGTM. Apologies for the delay, I was away; should be sorted now. 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] 5f2f390 - [clang][Interp][NFC] Allow Pointer assignment if both are zero
Author: Timm Bäder Date: 2024-05-07T08:53:45+02:00 New Revision: 5f2f3900138cc519e1cb807e99920337eede2b6c URL: https://github.com/llvm/llvm-project/commit/5f2f3900138cc519e1cb807e99920337eede2b6c DIFF: https://github.com/llvm/llvm-project/commit/5f2f3900138cc519e1cb807e99920337eede2b6c.diff LOG: [clang][Interp][NFC] Allow Pointer assignment if both are zero ... even if the storage types are different. Added: Modified: clang/lib/AST/Interp/Pointer.cpp Removed: diff --git a/clang/lib/AST/Interp/Pointer.cpp b/clang/lib/AST/Interp/Pointer.cpp index 5ef31671ae7be..12bef73f7e21c 100644 --- a/clang/lib/AST/Interp/Pointer.cpp +++ b/clang/lib/AST/Interp/Pointer.cpp @@ -63,9 +63,8 @@ Pointer::~Pointer() { } void Pointer::operator=(const Pointer &P) { - if (!this->isIntegralPointer() || !P.isBlockPointer()) -assert(P.StorageKind == StorageKind); +assert(P.StorageKind == StorageKind || (this->isZero() && P.isZero())); bool WasBlockPointer = isBlockPointer(); StorageKind = P.StorageKind; @@ -92,7 +91,7 @@ void Pointer::operator=(const Pointer &P) { void Pointer::operator=(Pointer &&P) { if (!this->isIntegralPointer() || !P.isBlockPointer()) -assert(P.StorageKind == StorageKind); +assert(P.StorageKind == StorageKind || (this->isZero() && P.isZero())); bool WasBlockPointer = isBlockPointer(); StorageKind = P.StorageKind; ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][analyzer] Check for label location bindings in `DereferenceChecker` (PR #91119)
steakhal wrote: > Should we introduce a new Kind in `DerefKind` (in reference to > `DereferenceChecker::reportBug`) ? Yes. Something like this should work: ```c++ BugType BT_Label{this, "Dereference of the address of a label", categories::LogicError}; ``` https://github.com/llvm/llvm-project/pull/91119 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [analyzer] Clean up apiModeling.llvm.ReturnValue (PR #91231)
https://github.com/steakhal approved this pull request. LGTM. I have nothing to add here. https://github.com/llvm/llvm-project/pull/91231 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [analyzer] Use explicit call description mode in more checkers (PR #90974)
@@ -149,26 +149,34 @@ class BlockInCriticalSectionChecker : public Checker { private: const std::array MutexDescriptors{ MemberMutexDescriptor( - CallDescription(/*QualifiedName=*/{"std", "mutex", "lock"}, + CallDescription(/*MatchAs=*/CDM::CXXMethod, + /*QualifiedName=*/{"std", "mutex", "lock"}, /*RequiredArgs=*/0), steakhal wrote: Do we need the `CallDescription(...)` stuff? Couldn't we just use braces `{...}` like we usually do? https://github.com/llvm/llvm-project/pull/90974 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [analyzer] Use explicit call description mode in more checkers (PR #90974)
https://github.com/steakhal approved this pull request. LGTM, thanks. I had one minor nit. https://github.com/llvm/llvm-project/pull/90974 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [analyzer] Use explicit call description mode in more checkers (PR #90974)
https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/90974 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [analyzer] Use explicit call description mode in more checkers (PR #90974)
https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/90974 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][PowerPC] Add flag to enable compatibility with GNU for complex arguments (PR #77732)
UmeshKalappa0 wrote: @diggerlin , >>can we implement -fcomplex-ppc-gnu-abi as "-msoft-float" ? what is your >>opinion ? that was not the intent here and we need to consultant ABI reference regrading the same ,before we decide on implementation . https://github.com/llvm/llvm-project/pull/77732 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] [clangd] Support callHierarchy/outgoingCalls (PR #91191)
ckandeler wrote: > If I'm understanding correctly, the implementation approach in this PR only > finds callees in the current translation > unit. > The approach in #77556 uses the project's index to find callees across > translation unit boundaries. Right, that's obviously nicer. > Regarding reviews: yes, it seems quite unfortunate that the original > developers seem to have largely moved on to > other things. I will do my best to make some progress of the project's review > backlog (including in particular > #86629 and #67802) as time permits. Your work is highly appreciated, but I don't think it's reasonable to expect a single unpaid contributor to maintain the entire project, as appears to be the case right now. https://github.com/llvm/llvm-project/pull/91191 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 05f4448 - [clang][Interp][NFC] Add eval-order test
Author: Timm Bäder Date: 2024-05-07T07:58:42+02:00 New Revision: 05f4448d40f00b9fb2447e1c32cd18a7a9b8b011 URL: https://github.com/llvm/llvm-project/commit/05f4448d40f00b9fb2447e1c32cd18a7a9b8b011 DIFF: https://github.com/llvm/llvm-project/commit/05f4448d40f00b9fb2447e1c32cd18a7a9b8b011.diff LOG: [clang][Interp][NFC] Add eval-order test Demonstrate that this isn't yet working right. Added: clang/test/AST/Interp/eval-order.cpp Modified: Removed: diff --git a/clang/test/AST/Interp/eval-order.cpp b/clang/test/AST/Interp/eval-order.cpp new file mode 100644 index 0..695a43c9d235b --- /dev/null +++ b/clang/test/AST/Interp/eval-order.cpp @@ -0,0 +1,117 @@ +// RUN: %clang_cc1 -std=c++1z -verify %s -fcxx-exceptions -triple=x86_64-linux-gnu +// RUN: %clang_cc1 -std=c++1z -verify %s -fcxx-exceptions -triple=x86_64-linux-gnu -fexperimental-new-constant-interpreter + +// ref-no-diagnostics +// expected-no-diagnostics + +/// Check that assignment operators evaluate their operands right-to-left. +/// Copied from test/SemaCXX/constant-expression-cxx1z.cpp +/// +/// As you can see from the FIXME comments, some of these are not yet working correctly +/// in the new interpreter. +namespace EvalOrder { + template struct lvalue { +T t; +constexpr T &get() { return t; } + }; + + struct UserDefined { +int n = 0; +constexpr UserDefined &operator=(const UserDefined&) { return *this; } +constexpr UserDefined &operator+=(const UserDefined&) { return *this; } +constexpr void operator<<(const UserDefined&) const {} +constexpr void operator>>(const UserDefined&) const {} +constexpr void operator+(const UserDefined&) const {} +constexpr void operator[](int) const {} + }; + constexpr UserDefined ud; + + struct NonMember {}; + constexpr void operator+=(NonMember, NonMember) {} + constexpr void operator<<(NonMember, NonMember) {} + constexpr void operator>>(NonMember, NonMember) {} + constexpr void operator+(NonMember, NonMember) {} + constexpr NonMember nm; + + constexpr void f(...) {} + + // Helper to ensure that 'a' is evaluated before 'b'. + struct seq_checker { +bool done_a = false; +bool done_b = false; + +template constexpr T &&a(T &&v) { + done_a = true; + return (T &&)v; +} +template constexpr T &&b(T &&v) { + if (!done_a) +throw "wrong"; + done_b = true; + return (T &&)v; +} + +constexpr bool ok() { return done_a && done_b; } + }; + + // SEQ(expr), where part of the expression is tagged A(...) and part is + // tagged B(...), checks that A is evaluated before B. + #define A sc.a + #define B sc.b + #define SEQ(...) static_assert([](seq_checker sc) { void(__VA_ARGS__); return sc.ok(); }({})) + + // Longstanding sequencing rules. + SEQ((A(1), B(2))); + SEQ((A(true) ? B(2) : throw "huh?")); + SEQ((A(false) ? throw "huh?" : B(2))); + SEQ(A(true) && B(true)); + SEQ(A(false) || B(true)); + + // From P0145R3: + + // Rules 1 and 2 have no effect ('b' is not an expression). + + // Rule 3: a->*b + // SEQ(A(ud).*B(&UserDefined::n)); FIXME + // SEQ(A(&ud)->*B(&UserDefined::n)); FIXME + + // Rule 4: a(b1, b2, b3) + // SEQ(A(f)(B(1), B(2), B(3))); FIXME + + // Rule 5: b = a, b @= a + // SEQ(B(lvalue().get()) = A(0)); FIXME + // SEQ(B(lvalue().get()) = A(ud)); FIXME + SEQ(B(lvalue().get()) += A(0)); + // SEQ(B(lvalue().get()) += A(ud)); FIXME + // SEQ(B(lvalue().get()) += A(nm)); FIXME + + // Rule 6: a[b] + constexpr int arr[3] = {}; + SEQ(A(arr)[B(0)]); + SEQ(A(+arr)[B(0)]); + // SEQ(A(0)[B(arr)]); FIXME + // SEQ(A(0)[B(+arr)]); FIXME + SEQ(A(ud)[B(0)]); + + // Rule 7: a << b + SEQ(A(1) << B(2)); + SEQ(A(ud) << B(ud)); + SEQ(A(nm) << B(nm)); + + // Rule 8: a >> b + SEQ(A(1) >> B(2)); + SEQ(A(ud) >> B(ud)); + SEQ(A(nm) >> B(nm)); + + // No particular order of evaluation is specified in other cases, but we in + // practice evaluate left-to-right. + // FIXME: Technically we're expected to check for undefined behavior due to + // unsequenced read and modification and treat it as non-constant due to UB. + SEQ(A(1) + B(2)); + SEQ(A(ud) + B(ud)); + SEQ(A(nm) + B(nm)); + SEQ(f(A(1), B(2))); + #undef SEQ + #undef A + #undef B +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [WebAssembly] Make EH depend on multivalue and reference-types (PR #91299)
llvmbot wrote: @llvm/pr-subscribers-clang Author: Heejin Ahn (aheejin) Changes This PR turns on multivalue and reference-types features when exception-handling feature is turned on, and errors out when disabling of those dependent features is explicitly requested. I think doing this would be safe anyway regardless of whether or when we end up turning on reference-types by default. We currently don't yet have a experimental flag for the Clang and LLVM for the new experimental EH yet. But I think it should be fine to turn those features on even if the LLVM does not yet generate the new EH instructions, for the same reason we tried to turn them on by default and the browsers that support EH also support multivalue and reference-types anyway. --- Full diff: https://github.com/llvm/llvm-project/pull/91299.diff 2 Files Affected: - (modified) clang/lib/Driver/ToolChains/WebAssembly.cpp (+34) - (modified) clang/test/Driver/wasm-toolchain.c (+33-6) ``diff diff --git a/clang/lib/Driver/ToolChains/WebAssembly.cpp b/clang/lib/Driver/ToolChains/WebAssembly.cpp index b7c6efab83e80..5b763df9b3329 100644 --- a/clang/lib/Driver/ToolChains/WebAssembly.cpp +++ b/clang/lib/Driver/ToolChains/WebAssembly.cpp @@ -347,6 +347,23 @@ void WebAssembly::addClangTargetOptions(const ArgList &DriverArgs, // Backend needs -wasm-enable-eh to enable Wasm EH CC1Args.push_back("-mllvm"); CC1Args.push_back("-wasm-enable-eh"); + +// New Wasm EH spec (adopted in Oct 2023) requires multivalue and +// reference-types. +if (DriverArgs.hasFlag(options::OPT_mno_multivalue, + options::OPT_mmultivalue, false)) { + getDriver().Diag(diag::err_drv_argument_not_allowed_with) + << "-fwasm-exceptions" << "-mno-multivalue"; +} +if (DriverArgs.hasFlag(options::OPT_mno_reference_types, + options::OPT_mreference_types, false)) { + getDriver().Diag(diag::err_drv_argument_not_allowed_with) + << "-fwasm-exceptions" << "-mno-reference-types"; +} +CC1Args.push_back("-target-feature"); +CC1Args.push_back("+multivalue"); +CC1Args.push_back("-target-feature"); +CC1Args.push_back("+reference-types"); } for (const Arg *A : DriverArgs.filtered(options::OPT_mllvm)) { @@ -408,6 +425,23 @@ void WebAssembly::addClangTargetOptions(const ArgList &DriverArgs, CC1Args.push_back("+exception-handling"); // Backend needs '-exception-model=wasm' to use Wasm EH instructions CC1Args.push_back("-exception-model=wasm"); + + // New Wasm EH spec (adopted in Oct 2023) requires multivalue and + // reference-types. + if (DriverArgs.hasFlag(options::OPT_mno_multivalue, + options::OPT_mmultivalue, false)) { +getDriver().Diag(diag::err_drv_argument_not_allowed_with) +<< "-mllvm -wasm-enable-sjlj" << "-mno-multivalue"; + } + if (DriverArgs.hasFlag(options::OPT_mno_reference_types, + options::OPT_mreference_types, false)) { +getDriver().Diag(diag::err_drv_argument_not_allowed_with) +<< "-mllvm -wasm-enable-sjlj" << "-mno-reference-types"; + } + CC1Args.push_back("-target-feature"); + CC1Args.push_back("+multivalue"); + CC1Args.push_back("-target-feature"); + CC1Args.push_back("+reference-types"); } } } diff --git a/clang/test/Driver/wasm-toolchain.c b/clang/test/Driver/wasm-toolchain.c index dabf0ac2433bb..7c26c2c13c0ba 100644 --- a/clang/test/Driver/wasm-toolchain.c +++ b/clang/test/Driver/wasm-toolchain.c @@ -120,11 +120,12 @@ // RUN: | FileCheck -check-prefix=EMSCRIPTEN_EH_ALLOWED_WO_ENABLE %s // EMSCRIPTEN_EH_ALLOWED_WO_ENABLE: invalid argument '-mllvm -emscripten-cxx-exceptions-allowed' only allowed with '-mllvm -enable-emscripten-cxx-exceptions' -// '-fwasm-exceptions' sets +exception-handling and '-mllvm -wasm-enable-eh' +// '-fwasm-exceptions' sets +exception-handling, -multivalue, -reference-types +// and '-mllvm -wasm-enable-eh' // RUN: %clang -### --target=wasm32-unknown-unknown \ // RUN:--sysroot=/foo %s -fwasm-exceptions 2>&1 \ // RUN: | FileCheck -check-prefix=WASM_EXCEPTIONS %s -// WASM_EXCEPTIONS: "-cc1" {{.*}} "-target-feature" "+exception-handling" "-mllvm" "-wasm-enable-eh" +// WASM_EXCEPTIONS: "-cc1" {{.*}} "-target-feature" "+exception-handling" "-mllvm" "-wasm-enable-eh" "-target-feature" "+multivalue" "-target-feature" "+reference-types" // '-fwasm-exceptions' not allowed with '-mno-exception-handling' // RUN: not %clang -### --target=wasm32-unknown-unknown \ @@ -132,19 +133,32 @@ // RUN: | FileCheck -check-prefix=WASM_EXCEPTIONS_NO_EH %s // WASM_EXCEPTIONS_NO_EH: invalid argument '-fwasm-exceptions' not allowed with '-mno-exception-handling' -// '-fwasm-exceptions' not allowed with '-mllvm -enable-emscripten-cxx-exceptions' +// '-fwasm-exceptions' not allowed with +// '-mllvm -enable-emscripten
[clang] [WebAssembly] Make EH depend on multivalue and reference-types (PR #91299)
https://github.com/aheejin created https://github.com/llvm/llvm-project/pull/91299 This PR turns on multivalue and reference-types features when exception-handling feature is turned on, and errors out when disabling of those dependent features is explicitly requested. I think doing this would be safe anyway regardless of whether or when we end up turning on reference-types by default. We currently don't yet have a experimental flag for the Clang and LLVM for the new experimental EH yet. But I think it should be fine to turn those features on even if the LLVM does not yet generate the new EH instructions, for the same reason we tried to turn them on by default and the browsers that support EH also support multivalue and reference-types anyway. >From 527209b600696885ab926cbf09c88feed8a18544 Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Tue, 7 May 2024 05:31:24 + Subject: [PATCH] [WebAssembly] Make EH depend on multivalue and reference-types This PR turns on multivalue and reference-types features when exception-handling feature is turned on, and errors out when disabling of those dependent features is explicitly requested. I think doing this would be safe anyway regardless of whether or when we end up turning on reference-types by default. We currently don't yet have a experimental flag for the Clang and LLVM for the new experimental EH yet. But I think it should be fine to turn those features on even if the LLVM does not yet generate the new EH instructions, for the same reason we tried to turn them on by default and the browsers that support EH also support multivalue and reference-types anyway. --- clang/lib/Driver/ToolChains/WebAssembly.cpp | 34 ++ clang/test/Driver/wasm-toolchain.c | 39 + 2 files changed, 67 insertions(+), 6 deletions(-) diff --git a/clang/lib/Driver/ToolChains/WebAssembly.cpp b/clang/lib/Driver/ToolChains/WebAssembly.cpp index b7c6efab83e806..5b763df9b33293 100644 --- a/clang/lib/Driver/ToolChains/WebAssembly.cpp +++ b/clang/lib/Driver/ToolChains/WebAssembly.cpp @@ -347,6 +347,23 @@ void WebAssembly::addClangTargetOptions(const ArgList &DriverArgs, // Backend needs -wasm-enable-eh to enable Wasm EH CC1Args.push_back("-mllvm"); CC1Args.push_back("-wasm-enable-eh"); + +// New Wasm EH spec (adopted in Oct 2023) requires multivalue and +// reference-types. +if (DriverArgs.hasFlag(options::OPT_mno_multivalue, + options::OPT_mmultivalue, false)) { + getDriver().Diag(diag::err_drv_argument_not_allowed_with) + << "-fwasm-exceptions" << "-mno-multivalue"; +} +if (DriverArgs.hasFlag(options::OPT_mno_reference_types, + options::OPT_mreference_types, false)) { + getDriver().Diag(diag::err_drv_argument_not_allowed_with) + << "-fwasm-exceptions" << "-mno-reference-types"; +} +CC1Args.push_back("-target-feature"); +CC1Args.push_back("+multivalue"); +CC1Args.push_back("-target-feature"); +CC1Args.push_back("+reference-types"); } for (const Arg *A : DriverArgs.filtered(options::OPT_mllvm)) { @@ -408,6 +425,23 @@ void WebAssembly::addClangTargetOptions(const ArgList &DriverArgs, CC1Args.push_back("+exception-handling"); // Backend needs '-exception-model=wasm' to use Wasm EH instructions CC1Args.push_back("-exception-model=wasm"); + + // New Wasm EH spec (adopted in Oct 2023) requires multivalue and + // reference-types. + if (DriverArgs.hasFlag(options::OPT_mno_multivalue, + options::OPT_mmultivalue, false)) { +getDriver().Diag(diag::err_drv_argument_not_allowed_with) +<< "-mllvm -wasm-enable-sjlj" << "-mno-multivalue"; + } + if (DriverArgs.hasFlag(options::OPT_mno_reference_types, + options::OPT_mreference_types, false)) { +getDriver().Diag(diag::err_drv_argument_not_allowed_with) +<< "-mllvm -wasm-enable-sjlj" << "-mno-reference-types"; + } + CC1Args.push_back("-target-feature"); + CC1Args.push_back("+multivalue"); + CC1Args.push_back("-target-feature"); + CC1Args.push_back("+reference-types"); } } } diff --git a/clang/test/Driver/wasm-toolchain.c b/clang/test/Driver/wasm-toolchain.c index dabf0ac2433bbb..7c26c2c13c0baf 100644 --- a/clang/test/Driver/wasm-toolchain.c +++ b/clang/test/Driver/wasm-toolchain.c @@ -120,11 +120,12 @@ // RUN: | FileCheck -check-prefix=EMSCRIPTEN_EH_ALLOWED_WO_ENABLE %s // EMSCRIPTEN_EH_ALLOWED_WO_ENABLE: invalid argument '-mllvm -emscripten-cxx-exceptions-allowed' only allowed with '-mllvm -enable-emscripten-cxx-exceptions' -// '-fwasm-exceptions' sets +exception-handling and '-mllvm -wasm-enable-eh' +// '-fwasm-exceptions' sets +exception-handling, -multivalue, -reference-types +// and '-mllvm -wasm-enable-eh' // RUN: %clang -### --target=wasm32-unknown-unknown \ // RUN:
[clang] [Clang][Comments] Attach comments to decl even if preproc directives are in between (PR #88367)
Boddlnagg wrote: Regarding the positioning of Doxygen comments, I just saw this and was wondering if it's possible to also support parsing of Doxygen comments that come after the signature, which happens to be the preferred style in our codebase ... ```c++ static int doSomething(int foobar) /** \brief ... * \param foobar foo bar * \return return value */ { ... ``` Doxygen accepts this, although I don't know if it's specified/documented as such. https://github.com/llvm/llvm-project/pull/88367 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] [clang-tidy] support expect no diagnosis test (PR #91293)
https://github.com/HerrCai0907 updated https://github.com/llvm/llvm-project/pull/91293 >From 55aecbedf3e10207eaef1d4c7913086a32e16b1e Mon Sep 17 00:00:00 2001 From: Congcong Cai Date: Tue, 7 May 2024 10:55:45 +0800 Subject: [PATCH 1/2] [clang-tidy] support expect no diagnosis test --- .../test/clang-tidy/check_clang_tidy.py | 13 +++-- .../clang-tidy/checkers/misc/unused-using-decls.hpp | 6 ++ .../clang-tidy/checkers/misc/unused-using-decls.hxx | 6 -- 3 files changed, 17 insertions(+), 8 deletions(-) create mode 100644 clang-tools-extra/test/clang-tidy/checkers/misc/unused-using-decls.hpp delete mode 100644 clang-tools-extra/test/clang-tidy/checkers/misc/unused-using-decls.hxx diff --git a/clang-tools-extra/test/clang-tidy/check_clang_tidy.py b/clang-tools-extra/test/clang-tidy/check_clang_tidy.py index 6d4b466afa691a..d1cfe086fc968c 100755 --- a/clang-tools-extra/test/clang-tidy/check_clang_tidy.py +++ b/clang-tools-extra/test/clang-tidy/check_clang_tidy.py @@ -99,6 +99,7 @@ def __init__(self, args, extra_args): self.has_check_fixes = False self.has_check_messages = False self.has_check_notes = False +self.expect_no_diagnosis = args.expect_no_diagnosis self.export_fixes = args.export_fixes self.fixes = MessagePrefix("CHECK-FIXES") self.messages = MessagePrefix("CHECK-MESSAGES") @@ -225,6 +226,11 @@ def run_clang_tidy(self): print(diff_output) print("--") return clang_tidy_output + +def check_no_diagnosis(self, clang_tidy_output): +print(clang_tidy_output) +if clang_tidy_output != "": +sys.exit('expect no diagnosis') def check_fixes(self): if self.has_check_fixes: @@ -273,11 +279,13 @@ def check_notes(self, clang_tidy_output): def run(self): self.read_input() -if self.export_fixes is None: +if self.export_fixes is None and not self.expect_no_diagnosis: self.get_prefixes() self.prepare_test_inputs() clang_tidy_output = self.run_clang_tidy() -if self.export_fixes is None: +if self.expect_no_diagnosis: +self.check_no_diagnosis(clang_tidy_output) +elif self.export_fixes is None: self.check_fixes() self.check_messages(clang_tidy_output) self.check_notes(clang_tidy_output) @@ -310,6 +318,7 @@ def parse_arguments(): formatter_class=argparse.RawDescriptionHelpFormatter, ) parser.add_argument("-expect-clang-tidy-error", action="store_true") +parser.add_argument("-expect-no-diagnosis", action="store_true") parser.add_argument("-resource-dir") parser.add_argument("-assume-filename") parser.add_argument("input_file_name") diff --git a/clang-tools-extra/test/clang-tidy/checkers/misc/unused-using-decls.hpp b/clang-tools-extra/test/clang-tidy/checkers/misc/unused-using-decls.hpp new file mode 100644 index 00..ce37877a22ecab --- /dev/null +++ b/clang-tools-extra/test/clang-tidy/checkers/misc/unused-using-decls.hpp @@ -0,0 +1,6 @@ +// RUN: %check_clang_tidy %s misc-unused-using-decls -expect-no-diagnosis %t + +// Verify that we don't generate the warnings on header files. +namespace foo { class Foo {}; } + +using foo::Foo; diff --git a/clang-tools-extra/test/clang-tidy/checkers/misc/unused-using-decls.hxx b/clang-tools-extra/test/clang-tidy/checkers/misc/unused-using-decls.hxx deleted file mode 100644 index f15e4fae80c0bc..00 --- a/clang-tools-extra/test/clang-tidy/checkers/misc/unused-using-decls.hxx +++ /dev/null @@ -1,6 +0,0 @@ -// RUN: %check_clang_tidy %s misc-unused-using-decls %t -- --fix-notes -- -fno-delayed-template-parsing -isystem %S/Inputs - -// Verify that we don't generate the warnings on header files. -namespace foo { class Foo {}; } - -using foo::Foo; >From 2a5d18a739e56cbefbff40d49cc1546fcd4b82d4 Mon Sep 17 00:00:00 2001 From: Congcong Cai Date: Tue, 7 May 2024 13:32:29 +0800 Subject: [PATCH 2/2] format --- clang-tools-extra/test/clang-tidy/check_clang_tidy.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clang-tools-extra/test/clang-tidy/check_clang_tidy.py b/clang-tools-extra/test/clang-tidy/check_clang_tidy.py index d1cfe086fc968c..e87a53df299695 100755 --- a/clang-tools-extra/test/clang-tidy/check_clang_tidy.py +++ b/clang-tools-extra/test/clang-tidy/check_clang_tidy.py @@ -226,11 +226,11 @@ def run_clang_tidy(self): print(diff_output) print("--") return clang_tidy_output - + def check_no_diagnosis(self, clang_tidy_output): print(clang_tidy_output) if clang_tidy_output != "": -sys.exit('expect no diagnosis') +sys.exit("expect no diagnosis") def check_fixes(self): if se
[clang] ad9f38d - [NFC] Fix Modules/no-transitive-source-location-change.cppm after dfa7ff97b2
Author: Chuanqi Xu Date: 2024-05-07T13:25:42+08:00 New Revision: ad9f38d0e3a5e7e06c39dbd7da88a921a49aa805 URL: https://github.com/llvm/llvm-project/commit/ad9f38d0e3a5e7e06c39dbd7da88a921a49aa805 DIFF: https://github.com/llvm/llvm-project/commit/ad9f38d0e3a5e7e06c39dbd7da88a921a49aa805.diff LOG: [NFC] Fix Modules/no-transitive-source-location-change.cppm after dfa7ff97b2 The test fails after dfa7ff97b2. I didn't find this locally due to cache. Added: Modified: clang/test/Modules/no-transitive-source-location-change.cppm Removed: diff --git a/clang/test/Modules/no-transitive-source-location-change.cppm b/clang/test/Modules/no-transitive-source-location-change.cppm index c9d156a74ce822..2a84ef6a912f54 100644 --- a/clang/test/Modules/no-transitive-source-location-change.cppm +++ b/clang/test/Modules/no-transitive-source-location-change.cppm @@ -1,6 +1,9 @@ // Testing that adding a new line in a module interface unit won't cause the BMI // of consuming module unit changes. // +// RUN: rm -rf %t +// RUN: split-file %s %t +// // RUN: %clang_cc1 -std=c++20 %t/A.cppm -emit-reduced-module-interface -o %t/A.pcm // RUN: %clang_cc1 -std=c++20 %t/A.v1.cppm -emit-reduced-module-interface -o %t/A.v1.pcm // ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [openmp] [PGO][OpenMP] Instrumentation for GPU devices (PR #76587)
https://github.com/EthanLuisMcDonough updated https://github.com/llvm/llvm-project/pull/76587 >From 530eb982b9770190377bb0bd09c5cb715f34d484 Mon Sep 17 00:00:00 2001 From: Ethan Luis McDonough Date: Fri, 15 Dec 2023 20:38:38 -0600 Subject: [PATCH 01/18] Add profiling functions to libomptarget --- .../include/llvm/Frontend/OpenMP/OMPKinds.def | 3 +++ openmp/libomptarget/DeviceRTL/CMakeLists.txt | 2 ++ .../DeviceRTL/include/Profiling.h | 21 +++ .../libomptarget/DeviceRTL/src/Profiling.cpp | 19 + 4 files changed, 45 insertions(+) create mode 100644 openmp/libomptarget/DeviceRTL/include/Profiling.h create mode 100644 openmp/libomptarget/DeviceRTL/src/Profiling.cpp diff --git a/llvm/include/llvm/Frontend/OpenMP/OMPKinds.def b/llvm/include/llvm/Frontend/OpenMP/OMPKinds.def index d22d2a8e948b0..1d887d5cb5812 100644 --- a/llvm/include/llvm/Frontend/OpenMP/OMPKinds.def +++ b/llvm/include/llvm/Frontend/OpenMP/OMPKinds.def @@ -503,6 +503,9 @@ __OMP_RTL(__kmpc_barrier_simple_generic, false, Void, IdentPtr, Int32) __OMP_RTL(__kmpc_warp_active_thread_mask, false, Int64,) __OMP_RTL(__kmpc_syncwarp, false, Void, Int64) +__OMP_RTL(__llvm_profile_register_function, false, Void, VoidPtr) +__OMP_RTL(__llvm_profile_register_names_function, false, Void, VoidPtr, Int64) + __OMP_RTL(__last, false, Void, ) #undef __OMP_RTL diff --git a/openmp/libomptarget/DeviceRTL/CMakeLists.txt b/openmp/libomptarget/DeviceRTL/CMakeLists.txt index 1ce3e1e40a80a..55ee15d068c67 100644 --- a/openmp/libomptarget/DeviceRTL/CMakeLists.txt +++ b/openmp/libomptarget/DeviceRTL/CMakeLists.txt @@ -89,6 +89,7 @@ set(include_files ${include_directory}/Interface.h ${include_directory}/LibC.h ${include_directory}/Mapping.h + ${include_directory}/Profiling.h ${include_directory}/State.h ${include_directory}/Synchronization.h ${include_directory}/Types.h @@ -104,6 +105,7 @@ set(src_files ${source_directory}/Mapping.cpp ${source_directory}/Misc.cpp ${source_directory}/Parallelism.cpp + ${source_directory}/Profiling.cpp ${source_directory}/Reduction.cpp ${source_directory}/State.cpp ${source_directory}/Synchronization.cpp diff --git a/openmp/libomptarget/DeviceRTL/include/Profiling.h b/openmp/libomptarget/DeviceRTL/include/Profiling.h new file mode 100644 index 0..68c7744cd6075 --- /dev/null +++ b/openmp/libomptarget/DeviceRTL/include/Profiling.h @@ -0,0 +1,21 @@ +//=== Profiling.h - OpenMP interface -- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// +// +// +//===--===// + +#ifndef OMPTARGET_DEVICERTL_PROFILING_H +#define OMPTARGET_DEVICERTL_PROFILING_H + +extern "C" { + +void __llvm_profile_register_function(void *ptr); +void __llvm_profile_register_names_function(void *ptr, long int i); +} + +#endif diff --git a/openmp/libomptarget/DeviceRTL/src/Profiling.cpp b/openmp/libomptarget/DeviceRTL/src/Profiling.cpp new file mode 100644 index 0..799477f5e47d2 --- /dev/null +++ b/openmp/libomptarget/DeviceRTL/src/Profiling.cpp @@ -0,0 +1,19 @@ +//===--- Profiling.cpp C++ ---===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// + +#include "Profiling.h" + +#pragma omp begin declare target device_type(nohost) + +extern "C" { + +void __llvm_profile_register_function(void *ptr) {} +void __llvm_profile_register_names_function(void *ptr, long int i) {} +} + +#pragma omp end declare target >From fb067d4ffe604fd68cf90b705db1942bce49dbb1 Mon Sep 17 00:00:00 2001 From: Ethan Luis McDonough Date: Sat, 16 Dec 2023 01:18:41 -0600 Subject: [PATCH 02/18] Fix PGO instrumentation for GPU targets --- clang/lib/CodeGen/CodeGenPGO.cpp | 10 -- .../lib/Transforms/Instrumentation/InstrProfiling.cpp | 11 --- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/clang/lib/CodeGen/CodeGenPGO.cpp b/clang/lib/CodeGen/CodeGenPGO.cpp index 81bf8ea696b16..edae6885b528a 100644 --- a/clang/lib/CodeGen/CodeGenPGO.cpp +++ b/clang/lib/CodeGen/CodeGenPGO.cpp @@ -959,8 +959,14 @@ void CodeGenPGO::emitCounterIncrement(CGBuilderTy &Builder, const Stmt *S, unsigned Counter = (*RegionCounterMap)[S]; - llvm::Value *Args[] = {FuncNameVar, - Builder.getInt64(FunctionHash), + // Make sure that pointer to global is passed in with zero addrspace + // This is re
[clang] [analyzer] MallocChecker: Recognize std::atomics in smart pointer suppression. (PR #90918)
@@ -3479,13 +3479,24 @@ PathDiagnosticPieceRef MallocBugVisitor::VisitNode(const ExplodedNode *N, // original reference count is positive, we should not report use-after-frees // on objects deleted in such destructors. This can probably be improved // through better shared pointer modeling. - if (ReleaseDestructorLC) { + if (ReleaseDestructorLC && (ReleaseDestructorLC == CurrentLC || + ReleaseDestructorLC->isParentOf(CurrentLC))) { if (const auto *AE = dyn_cast(S)) { + // Check for manual use of atomic builtins. AtomicExpr::AtomicOp Op = AE->getOp(); if (Op == AtomicExpr::AO__c11_atomic_fetch_add || Op == AtomicExpr::AO__c11_atomic_fetch_sub) { -if (ReleaseDestructorLC == CurrentLC || -ReleaseDestructorLC->isParentOf(CurrentLC)) { +BR.markInvalid(getTag(), S); + } +} else if (const auto *CE = dyn_cast(S)) { + // Check for `std::atomic` and such. This covers both regular method calls + // and operator calls. + if (const auto *MD = + dyn_cast_or_null(CE->getDirectCallee())) { +const CXXRecordDecl *RD = MD->getParent(); +// A bit wobbly with ".contains()" because it may be like +// "__atomic_base" or something. +if (StringRef(RD->getNameAsString()).contains("atomic")) { steakhal wrote: Makes sense. https://github.com/llvm/llvm-project/pull/90918 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] [clangd] Support callHierarchy/outgoingCalls (PR #91191)
HighCommander4 wrote: If I'm understanding correctly, the implementation approach in this PR only finds callees in the current translation unit. The approach in #77556 uses the project's index to find callees across translation unit boundaries. Regarding reviews: yes, it seems quite unfortunate that the original developers seem to have largely moved on to other things. I will do my best to make some progress of the project's review backlog (including in particular https://github.com/llvm/llvm-project/pull/86629 and https://github.com/llvm/llvm-project/pull/67802) as time permits. https://github.com/llvm/llvm-project/pull/91191 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] dfa7ff9 - [C++20] [Modules] [Reduced BMI] Combine the signature of used modules
Author: Chuanqi Xu Date: 2024-05-07T11:41:08+08:00 New Revision: dfa7ff97b24dc5a3dd714b45af288812c13d0110 URL: https://github.com/llvm/llvm-project/commit/dfa7ff97b24dc5a3dd714b45af288812c13d0110 DIFF: https://github.com/llvm/llvm-project/commit/dfa7ff97b24dc5a3dd714b45af288812c13d0110.diff LOG: [C++20] [Modules] [Reduced BMI] Combine the signature of used modules into the current module Following of https://github.com/llvm/llvm-project/pull/86912. After https://github.com/llvm/llvm-project/pull/86912, with reduced BMI, the BMI can keep unchange if the dependent modules only changes the implementation (without introduing new decls). However, this is not strictly correct. For example: ``` // a.cppm export module a; export inline int a() { ... } // b.cppm export module b; import a; export inline int b() { return a(); } ``` Since both `a()` and `b()` are inline, we need to make sure the BMI of `b.pcm` will change after the implementation of `a()` changes. We can't get that naturally since we won't record the body of `a()` during the writing process. We can't reuse ODRHash here since ODRHash won't calculate the called function recursively. So ODRHash will be problematic if `a()` calls other inline functions. Probably we can solve this by a new hash mechanism. But the safety and efficiency may a problem too. Here we just combine the hash value of the used modules conservatively. Added: clang/test/Modules/function-transitive-change.cppm Modified: clang/include/clang/Serialization/ASTWriter.h clang/lib/Serialization/ASTWriter.cpp clang/test/Modules/no-transitive-source-location-change.cppm Removed: diff --git a/clang/include/clang/Serialization/ASTWriter.h b/clang/include/clang/Serialization/ASTWriter.h index 6847c1db39c8ac..482e9dd168cc3d 100644 --- a/clang/include/clang/Serialization/ASTWriter.h +++ b/clang/include/clang/Serialization/ASTWriter.h @@ -357,6 +357,13 @@ class ASTWriter : public ASTDeserializationListener, /// contexts. llvm::DenseMap AnonymousDeclarationNumbers; + /// The external top level module during the writing process. Used to + /// generate signature for the module file being written. + /// + /// Only meaningful for standard C++ named modules. See the comments in + /// createSignatureForNamedModule() for details. + llvm::DenseSet TouchedTopLevelModules; + /// An update to a Decl. class DeclUpdate { /// A DeclUpdateKind. diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp index 8a0116fa893247..42da50abdc687c 100644 --- a/clang/lib/Serialization/ASTWriter.cpp +++ b/clang/lib/Serialization/ASTWriter.cpp @@ -1200,6 +1200,31 @@ ASTFileSignature ASTWriter::createSignatureForNamedModule() const { for (auto [ExportImported, _] : WritingModule->Exports) Hasher.update(ExportImported->Signature); + // We combine all the used modules to make sure the signature is precise. + // Consider the case like: + // + // // a.cppm + // export module a; + // export inline int a() { ... } + // + // // b.cppm + // export module b; + // import a; + // export inline int b() { return a(); } + // + // Since both `a()` and `b()` are inline, we need to make sure the BMI of + // `b.pcm` will change after the implementation of `a()` changes. We can't + // get that naturally since we won't record the body of `a()` during the + // writing process. We can't reuse ODRHash here since ODRHash won't calculate + // the called function recursively. So ODRHash will be problematic if `a()` + // calls other inline functions. + // + // Probably we can solve this by a new hash mechanism. But the safety and + // efficiency may a problem too. Here we just combine the hash value of the + // used modules conservatively. + for (Module *M : TouchedTopLevelModules) +Hasher.update(M->Signature); + return ASTFileSignature::create(Hasher.result()); } @@ -6112,8 +6137,12 @@ LocalDeclID ASTWriter::GetDeclRef(const Decl *D) { // If D comes from an AST file, its declaration ID is already known and // fixed. - if (D->isFromASTFile()) + if (D->isFromASTFile()) { +if (isWritingStdCXXNamedModules() && D->getOwningModule()) + TouchedTopLevelModules.insert(D->getOwningModule()->getTopLevelModule()); + return LocalDeclID(D->getGlobalID()); + } assert(!(reinterpret_cast(D) & 0x01) && "Invalid decl pointer"); LocalDeclID &ID = DeclIDs[D]; diff --git a/clang/test/Modules/function-transitive-change.cppm b/clang/test/Modules/function-transitive-change.cppm new file mode 100644 index 00..cfce669e3a7bc2 --- /dev/null +++ b/clang/test/Modules/function-transitive-change.cppm @@ -0,0 +1,94 @@ +// Test that, in C++20 modules reduced BMI, the implementation detail changes +// in non-inline function may not propagate while the inline function changes +// can get propagate. +// +// RUN: rm -rf
[clang] [Arm64EC] Fix compilation of arm_acle.h (PR #91281)
https://github.com/efriedma-quic closed https://github.com/llvm/llvm-project/pull/91281 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 4cce9fb - [Arm64EC] Fix compilation of arm_acle.h (#91281)
Author: Eli Friedman Date: 2024-05-06T20:04:55-07:00 New Revision: 4cce9fbb4e086170f69bfc8766f9613673b441c9 URL: https://github.com/llvm/llvm-project/commit/4cce9fbb4e086170f69bfc8766f9613673b441c9 DIFF: https://github.com/llvm/llvm-project/commit/4cce9fbb4e086170f69bfc8766f9613673b441c9.diff LOG: [Arm64EC] Fix compilation of arm_acle.h (#91281) Added: Modified: clang/lib/Headers/arm_acle.h clang/test/Headers/arm-acle-header.c Removed: diff --git a/clang/lib/Headers/arm_acle.h b/clang/lib/Headers/arm_acle.h index 6e557eda1dddca..5785954c9171ab 100644 --- a/clang/lib/Headers/arm_acle.h +++ b/clang/lib/Headers/arm_acle.h @@ -109,7 +109,7 @@ __swp(uint32_t __x, volatile uint32_t *__p) { #endif /* 7.7 NOP */ -#if !defined(_MSC_VER) || !defined(__aarch64__) +#if !defined(_MSC_VER) || (!defined(__aarch64__) && !defined(__arm64ec__)) static __inline__ void __attribute__((__always_inline__, __nodebug__)) __nop(void) { __builtin_arm_nop(); } diff --git a/clang/test/Headers/arm-acle-header.c b/clang/test/Headers/arm-acle-header.c index f04c7e1f0f35f7..fea8472183c871 100644 --- a/clang/test/Headers/arm-acle-header.c +++ b/clang/test/Headers/arm-acle-header.c @@ -7,6 +7,7 @@ // RUN: %clang_cc1 -x c++ -triple thumbv7-windows -target-cpu cortex-a15 -fsyntax-only -ffreestanding -fms-extensions -fms-compatibility -fms-compatibility-version=19.11 %s // RUN: %clang_cc1 -x c++ -triple aarch64-windows -target-cpu cortex-a53 -fsyntax-only -ffreestanding -fms-extensions -fms-compatibility -fms-compatibility-version=19.11 %s // RUN: %clang_cc1 -x c++ -triple arm64-apple-ios -target-cpu apple-a7 -fsyntax-only -ffreestanding -fms-extensions %s +// RUN: %clang_cc1 -x c++ -triple arm64ec-windows -target-cpu cortex-a53 -fsyntax-only -ffreestanding -fms-extensions -fms-compatibility -fms-compatibility-version=19.11 %s // expected-no-diagnostics #include ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] f9d7619 - [ASTContext] Profile Dependently-sized array types that do not have a specified number
Author: Chuanqi Xu Date: 2024-05-07T10:59:34+08:00 New Revision: f9d76197ff0099502cf001abe3f5310c5bc4532d URL: https://github.com/llvm/llvm-project/commit/f9d76197ff0099502cf001abe3f5310c5bc4532d DIFF: https://github.com/llvm/llvm-project/commit/f9d76197ff0099502cf001abe3f5310c5bc4532d.diff LOG: [ASTContext] Profile Dependently-sized array types that do not have a specified number of elements Close https://github.com/llvm/llvm-project/issues/91105 The root reason for the issue is that we always generate the dependently-sized array types which don't specify a number of elements. The original comment says: > We do no canonicalization here at all, which is okay > because they can't be used in most locations. But now we find the locations. Added: clang/test/Modules/pr91105.cppm Modified: clang/lib/AST/ASTContext.cpp clang/lib/AST/Type.cpp Removed: diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index 5f96e86f803a80..91e7a5f67a93d3 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -3797,33 +3797,33 @@ QualType ASTContext::getDependentSizedArrayType(QualType elementType, numElements->isValueDependent()) && "Size must be type- or value-dependent!"); + SplitQualType canonElementType = getCanonicalType(elementType).split(); + + void *insertPos = nullptr; + llvm::FoldingSetNodeID ID; + DependentSizedArrayType::Profile( + ID, *this, numElements ? QualType(canonElementType.Ty, 0) : elementType, + ASM, elementTypeQuals, numElements); + + // Look for an existing type with these properties. + DependentSizedArrayType *canonTy = +DependentSizedArrayTypes.FindNodeOrInsertPos(ID, insertPos); + // Dependently-sized array types that do not have a specified number // of elements will have their sizes deduced from a dependent - // initializer. We do no canonicalization here at all, which is okay - // because they can't be used in most locations. + // initializer. if (!numElements) { +if (canonTy) + return QualType(canonTy, 0); + auto *newType = new (*this, alignof(DependentSizedArrayType)) DependentSizedArrayType(elementType, QualType(), numElements, ASM, elementTypeQuals, brackets); +DependentSizedArrayTypes.InsertNode(newType, insertPos); Types.push_back(newType); return QualType(newType, 0); } - // Otherwise, we actually build a new type every time, but we - // also build a canonical type. - - SplitQualType canonElementType = getCanonicalType(elementType).split(); - - void *insertPos = nullptr; - llvm::FoldingSetNodeID ID; - DependentSizedArrayType::Profile(ID, *this, - QualType(canonElementType.Ty, 0), - ASM, elementTypeQuals, numElements); - - // Look for an existing type with these properties. - DependentSizedArrayType *canonTy = -DependentSizedArrayTypes.FindNodeOrInsertPos(ID, insertPos); - // If we don't have one, build one. if (!canonTy) { canonTy = new (*this, alignof(DependentSizedArrayType)) diff --git a/clang/lib/AST/Type.cpp b/clang/lib/AST/Type.cpp index 2385c5e02cb269..e31741cd44240d 100644 --- a/clang/lib/AST/Type.cpp +++ b/clang/lib/AST/Type.cpp @@ -256,7 +256,8 @@ void DependentSizedArrayType::Profile(llvm::FoldingSetNodeID &ID, ID.AddPointer(ET.getAsOpaquePtr()); ID.AddInteger(llvm::to_underlying(SizeMod)); ID.AddInteger(TypeQuals); - E->Profile(ID, Context, true); + if (E) +E->Profile(ID, Context, true); } DependentVectorType::DependentVectorType(QualType ElementType, diff --git a/clang/test/Modules/pr91105.cppm b/clang/test/Modules/pr91105.cppm new file mode 100644 index 00..0873962c3773ca --- /dev/null +++ b/clang/test/Modules/pr91105.cppm @@ -0,0 +1,47 @@ +// RUN: rm -rf %t +// RUN: mkdir -p %t +// RUN: split-file %s %t +// +// RUN: %clang_cc1 -std=c++20 %t/bar.cppm -emit-module-interface -o %t/bar.pcm +// RUN: %clang_cc1 -std=c++20 %t/foo.cc -fmodule-file=bar=%t/bar.pcm -fsyntax-only -verify +// +// RUN: %clang_cc1 -std=c++20 -fskip-odr-check-in-gmf %t/bar.cppm -emit-module-interface \ +// RUN: -o %t/bar.pcm +// RUN: %clang_cc1 -std=c++20 -fskip-odr-check-in-gmf %t/foo.cc \ +// RUN: -fmodule-file=bar=%t/bar.pcm -fsyntax-only -verify +// +// RUN: %clang_cc1 -std=c++20 %t/bar.cppm -emit-reduced-module-interface -o %t/bar.pcm +// RUN: %clang_cc1 -std=c++20 %t/foo.cc -fmodule-file=bar=%t/bar.pcm -fsyntax-only -verify +// +// RUN: %clang_cc1 -std=c++20 -fskip-odr-check-in-gmf %t/bar.cppm -emit-reduced-module-interface \ +// RUN: -o %t/bar.pcm +// RUN: %clang_cc1 -std=c++20 -fskip-odr-check-in-gmf %t/foo.cc \ +// RUN: -fmodule-file=bar=%t/bar.pcm -fsyntax-only -verify + +//--- h.hpp +#pragma once + +struct T { +constexpr T(const char *) {} +}; +template +struc
[clang-tools-extra] [clang-tidy] support expect no diagnosis test (PR #91293)
github-actions[bot] wrote: :warning: Python code formatter, darker found issues in your code. :warning: You can test this locally with the following command: ``bash darker --check --diff -r ddecadabebdd4b301bd65534b58009e57ac1bbe5...55aecbedf3e10207eaef1d4c7913086a32e16b1e clang-tools-extra/test/clang-tidy/check_clang_tidy.py `` View the diff from darker here. ``diff --- check_clang_tidy.py 2024-05-07 02:55:45.00 + +++ check_clang_tidy.py 2024-05-07 02:58:50.584570 + @@ -224,15 +224,15 @@ ) print("-- Fixes -") print(diff_output) print("--") return clang_tidy_output - + def check_no_diagnosis(self, clang_tidy_output): print(clang_tidy_output) if clang_tidy_output != "": -sys.exit('expect no diagnosis') +sys.exit("expect no diagnosis") def check_fixes(self): if self.has_check_fixes: try_run( [ `` https://github.com/llvm/llvm-project/pull/91293 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] [clang-tidy] support expect no diagnosis test (PR #91293)
llvmbot wrote: @llvm/pr-subscribers-clang-tools-extra Author: Congcong Cai (HerrCai0907) Changes --- Full diff: https://github.com/llvm/llvm-project/pull/91293.diff 3 Files Affected: - (modified) clang-tools-extra/test/clang-tidy/check_clang_tidy.py (+11-2) - (added) clang-tools-extra/test/clang-tidy/checkers/misc/unused-using-decls.hpp (+6) - (removed) clang-tools-extra/test/clang-tidy/checkers/misc/unused-using-decls.hxx (-6) ``diff diff --git a/clang-tools-extra/test/clang-tidy/check_clang_tidy.py b/clang-tools-extra/test/clang-tidy/check_clang_tidy.py index 6d4b466afa691a..d1cfe086fc968c 100755 --- a/clang-tools-extra/test/clang-tidy/check_clang_tidy.py +++ b/clang-tools-extra/test/clang-tidy/check_clang_tidy.py @@ -99,6 +99,7 @@ def __init__(self, args, extra_args): self.has_check_fixes = False self.has_check_messages = False self.has_check_notes = False +self.expect_no_diagnosis = args.expect_no_diagnosis self.export_fixes = args.export_fixes self.fixes = MessagePrefix("CHECK-FIXES") self.messages = MessagePrefix("CHECK-MESSAGES") @@ -225,6 +226,11 @@ def run_clang_tidy(self): print(diff_output) print("--") return clang_tidy_output + +def check_no_diagnosis(self, clang_tidy_output): +print(clang_tidy_output) +if clang_tidy_output != "": +sys.exit('expect no diagnosis') def check_fixes(self): if self.has_check_fixes: @@ -273,11 +279,13 @@ def check_notes(self, clang_tidy_output): def run(self): self.read_input() -if self.export_fixes is None: +if self.export_fixes is None and not self.expect_no_diagnosis: self.get_prefixes() self.prepare_test_inputs() clang_tidy_output = self.run_clang_tidy() -if self.export_fixes is None: +if self.expect_no_diagnosis: +self.check_no_diagnosis(clang_tidy_output) +elif self.export_fixes is None: self.check_fixes() self.check_messages(clang_tidy_output) self.check_notes(clang_tidy_output) @@ -310,6 +318,7 @@ def parse_arguments(): formatter_class=argparse.RawDescriptionHelpFormatter, ) parser.add_argument("-expect-clang-tidy-error", action="store_true") +parser.add_argument("-expect-no-diagnosis", action="store_true") parser.add_argument("-resource-dir") parser.add_argument("-assume-filename") parser.add_argument("input_file_name") diff --git a/clang-tools-extra/test/clang-tidy/checkers/misc/unused-using-decls.hpp b/clang-tools-extra/test/clang-tidy/checkers/misc/unused-using-decls.hpp new file mode 100644 index 00..ce37877a22ecab --- /dev/null +++ b/clang-tools-extra/test/clang-tidy/checkers/misc/unused-using-decls.hpp @@ -0,0 +1,6 @@ +// RUN: %check_clang_tidy %s misc-unused-using-decls -expect-no-diagnosis %t + +// Verify that we don't generate the warnings on header files. +namespace foo { class Foo {}; } + +using foo::Foo; diff --git a/clang-tools-extra/test/clang-tidy/checkers/misc/unused-using-decls.hxx b/clang-tools-extra/test/clang-tidy/checkers/misc/unused-using-decls.hxx deleted file mode 100644 index f15e4fae80c0bc..00 --- a/clang-tools-extra/test/clang-tidy/checkers/misc/unused-using-decls.hxx +++ /dev/null @@ -1,6 +0,0 @@ -// RUN: %check_clang_tidy %s misc-unused-using-decls %t -- --fix-notes -- -fno-delayed-template-parsing -isystem %S/Inputs - -// Verify that we don't generate the warnings on header files. -namespace foo { class Foo {}; } - -using foo::Foo; `` https://github.com/llvm/llvm-project/pull/91293 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] [clang-tidy] support expect no diagnosis test (PR #91293)
llvmbot wrote: @llvm/pr-subscribers-clang-tidy Author: Congcong Cai (HerrCai0907) Changes --- Full diff: https://github.com/llvm/llvm-project/pull/91293.diff 3 Files Affected: - (modified) clang-tools-extra/test/clang-tidy/check_clang_tidy.py (+11-2) - (added) clang-tools-extra/test/clang-tidy/checkers/misc/unused-using-decls.hpp (+6) - (removed) clang-tools-extra/test/clang-tidy/checkers/misc/unused-using-decls.hxx (-6) ``diff diff --git a/clang-tools-extra/test/clang-tidy/check_clang_tidy.py b/clang-tools-extra/test/clang-tidy/check_clang_tidy.py index 6d4b466afa691a..d1cfe086fc968c 100755 --- a/clang-tools-extra/test/clang-tidy/check_clang_tidy.py +++ b/clang-tools-extra/test/clang-tidy/check_clang_tidy.py @@ -99,6 +99,7 @@ def __init__(self, args, extra_args): self.has_check_fixes = False self.has_check_messages = False self.has_check_notes = False +self.expect_no_diagnosis = args.expect_no_diagnosis self.export_fixes = args.export_fixes self.fixes = MessagePrefix("CHECK-FIXES") self.messages = MessagePrefix("CHECK-MESSAGES") @@ -225,6 +226,11 @@ def run_clang_tidy(self): print(diff_output) print("--") return clang_tidy_output + +def check_no_diagnosis(self, clang_tidy_output): +print(clang_tidy_output) +if clang_tidy_output != "": +sys.exit('expect no diagnosis') def check_fixes(self): if self.has_check_fixes: @@ -273,11 +279,13 @@ def check_notes(self, clang_tidy_output): def run(self): self.read_input() -if self.export_fixes is None: +if self.export_fixes is None and not self.expect_no_diagnosis: self.get_prefixes() self.prepare_test_inputs() clang_tidy_output = self.run_clang_tidy() -if self.export_fixes is None: +if self.expect_no_diagnosis: +self.check_no_diagnosis(clang_tidy_output) +elif self.export_fixes is None: self.check_fixes() self.check_messages(clang_tidy_output) self.check_notes(clang_tidy_output) @@ -310,6 +318,7 @@ def parse_arguments(): formatter_class=argparse.RawDescriptionHelpFormatter, ) parser.add_argument("-expect-clang-tidy-error", action="store_true") +parser.add_argument("-expect-no-diagnosis", action="store_true") parser.add_argument("-resource-dir") parser.add_argument("-assume-filename") parser.add_argument("input_file_name") diff --git a/clang-tools-extra/test/clang-tidy/checkers/misc/unused-using-decls.hpp b/clang-tools-extra/test/clang-tidy/checkers/misc/unused-using-decls.hpp new file mode 100644 index 00..ce37877a22ecab --- /dev/null +++ b/clang-tools-extra/test/clang-tidy/checkers/misc/unused-using-decls.hpp @@ -0,0 +1,6 @@ +// RUN: %check_clang_tidy %s misc-unused-using-decls -expect-no-diagnosis %t + +// Verify that we don't generate the warnings on header files. +namespace foo { class Foo {}; } + +using foo::Foo; diff --git a/clang-tools-extra/test/clang-tidy/checkers/misc/unused-using-decls.hxx b/clang-tools-extra/test/clang-tidy/checkers/misc/unused-using-decls.hxx deleted file mode 100644 index f15e4fae80c0bc..00 --- a/clang-tools-extra/test/clang-tidy/checkers/misc/unused-using-decls.hxx +++ /dev/null @@ -1,6 +0,0 @@ -// RUN: %check_clang_tidy %s misc-unused-using-decls %t -- --fix-notes -- -fno-delayed-template-parsing -isystem %S/Inputs - -// Verify that we don't generate the warnings on header files. -namespace foo { class Foo {}; } - -using foo::Foo; `` https://github.com/llvm/llvm-project/pull/91293 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] [clang-tidy] support expect no diagnosis test (PR #91293)
https://github.com/HerrCai0907 created https://github.com/llvm/llvm-project/pull/91293 None >From 55aecbedf3e10207eaef1d4c7913086a32e16b1e Mon Sep 17 00:00:00 2001 From: Congcong Cai Date: Tue, 7 May 2024 10:55:45 +0800 Subject: [PATCH] [clang-tidy] support expect no diagnosis test --- .../test/clang-tidy/check_clang_tidy.py | 13 +++-- .../clang-tidy/checkers/misc/unused-using-decls.hpp | 6 ++ .../clang-tidy/checkers/misc/unused-using-decls.hxx | 6 -- 3 files changed, 17 insertions(+), 8 deletions(-) create mode 100644 clang-tools-extra/test/clang-tidy/checkers/misc/unused-using-decls.hpp delete mode 100644 clang-tools-extra/test/clang-tidy/checkers/misc/unused-using-decls.hxx diff --git a/clang-tools-extra/test/clang-tidy/check_clang_tidy.py b/clang-tools-extra/test/clang-tidy/check_clang_tidy.py index 6d4b466afa691a..d1cfe086fc968c 100755 --- a/clang-tools-extra/test/clang-tidy/check_clang_tidy.py +++ b/clang-tools-extra/test/clang-tidy/check_clang_tidy.py @@ -99,6 +99,7 @@ def __init__(self, args, extra_args): self.has_check_fixes = False self.has_check_messages = False self.has_check_notes = False +self.expect_no_diagnosis = args.expect_no_diagnosis self.export_fixes = args.export_fixes self.fixes = MessagePrefix("CHECK-FIXES") self.messages = MessagePrefix("CHECK-MESSAGES") @@ -225,6 +226,11 @@ def run_clang_tidy(self): print(diff_output) print("--") return clang_tidy_output + +def check_no_diagnosis(self, clang_tidy_output): +print(clang_tidy_output) +if clang_tidy_output != "": +sys.exit('expect no diagnosis') def check_fixes(self): if self.has_check_fixes: @@ -273,11 +279,13 @@ def check_notes(self, clang_tidy_output): def run(self): self.read_input() -if self.export_fixes is None: +if self.export_fixes is None and not self.expect_no_diagnosis: self.get_prefixes() self.prepare_test_inputs() clang_tidy_output = self.run_clang_tidy() -if self.export_fixes is None: +if self.expect_no_diagnosis: +self.check_no_diagnosis(clang_tidy_output) +elif self.export_fixes is None: self.check_fixes() self.check_messages(clang_tidy_output) self.check_notes(clang_tidy_output) @@ -310,6 +318,7 @@ def parse_arguments(): formatter_class=argparse.RawDescriptionHelpFormatter, ) parser.add_argument("-expect-clang-tidy-error", action="store_true") +parser.add_argument("-expect-no-diagnosis", action="store_true") parser.add_argument("-resource-dir") parser.add_argument("-assume-filename") parser.add_argument("input_file_name") diff --git a/clang-tools-extra/test/clang-tidy/checkers/misc/unused-using-decls.hpp b/clang-tools-extra/test/clang-tidy/checkers/misc/unused-using-decls.hpp new file mode 100644 index 00..ce37877a22ecab --- /dev/null +++ b/clang-tools-extra/test/clang-tidy/checkers/misc/unused-using-decls.hpp @@ -0,0 +1,6 @@ +// RUN: %check_clang_tidy %s misc-unused-using-decls -expect-no-diagnosis %t + +// Verify that we don't generate the warnings on header files. +namespace foo { class Foo {}; } + +using foo::Foo; diff --git a/clang-tools-extra/test/clang-tidy/checkers/misc/unused-using-decls.hxx b/clang-tools-extra/test/clang-tidy/checkers/misc/unused-using-decls.hxx deleted file mode 100644 index f15e4fae80c0bc..00 --- a/clang-tools-extra/test/clang-tidy/checkers/misc/unused-using-decls.hxx +++ /dev/null @@ -1,6 +0,0 @@ -// RUN: %check_clang_tidy %s misc-unused-using-decls %t -- --fix-notes -- -fno-delayed-template-parsing -isystem %S/Inputs - -// Verify that we don't generate the warnings on header files. -namespace foo { class Foo {}; } - -using foo::Foo; ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang-format] Handle Java switch expressions (PR #91112)
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/91112 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 236b3e1 - [clang-format] Handle Java switch expressions (#91112)
Author: Owen Pan Date: 2024-05-06T19:55:55-07:00 New Revision: 236b3e1aad45e2bab8ede0da6397b7b01f9cc9d8 URL: https://github.com/llvm/llvm-project/commit/236b3e1aad45e2bab8ede0da6397b7b01f9cc9d8 DIFF: https://github.com/llvm/llvm-project/commit/236b3e1aad45e2bab8ede0da6397b7b01f9cc9d8.diff LOG: [clang-format] Handle Java switch expressions (#91112) Also adds AllowShortCaseExpressionOnASingleLine option and AlignCaseArrows suboption of AlignConsecutiveShortCaseStatements. Fixes #55903. Added: Modified: clang/docs/ClangFormatStyleOptions.rst clang/docs/ReleaseNotes.rst clang/include/clang/Format/Format.h clang/lib/Format/Format.cpp clang/lib/Format/FormatToken.h clang/lib/Format/TokenAnnotator.cpp clang/lib/Format/UnwrappedLineFormatter.cpp clang/lib/Format/UnwrappedLineParser.cpp clang/lib/Format/UnwrappedLineParser.h clang/lib/Format/WhitespaceManager.cpp clang/lib/Format/WhitespaceManager.h clang/unittests/Format/ConfigParseTest.cpp clang/unittests/Format/FormatTestJava.cpp clang/unittests/Format/TokenAnnotatorTest.cpp Removed: diff --git a/clang/docs/ClangFormatStyleOptions.rst b/clang/docs/ClangFormatStyleOptions.rst index ce9035a2770eec..6d092219877f91 100644 --- a/clang/docs/ClangFormatStyleOptions.rst +++ b/clang/docs/ClangFormatStyleOptions.rst @@ -861,7 +861,8 @@ the configuration (without a prefix: ``Auto``). **AlignConsecutiveShortCaseStatements** (``ShortCaseStatementsAlignmentStyle``) :versionbadge:`clang-format 17` :ref:`¶ ` Style of aligning consecutive short case labels. - Only applies if ``AllowShortCaseLabelsOnASingleLine`` is ``true``. + Only applies if ``AllowShortCaseExpressionOnASingleLine`` or + ``AllowShortCaseLabelsOnASingleLine`` is ``true``. .. code-block:: yaml @@ -935,6 +936,24 @@ the configuration (without a prefix: ``Auto``). default: return ""; } + * ``bool AlignCaseArrows`` Whether to align the case arrows when aligning short case expressions. + +.. code-block:: java + + true: + i = switch (day) { +case THURSDAY, SATURDAY -> 8; +case WEDNESDAY -> 9; +default -> 0; + }; + + false: + i = switch (day) { +case THURSDAY, SATURDAY -> 8; +case WEDNESDAY -> 9; +default -> 0; + }; + * ``bool AlignCaseColons`` Whether aligned case labels are aligned on the colon, or on the tokens after the colon. @@ -1692,6 +1711,21 @@ the configuration (without a prefix: ``Auto``). +.. _AllowShortCaseExpressionOnASingleLine: + +**AllowShortCaseExpressionOnASingleLine** (``Boolean``) :versionbadge:`clang-format 19` :ref:`¶ ` + Whether to merge a short switch labeled rule into a single line. + + .. code-block:: java + +true: false: +switch (a) { vs. switch (a) { +case 1 -> 1;case 1 -> +default -> 0; 1; +}; default -> + 0; +}; + .. _AllowShortCaseLabelsOnASingleLine: **AllowShortCaseLabelsOnASingleLine** (``Boolean``) :versionbadge:`clang-format 3.6` :ref:`¶ ` diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index b146a9b56884ad..a85095e424b64b 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -834,6 +834,9 @@ clang-format ``BreakTemplateDeclarations``. - ``AlwaysBreakAfterReturnType`` is deprecated and renamed to ``BreakAfterReturnType``. +- Handles Java ``switch`` expressions. +- Adds ``AllowShortCaseExpressionOnASingleLine`` option. +- Adds ``AlignCaseArrows`` suboption to ``AlignConsecutiveShortCaseStatements``. libclang diff --git a/clang/include/clang/Format/Format.h b/clang/include/clang/Format/Format.h index 8ebdc86b98329c..74893f23210cd0 100644 --- a/clang/include/clang/Format/Format.h +++ b/clang/include/clang/Format/Format.h @@ -375,6 +375,23 @@ struct FormatStyle { /// } /// \endcode bool AcrossComments; +/// Whether to align the case arrows when aligning short case expressions. +/// \code{.java} +/// true: +/// i = switch (day) { +/// case THURSDAY, SATURDAY -> 8; +/// case WEDNESDAY -> 9; +/// default -> 0; +/// }; +/// +/// false: +/// i = switch (day) { +/// case THURSDAY, SATURDAY -> 8; +/// case WEDNESDAY -> 9; +/// default -> 0; +/// }; +/// \endcode +bool AlignCaseArrows; /// Whether aligned case labels are aligned on the colon, or on the tokens /// after the colon. /// \code @@ -396,12 +413,14 @@ struct FormatStyle { bool operator==(const ShortC
[clang] [Clang] Allow raw string literals in C as an extension (PR #88265)
@@ -3850,6 +3850,7 @@ LangOptions getFormattingLangOpts(const FormatStyle &Style) { // the sequence "<::" will be unconditionally treated as "[:". // Cf. Lexer::LexTokenInternal. LangOpts.Digraphs = LexingStd >= FormatStyle::LS_Cpp11; + LangOpts.RawStringLiterals = LexingStd >= FormatStyle::LS_Cpp11; owenca wrote: Can we set the default to 1 in `LangOpts.def`? That would take care of it. https://github.com/llvm/llvm-project/pull/88265 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [analyzer] MallocChecker: Recognize std::atomics in smart pointer suppression. (PR #90918)
sharkautarch wrote: > Yeah I think it's not sufficient to model the atomics. It's a good idea to > model them anyway, but even when atomics aren't used (eg. the custom smart > pointer never needed to be thread-safe), the fundamental problem is that we > still don't know the _initial_ value of the reference count. In particular we > can't refute the possibility that the original value was like `-1` or > something. I was actually thinking about something similar to that sort of conundrum, and I did have some ideas that don't involve whole program analysis: - Track function/method calls that pass freeable pointers/references to freeable stuff that cross TU boundaries. Maybe that would allow the analyzer to backtrack beyond the local TU, without having to try to analyze all of the TUs? - Specifically for use-after-free FPs with reference counting implementations, with perhaps the exception of static variables, I imagine you'd have to have allocated memory for you do to a use-after-free on it. Maybe for classes/objects recognized as reference counting implementations, you'd ignore any weird edgecase for semi-cross-TU use-after-free analysis (only thing I could think of is if in one TU memory could be allocated and then the pointer to it is set to null, and somehow another TU still has a pointer to said memory and frees the memory, and then a third TU uses the memory after it is freed) So, if you assume that memory has to have been allocated at some point (again only applicable for use-after-free analysis), you could assume that the reference count for said memory *should* have been more than zero at *some point* https://github.com/llvm/llvm-project/pull/90918 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [Libomptarget] Statically link all plugin runtimes (PR #87009)
dhruvachak wrote: I think OmptCallback.cpp can be completely removed from the plugin since that functionality is subsumed by offload. As in ``` diff --git a/offload/plugins-nextgen/common/CMakeLists.txt b/offload/plugins-nextgen/common/CMakeLists.txt index acf0af63f050..dc942db826bf 100644 --- a/offload/plugins-nextgen/common/CMakeLists.txt +++ b/offload/plugins-nextgen/common/CMakeLists.txt @@ -46,7 +46,6 @@ endif() # If we have OMPT enabled include it in the list of sources. if (OMPT_TARGET_DEFAULT AND LIBOMPTARGET_OMPT_SUPPORT) - target_sources(PluginCommon PRIVATE OMPT/OmptCallback.cpp) target_include_directories(PluginCommon PRIVATE OMPT) endif() ``` https://github.com/llvm/llvm-project/pull/87009 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] Revert "[DirectX][DXIL] Set DXIL Version in DXIL target triple based on shader model version" (PR #91290)
https://github.com/bharadwajy closed https://github.com/llvm/llvm-project/pull/91290 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 178ff39 - Revert "[DirectX][DXIL] Set DXIL Version in DXIL target triple based on shader model version" (#91290)
Author: S. Bharadwaj Yadavalli Date: 2024-05-06T22:21:37-04:00 New Revision: 178ff395006f204265b4f6fe72a3dbb2b9a79b47 URL: https://github.com/llvm/llvm-project/commit/178ff395006f204265b4f6fe72a3dbb2b9a79b47 DIFF: https://github.com/llvm/llvm-project/commit/178ff395006f204265b4f6fe72a3dbb2b9a79b47.diff LOG: Revert "[DirectX][DXIL] Set DXIL Version in DXIL target triple based on shader model version" (#91290) Reverts llvm/llvm-project#90809 Need to investigate ASAN failures. Added: Modified: clang/lib/Basic/Targets.cpp clang/lib/Driver/ToolChains/HLSL.cpp clang/test/CodeGenHLSL/basic-target.c clang/test/Driver/dxc_dxv_path.hlsl clang/test/Options/enable_16bit_types_validation.hlsl clang/unittests/Driver/DXCModeTest.cpp llvm/include/llvm/TargetParser/Triple.h llvm/lib/IR/Verifier.cpp llvm/lib/TargetParser/Triple.cpp llvm/unittests/TargetParser/TripleTest.cpp Removed: diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp index dc1792b3471e6c..e3283510c6aac7 100644 --- a/clang/lib/Basic/Targets.cpp +++ b/clang/lib/Basic/Targets.cpp @@ -760,7 +760,7 @@ using namespace clang::targets; TargetInfo * TargetInfo::CreateTargetInfo(DiagnosticsEngine &Diags, const std::shared_ptr &Opts) { - llvm::Triple Triple(llvm::Triple::normalize(Opts->Triple)); + llvm::Triple Triple(Opts->Triple); // Construct the target std::unique_ptr Target = AllocateTarget(Triple, *Opts); diff --git a/clang/lib/Driver/ToolChains/HLSL.cpp b/clang/lib/Driver/ToolChains/HLSL.cpp index 8286e3be21803f..558e4db46f8182 100644 --- a/clang/lib/Driver/ToolChains/HLSL.cpp +++ b/clang/lib/Driver/ToolChains/HLSL.cpp @@ -98,49 +98,9 @@ std::optional tryParseProfile(StringRef Profile) { else if (llvm::getAsUnsignedInteger(Parts[2], 0, Minor)) return std::nullopt; - // Determine DXIL version using the minor version number of Shader - // Model version specified in target profile. Prior to decoupling DXIL version - // numbering from that of Shader Model DXIL version 1.Y corresponds to SM 6.Y. - // E.g., dxilv1.Y-unknown-shadermodelX.Y-hull + // dxil-unknown-shadermodel-hull llvm::Triple T; - Triple::SubArchType SubArch = llvm::Triple::NoSubArch; - switch (Minor) { - case 0: -SubArch = llvm::Triple::DXILSubArch_v1_0; -break; - case 1: -SubArch = llvm::Triple::DXILSubArch_v1_1; -break; - case 2: -SubArch = llvm::Triple::DXILSubArch_v1_2; -break; - case 3: -SubArch = llvm::Triple::DXILSubArch_v1_3; -break; - case 4: -SubArch = llvm::Triple::DXILSubArch_v1_4; -break; - case 5: -SubArch = llvm::Triple::DXILSubArch_v1_5; -break; - case 6: -SubArch = llvm::Triple::DXILSubArch_v1_6; -break; - case 7: -SubArch = llvm::Triple::DXILSubArch_v1_7; -break; - case 8: -SubArch = llvm::Triple::DXILSubArch_v1_8; -break; - case OfflineLibMinor: -// Always consider minor version x as the latest supported DXIL version -SubArch = llvm::Triple::LatestDXILSubArch; -break; - default: -// No DXIL Version corresponding to specified Shader Model version found -return std::nullopt; - } - T.setArch(Triple::ArchType::dxil, SubArch); + T.setArch(Triple::ArchType::dxil); T.setOSName(Triple::getOSTypeName(Triple::OSType::ShaderModel).str() + VersionTuple(Major, Minor).getAsString()); T.setEnvironment(Kind); diff --git a/clang/test/CodeGenHLSL/basic-target.c b/clang/test/CodeGenHLSL/basic-target.c index b97ebf90a7a107..8db711c3f2a5b1 100644 --- a/clang/test/CodeGenHLSL/basic-target.c +++ b/clang/test/CodeGenHLSL/basic-target.c @@ -7,4 +7,4 @@ // RUN: %clang -target dxil-pc-shadermodel6.0-geometry -S -emit-llvm -o - %s | FileCheck %s // CHECK: target datalayout = "e-m:e-p:32:32-i1:32-i8:8-i16:16-i32:32-i64:64-f16:16-f32:32-f64:64-n8:16:32:64" -// CHECK: target triple = "dxilv1.0-pc-shadermodel6.0-{{[a-z]+}}" +// CHECK: target triple = "dxil-pc-shadermodel6.0-{{[a-z]+}}" diff --git a/clang/test/Driver/dxc_dxv_path.hlsl b/clang/test/Driver/dxc_dxv_path.hlsl index 4845de11d5b00b..3d8e90d0d91975 100644 --- a/clang/test/Driver/dxc_dxv_path.hlsl +++ b/clang/test/Driver/dxc_dxv_path.hlsl @@ -7,12 +7,12 @@ // DXV_PATH:dxv{{(.exe)?}}" "-" "-o" "-" // RUN: %clang_dxc -I test -Vd -Tlib_6_3 -### %s 2>&1 | FileCheck %s --check-prefix=VD -// VD:"-cc1"{{.*}}"-triple" "dxilv1.3-unknown-shadermodel6.3-library" +// VD:"-cc1"{{.*}}"-triple" "dxil-unknown-shadermodel6.3-library" // VD-NOT:dxv not found // RUN: %clang_dxc -Tlib_6_3 -ccc-print-bindings --dxv-path=%T -Fo %t.dxo %s 2>&1 | FileCheck %s --check-prefix=BINDINGS -// BINDINGS: "dxilv1.3-unknown-shadermodel6.3-library" - "clang", inputs: ["[[INPUT:.+]]"], output: "[[DXC:.+]].dxo" -// BINDINGS-NEXT: "dxilv1.3-unknown-shadermodel6.3-library" - "hlsl::Validator", inputs: ["[[DXC]].dx
[clang] [llvm] Revert "[DirectX][DXIL] Set DXIL Version in DXIL target triple based on shader model version" (PR #91290)
llvmbot wrote: @llvm/pr-subscribers-hlsl Author: S. Bharadwaj Yadavalli (bharadwajy) Changes Reverts llvm/llvm-project#90809 Need to investigate ASAN failures. --- Full diff: https://github.com/llvm/llvm-project/pull/91290.diff 10 Files Affected: - (modified) clang/lib/Basic/Targets.cpp (+1-1) - (modified) clang/lib/Driver/ToolChains/HLSL.cpp (+2-42) - (modified) clang/test/CodeGenHLSL/basic-target.c (+1-1) - (modified) clang/test/Driver/dxc_dxv_path.hlsl (+3-3) - (modified) clang/test/Options/enable_16bit_types_validation.hlsl (+2-2) - (modified) clang/unittests/Driver/DXCModeTest.cpp (+10-12) - (modified) llvm/include/llvm/TargetParser/Triple.h (-1) - (modified) llvm/lib/IR/Verifier.cpp (+2-2) - (modified) llvm/lib/TargetParser/Triple.cpp (-68) - (modified) llvm/unittests/TargetParser/TripleTest.cpp (-16) ``diff diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp index dc1792b3471e6c..e3283510c6aac7 100644 --- a/clang/lib/Basic/Targets.cpp +++ b/clang/lib/Basic/Targets.cpp @@ -760,7 +760,7 @@ using namespace clang::targets; TargetInfo * TargetInfo::CreateTargetInfo(DiagnosticsEngine &Diags, const std::shared_ptr &Opts) { - llvm::Triple Triple(llvm::Triple::normalize(Opts->Triple)); + llvm::Triple Triple(Opts->Triple); // Construct the target std::unique_ptr Target = AllocateTarget(Triple, *Opts); diff --git a/clang/lib/Driver/ToolChains/HLSL.cpp b/clang/lib/Driver/ToolChains/HLSL.cpp index 8286e3be21803f..558e4db46f8182 100644 --- a/clang/lib/Driver/ToolChains/HLSL.cpp +++ b/clang/lib/Driver/ToolChains/HLSL.cpp @@ -98,49 +98,9 @@ std::optional tryParseProfile(StringRef Profile) { else if (llvm::getAsUnsignedInteger(Parts[2], 0, Minor)) return std::nullopt; - // Determine DXIL version using the minor version number of Shader - // Model version specified in target profile. Prior to decoupling DXIL version - // numbering from that of Shader Model DXIL version 1.Y corresponds to SM 6.Y. - // E.g., dxilv1.Y-unknown-shadermodelX.Y-hull + // dxil-unknown-shadermodel-hull llvm::Triple T; - Triple::SubArchType SubArch = llvm::Triple::NoSubArch; - switch (Minor) { - case 0: -SubArch = llvm::Triple::DXILSubArch_v1_0; -break; - case 1: -SubArch = llvm::Triple::DXILSubArch_v1_1; -break; - case 2: -SubArch = llvm::Triple::DXILSubArch_v1_2; -break; - case 3: -SubArch = llvm::Triple::DXILSubArch_v1_3; -break; - case 4: -SubArch = llvm::Triple::DXILSubArch_v1_4; -break; - case 5: -SubArch = llvm::Triple::DXILSubArch_v1_5; -break; - case 6: -SubArch = llvm::Triple::DXILSubArch_v1_6; -break; - case 7: -SubArch = llvm::Triple::DXILSubArch_v1_7; -break; - case 8: -SubArch = llvm::Triple::DXILSubArch_v1_8; -break; - case OfflineLibMinor: -// Always consider minor version x as the latest supported DXIL version -SubArch = llvm::Triple::LatestDXILSubArch; -break; - default: -// No DXIL Version corresponding to specified Shader Model version found -return std::nullopt; - } - T.setArch(Triple::ArchType::dxil, SubArch); + T.setArch(Triple::ArchType::dxil); T.setOSName(Triple::getOSTypeName(Triple::OSType::ShaderModel).str() + VersionTuple(Major, Minor).getAsString()); T.setEnvironment(Kind); diff --git a/clang/test/CodeGenHLSL/basic-target.c b/clang/test/CodeGenHLSL/basic-target.c index b97ebf90a7a107..8db711c3f2a5b1 100644 --- a/clang/test/CodeGenHLSL/basic-target.c +++ b/clang/test/CodeGenHLSL/basic-target.c @@ -7,4 +7,4 @@ // RUN: %clang -target dxil-pc-shadermodel6.0-geometry -S -emit-llvm -o - %s | FileCheck %s // CHECK: target datalayout = "e-m:e-p:32:32-i1:32-i8:8-i16:16-i32:32-i64:64-f16:16-f32:32-f64:64-n8:16:32:64" -// CHECK: target triple = "dxilv1.0-pc-shadermodel6.0-{{[a-z]+}}" +// CHECK: target triple = "dxil-pc-shadermodel6.0-{{[a-z]+}}" diff --git a/clang/test/Driver/dxc_dxv_path.hlsl b/clang/test/Driver/dxc_dxv_path.hlsl index 4845de11d5b00b..3d8e90d0d91975 100644 --- a/clang/test/Driver/dxc_dxv_path.hlsl +++ b/clang/test/Driver/dxc_dxv_path.hlsl @@ -7,12 +7,12 @@ // DXV_PATH:dxv{{(.exe)?}}" "-" "-o" "-" // RUN: %clang_dxc -I test -Vd -Tlib_6_3 -### %s 2>&1 | FileCheck %s --check-prefix=VD -// VD:"-cc1"{{.*}}"-triple" "dxilv1.3-unknown-shadermodel6.3-library" +// VD:"-cc1"{{.*}}"-triple" "dxil-unknown-shadermodel6.3-library" // VD-NOT:dxv not found // RUN: %clang_dxc -Tlib_6_3 -ccc-print-bindings --dxv-path=%T -Fo %t.dxo %s 2>&1 | FileCheck %s --check-prefix=BINDINGS -// BINDINGS: "dxilv1.3-unknown-shadermodel6.3-library" - "clang", inputs: ["[[INPUT:.+]]"], output: "[[DXC:.+]].dxo" -// BINDINGS-NEXT: "dxilv1.3-unknown-shadermodel6.3-library" - "hlsl::Validator", inputs: ["[[DXC]].dxo"] +// BINDINGS: "dxil-unknown-shadermodel6.3-library" - "clang", inputs: ["[[INPUT:.+]]"], output: "[[DXC:.+]].dxo" +// BINDINGS-NEXT: "dxil-unknown-shadermodel6.3-libra
[clang] [llvm] Revert "[DirectX][DXIL] Set DXIL Version in DXIL target triple based on shader model version" (PR #91290)
https://github.com/bharadwajy created https://github.com/llvm/llvm-project/pull/91290 Reverts llvm/llvm-project#90809 Need to investigate ASAN failures. >From 3be739599982371e6151561758928007d4dc2762 Mon Sep 17 00:00:00 2001 From: "S. Bharadwaj Yadavalli" Date: Mon, 6 May 2024 22:16:35 -0400 Subject: [PATCH] =?UTF-8?q?Revert=20"[DirectX][DXIL]=20Set=20DXIL=20Versio?= =?UTF-8?q?n=20in=20DXIL=20target=20triple=20based=20on=20shade=E2=80=A6"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 080978dd2067d0c9ea7e229aa7696c2480d89ef1. --- clang/lib/Basic/Targets.cpp | 2 +- clang/lib/Driver/ToolChains/HLSL.cpp | 44 +--- clang/test/CodeGenHLSL/basic-target.c | 2 +- clang/test/Driver/dxc_dxv_path.hlsl | 6 +- .../enable_16bit_types_validation.hlsl| 4 +- clang/unittests/Driver/DXCModeTest.cpp| 22 +++--- llvm/include/llvm/TargetParser/Triple.h | 1 - llvm/lib/IR/Verifier.cpp | 4 +- llvm/lib/TargetParser/Triple.cpp | 68 --- llvm/unittests/TargetParser/TripleTest.cpp| 16 - 10 files changed, 21 insertions(+), 148 deletions(-) diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp index dc1792b3471e6c..e3283510c6aac7 100644 --- a/clang/lib/Basic/Targets.cpp +++ b/clang/lib/Basic/Targets.cpp @@ -760,7 +760,7 @@ using namespace clang::targets; TargetInfo * TargetInfo::CreateTargetInfo(DiagnosticsEngine &Diags, const std::shared_ptr &Opts) { - llvm::Triple Triple(llvm::Triple::normalize(Opts->Triple)); + llvm::Triple Triple(Opts->Triple); // Construct the target std::unique_ptr Target = AllocateTarget(Triple, *Opts); diff --git a/clang/lib/Driver/ToolChains/HLSL.cpp b/clang/lib/Driver/ToolChains/HLSL.cpp index 8286e3be21803f..558e4db46f8182 100644 --- a/clang/lib/Driver/ToolChains/HLSL.cpp +++ b/clang/lib/Driver/ToolChains/HLSL.cpp @@ -98,49 +98,9 @@ std::optional tryParseProfile(StringRef Profile) { else if (llvm::getAsUnsignedInteger(Parts[2], 0, Minor)) return std::nullopt; - // Determine DXIL version using the minor version number of Shader - // Model version specified in target profile. Prior to decoupling DXIL version - // numbering from that of Shader Model DXIL version 1.Y corresponds to SM 6.Y. - // E.g., dxilv1.Y-unknown-shadermodelX.Y-hull + // dxil-unknown-shadermodel-hull llvm::Triple T; - Triple::SubArchType SubArch = llvm::Triple::NoSubArch; - switch (Minor) { - case 0: -SubArch = llvm::Triple::DXILSubArch_v1_0; -break; - case 1: -SubArch = llvm::Triple::DXILSubArch_v1_1; -break; - case 2: -SubArch = llvm::Triple::DXILSubArch_v1_2; -break; - case 3: -SubArch = llvm::Triple::DXILSubArch_v1_3; -break; - case 4: -SubArch = llvm::Triple::DXILSubArch_v1_4; -break; - case 5: -SubArch = llvm::Triple::DXILSubArch_v1_5; -break; - case 6: -SubArch = llvm::Triple::DXILSubArch_v1_6; -break; - case 7: -SubArch = llvm::Triple::DXILSubArch_v1_7; -break; - case 8: -SubArch = llvm::Triple::DXILSubArch_v1_8; -break; - case OfflineLibMinor: -// Always consider minor version x as the latest supported DXIL version -SubArch = llvm::Triple::LatestDXILSubArch; -break; - default: -// No DXIL Version corresponding to specified Shader Model version found -return std::nullopt; - } - T.setArch(Triple::ArchType::dxil, SubArch); + T.setArch(Triple::ArchType::dxil); T.setOSName(Triple::getOSTypeName(Triple::OSType::ShaderModel).str() + VersionTuple(Major, Minor).getAsString()); T.setEnvironment(Kind); diff --git a/clang/test/CodeGenHLSL/basic-target.c b/clang/test/CodeGenHLSL/basic-target.c index b97ebf90a7a107..8db711c3f2a5b1 100644 --- a/clang/test/CodeGenHLSL/basic-target.c +++ b/clang/test/CodeGenHLSL/basic-target.c @@ -7,4 +7,4 @@ // RUN: %clang -target dxil-pc-shadermodel6.0-geometry -S -emit-llvm -o - %s | FileCheck %s // CHECK: target datalayout = "e-m:e-p:32:32-i1:32-i8:8-i16:16-i32:32-i64:64-f16:16-f32:32-f64:64-n8:16:32:64" -// CHECK: target triple = "dxilv1.0-pc-shadermodel6.0-{{[a-z]+}}" +// CHECK: target triple = "dxil-pc-shadermodel6.0-{{[a-z]+}}" diff --git a/clang/test/Driver/dxc_dxv_path.hlsl b/clang/test/Driver/dxc_dxv_path.hlsl index 4845de11d5b00b..3d8e90d0d91975 100644 --- a/clang/test/Driver/dxc_dxv_path.hlsl +++ b/clang/test/Driver/dxc_dxv_path.hlsl @@ -7,12 +7,12 @@ // DXV_PATH:dxv{{(.exe)?}}" "-" "-o" "-" // RUN: %clang_dxc -I test -Vd -Tlib_6_3 -### %s 2>&1 | FileCheck %s --check-prefix=VD -// VD:"-cc1"{{.*}}"-triple" "dxilv1.3-unknown-shadermodel6.3-library" +// VD:"-cc1"{{.*}}"-triple" "dxil-unknown-shadermodel6.3-library" // VD-NOT:dxv not found // RUN: %clang_dxc -Tlib_6_3 -ccc-print-bindings --dxv-path=%T -Fo %t.dxo %s 2>&1 | FileCheck %s --check-prefix=BINDINGS -// BIN
[clang] [analyzer] MallocChecker: Recognize std::atomics in smart pointer suppression. (PR #90918)
haoNoQ wrote: > I've just left here what my thought process was when I dig into a similar > case. It might be useful, who knows. Medium-to-long-term I think an attribute-based approach might make sense there: - Either annotate reference-counting pointers as "hey I'm a smart pointer (I'm following a different safety model in which symbolic execution based analysis would do more harm than good) so please ignore memory managed by me"; - Or annotate reference-counted objects (i.e. objects that contain an intrusive reference count and are always managed by intrusive reference-counted pointers) with an attribute "hey I'm always well-managed, please ignore my allocations entirely (for the same reason)". Or both. I've definitely seen a few codebases, that are security-critical to a large-ish chunk of humanity, that have like 20 competing ad-hoc reference-counting schemes. Mostly in plain C where MallocChecker would otherwise be very useful, if it wasn't ruined by false positives of a similar nature from all these reference counting schemes. These schemes probably don't make sense to hardcode in the compiler because there's no inheritance so you'd need to hardcode every struct that follows one of those schemes, not just every scheme in and of itself. > I considered modeling the atomic member functions, until the first place they > escape, after which we can no longer ever reason about them. This made me to > look into suppressions. Yeah I think it's not sufficient to model the atomics. It's a good idea to model them anyway, but even when atomics aren't used (eg. the custom smart pointer never needed to be thread-safe), the fundamental problem is that we still don't know the *initial* value of the reference count. In particular we can't refute the possibility that the original value was like `-1` or something. Modeling atomics would make it better when the smart pointer was first created *during* analysis, so we actually know that the initial value is 0. Then by carefully tracking it we might arrive to the correct conclusion. But when the initial value is symbolic we're fundamentally powerless without the domain-specific knowledge that the value could not have been `-1`. It's possible that this domain-specific knowledge could be transferred to us with the help of well-placed assertions across the smart pointer class. But an attribute could achieve the same in a more direct manner. > I believe, that such a heuristic with dominators could work for the rest of > the checkers - where the bug report is attached to some given statement - and > not delayed until some other future statement like in the leak checker. Yes, I think there has to be something good in this area, even though I haven't got any good specific solutions in my head. @Szelethus did a lot of initial experimentation in this area, which resulted in improved condition tracking, but we haven't used it for false positive suppression yet. Once we research this deeper and make it more principled, maybe we should really start doing that. It may also be a good idea to not look at the bug report in isolation, but consider the entire space of execution paths on which it was found. If the space isn't "vast" enough to convince us that we aren't stepping onto an #61669, suppress the warning. https://github.com/llvm/llvm-project/pull/90918 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [analyzer] MallocChecker: Recognize std::atomics in smart pointer suppression. (PR #90918)
@@ -3479,13 +3479,24 @@ PathDiagnosticPieceRef MallocBugVisitor::VisitNode(const ExplodedNode *N, // original reference count is positive, we should not report use-after-frees // on objects deleted in such destructors. This can probably be improved // through better shared pointer modeling. - if (ReleaseDestructorLC) { + if (ReleaseDestructorLC && (ReleaseDestructorLC == CurrentLC || + ReleaseDestructorLC->isParentOf(CurrentLC))) { if (const auto *AE = dyn_cast(S)) { + // Check for manual use of atomic builtins. AtomicExpr::AtomicOp Op = AE->getOp(); if (Op == AtomicExpr::AO__c11_atomic_fetch_add || Op == AtomicExpr::AO__c11_atomic_fetch_sub) { -if (ReleaseDestructorLC == CurrentLC || -ReleaseDestructorLC->isParentOf(CurrentLC)) { +BR.markInvalid(getTag(), S); + } +} else if (const auto *CE = dyn_cast(S)) { + // Check for `std::atomic` and such. This covers both regular method calls + // and operator calls. + if (const auto *MD = + dyn_cast_or_null(CE->getDirectCallee())) { +const CXXRecordDecl *RD = MD->getParent(); +// A bit wobbly with ".contains()" because it may be like +// "__atomic_base" or something. +if (StringRef(RD->getNameAsString()).contains("atomic")) { haoNoQ wrote: > Do we have any safeguard to only match names within the `std` namespace? > Could you add a test case demonstrating that a user-defined type wouldn't be > mistaken for `atomic` here? There aren't any safeguards, but I'm not sure we want them. This is already a crude heuristic that goes at like 45 degrees against the desired direction. I think I'd rather have it catch more false positives by respecting user-defined types that are probably atomics, than eliminate a few false negatives when our tool is applied to... Chemistry software probably? A few video games come to mind? Which are both amazing and I'd love to catch a few bugs in them. But I'm generally more worried about the entire projects that can't use our tool at all because they use custom atomic classes, dealing with problems similar to the original bug report. Because this heuristic applies only to method calls inside destructors (which doesn't include other destructor calls), the exact situation where this causes problems is _"somebody explicitly calls a method on a class named '...atomic...' which isn't an actual atomic integer, in a destructor which isn't a destructor of a smart pointer, and we're tracking a MallocChecker use-after-free report where memory was released inside that destructor, and that report is actually desired by the user"_. Which is definitely not impossible, but even in projects where this could happen, it would not happen every time; I hope that only one or two reports are affected in practice. MallocChecker isn't even that good in C++ code in which the programmers know what a destructor is, so I think even the "report is actually desired by the user" part would be fairly hard to satisfy. So I'm future-proofing this a bit, acknowledging that if we went with strict `std::atomic` requirement, we'd be likely to relax it in the future when more bug reports come in. Dunno, am I being overly pessimistic? Again, I'm very open to changing my mind. https://github.com/llvm/llvm-project/pull/90918 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [analyzer] MallocChecker: Recognize std::atomics in smart pointer suppression. (PR #90918)
@@ -3479,13 +3479,24 @@ PathDiagnosticPieceRef MallocBugVisitor::VisitNode(const ExplodedNode *N, // original reference count is positive, we should not report use-after-frees // on objects deleted in such destructors. This can probably be improved // through better shared pointer modeling. - if (ReleaseDestructorLC) { + if (ReleaseDestructorLC && (ReleaseDestructorLC == CurrentLC || + ReleaseDestructorLC->isParentOf(CurrentLC))) { if (const auto *AE = dyn_cast(S)) { + // Check for manual use of atomic builtins. AtomicExpr::AtomicOp Op = AE->getOp(); if (Op == AtomicExpr::AO__c11_atomic_fetch_add || Op == AtomicExpr::AO__c11_atomic_fetch_sub) { -if (ReleaseDestructorLC == CurrentLC || -ReleaseDestructorLC->isParentOf(CurrentLC)) { +BR.markInvalid(getTag(), S); + } +} else if (const auto *CE = dyn_cast(S)) { + // Check for `std::atomic` and such. This covers both regular method calls + // and operator calls. + if (const auto *MD = + dyn_cast_or_null(CE->getDirectCallee())) { +const CXXRecordDecl *RD = MD->getParent(); +// A bit wobbly with ".contains()" because it may be like +// "__atomic_base" or something. +if (StringRef(RD->getNameAsString()).contains("atomic")) { haoNoQ wrote: > Do we need to do the heavy weight `getNameAsString` here? Could we get the > identifier instead? Dunno do we still care about this? This isn't a hot path, and it's so annoying and error-prone to check the crash pre-condition first. If it's fast enough for ASTMatchers it's probably fast enough for us. I feel like, since nobody provided a safer method, and since the documentation appears to be very stale (`getNameAsString` is described as deprecated but it's already clear that it's not going anywhere), this doesn't appear to be a real problem to anybody. Though, I'm very open to changing my mind about this :) https://github.com/llvm/llvm-project/pull/90918 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [AArch64] Support preserve_none calling convention (PR #91046)
https://github.com/antangelo updated https://github.com/llvm/llvm-project/pull/91046 >From 767173a0dfde9858c90867cc5d476da90e5ba898 Mon Sep 17 00:00:00 2001 From: Antonio Abbatangelo Date: Tue, 30 Apr 2024 22:58:18 -0400 Subject: [PATCH 1/5] [AArch64] Support preserve_none calling convention --- clang/include/clang/Basic/Attr.td | 3 +- clang/include/clang/Basic/AttrDocs.td | 19 +- clang/lib/Basic/Targets/AArch64.cpp | 1 + clang/test/CodeGen/preserve-call-conv.c | 6 +- llvm/docs/LangRef.rst | 2 +- .../Target/AArch64/AArch64CallingConvention.h | 3 + .../AArch64/AArch64CallingConvention.td | 27 ++ .../Target/AArch64/AArch64ISelLowering.cpp| 34 +- .../Target/AArch64/AArch64RegisterInfo.cpp| 12 +- .../AArch64/GISel/AArch64CallLowering.cpp | 1 + .../AArch64/dynamic-regmask-preserve-none.ll | 88 + llvm/test/CodeGen/AArch64/preserve.ll | 9 +- llvm/test/CodeGen/AArch64/preserve_nonecc.ll | 92 + .../CodeGen/AArch64/preserve_nonecc_call.ll | 325 ++ .../AArch64/preserve_nonecc_musttail.ll | 11 + .../CodeGen/AArch64/preserve_nonecc_swift.ll | 16 + 16 files changed, 631 insertions(+), 18 deletions(-) create mode 100644 llvm/test/CodeGen/AArch64/dynamic-regmask-preserve-none.ll create mode 100644 llvm/test/CodeGen/AArch64/preserve_nonecc.ll create mode 100644 llvm/test/CodeGen/AArch64/preserve_nonecc_call.ll create mode 100644 llvm/test/CodeGen/AArch64/preserve_nonecc_musttail.ll create mode 100644 llvm/test/CodeGen/AArch64/preserve_nonecc_swift.ll diff --git a/clang/include/clang/Basic/Attr.td b/clang/include/clang/Basic/Attr.td index 0225598cbbe8ad..712c79927304e2 100644 --- a/clang/include/clang/Basic/Attr.td +++ b/clang/include/clang/Basic/Attr.td @@ -3038,7 +3038,8 @@ def M68kRTD: DeclOrTypeAttr { let Documentation = [M68kRTDDocs]; } -def PreserveNone : DeclOrTypeAttr, TargetSpecificAttr { +def PreserveNone : DeclOrTypeAttr, + TargetSpecificAttr> { let Spellings = [Clang<"preserve_none">]; let Subjects = SubjectList<[FunctionLike]>; let Documentation = [PreserveNoneDocs]; diff --git a/clang/include/clang/Basic/AttrDocs.td b/clang/include/clang/Basic/AttrDocs.td index f8253143b596c0..d23465b77e7edd 100644 --- a/clang/include/clang/Basic/AttrDocs.td +++ b/clang/include/clang/Basic/AttrDocs.td @@ -5658,17 +5658,20 @@ experimental at this time. def PreserveNoneDocs : Documentation { let Category = DocCatCallingConvs; let Content = [{ -On X86-64 target, this attribute changes the calling convention of a function. +On X86-64 and AArch64 targets, this attribute changes the calling convention of a function. The ``preserve_none`` calling convention tries to preserve as few general registers as possible. So all general registers are caller saved registers. It also uses more general registers to pass arguments. This attribute doesn't -impact floating-point registers (XMMs/YMMs). Floating-point registers still -follow the c calling convention. - -- Only RSP and RBP are preserved by callee. - -- Register RDI, RSI, RDX, RCX, R8, R9, R11, R12, R13, R14, R15 and RAX now can - be used to pass function arguments. +impact floating-point registers. + +- On X86-64, only RSP and RBP are preserved by the callee. + Registers RDI, RSI, RDX, RCX, R8, R9, R11, R12, R13, R14, R15 and RAX now can + be used to pass function arguments. Floating-point registers (XMMs/YMMs) still + follow the C calling convention. +- On AArch64, only LR and FP are preserved by the callee. + Registers X19-X28 and X0-X17 are used to pass function arguments. + X18, SIMD and floating-point registers follow the AAPCS calling + convention. }]; } diff --git a/clang/lib/Basic/Targets/AArch64.cpp b/clang/lib/Basic/Targets/AArch64.cpp index c8d243a8fb7aea..e1f7dbf1d9f20b 100644 --- a/clang/lib/Basic/Targets/AArch64.cpp +++ b/clang/lib/Basic/Targets/AArch64.cpp @@ -1202,6 +1202,7 @@ AArch64TargetInfo::checkCallingConvention(CallingConv CC) const { case CC_SwiftAsync: case CC_PreserveMost: case CC_PreserveAll: + case CC_PreserveNone: case CC_OpenCLKernel: case CC_AArch64VectorCall: case CC_AArch64SVEPCS: diff --git a/clang/test/CodeGen/preserve-call-conv.c b/clang/test/CodeGen/preserve-call-conv.c index 74bf695e6f331d..65973206403f70 100644 --- a/clang/test/CodeGen/preserve-call-conv.c +++ b/clang/test/CodeGen/preserve-call-conv.c @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm < %s | FileCheck %s --check-prefixes=CHECK,X86-LINUX -// RUN: %clang_cc1 -triple arm64-unknown-unknown -emit-llvm < %s | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm < %s | FileCheck %s --check-prefixes=CHECK,LINUX +// RUN: %clang_cc1 -triple arm64-unknown-unknown -emit-llvm < %s | FileCheck %s --check-prefixes=CHECK,LINUX // RUN: %clang_cc1 -triple x86_64-unknown-windows-msvc -emit-llvm
[clang] [llvm] [WebAssembly] Implement prototype f32.load_f16 instruction. (PR #90906)
https://github.com/aheejin approved this pull request. https://github.com/llvm/llvm-project/pull/90906 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] Use cmake to find perl executable (PR #91275)
https://github.com/MatzeB updated https://github.com/llvm/llvm-project/pull/91275 >From c0b7ec2e336476b1a1d6cf05d07bfde2f3dc88a4 Mon Sep 17 00:00:00 2001 From: Matthias Braun Date: Mon, 6 May 2024 14:39:37 -0700 Subject: [PATCH 1/5] Use cmake to find perl executable --- clang/CMakeLists.txt | 2 ++ clang/test/Analysis/scan-build/cxx-name.test | 2 +- clang/test/Analysis/scan-build/deduplication.test | 3 +-- clang/test/Analysis/scan-build/exclude_directories.test| 3 +-- clang/test/Analysis/scan-build/help.test | 3 +-- clang/test/Analysis/scan-build/html_output.test| 3 +-- clang/test/Analysis/scan-build/lit.local.cfg | 3 ++- clang/test/Analysis/scan-build/plist_html_output.test | 3 +-- clang/test/Analysis/scan-build/plist_output.test | 3 +-- .../test/Analysis/scan-build/rebuild_index/rebuild_index.test | 3 +-- clang/test/Analysis/scan-build/silence-core-checkers.test | 3 +-- clang/test/lit.cfg.py | 3 +++ clang/test/lit.site.cfg.py.in | 1 + 13 files changed, 17 insertions(+), 18 deletions(-) diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt index cf97e3c6e851ae..c20ce47a12abbd 100644 --- a/clang/CMakeLists.txt +++ b/clang/CMakeLists.txt @@ -523,6 +523,8 @@ endif() if( CLANG_INCLUDE_TESTS ) + find_package(Perl) + add_subdirectory(unittests) list(APPEND CLANG_TEST_DEPS ClangUnitTests) list(APPEND CLANG_TEST_PARAMS diff --git a/clang/test/Analysis/scan-build/cxx-name.test b/clang/test/Analysis/scan-build/cxx-name.test index 483762d619d178..789f7e0ac197c6 100644 --- a/clang/test/Analysis/scan-build/cxx-name.test +++ b/clang/test/Analysis/scan-build/cxx-name.test @@ -1,4 +1,4 @@ -REQUIRES: shell +REQUIRES: perl RUN: %scan-build sh -c 'echo "CLANG_CXX=/$(basename "$CLANG_CXX")/"' | FileCheck %s diff --git a/clang/test/Analysis/scan-build/deduplication.test b/clang/test/Analysis/scan-build/deduplication.test index 56d888e5fc12a2..62375d9aadfa85 100644 --- a/clang/test/Analysis/scan-build/deduplication.test +++ b/clang/test/Analysis/scan-build/deduplication.test @@ -1,5 +1,4 @@ -// FIXME: Actually, "perl". -REQUIRES: shell +REQUIRES: perl RUN: rm -rf %t.output_dir && mkdir %t.output_dir RUN: %scan-build -o %t.output_dir \ diff --git a/clang/test/Analysis/scan-build/exclude_directories.test b/clang/test/Analysis/scan-build/exclude_directories.test index c161e51b6d26c5..c15568f0b6bb9e 100644 --- a/clang/test/Analysis/scan-build/exclude_directories.test +++ b/clang/test/Analysis/scan-build/exclude_directories.test @@ -1,5 +1,4 @@ -// FIXME: Actually, "perl". -REQUIRES: shell +REQUIRES: perl RUN: rm -rf %t.output_dir && mkdir %t.output_dir RUN: %scan-build -o %t.output_dir %clang -S \ diff --git a/clang/test/Analysis/scan-build/help.test b/clang/test/Analysis/scan-build/help.test index 61915d32609439..2966507b6080cd 100644 --- a/clang/test/Analysis/scan-build/help.test +++ b/clang/test/Analysis/scan-build/help.test @@ -1,5 +1,4 @@ -// FIXME: Actually, "perl". -REQUIRES: shell +REQUIRES: perl RUN: %scan-build -h | FileCheck %s RUN: %scan-build --help | FileCheck %s diff --git a/clang/test/Analysis/scan-build/html_output.test b/clang/test/Analysis/scan-build/html_output.test index add35d83b95887..2d5c001e83960d 100644 --- a/clang/test/Analysis/scan-build/html_output.test +++ b/clang/test/Analysis/scan-build/html_output.test @@ -1,5 +1,4 @@ -// FIXME: Actually, "perl". -REQUIRES: shell +REQUIRES: perl RUN: rm -rf %t.output_dir && mkdir %t.output_dir RUN: %scan-build -o %t.output_dir %clang -S %S/Inputs/single_null_dereference.c \ diff --git a/clang/test/Analysis/scan-build/lit.local.cfg b/clang/test/Analysis/scan-build/lit.local.cfg index fab52b1c7bd679..e606243ea73a48 100644 --- a/clang/test/Analysis/scan-build/lit.local.cfg +++ b/clang/test/Analysis/scan-build/lit.local.cfg @@ -12,8 +12,9 @@ clang_path = config.clang if config.have_llvm_driver else os.path.realpath(confi config.substitutions.append( ( "%scan-build", -"'%s' --use-analyzer=%s " +"'%s' '%s' --use-analyzer=%s " % ( +config.perl_executable, lit.util.which( "scan-build", os.path.join(config.clang_src_dir, "tools", "scan-build", "bin"), diff --git a/clang/test/Analysis/scan-build/plist_html_output.test b/clang/test/Analysis/scan-build/plist_html_output.test index c07891e35fbf33..811bca22b07643 100644 --- a/clang/test/Analysis/scan-build/plist_html_output.test +++ b/clang/test/Analysis/scan-build/plist_html_output.test @@ -1,5 +1,4 @@ -// FIXME: Actually, "perl". -REQUIRES: shell +REQUIRES: perl RUN: rm -rf %t.output_dir && mkdir %t.output_dir RUN: %scan-build -plist-html -o %t.output_dir %clang -S %S/Inputs/single_null_dereference.c \ diff --git a/clang/
[clang] Use cmake to find perl executable (PR #91275)
@@ -1,4 +1,4 @@ -REQUIRES: shell +REQUIRES: perl MatzeB wrote: Seems there is `rm` but no `ls`: https://github.com/MatzeB/llvm-project/blob/5e5b18a31057f0d086ce9731d2b58aa70d55eef5/llvm/utils/lit/lit/TestRunner.py?plain=1#L714 https://github.com/llvm/llvm-project/pull/91275 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] Use cmake to find perl executable (PR #91275)
https://github.com/MatzeB updated https://github.com/llvm/llvm-project/pull/91275 >From c0b7ec2e336476b1a1d6cf05d07bfde2f3dc88a4 Mon Sep 17 00:00:00 2001 From: Matthias Braun Date: Mon, 6 May 2024 14:39:37 -0700 Subject: [PATCH 1/4] Use cmake to find perl executable --- clang/CMakeLists.txt | 2 ++ clang/test/Analysis/scan-build/cxx-name.test | 2 +- clang/test/Analysis/scan-build/deduplication.test | 3 +-- clang/test/Analysis/scan-build/exclude_directories.test| 3 +-- clang/test/Analysis/scan-build/help.test | 3 +-- clang/test/Analysis/scan-build/html_output.test| 3 +-- clang/test/Analysis/scan-build/lit.local.cfg | 3 ++- clang/test/Analysis/scan-build/plist_html_output.test | 3 +-- clang/test/Analysis/scan-build/plist_output.test | 3 +-- .../test/Analysis/scan-build/rebuild_index/rebuild_index.test | 3 +-- clang/test/Analysis/scan-build/silence-core-checkers.test | 3 +-- clang/test/lit.cfg.py | 3 +++ clang/test/lit.site.cfg.py.in | 1 + 13 files changed, 17 insertions(+), 18 deletions(-) diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt index cf97e3c6e851ae..c20ce47a12abbd 100644 --- a/clang/CMakeLists.txt +++ b/clang/CMakeLists.txt @@ -523,6 +523,8 @@ endif() if( CLANG_INCLUDE_TESTS ) + find_package(Perl) + add_subdirectory(unittests) list(APPEND CLANG_TEST_DEPS ClangUnitTests) list(APPEND CLANG_TEST_PARAMS diff --git a/clang/test/Analysis/scan-build/cxx-name.test b/clang/test/Analysis/scan-build/cxx-name.test index 483762d619d178..789f7e0ac197c6 100644 --- a/clang/test/Analysis/scan-build/cxx-name.test +++ b/clang/test/Analysis/scan-build/cxx-name.test @@ -1,4 +1,4 @@ -REQUIRES: shell +REQUIRES: perl RUN: %scan-build sh -c 'echo "CLANG_CXX=/$(basename "$CLANG_CXX")/"' | FileCheck %s diff --git a/clang/test/Analysis/scan-build/deduplication.test b/clang/test/Analysis/scan-build/deduplication.test index 56d888e5fc12a2..62375d9aadfa85 100644 --- a/clang/test/Analysis/scan-build/deduplication.test +++ b/clang/test/Analysis/scan-build/deduplication.test @@ -1,5 +1,4 @@ -// FIXME: Actually, "perl". -REQUIRES: shell +REQUIRES: perl RUN: rm -rf %t.output_dir && mkdir %t.output_dir RUN: %scan-build -o %t.output_dir \ diff --git a/clang/test/Analysis/scan-build/exclude_directories.test b/clang/test/Analysis/scan-build/exclude_directories.test index c161e51b6d26c5..c15568f0b6bb9e 100644 --- a/clang/test/Analysis/scan-build/exclude_directories.test +++ b/clang/test/Analysis/scan-build/exclude_directories.test @@ -1,5 +1,4 @@ -// FIXME: Actually, "perl". -REQUIRES: shell +REQUIRES: perl RUN: rm -rf %t.output_dir && mkdir %t.output_dir RUN: %scan-build -o %t.output_dir %clang -S \ diff --git a/clang/test/Analysis/scan-build/help.test b/clang/test/Analysis/scan-build/help.test index 61915d32609439..2966507b6080cd 100644 --- a/clang/test/Analysis/scan-build/help.test +++ b/clang/test/Analysis/scan-build/help.test @@ -1,5 +1,4 @@ -// FIXME: Actually, "perl". -REQUIRES: shell +REQUIRES: perl RUN: %scan-build -h | FileCheck %s RUN: %scan-build --help | FileCheck %s diff --git a/clang/test/Analysis/scan-build/html_output.test b/clang/test/Analysis/scan-build/html_output.test index add35d83b95887..2d5c001e83960d 100644 --- a/clang/test/Analysis/scan-build/html_output.test +++ b/clang/test/Analysis/scan-build/html_output.test @@ -1,5 +1,4 @@ -// FIXME: Actually, "perl". -REQUIRES: shell +REQUIRES: perl RUN: rm -rf %t.output_dir && mkdir %t.output_dir RUN: %scan-build -o %t.output_dir %clang -S %S/Inputs/single_null_dereference.c \ diff --git a/clang/test/Analysis/scan-build/lit.local.cfg b/clang/test/Analysis/scan-build/lit.local.cfg index fab52b1c7bd679..e606243ea73a48 100644 --- a/clang/test/Analysis/scan-build/lit.local.cfg +++ b/clang/test/Analysis/scan-build/lit.local.cfg @@ -12,8 +12,9 @@ clang_path = config.clang if config.have_llvm_driver else os.path.realpath(confi config.substitutions.append( ( "%scan-build", -"'%s' --use-analyzer=%s " +"'%s' '%s' --use-analyzer=%s " % ( +config.perl_executable, lit.util.which( "scan-build", os.path.join(config.clang_src_dir, "tools", "scan-build", "bin"), diff --git a/clang/test/Analysis/scan-build/plist_html_output.test b/clang/test/Analysis/scan-build/plist_html_output.test index c07891e35fbf33..811bca22b07643 100644 --- a/clang/test/Analysis/scan-build/plist_html_output.test +++ b/clang/test/Analysis/scan-build/plist_html_output.test @@ -1,5 +1,4 @@ -// FIXME: Actually, "perl". -REQUIRES: shell +REQUIRES: perl RUN: rm -rf %t.output_dir && mkdir %t.output_dir RUN: %scan-build -plist-html -o %t.output_dir %clang -S %S/Inputs/single_null_dereference.c \ diff --git a/clang/
[clang] [Arm64EC] Fix compilation of arm_acle.h (PR #91281)
https://github.com/dpaoliello approved this pull request. https://github.com/llvm/llvm-project/pull/91281 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] Use cmake to find perl executable (PR #91275)
@@ -1,5 +1,4 @@ -// FIXME: Actually, "perl". MaskRay wrote: Instead of `REQUIRES: perl` in (almost?) every scan-build/ test, update `clang/test/Analysis/scan-build/lit.local.cfg` instead? There are some `if ... not config.xxx: config.unsupported = True` examples in other `lit.local.cfg` files. https://github.com/llvm/llvm-project/pull/91275 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] Use cmake to find perl executable (PR #91275)
https://github.com/MaskRay approved this pull request. https://github.com/llvm/llvm-project/pull/91275 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] Use cmake to find perl executable (PR #91275)
https://github.com/MaskRay edited https://github.com/llvm/llvm-project/pull/91275 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [DirectX] Set DXIL Version using shader model version in compilation target profile (PR #89823)
bharadwajy wrote: > Now the #90809 has landed, is this PR still relevant? No. I was just about to close it. Thanks! Closing as an expanded implementation has been merged. https://github.com/llvm/llvm-project/pull/89823 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [DirectX] Set DXIL Version using shader model version in compilation target profile (PR #89823)
https://github.com/bharadwajy closed https://github.com/llvm/llvm-project/pull/89823 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [DirectX] Set DXIL Version using shader model version in compilation target profile (PR #89823)
damyanp wrote: Now the #90809 has landed, is this PR still relevant? https://github.com/llvm/llvm-project/pull/89823 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [webkit.RefCntblBaseVirtualDtor] Ignore WTF::RefCounted and its variants missing virtual destructor (PR #91009)
rniwa wrote: Thanks for the reviews! https://github.com/llvm/llvm-project/pull/91009 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [webkit.RefCntblBaseVirtualDtor] Ignore WTF::RefCounted and its variants missing virtual destructor (PR #91009)
https://github.com/rniwa closed https://github.com/llvm/llvm-project/pull/91009 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 6d6693e - [webkit.RefCntblBaseVirtualDtor] Ignore WTF::RefCounted and its variants missing virtual destructor (#91009)
Author: Ryosuke Niwa Date: 2024-05-06T16:01:45-07:00 New Revision: 6d6693e9f5376ac8c809a36e1ba4a8c47f311a70 URL: https://github.com/llvm/llvm-project/commit/6d6693e9f5376ac8c809a36e1ba4a8c47f311a70 DIFF: https://github.com/llvm/llvm-project/commit/6d6693e9f5376ac8c809a36e1ba4a8c47f311a70.diff LOG: [webkit.RefCntblBaseVirtualDtor] Ignore WTF::RefCounted and its variants missing virtual destructor (#91009) Added: Modified: clang/lib/StaticAnalyzer/Checkers/WebKit/RefCntblBaseVirtualDtorChecker.cpp clang/test/Analysis/Checkers/WebKit/ref-cntbl-base-virtual-dtor-templates.cpp Removed: diff --git a/clang/lib/StaticAnalyzer/Checkers/WebKit/RefCntblBaseVirtualDtorChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/WebKit/RefCntblBaseVirtualDtorChecker.cpp index d879c110b75d33..7f4c3a7b787e88 100644 --- a/clang/lib/StaticAnalyzer/Checkers/WebKit/RefCntblBaseVirtualDtorChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/WebKit/RefCntblBaseVirtualDtorChecker.cpp @@ -6,6 +6,7 @@ // //===--===// +#include "ASTUtils.h" #include "DiagOutputUtils.h" #include "PtrTypesSemantics.h" #include "clang/AST/CXXInheritance.h" @@ -90,6 +91,9 @@ class RefCntblBaseVirtualDtorChecker const CXXRecordDecl *C = T->getAsCXXRecordDecl(); if (!C) return false; + if (isRefCountedClass(C)) +return false; + bool AnyInconclusiveBase = false; const auto hasPublicRefInBase = [&AnyInconclusiveBase](const CXXBaseSpecifier *Base, @@ -164,6 +168,20 @@ class RefCntblBaseVirtualDtorChecker return false; } + static bool isRefCountedClass(const CXXRecordDecl *D) { +if (!D->getTemplateInstantiationPattern()) + return false; +auto *NsDecl = D->getParent(); +if (!NsDecl || !isa(NsDecl)) + return false; +auto NamespaceName = safeGetName(NsDecl); +auto ClsNameStr = safeGetName(D); +StringRef ClsName = ClsNameStr; // FIXME: Make safeGetName return StringRef. +return NamespaceName == "WTF" && + (ClsName.ends_with("RefCounted") || +ClsName == "ThreadSafeRefCountedAndCanMakeThreadSafeWeakPtr"); + } + void reportBug(const CXXRecordDecl *DerivedClass, const CXXBaseSpecifier *BaseSpec, const CXXRecordDecl *ProblematicBaseClass) const { diff --git a/clang/test/Analysis/Checkers/WebKit/ref-cntbl-base-virtual-dtor-templates.cpp b/clang/test/Analysis/Checkers/WebKit/ref-cntbl-base-virtual-dtor-templates.cpp index 3338fa9368e4b5..eeb62d5d89ec41 100644 --- a/clang/test/Analysis/Checkers/WebKit/ref-cntbl-base-virtual-dtor-templates.cpp +++ b/clang/test/Analysis/Checkers/WebKit/ref-cntbl-base-virtual-dtor-templates.cpp @@ -28,3 +28,63 @@ struct DerivedClassTmpl3 : T { }; typedef DerivedClassTmpl3 Foo; Foo c; + + +namespace WTF { + +class RefCountedBase { +public: + void ref() const { ++count; } + +protected: + bool derefBase() const + { +return !--count; + } + +private: + mutable unsigned count; +}; + +template +class RefCounted : public RefCountedBase { +public: + void deref() const { +if (derefBase()) + delete const_cast(static_cast(this)); + } + +protected: + RefCounted() { } +}; + +template +class ThreadSafeRefCounted { +public: + void ref() const; + bool deref() const; +}; + +template +class ThreadSafeRefCountedAndCanMakeThreadSafeWeakPtr { +public: + void ref() const; + bool deref() const; +}; + +} // namespace WTF + +class DerivedClass4 : public WTF::RefCounted { }; + +class DerivedClass5 : public DerivedClass4 { }; +// expected-warning@-1{{Class 'DerivedClass4' is used as a base of class 'DerivedClass5' but doesn't have virtual destructor}} + +class DerivedClass6 : public WTF::ThreadSafeRefCounted { }; + +class DerivedClass7 : public DerivedClass6 { }; +// expected-warning@-1{{Class 'DerivedClass6' is used as a base of class 'DerivedClass7' but doesn't have virtual destructor}} + +class DerivedClass8 : public WTF::ThreadSafeRefCountedAndCanMakeThreadSafeWeakPtr { }; + +class DerivedClass9 : public DerivedClass8 { }; +// expected-warning@-1{{Class 'DerivedClass8' is used as a base of class 'DerivedClass9' but doesn't have virtual destructor}} ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [AArch64] Add support for Qualcomm Oryon processor (PR #91022)
@@ -85,6 +85,10 @@ def SMEUnsupported : AArch64Unsupported { SME2Unsupported.F); } +def MTEUnsupported : AArch64Unsupported { + let F = [HasMTE]; +} + wxz2020 wrote: It is referenced in AArch64SchedOryon.td on line 33. The Oryon CPU does not support MTE. https://github.com/llvm/llvm-project/pull/91022 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] b86accc - [alpha.webkit.UncountedCallArgsChecker] Treat (foo())->bar() like foo()->bar(). (#91052)
Author: Ryosuke Niwa Date: 2024-05-06T15:59:08-07:00 New Revision: b86accceee0c7c5d36ecdc1629d00e6303f29955 URL: https://github.com/llvm/llvm-project/commit/b86accceee0c7c5d36ecdc1629d00e6303f29955 DIFF: https://github.com/llvm/llvm-project/commit/b86accceee0c7c5d36ecdc1629d00e6303f29955.diff LOG: [alpha.webkit.UncountedCallArgsChecker] Treat (foo())->bar() like foo()->bar(). (#91052) Added: Modified: clang/lib/StaticAnalyzer/Checkers/WebKit/ASTUtils.cpp clang/test/Analysis/Checkers/WebKit/call-args.cpp Removed: diff --git a/clang/lib/StaticAnalyzer/Checkers/WebKit/ASTUtils.cpp b/clang/lib/StaticAnalyzer/Checkers/WebKit/ASTUtils.cpp index b36fa95bc73f3e..5c49eecacc0f27 100644 --- a/clang/lib/StaticAnalyzer/Checkers/WebKit/ASTUtils.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/WebKit/ASTUtils.cpp @@ -27,6 +27,10 @@ tryToFindPtrOrigin(const Expr *E, bool StopAtFirstRefCountedObj) { E = tempExpr->getSubExpr(); continue; } +if (auto *tempExpr = dyn_cast(E)) { + E = tempExpr->getSubExpr(); + continue; +} if (auto *cast = dyn_cast(E)) { if (StopAtFirstRefCountedObj) { if (auto *ConversionFunc = diff --git a/clang/test/Analysis/Checkers/WebKit/call-args.cpp b/clang/test/Analysis/Checkers/WebKit/call-args.cpp index 2a4b6bb1f1063a..45d900d4ba880e 100644 --- a/clang/test/Analysis/Checkers/WebKit/call-args.cpp +++ b/clang/test/Analysis/Checkers/WebKit/call-args.cpp @@ -313,6 +313,17 @@ namespace default_arg { } } +namespace cxx_member_func { + Ref provideProtected(); + void foo() { +provide()->trivial(); +provide()->method(); +// expected-warning@-1{{Call argument for 'this' parameter is uncounted and unsafe}} +provideProtected()->method(); +(provideProtected())->method(); + }; +} + namespace cxx_member_operator_call { // The hidden this-pointer argument without a corresponding parameter caused couple bugs in parameter <-> argument attribution. struct Foo { ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [alpha.webkit.UncountedCallArgsChecker] Treat (foo())->bar() like foo()->bar(). (PR #91052)
https://github.com/rniwa closed https://github.com/llvm/llvm-project/pull/91052 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang-tools-extra] [llvm] [clang][modules] stdarg.h and stddef.h shouldn't directly declare anything (PR #90676)
https://github.com/ian-twilightcoder closed https://github.com/llvm/llvm-project/pull/90676 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 29d447a - [clang][modules] stdarg.h and stddef.h shouldn't directly declare anything (#90676)
Author: Ian Anderson Date: 2024-05-06T15:55:41-07:00 New Revision: 29d447a6e446e7fd78bd28af28bbf7dd377ade10 URL: https://github.com/llvm/llvm-project/commit/29d447a6e446e7fd78bd28af28bbf7dd377ade10 DIFF: https://github.com/llvm/llvm-project/commit/29d447a6e446e7fd78bd28af28bbf7dd377ade10.diff LOG: [clang][modules] stdarg.h and stddef.h shouldn't directly declare anything (#90676) stdarg.h and especially stddef.h are textual and so everything they declare gets precompiled into all of their clients' pcm files. They shouldn't directly declare anything though, their purpose is to select what submodules get imported, and not to add duplicate declarations to all of their clients. Make it so that they always ignore their header guards, even without modules, and declare them in separate header files so that they only go into the stdarg/stddef pcms. Still declare them in case clients rely on them. Added: clang/lib/Headers/__stdarg_header_macro.h clang/lib/Headers/__stddef_header_macro.h Modified: clang-tools-extra/clang-include-fixer/find-all-symbols/STLPostfixHeaderMap.cpp clang-tools-extra/clangd/index/CanonicalIncludes.cpp clang/lib/Headers/CMakeLists.txt clang/lib/Headers/module.modulemap clang/lib/Headers/stdarg.h clang/lib/Headers/stddef.h llvm/utils/gn/secondary/clang/lib/Headers/BUILD.gn Removed: diff --git a/clang-tools-extra/clang-include-fixer/find-all-symbols/STLPostfixHeaderMap.cpp b/clang-tools-extra/clang-include-fixer/find-all-symbols/STLPostfixHeaderMap.cpp index df77bf7ea46da3..469323f0ee9d7f 100644 --- a/clang-tools-extra/clang-include-fixer/find-all-symbols/STLPostfixHeaderMap.cpp +++ b/clang-tools-extra/clang-include-fixer/find-all-symbols/STLPostfixHeaderMap.cpp @@ -15,9 +15,11 @@ const HeaderMapCollector::RegexHeaderMap *getSTLPostfixHeaderMap() { static const HeaderMapCollector::RegexHeaderMap STLPostfixHeaderMap = { {"include/__stdarg___gnuc_va_list.h$", ""}, {"include/__stdarg___va_copy.h$", ""}, + {"include/__stdarg_header_macro.h$", ""}, {"include/__stdarg_va_arg.h$", ""}, {"include/__stdarg_va_copy.h$", ""}, {"include/__stdarg_va_list.h$", ""}, + {"include/__stddef_header_macro.h$", ""}, {"include/__stddef_max_align_t.h$", ""}, {"include/__stddef_null.h$", ""}, {"include/__stddef_nullptr_t.h$", ""}, diff --git a/clang-tools-extra/clangd/index/CanonicalIncludes.cpp b/clang-tools-extra/clangd/index/CanonicalIncludes.cpp index 42eeba36a80e43..785ec4086ea760 100644 --- a/clang-tools-extra/clangd/index/CanonicalIncludes.cpp +++ b/clang-tools-extra/clangd/index/CanonicalIncludes.cpp @@ -18,9 +18,11 @@ namespace { const std::pair IncludeMappings[] = { {"include/__stdarg___gnuc_va_list.h", ""}, {"include/__stdarg___va_copy.h", ""}, +{"include/__stdarg_header_macro.h", ""}, {"include/__stdarg_va_arg.h", ""}, {"include/__stdarg_va_copy.h", ""}, {"include/__stdarg_va_list.h", ""}, +{"include/__stddef_header_macro.h", ""}, {"include/__stddef_max_align_t.h", ""}, {"include/__stddef_null.h", ""}, {"include/__stddef_nullptr_t.h", ""}, diff --git a/clang/lib/Headers/CMakeLists.txt b/clang/lib/Headers/CMakeLists.txt index 3416811e39de27..5f02c71f6ca51a 100644 --- a/clang/lib/Headers/CMakeLists.txt +++ b/clang/lib/Headers/CMakeLists.txt @@ -12,6 +12,7 @@ set(core_files stdarg.h __stdarg___gnuc_va_list.h __stdarg___va_copy.h + __stdarg_header_macro.h __stdarg_va_arg.h __stdarg_va_copy.h __stdarg_va_list.h @@ -19,6 +20,7 @@ set(core_files stdbool.h stdckdint.h stddef.h + __stddef_header_macro.h __stddef_max_align_t.h __stddef_null.h __stddef_nullptr_t.h diff --git a/clang/lib/Headers/__stdarg_header_macro.h b/clang/lib/Headers/__stdarg_header_macro.h new file mode 100644 index 00..beb92ee0252679 --- /dev/null +++ b/clang/lib/Headers/__stdarg_header_macro.h @@ -0,0 +1,12 @@ +/*=== __stdarg_header_macro.h --=== + * + * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. + * See https://llvm.org/LICENSE.txt for license information. + * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + * + *===---=== + */ + +#ifndef __STDARG_H +#define __STDARG_H +#endif diff --git a/clang/lib/Headers/__stddef_header_macro.h b/clang/lib/Headers/__stddef_header_macro.h new file mode 100644 index 00..db5fb3c0abc1bf --- /dev/null +++ b/clang/lib/Headers/__stddef_header_macro.h @@ -0,0 +1,12 @@ +/*=== __stddef_header_macro.h --=== + * + * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. + * See https://llvm.org/LICENSE.txt for license information. + * SPDX-License-Identifier: Apache-
[clang-tools-extra] 29d447a - [clang][modules] stdarg.h and stddef.h shouldn't directly declare anything (#90676)
Author: Ian Anderson Date: 2024-05-06T15:55:41-07:00 New Revision: 29d447a6e446e7fd78bd28af28bbf7dd377ade10 URL: https://github.com/llvm/llvm-project/commit/29d447a6e446e7fd78bd28af28bbf7dd377ade10 DIFF: https://github.com/llvm/llvm-project/commit/29d447a6e446e7fd78bd28af28bbf7dd377ade10.diff LOG: [clang][modules] stdarg.h and stddef.h shouldn't directly declare anything (#90676) stdarg.h and especially stddef.h are textual and so everything they declare gets precompiled into all of their clients' pcm files. They shouldn't directly declare anything though, their purpose is to select what submodules get imported, and not to add duplicate declarations to all of their clients. Make it so that they always ignore their header guards, even without modules, and declare them in separate header files so that they only go into the stdarg/stddef pcms. Still declare them in case clients rely on them. Added: clang/lib/Headers/__stdarg_header_macro.h clang/lib/Headers/__stddef_header_macro.h Modified: clang-tools-extra/clang-include-fixer/find-all-symbols/STLPostfixHeaderMap.cpp clang-tools-extra/clangd/index/CanonicalIncludes.cpp clang/lib/Headers/CMakeLists.txt clang/lib/Headers/module.modulemap clang/lib/Headers/stdarg.h clang/lib/Headers/stddef.h llvm/utils/gn/secondary/clang/lib/Headers/BUILD.gn Removed: diff --git a/clang-tools-extra/clang-include-fixer/find-all-symbols/STLPostfixHeaderMap.cpp b/clang-tools-extra/clang-include-fixer/find-all-symbols/STLPostfixHeaderMap.cpp index df77bf7ea46da3..469323f0ee9d7f 100644 --- a/clang-tools-extra/clang-include-fixer/find-all-symbols/STLPostfixHeaderMap.cpp +++ b/clang-tools-extra/clang-include-fixer/find-all-symbols/STLPostfixHeaderMap.cpp @@ -15,9 +15,11 @@ const HeaderMapCollector::RegexHeaderMap *getSTLPostfixHeaderMap() { static const HeaderMapCollector::RegexHeaderMap STLPostfixHeaderMap = { {"include/__stdarg___gnuc_va_list.h$", ""}, {"include/__stdarg___va_copy.h$", ""}, + {"include/__stdarg_header_macro.h$", ""}, {"include/__stdarg_va_arg.h$", ""}, {"include/__stdarg_va_copy.h$", ""}, {"include/__stdarg_va_list.h$", ""}, + {"include/__stddef_header_macro.h$", ""}, {"include/__stddef_max_align_t.h$", ""}, {"include/__stddef_null.h$", ""}, {"include/__stddef_nullptr_t.h$", ""}, diff --git a/clang-tools-extra/clangd/index/CanonicalIncludes.cpp b/clang-tools-extra/clangd/index/CanonicalIncludes.cpp index 42eeba36a80e43..785ec4086ea760 100644 --- a/clang-tools-extra/clangd/index/CanonicalIncludes.cpp +++ b/clang-tools-extra/clangd/index/CanonicalIncludes.cpp @@ -18,9 +18,11 @@ namespace { const std::pair IncludeMappings[] = { {"include/__stdarg___gnuc_va_list.h", ""}, {"include/__stdarg___va_copy.h", ""}, +{"include/__stdarg_header_macro.h", ""}, {"include/__stdarg_va_arg.h", ""}, {"include/__stdarg_va_copy.h", ""}, {"include/__stdarg_va_list.h", ""}, +{"include/__stddef_header_macro.h", ""}, {"include/__stddef_max_align_t.h", ""}, {"include/__stddef_null.h", ""}, {"include/__stddef_nullptr_t.h", ""}, diff --git a/clang/lib/Headers/CMakeLists.txt b/clang/lib/Headers/CMakeLists.txt index 3416811e39de27..5f02c71f6ca51a 100644 --- a/clang/lib/Headers/CMakeLists.txt +++ b/clang/lib/Headers/CMakeLists.txt @@ -12,6 +12,7 @@ set(core_files stdarg.h __stdarg___gnuc_va_list.h __stdarg___va_copy.h + __stdarg_header_macro.h __stdarg_va_arg.h __stdarg_va_copy.h __stdarg_va_list.h @@ -19,6 +20,7 @@ set(core_files stdbool.h stdckdint.h stddef.h + __stddef_header_macro.h __stddef_max_align_t.h __stddef_null.h __stddef_nullptr_t.h diff --git a/clang/lib/Headers/__stdarg_header_macro.h b/clang/lib/Headers/__stdarg_header_macro.h new file mode 100644 index 00..beb92ee0252679 --- /dev/null +++ b/clang/lib/Headers/__stdarg_header_macro.h @@ -0,0 +1,12 @@ +/*=== __stdarg_header_macro.h --=== + * + * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. + * See https://llvm.org/LICENSE.txt for license information. + * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + * + *===---=== + */ + +#ifndef __STDARG_H +#define __STDARG_H +#endif diff --git a/clang/lib/Headers/__stddef_header_macro.h b/clang/lib/Headers/__stddef_header_macro.h new file mode 100644 index 00..db5fb3c0abc1bf --- /dev/null +++ b/clang/lib/Headers/__stddef_header_macro.h @@ -0,0 +1,12 @@ +/*=== __stddef_header_macro.h --=== + * + * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. + * See https://llvm.org/LICENSE.txt for license information. + * SPDX-License-Identifier: Apache-
[clang] Use cmake to find perl executable (PR #91275)
https://github.com/haoNoQ approved this pull request. https://github.com/llvm/llvm-project/pull/91275 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [HLSL] Support packoffset attribute in AST (PR #89836)
python3kgae wrote: > I'm marking this as requesting changes because I don't think we should land > this as-is. Switched to warning. https://github.com/llvm/llvm-project/pull/89836 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] Use cmake to find perl executable (PR #91275)
https://github.com/haoNoQ edited https://github.com/llvm/llvm-project/pull/91275 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] Use cmake to find perl executable (PR #91275)
@@ -1,4 +1,4 @@ -REQUIRES: shell +REQUIRES: perl haoNoQ wrote: A few of those require `rm` and `ls` but these don't count as shell right? https://github.com/llvm/llvm-project/pull/91275 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] Use cmake to find perl executable (PR #91275)
https://github.com/haoNoQ approved this pull request. Looks great thanks a lot!! I can confirm that it works for me on a mac too. @jroelofs's comment is on point. https://github.com/llvm/llvm-project/pull/91275 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [analyzer] Support determining origins in a conditional operator in WebKit checkers. (PR #91143)
@@ -27,12 +28,18 @@ tryToFindPtrOrigin(const Expr *E, bool StopAtFirstRefCountedObj) { E = tempExpr->getSubExpr(); continue; } +if (auto *Expr = dyn_cast(E)) { + return tryToFindPtrOrigin(Expr->getTrueExpr(), StopAtFirstRefCountedObj, +callback) && + tryToFindPtrOrigin(Expr->getFalseExpr(), StopAtFirstRefCountedObj, haoNoQ wrote: Hmm does this code play well with `StopAtFirstRefCountedObj`? Am I reading this right that both branches need to originate from a smart pointer, so we should never really stop in the middle between the branches? https://github.com/llvm/llvm-project/pull/91143 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [HLSL] Support packoffset attribute in AST (PR #89836)
https://github.com/damyanp approved this pull request. https://github.com/llvm/llvm-project/pull/89836 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [HLSL] Support packoffset attribute in AST (PR #89836)
https://github.com/python3kgae updated https://github.com/llvm/llvm-project/pull/89836 >From 4d8c72688656fe3b2ce8817087d8cf7352b5876b Mon Sep 17 00:00:00 2001 From: Xiang Li Date: Tue, 23 Apr 2024 17:49:02 -0400 Subject: [PATCH 1/7] [HLSL] Support packoffset attribute in AST Add HLSLPackOffsetAttr to save packoffset in AST. Since we have to parse the attribute manually in ParseHLSLAnnotations, we could create the ParsedAttribute with a integer offset parameter instead of string. This approach avoids parsing the string if the offset is saved as a string in HLSLPackOffsetAttr. --- clang/include/clang/Basic/Attr.td | 7 ++ clang/include/clang/Basic/AttrDocs.td | 18 + .../clang/Basic/DiagnosticParseKinds.td | 2 + .../clang/Basic/DiagnosticSemaKinds.td| 3 + clang/lib/Parse/ParseHLSL.cpp | 80 +++ clang/lib/Sema/SemaDeclAttr.cpp | 44 ++ clang/lib/Sema/SemaHLSL.cpp | 48 +++ clang/test/AST/HLSL/packoffset.hlsl | 16 clang/test/SemaHLSL/packoffset-invalid.hlsl | 55 + 9 files changed, 273 insertions(+) create mode 100644 clang/test/AST/HLSL/packoffset.hlsl create mode 100644 clang/test/SemaHLSL/packoffset-invalid.hlsl diff --git a/clang/include/clang/Basic/Attr.td b/clang/include/clang/Basic/Attr.td index 4408d517e70e58..d3d006ed9633f4 100644 --- a/clang/include/clang/Basic/Attr.td +++ b/clang/include/clang/Basic/Attr.td @@ -4372,6 +4372,13 @@ def HLSLResourceBinding: InheritableAttr { let Documentation = [HLSLResourceBindingDocs]; } +def HLSLPackOffset: HLSLAnnotationAttr { + let Spellings = [HLSLAnnotation<"packoffset">]; + let LangOpts = [HLSL]; + let Args = [IntArgument<"Offset">]; + let Documentation = [HLSLPackOffsetDocs]; +} + def HLSLSV_DispatchThreadID: HLSLAnnotationAttr { let Spellings = [HLSLAnnotation<"SV_DispatchThreadID">]; let Subjects = SubjectList<[ParmVar, Field]>; diff --git a/clang/include/clang/Basic/AttrDocs.td b/clang/include/clang/Basic/AttrDocs.td index a0bbe5861c5722..6bc7813bd43cb4 100644 --- a/clang/include/clang/Basic/AttrDocs.td +++ b/clang/include/clang/Basic/AttrDocs.td @@ -7398,6 +7398,24 @@ The full documentation is available here: https://docs.microsoft.com/en-us/windo }]; } +def HLSLPackOffsetDocs : Documentation { + let Category = DocCatFunction; + let Content = [{ +The packoffset attribute is used to change the layout of a cbuffer. +Attribute spelling in HLSL is: ``packoffset(c[Subcomponent[.component]])``. +A subcomponent is a register number, which is an integer. A component is in the form of [.xyzw]. + +Here're packoffset examples with and without component: +.. code-block:: c++ + cbuffer A { +float3 a : packoffset(c0.y); +float4 b : packoffset(c4); + } + +The full documentation is available here: https://learn.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-variable-packoffset + }]; +} + def HLSLSV_DispatchThreadIDDocs : Documentation { let Category = DocCatFunction; let Content = [{ diff --git a/clang/include/clang/Basic/DiagnosticParseKinds.td b/clang/include/clang/Basic/DiagnosticParseKinds.td index 38174cf3549f14..81433ee79d48b2 100644 --- a/clang/include/clang/Basic/DiagnosticParseKinds.td +++ b/clang/include/clang/Basic/DiagnosticParseKinds.td @@ -1745,5 +1745,7 @@ def err_hlsl_separate_attr_arg_and_number : Error<"wrong argument format for hls def ext_hlsl_access_specifiers : ExtWarn< "access specifiers are a clang HLSL extension">, InGroup; +def err_hlsl_unsupported_component : Error<"invalid component '%0' used; expected 'x', 'y', 'z', or 'w'">; +def err_hlsl_packoffset_invalid_reg : Error<"invalid resource class specifier '%0' for packoffset, expected 'c'">; } // end of Parser diagnostics diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td index 63e951daec7477..bde9617c9820a8 100644 --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -12167,6 +12167,9 @@ def err_hlsl_init_priority_unsupported : Error< def err_hlsl_unsupported_register_type : Error<"invalid resource class specifier '%0' used; expected 'b', 's', 't', or 'u'">; def err_hlsl_unsupported_register_number : Error<"register number should be an integer">; def err_hlsl_expected_space : Error<"invalid space specifier '%0' used; expected 'space' followed by an integer, like space1">; +def err_hlsl_packoffset_mix : Error<"cannot mix packoffset elements with nonpackoffset elements in a cbuffer">; +def err_hlsl_packoffset_overlap : Error<"packoffset overlap between %0, %1">; +def err_hlsl_packoffset_cross_reg_boundary : Error<"packoffset cannot cross register boundary">; def err_hlsl_pointers_unsupported : Error< "%select{pointers|references}0 are unsupported in HLSL">; diff --git a/clang/lib/Parse/ParseHLSL.cpp b/clang/lib/Parse/ParseH
[clang] [analyzer] Ignore system headers in WebKit checkers. (PR #91103)
rniwa wrote: > Aha, this looks like a more traditional solution! Looks great. You can make > tests for this by feeding the compiler fake system headers with the help of > > ``` > #pragma clang system_header > ``` > > ! oh, that's neat! https://github.com/llvm/llvm-project/pull/91103 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [analyzer] Ignore system headers in WebKit checkers. (PR #91103)
haoNoQ wrote: Aha, this looks like a more traditional solution! Looks great. You can make tests for this by feeding the compiler fake system headers with the help of ``` #pragma clang system_header ``` ! https://github.com/llvm/llvm-project/pull/91103 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [alpha.webkit.UncountedCallArgsChecker] Allow trivial operator++ (PR #91102)
@@ -316,10 +316,15 @@ class TrivialFunctionAnalysisVisitor if (UO->isIncrementOp() || UO->isDecrementOp()) { // Allow increment or decrement of a POD type. - if (auto *RefExpr = dyn_cast(UO->getSubExpr())) { + auto *SubExpr = UO->getSubExpr(); + if (auto *RefExpr = dyn_cast(SubExpr)) { haoNoQ wrote: Hmm. You're jumping two steps at a time here: exploring `UnaryOperator` and the inner `DeclRefExrpr`/`MemberExpr` together simultaneously, as opposed to fully relying on the `Visit()` method which already has slightly different behavior. For example, it looks like an access to a global variable is considered trivial _unless it's an increment_. In particular, `global += 1` is still considered trivial but `++global` isn't. (This has actually already been the case before your patch, you just added more similar behavior.) Is this intended? Maybe it's better to check for these extra conditions by default? https://github.com/llvm/llvm-project/pull/91102 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Arm64EC] Fix compilation of arm_acle.h (PR #91281)
llvmbot wrote: @llvm/pr-subscribers-clang Author: Eli Friedman (efriedma-quic) Changes --- Full diff: https://github.com/llvm/llvm-project/pull/91281.diff 2 Files Affected: - (modified) clang/lib/Headers/arm_acle.h (+1-1) - (modified) clang/test/Headers/arm-acle-header.c (+1) ``diff diff --git a/clang/lib/Headers/arm_acle.h b/clang/lib/Headers/arm_acle.h index 6e557eda1dddca..5785954c9171ab 100644 --- a/clang/lib/Headers/arm_acle.h +++ b/clang/lib/Headers/arm_acle.h @@ -109,7 +109,7 @@ __swp(uint32_t __x, volatile uint32_t *__p) { #endif /* 7.7 NOP */ -#if !defined(_MSC_VER) || !defined(__aarch64__) +#if !defined(_MSC_VER) || (!defined(__aarch64__) && !defined(__arm64ec__)) static __inline__ void __attribute__((__always_inline__, __nodebug__)) __nop(void) { __builtin_arm_nop(); } diff --git a/clang/test/Headers/arm-acle-header.c b/clang/test/Headers/arm-acle-header.c index f04c7e1f0f35f7..fea8472183c871 100644 --- a/clang/test/Headers/arm-acle-header.c +++ b/clang/test/Headers/arm-acle-header.c @@ -7,6 +7,7 @@ // RUN: %clang_cc1 -x c++ -triple thumbv7-windows -target-cpu cortex-a15 -fsyntax-only -ffreestanding -fms-extensions -fms-compatibility -fms-compatibility-version=19.11 %s // RUN: %clang_cc1 -x c++ -triple aarch64-windows -target-cpu cortex-a53 -fsyntax-only -ffreestanding -fms-extensions -fms-compatibility -fms-compatibility-version=19.11 %s // RUN: %clang_cc1 -x c++ -triple arm64-apple-ios -target-cpu apple-a7 -fsyntax-only -ffreestanding -fms-extensions %s +// RUN: %clang_cc1 -x c++ -triple arm64ec-windows -target-cpu cortex-a53 -fsyntax-only -ffreestanding -fms-extensions -fms-compatibility -fms-compatibility-version=19.11 %s // expected-no-diagnostics #include `` https://github.com/llvm/llvm-project/pull/91281 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Arm64EC] Fix compilation of arm_acle.h (PR #91281)
llvmbot wrote: @llvm/pr-subscribers-backend-x86 Author: Eli Friedman (efriedma-quic) Changes --- Full diff: https://github.com/llvm/llvm-project/pull/91281.diff 2 Files Affected: - (modified) clang/lib/Headers/arm_acle.h (+1-1) - (modified) clang/test/Headers/arm-acle-header.c (+1) ``diff diff --git a/clang/lib/Headers/arm_acle.h b/clang/lib/Headers/arm_acle.h index 6e557eda1dddca..5785954c9171ab 100644 --- a/clang/lib/Headers/arm_acle.h +++ b/clang/lib/Headers/arm_acle.h @@ -109,7 +109,7 @@ __swp(uint32_t __x, volatile uint32_t *__p) { #endif /* 7.7 NOP */ -#if !defined(_MSC_VER) || !defined(__aarch64__) +#if !defined(_MSC_VER) || (!defined(__aarch64__) && !defined(__arm64ec__)) static __inline__ void __attribute__((__always_inline__, __nodebug__)) __nop(void) { __builtin_arm_nop(); } diff --git a/clang/test/Headers/arm-acle-header.c b/clang/test/Headers/arm-acle-header.c index f04c7e1f0f35f7..fea8472183c871 100644 --- a/clang/test/Headers/arm-acle-header.c +++ b/clang/test/Headers/arm-acle-header.c @@ -7,6 +7,7 @@ // RUN: %clang_cc1 -x c++ -triple thumbv7-windows -target-cpu cortex-a15 -fsyntax-only -ffreestanding -fms-extensions -fms-compatibility -fms-compatibility-version=19.11 %s // RUN: %clang_cc1 -x c++ -triple aarch64-windows -target-cpu cortex-a53 -fsyntax-only -ffreestanding -fms-extensions -fms-compatibility -fms-compatibility-version=19.11 %s // RUN: %clang_cc1 -x c++ -triple arm64-apple-ios -target-cpu apple-a7 -fsyntax-only -ffreestanding -fms-extensions %s +// RUN: %clang_cc1 -x c++ -triple arm64ec-windows -target-cpu cortex-a53 -fsyntax-only -ffreestanding -fms-extensions -fms-compatibility -fms-compatibility-version=19.11 %s // expected-no-diagnostics #include `` https://github.com/llvm/llvm-project/pull/91281 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Arm64EC] Fix compilation of arm_acle.h (PR #91281)
https://github.com/efriedma-quic created https://github.com/llvm/llvm-project/pull/91281 None >From 5a5512aa5a84e2c89efd9e9ade043061d73d25fb Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Fri, 3 May 2024 21:13:32 -0700 Subject: [PATCH] [Arm64EC] Fix compilation of arm_acle.h --- clang/lib/Headers/arm_acle.h | 2 +- clang/test/Headers/arm-acle-header.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/clang/lib/Headers/arm_acle.h b/clang/lib/Headers/arm_acle.h index 6e557eda1dddca..5785954c9171ab 100644 --- a/clang/lib/Headers/arm_acle.h +++ b/clang/lib/Headers/arm_acle.h @@ -109,7 +109,7 @@ __swp(uint32_t __x, volatile uint32_t *__p) { #endif /* 7.7 NOP */ -#if !defined(_MSC_VER) || !defined(__aarch64__) +#if !defined(_MSC_VER) || (!defined(__aarch64__) && !defined(__arm64ec__)) static __inline__ void __attribute__((__always_inline__, __nodebug__)) __nop(void) { __builtin_arm_nop(); } diff --git a/clang/test/Headers/arm-acle-header.c b/clang/test/Headers/arm-acle-header.c index f04c7e1f0f35f7..fea8472183c871 100644 --- a/clang/test/Headers/arm-acle-header.c +++ b/clang/test/Headers/arm-acle-header.c @@ -7,6 +7,7 @@ // RUN: %clang_cc1 -x c++ -triple thumbv7-windows -target-cpu cortex-a15 -fsyntax-only -ffreestanding -fms-extensions -fms-compatibility -fms-compatibility-version=19.11 %s // RUN: %clang_cc1 -x c++ -triple aarch64-windows -target-cpu cortex-a53 -fsyntax-only -ffreestanding -fms-extensions -fms-compatibility -fms-compatibility-version=19.11 %s // RUN: %clang_cc1 -x c++ -triple arm64-apple-ios -target-cpu apple-a7 -fsyntax-only -ffreestanding -fms-extensions %s +// RUN: %clang_cc1 -x c++ -triple arm64ec-windows -target-cpu cortex-a53 -fsyntax-only -ffreestanding -fms-extensions -fms-compatibility -fms-compatibility-version=19.11 %s // expected-no-diagnostics #include ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] Use cmake to find perl executable (PR #91275)
https://github.com/MatzeB updated https://github.com/llvm/llvm-project/pull/91275 >From c0b7ec2e336476b1a1d6cf05d07bfde2f3dc88a4 Mon Sep 17 00:00:00 2001 From: Matthias Braun Date: Mon, 6 May 2024 14:39:37 -0700 Subject: [PATCH 1/3] Use cmake to find perl executable --- clang/CMakeLists.txt | 2 ++ clang/test/Analysis/scan-build/cxx-name.test | 2 +- clang/test/Analysis/scan-build/deduplication.test | 3 +-- clang/test/Analysis/scan-build/exclude_directories.test| 3 +-- clang/test/Analysis/scan-build/help.test | 3 +-- clang/test/Analysis/scan-build/html_output.test| 3 +-- clang/test/Analysis/scan-build/lit.local.cfg | 3 ++- clang/test/Analysis/scan-build/plist_html_output.test | 3 +-- clang/test/Analysis/scan-build/plist_output.test | 3 +-- .../test/Analysis/scan-build/rebuild_index/rebuild_index.test | 3 +-- clang/test/Analysis/scan-build/silence-core-checkers.test | 3 +-- clang/test/lit.cfg.py | 3 +++ clang/test/lit.site.cfg.py.in | 1 + 13 files changed, 17 insertions(+), 18 deletions(-) diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt index cf97e3c6e851ae..c20ce47a12abbd 100644 --- a/clang/CMakeLists.txt +++ b/clang/CMakeLists.txt @@ -523,6 +523,8 @@ endif() if( CLANG_INCLUDE_TESTS ) + find_package(Perl) + add_subdirectory(unittests) list(APPEND CLANG_TEST_DEPS ClangUnitTests) list(APPEND CLANG_TEST_PARAMS diff --git a/clang/test/Analysis/scan-build/cxx-name.test b/clang/test/Analysis/scan-build/cxx-name.test index 483762d619d178..789f7e0ac197c6 100644 --- a/clang/test/Analysis/scan-build/cxx-name.test +++ b/clang/test/Analysis/scan-build/cxx-name.test @@ -1,4 +1,4 @@ -REQUIRES: shell +REQUIRES: perl RUN: %scan-build sh -c 'echo "CLANG_CXX=/$(basename "$CLANG_CXX")/"' | FileCheck %s diff --git a/clang/test/Analysis/scan-build/deduplication.test b/clang/test/Analysis/scan-build/deduplication.test index 56d888e5fc12a2..62375d9aadfa85 100644 --- a/clang/test/Analysis/scan-build/deduplication.test +++ b/clang/test/Analysis/scan-build/deduplication.test @@ -1,5 +1,4 @@ -// FIXME: Actually, "perl". -REQUIRES: shell +REQUIRES: perl RUN: rm -rf %t.output_dir && mkdir %t.output_dir RUN: %scan-build -o %t.output_dir \ diff --git a/clang/test/Analysis/scan-build/exclude_directories.test b/clang/test/Analysis/scan-build/exclude_directories.test index c161e51b6d26c5..c15568f0b6bb9e 100644 --- a/clang/test/Analysis/scan-build/exclude_directories.test +++ b/clang/test/Analysis/scan-build/exclude_directories.test @@ -1,5 +1,4 @@ -// FIXME: Actually, "perl". -REQUIRES: shell +REQUIRES: perl RUN: rm -rf %t.output_dir && mkdir %t.output_dir RUN: %scan-build -o %t.output_dir %clang -S \ diff --git a/clang/test/Analysis/scan-build/help.test b/clang/test/Analysis/scan-build/help.test index 61915d32609439..2966507b6080cd 100644 --- a/clang/test/Analysis/scan-build/help.test +++ b/clang/test/Analysis/scan-build/help.test @@ -1,5 +1,4 @@ -// FIXME: Actually, "perl". -REQUIRES: shell +REQUIRES: perl RUN: %scan-build -h | FileCheck %s RUN: %scan-build --help | FileCheck %s diff --git a/clang/test/Analysis/scan-build/html_output.test b/clang/test/Analysis/scan-build/html_output.test index add35d83b95887..2d5c001e83960d 100644 --- a/clang/test/Analysis/scan-build/html_output.test +++ b/clang/test/Analysis/scan-build/html_output.test @@ -1,5 +1,4 @@ -// FIXME: Actually, "perl". -REQUIRES: shell +REQUIRES: perl RUN: rm -rf %t.output_dir && mkdir %t.output_dir RUN: %scan-build -o %t.output_dir %clang -S %S/Inputs/single_null_dereference.c \ diff --git a/clang/test/Analysis/scan-build/lit.local.cfg b/clang/test/Analysis/scan-build/lit.local.cfg index fab52b1c7bd679..e606243ea73a48 100644 --- a/clang/test/Analysis/scan-build/lit.local.cfg +++ b/clang/test/Analysis/scan-build/lit.local.cfg @@ -12,8 +12,9 @@ clang_path = config.clang if config.have_llvm_driver else os.path.realpath(confi config.substitutions.append( ( "%scan-build", -"'%s' --use-analyzer=%s " +"'%s' '%s' --use-analyzer=%s " % ( +config.perl_executable, lit.util.which( "scan-build", os.path.join(config.clang_src_dir, "tools", "scan-build", "bin"), diff --git a/clang/test/Analysis/scan-build/plist_html_output.test b/clang/test/Analysis/scan-build/plist_html_output.test index c07891e35fbf33..811bca22b07643 100644 --- a/clang/test/Analysis/scan-build/plist_html_output.test +++ b/clang/test/Analysis/scan-build/plist_html_output.test @@ -1,5 +1,4 @@ -// FIXME: Actually, "perl". -REQUIRES: shell +REQUIRES: perl RUN: rm -rf %t.output_dir && mkdir %t.output_dir RUN: %scan-build -plist-html -o %t.output_dir %clang -S %S/Inputs/single_null_dereference.c \ diff --git a/clang/
[clang] [llvm] [MC,clang,llvm-readobj,yaml2obj] Support CREL relocation format (PR #91280)
llvmbot wrote: @llvm/pr-subscribers-clang-driver @llvm/pr-subscribers-clang Author: Fangrui Song (MaskRay) Changes CREL is a compact relocation format for the ELF object file format. This patch adds integrated assembler support (using the RELA form), which can be enabled with `clang -c -Wa,--crel,--experimental-crel`. `-Wa,--experimental-crel` indicates that CREL is experimental and not a standard. `-Wa,--experimental-crel` might be removed in the future. * We take a section type code 20 from the generic range for `SHT_CREL`. We avoided using `SHT_LLVM_` or `SHT_GNU_` to maintain broader applicability for interested psABIs. * In the extremely unlikely case the generic ABI assigns 20 to another purpose, and existing toolchains generate relocatable files using that code (unlikely if we ensure GNU and LLVM don't do this), any conflicts would be the user's responsibility to resolve. This patch also adds llvm-readobj support (for both REL and RELA forms) to facilitate testing the assembler. Additionally, yaml2obj gains support for the RELA form to aid testing with llvm-readobj. Currently, linking the generated relocatable file with GNU ld will fail because GNU ld doesn't support CREL yet. unknown architecture of input file `a.o' is incompatible with i386:x86-64 output lld will also produce an error when attempting to link a CREL relocatable file. The support will come in a future change. Link: https://discourse.llvm.org/t/rfc-crel-a-compact-relocation-format-for-elf/77600 --- Patch is 72.41 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/91280.diff 32 Files Affected: - (modified) clang/include/clang/Basic/CodeGenOptions.def (+1) - (modified) clang/include/clang/Basic/DiagnosticDriverKinds.td (+3) - (modified) clang/include/clang/Driver/Options.td (+3) - (modified) clang/lib/CodeGen/BackendUtil.cpp (+1) - (modified) clang/lib/Driver/ToolChains/Clang.cpp (+18) - (modified) clang/lib/Driver/ToolChains/CommonArgs.cpp (+21) - (added) clang/test/Driver/crel.c (+24) - (added) clang/test/Misc/cc1as-crel.s (+6) - (modified) clang/tools/driver/cc1as_main.cpp (+6) - (modified) llvm/include/llvm/BinaryFormat/DynamicTags.def (+2) - (modified) llvm/include/llvm/BinaryFormat/ELF.h (+1) - (modified) llvm/include/llvm/MC/MCTargetOptions.h (+3) - (modified) llvm/include/llvm/MC/MCTargetOptionsCommandFlags.h (+1) - (modified) llvm/include/llvm/Object/ELF.h (+5) - (modified) llvm/include/llvm/Object/ELFObjectFile.h (+64-6) - (modified) llvm/include/llvm/Object/ELFTypes.h (+25) - (modified) llvm/lib/MC/ELFObjectWriter.cpp (+84-26) - (modified) llvm/lib/MC/MCTargetOptionsCommandFlags.cpp (+6) - (modified) llvm/lib/Object/ELF.cpp (+63) - (modified) llvm/lib/ObjectYAML/ELFEmitter.cpp (+53-7) - (modified) llvm/lib/ObjectYAML/ELFYAML.cpp (+2) - (added) llvm/test/MC/ELF/crel-32.s (+16) - (added) llvm/test/MC/ELF/crel.s (+100) - (added) llvm/test/tools/llvm-readobj/ELF/crel.test (+180) - (modified) llvm/test/tools/llvm-readobj/ELF/dynamic-reloc.test (+25-6) - (modified) llvm/test/tools/llvm-readobj/ELF/relocation-errors.test (+18-1) - (modified) llvm/test/tools/yaml2obj/ELF/dynamic-relocations.yaml (+4-1) - (modified) llvm/test/tools/yaml2obj/ELF/reloc-sec-entry-size.yaml (+5) - (added) llvm/test/tools/yaml2obj/ELF/relocation-crel.yaml (+63) - (modified) llvm/test/tools/yaml2obj/ELF/relocation-missing-symbol.yaml (+2-1) - (modified) llvm/test/tools/yaml2obj/ELF/relocation-type.yaml (+3-1) - (modified) llvm/tools/llvm-readobj/ELFDumper.cpp (+75-6) ``diff diff --git a/clang/include/clang/Basic/CodeGenOptions.def b/clang/include/clang/Basic/CodeGenOptions.def index 340b08dd7e2a33..3229f77eef1fcc 100644 --- a/clang/include/clang/Basic/CodeGenOptions.def +++ b/clang/include/clang/Basic/CodeGenOptions.def @@ -36,6 +36,7 @@ VALUE_CODEGENOPT(Name, Bits, Default) #endif CODEGENOPT(DisableIntegratedAS, 1, 0) ///< -no-integrated-as +CODEGENOPT(Crel, 1, 0) ///< -Wa,--crel CODEGENOPT(RelaxELFRelocations, 1, 1) ///< -Wa,-mrelax-relocations={yes,no} CODEGENOPT(AsmVerbose, 1, 0) ///< -dA, -fverbose-asm. CODEGENOPT(PreserveAsmComments, 1, 1) ///< -dA, -fno-preserve-as-comments. diff --git a/clang/include/clang/Basic/DiagnosticDriverKinds.td b/clang/include/clang/Basic/DiagnosticDriverKinds.td index 9781fcaa4ff5e9..e9cea8967c1334 100644 --- a/clang/include/clang/Basic/DiagnosticDriverKinds.td +++ b/clang/include/clang/Basic/DiagnosticDriverKinds.td @@ -809,6 +809,9 @@ def warn_drv_missing_multilib : Warning< def note_drv_available_multilibs : Note< "available multilibs are:%0">; +def err_drv_experimental_crel : Error< + "-Wa,--experimental-crel must be specified to use -Wa,--crel. CREL is experimental and takes a non-standard section type code">; + def warn_android_unversioned_fallback : Warning< "Using unversioned Android target directory %0 for target %1. Unversioned" " directories will not be used in
[clang] [llvm] [MC,clang,llvm-readobj,yaml2obj] Support CREL relocation format (PR #91280)
llvmbot wrote: @llvm/pr-subscribers-mc Author: Fangrui Song (MaskRay) Changes CREL is a compact relocation format for the ELF object file format. This patch adds integrated assembler support (using the RELA form), which can be enabled with `clang -c -Wa,--crel,--experimental-crel`. `-Wa,--experimental-crel` indicates that CREL is experimental and not a standard. `-Wa,--experimental-crel` might be removed in the future. * We take a section type code 20 from the generic range for `SHT_CREL`. We avoided using `SHT_LLVM_` or `SHT_GNU_` to maintain broader applicability for interested psABIs. * In the extremely unlikely case the generic ABI assigns 20 to another purpose, and existing toolchains generate relocatable files using that code (unlikely if we ensure GNU and LLVM don't do this), any conflicts would be the user's responsibility to resolve. This patch also adds llvm-readobj support (for both REL and RELA forms) to facilitate testing the assembler. Additionally, yaml2obj gains support for the RELA form to aid testing with llvm-readobj. Currently, linking the generated relocatable file with GNU ld will fail because GNU ld doesn't support CREL yet. unknown architecture of input file `a.o' is incompatible with i386:x86-64 output lld will also produce an error when attempting to link a CREL relocatable file. The support will come in a future change. Link: https://discourse.llvm.org/t/rfc-crel-a-compact-relocation-format-for-elf/77600 --- Patch is 72.41 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/91280.diff 32 Files Affected: - (modified) clang/include/clang/Basic/CodeGenOptions.def (+1) - (modified) clang/include/clang/Basic/DiagnosticDriverKinds.td (+3) - (modified) clang/include/clang/Driver/Options.td (+3) - (modified) clang/lib/CodeGen/BackendUtil.cpp (+1) - (modified) clang/lib/Driver/ToolChains/Clang.cpp (+18) - (modified) clang/lib/Driver/ToolChains/CommonArgs.cpp (+21) - (added) clang/test/Driver/crel.c (+24) - (added) clang/test/Misc/cc1as-crel.s (+6) - (modified) clang/tools/driver/cc1as_main.cpp (+6) - (modified) llvm/include/llvm/BinaryFormat/DynamicTags.def (+2) - (modified) llvm/include/llvm/BinaryFormat/ELF.h (+1) - (modified) llvm/include/llvm/MC/MCTargetOptions.h (+3) - (modified) llvm/include/llvm/MC/MCTargetOptionsCommandFlags.h (+1) - (modified) llvm/include/llvm/Object/ELF.h (+5) - (modified) llvm/include/llvm/Object/ELFObjectFile.h (+64-6) - (modified) llvm/include/llvm/Object/ELFTypes.h (+25) - (modified) llvm/lib/MC/ELFObjectWriter.cpp (+84-26) - (modified) llvm/lib/MC/MCTargetOptionsCommandFlags.cpp (+6) - (modified) llvm/lib/Object/ELF.cpp (+63) - (modified) llvm/lib/ObjectYAML/ELFEmitter.cpp (+53-7) - (modified) llvm/lib/ObjectYAML/ELFYAML.cpp (+2) - (added) llvm/test/MC/ELF/crel-32.s (+16) - (added) llvm/test/MC/ELF/crel.s (+100) - (added) llvm/test/tools/llvm-readobj/ELF/crel.test (+180) - (modified) llvm/test/tools/llvm-readobj/ELF/dynamic-reloc.test (+25-6) - (modified) llvm/test/tools/llvm-readobj/ELF/relocation-errors.test (+18-1) - (modified) llvm/test/tools/yaml2obj/ELF/dynamic-relocations.yaml (+4-1) - (modified) llvm/test/tools/yaml2obj/ELF/reloc-sec-entry-size.yaml (+5) - (added) llvm/test/tools/yaml2obj/ELF/relocation-crel.yaml (+63) - (modified) llvm/test/tools/yaml2obj/ELF/relocation-missing-symbol.yaml (+2-1) - (modified) llvm/test/tools/yaml2obj/ELF/relocation-type.yaml (+3-1) - (modified) llvm/tools/llvm-readobj/ELFDumper.cpp (+75-6) ``diff diff --git a/clang/include/clang/Basic/CodeGenOptions.def b/clang/include/clang/Basic/CodeGenOptions.def index 340b08dd7e2a33..3229f77eef1fcc 100644 --- a/clang/include/clang/Basic/CodeGenOptions.def +++ b/clang/include/clang/Basic/CodeGenOptions.def @@ -36,6 +36,7 @@ VALUE_CODEGENOPT(Name, Bits, Default) #endif CODEGENOPT(DisableIntegratedAS, 1, 0) ///< -no-integrated-as +CODEGENOPT(Crel, 1, 0) ///< -Wa,--crel CODEGENOPT(RelaxELFRelocations, 1, 1) ///< -Wa,-mrelax-relocations={yes,no} CODEGENOPT(AsmVerbose, 1, 0) ///< -dA, -fverbose-asm. CODEGENOPT(PreserveAsmComments, 1, 1) ///< -dA, -fno-preserve-as-comments. diff --git a/clang/include/clang/Basic/DiagnosticDriverKinds.td b/clang/include/clang/Basic/DiagnosticDriverKinds.td index 9781fcaa4ff5e9..e9cea8967c1334 100644 --- a/clang/include/clang/Basic/DiagnosticDriverKinds.td +++ b/clang/include/clang/Basic/DiagnosticDriverKinds.td @@ -809,6 +809,9 @@ def warn_drv_missing_multilib : Warning< def note_drv_available_multilibs : Note< "available multilibs are:%0">; +def err_drv_experimental_crel : Error< + "-Wa,--experimental-crel must be specified to use -Wa,--crel. CREL is experimental and takes a non-standard section type code">; + def warn_android_unversioned_fallback : Warning< "Using unversioned Android target directory %0 for target %1. Unversioned" " directories will not be used in Clang 19. Provide a versioned direct
[clang] [llvm] [MC,clang,llvm-readobj,yaml2obj] Support CREL relocation format (PR #91280)
https://github.com/MaskRay created https://github.com/llvm/llvm-project/pull/91280 CREL is a compact relocation format for the ELF object file format. This patch adds integrated assembler support (using the RELA form), which can be enabled with `clang -c -Wa,--crel,--experimental-crel`. `-Wa,--experimental-crel` indicates that CREL is experimental and not a standard. `-Wa,--experimental-crel` might be removed in the future. * We take a section type code 20 from the generic range for `SHT_CREL`. We avoided using `SHT_LLVM_` or `SHT_GNU_` to maintain broader applicability for interested psABIs. * In the extremely unlikely case the generic ABI assigns 20 to another purpose, and existing toolchains generate relocatable files using that code (unlikely if we ensure GNU and LLVM don't do this), any conflicts would be the user's responsibility to resolve. This patch also adds llvm-readobj support (for both REL and RELA forms) to facilitate testing the assembler. Additionally, yaml2obj gains support for the RELA form to aid testing with llvm-readobj. Currently, linking the generated relocatable file with GNU ld will fail because GNU ld doesn't support CREL yet. unknown architecture of input file `a.o' is incompatible with i386:x86-64 output lld will also produce an error when attempting to link a CREL relocatable file. The support will come in a future change. Link: https://discourse.llvm.org/t/rfc-crel-a-compact-relocation-format-for-elf/77600 >From a0cfafb82db825512b0ca44778fa9d4bb435563d Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Mon, 6 May 2024 15:37:50 -0700 Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20initia?= =?UTF-8?q?l=20version?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Created using spr 1.3.5-bogner --- clang/include/clang/Basic/CodeGenOptions.def | 1 + .../clang/Basic/DiagnosticDriverKinds.td | 3 + clang/include/clang/Driver/Options.td | 3 + clang/lib/CodeGen/BackendUtil.cpp | 1 + clang/lib/Driver/ToolChains/Clang.cpp | 18 ++ clang/lib/Driver/ToolChains/CommonArgs.cpp| 21 ++ clang/test/Driver/crel.c | 24 +++ clang/test/Misc/cc1as-crel.s | 6 + clang/tools/driver/cc1as_main.cpp | 6 + .../include/llvm/BinaryFormat/DynamicTags.def | 2 + llvm/include/llvm/BinaryFormat/ELF.h | 1 + llvm/include/llvm/MC/MCTargetOptions.h| 3 + .../llvm/MC/MCTargetOptionsCommandFlags.h | 1 + llvm/include/llvm/Object/ELF.h| 5 + llvm/include/llvm/Object/ELFObjectFile.h | 70 ++- llvm/include/llvm/Object/ELFTypes.h | 25 +++ llvm/lib/MC/ELFObjectWriter.cpp | 110 --- llvm/lib/MC/MCTargetOptionsCommandFlags.cpp | 6 + llvm/lib/Object/ELF.cpp | 63 ++ llvm/lib/ObjectYAML/ELFEmitter.cpp| 60 +- llvm/lib/ObjectYAML/ELFYAML.cpp | 2 + llvm/test/MC/ELF/crel-32.s| 16 ++ llvm/test/MC/ELF/crel.s | 100 ++ llvm/test/tools/llvm-readobj/ELF/crel.test| 180 ++ .../tools/llvm-readobj/ELF/dynamic-reloc.test | 31 ++- .../llvm-readobj/ELF/relocation-errors.test | 19 +- .../yaml2obj/ELF/dynamic-relocations.yaml | 5 +- .../yaml2obj/ELF/reloc-sec-entry-size.yaml| 5 + .../tools/yaml2obj/ELF/relocation-crel.yaml | 63 ++ .../ELF/relocation-missing-symbol.yaml| 3 +- .../tools/yaml2obj/ELF/relocation-type.yaml | 4 +- llvm/tools/llvm-readobj/ELFDumper.cpp | 81 +++- 32 files changed, 883 insertions(+), 55 deletions(-) create mode 100644 clang/test/Driver/crel.c create mode 100644 clang/test/Misc/cc1as-crel.s create mode 100644 llvm/test/MC/ELF/crel-32.s create mode 100644 llvm/test/MC/ELF/crel.s create mode 100644 llvm/test/tools/llvm-readobj/ELF/crel.test create mode 100644 llvm/test/tools/yaml2obj/ELF/relocation-crel.yaml diff --git a/clang/include/clang/Basic/CodeGenOptions.def b/clang/include/clang/Basic/CodeGenOptions.def index 340b08dd7e2a33..3229f77eef1fcc 100644 --- a/clang/include/clang/Basic/CodeGenOptions.def +++ b/clang/include/clang/Basic/CodeGenOptions.def @@ -36,6 +36,7 @@ VALUE_CODEGENOPT(Name, Bits, Default) #endif CODEGENOPT(DisableIntegratedAS, 1, 0) ///< -no-integrated-as +CODEGENOPT(Crel, 1, 0) ///< -Wa,--crel CODEGENOPT(RelaxELFRelocations, 1, 1) ///< -Wa,-mrelax-relocations={yes,no} CODEGENOPT(AsmVerbose, 1, 0) ///< -dA, -fverbose-asm. CODEGENOPT(PreserveAsmComments, 1, 1) ///< -dA, -fno-preserve-as-comments. diff --git a/clang/include/clang/Basic/DiagnosticDriverKinds.td b/clang/include/clang/Basic/DiagnosticDriverKinds.td index 9781fcaa4ff5e9..e9cea8967c1334 100644 --- a/clang/include/clang/Basic/DiagnosticDriverKinds.td +++ b/clang/include/clang/Basic/DiagnosticDriverKinds.td @@ -809,6 +809,9 @@ def warn_drv
[clang] Use cmake to find perl executable (PR #91275)
https://github.com/MatzeB updated https://github.com/llvm/llvm-project/pull/91275 >From c0b7ec2e336476b1a1d6cf05d07bfde2f3dc88a4 Mon Sep 17 00:00:00 2001 From: Matthias Braun Date: Mon, 6 May 2024 14:39:37 -0700 Subject: [PATCH 1/2] Use cmake to find perl executable --- clang/CMakeLists.txt | 2 ++ clang/test/Analysis/scan-build/cxx-name.test | 2 +- clang/test/Analysis/scan-build/deduplication.test | 3 +-- clang/test/Analysis/scan-build/exclude_directories.test| 3 +-- clang/test/Analysis/scan-build/help.test | 3 +-- clang/test/Analysis/scan-build/html_output.test| 3 +-- clang/test/Analysis/scan-build/lit.local.cfg | 3 ++- clang/test/Analysis/scan-build/plist_html_output.test | 3 +-- clang/test/Analysis/scan-build/plist_output.test | 3 +-- .../test/Analysis/scan-build/rebuild_index/rebuild_index.test | 3 +-- clang/test/Analysis/scan-build/silence-core-checkers.test | 3 +-- clang/test/lit.cfg.py | 3 +++ clang/test/lit.site.cfg.py.in | 1 + 13 files changed, 17 insertions(+), 18 deletions(-) diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt index cf97e3c6e851ae..c20ce47a12abbd 100644 --- a/clang/CMakeLists.txt +++ b/clang/CMakeLists.txt @@ -523,6 +523,8 @@ endif() if( CLANG_INCLUDE_TESTS ) + find_package(Perl) + add_subdirectory(unittests) list(APPEND CLANG_TEST_DEPS ClangUnitTests) list(APPEND CLANG_TEST_PARAMS diff --git a/clang/test/Analysis/scan-build/cxx-name.test b/clang/test/Analysis/scan-build/cxx-name.test index 483762d619d178..789f7e0ac197c6 100644 --- a/clang/test/Analysis/scan-build/cxx-name.test +++ b/clang/test/Analysis/scan-build/cxx-name.test @@ -1,4 +1,4 @@ -REQUIRES: shell +REQUIRES: perl RUN: %scan-build sh -c 'echo "CLANG_CXX=/$(basename "$CLANG_CXX")/"' | FileCheck %s diff --git a/clang/test/Analysis/scan-build/deduplication.test b/clang/test/Analysis/scan-build/deduplication.test index 56d888e5fc12a2..62375d9aadfa85 100644 --- a/clang/test/Analysis/scan-build/deduplication.test +++ b/clang/test/Analysis/scan-build/deduplication.test @@ -1,5 +1,4 @@ -// FIXME: Actually, "perl". -REQUIRES: shell +REQUIRES: perl RUN: rm -rf %t.output_dir && mkdir %t.output_dir RUN: %scan-build -o %t.output_dir \ diff --git a/clang/test/Analysis/scan-build/exclude_directories.test b/clang/test/Analysis/scan-build/exclude_directories.test index c161e51b6d26c5..c15568f0b6bb9e 100644 --- a/clang/test/Analysis/scan-build/exclude_directories.test +++ b/clang/test/Analysis/scan-build/exclude_directories.test @@ -1,5 +1,4 @@ -// FIXME: Actually, "perl". -REQUIRES: shell +REQUIRES: perl RUN: rm -rf %t.output_dir && mkdir %t.output_dir RUN: %scan-build -o %t.output_dir %clang -S \ diff --git a/clang/test/Analysis/scan-build/help.test b/clang/test/Analysis/scan-build/help.test index 61915d32609439..2966507b6080cd 100644 --- a/clang/test/Analysis/scan-build/help.test +++ b/clang/test/Analysis/scan-build/help.test @@ -1,5 +1,4 @@ -// FIXME: Actually, "perl". -REQUIRES: shell +REQUIRES: perl RUN: %scan-build -h | FileCheck %s RUN: %scan-build --help | FileCheck %s diff --git a/clang/test/Analysis/scan-build/html_output.test b/clang/test/Analysis/scan-build/html_output.test index add35d83b95887..2d5c001e83960d 100644 --- a/clang/test/Analysis/scan-build/html_output.test +++ b/clang/test/Analysis/scan-build/html_output.test @@ -1,5 +1,4 @@ -// FIXME: Actually, "perl". -REQUIRES: shell +REQUIRES: perl RUN: rm -rf %t.output_dir && mkdir %t.output_dir RUN: %scan-build -o %t.output_dir %clang -S %S/Inputs/single_null_dereference.c \ diff --git a/clang/test/Analysis/scan-build/lit.local.cfg b/clang/test/Analysis/scan-build/lit.local.cfg index fab52b1c7bd679..e606243ea73a48 100644 --- a/clang/test/Analysis/scan-build/lit.local.cfg +++ b/clang/test/Analysis/scan-build/lit.local.cfg @@ -12,8 +12,9 @@ clang_path = config.clang if config.have_llvm_driver else os.path.realpath(confi config.substitutions.append( ( "%scan-build", -"'%s' --use-analyzer=%s " +"'%s' '%s' --use-analyzer=%s " % ( +config.perl_executable, lit.util.which( "scan-build", os.path.join(config.clang_src_dir, "tools", "scan-build", "bin"), diff --git a/clang/test/Analysis/scan-build/plist_html_output.test b/clang/test/Analysis/scan-build/plist_html_output.test index c07891e35fbf33..811bca22b07643 100644 --- a/clang/test/Analysis/scan-build/plist_html_output.test +++ b/clang/test/Analysis/scan-build/plist_html_output.test @@ -1,5 +1,4 @@ -// FIXME: Actually, "perl". -REQUIRES: shell +REQUIRES: perl RUN: rm -rf %t.output_dir && mkdir %t.output_dir RUN: %scan-build -plist-html -o %t.output_dir %clang -S %S/Inputs/single_null_dereference.c \ diff --git a/clang/
[clang] Use cmake to find perl executable (PR #91275)
llvmbot wrote: @llvm/pr-subscribers-clang Author: Matthias Braun (MatzeB) Changes `clang/tools/scan-build` is implemented in `perl`. However given `perl` is not mentioned as a required dependency in `GettingStarted.rst` we should make this optional. This adds a `find_package(Perl)` check to cmake and disables the `scan-build` tests when no perl executable is found. Ideally we would also check if dependent perl modules like `Hash::Util` are present on the system, but I don't see any pre-existing cmake macros to easily test this. So for now I go with a plain check for the `perl` package, at least this allows to use `cmake -DCMAKE_DISBALE_FIND_PACKAGE_Perl=ON` to manually disable `perl` and the tests. --- Full diff: https://github.com/llvm/llvm-project/pull/91275.diff 13 Files Affected: - (modified) clang/CMakeLists.txt (+2) - (modified) clang/test/Analysis/scan-build/cxx-name.test (+1-1) - (modified) clang/test/Analysis/scan-build/deduplication.test (+1-2) - (modified) clang/test/Analysis/scan-build/exclude_directories.test (+1-2) - (modified) clang/test/Analysis/scan-build/help.test (+1-2) - (modified) clang/test/Analysis/scan-build/html_output.test (+1-2) - (modified) clang/test/Analysis/scan-build/lit.local.cfg (+2-1) - (modified) clang/test/Analysis/scan-build/plist_html_output.test (+1-2) - (modified) clang/test/Analysis/scan-build/plist_output.test (+1-2) - (modified) clang/test/Analysis/scan-build/rebuild_index/rebuild_index.test (+1-2) - (modified) clang/test/Analysis/scan-build/silence-core-checkers.test (+1-2) - (modified) clang/test/lit.cfg.py (+3) - (modified) clang/test/lit.site.cfg.py.in (+1) ``diff diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt index cf97e3c6e851ae..c20ce47a12abbd 100644 --- a/clang/CMakeLists.txt +++ b/clang/CMakeLists.txt @@ -523,6 +523,8 @@ endif() if( CLANG_INCLUDE_TESTS ) + find_package(Perl) + add_subdirectory(unittests) list(APPEND CLANG_TEST_DEPS ClangUnitTests) list(APPEND CLANG_TEST_PARAMS diff --git a/clang/test/Analysis/scan-build/cxx-name.test b/clang/test/Analysis/scan-build/cxx-name.test index 483762d619d178..789f7e0ac197c6 100644 --- a/clang/test/Analysis/scan-build/cxx-name.test +++ b/clang/test/Analysis/scan-build/cxx-name.test @@ -1,4 +1,4 @@ -REQUIRES: shell +REQUIRES: perl RUN: %scan-build sh -c 'echo "CLANG_CXX=/$(basename "$CLANG_CXX")/"' | FileCheck %s diff --git a/clang/test/Analysis/scan-build/deduplication.test b/clang/test/Analysis/scan-build/deduplication.test index 56d888e5fc12a2..62375d9aadfa85 100644 --- a/clang/test/Analysis/scan-build/deduplication.test +++ b/clang/test/Analysis/scan-build/deduplication.test @@ -1,5 +1,4 @@ -// FIXME: Actually, "perl". -REQUIRES: shell +REQUIRES: perl RUN: rm -rf %t.output_dir && mkdir %t.output_dir RUN: %scan-build -o %t.output_dir \ diff --git a/clang/test/Analysis/scan-build/exclude_directories.test b/clang/test/Analysis/scan-build/exclude_directories.test index c161e51b6d26c5..c15568f0b6bb9e 100644 --- a/clang/test/Analysis/scan-build/exclude_directories.test +++ b/clang/test/Analysis/scan-build/exclude_directories.test @@ -1,5 +1,4 @@ -// FIXME: Actually, "perl". -REQUIRES: shell +REQUIRES: perl RUN: rm -rf %t.output_dir && mkdir %t.output_dir RUN: %scan-build -o %t.output_dir %clang -S \ diff --git a/clang/test/Analysis/scan-build/help.test b/clang/test/Analysis/scan-build/help.test index 61915d32609439..2966507b6080cd 100644 --- a/clang/test/Analysis/scan-build/help.test +++ b/clang/test/Analysis/scan-build/help.test @@ -1,5 +1,4 @@ -// FIXME: Actually, "perl". -REQUIRES: shell +REQUIRES: perl RUN: %scan-build -h | FileCheck %s RUN: %scan-build --help | FileCheck %s diff --git a/clang/test/Analysis/scan-build/html_output.test b/clang/test/Analysis/scan-build/html_output.test index add35d83b95887..2d5c001e83960d 100644 --- a/clang/test/Analysis/scan-build/html_output.test +++ b/clang/test/Analysis/scan-build/html_output.test @@ -1,5 +1,4 @@ -// FIXME: Actually, "perl". -REQUIRES: shell +REQUIRES: perl RUN: rm -rf %t.output_dir && mkdir %t.output_dir RUN: %scan-build -o %t.output_dir %clang -S %S/Inputs/single_null_dereference.c \ diff --git a/clang/test/Analysis/scan-build/lit.local.cfg b/clang/test/Analysis/scan-build/lit.local.cfg index fab52b1c7bd679..e606243ea73a48 100644 --- a/clang/test/Analysis/scan-build/lit.local.cfg +++ b/clang/test/Analysis/scan-build/lit.local.cfg @@ -12,8 +12,9 @@ clang_path = config.clang if config.have_llvm_driver else os.path.realpath(confi config.substitutions.append( ( "%scan-build", -"'%s' --use-analyzer=%s " +"'%s' '%s' --use-analyzer=%s " % ( +config.perl_executable, lit.util.which( "scan-build", os.path.join(config.clang_src_dir, "tools", "scan-build", "bin"), diff --git a/clang/test/Analysis/scan-build/plist_html_output.test b/clang/test/Analysis/scan-build/plist_htm
[clang] Use cmake to find perl executable (PR #91275)
https://github.com/MatzeB ready_for_review https://github.com/llvm/llvm-project/pull/91275 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [DirectX][DXIL] Set DXIL Version in DXIL target triple based on shader model version (PR #90809)
https://github.com/bharadwajy closed https://github.com/llvm/llvm-project/pull/90809 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 080978d - [DirectX][DXIL] Set DXIL Version in DXIL target triple based on shader model version (#90809)
Author: S. Bharadwaj Yadavalli Date: 2024-05-06T18:33:57-04:00 New Revision: 080978dd2067d0c9ea7e229aa7696c2480d89ef1 URL: https://github.com/llvm/llvm-project/commit/080978dd2067d0c9ea7e229aa7696c2480d89ef1 DIFF: https://github.com/llvm/llvm-project/commit/080978dd2067d0c9ea7e229aa7696c2480d89ef1.diff LOG: [DirectX][DXIL] Set DXIL Version in DXIL target triple based on shader model version (#90809) An earlier commit provided a way to decouple DXIL version from Shader Model version by representing the DXIL version as `SubArch` in the DXIL Target Triple and adding corresponding valid DXIL Arch types. This change constructs DXIL target triple with DXIL version that is deduced from Shader Model version specified in the following scenarios: 1. When compilation target profile is specified: For e.g., DXIL target triple `dxilv1.8-unknown-shader6.8-library` is constructed when `-T lib_6_8` is specified. 2. When DXIL target triple without DXIL version is specified: For e.g., DXIL target triple `dxilv1.8-pc-shadermodel6.8-library` is constructed when `-mtriple=dxil-pc-shadermodel6.8-library` is specified. Updated relevant HLSL tests that check for target triple. Validated that Clang (`check-clang`) and LLVM (`check-llvm`) regression tests pass. Added: Modified: clang/lib/Basic/Targets.cpp clang/lib/Driver/ToolChains/HLSL.cpp clang/test/CodeGenHLSL/basic-target.c clang/test/Driver/dxc_dxv_path.hlsl clang/test/Options/enable_16bit_types_validation.hlsl clang/unittests/Driver/DXCModeTest.cpp llvm/include/llvm/TargetParser/Triple.h llvm/lib/IR/Verifier.cpp llvm/lib/TargetParser/Triple.cpp llvm/unittests/TargetParser/TripleTest.cpp Removed: diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp index e3283510c6aac7..dc1792b3471e6c 100644 --- a/clang/lib/Basic/Targets.cpp +++ b/clang/lib/Basic/Targets.cpp @@ -760,7 +760,7 @@ using namespace clang::targets; TargetInfo * TargetInfo::CreateTargetInfo(DiagnosticsEngine &Diags, const std::shared_ptr &Opts) { - llvm::Triple Triple(Opts->Triple); + llvm::Triple Triple(llvm::Triple::normalize(Opts->Triple)); // Construct the target std::unique_ptr Target = AllocateTarget(Triple, *Opts); diff --git a/clang/lib/Driver/ToolChains/HLSL.cpp b/clang/lib/Driver/ToolChains/HLSL.cpp index 558e4db46f8182..8286e3be21803f 100644 --- a/clang/lib/Driver/ToolChains/HLSL.cpp +++ b/clang/lib/Driver/ToolChains/HLSL.cpp @@ -98,9 +98,49 @@ std::optional tryParseProfile(StringRef Profile) { else if (llvm::getAsUnsignedInteger(Parts[2], 0, Minor)) return std::nullopt; - // dxil-unknown-shadermodel-hull + // Determine DXIL version using the minor version number of Shader + // Model version specified in target profile. Prior to decoupling DXIL version + // numbering from that of Shader Model DXIL version 1.Y corresponds to SM 6.Y. + // E.g., dxilv1.Y-unknown-shadermodelX.Y-hull llvm::Triple T; - T.setArch(Triple::ArchType::dxil); + Triple::SubArchType SubArch = llvm::Triple::NoSubArch; + switch (Minor) { + case 0: +SubArch = llvm::Triple::DXILSubArch_v1_0; +break; + case 1: +SubArch = llvm::Triple::DXILSubArch_v1_1; +break; + case 2: +SubArch = llvm::Triple::DXILSubArch_v1_2; +break; + case 3: +SubArch = llvm::Triple::DXILSubArch_v1_3; +break; + case 4: +SubArch = llvm::Triple::DXILSubArch_v1_4; +break; + case 5: +SubArch = llvm::Triple::DXILSubArch_v1_5; +break; + case 6: +SubArch = llvm::Triple::DXILSubArch_v1_6; +break; + case 7: +SubArch = llvm::Triple::DXILSubArch_v1_7; +break; + case 8: +SubArch = llvm::Triple::DXILSubArch_v1_8; +break; + case OfflineLibMinor: +// Always consider minor version x as the latest supported DXIL version +SubArch = llvm::Triple::LatestDXILSubArch; +break; + default: +// No DXIL Version corresponding to specified Shader Model version found +return std::nullopt; + } + T.setArch(Triple::ArchType::dxil, SubArch); T.setOSName(Triple::getOSTypeName(Triple::OSType::ShaderModel).str() + VersionTuple(Major, Minor).getAsString()); T.setEnvironment(Kind); diff --git a/clang/test/CodeGenHLSL/basic-target.c b/clang/test/CodeGenHLSL/basic-target.c index 8db711c3f2a5b1..b97ebf90a7a107 100644 --- a/clang/test/CodeGenHLSL/basic-target.c +++ b/clang/test/CodeGenHLSL/basic-target.c @@ -7,4 +7,4 @@ // RUN: %clang -target dxil-pc-shadermodel6.0-geometry -S -emit-llvm -o - %s | FileCheck %s // CHECK: target datalayout = "e-m:e-p:32:32-i1:32-i8:8-i16:16-i32:32-i64:64-f16:16-f32:32-f64:64-n8:16:32:64" -// CHECK: target triple = "dxil-pc-shadermodel6.0-{{[a-z]+}}" +// CHECK: target triple = "dxilv1.0-pc-shadermodel6.0-{{[a-z]+}}" diff --git a/clang/test/Driver/dxc_dxv_path.hlsl b/clang/test/Driver/dxc_dxv_path.hlsl index 3d
[clang] Duplicate condition (PR #91279)
jyu2-git wrote: Sorry, I don't why to patch merge to one. I am trying again. https://github.com/llvm/llvm-project/pull/91279 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] Duplicate condition (PR #91279)
https://github.com/jyu2-git converted_to_draft https://github.com/llvm/llvm-project/pull/91279 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] Duplicate condition (PR #91279)
llvmbot wrote: @llvm/pr-subscribers-clang Author: None (jyu2-git) Changes --- Patch is 30.49 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/91279.diff 5 Files Affected: - (modified) clang/include/clang/Basic/DiagnosticParseKinds.td (+5) - (modified) clang/lib/Parse/ParseOpenMP.cpp (+43-8) - (modified) clang/lib/Sema/SemaOpenMP.cpp (+1-2) - (modified) clang/test/OpenMP/target_ast_print.cpp (+58) - (modified) clang/test/OpenMP/target_map_messages.cpp (+59-46) ``diff 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 18ba1185ee8de7..5265d8f1922c31 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().OpenMP >= 51 ? (getLangOpts().OpenMP >= 52 ? 2 : 1) : 0) @@ -4278,6 +4304,14 @@ bool Parser::parseMapTypeModifiers(SemaOpenMP::OpenMPVarListDataTy &Data) { if (getCurToken().is(tok::comma)) ConsumeToken(); } + if (getLangOpts().OpenMP >= 60 && !HasMapType) { +if (!Tok.is(tok::colon)) { + Diag(Tok
[clang] Duplicate condition (PR #91279)
https://github.com/jyu2-git created https://github.com/llvm/llvm-project/pull/91279 None >From 563c1254162d7b42fd7579514f45df326216f508 Mon Sep 17 00:00:00 2001 From: Jennifer Yu Date: Sun, 5 May 2024 10:44:40 -0700 Subject: [PATCH 1/2] Revert "Revert "[OpenMP][TR12] change property of map-type modifier." (#90885)" This reverts commit eea81aa29848361eb5b24f24d2af643fdeb9adfd. --- .../clang/Basic/DiagnosticParseKinds.td | 5 + clang/lib/Parse/ParseOpenMP.cpp | 51 +++-- clang/test/OpenMP/target_ast_print.cpp| 58 ++ clang/test/OpenMP/target_map_messages.cpp | 105 ++ 4 files changed, 165 insertions(+), 54 deletions(-) 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 18ba1185ee8de7..5265d8f1922c31 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().OpenMP >= 51 ? (getLangOpts().OpenMP >= 52 ? 2 : 1) : 0) @@ -4278,6 +4304,14 @@ bool Parser::parseMapTypeModifiers(SemaOpenMP::OpenMPVarListDataTy &Data) { if (get
[clang] [alpha.webkit.UncountedCallArgsChecker] Treat (foo())->bar() like foo()->bar(). (PR #91052)
https://github.com/haoNoQ approved this pull request. LGTM! Yeah I really don't know why `ParenExpr` needed to be a thing in the AST. https://github.com/llvm/llvm-project/pull/91052 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [webkit.RefCntblBaseVirtualDtor] Ignore WTF::RefCounted and its variants missing virtual destructor (PR #91009)
https://github.com/haoNoQ approved this pull request. LGTM! https://github.com/llvm/llvm-project/pull/91009 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang-tools-extra] [llvm] [clang][modules] stdarg.h and stddef.h shouldn't directly declare anything (PR #90676)
https://github.com/Bigcheese approved this pull request. lgtm https://github.com/llvm/llvm-project/pull/90676 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] Use cmake to find perl executable (PR #91275)
https://github.com/jroelofs approved this pull request. https://github.com/llvm/llvm-project/pull/91275 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] Use cmake to find perl executable (PR #91275)
@@ -1,4 +1,4 @@ -REQUIRES: shell +REQUIRES: perl jroelofs wrote: (the rest of them seem fine though) https://github.com/llvm/llvm-project/pull/91275 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] Use cmake to find perl executable (PR #91275)
@@ -1,4 +1,4 @@ -REQUIRES: shell +REQUIRES: perl jroelofs wrote: should be: ``` REQUIRES: perl, shell ``` right? https://github.com/llvm/llvm-project/pull/91275 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] Use cmake to find perl executable (PR #91275)
MatzeB wrote: I checked that: - scan-build tests run fine by default on my machine. - scan-build tests are skipped when using `cmake -DCMAKE_DISBALE_FIND_PACKAGE_Perl=ON ...`. https://github.com/llvm/llvm-project/pull/91275 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Modules] Detect ODR mismatches for enums in non-C++ like in C++. (PR #90298)
dwblaikie wrote: > Though we detect when the types aren't identical and don't try to use them > interchangeably. The change extends the existing behavior for structs/unions > to enums. OK, still a bit confused though - "like in C++", I assume in C++ we reject mismatched types coming from different modules. But it sounds like in C you're suggesting that we (moreso with this patch) detect mismatches and silently allow different type definitions to work? Which would presumably be the right thing for C. So, I guess, maybe my concern is only with a confusing title/description... https://github.com/llvm/llvm-project/pull/90298 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] Use cmake to find perl executable (PR #91275)
https://github.com/MatzeB edited https://github.com/llvm/llvm-project/pull/91275 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [Libomptarget] Statically link all plugin runtimes (PR #87009)
jhuber6 wrote: > I did not build upstream but looking at downstream, I think for some reason > they don't show up as duplicate symbols. But looking at the code, they should > be removed. There are uses of those variables in the plugin, so there should > be only 1 definition. Does this apply for anything OMPT related inside of the plugin? There's a few places where we mark callbacks, but those can all be moved into `libomptarget` once this lands. https://github.com/llvm/llvm-project/pull/87009 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [Libomptarget] Statically link all plugin runtimes (PR #87009)
dhruvachak wrote: > > There are duplicate definitions of the following > > ``` > > bool llvm::omp::target::ompt::Initialized = false; > > > > ompt_get_callback_t llvm::omp::target::ompt::lookupCallbackByCode = nullptr; > > ompt_function_lookup_t llvm::omp::target::ompt::lookupCallbackByName = > > nullptr; > > ``` > > > > > > > > > > > > > > > > > > > > > > > > in src/OpenMP/OMPT/Callback.cpp and > > plugins-nextgen/common/OMPT/OmptCallback.cpp > > Can you remove the ones in the plugin? Otherwise, it's not clear which > > definition is being used. > > Sure, do you get that upstream? If so, wonder why I didn't get it. I did not build upstream but looking at downstream, I think for some reason they don't show up as duplicate symbols. But looking at the code, they should be removed. There are uses of those variables in the plugin, so there should be only 1 definition. > > I guess we would just have it to where the `libomptarget` instance handles > all the OMPT. https://github.com/llvm/llvm-project/pull/87009 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits