[clang-tools-extra] [compiler-rt] [lldb] [llvm] [Memprof] Adds the option to collect AccessCountHistograms for memprof. (PR #94264)
@@ -124,6 +124,13 @@ struct PortableMemInfoBlock { OS << "" << #Name << ": " << Name << "\n"; #include "llvm/ProfileData/MIBEntryDef.inc" #undef MIBEntryDef +if (AccessHistogramSize > 0) { + OS << "" << "AccessHistogramValues" << ":"; + for (uint32_t I = 0; I < AccessHistogramSize; ++I) { +OS << " -" << ((uint64_t *)AccessHistogram)[I]; mattweingarten wrote: I though only having space delimiting did not produce valid yaml, I double checked and was wrong. Changed to space delimiting, thanks! https://github.com/llvm/llvm-project/pull/94264 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] [compiler-rt] [lldb] [llvm] [Memprof] Adds the option to collect AccessCountHistograms for memprof. (PR #94264)
@@ -20,25 +20,25 @@ CHECK-NEXT: - CHECK: Records: CHECK-NEXT: - -CHECK-NEXT:FunctionGUID: 15505678318020221912 +CHECK-NEXT:FunctionGUID: 3873612792189045660 CHECK-NEXT:AllocSites: CHECK-NEXT:- CHECK-NEXT: Callstack: CHECK-NEXT: - -CHECK-NEXT:Function: 15505678318020221912 -CHECK-NEXT:SymbolName: qux +CHECK-NEXT:Function: 3873612792189045660 +CHECK-NEXT:SymbolName: _Z3quxi mattweingarten wrote: good question, I suspect this test has not been regenerated in a long time and something changed in meantime in memprof? I think it might have to do with the SymbolNames being mangled vs demangled, which changes the hash value? Is it a problem that the hash value changed? https://github.com/llvm/llvm-project/pull/94264 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang-format] Don't count template template parameter as declaration (PR #96396)
rymiel wrote: Isn't fixing bugs meant to change defaults? See #61732, #48746 and #93793. The old version is confusing since it looks like a separate template parameter when it isn't. https://github.com/llvm/llvm-project/pull/96396 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] [compiler-rt] [lldb] [llvm] [Memprof] Adds the option to collect AccessCountHistograms for memprof. (PR #94264)
@@ -0,0 +1,101 @@ +REQUIRES: x86_64-linux + +This is a copy of memprof-basict.test with slight changes to check that we can still read v3 of memprofraw. + +To update the inputs used below run Inputs/update_memprof_inputs.sh /path/to/updated/clang mattweingarten wrote: yes, good point! done. https://github.com/llvm/llvm-project/pull/94264 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [AArch64] Add ability to list extensions enabled for a target (PR #95805)
@@ -1841,7 +1868,8 @@ INSTANTIATE_TEST_SUITE_P( AArch64::AEK_PROFILE, AArch64::AEK_RAND, AArch64::AEK_FP16FML, AArch64::AEK_I8MM, AArch64::AEK_JSCVT, AArch64::AEK_FCMA, - AArch64::AEK_PAUTH, AArch64::AEK_PERFMON}), + AArch64::AEK_PAUTH, AArch64::AEK_PERFMON, + AArch64::AEK_CCDP}), pratlucas wrote: I don't see an advantage to not having AEK entries for all extensions. Having this correspondence not only increases testability, as shown by the changes in `TargetParserTest.cpp`, but also makes them consistently visible to the wider codebase via the Target Parser interface. https://github.com/llvm/llvm-project/pull/95805 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] [compiler-rt] [lldb] [llvm] [Memprof] Adds the option to collect AccessCountHistograms for memprof. (PR #94264)
@@ -0,0 +1,101 @@ +REQUIRES: x86_64-linux + +This is a copy of memprof-basict.test with slight changes to check that we can still read v3 of memprofraw. mattweingarten wrote: done https://github.com/llvm/llvm-project/pull/94264 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] [compiler-rt] [lldb] [llvm] [Memprof] Adds the option to collect AccessCountHistograms for memprof. (PR #94264)
@@ -508,7 +519,26 @@ void createProfileFileNameVar(Module ) { } } +// Set MemprofHistogramFlag as a Global veriable in IR. This makes it accessible +// to +// the runtime, changing shadow count behavior. +void createMemprofHistogramFlagVar(Module ) { + const StringRef VarName(MemProfHistogramFlagVar); + Type *IntTy1 = Type::getInt1Ty(M.getContext()); + auto MemprofHistogramFlag = new GlobalVariable( + M, IntTy1, true, GlobalValue::WeakAnyLinkage, + Constant::getIntegerValue(IntTy1, APInt(1, ClHistogram)), VarName); + // MemprofHistogramFlag->setVisibility(GlobalValue::HiddenVisibility); mattweingarten wrote: done. https://github.com/llvm/llvm-project/pull/94264 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] [compiler-rt] [lldb] [llvm] [Memprof] Adds the option to collect AccessCountHistograms for memprof. (PR #94264)
@@ -508,7 +519,26 @@ void createProfileFileNameVar(Module ) { } } +// Set MemprofHistogramFlag as a Global veriable in IR. This makes it accessible +// to mattweingarten wrote: done. https://github.com/llvm/llvm-project/pull/94264 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] [compiler-rt] [lldb] [llvm] [Memprof] Adds the option to collect AccessCountHistograms for memprof. (PR #94264)
@@ -610,13 +670,33 @@ RawMemProfReader::peekBuildIds(MemoryBuffer *DataBuffer) { return BuildIds.takeVector(); } +// FIXME: Add a schema for serializing similiar to IndexedMemprofReader. This +// will help being able to deserialize different versions raw memprof versions +// more easily. +llvm::SmallVector> +RawMemProfReader::readMemInfoBlocks(const char *Ptr) { + if (MemprofRawVersion == 3ULL) { +errs() << "Reading V3\n"; mattweingarten wrote: done. https://github.com/llvm/llvm-project/pull/94264 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] [compiler-rt] [lldb] [llvm] [Memprof] Adds the option to collect AccessCountHistograms for memprof. (PR #94264)
@@ -96,19 +102,63 @@ llvm::SmallVector readSegmentEntries(const char *Ptr) { } llvm::SmallVector> -readMemInfoBlocks(const char *Ptr) { +readMemInfoBlocksV3(const char *Ptr) { using namespace support; const uint64_t NumItemsToRead = - endian::readNext(Ptr); + endian::readNext(Ptr); + llvm::SmallVector> Items; for (uint64_t I = 0; I < NumItemsToRead; I++) { const uint64_t Id = -endian::readNext(Ptr); -const MemInfoBlock MIB = *reinterpret_cast(Ptr); +endian::readNext(Ptr); + +// We cheat a bit here and remove the const from cast to set the +// Histogram Pointer to newly allocated buffer. We also cheat, since V3 and +// V4 do not have the same fields. V3 is missing AccessHistogramSize and +// AccessHistogram. This means we read "dirty" data in here, but it should +// not segfault, since there will be callstack data placed after this in the +// binary format. +MemInfoBlock MIB = *reinterpret_cast(Ptr); +// Overwrite dirty data. mattweingarten wrote: My thought process is that the MemInfoBlock MIB is a allocated on the stack, since its a local variable and not a pointer. Meaning the reinterpret_cast copies the information from the data-buffer into the stack variable. Correct me if I am wrong https://github.com/llvm/llvm-project/pull/94264 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] [compiler-rt] [lldb] [llvm] [Memprof] Adds the option to collect AccessCountHistograms for memprof. (PR #94264)
@@ -205,8 +205,14 @@ class RawMemProfReader final : public MemProfReader { object::SectionedAddress getModuleOffset(uint64_t VirtualAddress); + llvm::SmallVector> + readMemInfoBlocks(const char *Ptr); + // The profiled binary. object::OwningBinary Binary; + // Version of raw memprof binary currently being read. Defaults to most update mattweingarten wrote: done. https://github.com/llvm/llvm-project/pull/94264 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [RISCV] Remove experimental from Ztso. (PR #96465)
preames wrote: > I think @preames told me he was keeping this experimental for a reason. Yes, revert pending. The concern here is that there are multiple possible ABIs here, and at the point I implemented this, the ABI chosen in my initial set of patches was compatible with the then current WMO ABI, but is *incompatible* with the revised ABI for load acquire/store release. I know there has been some work on this since, but the prominent warning comment has not been removed, and there is not discussion in this review about status. I will note that simply deleting a comment from the docs *which directly explain why something is still experimental* without discussing exactly that issue in the review thread is, IMO, poor behavior on all parties involved. https://github.com/llvm/llvm-project/pull/96465 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang-format] Add SpacesInParensOption for filtering repeated parens (PR #77522)
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/77522 >From 4a7489251b842da778dd839bd5af3db12ba0fe0b Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Mon, 17 Jul 2023 18:24:30 -0600 Subject: [PATCH 1/5] Add SpaceInParensOption ExceptDoubleParentheses This change allows finer control over addition of spaces between a pair of consecutive opening parentheses with a pair of closing parentheses. --- clang/docs/ClangFormatStyleOptions.rst | 28 +- clang/docs/ReleaseNotes.rst| 3 + clang/include/clang/Format/Format.h| 40 ++- clang/lib/Format/Format.cpp| 5 +- clang/lib/Format/TokenAnnotator.cpp| 70 +++-- clang/unittests/Format/ConfigParseTest.cpp | 21 +- clang/unittests/Format/FormatTest.cpp | 314 + 7 files changed, 441 insertions(+), 40 deletions(-) diff --git a/clang/docs/ClangFormatStyleOptions.rst b/clang/docs/ClangFormatStyleOptions.rst index bb00c20922d36..d5cda03e55f26 100644 --- a/clang/docs/ClangFormatStyleOptions.rst +++ b/clang/docs/ClangFormatStyleOptions.rst @@ -6214,6 +6214,7 @@ the configuration (without a prefix: ``Auto``). # Example of usage: SpacesInParens: Custom SpacesInParensOptions: + ExceptDoubleParentheses: false InConditionalStatements: true InEmptyParentheses: true @@ -6226,9 +6227,23 @@ the configuration (without a prefix: ``Auto``). # Should be declared this way: SpacesInParens: Custom SpacesInParensOptions: + ExceptDoubleParentheses: false InConditionalStatements: true Other: true + * ``bool ExceptDoubleParentheses`` Override any of the following options to prevent addition of space +between the first two parentheses in situations where a pair of +parentheses have been used. + +.. code-block:: c++ + + true: + __attribute__(( noreturn )) + __decltype__(( x )) + if (( a = b )) + false: + Uses the applicable option. + * ``bool InConditionalStatements`` Put a space in parentheses only inside conditional statements (``for/if/while/switch...``). @@ -6242,8 +6257,9 @@ the configuration (without a prefix: ``Auto``). .. code-block:: c++ - true: false: - x = ( int32 )y vs. x = (int32)y + true: false: + x = ( int32 )y vs.x = (int32)y + y = (( int (*)(int) )foo)(x); y = ((int (*)(int))foo)(x); * ``bool InEmptyParentheses`` Insert a space in empty parentheses, i.e. ``()``. @@ -6261,8 +6277,12 @@ the configuration (without a prefix: ``Auto``). .. code-block:: c++ - true: false: - t f( Deleted & ) & = delete; vs. t f(Deleted &) & = delete; + true: false: + t f( Deleted & ) & = delete;vs. t f(Deleted &) & = delete; + decltype( ( x ) ) decltype((x)) + x = ( (int32)y ) x = ((int32))y + y = ( (int ( * )( int ))foo )( x ); y = ((int (*)(int))foo)(x); + __attribute__( ( noreturn ) )__attribute__((noreturn)) .. _SpacesInParentheses: diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 92ada517acae3..bbb24a59191fa 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -1079,6 +1079,9 @@ clang-format - Adds ``AllowShortCaseExpressionOnASingleLine`` option. - Adds ``AlignCaseArrows`` suboption to ``AlignConsecutiveShortCaseStatements``. - Adds ``LeftWithLastLine`` suboption to ``AlignEscapedNewlines``. +- Add ``ExceptDoubleParentheses`` sub-option for ``SpacesInParensOptions`` + to override addition of spaces between multiple, non-redundant parentheses + similar to the rules used for ``RemoveParentheses``. libclang diff --git a/clang/include/clang/Format/Format.h b/clang/include/clang/Format/Format.h index 7d257be10af42..3469cbad027c2 100644 --- a/clang/include/clang/Format/Format.h +++ b/clang/include/clang/Format/Format.h @@ -4650,10 +4650,23 @@ struct FormatStyle { /// # Should be declared this way: /// SpacesInParens: Custom /// SpacesInParensOptions: + /// ExceptDoubleParentheses: false /// InConditionalStatements: true /// Other: true /// \endcode struct SpacesInParensCustom { +/// Override any of the following options to prevent addition of space +/// between the first two parentheses in situations where a pair of +/// parentheses have been used. +/// \code +/// true: +/// __attribute__(( noreturn )) +/// __decltype__(( x )) +/// if (( a = b )) +/// \endcode +/// false: +///Uses the applicable option. +bool ExceptDoubleParentheses; /// Put a space in parentheses only inside conditional statements /// (``for/if/while/switch...``). ///
[clang-tools-extra] [compiler-rt] [lldb] [llvm] [Memprof] Adds the option to collect AccessCountHistograms for memprof. (PR #94264)
@@ -38,4 +38,5 @@ MEMPROF_FLAG(bool, allocator_frees_and_returns_null_on_realloc_zero, true, MEMPROF_FLAG(bool, print_text, false, "If set, prints the heap profile in text format. Else use the raw binary serialization format.") MEMPROF_FLAG(bool, print_terse, false, - "If set, prints memory profile in a terse format. Only applicable if print_text = true.") + "If set, prints memory profile in a terse format. Only applicable " mattweingarten wrote: done. https://github.com/llvm/llvm-project/pull/94264 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] [compiler-rt] [lldb] [llvm] [Memprof] Adds the option to collect AccessCountHistograms for memprof. (PR #94264)
@@ -216,6 +228,35 @@ u64 GetShadowCount(uptr p, u32 size) { return count; } +// Accumulates the access count from the shadow for the given pointer and size. +// See memprof_mapping.h for an overview on histogram counters. +u64 GetShadowCountHistogram(uptr p, u32 size) { + u8 *shadow = (u8 *)HISTOGRAM_MEM_TO_SHADOW(p); + u8 *shadow_end = (u8 *)HISTOGRAM_MEM_TO_SHADOW(p + size); + u64 count = 0; + for (; shadow <= shadow_end; shadow++) +count += *shadow; + return count; +} + +// If we use the normal approach from clearCountersWithoutHistogram, the +// histogram will clear too much data and may overwrite shadow counters that are +// in use. Likely because of rounding up the shadow_end pointer. +// See memprof_mapping.h for an overview on histogram counters. +void clearCountersHistogram(uptr addr, uptr size) { + u8 *shadow_8 = (u8 *)HISTOGRAM_MEM_TO_SHADOW(addr); + u8 *shadow_end_8 = (u8 *)HISTOGRAM_MEM_TO_SHADOW(addr + size); + for (; shadow_8 < shadow_end_8; shadow_8++) { +*shadow_8 = 0; + } +} + +void clearCountersWithoutHistogram(uptr addr, uptr size) { + uptr shadow_beg = MEM_TO_SHADOW(addr); + uptr shadow_end = MEM_TO_SHADOW(addr + size - SHADOW_GRANULARITY) + 1; + REAL(memset)((void *)shadow_beg, 0, shadow_end - shadow_beg); +} + // Clears the shadow counters (when memory is allocated). void ClearShadow(uptr addr, uptr size) { mattweingarten wrote: This function uses the MEM_TO_SHADOW computed pointers "kind of", but in reality it just rounds these pointers up to nearest page_sizes. So in effect, full pages should be cleared no matter if it is with histogram or without. https://github.com/llvm/llvm-project/pull/94264 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] [compiler-rt] [lldb] [llvm] [Memprof] Adds the option to collect AccessCountHistograms for memprof. (PR #94264)
@@ -216,6 +228,35 @@ u64 GetShadowCount(uptr p, u32 size) { return count; } +// Accumulates the access count from the shadow for the given pointer and size. +// See memprof_mapping.h for an overview on histogram counters. +u64 GetShadowCountHistogram(uptr p, u32 size) { + u8 *shadow = (u8 *)HISTOGRAM_MEM_TO_SHADOW(p); + u8 *shadow_end = (u8 *)HISTOGRAM_MEM_TO_SHADOW(p + size); + u64 count = 0; + for (; shadow <= shadow_end; shadow++) +count += *shadow; + return count; +} + +// If we use the normal approach from clearCountersWithoutHistogram, the +// histogram will clear too much data and may overwrite shadow counters that are +// in use. Likely because of rounding up the shadow_end pointer. +// See memprof_mapping.h for an overview on histogram counters. +void clearCountersHistogram(uptr addr, uptr size) { + u8 *shadow_8 = (u8 *)HISTOGRAM_MEM_TO_SHADOW(addr); + u8 *shadow_end_8 = (u8 *)HISTOGRAM_MEM_TO_SHADOW(addr + size); + for (; shadow_8 < shadow_end_8; shadow_8++) { mattweingarten wrote: changed. https://github.com/llvm/llvm-project/pull/94264 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] [clang-tidy] Fix assert in performance-unnecessary-copy-init. (PR #96506)
llvmbot wrote: @llvm/pr-subscribers-clang-tools-extra Author: Clement Courbet (legrosbuffle) Changes `GetDirectCallee` can be null. Fixes #96498. --- Full diff: https://github.com/llvm/llvm-project/pull/96506.diff 2 Files Affected: - (modified) clang-tools-extra/clang-tidy/utils/DeclRefExprUtils.cpp (+1-1) - (modified) clang-tools-extra/test/clang-tidy/checkers/performance/unnecessary-copy-initialization.cpp (+9) ``diff diff --git a/clang-tools-extra/clang-tidy/utils/DeclRefExprUtils.cpp b/clang-tools-extra/clang-tidy/utils/DeclRefExprUtils.cpp index a6062ccf42230..106feb7fb4172 100644 --- a/clang-tools-extra/clang-tidy/utils/DeclRefExprUtils.cpp +++ b/clang-tools-extra/clang-tidy/utils/DeclRefExprUtils.cpp @@ -296,7 +296,7 @@ AST_MATCHER_P(DeclRefExpr, doesNotMutateObject, int, Indirections) { return false; } const auto *const Method = -dyn_cast(OpCall->getDirectCallee()); +dyn_cast_or_null(OpCall->getDirectCallee()); if (Method == nullptr) { // This is not a member operator. Typically, a friend operator. These diff --git a/clang-tools-extra/test/clang-tidy/checkers/performance/unnecessary-copy-initialization.cpp b/clang-tools-extra/test/clang-tidy/checkers/performance/unnecessary-copy-initialization.cpp index f259552dc8f1d..d02bb98cf583c 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/performance/unnecessary-copy-initialization.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/performance/unnecessary-copy-initialization.cpp @@ -906,3 +906,12 @@ void negativeNonConstMemberExpr() { } } + +bool operator==(ExpensiveToCopyType, ExpensiveToCopyType); + +template bool OperatorWithNoDirectCallee(T t) { + ExpensiveToCopyType a1; + ExpensiveToCopyType a2 = a1; + return a1 == t; +} + `` https://github.com/llvm/llvm-project/pull/96506 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] [clang-tidy] Fix assert in performance-unnecessary-copy-init. (PR #96506)
https://github.com/legrosbuffle created https://github.com/llvm/llvm-project/pull/96506 `GetDirectCallee` can be null. Fixes #96498. >From 5034dc92f9098874471b3f035fceb8275629b37a Mon Sep 17 00:00:00 2001 From: Clement Courbet Date: Mon, 24 Jun 2024 15:05:48 + Subject: [PATCH] [clang-tidy] Fix assert in performance-unnecessary-copy-init. `GetDirectCallee` can be null. Fixes #96498. --- clang-tools-extra/clang-tidy/utils/DeclRefExprUtils.cpp | 2 +- .../performance/unnecessary-copy-initialization.cpp | 9 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/clang-tools-extra/clang-tidy/utils/DeclRefExprUtils.cpp b/clang-tools-extra/clang-tidy/utils/DeclRefExprUtils.cpp index a6062ccf42230..106feb7fb4172 100644 --- a/clang-tools-extra/clang-tidy/utils/DeclRefExprUtils.cpp +++ b/clang-tools-extra/clang-tidy/utils/DeclRefExprUtils.cpp @@ -296,7 +296,7 @@ AST_MATCHER_P(DeclRefExpr, doesNotMutateObject, int, Indirections) { return false; } const auto *const Method = -dyn_cast(OpCall->getDirectCallee()); +dyn_cast_or_null(OpCall->getDirectCallee()); if (Method == nullptr) { // This is not a member operator. Typically, a friend operator. These diff --git a/clang-tools-extra/test/clang-tidy/checkers/performance/unnecessary-copy-initialization.cpp b/clang-tools-extra/test/clang-tidy/checkers/performance/unnecessary-copy-initialization.cpp index f259552dc8f1d..d02bb98cf583c 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/performance/unnecessary-copy-initialization.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/performance/unnecessary-copy-initialization.cpp @@ -906,3 +906,12 @@ void negativeNonConstMemberExpr() { } } + +bool operator==(ExpensiveToCopyType, ExpensiveToCopyType); + +template bool OperatorWithNoDirectCallee(T t) { + ExpensiveToCopyType a1; + ExpensiveToCopyType a2 = a1; + return a1 == t; +} + ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 3e36dfa - [C23] Remove WG14 N2660 from the list of papers we track
Author: Aaron Ballman Date: 2024-06-24T11:12:18-04:00 New Revision: 3e36dfafa0d11b2a5d7776d88f170c449116aa0e URL: https://github.com/llvm/llvm-project/commit/3e36dfafa0d11b2a5d7776d88f170c449116aa0e DIFF: https://github.com/llvm/llvm-project/commit/3e36dfafa0d11b2a5d7776d88f170c449116aa0e.diff LOG: [C23] Remove WG14 N2660 from the list of papers we track This paper was a clarification paper that made no normative changes to the wording, so we can lean on the C99 status for this. Added: Modified: clang/www/c_status.html Removed: diff --git a/clang/www/c_status.html b/clang/www/c_status.html index f6a92d94874a5..434c9e20011d4 100644 --- a/clang/www/c_status.html +++ b/clang/www/c_status.html @@ -642,11 +642,6 @@ C23 implementation status https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2186.pdf;>N2186 Unknown - - Clarifying the restrict Keyword v2 - https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2260.pdf;>N2660 - Unknown - Harmonizing static_assert with C++ https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2265.pdf;>N2665 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang] Remove preprocessor guards and global feature checks for NEON (PR #95224)
https://github.com/mgabka approved this pull request. https://github.com/llvm/llvm-project/pull/95224 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [RISCV] Remove experimental from Ztso. (PR #96465)
topperc wrote: I think @preames told me he was keeping this experimental for a reason. https://github.com/llvm/llvm-project/pull/96465 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [mlir] [polly] [IR][NFC] Update IRBuilder to use InsertPosition (PR #96497)
@@ -637,8 +637,7 @@ void ARMParallelDSP::InsertParallelMACs(Reduction ) { Intrinsic::getDeclaration(M, Intrinsic::arm_smlad) : Intrinsic::getDeclaration(M, Intrinsic::arm_smlald); -IRBuilder Builder(InsertAfter->getParent(), -BasicBlock::iterator(InsertAfter)); +IRBuilder Builder((BasicBlock::iterator(InsertAfter))); nikic wrote: ```suggestion IRBuilder Builder(BasicBlock::iterator(InsertAfter)); ``` https://github.com/llvm/llvm-project/pull/96497 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [mlir] [polly] [IR][NFC] Update IRBuilder to use InsertPosition (PR #96497)
https://github.com/nikic approved this pull request. LGTM if CI is happy. https://github.com/llvm/llvm-project/pull/96497 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [mlir] [polly] [IR][NFC] Update IRBuilder to use InsertPosition (PR #96497)
@@ -3136,7 +3136,7 @@ static void LLVMPositionBuilderImpl(IRBuilder<> *Builder, BasicBlock *Block, Instruction *Instr, bool BeforeDbgRecords) { BasicBlock::iterator I = Instr ? Instr->getIterator() : Block->end(); I.setHeadBit(BeforeDbgRecords); - Builder->SetInsertPoint(Block, I); + Builder->SetInsertPoint(I); nikic wrote: Maybe assert that BB and Instr are consistent here? https://github.com/llvm/llvm-project/pull/96497 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [mlir] [polly] [IR][NFC] Update IRBuilder to use InsertPosition (PR #96497)
@@ -44,15 +44,19 @@ template <> struct ilist_alloc_traits { iterator_range::iterator> getDbgRecordRange(DbgMarker *); +/// Class used to generate an insert position (ultimately always a +/// BasicBlock::iterator, which it will implicitly convert to) from either: +/// - An Instruction, inserting immediately prior. nikic wrote: Indicate that this is deprecated? https://github.com/llvm/llvm-project/pull/96497 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [mlir] [polly] [IR][NFC] Update IRBuilder to use InsertPosition (PR #96497)
https://github.com/nikic edited https://github.com/llvm/llvm-project/pull/96497 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang] Extend lifetime bound analysis to support assignments (PR #96475)
ilya-biryukov wrote: @hokein could you please split this into two PRs, one with an NFC change and another one with adding assignment support? GitHub is not great at providing the UI to review individual commits and we won't be able to merge as 2 separate commits with the green button (which seems like a desirable end state for the readability of the commit history). https://github.com/llvm/llvm-project/pull/96475 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Serialization] Storing DeclID separately (PR #95897)
ilya-biryukov wrote: Sorry for not getting to it today, I'll send a review tomorrow. https://github.com/llvm/llvm-project/pull/95897 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Serialization] Don't read all declaration id eagerly when merge the tables (PR #95506)
ilya-biryukov wrote: I feel the increased complexity does not seem like a good trade-off if it does not significantly improve performance. However I don't feel too strongly about it, so I suggest you get a second opinion if you feel strongly that we should land this. https://github.com/llvm/llvm-project/pull/95506 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][analyzer] Improve PointerSubChecker (PR #96501)
llvmbot wrote: @llvm/pr-subscribers-clang @llvm/pr-subscribers-clang-static-analyzer-1 Author: Balázs Kéri (balazske) Changes The checker could report false positives if pointer arithmetic was done on pointers to non-array data before pointer subtraction. Another problem is fixed that could cause false positive if members of the same structure but in different memory objects are subtracted. --- Full diff: https://github.com/llvm/llvm-project/pull/96501.diff 2 Files Affected: - (modified) clang/lib/StaticAnalyzer/Checkers/PointerSubChecker.cpp (+19-3) - (modified) clang/test/Analysis/pointer-sub.c (+20-9) ``diff diff --git a/clang/lib/StaticAnalyzer/Checkers/PointerSubChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/PointerSubChecker.cpp index eea93a41f1384..63ed4df67d6d5 100644 --- a/clang/lib/StaticAnalyzer/Checkers/PointerSubChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/PointerSubChecker.cpp @@ -49,12 +49,28 @@ class PointerSubChecker }; } +static bool isArrayVar(const MemRegion *R) { + while (R) { +if (isa(R)) + return true; +if (const auto *ER = dyn_cast(R)) + R = ER->getSuperRegion(); +else + return false; + } + return false; +} + bool PointerSubChecker::checkArrayBounds(CheckerContext , const Expr *E, const ElementRegion *ElemReg, const MemRegion *Reg) const { if (!ElemReg) return true; + const MemRegion *SuperReg = ElemReg->getSuperRegion(); + if (!isArrayVar(SuperReg)) +return true; + auto ReportBug = [&](const llvm::StringLiteral ) { if (ExplodedNode *N = C.generateNonFatalErrorNode()) { auto R = std::make_unique(BT, Msg, N); @@ -64,7 +80,6 @@ bool PointerSubChecker::checkArrayBounds(CheckerContext , const Expr *E, }; ProgramStateRef State = C.getState(); - const MemRegion *SuperReg = ElemReg->getSuperRegion(); SValBuilder = C.getSValBuilder(); if (SuperReg == Reg) { @@ -121,8 +136,9 @@ void PointerSubChecker::checkPreStmt(const BinaryOperator *B, if (LR == RR) return; - // No warning if one operand is unknown. - if (isa(LR) || isa(RR)) + // No warning if one operand is unknown or resides in a region that could be + // equal to the other. + if (LR->getSymbolicBase() || RR->getSymbolicBase()) return; const auto *ElemLR = dyn_cast(LR); diff --git a/clang/test/Analysis/pointer-sub.c b/clang/test/Analysis/pointer-sub.c index 88e6dec2d172f..404b8530b89c0 100644 --- a/clang/test/Analysis/pointer-sub.c +++ b/clang/test/Analysis/pointer-sub.c @@ -1,4 +1,4 @@ -// RUN: %clang_analyze_cc1 -analyzer-checker=alpha.core.PointerSub -verify %s +// RUN: %clang_analyze_cc1 -analyzer-checker=core,alpha.core.PointerSub -analyzer-output=text-minimal -verify %s void f1(void) { int x, y, z[10]; @@ -73,15 +73,15 @@ void f4(void) { d = a[2] - a[1]; // expected-warning{{Subtraction of two pointers that}} } -typedef struct { +struct S { int a; int b; int c[10]; // expected-note2{{Array at the right-hand side of subtraction}} int d[10]; // expected-note2{{Array at the left-hand side of subtraction}} -} S; +}; void f5(void) { - S s; + struct S s; int y; int d; @@ -92,18 +92,18 @@ void f5(void) { d = [3] - [2]; // expected-warning{{Subtraction of two pointers that}} d = s.d - s.c; // expected-warning{{Subtraction of two pointers that}} - S sa[10]; + struct S sa[10]; d = [2] - [1]; d = [2].a - [1].b; // expected-warning{{Subtraction of two pointers that}} } void f6(void) { - long long l; + long long l = 2; char *a1 = (char *) int d = a1[3] - l; - long long la1[3]; // expected-note{{Array at the right-hand side of subtraction}} - long long la2[3]; // expected-note{{Array at the left-hand side of subtraction}} + long long la1[3] = {1}; // expected-note{{Array at the right-hand side of subtraction}} + long long la2[3] = {1}; // expected-note{{Array at the left-hand side of subtraction}} char *pla1 = (char *)la1; char *pla2 = (char *)la2; d = pla1[1] - pla1[0]; @@ -117,6 +117,17 @@ void f7(int *p) { } void f8(int n) { - int a[10]; + int a[10] = {1}; int d = a[n] - a[0]; } + +int f9(const char *p1) { + const char *p2 = p1; + --p1; + ++p2; + return p1 - p2; // no-warning +} + +int f10(struct S *p1, struct S *p2) { + return >c[5] - >c[5]; // no-warning +} `` https://github.com/llvm/llvm-project/pull/96501 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libunwind] [llvm] [runtimes] remove workaround for old CMake when setting `--unwindlib=none` (PR #93429)
antmox wrote: I may be missing something, but it looks like the armv7m-picolibc-no-exceptions issue is still related to https://gitlab.kitware.com/cmake/cmake/-/issues/23454 I notice that once the `--unwindlib=none` flag is added to `CMAKE_REQUIRED_LINK_OPTIONS`, it is also added to ar commands during the next cmake tests (starting with `CXX_SUPPORTS_NOSTDLIBXX_FLAG`). Failing these tests will result in `fno-exceptions` not being used later This is probably due to the fact that for Armv7M-picolibc, `CMAKE_TRY_COMPILE_TARGET_TYPE` is set to `STATIC_LIBRARY` here: https://github.com/llvm/llvm-project/blob/main/libcxx/cmake/caches/Armv7M-picolibc.cmake#L7C35-L7C49 https://github.com/llvm/llvm-project/pull/93429 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][analyzer] Improve PointerSubChecker (PR #96501)
https://github.com/balazske created https://github.com/llvm/llvm-project/pull/96501 The checker could report false positives if pointer arithmetic was done on pointers to non-array data before pointer subtraction. Another problem is fixed that could cause false positive if members of the same structure but in different memory objects are subtracted. From b431151f83fa2980e4a132191ccf5713ab69806b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bal=C3=A1zs=20K=C3=A9ri?= Date: Mon, 24 Jun 2024 16:48:54 +0200 Subject: [PATCH] [clang][analyzer] Improve PointerSubChecker The checker could report false positives if pointer arithmetic was done on pointers to non-array data before pointer subtraction. Another problem is fixed that could cause false positive if members of the same structure but in different memory objects are subtracted. --- .../Checkers/PointerSubChecker.cpp| 22 -- clang/test/Analysis/pointer-sub.c | 29 +-- 2 files changed, 39 insertions(+), 12 deletions(-) diff --git a/clang/lib/StaticAnalyzer/Checkers/PointerSubChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/PointerSubChecker.cpp index eea93a41f1384..63ed4df67d6d5 100644 --- a/clang/lib/StaticAnalyzer/Checkers/PointerSubChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/PointerSubChecker.cpp @@ -49,12 +49,28 @@ class PointerSubChecker }; } +static bool isArrayVar(const MemRegion *R) { + while (R) { +if (isa(R)) + return true; +if (const auto *ER = dyn_cast(R)) + R = ER->getSuperRegion(); +else + return false; + } + return false; +} + bool PointerSubChecker::checkArrayBounds(CheckerContext , const Expr *E, const ElementRegion *ElemReg, const MemRegion *Reg) const { if (!ElemReg) return true; + const MemRegion *SuperReg = ElemReg->getSuperRegion(); + if (!isArrayVar(SuperReg)) +return true; + auto ReportBug = [&](const llvm::StringLiteral ) { if (ExplodedNode *N = C.generateNonFatalErrorNode()) { auto R = std::make_unique(BT, Msg, N); @@ -64,7 +80,6 @@ bool PointerSubChecker::checkArrayBounds(CheckerContext , const Expr *E, }; ProgramStateRef State = C.getState(); - const MemRegion *SuperReg = ElemReg->getSuperRegion(); SValBuilder = C.getSValBuilder(); if (SuperReg == Reg) { @@ -121,8 +136,9 @@ void PointerSubChecker::checkPreStmt(const BinaryOperator *B, if (LR == RR) return; - // No warning if one operand is unknown. - if (isa(LR) || isa(RR)) + // No warning if one operand is unknown or resides in a region that could be + // equal to the other. + if (LR->getSymbolicBase() || RR->getSymbolicBase()) return; const auto *ElemLR = dyn_cast(LR); diff --git a/clang/test/Analysis/pointer-sub.c b/clang/test/Analysis/pointer-sub.c index 88e6dec2d172f..404b8530b89c0 100644 --- a/clang/test/Analysis/pointer-sub.c +++ b/clang/test/Analysis/pointer-sub.c @@ -1,4 +1,4 @@ -// RUN: %clang_analyze_cc1 -analyzer-checker=alpha.core.PointerSub -verify %s +// RUN: %clang_analyze_cc1 -analyzer-checker=core,alpha.core.PointerSub -analyzer-output=text-minimal -verify %s void f1(void) { int x, y, z[10]; @@ -73,15 +73,15 @@ void f4(void) { d = a[2] - a[1]; // expected-warning{{Subtraction of two pointers that}} } -typedef struct { +struct S { int a; int b; int c[10]; // expected-note2{{Array at the right-hand side of subtraction}} int d[10]; // expected-note2{{Array at the left-hand side of subtraction}} -} S; +}; void f5(void) { - S s; + struct S s; int y; int d; @@ -92,18 +92,18 @@ void f5(void) { d = [3] - [2]; // expected-warning{{Subtraction of two pointers that}} d = s.d - s.c; // expected-warning{{Subtraction of two pointers that}} - S sa[10]; + struct S sa[10]; d = [2] - [1]; d = [2].a - [1].b; // expected-warning{{Subtraction of two pointers that}} } void f6(void) { - long long l; + long long l = 2; char *a1 = (char *) int d = a1[3] - l; - long long la1[3]; // expected-note{{Array at the right-hand side of subtraction}} - long long la2[3]; // expected-note{{Array at the left-hand side of subtraction}} + long long la1[3] = {1}; // expected-note{{Array at the right-hand side of subtraction}} + long long la2[3] = {1}; // expected-note{{Array at the left-hand side of subtraction}} char *pla1 = (char *)la1; char *pla2 = (char *)la2; d = pla1[1] - pla1[0]; @@ -117,6 +117,17 @@ void f7(int *p) { } void f8(int n) { - int a[10]; + int a[10] = {1}; int d = a[n] - a[0]; } + +int f9(const char *p1) { + const char *p2 = p1; + --p1; + ++p2; + return p1 - p2; // no-warning +} + +int f10(struct S *p1, struct S *p2) { + return >c[5] - >c[5]; // no-warning +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [AArch64] Add ability to list extensions enabled for a target (PR #95805)
@@ -1130,7 +1130,8 @@ INSTANTIATE_TEST_SUITE_P( AArch64::AEK_MTE, AArch64::AEK_SSBS, AArch64::AEK_FP16,AArch64::AEK_FP16FML, AArch64::AEK_SB, AArch64::AEK_JSCVT, - AArch64::AEK_FCMA,AArch64::AEK_PERFMON}), + AArch64::AEK_FCMA,AArch64::AEK_PERFMON, + AArch64::AEK_ETE, AArch64::AEK_AM}), jroelofs wrote: OMG that would be amazing. Dealing with downstream diff there is really painful. It would be fantastic to have each one on their own line so that any downstream changes are purely `+ lines`. If you do that, please make sure it's in its own commit, and as NFC as you can make it, so it's much easier to "audit" when merging. https://github.com/llvm/llvm-project/pull/95805 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [AArch64] Add ability to list extensions enabled for a target (PR #95805)
@@ -161,6 +162,39 @@ static int PrintSupportedExtensions(std::string TargetStr) { return 0; } +static int PrintEnabledExtensions(const TargetOptions& TargetOpts) { + std::string Error; + const llvm::Target *TheTarget = + llvm::TargetRegistry::lookupTarget(TargetOpts.Triple, Error); + if (!TheTarget) { +llvm::errs() << Error; +return 1; + } + + llvm::TargetOptions BackendOptions; pratlucas wrote: `TargetOpts` captures the frontend options as a `clang::TargetOptions` instance. The target machine takes an instance of `llvm::TargetOptions` instead. It's confusing that the same class name was chosen for both. https://github.com/llvm/llvm-project/pull/95805 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Doc] Update documentation for no-transitive-change (PR #96453)
ilya-biryukov wrote: I really like the idea of documenting this, hopefully this create some fruitful discussions with the build system developers and other compiler users. After trying to put myself into the shoes of the compiler users reading this, I can't help but think that the "no transitive changes" is slightly confusing and hard to grasp. The example does help quite a bit, but I also feel there should be a way to document this in shorter form. (E.g. we can double-down on the "this is a build optimization" angle and being explicit that we want people to try this and let them know how to report bugs about it?) I wanted to take a little bit of time to think how to do it before providing concrete suggestions, but still wanted to mention this. https://github.com/llvm/llvm-project/pull/96453 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] b012ab0 - [C23] Claim conformance to WG14 N3033
Author: Aaron Ballman Date: 2024-06-24T10:52:17-04:00 New Revision: b012ab01cb39e440a38dad5d7dd71b419480264b URL: https://github.com/llvm/llvm-project/commit/b012ab01cb39e440a38dad5d7dd71b419480264b DIFF: https://github.com/llvm/llvm-project/commit/b012ab01cb39e440a38dad5d7dd71b419480264b.diff LOG: [C23] Claim conformance to WG14 N3033 Clang has implemented __VA_OPT__ since Clang 12. Added: clang/test/C/C2x/n3033.c clang/test/C/C2x/n3033_2.c Modified: clang/www/c_status.html Removed: diff --git a/clang/test/C/C2x/n3033.c b/clang/test/C/C2x/n3033.c new file mode 100644 index 0..bf249a37facb3 --- /dev/null +++ b/clang/test/C/C2x/n3033.c @@ -0,0 +1,50 @@ +// RUN: %clang_cc1 -std=c23 -E %s | FileCheck %s + +/* WG14 N3033: Clang 12 + * Comma ommission and deletion (__VA_OPT__) + */ + +#define F(...) f(0 __VA_OPT__(,) __VA_ARGS__) +#define G(X, ...)f(0, X __VA_OPT__(,) __VA_ARGS__) +#define SDEF(sname, ...) S sname __VA_OPT__(= { __VA_ARGS__ }) +#define EMP + +F(a, b, c)// replaced by f(0, a, b, c) +// CHECK: f(0 , a, b, c) +F() // replaced by f(0) +// CHECK: f(0 ) +F(EMP)// replaced by f(0) +// CHECK: f(0 ) + +G(a, b, c)// replaced by f(0, a, b, c) +// CHECK: f(0, a , b, c) +G(a, )// replaced by f(0, a) +// CHECK: f(0, a ) +G(a) // replaced by f(0, a) +// CHECK: f(0, a ) + +SDEF(foo);// replaced by S foo; +// CHECK: S foo ; +SDEF(bar, 1, 2); // replaced by S bar = { 1, 2 }; +// CHECK: S bar = { 1, 2 }; + +//#define H1(X, ...) X __VA_OPT__(##) __VA_ARGS__ // error: ## may not appear at the beginning of a replacement list (6.10.3.3) + +#define H2(X, Y, ...)__VA_OPT__(X ## Y,) __VA_ARGS__ +H2(a, b, c, d)// replaced by ab, c, d +// CHECK: ab, c, d + +#define H3(X, ...) #__VA_OPT__(X##X X##X) +H3(, 0) // replaced by "" +// CHECK: "" + +#define H4(X, ...) __VA_OPT__(a X ## X) ## b +H4(, 1) // replaced by a b +// CHECK: a b + +#define H5A(...) __VA_OPT__()/**/__VA_OPT__() +#define H5B(X) a ## X ## b +#define H5C(X) H5B(X) +H5C(H5A())// replaced by ab +// CHECK: ab + diff --git a/clang/test/C/C2x/n3033_2.c b/clang/test/C/C2x/n3033_2.c new file mode 100644 index 0..5da206658690c --- /dev/null +++ b/clang/test/C/C2x/n3033_2.c @@ -0,0 +1,4 @@ +// RUN: %clang_cc1 -fsyntax-only -std=c23 -verify %s + +#define H1(X, ...) X __VA_OPT__(##) __VA_ARGS__ // expected-error {{'##' cannot appear at start of __VA_OPT__ argument}} + diff --git a/clang/www/c_status.html b/clang/www/c_status.html index 6b375a6b7999d..f6a92d94874a5 100644 --- a/clang/www/c_status.html +++ b/clang/www/c_status.html @@ -1184,7 +1184,7 @@ C23 implementation status Comma ommission and deletion (__VA_OPT__) https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3033.htm;>N3033 - Unknown + Clang 12 Underspecified object definitions ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [mlir] [polly] [IR][NFC] Update IRBuilder to use InsertPosition (PR #96497)
llvmbot wrote: @llvm/pr-subscribers-mlir Author: Stephen Tozer (SLTozer) Changes Uses the new InsertPosition class (added in #94226) to simplify some of the IRBuilder interface, and removes the need to pass a BasicBlock alongside a BasicBlock::iterator, using the fact that we can now get the parent basic block from the iterator even if it points to the sentinel. This patch removes the BasicBlock argument from each constructor or call to setInsertPoint. This has no functional effect, but later on as we look to remove the `Instruction *InsertBefore` argument from instruction-creation (discussed [here](https://discourse.llvm.org/t/psa-instruction-constructors-changing-to-iterator-only-insertion/77845)), this will simplify the process by allowing us to deprecate the InsertPosition constructor directly and catch all the cases where we use instructions rather than iterators. --- Patch is 122.75 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/96497.diff 97 Files Affected: - (modified) clang/lib/CodeGen/CGBlocks.cpp (+1-1) - (modified) clang/lib/CodeGen/CGGPUBuiltin.cpp (+2-2) - (modified) clang/lib/CodeGen/CGHLSLRuntime.cpp (+1-1) - (modified) clang/lib/CodeGen/CGObjC.cpp (+3-4) - (modified) clang/lib/CodeGen/CGObjCMac.cpp (+1-1) - (modified) clang/lib/CodeGen/CGOpenMPRuntime.cpp (+1-1) - (modified) clang/lib/CodeGen/CGStmt.cpp (+1-1) - (modified) clang/lib/CodeGen/CodeGenABITypes.cpp (+1-1) - (modified) clang/lib/CodeGen/CodeGenFunction.cpp (+2-2) - (modified) llvm/include/llvm/IR/IRBuilder.h (+15-63) - (modified) llvm/include/llvm/IR/Instruction.h (+6-2) - (modified) llvm/include/llvm/Transforms/Utils/ScalarEvolutionExpander.h (+1-3) - (modified) llvm/lib/Analysis/MemoryBuiltins.cpp (+1-1) - (modified) llvm/lib/CodeGen/AtomicExpandPass.cpp (+4-4) - (modified) llvm/lib/CodeGen/CodeGenPrepare.cpp (+2-2) - (modified) llvm/lib/CodeGen/ExpandLargeFpConvert.cpp (+2-2) - (modified) llvm/lib/CodeGen/ExpandMemCmp.cpp (+3-3) - (modified) llvm/lib/CodeGen/ExpandVectorPredication.cpp (+1-1) - (modified) llvm/lib/CodeGen/HardwareLoops.cpp (+1-1) - (modified) llvm/lib/CodeGen/IntrinsicLowering.cpp (+1-1) - (modified) llvm/lib/CodeGen/PreISelIntrinsicLowering.cpp (+1-1) - (modified) llvm/lib/CodeGen/SafeStack.cpp (+1-1) - (modified) llvm/lib/CodeGen/ShadowStackGCLowering.cpp (+2-2) - (modified) llvm/lib/CodeGen/SjLjEHPrepare.cpp (+2-3) - (modified) llvm/lib/CodeGen/WasmEHPrepare.cpp (+1-1) - (modified) llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp (+13-16) - (modified) llvm/lib/IR/AutoUpgrade.cpp (+2-2) - (modified) llvm/lib/IR/Core.cpp (+1-1) - (modified) llvm/lib/Target/AArch64/SVEIntrinsicOpts.cpp (+2-2) - (modified) llvm/lib/Target/AMDGPU/AMDGPUAtomicOptimizer.cpp (+1-1) - (modified) llvm/lib/Target/AMDGPU/AMDGPUCodeGenPrepare.cpp (+1-1) - (modified) llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp (+1-1) - (modified) llvm/lib/Target/AMDGPU/AMDGPULowerKernelArguments.cpp (+1-1) - (modified) llvm/lib/Target/AMDGPU/AMDGPULowerModuleLDSPass.cpp (+1-1) - (modified) llvm/lib/Target/AMDGPU/SIAnnotateControlFlow.cpp (+1-1) - (modified) llvm/lib/Target/ARM/ARMParallelDSP.cpp (+2-4) - (modified) llvm/lib/Target/ARM/MVELaneInterleavingPass.cpp (+1-1) - (modified) llvm/lib/Target/ARM/MVETailPredication.cpp (+1-1) - (modified) llvm/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp (+2-2) - (modified) llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp (+2-4) - (modified) llvm/lib/Target/Hexagon/HexagonVectorLoopCarriedReuse.cpp (+1-1) - (modified) llvm/lib/Target/PowerPC/PPCBoolRetToInt.cpp (+1-1) - (modified) llvm/lib/Target/SPIRV/SPIRVEmitIntrinsics.cpp (+1-1) - (modified) llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp (+1-1) - (modified) llvm/lib/Target/X86/X86LowerAMXIntrinsics.cpp (+2-2) - (modified) llvm/lib/Target/X86/X86LowerAMXType.cpp (+1-2) - (modified) llvm/lib/Target/X86/X86WinEHState.cpp (+1-1) - (modified) llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp (+1-1) - (modified) llvm/lib/Transforms/Coroutines/CoroFrame.cpp (+5-7) - (modified) llvm/lib/Transforms/IPO/AttributorAttributes.cpp (+1-1) - (modified) llvm/lib/Transforms/IPO/OpenMPOpt.cpp (+1-2) - (modified) llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp (+1-1) - (modified) llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp (+2-2) - (modified) llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp (+2-2) - (modified) llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp (+1-1) - (modified) llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp (+1-1) - (modified) llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp (+2-3) - (modified) llvm/lib/Transforms/Instrumentation/BoundsChecking.cpp (+2-2) - (modified) llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp (+22-22) - (modified) llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp (+1-1) - (modified)
[clang] [llvm] [mlir] [polly] [IR][NFC] Update IRBuilder to use InsertPosition (PR #96497)
llvmbot wrote: @llvm/pr-subscribers-backend-aarch64 Author: Stephen Tozer (SLTozer) Changes Uses the new InsertPosition class (added in #94226) to simplify some of the IRBuilder interface, and removes the need to pass a BasicBlock alongside a BasicBlock::iterator, using the fact that we can now get the parent basic block from the iterator even if it points to the sentinel. This patch removes the BasicBlock argument from each constructor or call to setInsertPoint. This has no functional effect, but later on as we look to remove the `Instruction *InsertBefore` argument from instruction-creation (discussed [here](https://discourse.llvm.org/t/psa-instruction-constructors-changing-to-iterator-only-insertion/77845)), this will simplify the process by allowing us to deprecate the InsertPosition constructor directly and catch all the cases where we use instructions rather than iterators. --- Patch is 122.75 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/96497.diff 97 Files Affected: - (modified) clang/lib/CodeGen/CGBlocks.cpp (+1-1) - (modified) clang/lib/CodeGen/CGGPUBuiltin.cpp (+2-2) - (modified) clang/lib/CodeGen/CGHLSLRuntime.cpp (+1-1) - (modified) clang/lib/CodeGen/CGObjC.cpp (+3-4) - (modified) clang/lib/CodeGen/CGObjCMac.cpp (+1-1) - (modified) clang/lib/CodeGen/CGOpenMPRuntime.cpp (+1-1) - (modified) clang/lib/CodeGen/CGStmt.cpp (+1-1) - (modified) clang/lib/CodeGen/CodeGenABITypes.cpp (+1-1) - (modified) clang/lib/CodeGen/CodeGenFunction.cpp (+2-2) - (modified) llvm/include/llvm/IR/IRBuilder.h (+15-63) - (modified) llvm/include/llvm/IR/Instruction.h (+6-2) - (modified) llvm/include/llvm/Transforms/Utils/ScalarEvolutionExpander.h (+1-3) - (modified) llvm/lib/Analysis/MemoryBuiltins.cpp (+1-1) - (modified) llvm/lib/CodeGen/AtomicExpandPass.cpp (+4-4) - (modified) llvm/lib/CodeGen/CodeGenPrepare.cpp (+2-2) - (modified) llvm/lib/CodeGen/ExpandLargeFpConvert.cpp (+2-2) - (modified) llvm/lib/CodeGen/ExpandMemCmp.cpp (+3-3) - (modified) llvm/lib/CodeGen/ExpandVectorPredication.cpp (+1-1) - (modified) llvm/lib/CodeGen/HardwareLoops.cpp (+1-1) - (modified) llvm/lib/CodeGen/IntrinsicLowering.cpp (+1-1) - (modified) llvm/lib/CodeGen/PreISelIntrinsicLowering.cpp (+1-1) - (modified) llvm/lib/CodeGen/SafeStack.cpp (+1-1) - (modified) llvm/lib/CodeGen/ShadowStackGCLowering.cpp (+2-2) - (modified) llvm/lib/CodeGen/SjLjEHPrepare.cpp (+2-3) - (modified) llvm/lib/CodeGen/WasmEHPrepare.cpp (+1-1) - (modified) llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp (+13-16) - (modified) llvm/lib/IR/AutoUpgrade.cpp (+2-2) - (modified) llvm/lib/IR/Core.cpp (+1-1) - (modified) llvm/lib/Target/AArch64/SVEIntrinsicOpts.cpp (+2-2) - (modified) llvm/lib/Target/AMDGPU/AMDGPUAtomicOptimizer.cpp (+1-1) - (modified) llvm/lib/Target/AMDGPU/AMDGPUCodeGenPrepare.cpp (+1-1) - (modified) llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp (+1-1) - (modified) llvm/lib/Target/AMDGPU/AMDGPULowerKernelArguments.cpp (+1-1) - (modified) llvm/lib/Target/AMDGPU/AMDGPULowerModuleLDSPass.cpp (+1-1) - (modified) llvm/lib/Target/AMDGPU/SIAnnotateControlFlow.cpp (+1-1) - (modified) llvm/lib/Target/ARM/ARMParallelDSP.cpp (+2-4) - (modified) llvm/lib/Target/ARM/MVELaneInterleavingPass.cpp (+1-1) - (modified) llvm/lib/Target/ARM/MVETailPredication.cpp (+1-1) - (modified) llvm/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp (+2-2) - (modified) llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp (+2-4) - (modified) llvm/lib/Target/Hexagon/HexagonVectorLoopCarriedReuse.cpp (+1-1) - (modified) llvm/lib/Target/PowerPC/PPCBoolRetToInt.cpp (+1-1) - (modified) llvm/lib/Target/SPIRV/SPIRVEmitIntrinsics.cpp (+1-1) - (modified) llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp (+1-1) - (modified) llvm/lib/Target/X86/X86LowerAMXIntrinsics.cpp (+2-2) - (modified) llvm/lib/Target/X86/X86LowerAMXType.cpp (+1-2) - (modified) llvm/lib/Target/X86/X86WinEHState.cpp (+1-1) - (modified) llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp (+1-1) - (modified) llvm/lib/Transforms/Coroutines/CoroFrame.cpp (+5-7) - (modified) llvm/lib/Transforms/IPO/AttributorAttributes.cpp (+1-1) - (modified) llvm/lib/Transforms/IPO/OpenMPOpt.cpp (+1-2) - (modified) llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp (+1-1) - (modified) llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp (+2-2) - (modified) llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp (+2-2) - (modified) llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp (+1-1) - (modified) llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp (+1-1) - (modified) llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp (+2-3) - (modified) llvm/lib/Transforms/Instrumentation/BoundsChecking.cpp (+2-2) - (modified) llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp (+22-22) - (modified) llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp (+1-1) - (modified)
[clang] [llvm] [mlir] [polly] [IR][NFC] Update IRBuilder to use InsertPosition (PR #96497)
llvmbot wrote: @llvm/pr-subscribers-backend-arm Author: Stephen Tozer (SLTozer) Changes Uses the new InsertPosition class (added in #94226) to simplify some of the IRBuilder interface, and removes the need to pass a BasicBlock alongside a BasicBlock::iterator, using the fact that we can now get the parent basic block from the iterator even if it points to the sentinel. This patch removes the BasicBlock argument from each constructor or call to setInsertPoint. This has no functional effect, but later on as we look to remove the `Instruction *InsertBefore` argument from instruction-creation (discussed [here](https://discourse.llvm.org/t/psa-instruction-constructors-changing-to-iterator-only-insertion/77845)), this will simplify the process by allowing us to deprecate the InsertPosition constructor directly and catch all the cases where we use instructions rather than iterators. --- Patch is 122.75 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/96497.diff 97 Files Affected: - (modified) clang/lib/CodeGen/CGBlocks.cpp (+1-1) - (modified) clang/lib/CodeGen/CGGPUBuiltin.cpp (+2-2) - (modified) clang/lib/CodeGen/CGHLSLRuntime.cpp (+1-1) - (modified) clang/lib/CodeGen/CGObjC.cpp (+3-4) - (modified) clang/lib/CodeGen/CGObjCMac.cpp (+1-1) - (modified) clang/lib/CodeGen/CGOpenMPRuntime.cpp (+1-1) - (modified) clang/lib/CodeGen/CGStmt.cpp (+1-1) - (modified) clang/lib/CodeGen/CodeGenABITypes.cpp (+1-1) - (modified) clang/lib/CodeGen/CodeGenFunction.cpp (+2-2) - (modified) llvm/include/llvm/IR/IRBuilder.h (+15-63) - (modified) llvm/include/llvm/IR/Instruction.h (+6-2) - (modified) llvm/include/llvm/Transforms/Utils/ScalarEvolutionExpander.h (+1-3) - (modified) llvm/lib/Analysis/MemoryBuiltins.cpp (+1-1) - (modified) llvm/lib/CodeGen/AtomicExpandPass.cpp (+4-4) - (modified) llvm/lib/CodeGen/CodeGenPrepare.cpp (+2-2) - (modified) llvm/lib/CodeGen/ExpandLargeFpConvert.cpp (+2-2) - (modified) llvm/lib/CodeGen/ExpandMemCmp.cpp (+3-3) - (modified) llvm/lib/CodeGen/ExpandVectorPredication.cpp (+1-1) - (modified) llvm/lib/CodeGen/HardwareLoops.cpp (+1-1) - (modified) llvm/lib/CodeGen/IntrinsicLowering.cpp (+1-1) - (modified) llvm/lib/CodeGen/PreISelIntrinsicLowering.cpp (+1-1) - (modified) llvm/lib/CodeGen/SafeStack.cpp (+1-1) - (modified) llvm/lib/CodeGen/ShadowStackGCLowering.cpp (+2-2) - (modified) llvm/lib/CodeGen/SjLjEHPrepare.cpp (+2-3) - (modified) llvm/lib/CodeGen/WasmEHPrepare.cpp (+1-1) - (modified) llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp (+13-16) - (modified) llvm/lib/IR/AutoUpgrade.cpp (+2-2) - (modified) llvm/lib/IR/Core.cpp (+1-1) - (modified) llvm/lib/Target/AArch64/SVEIntrinsicOpts.cpp (+2-2) - (modified) llvm/lib/Target/AMDGPU/AMDGPUAtomicOptimizer.cpp (+1-1) - (modified) llvm/lib/Target/AMDGPU/AMDGPUCodeGenPrepare.cpp (+1-1) - (modified) llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp (+1-1) - (modified) llvm/lib/Target/AMDGPU/AMDGPULowerKernelArguments.cpp (+1-1) - (modified) llvm/lib/Target/AMDGPU/AMDGPULowerModuleLDSPass.cpp (+1-1) - (modified) llvm/lib/Target/AMDGPU/SIAnnotateControlFlow.cpp (+1-1) - (modified) llvm/lib/Target/ARM/ARMParallelDSP.cpp (+2-4) - (modified) llvm/lib/Target/ARM/MVELaneInterleavingPass.cpp (+1-1) - (modified) llvm/lib/Target/ARM/MVETailPredication.cpp (+1-1) - (modified) llvm/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp (+2-2) - (modified) llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp (+2-4) - (modified) llvm/lib/Target/Hexagon/HexagonVectorLoopCarriedReuse.cpp (+1-1) - (modified) llvm/lib/Target/PowerPC/PPCBoolRetToInt.cpp (+1-1) - (modified) llvm/lib/Target/SPIRV/SPIRVEmitIntrinsics.cpp (+1-1) - (modified) llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp (+1-1) - (modified) llvm/lib/Target/X86/X86LowerAMXIntrinsics.cpp (+2-2) - (modified) llvm/lib/Target/X86/X86LowerAMXType.cpp (+1-2) - (modified) llvm/lib/Target/X86/X86WinEHState.cpp (+1-1) - (modified) llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp (+1-1) - (modified) llvm/lib/Transforms/Coroutines/CoroFrame.cpp (+5-7) - (modified) llvm/lib/Transforms/IPO/AttributorAttributes.cpp (+1-1) - (modified) llvm/lib/Transforms/IPO/OpenMPOpt.cpp (+1-2) - (modified) llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp (+1-1) - (modified) llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp (+2-2) - (modified) llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp (+2-2) - (modified) llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp (+1-1) - (modified) llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp (+1-1) - (modified) llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp (+2-3) - (modified) llvm/lib/Transforms/Instrumentation/BoundsChecking.cpp (+2-2) - (modified) llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp (+22-22) - (modified) llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp (+1-1) - (modified)
[clang] [llvm] [mlir] [polly] [IR][NFC] Update IRBuilder to use InsertPosition (PR #96497)
llvmbot wrote: @llvm/pr-subscribers-hlsl @llvm/pr-subscribers-backend-webassembly @llvm/pr-subscribers-clang-codegen Author: Stephen Tozer (SLTozer) Changes Uses the new InsertPosition class (added in #94226) to simplify some of the IRBuilder interface, and removes the need to pass a BasicBlock alongside a BasicBlock::iterator, using the fact that we can now get the parent basic block from the iterator even if it points to the sentinel. This patch removes the BasicBlock argument from each constructor or call to setInsertPoint. This has no functional effect, but later on as we look to remove the `Instruction *InsertBefore` argument from instruction-creation (discussed [here](https://discourse.llvm.org/t/psa-instruction-constructors-changing-to-iterator-only-insertion/77845)), this will simplify the process by allowing us to deprecate the InsertPosition constructor directly and catch all the cases where we use instructions rather than iterators. --- Patch is 122.75 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/96497.diff 97 Files Affected: - (modified) clang/lib/CodeGen/CGBlocks.cpp (+1-1) - (modified) clang/lib/CodeGen/CGGPUBuiltin.cpp (+2-2) - (modified) clang/lib/CodeGen/CGHLSLRuntime.cpp (+1-1) - (modified) clang/lib/CodeGen/CGObjC.cpp (+3-4) - (modified) clang/lib/CodeGen/CGObjCMac.cpp (+1-1) - (modified) clang/lib/CodeGen/CGOpenMPRuntime.cpp (+1-1) - (modified) clang/lib/CodeGen/CGStmt.cpp (+1-1) - (modified) clang/lib/CodeGen/CodeGenABITypes.cpp (+1-1) - (modified) clang/lib/CodeGen/CodeGenFunction.cpp (+2-2) - (modified) llvm/include/llvm/IR/IRBuilder.h (+15-63) - (modified) llvm/include/llvm/IR/Instruction.h (+6-2) - (modified) llvm/include/llvm/Transforms/Utils/ScalarEvolutionExpander.h (+1-3) - (modified) llvm/lib/Analysis/MemoryBuiltins.cpp (+1-1) - (modified) llvm/lib/CodeGen/AtomicExpandPass.cpp (+4-4) - (modified) llvm/lib/CodeGen/CodeGenPrepare.cpp (+2-2) - (modified) llvm/lib/CodeGen/ExpandLargeFpConvert.cpp (+2-2) - (modified) llvm/lib/CodeGen/ExpandMemCmp.cpp (+3-3) - (modified) llvm/lib/CodeGen/ExpandVectorPredication.cpp (+1-1) - (modified) llvm/lib/CodeGen/HardwareLoops.cpp (+1-1) - (modified) llvm/lib/CodeGen/IntrinsicLowering.cpp (+1-1) - (modified) llvm/lib/CodeGen/PreISelIntrinsicLowering.cpp (+1-1) - (modified) llvm/lib/CodeGen/SafeStack.cpp (+1-1) - (modified) llvm/lib/CodeGen/ShadowStackGCLowering.cpp (+2-2) - (modified) llvm/lib/CodeGen/SjLjEHPrepare.cpp (+2-3) - (modified) llvm/lib/CodeGen/WasmEHPrepare.cpp (+1-1) - (modified) llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp (+13-16) - (modified) llvm/lib/IR/AutoUpgrade.cpp (+2-2) - (modified) llvm/lib/IR/Core.cpp (+1-1) - (modified) llvm/lib/Target/AArch64/SVEIntrinsicOpts.cpp (+2-2) - (modified) llvm/lib/Target/AMDGPU/AMDGPUAtomicOptimizer.cpp (+1-1) - (modified) llvm/lib/Target/AMDGPU/AMDGPUCodeGenPrepare.cpp (+1-1) - (modified) llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp (+1-1) - (modified) llvm/lib/Target/AMDGPU/AMDGPULowerKernelArguments.cpp (+1-1) - (modified) llvm/lib/Target/AMDGPU/AMDGPULowerModuleLDSPass.cpp (+1-1) - (modified) llvm/lib/Target/AMDGPU/SIAnnotateControlFlow.cpp (+1-1) - (modified) llvm/lib/Target/ARM/ARMParallelDSP.cpp (+2-4) - (modified) llvm/lib/Target/ARM/MVELaneInterleavingPass.cpp (+1-1) - (modified) llvm/lib/Target/ARM/MVETailPredication.cpp (+1-1) - (modified) llvm/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp (+2-2) - (modified) llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp (+2-4) - (modified) llvm/lib/Target/Hexagon/HexagonVectorLoopCarriedReuse.cpp (+1-1) - (modified) llvm/lib/Target/PowerPC/PPCBoolRetToInt.cpp (+1-1) - (modified) llvm/lib/Target/SPIRV/SPIRVEmitIntrinsics.cpp (+1-1) - (modified) llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp (+1-1) - (modified) llvm/lib/Target/X86/X86LowerAMXIntrinsics.cpp (+2-2) - (modified) llvm/lib/Target/X86/X86LowerAMXType.cpp (+1-2) - (modified) llvm/lib/Target/X86/X86WinEHState.cpp (+1-1) - (modified) llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp (+1-1) - (modified) llvm/lib/Transforms/Coroutines/CoroFrame.cpp (+5-7) - (modified) llvm/lib/Transforms/IPO/AttributorAttributes.cpp (+1-1) - (modified) llvm/lib/Transforms/IPO/OpenMPOpt.cpp (+1-2) - (modified) llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp (+1-1) - (modified) llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp (+2-2) - (modified) llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp (+2-2) - (modified) llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp (+1-1) - (modified) llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp (+1-1) - (modified) llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp (+2-3) - (modified) llvm/lib/Transforms/Instrumentation/BoundsChecking.cpp (+2-2) - (modified) llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp (+22-22) - (modified)
[clang] [llvm] [mlir] [polly] [IR][NFC] Update IRBuilder to use InsertPosition (PR #96497)
llvmbot wrote: @llvm/pr-subscribers-backend-amdgpu Author: Stephen Tozer (SLTozer) Changes Uses the new InsertPosition class (added in #94226) to simplify some of the IRBuilder interface, and removes the need to pass a BasicBlock alongside a BasicBlock::iterator, using the fact that we can now get the parent basic block from the iterator even if it points to the sentinel. This patch removes the BasicBlock argument from each constructor or call to setInsertPoint. This has no functional effect, but later on as we look to remove the `Instruction *InsertBefore` argument from instruction-creation (discussed [here](https://discourse.llvm.org/t/psa-instruction-constructors-changing-to-iterator-only-insertion/77845)), this will simplify the process by allowing us to deprecate the InsertPosition constructor directly and catch all the cases where we use instructions rather than iterators. --- Patch is 122.75 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/96497.diff 97 Files Affected: - (modified) clang/lib/CodeGen/CGBlocks.cpp (+1-1) - (modified) clang/lib/CodeGen/CGGPUBuiltin.cpp (+2-2) - (modified) clang/lib/CodeGen/CGHLSLRuntime.cpp (+1-1) - (modified) clang/lib/CodeGen/CGObjC.cpp (+3-4) - (modified) clang/lib/CodeGen/CGObjCMac.cpp (+1-1) - (modified) clang/lib/CodeGen/CGOpenMPRuntime.cpp (+1-1) - (modified) clang/lib/CodeGen/CGStmt.cpp (+1-1) - (modified) clang/lib/CodeGen/CodeGenABITypes.cpp (+1-1) - (modified) clang/lib/CodeGen/CodeGenFunction.cpp (+2-2) - (modified) llvm/include/llvm/IR/IRBuilder.h (+15-63) - (modified) llvm/include/llvm/IR/Instruction.h (+6-2) - (modified) llvm/include/llvm/Transforms/Utils/ScalarEvolutionExpander.h (+1-3) - (modified) llvm/lib/Analysis/MemoryBuiltins.cpp (+1-1) - (modified) llvm/lib/CodeGen/AtomicExpandPass.cpp (+4-4) - (modified) llvm/lib/CodeGen/CodeGenPrepare.cpp (+2-2) - (modified) llvm/lib/CodeGen/ExpandLargeFpConvert.cpp (+2-2) - (modified) llvm/lib/CodeGen/ExpandMemCmp.cpp (+3-3) - (modified) llvm/lib/CodeGen/ExpandVectorPredication.cpp (+1-1) - (modified) llvm/lib/CodeGen/HardwareLoops.cpp (+1-1) - (modified) llvm/lib/CodeGen/IntrinsicLowering.cpp (+1-1) - (modified) llvm/lib/CodeGen/PreISelIntrinsicLowering.cpp (+1-1) - (modified) llvm/lib/CodeGen/SafeStack.cpp (+1-1) - (modified) llvm/lib/CodeGen/ShadowStackGCLowering.cpp (+2-2) - (modified) llvm/lib/CodeGen/SjLjEHPrepare.cpp (+2-3) - (modified) llvm/lib/CodeGen/WasmEHPrepare.cpp (+1-1) - (modified) llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp (+13-16) - (modified) llvm/lib/IR/AutoUpgrade.cpp (+2-2) - (modified) llvm/lib/IR/Core.cpp (+1-1) - (modified) llvm/lib/Target/AArch64/SVEIntrinsicOpts.cpp (+2-2) - (modified) llvm/lib/Target/AMDGPU/AMDGPUAtomicOptimizer.cpp (+1-1) - (modified) llvm/lib/Target/AMDGPU/AMDGPUCodeGenPrepare.cpp (+1-1) - (modified) llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp (+1-1) - (modified) llvm/lib/Target/AMDGPU/AMDGPULowerKernelArguments.cpp (+1-1) - (modified) llvm/lib/Target/AMDGPU/AMDGPULowerModuleLDSPass.cpp (+1-1) - (modified) llvm/lib/Target/AMDGPU/SIAnnotateControlFlow.cpp (+1-1) - (modified) llvm/lib/Target/ARM/ARMParallelDSP.cpp (+2-4) - (modified) llvm/lib/Target/ARM/MVELaneInterleavingPass.cpp (+1-1) - (modified) llvm/lib/Target/ARM/MVETailPredication.cpp (+1-1) - (modified) llvm/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp (+2-2) - (modified) llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp (+2-4) - (modified) llvm/lib/Target/Hexagon/HexagonVectorLoopCarriedReuse.cpp (+1-1) - (modified) llvm/lib/Target/PowerPC/PPCBoolRetToInt.cpp (+1-1) - (modified) llvm/lib/Target/SPIRV/SPIRVEmitIntrinsics.cpp (+1-1) - (modified) llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp (+1-1) - (modified) llvm/lib/Target/X86/X86LowerAMXIntrinsics.cpp (+2-2) - (modified) llvm/lib/Target/X86/X86LowerAMXType.cpp (+1-2) - (modified) llvm/lib/Target/X86/X86WinEHState.cpp (+1-1) - (modified) llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp (+1-1) - (modified) llvm/lib/Transforms/Coroutines/CoroFrame.cpp (+5-7) - (modified) llvm/lib/Transforms/IPO/AttributorAttributes.cpp (+1-1) - (modified) llvm/lib/Transforms/IPO/OpenMPOpt.cpp (+1-2) - (modified) llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp (+1-1) - (modified) llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp (+2-2) - (modified) llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp (+2-2) - (modified) llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp (+1-1) - (modified) llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp (+1-1) - (modified) llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp (+2-3) - (modified) llvm/lib/Transforms/Instrumentation/BoundsChecking.cpp (+2-2) - (modified) llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp (+22-22) - (modified) llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp (+1-1) - (modified)
[clang] [llvm] [mlir] [polly] [IR][NFC] Update IRBuilder to use InsertPosition (PR #96497)
llvmbot wrote: @llvm/pr-subscribers-backend-powerpc Author: Stephen Tozer (SLTozer) Changes Uses the new InsertPosition class (added in #94226) to simplify some of the IRBuilder interface, and removes the need to pass a BasicBlock alongside a BasicBlock::iterator, using the fact that we can now get the parent basic block from the iterator even if it points to the sentinel. This patch removes the BasicBlock argument from each constructor or call to setInsertPoint. This has no functional effect, but later on as we look to remove the `Instruction *InsertBefore` argument from instruction-creation (discussed [here](https://discourse.llvm.org/t/psa-instruction-constructors-changing-to-iterator-only-insertion/77845)), this will simplify the process by allowing us to deprecate the InsertPosition constructor directly and catch all the cases where we use instructions rather than iterators. --- Patch is 122.75 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/96497.diff 97 Files Affected: - (modified) clang/lib/CodeGen/CGBlocks.cpp (+1-1) - (modified) clang/lib/CodeGen/CGGPUBuiltin.cpp (+2-2) - (modified) clang/lib/CodeGen/CGHLSLRuntime.cpp (+1-1) - (modified) clang/lib/CodeGen/CGObjC.cpp (+3-4) - (modified) clang/lib/CodeGen/CGObjCMac.cpp (+1-1) - (modified) clang/lib/CodeGen/CGOpenMPRuntime.cpp (+1-1) - (modified) clang/lib/CodeGen/CGStmt.cpp (+1-1) - (modified) clang/lib/CodeGen/CodeGenABITypes.cpp (+1-1) - (modified) clang/lib/CodeGen/CodeGenFunction.cpp (+2-2) - (modified) llvm/include/llvm/IR/IRBuilder.h (+15-63) - (modified) llvm/include/llvm/IR/Instruction.h (+6-2) - (modified) llvm/include/llvm/Transforms/Utils/ScalarEvolutionExpander.h (+1-3) - (modified) llvm/lib/Analysis/MemoryBuiltins.cpp (+1-1) - (modified) llvm/lib/CodeGen/AtomicExpandPass.cpp (+4-4) - (modified) llvm/lib/CodeGen/CodeGenPrepare.cpp (+2-2) - (modified) llvm/lib/CodeGen/ExpandLargeFpConvert.cpp (+2-2) - (modified) llvm/lib/CodeGen/ExpandMemCmp.cpp (+3-3) - (modified) llvm/lib/CodeGen/ExpandVectorPredication.cpp (+1-1) - (modified) llvm/lib/CodeGen/HardwareLoops.cpp (+1-1) - (modified) llvm/lib/CodeGen/IntrinsicLowering.cpp (+1-1) - (modified) llvm/lib/CodeGen/PreISelIntrinsicLowering.cpp (+1-1) - (modified) llvm/lib/CodeGen/SafeStack.cpp (+1-1) - (modified) llvm/lib/CodeGen/ShadowStackGCLowering.cpp (+2-2) - (modified) llvm/lib/CodeGen/SjLjEHPrepare.cpp (+2-3) - (modified) llvm/lib/CodeGen/WasmEHPrepare.cpp (+1-1) - (modified) llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp (+13-16) - (modified) llvm/lib/IR/AutoUpgrade.cpp (+2-2) - (modified) llvm/lib/IR/Core.cpp (+1-1) - (modified) llvm/lib/Target/AArch64/SVEIntrinsicOpts.cpp (+2-2) - (modified) llvm/lib/Target/AMDGPU/AMDGPUAtomicOptimizer.cpp (+1-1) - (modified) llvm/lib/Target/AMDGPU/AMDGPUCodeGenPrepare.cpp (+1-1) - (modified) llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp (+1-1) - (modified) llvm/lib/Target/AMDGPU/AMDGPULowerKernelArguments.cpp (+1-1) - (modified) llvm/lib/Target/AMDGPU/AMDGPULowerModuleLDSPass.cpp (+1-1) - (modified) llvm/lib/Target/AMDGPU/SIAnnotateControlFlow.cpp (+1-1) - (modified) llvm/lib/Target/ARM/ARMParallelDSP.cpp (+2-4) - (modified) llvm/lib/Target/ARM/MVELaneInterleavingPass.cpp (+1-1) - (modified) llvm/lib/Target/ARM/MVETailPredication.cpp (+1-1) - (modified) llvm/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp (+2-2) - (modified) llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp (+2-4) - (modified) llvm/lib/Target/Hexagon/HexagonVectorLoopCarriedReuse.cpp (+1-1) - (modified) llvm/lib/Target/PowerPC/PPCBoolRetToInt.cpp (+1-1) - (modified) llvm/lib/Target/SPIRV/SPIRVEmitIntrinsics.cpp (+1-1) - (modified) llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp (+1-1) - (modified) llvm/lib/Target/X86/X86LowerAMXIntrinsics.cpp (+2-2) - (modified) llvm/lib/Target/X86/X86LowerAMXType.cpp (+1-2) - (modified) llvm/lib/Target/X86/X86WinEHState.cpp (+1-1) - (modified) llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp (+1-1) - (modified) llvm/lib/Transforms/Coroutines/CoroFrame.cpp (+5-7) - (modified) llvm/lib/Transforms/IPO/AttributorAttributes.cpp (+1-1) - (modified) llvm/lib/Transforms/IPO/OpenMPOpt.cpp (+1-2) - (modified) llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp (+1-1) - (modified) llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp (+2-2) - (modified) llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp (+2-2) - (modified) llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp (+1-1) - (modified) llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp (+1-1) - (modified) llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp (+2-3) - (modified) llvm/lib/Transforms/Instrumentation/BoundsChecking.cpp (+2-2) - (modified) llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp (+22-22) - (modified) llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp (+1-1) - (modified)
[clang] [llvm] [mlir] [polly] [IR][NFC] Update IRBuilder to use InsertPosition (PR #96497)
https://github.com/SLTozer edited https://github.com/llvm/llvm-project/pull/96497 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang][SveEmitter] Split up TargetGuard into SVE and SME component. (PR #96482)
https://github.com/paulwalker-arm approved this pull request. This is certainly a step in the right direction. https://github.com/llvm/llvm-project/pull/96482 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [AArch64] Add ability to list extensions enabled for a target (PR #95805)
@@ -161,6 +162,39 @@ static int PrintSupportedExtensions(std::string TargetStr) { return 0; } +static int PrintEnabledExtensions(const TargetOptions& TargetOpts) { + std::string Error; + const llvm::Target *TheTarget = + llvm::TargetRegistry::lookupTarget(TargetOpts.Triple, Error); + if (!TheTarget) { +llvm::errs() << Error; +return 1; + } + + llvm::TargetOptions BackendOptions; + std::string FeaturesStr = llvm::join(TargetOpts.FeaturesAsWritten, ","); + std::unique_ptr TheTargetMachine( + TheTarget->createTargetMachine(TargetOpts.Triple, TargetOpts.CPU, FeaturesStr, BackendOptions, std::nullopt)); + const llvm::Triple = TheTargetMachine->getTargetTriple(); + const llvm::MCSubtargetInfo *MCInfo = TheTargetMachine->getMCSubtargetInfo(); + const std::vector Features = +MCInfo->getEnabledProcessorFeatures(); + + std::vector EnabledFeatureNames; + for (const llvm::SubtargetFeatureKV : Features) +EnabledFeatureNames.push_back(feature.Key); pratlucas wrote: Unfortunately `llvm::SubtargetFeatureKV` doesn't hold a lot of information and semantics of its contents is even less clear the what's capture here. I'll add a comment to this block clarifying what's being captured. https://github.com/llvm/llvm-project/pull/95805 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][ThreadSafety] Fix code block syntax in ThreadSafetyAnalysis.rst (PR #96494)
https://github.com/AaronBallman closed https://github.com/llvm/llvm-project/pull/96494 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 3402620 - [clang][ThreadSafety] Fix code block syntax in ThreadSafetyAnalysis.rst (#96494)
Author: Dan McArdle Date: 2024-06-24T10:48:51-04:00 New Revision: 34026207c87116bd8e7fb0a464ea8db947f8239a URL: https://github.com/llvm/llvm-project/commit/34026207c87116bd8e7fb0a464ea8db947f8239a DIFF: https://github.com/llvm/llvm-project/commit/34026207c87116bd8e7fb0a464ea8db947f8239a.diff LOG: [clang][ThreadSafety] Fix code block syntax in ThreadSafetyAnalysis.rst (#96494) Without a newline, documentation was failing to build with this error: Warning, treated as error: /home/runner/work/llvm-project/llvm-project/clang-build/tools/clang/docs/ThreadSafetyAnalysis.rst:466:Error in "code-block" directive: maximum 1 argument(s) allowed, 10 supplied. Issue #92408 Added: Modified: clang/docs/ThreadSafetyAnalysis.rst Removed: diff --git a/clang/docs/ThreadSafetyAnalysis.rst b/clang/docs/ThreadSafetyAnalysis.rst index 0ecbebe7a692f..1513719caa464 100644 --- a/clang/docs/ThreadSafetyAnalysis.rst +++ b/clang/docs/ThreadSafetyAnalysis.rst @@ -464,6 +464,7 @@ on success and ``LockNotAcquired`` on failure, the analysis may fail to detect access to guarded data without holding the mutex because they are both non-zero. .. code-block:: c++ + // *** Beware: this code demonstrates incorrect usage. *** enum TrylockResult { LockAcquired = 1, LockNotAcquired = 2 }; ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][ThreadSafety] Fix code block syntax in ThreadSafetyAnalysis.rst (PR #96494)
https://github.com/AaronBallman approved this pull request. LGTM, thanks for the quick fix! https://github.com/llvm/llvm-project/pull/96494 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] [clang-tidy] add fixhint for misc-use-internal-linkage (PR #96203)
https://github.com/HerrCai0907 updated https://github.com/llvm/llvm-project/pull/96203 >From 669205c0f659239c58a3bde3ddadabb0a8ecbad8 Mon Sep 17 00:00:00 2001 From: Congcong Cai Date: Thu, 20 Jun 2024 15:05:57 + Subject: [PATCH 1/3] [clang-tidy] add fixhint for misc-use-internal-linkage --- .../clang-tidy/misc/UseInternalLinkageCheck.cpp | 12 ++-- .../checkers/misc/use-internal-linkage-func.cpp | 1 + .../checkers/misc/use-internal-linkage-var.cpp | 1 + 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/clang-tools-extra/clang-tidy/misc/UseInternalLinkageCheck.cpp b/clang-tools-extra/clang-tidy/misc/UseInternalLinkageCheck.cpp index 70d0281df28fa..e36ccdba42ef1 100644 --- a/clang-tools-extra/clang-tidy/misc/UseInternalLinkageCheck.cpp +++ b/clang-tools-extra/clang-tidy/misc/UseInternalLinkageCheck.cpp @@ -82,11 +82,19 @@ static constexpr StringRef Message = void UseInternalLinkageCheck::check(const MatchFinder::MatchResult ) { if (const auto *FD = Result.Nodes.getNodeAs("fn")) { -diag(FD->getLocation(), Message) << "function" << FD; +DiagnosticBuilder DB = diag(FD->getLocation(), Message) << "function" << FD; +SourceLocation FixLoc = FD->getTypeSpecStartLoc(); +if (FixLoc.isInvalid() || FixLoc.isMacroID()) + return; +DB << FixItHint::CreateInsertion(FixLoc, "static "); return; } if (const auto *VD = Result.Nodes.getNodeAs("var")) { -diag(VD->getLocation(), Message) << "variable" << VD; +DiagnosticBuilder DB = diag(VD->getLocation(), Message) << "variable" << VD; +SourceLocation FixLoc = VD->getTypeSpecStartLoc(); +if (FixLoc.isInvalid() || FixLoc.isMacroID()) + return; +DB << FixItHint::CreateInsertion(FixLoc, "static "); return; } llvm_unreachable(""); diff --git a/clang-tools-extra/test/clang-tidy/checkers/misc/use-internal-linkage-func.cpp b/clang-tools-extra/test/clang-tidy/checkers/misc/use-internal-linkage-func.cpp index c6c513fe0b0c0..c244f32db8e96 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/misc/use-internal-linkage-func.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/misc/use-internal-linkage-func.cpp @@ -4,6 +4,7 @@ void func() {} // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'func' +// CHECK-FIXES: static void func() {} template void func_template() {} diff --git a/clang-tools-extra/test/clang-tidy/checkers/misc/use-internal-linkage-var.cpp b/clang-tools-extra/test/clang-tidy/checkers/misc/use-internal-linkage-var.cpp index bd5ef5431de6c..b076e9125fc35 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/misc/use-internal-linkage-var.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/misc/use-internal-linkage-var.cpp @@ -4,6 +4,7 @@ int global; // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: variable 'global' +// CHECK-FIXES: static int global; template T global_template; >From d5bb05e2af683a2dcb08c6e8cabc448001c07414 Mon Sep 17 00:00:00 2001 From: Congcong Cai Date: Mon, 24 Jun 2024 21:58:56 +0800 Subject: [PATCH 2/3] add FixMode option --- .../misc/UseInternalLinkageCheck.cpp | 36 +-- .../clang-tidy/misc/UseInternalLinkageCheck.h | 11 -- .../checks/misc/use-internal-linkage.rst | 13 +++ .../use-internal-linkage-fix-mode-none.cpp| 10 ++ .../misc/use-internal-linkage-func.cpp| 2 ++ .../misc/use-internal-linkage-var.cpp | 2 ++ 6 files changed, 69 insertions(+), 5 deletions(-) create mode 100644 clang-tools-extra/test/clang-tidy/checkers/misc/use-internal-linkage-fix-mode-none.cpp diff --git a/clang-tools-extra/clang-tidy/misc/UseInternalLinkageCheck.cpp b/clang-tools-extra/clang-tidy/misc/UseInternalLinkageCheck.cpp index e36ccdba42ef1..44ccc2bc906a5 100644 --- a/clang-tools-extra/clang-tidy/misc/UseInternalLinkageCheck.cpp +++ b/clang-tools-extra/clang-tidy/misc/UseInternalLinkageCheck.cpp @@ -18,6 +18,26 @@ using namespace clang::ast_matchers; +namespace clang::tidy { + +template <> +struct OptionEnumMapping { + static llvm::ArrayRef< + std::pair> + getEnumMapping() { +static constexpr std::pair +Mapping[] = { +{misc::UseInternalLinkageCheck::FixModeKind::None, "None"}, +{misc::UseInternalLinkageCheck::FixModeKind::UseStatic, + "UseStatic"}, +}; +return {Mapping}; + } +}; + +} // namespace clang::tidy + namespace clang::tidy::misc { namespace { @@ -57,6 +77,16 @@ AST_POLYMORPHIC_MATCHER(isExternStorageClass, } // namespace +UseInternalLinkageCheck::UseInternalLinkageCheck(StringRef Name, + ClangTidyContext *Context) +: ClangTidyCheck(Name, Context), + HeaderFileExtensions(Context->getHeaderFileExtensions()), + FixMode(Options.get("FixMode", FixModeKind::UseStatic)) {} + +void UseInternalLinkageCheck::storeOptions(ClangTidyOptions::OptionMap ) { + Options.store(Opts, "FixMode", FixMode); +} + void
[clang] [clang][ThreadSafety] Fix code block syntax in ThreadSafetyAnalysis.rst (PR #96494)
dmcardle wrote: @AaronBallman PTAL — looks like #95290 broke the documentation. https://github.com/llvm/llvm-project/pull/96494 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][ThreadSafety] Fix code block syntax in ThreadSafetyAnalysis.rst (PR #96494)
llvmbot wrote: @llvm/pr-subscribers-clang Author: Dan McArdle (dmcardle) Changes Without a newline, documentation was failing to build with this error: Warning, treated as error: /home/runner/work/llvm-project/llvm-project/clang-build/tools/clang/docs/ThreadSafetyAnalysis.rst:466:Error in "code-block" directive: maximum 1 argument(s) allowed, 10 supplied. Issue #92408 --- Full diff: https://github.com/llvm/llvm-project/pull/96494.diff 1 Files Affected: - (modified) clang/docs/ThreadSafetyAnalysis.rst (+1) ``diff diff --git a/clang/docs/ThreadSafetyAnalysis.rst b/clang/docs/ThreadSafetyAnalysis.rst index 0ecbebe7a692f..1513719caa464 100644 --- a/clang/docs/ThreadSafetyAnalysis.rst +++ b/clang/docs/ThreadSafetyAnalysis.rst @@ -464,6 +464,7 @@ on success and ``LockNotAcquired`` on failure, the analysis may fail to detect access to guarded data without holding the mutex because they are both non-zero. .. code-block:: c++ + // *** Beware: this code demonstrates incorrect usage. *** enum TrylockResult { LockAcquired = 1, LockNotAcquired = 2 }; `` https://github.com/llvm/llvm-project/pull/96494 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][ThreadSafety] Fix code block syntax in ThreadSafetyAnalysis.rst (PR #96494)
https://github.com/dmcardle created https://github.com/llvm/llvm-project/pull/96494 Without a newline, documentation was failing to build with this error: Warning, treated as error: /home/runner/work/llvm-project/llvm-project/clang-build/tools/clang/docs/ThreadSafetyAnalysis.rst:466:Error in "code-block" directive: maximum 1 argument(s) allowed, 10 supplied. Issue #92408 >From 3bd8ad70da4c3ab7a89969dd31b728dcf301d7ab Mon Sep 17 00:00:00 2001 From: Dan McArdle Date: Mon, 24 Jun 2024 10:39:58 -0400 Subject: [PATCH] [clang][ThreadSafety] Fix code block syntax in ThreadSafetyAnalysis.rst Without a newline, documentation was failing to build with this error: Warning, treated as error: /home/runner/work/llvm-project/llvm-project/clang-build/tools/clang/docs/ThreadSafetyAnalysis.rst:466:Error in "code-block" directive: maximum 1 argument(s) allowed, 10 supplied. Issue #92408 --- clang/docs/ThreadSafetyAnalysis.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/clang/docs/ThreadSafetyAnalysis.rst b/clang/docs/ThreadSafetyAnalysis.rst index 0ecbebe7a692f..1513719caa464 100644 --- a/clang/docs/ThreadSafetyAnalysis.rst +++ b/clang/docs/ThreadSafetyAnalysis.rst @@ -464,6 +464,7 @@ on success and ``LockNotAcquired`` on failure, the analysis may fail to detect access to guarded data without holding the mutex because they are both non-zero. .. code-block:: c++ + // *** Beware: this code demonstrates incorrect usage. *** enum TrylockResult { LockAcquired = 1, LockNotAcquired = 2 }; ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang][objectsize] Generate object size calculation for sub-objects (PR #86858)
https://github.com/bwendling updated https://github.com/llvm/llvm-project/pull/86858 >From 31af119d614ef2108b5404f9c9387ec45aa1bfef Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Thu, 21 Mar 2024 15:07:31 -0700 Subject: [PATCH 1/7] [Clang][objectsize] Generate object size calculation for sub-objects The second argument of __builtin_dynamic_object_size controls whether it returns the size of the whole object or the closest surrounding object. For this struct: struct s { int foo; char bar[2][40]; int baz; int qux; }; int main(int argc, char **argv) { struct s f; #define report(x) printf(#x ": %zu\n", x) argc = 1; report(__builtin_dynamic_object_size(f.bar[argc], 0)); report(__builtin_dynamic_object_size(f.bar[argc], 1)); return 0; } should return: __builtin_dynamic_object_size(f.bar[argc], 0): 48 __builtin_dynamic_object_size(f.bar[argc], 1): 40 determined by the least significant bit of the TYPE. The LLVM IR isn't sufficient to determine what could be considered a "sub-object". However, the front-end does have enough information to determine the size of a sub-object and the offset into that sub-object. We try therefore to convert the intrinsic into a calculation in the front-end so that we can avoid the information issue.. --- clang/lib/CodeGen/CGBuiltin.cpp | 138 +- clang/lib/CodeGen/CodeGenFunction.h | 6 + clang/test/CodeGen/object-size-sub-object.c | 280 3 files changed, 418 insertions(+), 6 deletions(-) create mode 100644 clang/test/CodeGen/object-size-sub-object.c diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp index 2eaceeba61770..be055f34c4492 100644 --- a/clang/lib/CodeGen/CGBuiltin.cpp +++ b/clang/lib/CodeGen/CGBuiltin.cpp @@ -26,6 +26,7 @@ #include "clang/AST/Decl.h" #include "clang/AST/OSLog.h" #include "clang/AST/OperationKinds.h" +#include "clang/AST/StmtVisitor.h" #include "clang/Basic/TargetBuiltins.h" #include "clang/Basic/TargetInfo.h" #include "clang/Basic/TargetOptions.h" @@ -1052,6 +1053,128 @@ CodeGenFunction::emitFlexibleArrayMemberSize(const Expr *E, unsigned Type, return Builder.CreateSelect(Cmp, Res, ConstantInt::get(ResType, 0, IsSigned)); } +namespace { + +struct ObjectSizeVisitor +: public ConstStmtVisitor { + const Expr *Visit(const Expr *E) { +return ConstStmtVisitor::Visit(E); + } + + const Expr *VisitStmt(const Stmt *S) { return nullptr; } + + const Expr *VisitDeclRefExpr(const DeclRefExpr *E) { return E; } + const Expr *VisitMemberExpr(const MemberExpr *E) { return E; } + const Expr *VisitArraySubscriptExpr(const ArraySubscriptExpr *E) { return E; } + + const Expr *VisitCastExpr(const CastExpr *E) { +return Visit(E->getSubExpr()); + } + const Expr *VisitParenExpr(const ParenExpr *E) { +return Visit(E->getSubExpr()); + } + const Expr *VisitUnaryAddrOf(const clang::UnaryOperator *E) { +return Visit(E->getSubExpr()); + } + const Expr *VisitUnaryDeref(const clang::UnaryOperator *E) { +return Visit(E->getSubExpr()); + } +}; + +} // end anonymous namespace + +/// tryToCalculateSubObjectSize - It may be possible to calculate the +/// sub-object size of an array and skip the generation of the llvm.objectsize +/// intrinsic. This avoids the complication in conveying the sub-object's +/// information to the backend. This calculation works for an N-dimentional +/// array. +/// +/// Note that this function supports only Row-Major arrays. The generalized +/// calculation of the offset of an element in Row-Major form: +/// +/// .- -. +/// d |d | +/// ---| - | +/// offset = \ | | | | +/// / | | | N_j | m_i +/// ---| | | | +/// i = 1 | j = i + 1 | +/// `- -' +/// +/// where d is the number of dimensions; m_i is the index of an element in +/// dimension i; and N_i is the size of dimention i. +/// +/// Examples: +/// 2D: offset = m_2 + (N_2 * m_1) +/// 3D: offset = m_3 + (N_3 * m_2) + (N_3 * N_2 * m_1) +llvm::Value * +CodeGenFunction::tryToCalculateSubObjectSize(const Expr *E, unsigned Type, + llvm::IntegerType *ResType) { + if ((Type & 0x01) != 1) +// Only support sub-object calculation. +return nullptr; + + const Expr *ObjectBase = ObjectSizeVisitor().Visit(E); + if (!ObjectBase) +return nullptr; + + // Collect the sizes and indices from the array. + ASTContext = getContext(); + SmallVector, 4> Dims; + while (const auto *ASE = dyn_cast(ObjectBase)) { +const Expr *Base = ASE; +const Expr *Idx = ASE->getIdx(); + +if (Idx->HasSideEffects(Ctx)) + return nullptr; + +uint64_t BaseSize = Ctx.getTypeSizeInChars(Base->getType()).getQuantity(); +Value *IdxSize = EmitScalarExpr(Idx); + +
[clang] b644726 - [PPC][InlineASM] Don't write to source directory in test
Author: Benjamin Kramer Date: 2024-06-24T16:35:07+02:00 New Revision: b6447260748086c0df484ec6609f126ae90e91ea URL: https://github.com/llvm/llvm-project/commit/b6447260748086c0df484ec6609f126ae90e91ea DIFF: https://github.com/llvm/llvm-project/commit/b6447260748086c0df484ec6609f126ae90e91ea.diff LOG: [PPC][InlineASM] Don't write to source directory in test Added: Modified: clang/test/CodeGen/PowerPC/inline-asm-constraints-error.c Removed: diff --git a/clang/test/CodeGen/PowerPC/inline-asm-constraints-error.c b/clang/test/CodeGen/PowerPC/inline-asm-constraints-error.c index eb443eee40e55..2f35e52fc0b77 100644 --- a/clang/test/CodeGen/PowerPC/inline-asm-constraints-error.c +++ b/clang/test/CodeGen/PowerPC/inline-asm-constraints-error.c @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -emit-llvm -triple powerpc64-ibm-aix-xcoff -verify %s -// RUN: %clang_cc1 -emit-llvm -triple powerpc-ibm-aix-xcoff -verify %s +// RUN: %clang_cc1 -emit-llvm-only -triple powerpc64-ibm-aix-xcoff -verify %s +// RUN: %clang_cc1 -emit-llvm-only -triple powerpc-ibm-aix-xcoff -verify %s // This test case exist to test marking the 'a' inline assembly constraint as // unsupported because powerpc previously marked it as supported. int foo(int arg){ ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [analyzer] Add an ownership change visitor to StreamChecker (PR #94957)
https://github.com/Szelethus closed https://github.com/llvm/llvm-project/pull/94957 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] fc4b09d - [analyzer] Add an ownership change visitor to StreamChecker (#94957)
Author: Kristóf Umann Date: 2024-06-24T16:34:36+02:00 New Revision: fc4b09d16139348533f1a1c9c72c99dacba51417 URL: https://github.com/llvm/llvm-project/commit/fc4b09d16139348533f1a1c9c72c99dacba51417 DIFF: https://github.com/llvm/llvm-project/commit/fc4b09d16139348533f1a1c9c72c99dacba51417.diff LOG: [analyzer] Add an ownership change visitor to StreamChecker (#94957) This is very similar to https://reviews.llvm.org/D105553, in fact, I barely made any changes from MallocChecker's ownership visitor to this one. The new visitor emits a diagnostic note for function where a change in stream ownership was expected (for example, it had a fclose() call), but the ownership remained unchanged. This is similar to messages regarding ordinary values ("Returning without writing to x"). Added: clang/test/Analysis/stream-notes-missing-close.cpp Modified: clang/lib/StaticAnalyzer/Checkers/NoOwnershipChangeVisitor.cpp clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp Removed: diff --git a/clang/lib/StaticAnalyzer/Checkers/NoOwnershipChangeVisitor.cpp b/clang/lib/StaticAnalyzer/Checkers/NoOwnershipChangeVisitor.cpp index 2ff76679b5ebf..22b5ebfd6fab0 100644 --- a/clang/lib/StaticAnalyzer/Checkers/NoOwnershipChangeVisitor.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/NoOwnershipChangeVisitor.cpp @@ -18,6 +18,7 @@ using namespace clang; using namespace ento; using OwnerSet = NoOwnershipChangeVisitor::OwnerSet; +namespace { // Collect which entities point to the allocated memory, and could be // responsible for deallocating it. class OwnershipBindingsHandler : public StoreManager::BindingsHandler { @@ -46,6 +47,7 @@ class OwnershipBindingsHandler : public StoreManager::BindingsHandler { out << "}\n"; } }; +} // namespace OwnerSet NoOwnershipChangeVisitor::getOwnersAtNode(const ExplodedNode *N) { OwnerSet Ret; diff --git a/clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp index 613c221de7b4c..9aee7f952ad2d 100644 --- a/clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp @@ -10,6 +10,9 @@ // //===--===// +#include "NoOwnershipChangeVisitor.h" +#include "clang/ASTMatchers/ASTMatchFinder.h" +#include "clang/ASTMatchers/ASTMatchers.h" #include "clang/StaticAnalyzer/Checkers/BuiltinCheckerRegistration.h" #include "clang/StaticAnalyzer/Core/BugReporter/BugType.h" #include "clang/StaticAnalyzer/Core/Checker.h" @@ -74,6 +77,12 @@ struct StreamErrorState { /// Returns if the StreamErrorState is a valid object. operator bool() const { return NoError || FEof || FError; } + LLVM_DUMP_METHOD void dump() const { dumpToStream(llvm::errs()); } + LLVM_DUMP_METHOD void dumpToStream(llvm::raw_ostream ) const { +os << "NoError: " << NoError << ", FEof: " << FEof + << ", FError: " << FError; + } + void Profile(llvm::FoldingSetNodeID ) const { ID.AddBoolean(NoError); ID.AddBoolean(FEof); @@ -98,6 +107,18 @@ struct StreamState { OpenFailed /// The last open operation has failed. } State; + StringRef getKindStr() const { +switch (State) { +case Opened: + return "Opened"; +case Closed: + return "Closed"; +case OpenFailed: + return "OpenFailed"; +} +llvm_unreachable("Unknown StreamState!"); + } + /// State of the error flags. /// Ignored in non-opened stream state but must be NoError. StreamErrorState const ErrorState; @@ -146,6 +167,9 @@ struct StreamState { return StreamState{L, OpenFailed, {}, false}; } + LLVM_DUMP_METHOD void dump() const { dumpToStream(llvm::errs()); } + LLVM_DUMP_METHOD void dumpToStream(llvm::raw_ostream ) const; + void Profile(llvm::FoldingSetNodeID ) const { ID.AddPointer(LastOperation); ID.AddInteger(State); @@ -183,6 +207,14 @@ struct FnDescription { ArgNoTy StreamArgNo; }; +LLVM_DUMP_METHOD void StreamState::dumpToStream(llvm::raw_ostream ) const { + os << "{Kind: " << getKindStr() << ", Last operation: " << LastOperation + << ", ErrorState: "; + ErrorState.dumpToStream(os); + os << ", FilePos: " << (FilePositionIndeterminate ? "Indeterminate" : "OK") + << '}'; +} + /// Get the value of the stream argument out of the passed call event. /// The call should contain a function that is described by Desc. SVal getStreamArg(const FnDescription *Desc, const CallEvent ) { @@ -300,6 +332,8 @@ class StreamChecker : public Checker FnDescriptions = { {{CDM::CLibrary, {"fopen"}, 2}, @@ -310,8 +344,7 @@ class StreamChecker : public Checker(); +return StreamChk->FCloseDesc.matchesAsWritten(Call); + } + + bool doesFnIntendToHandleOwnership(const Decl *Callee, + ASTContext ) final { +using namespace clang::ast_matchers; +const
[clang] 6ecb9fd - [C11] Remove WG14 N1382 from the list of papers to track
Author: Aaron Ballman Date: 2024-06-24T10:34:11-04:00 New Revision: 6ecb9fd83d6015b19be8db554328645ae15e63e9 URL: https://github.com/llvm/llvm-project/commit/6ecb9fd83d6015b19be8db554328645ae15e63e9 DIFF: https://github.com/llvm/llvm-project/commit/6ecb9fd83d6015b19be8db554328645ae15e63e9.diff LOG: [C11] Remove WG14 N1382 from the list of papers to track This paper proposes only changes to a footnote that had problematic implications for ABI; the changes were purely editorial. Added: Modified: clang/www/c_status.html Removed: diff --git a/clang/www/c_status.html b/clang/www/c_status.html index 4cbb51ea02468..6b375a6b7999d 100644 --- a/clang/www/c_status.html +++ b/clang/www/c_status.html @@ -488,11 +488,6 @@ C11 implementation status https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1367.htm;>N1367 Unknown - - FLT_EVAL_METHOD and return - https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1382.htm;>N1382 - Unknown - Floating-point to int/_Bool conversions https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1391.htm;>N1391 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 29e0f04 - [C11] Remove WG14 N1353 from the list of papers to track
Author: Aaron Ballman Date: 2024-06-24T10:29:15-04:00 New Revision: 29e0f046735010540fbdba4371dcd26f9e437650 URL: https://github.com/llvm/llvm-project/commit/29e0f046735010540fbdba4371dcd26f9e437650 DIFF: https://github.com/llvm/llvm-project/commit/29e0f046735010540fbdba4371dcd26f9e437650.diff LOG: [C11] Remove WG14 N1353 from the list of papers to track Only the first proposed changes in the paper were adopted, and that wording was changing "operations" into "operators", which is purely an editorial change. Added: Modified: clang/www/c_status.html Removed: diff --git a/clang/www/c_status.html b/clang/www/c_status.html index 922a84ca34312..4cbb51ea02468 100644 --- a/clang/www/c_status.html +++ b/clang/www/c_status.html @@ -457,11 +457,6 @@ C11 implementation status https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1349.htm;>N1349 Unknown - - FLT_EVAL_METHOD issues (first change only) - https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1353.pdf;>N1353 - Unknown - _Bool bit-fields https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1356.htm;>N1356 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] nonblocking/nonallocating attributes (was: nolock/noalloc) (PR #84983)
dougsonos wrote: > I’m probably just stating the obvious here, but seeing as existing code > obviously does not make use of effects, for compiling it to become slower, > that means that we’re probably unconditionally executing code somewhere > irrespective of whether effects are present or not, so what I’m saying is we > should probably investigate any places where this pr checks for the presence > of effects and does something based on that and move the checks for whether a > function even has effects attached to it as far up as possible and try and > also optimise that check (is the function that checks for that defined in a > header? If not, we should maybe move the definition there so it can be > inlined). That makes sense. I remember thinking a couple of times that I was working on a function that might be better inlined, but changing Type.h triggered long rebuilds. > The only other option I can think of is that this adds some more data to > `FunctionProtoType`s, which means we allocate more etc. but that alone > shouldn’t have this big of an impact I’m assuming? Well, it adds two more types of trailing objects so nothing more gets allocated in the case of no effects. Possibly the trailing objects mechanism itself gets a bit slower though. I'll dig in and investigate today. https://github.com/llvm/llvm-project/pull/84983 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] ae1c564 - [clang][Interp] Cast dummy pointers to other pointer type if necessary
Author: Timm Bäder Date: 2024-06-24T16:17:03+02:00 New Revision: ae1c564d1522f1202d05b698dce8d9c8ca46667c URL: https://github.com/llvm/llvm-project/commit/ae1c564d1522f1202d05b698dce8d9c8ca46667c DIFF: https://github.com/llvm/llvm-project/commit/ae1c564d1522f1202d05b698dce8d9c8ca46667c.diff LOG: [clang][Interp] Cast dummy pointers to other pointer type if necessary Added: Modified: clang/lib/AST/Interp/ByteCodeExprGen.cpp clang/test/Sema/ptrauth.c Removed: diff --git a/clang/lib/AST/Interp/ByteCodeExprGen.cpp b/clang/lib/AST/Interp/ByteCodeExprGen.cpp index 3c96059375360..69661a590b9c2 100644 --- a/clang/lib/AST/Interp/ByteCodeExprGen.cpp +++ b/clang/lib/AST/Interp/ByteCodeExprGen.cpp @@ -3574,8 +3574,14 @@ bool ByteCodeExprGen::VisitBuiltinCallExpr(const CallExpr *E) { Builtin == Builtin::BI__builtin___NSStringMakeConstantString || Builtin == Builtin::BI__builtin_ptrauth_sign_constant || Builtin == Builtin::BI__builtin_function_start) { -if (std::optional GlobalOffset = P.createGlobal(E)) - return this->emitGetPtrGlobal(*GlobalOffset, E); +if (std::optional GlobalOffset = P.createGlobal(E)) { + if (!this->emitGetPtrGlobal(*GlobalOffset, E)) +return false; + + if (PrimType PT = classifyPrim(E); PT != PT_Ptr && isPtrType(PT)) +return this->emitDecayPtr(PT_Ptr, PT, E); + return true; +} return false; } diff --git a/clang/test/Sema/ptrauth.c b/clang/test/Sema/ptrauth.c index cd069881793c5..fc1ae954fa36b 100644 --- a/clang/test/Sema/ptrauth.c +++ b/clang/test/Sema/ptrauth.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple arm64-apple-ios -fsyntax-only -verify -fptrauth-intrinsics %s +// RUN: %clang_cc1 -triple arm64-apple-ios -fsyntax-only -verify -fptrauth-intrinsics %s -fexperimental-new-constant-interpreter #if __has_feature(ptrauth_intrinsics) #warning Pointer authentication enabled! ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] Emit bad shift warnings (PR #70307)
https://github.com/budimirarandjelovicsyrmia updated https://github.com/llvm/llvm-project/pull/70307 From a80047859d20f0fbb591f6c8a561468ce966f845 Mon Sep 17 00:00:00 2001 From: budimirarandjelovicsyrmia Date: Thu, 26 Oct 2023 10:39:52 +0200 Subject: [PATCH] [clang] Emit bad shift warnings --- clang/lib/AST/ExprConstant.cpp | 7 +++ clang/lib/Sema/SemaExpr.cpp| 16 clang/test/C/drs/dr0xx.c | 3 ++- clang/test/C/drs/dr2xx.c | 4 +++- clang/test/Sema/builtins.c | 6 -- clang/test/Sema/constant-builtins-2.c | 12 clang/test/Sema/integer-overflow.c | 2 ++ clang/test/Sema/shift-count-negative.c | 8 clang/test/Sema/shift-count-overflow.c | 6 ++ clang/test/Sema/shift-negative-value.c | 9 + clang/test/Sema/vla-2.c| 6 -- clang/test/SemaCXX/enum.cpp| 15 --- clang/test/SemaCXX/shift.cpp | 2 +- 13 files changed, 74 insertions(+), 22 deletions(-) create mode 100644 clang/test/Sema/shift-count-negative.c create mode 100644 clang/test/Sema/shift-count-overflow.c create mode 100644 clang/test/Sema/shift-negative-value.c diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp index af1f18aa8ef24..0926bcf258f58 100644 --- a/clang/lib/AST/ExprConstant.cpp +++ b/clang/lib/AST/ExprConstant.cpp @@ -2856,6 +2856,9 @@ static bool handleIntIntBinOp(EvalInfo , const BinaryOperator *E, else if (LHS.countl_zero() < SA) Info.CCEDiag(E, diag::note_constexpr_lshift_discards); } +if (Info.EvalStatus.Diag && !Info.EvalStatus.Diag->empty() && +Info.getLangOpts().CPlusPlus) + return false; Result = LHS << SA; return true; } @@ -2879,6 +2882,10 @@ static bool handleIntIntBinOp(EvalInfo , const BinaryOperator *E, if (SA != RHS) Info.CCEDiag(E, diag::note_constexpr_large_shift) << RHS << E->getType() << LHS.getBitWidth(); + +if (Info.EvalStatus.Diag && !Info.EvalStatus.Diag->empty() && +Info.getLangOpts().CPlusPlus) + return false; Result = LHS >> SA; return true; } diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 44f886bf54e3a..fd1c8284b5ff0 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -11246,7 +11246,7 @@ static void DiagnoseBadShiftValues(Sema& S, ExprResult , ExprResult , if (Right.isNegative()) { S.DiagRuntimeBehavior(Loc, RHS.get(), S.PDiag(diag::warn_shift_negative) -<< RHS.get()->getSourceRange()); + << RHS.get()->getSourceRange()); return; } @@ -11261,7 +11261,7 @@ static void DiagnoseBadShiftValues(Sema& S, ExprResult , ExprResult , if (Right.uge(LeftSize)) { S.DiagRuntimeBehavior(Loc, RHS.get(), S.PDiag(diag::warn_shift_gt_typewidth) -<< RHS.get()->getSourceRange()); + << RHS.get()->getSourceRange()); return; } @@ -11294,7 +11294,7 @@ static void DiagnoseBadShiftValues(Sema& S, ExprResult , ExprResult , if (Left.isNegative()) { S.DiagRuntimeBehavior(Loc, LHS.get(), S.PDiag(diag::warn_shift_lhs_negative) -<< LHS.get()->getSourceRange()); + << LHS.get()->getSourceRange()); return; } @@ -17130,11 +17130,19 @@ Sema::VerifyIntegerConstantExpression(Expr *E, llvm::APSInt *Result, // Circumvent ICE checking in C++11 to avoid evaluating the expression twice // in the non-ICE case. if (!getLangOpts().CPlusPlus11 && E->isIntegerConstantExpr(Context)) { +SmallVector Notes; if (Result) - *Result = E->EvaluateKnownConstIntCheckOverflow(Context); + *Result = E->EvaluateKnownConstIntCheckOverflow(Context, ); if (!isa(E)) E = Result ? ConstantExpr::Create(Context, E, APValue(*Result)) : ConstantExpr::Create(Context, E); + +if (Notes.size()) { + Diagnoser.diagnoseFold(*this, DiagLoc) << E->getSourceRange(); + for (const PartialDiagnosticAt : Notes) +Diag(Note.first, Note.second); +} + return E; } diff --git a/clang/test/C/drs/dr0xx.c b/clang/test/C/drs/dr0xx.c index 36de32a93da95..252dc9329c4ca 100644 --- a/clang/test/C/drs/dr0xx.c +++ b/clang/test/C/drs/dr0xx.c @@ -430,7 +430,8 @@ void dr081(void) { /* Demonstrate that we don't crash when left shifting a signed value; that's * implementation defined behavior. */ - _Static_assert(-1 << 1 == -2, "fail"); /* Didn't shift a zero into the "sign bit". */ + _Static_assert(-1 << 1 == -2, "fail"); /* expected-warning {{expression is not an integer constant expression; folding it to a constant is a GNU extension}} + expected-note {{left shift of negative value -1}} */
[clang] [compiler-rt] [llvm] [openmp] [PGO][Offload] Add GPU profiling flags to driver (PR #94268)
EthanLuisMcDonough wrote: > Is this something that specifically requires its own flag? Or could we just > do `-Xarch_device -fprofile-generate`. Right now the `-fprofile-generate-gpu` and `-fprofile-instr-generate-gpu` flags make sure that the compiler-rt profiling library is included even if host profiling isn't enabled, but your suggestion seems quite nice and compact. I'm open to looking into this. Thoughts @jdoerfert? https://github.com/llvm/llvm-project/pull/94268 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang-format] Don't count template template parameter as declaration (PR #96396)
https://github.com/mydeveloperday commented: Doesn't this show a change in default formatting from ```c++ template class QQQ> class PPP> void comment_to_html_conversion_22() ``` ```c++ template class QQQ> class PPP> void comment_to_html_conversion_22() ``` I think the fact that the previous test failed shows more that we have changed the default. Is this the change we expect? maybe we could add a unit test to assert the new behavior if that is desired https://github.com/llvm/llvm-project/pull/96396 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] [clang-tidy] align all help message in run-clang-tidy (PR #96199)
https://github.com/HerrCai0907 updated https://github.com/llvm/llvm-project/pull/96199 >From 03bc40a343227cb839ec908492c0d904be9af654 Mon Sep 17 00:00:00 2001 From: Congcong Cai Date: Thu, 20 Jun 2024 14:36:51 + Subject: [PATCH 1/3] [clang-tidy] align all help message in run-clang-tidy [NFC] --- .../clang-tidy/tool/run-clang-tidy.py | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py b/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py index 4dd20bec81d3b..76374933bfd15 100755 --- a/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py +++ b/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py @@ -264,17 +264,17 @@ def main(): help="allow alpha checkers from clang-analyzer.", ) parser.add_argument( -"-clang-tidy-binary", metavar="PATH", help="path to clang-tidy binary" +"-clang-tidy-binary", metavar="PATH", help="path to clang-tidy binary." ) parser.add_argument( "-clang-apply-replacements-binary", metavar="PATH", -help="path to clang-apply-replacements binary", +help="path to clang-apply-replacements binary.", ) parser.add_argument( "-checks", default=None, -help="checks filter, when not specified, use clang-tidy default", +help="checks filter, when not specified, use clang-tidy default.", ) config_group = parser.add_mutually_exclusive_group() config_group.add_argument( @@ -350,16 +350,16 @@ def main(): help="number of tidy instances to be run in parallel.", ) parser.add_argument( -"files", nargs="*", default=[".*"], help="files to be processed (regex on path)" +"files", nargs="*", default=[".*"], help="files to be processed (regex on path)." ) -parser.add_argument("-fix", action="store_true", help="apply fix-its") +parser.add_argument("-fix", action="store_true", help="apply fix-its.") parser.add_argument( -"-format", action="store_true", help="Reformat code after applying fixes" +"-format", action="store_true", help="Reformat code after applying fixes." ) parser.add_argument( "-style", default="file", -help="The style of reformat code after applying fixes", +help="The style of reformat code after applying fixes.", ) parser.add_argument( "-use-color", @@ -388,7 +388,7 @@ def main(): help="Additional argument to prepend to the compiler command line.", ) parser.add_argument( -"-quiet", action="store_true", help="Run clang-tidy in quiet mode" +"-quiet", action="store_true", help="Run clang-tidy in quiet mode." ) parser.add_argument( "-load", @@ -400,7 +400,7 @@ def main(): parser.add_argument( "-warnings-as-errors", default=None, -help="Upgrades warnings to errors. Same format as '-checks'", +help="Upgrades warnings to errors. Same format as '-checks'.", ) args = parser.parse_args() >From 60c9498a58442a4e1e7f4ee04b9fa225c02ee9bf Mon Sep 17 00:00:00 2001 From: Congcong Cai Date: Thu, 20 Jun 2024 15:11:43 + Subject: [PATCH 2/3] format --- clang-tools-extra/clang-tidy/tool/run-clang-tidy.py | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py b/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py index 76374933bfd15..a2c8e4f8dc52b 100755 --- a/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py +++ b/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py @@ -350,7 +350,10 @@ def main(): help="number of tidy instances to be run in parallel.", ) parser.add_argument( -"files", nargs="*", default=[".*"], help="files to be processed (regex on path)." +"files", +nargs="*", +default=[".*"], +help="files to be processed (regex on path).", ) parser.add_argument("-fix", action="store_true", help="apply fix-its.") parser.add_argument( >From 867a104276e38bd7c4899fd5540f0cacfa5d5e41 Mon Sep 17 00:00:00 2001 From: Congcong Cai Date: Mon, 24 Jun 2024 22:00:44 +0800 Subject: [PATCH 3/3] capitalize the first word --- .../clang-tidy/tool/run-clang-tidy.py | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py b/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py index a2c8e4f8dc52b..6e7cc8a873a22 100755 --- a/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py +++ b/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py @@ -261,20 +261,20 @@ def main(): parser.add_argument( "-allow-enabling-alpha-checkers", action="store_true", -help="allow alpha checkers from clang-analyzer.", +help="Allow alpha checkers from clang-analyzer.", ) parser.add_argument( -
[clang] [llvm] [AArch64] Add ability to list extensions enabled for a target (PR #95805)
@@ -1130,7 +1130,8 @@ INSTANTIATE_TEST_SUITE_P( AArch64::AEK_MTE, AArch64::AEK_SSBS, AArch64::AEK_FP16,AArch64::AEK_FP16FML, AArch64::AEK_SB, AArch64::AEK_JSCVT, - AArch64::AEK_FCMA,AArch64::AEK_PERFMON}), + AArch64::AEK_FCMA,AArch64::AEK_PERFMON, + AArch64::AEK_ETE, AArch64::AEK_AM}), tmatheson-arm wrote: I notice there are no tests for `--print-enabled-extensions` for individual CPUs. Can we now remove these from `TargetParserTest`, which is quite annoying to keep updated, and instead add lit tests for these CPUs which can be autogenerated? Maybe in a follow up PR. https://github.com/llvm/llvm-project/pull/95805 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] [clang-tidy] add fixhint for misc-use-internal-linkage (PR #96203)
https://github.com/HerrCai0907 updated https://github.com/llvm/llvm-project/pull/96203 >From 669205c0f659239c58a3bde3ddadabb0a8ecbad8 Mon Sep 17 00:00:00 2001 From: Congcong Cai Date: Thu, 20 Jun 2024 15:05:57 + Subject: [PATCH 1/2] [clang-tidy] add fixhint for misc-use-internal-linkage --- .../clang-tidy/misc/UseInternalLinkageCheck.cpp | 12 ++-- .../checkers/misc/use-internal-linkage-func.cpp | 1 + .../checkers/misc/use-internal-linkage-var.cpp | 1 + 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/clang-tools-extra/clang-tidy/misc/UseInternalLinkageCheck.cpp b/clang-tools-extra/clang-tidy/misc/UseInternalLinkageCheck.cpp index 70d0281df28fa..e36ccdba42ef1 100644 --- a/clang-tools-extra/clang-tidy/misc/UseInternalLinkageCheck.cpp +++ b/clang-tools-extra/clang-tidy/misc/UseInternalLinkageCheck.cpp @@ -82,11 +82,19 @@ static constexpr StringRef Message = void UseInternalLinkageCheck::check(const MatchFinder::MatchResult ) { if (const auto *FD = Result.Nodes.getNodeAs("fn")) { -diag(FD->getLocation(), Message) << "function" << FD; +DiagnosticBuilder DB = diag(FD->getLocation(), Message) << "function" << FD; +SourceLocation FixLoc = FD->getTypeSpecStartLoc(); +if (FixLoc.isInvalid() || FixLoc.isMacroID()) + return; +DB << FixItHint::CreateInsertion(FixLoc, "static "); return; } if (const auto *VD = Result.Nodes.getNodeAs("var")) { -diag(VD->getLocation(), Message) << "variable" << VD; +DiagnosticBuilder DB = diag(VD->getLocation(), Message) << "variable" << VD; +SourceLocation FixLoc = VD->getTypeSpecStartLoc(); +if (FixLoc.isInvalid() || FixLoc.isMacroID()) + return; +DB << FixItHint::CreateInsertion(FixLoc, "static "); return; } llvm_unreachable(""); diff --git a/clang-tools-extra/test/clang-tidy/checkers/misc/use-internal-linkage-func.cpp b/clang-tools-extra/test/clang-tidy/checkers/misc/use-internal-linkage-func.cpp index c6c513fe0b0c0..c244f32db8e96 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/misc/use-internal-linkage-func.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/misc/use-internal-linkage-func.cpp @@ -4,6 +4,7 @@ void func() {} // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'func' +// CHECK-FIXES: static void func() {} template void func_template() {} diff --git a/clang-tools-extra/test/clang-tidy/checkers/misc/use-internal-linkage-var.cpp b/clang-tools-extra/test/clang-tidy/checkers/misc/use-internal-linkage-var.cpp index bd5ef5431de6c..b076e9125fc35 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/misc/use-internal-linkage-var.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/misc/use-internal-linkage-var.cpp @@ -4,6 +4,7 @@ int global; // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: variable 'global' +// CHECK-FIXES: static int global; template T global_template; >From d5bb05e2af683a2dcb08c6e8cabc448001c07414 Mon Sep 17 00:00:00 2001 From: Congcong Cai Date: Mon, 24 Jun 2024 21:58:56 +0800 Subject: [PATCH 2/2] add FixMode option --- .../misc/UseInternalLinkageCheck.cpp | 36 +-- .../clang-tidy/misc/UseInternalLinkageCheck.h | 11 -- .../checks/misc/use-internal-linkage.rst | 13 +++ .../use-internal-linkage-fix-mode-none.cpp| 10 ++ .../misc/use-internal-linkage-func.cpp| 2 ++ .../misc/use-internal-linkage-var.cpp | 2 ++ 6 files changed, 69 insertions(+), 5 deletions(-) create mode 100644 clang-tools-extra/test/clang-tidy/checkers/misc/use-internal-linkage-fix-mode-none.cpp diff --git a/clang-tools-extra/clang-tidy/misc/UseInternalLinkageCheck.cpp b/clang-tools-extra/clang-tidy/misc/UseInternalLinkageCheck.cpp index e36ccdba42ef1..44ccc2bc906a5 100644 --- a/clang-tools-extra/clang-tidy/misc/UseInternalLinkageCheck.cpp +++ b/clang-tools-extra/clang-tidy/misc/UseInternalLinkageCheck.cpp @@ -18,6 +18,26 @@ using namespace clang::ast_matchers; +namespace clang::tidy { + +template <> +struct OptionEnumMapping { + static llvm::ArrayRef< + std::pair> + getEnumMapping() { +static constexpr std::pair +Mapping[] = { +{misc::UseInternalLinkageCheck::FixModeKind::None, "None"}, +{misc::UseInternalLinkageCheck::FixModeKind::UseStatic, + "UseStatic"}, +}; +return {Mapping}; + } +}; + +} // namespace clang::tidy + namespace clang::tidy::misc { namespace { @@ -57,6 +77,16 @@ AST_POLYMORPHIC_MATCHER(isExternStorageClass, } // namespace +UseInternalLinkageCheck::UseInternalLinkageCheck(StringRef Name, + ClangTidyContext *Context) +: ClangTidyCheck(Name, Context), + HeaderFileExtensions(Context->getHeaderFileExtensions()), + FixMode(Options.get("FixMode", FixModeKind::UseStatic)) {} + +void UseInternalLinkageCheck::storeOptions(ClangTidyOptions::OptionMap ) { + Options.store(Opts, "FixMode", FixMode); +} + void
[clang] [clang][CGRecordLayout] Remove dependency on isZeroSize (PR #96422)
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/96422 >From f5938919b3a0060db6b373bead1c52f4bb65c841 Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Fri, 21 Jun 2024 12:15:07 +0100 Subject: [PATCH 1/4] [clang][CGRecordLayout] Remove dependency on isZeroSize This is a follow-up from the conversation starting at https://github.com/llvm/llvm-project/pull/93809#issuecomment-2173729801 The root problem that motivated the change are external AST sources that compute `ASTRecordLayout`s themselves instead of letting Clang compute them from the AST. One such examples is LLDB using DWARF to get the definitive offsets and sizes of C++ structures. Such layouts should be considered correct (modulo buggy DWARF), but various assertions and lowering logic around the `CGRecordLayoutBuilder` relies on the AST having `[[no_unique_address]]` attached to them. This is a layout-altering attribute which is not encoded in DWARF. This causes us LLDB to trip over the various LLVM<->Clang layout consistency checks. There has been precedent for avoiding such layout-altering attributes to affect lowering with externally-provided layouts (e.g., packed structs). This patch proposes to replace the `isZeroSize` checks in `CGRecordLayoutBuilder` (which roughly means "empty field with [[no_unique_address]]") with checks for `CodeGen::isEmptyField`/`CodeGen::isEmptyRecord`. --- clang/lib/CodeGen/ABIInfoImpl.cpp | 6 ++--- clang/lib/CodeGen/ABIInfoImpl.h | 6 ++--- clang/lib/CodeGen/CGExpr.cpp | 3 ++- clang/lib/CodeGen/CGRecordLayoutBuilder.cpp | 14 ++-- clang/test/CodeGen/X86/x86_64-vaarg.c | 3 ++- clang/test/CodeGen/debug-info-packed-struct.c | 2 +- clang/test/CodeGen/paren-list-agg-init.cpp| 15 + .../CodeGenCXX/2011-12-19-init-list-ctor.cpp | 6 ++--- clang/test/CodeGenCXX/auto-var-init.cpp | 10 - .../test/CodeGenCXX/bitfield-access-empty.cpp | 16 +++--- clang/test/CodeGenCXX/class-layout.cpp| 2 +- clang/test/CodeGenCXX/compound-literals.cpp | 2 +- clang/test/CodeGenCXX/exceptions.cpp | 7 +++--- .../lambda-deterministic-captures.cpp | 4 +--- clang/test/CodeGenCXX/ms_struct.cpp | 4 +--- clang/test/CodeGenCXX/partial-destruction.cpp | 11 -- clang/test/CodeGenCXX/pr18962.cpp | 5 ++--- clang/test/CodeGenCXX/references.cpp | 4 +--- clang/test/CodeGenCXX/temporaries.cpp | 12 +- clang/test/CodeGenObjCXX/lambda-to-block.mm | 9 clang/test/OpenMP/irbuilder_for_iterator.cpp | 10 - clang/test/OpenMP/irbuilder_for_rangefor.cpp | 14 +--- .../test/OpenMP/task_member_call_codegen.cpp | 22 --- clang/test/Sema/ms_class_layout.cpp | 14 ++-- 24 files changed, 85 insertions(+), 116 deletions(-) diff --git a/clang/lib/CodeGen/ABIInfoImpl.cpp b/clang/lib/CodeGen/ABIInfoImpl.cpp index e9a26abb77837..92fcc3bc2c5f4 100644 --- a/clang/lib/CodeGen/ABIInfoImpl.cpp +++ b/clang/lib/CodeGen/ABIInfoImpl.cpp @@ -248,7 +248,7 @@ Address CodeGen::emitMergePHI(CodeGenFunction , Address Addr1, return Address(PHI, Addr1.getElementType(), Align); } -bool CodeGen::isEmptyField(ASTContext , const FieldDecl *FD, +bool CodeGen::isEmptyField(const ASTContext , const FieldDecl *FD, bool AllowArrays, bool AsIfNoUniqueAddr) { if (FD->isUnnamedBitField()) return true; @@ -289,8 +289,8 @@ bool CodeGen::isEmptyField(ASTContext , const FieldDecl *FD, return isEmptyRecord(Context, FT, AllowArrays, AsIfNoUniqueAddr); } -bool CodeGen::isEmptyRecord(ASTContext , QualType T, bool AllowArrays, -bool AsIfNoUniqueAddr) { +bool CodeGen::isEmptyRecord(const ASTContext , QualType T, +bool AllowArrays, bool AsIfNoUniqueAddr) { const RecordType *RT = T->getAs(); if (!RT) return false; diff --git a/clang/lib/CodeGen/ABIInfoImpl.h b/clang/lib/CodeGen/ABIInfoImpl.h index 92986fb431646..e3f373e39c35a 100644 --- a/clang/lib/CodeGen/ABIInfoImpl.h +++ b/clang/lib/CodeGen/ABIInfoImpl.h @@ -126,15 +126,15 @@ Address emitMergePHI(CodeGenFunction , Address Addr1, /// is an unnamed bit-field or an (array of) empty record(s). If /// AsIfNoUniqueAddr is true, then C++ record fields are considered empty if /// the [[no_unique_address]] attribute would have made them empty. -bool isEmptyField(ASTContext , const FieldDecl *FD, bool AllowArrays, - bool AsIfNoUniqueAddr = false); +bool isEmptyField(const ASTContext , const FieldDecl *FD, + bool AllowArrays, bool AsIfNoUniqueAddr = false); /// isEmptyRecord - Return true iff a structure contains only empty /// fields. Note that a structure with a flexible array member is not /// considered empty. If AsIfNoUniqueAddr is true, then C++ record fields are /// considered empty if the
[clang] [MS ABI]: Support preserve_none in MS ABI (PR #96487)
llvmbot wrote: @llvm/pr-subscribers-clang Author: None (antangelo) Changes Fixes ICE when compiling preserve_nonecc functions on Windows and adds support for the calling convention on AArch64 for Windows targets. --- Full diff: https://github.com/llvm/llvm-project/pull/96487.diff 4 Files Affected: - (modified) clang/lib/AST/MicrosoftMangle.cpp (+7-1) - (modified) clang/lib/Basic/Targets/AArch64.cpp (+1) - (added) clang/test/CodeGenCXX/msabi-preserve-none-cc.cpp (+28) - (modified) clang/test/Sema/preserve-none-call-conv.c (+1) ``diff diff --git a/clang/lib/AST/MicrosoftMangle.cpp b/clang/lib/AST/MicrosoftMangle.cpp index 3923d34274703..b49a96f105cfb 100644 --- a/clang/lib/AST/MicrosoftMangle.cpp +++ b/clang/lib/AST/MicrosoftMangle.cpp @@ -2962,7 +2962,10 @@ void MicrosoftCXXNameMangler::mangleCallingConvention(CallingConv CC) { // ::= J # __export __fastcall // ::= Q # __vectorcall // ::= S # __attribute__((__swiftcall__)) // Clang-only - // ::= T # __attribute__((__swiftasynccall__)) + // ::= W # __attribute__((__swiftasynccall__)) + // ::= U # __attribute__((__preserve_most__)) + // ::= V # __attribute__((__preserve_none__)) // + // Clang-only //// Clang-only // ::= w # __regcall // ::= x # __regcall4 @@ -2986,6 +2989,9 @@ void MicrosoftCXXNameMangler::mangleCallingConvention(CallingConv CC) { case CC_Swift: Out << 'S'; break; case CC_SwiftAsync: Out << 'W'; break; case CC_PreserveMost: Out << 'U'; break; +case CC_PreserveNone: + Out << 'V'; + break; case CC_X86RegCall: if (getASTContext().getLangOpts().RegCall4) Out << "x"; diff --git a/clang/lib/Basic/Targets/AArch64.cpp b/clang/lib/Basic/Targets/AArch64.cpp index 31d8121b91d10..2692ddec26ff4 100644 --- a/clang/lib/Basic/Targets/AArch64.cpp +++ b/clang/lib/Basic/Targets/AArch64.cpp @@ -1536,6 +1536,7 @@ WindowsARM64TargetInfo::checkCallingConvention(CallingConv CC) const { case CC_OpenCLKernel: case CC_PreserveMost: case CC_PreserveAll: + case CC_PreserveNone: case CC_Swift: case CC_SwiftAsync: case CC_Win64: diff --git a/clang/test/CodeGenCXX/msabi-preserve-none-cc.cpp b/clang/test/CodeGenCXX/msabi-preserve-none-cc.cpp new file mode 100644 index 0..29df5e4d84a70 --- /dev/null +++ b/clang/test/CodeGenCXX/msabi-preserve-none-cc.cpp @@ -0,0 +1,28 @@ +// RUN: %clang_cc1 -triple x86_64-unknown-windows-msvc -fdeclspec -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -triple aarch64-unknown-windows-msvc -fdeclspec -emit-llvm %s -o - | FileCheck %s + +void __attribute__((__preserve_none__)) f() {} +// CHECK-DAG: @"?f@@YVXXZ" + +void (__attribute__((__preserve_none__)) *p)(); +// CHECK-DAG: @"?p@@3P6VXXZEA + +namespace { +void __attribute__((__preserve_none__)) __attribute__((__used__)) f() { } +} +// CHECK-DAG: @"?f@?A0x{{[^@]*}}@@YVXXZ" + +namespace n { +void __attribute__((__preserve_none__)) f() {} +} +// CHECK-DAG: @"?f@n@@YVXXZ" + +struct __declspec(dllexport) S { + S(const S &) = delete; + S & operator=(const S &) = delete; + void __attribute__((__preserve_none__)) m() { } +}; +// CHECK-DAG: @"?m@S@@QEAVXXZ" + +void f(void (__attribute__((__preserve_none__))())) {} +// CHECK-DAG: @"?f@@YAXP6VXXZ@Z" diff --git a/clang/test/Sema/preserve-none-call-conv.c b/clang/test/Sema/preserve-none-call-conv.c index 4508095863de5..678fa7d5317e5 100644 --- a/clang/test/Sema/preserve-none-call-conv.c +++ b/clang/test/Sema/preserve-none-call-conv.c @@ -1,4 +1,5 @@ // RUN: %clang_cc1 %s -fsyntax-only -triple x86_64-unknown-unknown -verify +// RUN: %clang_cc1 %s -fsyntax-only -triple aarch64-unknown-unknown -verify typedef void typedef_fun_t(int); `` https://github.com/llvm/llvm-project/pull/96487 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [MS ABI]: Support preserve_none in MS ABI (PR #96487)
llvmbot wrote: @llvm/pr-subscribers-backend-aarch64 Author: None (antangelo) Changes Fixes ICE when compiling preserve_nonecc functions on Windows and adds support for the calling convention on AArch64 for Windows targets. --- Full diff: https://github.com/llvm/llvm-project/pull/96487.diff 4 Files Affected: - (modified) clang/lib/AST/MicrosoftMangle.cpp (+7-1) - (modified) clang/lib/Basic/Targets/AArch64.cpp (+1) - (added) clang/test/CodeGenCXX/msabi-preserve-none-cc.cpp (+28) - (modified) clang/test/Sema/preserve-none-call-conv.c (+1) ``diff diff --git a/clang/lib/AST/MicrosoftMangle.cpp b/clang/lib/AST/MicrosoftMangle.cpp index 3923d34274703..b49a96f105cfb 100644 --- a/clang/lib/AST/MicrosoftMangle.cpp +++ b/clang/lib/AST/MicrosoftMangle.cpp @@ -2962,7 +2962,10 @@ void MicrosoftCXXNameMangler::mangleCallingConvention(CallingConv CC) { // ::= J # __export __fastcall // ::= Q # __vectorcall // ::= S # __attribute__((__swiftcall__)) // Clang-only - // ::= T # __attribute__((__swiftasynccall__)) + // ::= W # __attribute__((__swiftasynccall__)) + // ::= U # __attribute__((__preserve_most__)) + // ::= V # __attribute__((__preserve_none__)) // + // Clang-only //// Clang-only // ::= w # __regcall // ::= x # __regcall4 @@ -2986,6 +2989,9 @@ void MicrosoftCXXNameMangler::mangleCallingConvention(CallingConv CC) { case CC_Swift: Out << 'S'; break; case CC_SwiftAsync: Out << 'W'; break; case CC_PreserveMost: Out << 'U'; break; +case CC_PreserveNone: + Out << 'V'; + break; case CC_X86RegCall: if (getASTContext().getLangOpts().RegCall4) Out << "x"; diff --git a/clang/lib/Basic/Targets/AArch64.cpp b/clang/lib/Basic/Targets/AArch64.cpp index 31d8121b91d10..2692ddec26ff4 100644 --- a/clang/lib/Basic/Targets/AArch64.cpp +++ b/clang/lib/Basic/Targets/AArch64.cpp @@ -1536,6 +1536,7 @@ WindowsARM64TargetInfo::checkCallingConvention(CallingConv CC) const { case CC_OpenCLKernel: case CC_PreserveMost: case CC_PreserveAll: + case CC_PreserveNone: case CC_Swift: case CC_SwiftAsync: case CC_Win64: diff --git a/clang/test/CodeGenCXX/msabi-preserve-none-cc.cpp b/clang/test/CodeGenCXX/msabi-preserve-none-cc.cpp new file mode 100644 index 0..29df5e4d84a70 --- /dev/null +++ b/clang/test/CodeGenCXX/msabi-preserve-none-cc.cpp @@ -0,0 +1,28 @@ +// RUN: %clang_cc1 -triple x86_64-unknown-windows-msvc -fdeclspec -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -triple aarch64-unknown-windows-msvc -fdeclspec -emit-llvm %s -o - | FileCheck %s + +void __attribute__((__preserve_none__)) f() {} +// CHECK-DAG: @"?f@@YVXXZ" + +void (__attribute__((__preserve_none__)) *p)(); +// CHECK-DAG: @"?p@@3P6VXXZEA + +namespace { +void __attribute__((__preserve_none__)) __attribute__((__used__)) f() { } +} +// CHECK-DAG: @"?f@?A0x{{[^@]*}}@@YVXXZ" + +namespace n { +void __attribute__((__preserve_none__)) f() {} +} +// CHECK-DAG: @"?f@n@@YVXXZ" + +struct __declspec(dllexport) S { + S(const S &) = delete; + S & operator=(const S &) = delete; + void __attribute__((__preserve_none__)) m() { } +}; +// CHECK-DAG: @"?m@S@@QEAVXXZ" + +void f(void (__attribute__((__preserve_none__))())) {} +// CHECK-DAG: @"?f@@YAXP6VXXZ@Z" diff --git a/clang/test/Sema/preserve-none-call-conv.c b/clang/test/Sema/preserve-none-call-conv.c index 4508095863de5..678fa7d5317e5 100644 --- a/clang/test/Sema/preserve-none-call-conv.c +++ b/clang/test/Sema/preserve-none-call-conv.c @@ -1,4 +1,5 @@ // RUN: %clang_cc1 %s -fsyntax-only -triple x86_64-unknown-unknown -verify +// RUN: %clang_cc1 %s -fsyntax-only -triple aarch64-unknown-unknown -verify typedef void typedef_fun_t(int); `` https://github.com/llvm/llvm-project/pull/96487 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [MS ABI]: Support preserve_none in MS ABI (PR #96487)
https://github.com/antangelo created https://github.com/llvm/llvm-project/pull/96487 Fixes ICE when compiling preserve_nonecc functions on Windows and adds support for the calling convention on AArch64 for Windows targets. >From 1e95098e324860268d55e72a14090f9524c7dde1 Mon Sep 17 00:00:00 2001 From: Antonio Abbatangelo Date: Mon, 24 Jun 2024 09:49:28 -0400 Subject: [PATCH] [MS ABI]: Support preserve_none in MS ABI --- clang/lib/AST/MicrosoftMangle.cpp | 8 +- clang/lib/Basic/Targets/AArch64.cpp | 1 + .../CodeGenCXX/msabi-preserve-none-cc.cpp | 28 +++ clang/test/Sema/preserve-none-call-conv.c | 1 + 4 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 clang/test/CodeGenCXX/msabi-preserve-none-cc.cpp diff --git a/clang/lib/AST/MicrosoftMangle.cpp b/clang/lib/AST/MicrosoftMangle.cpp index 3923d34274703..b49a96f105cfb 100644 --- a/clang/lib/AST/MicrosoftMangle.cpp +++ b/clang/lib/AST/MicrosoftMangle.cpp @@ -2962,7 +2962,10 @@ void MicrosoftCXXNameMangler::mangleCallingConvention(CallingConv CC) { // ::= J # __export __fastcall // ::= Q # __vectorcall // ::= S # __attribute__((__swiftcall__)) // Clang-only - // ::= T # __attribute__((__swiftasynccall__)) + // ::= W # __attribute__((__swiftasynccall__)) + // ::= U # __attribute__((__preserve_most__)) + // ::= V # __attribute__((__preserve_none__)) // + // Clang-only //// Clang-only // ::= w # __regcall // ::= x # __regcall4 @@ -2986,6 +2989,9 @@ void MicrosoftCXXNameMangler::mangleCallingConvention(CallingConv CC) { case CC_Swift: Out << 'S'; break; case CC_SwiftAsync: Out << 'W'; break; case CC_PreserveMost: Out << 'U'; break; +case CC_PreserveNone: + Out << 'V'; + break; case CC_X86RegCall: if (getASTContext().getLangOpts().RegCall4) Out << "x"; diff --git a/clang/lib/Basic/Targets/AArch64.cpp b/clang/lib/Basic/Targets/AArch64.cpp index 31d8121b91d10..2692ddec26ff4 100644 --- a/clang/lib/Basic/Targets/AArch64.cpp +++ b/clang/lib/Basic/Targets/AArch64.cpp @@ -1536,6 +1536,7 @@ WindowsARM64TargetInfo::checkCallingConvention(CallingConv CC) const { case CC_OpenCLKernel: case CC_PreserveMost: case CC_PreserveAll: + case CC_PreserveNone: case CC_Swift: case CC_SwiftAsync: case CC_Win64: diff --git a/clang/test/CodeGenCXX/msabi-preserve-none-cc.cpp b/clang/test/CodeGenCXX/msabi-preserve-none-cc.cpp new file mode 100644 index 0..29df5e4d84a70 --- /dev/null +++ b/clang/test/CodeGenCXX/msabi-preserve-none-cc.cpp @@ -0,0 +1,28 @@ +// RUN: %clang_cc1 -triple x86_64-unknown-windows-msvc -fdeclspec -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -triple aarch64-unknown-windows-msvc -fdeclspec -emit-llvm %s -o - | FileCheck %s + +void __attribute__((__preserve_none__)) f() {} +// CHECK-DAG: @"?f@@YVXXZ" + +void (__attribute__((__preserve_none__)) *p)(); +// CHECK-DAG: @"?p@@3P6VXXZEA + +namespace { +void __attribute__((__preserve_none__)) __attribute__((__used__)) f() { } +} +// CHECK-DAG: @"?f@?A0x{{[^@]*}}@@YVXXZ" + +namespace n { +void __attribute__((__preserve_none__)) f() {} +} +// CHECK-DAG: @"?f@n@@YVXXZ" + +struct __declspec(dllexport) S { + S(const S &) = delete; + S & operator=(const S &) = delete; + void __attribute__((__preserve_none__)) m() { } +}; +// CHECK-DAG: @"?m@S@@QEAVXXZ" + +void f(void (__attribute__((__preserve_none__))())) {} +// CHECK-DAG: @"?f@@YAXP6VXXZ@Z" diff --git a/clang/test/Sema/preserve-none-call-conv.c b/clang/test/Sema/preserve-none-call-conv.c index 4508095863de5..678fa7d5317e5 100644 --- a/clang/test/Sema/preserve-none-call-conv.c +++ b/clang/test/Sema/preserve-none-call-conv.c @@ -1,4 +1,5 @@ // RUN: %clang_cc1 %s -fsyntax-only -triple x86_64-unknown-unknown -verify +// RUN: %clang_cc1 %s -fsyntax-only -triple aarch64-unknown-unknown -verify typedef void typedef_fun_t(int); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [AArch64] Add ability to list extensions enabled for a target (PR #95805)
@@ -154,17 +156,39 @@ std::optional AArch64::parseCpu(StringRef Name) { return {}; } -void AArch64::PrintSupportedExtensions(StringMap DescMap) { +void AArch64::PrintSupportedExtensions() { outs() << "All available -march extensions for AArch64\n\n" << "" << left_justify("Name", 20) - << (DescMap.empty() ? "\n" : "Description\n"); + << left_justify("Architecture Feature(s)", 55) + << "Description\n"; for (const auto : Extensions) { // Extensions without a feature cannot be used with -march. -if (!Ext.Feature.empty()) { - std::string Description = DescMap[Ext.Name].str(); +if (!Ext.UserVisibleName.empty() && !Ext.PosTargetFeature.empty()) { + outs() << "" + << format(Ext.Description.empty() ? "%-20s%s\n" : "%-20s%-55s%s\n", + Ext.UserVisibleName.str().c_str(), + Ext.ArchFeatureName.str().c_str(), + Ext.Description.str().c_str()); +} + } +} + +void +AArch64::printEnabledExtensions(std::vector EnabledFeatureNames) { + outs() << "Extensions enabled for the given AArch64 target\n\n" + << "" << left_justify("Architecture Feature(s)", 55) + << "Description\n"; + auto IsEnabled = [&](const ExtensionInfo ) { +StringRef FeatureName = Ext.PosTargetFeature.drop_front(); // drop '+' before comparing tmatheson-arm wrote: Can you ever have a negative feature here? https://github.com/llvm/llvm-project/pull/95805 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [AArch64] Add ability to list extensions enabled for a target (PR #95805)
@@ -19,3 +19,17 @@ // RUN: %clang --target=arm64 -mlittle-endian -march=armv8.1a -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-GENERICV81A %s // RUN: %clang --target=arm64 -mlittle-endian -march=armv8.1-a -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-GENERICV81A %s // ARM64-GENERICV81A: "-cc1"{{.*}} "-triple" "arm64{{.*}}" "-target-cpu" "generic"{{.*}} "-target-feature" "+v8.1a"{{.*}} "-target-feature" "+neon" + +// = Architecture extensions = + +// RUN: %clang -target aarch64 -march=armv8.1-a --print-enabled-extensions 2>&1 | sort | FileCheck -check-prefix=ARCH-EXTENSION --implicit-check-not FEAT_ %s tmatheson-arm wrote: I don't think any of the `2>&1` are necessary, because you print to `outs()` (which is good). https://github.com/llvm/llvm-project/pull/95805 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [AArch64] Add ability to list extensions enabled for a target (PR #95805)
@@ -19,3 +19,17 @@ // RUN: %clang --target=arm64 -mlittle-endian -march=armv8.1a -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-GENERICV81A %s // RUN: %clang --target=arm64 -mlittle-endian -march=armv8.1-a -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-GENERICV81A %s // ARM64-GENERICV81A: "-cc1"{{.*}} "-triple" "arm64{{.*}}" "-target-cpu" "generic"{{.*}} "-target-feature" "+v8.1a"{{.*}} "-target-feature" "+neon" + +// = Architecture extensions = + +// RUN: %clang -target aarch64 -march=armv8.1-a --print-enabled-extensions 2>&1 | sort | FileCheck -check-prefix=ARCH-EXTENSION --implicit-check-not FEAT_ %s tmatheson-arm wrote: Why not sort the extensions in the actual output, rather than just in the test? Currently they are not in any particular order, which will make reading the output difficult when there are a lot. https://github.com/llvm/llvm-project/pull/95805 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [AArch64] Add ability to list extensions enabled for a target (PR #95805)
@@ -14,23 +14,36 @@ class Extension< tmatheson-arm wrote: The comment needs updating, something like: > A SubtargetFeature that represents one or more Architecture Extensions, as > defined in the Arm ARM and typically named `FEAT_*`. Each has an `AEK_*` > entry in the ArmExtKind enum. https://github.com/llvm/llvm-project/pull/95805 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [AArch64] Add ability to list extensions enabled for a target (PR #95805)
@@ -161,6 +162,39 @@ static int PrintSupportedExtensions(std::string TargetStr) { return 0; } +static int PrintEnabledExtensions(const TargetOptions& TargetOpts) { + std::string Error; + const llvm::Target *TheTarget = + llvm::TargetRegistry::lookupTarget(TargetOpts.Triple, Error); + if (!TheTarget) { +llvm::errs() << Error; +return 1; + } + + llvm::TargetOptions BackendOptions; tmatheson-arm wrote: What is the difference between this and `TargetOpts`? This section maybe needs a comment explaining what is going on. https://github.com/llvm/llvm-project/pull/95805 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [AArch64] Add ability to list extensions enabled for a target (PR #95805)
@@ -116,12 +116,18 @@ using ExtensionBitset = Bitset; // SubtargetFeature which may represent either an actual extension or some // internal LLVM property. struct ExtensionInfo { - StringRef Name; // Human readable name, e.g. "profile". + StringRef UserVisibleName; // Human readable name used in -march, -cpu tmatheson-arm wrote: Please could you make the names here consistent with tablegen, i.e. either pick `UserVisibleName` or `MArchName`. https://github.com/llvm/llvm-project/pull/95805 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [AArch64] Add ability to list extensions enabled for a target (PR #95805)
@@ -154,17 +156,39 @@ std::optional AArch64::parseCpu(StringRef Name) { return {}; } -void AArch64::PrintSupportedExtensions(StringMap DescMap) { +void AArch64::PrintSupportedExtensions() { outs() << "All available -march extensions for AArch64\n\n" << "" << left_justify("Name", 20) - << (DescMap.empty() ? "\n" : "Description\n"); + << left_justify("Architecture Feature(s)", 55) + << "Description\n"; for (const auto : Extensions) { // Extensions without a feature cannot be used with -march. -if (!Ext.Feature.empty()) { - std::string Description = DescMap[Ext.Name].str(); +if (!Ext.UserVisibleName.empty() && !Ext.PosTargetFeature.empty()) { + outs() << "" + << format(Ext.Description.empty() ? "%-20s%s\n" : "%-20s%-55s%s\n", + Ext.UserVisibleName.str().c_str(), + Ext.ArchFeatureName.str().c_str(), + Ext.Description.str().c_str()); +} + } +} + +void +AArch64::printEnabledExtensions(std::vector EnabledFeatureNames) { + outs() << "Extensions enabled for the given AArch64 target\n\n" + << "" << left_justify("Architecture Feature(s)", 55) + << "Description\n"; + auto IsEnabled = [&](const ExtensionInfo ) { +StringRef FeatureName = Ext.PosTargetFeature.drop_front(); // drop '+' before comparing +return std::find(EnabledFeatureNames.begin(), EnabledFeatureNames.end(), + FeatureName) != EnabledFeatureNames.end(); tmatheson-arm wrote: Can you use `targetFeatureToExtension` here, to avoid the double loop? https://github.com/llvm/llvm-project/pull/95805 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [AArch64] Add ability to list extensions enabled for a target (PR #95805)
@@ -1841,7 +1868,8 @@ INSTANTIATE_TEST_SUITE_P( AArch64::AEK_PROFILE, AArch64::AEK_RAND, AArch64::AEK_FP16FML, AArch64::AEK_I8MM, AArch64::AEK_JSCVT, AArch64::AEK_FCMA, - AArch64::AEK_PAUTH, AArch64::AEK_PERFMON}), + AArch64::AEK_PAUTH, AArch64::AEK_PERFMON, + AArch64::AEK_CCDP}), tmatheson-arm wrote: We should think about whether we want each AEK to correspond to a `-march` modifier (status quo) or whether we want it to correspond to an `Extension` like here. https://github.com/llvm/llvm-project/pull/95805 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [AArch64] Add ability to list extensions enabled for a target (PR #95805)
https://github.com/tmatheson-arm commented: LGTM, just some minor suggestions/clarifications. https://github.com/llvm/llvm-project/pull/95805 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [AArch64] Add ability to list extensions enabled for a target (PR #95805)
@@ -14,23 +14,36 @@ class Extension< string TargetFeatureName,// String used for -target-feature and -march, unless overridden. string Spelling, // The XYZ in HasXYZ and AEK_XYZ. + string ArchitectureFeatureName, // The extension's "FEAT_*"" name(s) defined by the architecture string Desc, // Description. list Implies = [] // List of dependent features. > : SubtargetFeature Implies> { string ArchExtKindSpelling = "AEK_" # Spelling; // ArchExtKind enum name. -// In general, the name written on the command line should match the name -// used for -target-feature. However, there are exceptions. Therefore we -// add a separate field for this, to allow overriding it. Strongly prefer -// not doing so. -string MArchName = TargetFeatureName; +string ArchFeatureName = ArchitectureFeatureName; + +// By default, extensions are available as -march/-cpu command line options. +string MArchName = ""; // An alias that can be used on the command line, if the extension has one. // Used for correcting historical names while remaining backwards compatible. string MArchAlias = ""; } +class ExtensionWithMArch< tmatheson-arm wrote: ```suggestion // An Extension that can be enabled via a `-march` modifier or target attribute, e.g. `+sm4` class ExtensionWithMArch< ``` https://github.com/llvm/llvm-project/pull/95805 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [AArch64] Add ability to list extensions enabled for a target (PR #95805)
@@ -161,6 +162,39 @@ static int PrintSupportedExtensions(std::string TargetStr) { return 0; } +static int PrintEnabledExtensions(const TargetOptions& TargetOpts) { + std::string Error; + const llvm::Target *TheTarget = + llvm::TargetRegistry::lookupTarget(TargetOpts.Triple, Error); + if (!TheTarget) { +llvm::errs() << Error; +return 1; + } + + llvm::TargetOptions BackendOptions; + std::string FeaturesStr = llvm::join(TargetOpts.FeaturesAsWritten, ","); + std::unique_ptr TheTargetMachine( + TheTarget->createTargetMachine(TargetOpts.Triple, TargetOpts.CPU, FeaturesStr, BackendOptions, std::nullopt)); + const llvm::Triple = TheTargetMachine->getTargetTriple(); + const llvm::MCSubtargetInfo *MCInfo = TheTargetMachine->getMCSubtargetInfo(); + const std::vector Features = +MCInfo->getEnabledProcessorFeatures(); + + std::vector EnabledFeatureNames; + for (const llvm::SubtargetFeatureKV : Features) +EnabledFeatureNames.push_back(feature.Key); tmatheson-arm wrote: Maybe we shouldn't throw away the type information in `llvm::SubtargetFeatureKV` before `printEnabledExtensions`. It is not clear what `EnabledFeatureNames` contains, since it is just a vector of strings. i.e. are they internal names, extension names, subtarget feature names, etc. https://github.com/llvm/llvm-project/pull/95805 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [AArch64] Add ability to list extensions enabled for a target (PR #95805)
https://github.com/tmatheson-arm edited https://github.com/llvm/llvm-project/pull/95805 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 3ff680a - [C11] Claim we do not conform to WG14 N1285 yet
Author: Aaron Ballman Date: 2024-06-24T09:50:37-04:00 New Revision: 3ff680a1a57d74a5c94d3da35594a8046a879888 URL: https://github.com/llvm/llvm-project/commit/3ff680a1a57d74a5c94d3da35594a8046a879888 DIFF: https://github.com/llvm/llvm-project/commit/3ff680a1a57d74a5c94d3da35594a8046a879888.diff LOG: [C11] Claim we do not conform to WG14 N1285 yet This also updates the status for C11 to be Partial, and because C17 is C11 plus DR resolutions, that makes C17 also Partial. Added: clang/test/C/C11/n1285.c Modified: clang/www/c_status.html Removed: diff --git a/clang/test/C/C11/n1285.c b/clang/test/C/C11/n1285.c new file mode 100644 index 0..e7a9463e68103 --- /dev/null +++ b/clang/test/C/C11/n1285.c @@ -0,0 +1,24 @@ +// RUN: %clang_cc1 -verify=wrong -std=c99 %s +// RUN: %clang_cc1 -verify=wrong -std=c11 %s +// RUN: %clang_cc1 -verify=cpp -std=c++11 -x c++ %s + +/* WG14 N1285: No + * Extending the lifetime of temporary objects (factored approach) + * + * NB: we do not properly materialize temporary expressions in situations where + * it would be expected; that is why the "no-diagnostics" marking is named + * "wrong". We do issue the expected diagnostic in C++ mode. + */ + +// wrong-no-diagnostics + +struct X { int a[5]; }; +struct X f(void); + +int foo(void) { + // FIXME: This diagnostic should be issued in C11 as well (though not in C99, + // as this paper was a breaking change between C99 and C11). + int *p = f().a; // cpp-warning {{temporary whose address is used as value of local variable 'p' will be destroyed at the end of the full-expression}} + return *p; +} + diff --git a/clang/www/c_status.html b/clang/www/c_status.html index d71d4c216f744..922a84ca34312 100644 --- a/clang/www/c_status.html +++ b/clang/www/c_status.html @@ -57,12 +57,12 @@ C Support in Clang C11 -std=c11 - Probably + Partial C17 -std=c17 - Maybe? + Partial C23 @@ -425,7 +425,7 @@ C11 implementation status Extending the lifetime of temporary objects (factored approach) https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1285.htm;>N1285 - Unknown + No Requiring signed char to have no padding bits ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] Improve diagnostics for constraints of inline asm (NFC) (PR #96363)
@@ -2626,14 +2629,20 @@ void CodeGenFunction::EmitAsmStmt(const AsmStmt ) { SmallVector OutputConstraintInfos; SmallVector InputConstraintInfos; + const FunctionDecl *FD = dyn_cast_or_null(CurCodeDecl); Sirraide wrote: > do we want an RFC to decide on which one to remove I could look into that if that would help. https://github.com/llvm/llvm-project/pull/96363 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] Improve diagnostics for constraints of inline asm (NFC) (PR #96363)
@@ -2626,14 +2629,20 @@ void CodeGenFunction::EmitAsmStmt(const AsmStmt ) { SmallVector OutputConstraintInfos; SmallVector InputConstraintInfos; + const FunctionDecl *FD = dyn_cast_or_null(CurCodeDecl); Sirraide wrote: Yeah, I agree it seems weird to keep both around, and just outright removing one of them shouldn’t be too disruptive imo considering that it’s a fairly straight-forward change; I don’t know the history behind this too well, but do we want an RFC to decide on which one to remove, or is there already a clear favourite? For what it’s worth, we currently have (at least according to grep, however accurate that may be) around 7900 occurrences of calls to functions ending with`cast_or_null` and around 530 ending with `cast_if_present` in the entire codebase. https://github.com/llvm/llvm-project/pull/96363 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] Improve diagnostics for constraints of inline asm (NFC) (PR #96363)
@@ -2626,14 +2629,20 @@ void CodeGenFunction::EmitAsmStmt(const AsmStmt ) { SmallVector OutputConstraintInfos; SmallVector InputConstraintInfos; + const FunctionDecl *FD = dyn_cast_or_null(CurCodeDecl); arsenm wrote: I think we should just get rid of dyn_cast_if_present then: https://discourse.llvm.org/t/psa-swapping-out-or-null-with-if-present/65018/12 https://github.com/llvm/llvm-project/pull/96363 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][ThreadSafety] Check trylock function success and return types (PR #95290)
github-actions[bot] wrote: @dmcardle Congratulations on having your first Pull Request (PR) merged into the LLVM Project! Your changes will be combined with recent changes from other authors, then tested by our [build bots](https://lab.llvm.org/buildbot/). If there is a problem with a build, you may receive a report in an email or a comment on this PR. Please check whether problems have been caused by your change specifically, as the builds can include changes from many authors. It is not uncommon for your change to be included in a build that fails due to someone else's changes, or infrastructure issues. How to do this, and the rest of the post-merge process, is covered in detail [here](https://llvm.org/docs/MyFirstTypoFix.html#myfirsttypofix-issues-after-landing-your-pr). If your change does cause a problem, it may be reverted, or you can revert it yourself. This is a normal part of [LLVM development](https://llvm.org/docs/DeveloperPolicy.html#patch-reversion-policy). You can fix your changes and open a new PR to merge them again. If you don't get any reports, no action is required from you. Your changes are working as expected, well done! https://github.com/llvm/llvm-project/pull/95290 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][ThreadSafety] Check trylock function success and return types (PR #95290)
https://github.com/AaronBallman closed https://github.com/llvm/llvm-project/pull/95290 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] c1bde0a - [clang][ThreadSafety] Check trylock function success and return types (#95290)
Author: Dan McArdle Date: 2024-06-24T09:29:13-04:00 New Revision: c1bde0a2cb640b3607e9568b9a57b292e1f82666 URL: https://github.com/llvm/llvm-project/commit/c1bde0a2cb640b3607e9568b9a57b292e1f82666 DIFF: https://github.com/llvm/llvm-project/commit/c1bde0a2cb640b3607e9568b9a57b292e1f82666.diff LOG: [clang][ThreadSafety] Check trylock function success and return types (#95290) With this change, Clang will generate errors when trylock functions have improper return types. Today, it silently fails to apply the trylock attribute to these functions which may incorrectly lead users to believe they have correctly acquired locks before accessing guarded data. As a side effect of explicitly checking the success argument type, I seem to have fixed a false negative in the analysis that could occur when a trylock's success argument is an enumerator. I've added a regression test to warn-thread-safety-analysis.cpp named `TrylockSuccessEnumFalseNegative`. This change also improves the documentation with descriptions of of the subtle gotchas that arise from the analysis interpreting the success arg as a boolean. Issue #92408 Added: Modified: clang/docs/ReleaseNotes.rst clang/docs/ThreadSafetyAnalysis.rst clang/include/clang/Basic/DiagnosticSemaKinds.td clang/include/clang/Sema/ParsedAttr.h clang/lib/Analysis/ThreadSafety.cpp clang/lib/Sema/SemaDeclAttr.cpp clang/test/Sema/attr-capabilities.c clang/test/SemaCXX/warn-thread-safety-analysis.cpp clang/test/SemaCXX/warn-thread-safety-parsing.cpp clang/unittests/AST/ASTImporterTest.cpp Removed: diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 136c72cf682a9..df579ae398c5e 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -71,6 +71,11 @@ C++ Specific Potentially Breaking Changes To fix this, update libstdc++ to version 14.1.1 or greater. +- Clang now emits errors when Thread Safety Analysis trylock attributes are + applied to functions or methods with incompatible return values, such as + constructors, destructors, and void-returning functions. This only affects the + ``TRY_ACQUIRE`` and ``TRY_ACQUIRE_SHARED`` attributes (and any synonyms). + ABI Changes in This Version --- - Fixed Microsoft name mangling of implicitly defined variables used for thread @@ -729,6 +734,11 @@ Bug Fixes in This Version - Fixed `static_cast` to array of unknown bound. Fixes (#GH62863). +- Clang's Thread Safety Analysis now evaluates trylock success arguments of enum + types rather than silently defaulting to false. This fixes a class of false + negatives where the analysis failed to detect unchecked access to guarded + data. + Bug Fixes to Compiler Builtins ^^ diff --git a/clang/docs/ThreadSafetyAnalysis.rst b/clang/docs/ThreadSafetyAnalysis.rst index dcde0c706c704..0ecbebe7a692f 100644 --- a/clang/docs/ThreadSafetyAnalysis.rst +++ b/clang/docs/ThreadSafetyAnalysis.rst @@ -420,10 +420,17 @@ TRY_ACQUIRE(, ...), TRY_ACQUIRE_SHARED(, ...) *Previously:* ``EXCLUSIVE_TRYLOCK_FUNCTION``, ``SHARED_TRYLOCK_FUNCTION`` These are attributes on a function or method that tries to acquire the given -capability, and returns a boolean value indicating success or failure. -The first argument must be ``true`` or ``false``, to specify which return value -indicates success, and the remaining arguments are interpreted in the same way -as ``ACQUIRE``. See :ref:`mutexheader`, below, for example uses. +capability, and returns a boolean, integer, or pointer value indicating success +or failure. + +The attribute's first argument defines whether a zero or non-zero return value +indicates success. Syntactically, it accepts ``NULL`` or ``nullptr``, ``bool`` +and ``int`` literals, as well as enumerator values. *The analysis only cares +whether this success value is zero or non-zero.* This leads to some subtle +consequences, discussed in the next section. + +The remaining arguments are interpreted in the same way as ``ACQUIRE``. See +:ref:`mutexheader`, below, for example uses. Because the analysis doesn't support conditional locking, a capability is treated as acquired after the first branch on the return value of a try-acquire @@ -445,6 +452,43 @@ function. } } +Subtle Consequences of Non-Boolean Success Values +^ + +The trylock attributes accept non-boolean expressions for the success value, but +the analysis only cares whether the value is zero or non-zero. + +Suppose you define an enum with two non-zero enumerators: ``LockAcquired = 1`` +and ``LockNotAcquired = 2``. If your trylock function returns ``LockAcquired`` +on success and ``LockNotAcquired`` on failure, the analysis may fail to detect +access to guarded data without holding the mutex because they are both non-zero. +
[clang] [clang][ThreadSafety] Check trylock function success and return types (PR #95290)
https://github.com/AaronBallman approved this pull request. LGTM still https://github.com/llvm/llvm-project/pull/95290 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][Sema] Fix crash on atomic builtins with incomplete type args (PR #96374)
@@ -4570,7 +4570,8 @@ ExprResult Sema::BuildAtomicExpr(SourceRange CallRange, SourceRange ExprRange, } // Pointer to object of size zero is not allowed. - if (Context.getTypeInfoInChars(AtomTy).Width.isZero()) { + if (!AtomTy->isIncompleteType() && AaronBallman wrote: If you call `RequireCompleteType()` before this `if` instead of checking for an incomplete type, do you get better diagnostic behavior? https://github.com/llvm/llvm-project/pull/96374 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][Sema] Fix crash on atomic builtins with incomplete type args (PR #96374)
https://github.com/AaronBallman commented: Thank you for the fix! The changes should also come with a release note in `clang/docs/ReleaseNotes.rst` so users know about the improvement. https://github.com/llvm/llvm-project/pull/96374 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][Sema] Fix crash on atomic builtins with incomplete type args (PR #96374)
https://github.com/AaronBallman edited https://github.com/llvm/llvm-project/pull/96374 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] Improve diagnostics for constraints of inline asm (NFC) (PR #96363)
@@ -2626,14 +2629,20 @@ void CodeGenFunction::EmitAsmStmt(const AsmStmt ) { SmallVector OutputConstraintInfos; SmallVector InputConstraintInfos; + const FunctionDecl *FD = dyn_cast_or_null(CurCodeDecl); Sirraide wrote: > Where do you get dyn_cast_or_null is deprecated? Mainly from here (as well as other places in `Casting.h`): https://github.com/llvm/llvm-project/blob/5cd0ba30f53d11835dbfd05ad4071d397387fb04/llvm/include/llvm/Support/Casting.h#L756-L769 https://github.com/llvm/llvm-project/pull/96363 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] Improve diagnostics for constraints of inline asm (NFC) (PR #96363)
https://github.com/arsenm commented: It's really unfortunate to have to add all this asm handling to clang. Can't it rely on backend diagnostic remarks for this? https://github.com/llvm/llvm-project/pull/96363 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] Improve diagnostics for constraints of inline asm (NFC) (PR #96363)
@@ -2626,14 +2629,20 @@ void CodeGenFunction::EmitAsmStmt(const AsmStmt ) { SmallVector OutputConstraintInfos; SmallVector InputConstraintInfos; + const FunctionDecl *FD = dyn_cast_or_null(CurCodeDecl); arsenm wrote: Where do you get dyn_cast_or_null is deprecated? I only remember a rejected RFC to start using dyn_cast_if_present https://github.com/llvm/llvm-project/pull/96363 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] nonblocking/nonallocating attributes (was: nolock/noalloc) (PR #84983)
AaronBallman wrote: > Given that this is for a clang extension and not a conformance issue, I'm > inclined to revert. > > It might make sense to do that, yeah. Either way, we should investigate > what’s going on here. @AaronBallman wdyt? Definitely worth investigating, unsure whether this is sufficiently disruptive to warrant a revert as opposed to a fix forward. I don't oppose a revert if @nikic would like to see one, but I realize now that we have no wording in our revert policy regarding incremental compile time performance regressions (if it was a huge regression, I think it falls under correctness, but this is a relatively small change in performance and no bots are red as a result either). So if we think this warrants a revert, should we consider updating the policy to more clearly state when to revert for performance reasons? https://github.com/llvm/llvm-project/pull/84983 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] nonblocking/nonallocating attributes (was: nolock/noalloc) (PR #84983)
Sirraide wrote: > I was not expecting that. Hmm, I wonder what’s causing this. I’m probably just stating the obvious here, but seeing as existing code obviously does not make use of effects, for compiling it to become slower, that means that we’re probably unconditionally executing code somewhere irrespective of whether effects are present or not, so what I’m saying is we should probably investigate any places where this pr checks for the presence of effects and does something based on that and move the checks for whether a function even has effects attached to it as far up as possible and try and also optimise that check (is the function that checks for that defined in a header? If not, we should maybe move the definition there so it can be inlined). The only other option I can think of is that this adds some more data to `FunctionProtoType`s, which means we allocate more etc. but that alone shouldn’t have this big of an impact I’m assuming? https://github.com/llvm/llvm-project/pull/84983 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] [clang-tidy] add option to avoid "no checks enabled" error (PR #96122)
https://github.com/HerrCai0907 updated https://github.com/llvm/llvm-project/pull/96122 >From 41993ea6903668c41eef8a4477f5914c894f7109 Mon Sep 17 00:00:00 2001 From: Congcong Cai Date: Wed, 19 Jun 2024 23:20:09 + Subject: [PATCH 1/8] [clang-tidy] add option to avoid "no checks enabled" error When clang-tidy get an empty checks, it will throw "no checks enabled" error and exit with non-zero return value. It make clang-tidy's wrapper program confused when in big project some files don't want to be checked and use `-checks=-*` to disable all checks. --- clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp | 12 ++-- clang-tools-extra/docs/ReleaseNotes.rst | 3 +++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp b/clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp index 7388f20ef288e..b579aff4394c9 100644 --- a/clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp +++ b/clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp @@ -325,6 +325,14 @@ option is recognized. )"), cl::init(false), cl::cat(ClangTidyCategory)); +static cl::opt AllowEmptyCheckList("allow-empty-checks", desc(R"( +Allow empty enabled checks. This suppresses +the "no checks enabled" error when disabling +all of the checks. +)"), + cl::init(false), + cl::cat(ClangTidyCategory)); + namespace clang::tidy { static void printStats(const ClangTidyStats ) { @@ -598,7 +606,7 @@ int clangTidyMain(int argc, const char **argv) { } if (ListChecks) { -if (EnabledChecks.empty()) { +if (EnabledChecks.empty() && !AllowEmptyCheckList) { llvm::errs() << "No checks enabled.\n"; return 1; } @@ -651,7 +659,7 @@ int clangTidyMain(int argc, const char **argv) { return 0; } - if (EnabledChecks.empty()) { + if (EnabledChecks.empty() && !AllowEmptyCheckList) { llvm::errs() << "Error: no checks enabled.\n"; llvm::cl::PrintHelpMessage(/*Hidden=*/false, /*Categorized=*/true); return 1; diff --git a/clang-tools-extra/docs/ReleaseNotes.rst b/clang-tools-extra/docs/ReleaseNotes.rst index 3bdd735f7dcf7..54cfcafd121b6 100644 --- a/clang-tools-extra/docs/ReleaseNotes.rst +++ b/clang-tools-extra/docs/ReleaseNotes.rst @@ -125,6 +125,9 @@ Improvements to clang-tidy - Added argument `--exclude-header-filter` and config option `ExcludeHeaderFilterRegex` to exclude headers from analysis via a RegEx. +- Added argument `--allow-empty-checks` and config option `AllowEmptyCheckList` + to suppress "no checks enabled" error when disabling all of the checks. + New checks ^^ >From 9302feee8fa9d19711ad2126dddbd73c044502b0 Mon Sep 17 00:00:00 2001 From: Congcong Cai Date: Thu, 20 Jun 2024 17:58:10 +0800 Subject: [PATCH 2/8] fix acc comment --- clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp | 6 +++--- clang-tools-extra/docs/ReleaseNotes.rst | 4 ++-- clang-tools-extra/docs/clang-tidy/index.rst | 3 +++ 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp b/clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp index b579aff4394c9..1475816827ac4 100644 --- a/clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp +++ b/clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp @@ -325,7 +325,7 @@ option is recognized. )"), cl::init(false), cl::cat(ClangTidyCategory)); -static cl::opt AllowEmptyCheckList("allow-empty-checks", desc(R"( +static cl::opt AllowNoChecks("allow-no-checks", desc(R"( Allow empty enabled checks. This suppresses the "no checks enabled" error when disabling all of the checks. @@ -606,7 +606,7 @@ int clangTidyMain(int argc, const char **argv) { } if (ListChecks) { -if (EnabledChecks.empty() && !AllowEmptyCheckList) { +if (EnabledChecks.empty() && !AllowNoChecks) { llvm::errs() << "No checks enabled.\n"; return 1; } @@ -659,7 +659,7 @@ int clangTidyMain(int argc, const char **argv) { return 0; } - if (EnabledChecks.empty() && !AllowEmptyCheckList) { + if (EnabledChecks.empty() && !AllowNoChecks) { llvm::errs() << "Error: no checks enabled.\n"; llvm::cl::PrintHelpMessage(/*Hidden=*/false, /*Categorized=*/true); return 1; diff --git a/clang-tools-extra/docs/ReleaseNotes.rst b/clang-tools-extra/docs/ReleaseNotes.rst index 54cfcafd121b6..e9a9cd47e9215 100644 --- a/clang-tools-extra/docs/ReleaseNotes.rst +++ b/clang-tools-extra/docs/ReleaseNotes.rst @@ -125,8 +125,8 @@ Improvements to clang-tidy - Added argument `--exclude-header-filter` and config option `ExcludeHeaderFilterRegex` to exclude headers from analysis via a RegEx. -- Added argument `--allow-empty-checks` and config option `AllowEmptyCheckList` - to suppress "no checks enabled" error when disabling all of the checks. +- Added argument
[clang] nonblocking/nonallocating attributes (was: nolock/noalloc) (PR #84983)
Sirraide wrote: > This change has some compile-time impact I was not expecting that. Hmm, I wonder what’s causing this. > Given that this is for a clang extension and not a conformance issue, I'm > inclined to revert. It might make sense to do that, yeah. Either way, we should investigate what’s going on here. @AaronBallman wdyt? https://github.com/llvm/llvm-project/pull/84983 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits