[clang] Add -static-libasan alias for -static-libsan. (PR #98194)

2024-07-10 Thread Vitaly Buka via cfe-commits

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


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


[clang] [compiler-rt] [safestack] Various Solaris fixes (PR #98001)

2024-07-09 Thread Vitaly Buka via cfe-commits

vitalybuka wrote:

They look quite independent. 
Would be possible to split independent fixed into a separate patches?

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


[clang] [msan] Precommit MSan Arm NEON vst tests (PR #98247)

2024-07-09 Thread Vitaly Buka via cfe-commits

https://github.com/vitalybuka requested changes to this pull request.

Discussed offline, it should be IR tests

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


[clang] [compiler-rt] [compiler-rt] Realtime Sanitizer: Introduce Realtime Sanitizer (RTSan) backend (PR #92460)

2024-07-09 Thread Vitaly Buka via cfe-commits

vitalybuka wrote:

I can reproduce and will debug in an hour.

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


[clang] [compiler-rt] [compiler-rt] Realtime Sanitizer: Introduce Realtime Sanitizer (RTSan) backend (PR #92460)

2024-07-09 Thread Vitaly Buka via cfe-commits


@@ -0,0 +1,516 @@
+//===--- rtsan_test_interceptors.cpp - Realtime Sanitizer ---*- C++ 
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//

vitalybuka wrote:

> Should we have a lit test for every intereceptor? 

I don't have strong preference. For other sanitizer default interceptor 
behavior is to crash, so we usually create a test per interceptor.

> The reason we did it in gtest unit tests is that adding a new interceptor's 
> test is a few lines, as opposed to a brand new file with the lit boilerplate. 
> This makes it easy to make sure that every interceptor does what we think it 
> does. We worried about the "cost" of the new file for every interceptor. In 
> our demo branch, as we have it laid out, the lit tests test on the full 
> end-to-end system level, while these tests actually hit every interceptor.

Yes, boilerplate of LIT is not nice. So there is a trade off. I guess you can 
wait and see.


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


[clang] [compiler-rt] [compiler-rt] Realtime Sanitizer: Introduce Realtime Sanitizer (RTSan) backend (PR #92460)

2024-07-09 Thread Vitaly Buka via cfe-commits

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


[clang] [compiler-rt] [compiler-rt] Realtime Sanitizer: Introduce Realtime Sanitizer (RTSan) backend (PR #92460)

2024-07-09 Thread Vitaly Buka via cfe-commits

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


[clang] [compiler-rt] [compiler-rt] Realtime Sanitizer: Introduce Realtime Sanitizer (RTSan) backend (PR #92460)

2024-07-09 Thread Vitaly Buka via cfe-commits

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


[clang] [compiler-rt] [compiler-rt] Realtime Sanitizer: Introduce Realtime Sanitizer (RTSan) backend (PR #92460)

2024-07-08 Thread Vitaly Buka via cfe-commits

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

LGTM. but I suggest to rework test into LIT, before or either commit.

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


[clang] [compiler-rt] [compiler-rt] Realtime Sanitizer: Introduce Realtime Sanitizer (RTSan) backend (PR #92460)

2024-07-08 Thread Vitaly Buka via cfe-commits


@@ -0,0 +1,516 @@
+//===--- rtsan_test_interceptors.cpp - Realtime Sanitizer ---*- C++ 
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//

vitalybuka wrote:

Actually even TestRtsan mostly can be done as LIT

BTW. Why I don't like GTEST in LLVM?

LIT is easier to reproduce and experiment and debug than with a particular test 
case of.

Also I don't trust incremental builds with GTEST, some times I am not sure that 
my changes are used in tests.

A couple of time CMakes bugs caused compiler-rt GTEST not executed on bots and 
it was unnoticed for a long time. LIT is majority, so unlikely it could happen 
with them.


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


[clang] [compiler-rt] [compiler-rt] Realtime Sanitizer: Introduce Realtime Sanitizer (RTSan) backend (PR #92460)

2024-07-08 Thread Vitaly Buka via cfe-commits


@@ -0,0 +1,516 @@
+//===--- rtsan_test_interceptors.cpp - Realtime Sanitizer ---*- C++ 
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//

vitalybuka wrote:

In my experience LIT tests in are easier to maintain in LLVM environment

`TEST(TestRtsan,` are internals test, so probably fine to keep as GTEST

However `TEST(TestRtsanInterceptors` are likely better as regular LIT tests


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


[clang] [compiler-rt] [compiler-rt] Realtime Sanitizer: Introduce Realtime Sanitizer (RTSan) backend (PR #92460)

2024-07-08 Thread Vitaly Buka via cfe-commits


@@ -67,3 +67,7 @@ D: ThreadSanitizer
 N: Bill Wendling
 E: isanb...@gmail.com
 D: Profile runtime library
+

vitalybuka wrote:

BTW @alexander-shaposhnikov NSAN is missing from here.

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


[clang] [Clang][Sema] Add a test for move ctor calling for a base class. NFC (PR #97164)

2024-07-01 Thread Vitaly Buka via cfe-commits

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


[clang] [Clang][Sema] Add a test for move ctor calling for a base class. NFC (PR #97164)

2024-07-01 Thread Vitaly Buka via cfe-commits


@@ -0,0 +1,43 @@
+// RUN: %clang_cc1 -ast-dump -fblocks %s | FileCheck -strict-whitespace %s

vitalybuka wrote:

I was thinking about utils/update_cc_test_checks.py
But this is AST test

Maybe llvm-project/clang/test/AST/gen_ast_dump_json_test.py

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


[clang] [Clang][Sema] Add a test for move ctor calling for a base class. NFC (PR #97164)

2024-07-01 Thread Vitaly Buka via cfe-commits


@@ -0,0 +1,43 @@
+// RUN: %clang_cc1 -ast-dump -fblocks %s | FileCheck -strict-whitespace %s

vitalybuka wrote:

can this test be autogenerated?

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


[clang] [Clang] Enable nsan instrumentation pass (PR #97359)

2024-07-01 Thread Vitaly Buka via cfe-commits

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


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


[clang] [Clang] Enable nsan instrumentation pass (PR #97359)

2024-07-01 Thread Vitaly Buka via cfe-commits


@@ -707,6 +708,9 @@ static void addSanitizers(const Triple ,
   MPM.addPass(createModuleToFunctionPassAdaptor(ThreadSanitizerPass()));
 }
 
+if (LangOpts.Sanitize.has(SanitizerKind::NumericalStability))
+  MPM.addPass(NumericalStabilitySanitizerPass());

vitalybuka wrote:

you may want late to introduce post-instrumentations as on line 693 of msan

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


[clang] [clang-format] Add option to remove leading blank lines (PR #91221)

2024-06-25 Thread Vitaly Buka via cfe-commits

vitalybuka wrote:

@sstwcw Please don't ignore the presubmit, it detected issue before merging:

Some checks were not successful
2 skipped, 65 successful, 48 failing, and 3 pending checks

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


[clang] [Clang][Sanitizers] Enable NSAN on Linux only (PR #96120)

2024-06-20 Thread Vitaly Buka via cfe-commits

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


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


[clang] [Clang][Sanitizers] Enable NSAN on X86_64 only (PR #95885)

2024-06-18 Thread Vitaly Buka via cfe-commits

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


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


[clang] [clang-tools-extra] Revert "✨ [Sema, Lex, Parse] Preprocessor embed in C and C++ (and Obj-C and Obj-C++ by-proxy)" (PR #95299)

2024-06-12 Thread Vitaly Buka via cfe-commits

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


[clang] [clang-tools-extra] Revert "✨ [Sema, Lex, Parse] Preprocessor embed in C and C++ (and Obj-C and Obj-C++ by-proxy)" (PR #95299)

2024-06-12 Thread Vitaly Buka via cfe-commits

vitalybuka wrote:

I guess I will proceed with revert, I don't know meaning that failed assert in 
the test, and expected ownership of EmbedAnnotationData is not clear to me.

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


[clang] [clang-tools-extra] Revert "✨ [Sema, Lex, Parse] Preprocessor embed in C and C++ (and Obj-C and Obj-C++ by-proxy)" (PR #95299)

2024-06-12 Thread Vitaly Buka via cfe-commits

vitalybuka wrote:

The patch is large, so I'll take another look, if there is a trivial fix.
So please approve without merging.

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


[clang] [clang-repl] Lay the foundation of pretty printing for C. (PR #89811)

2024-06-06 Thread Vitaly Buka via cfe-commits

vitalybuka wrote:

Actually I will try myself, as I have access to the bot.

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


[clang] [clang-repl] Lay the foundation of pretty printing for C. (PR #89811)

2024-06-06 Thread Vitaly Buka via cfe-commits

vitalybuka wrote:

Try `// UNSUPPORTED: hwasan`

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


[clang] [clang-repl] Lay the foundation of pretty printing for C. (PR #89811)

2024-06-06 Thread Vitaly Buka via cfe-commits

vitalybuka wrote:

> @vitalybuka could it be a ccache glitch?

Technically can, but I would not count on hash collision :)
Also there are two machines running same config consistently fail.



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


[clang] [clang-repl] Lay the foundation of pretty printing for C. (PR #89811)

2024-06-06 Thread Vitaly Buka via cfe-commits

vitalybuka wrote:

Not sure, nothing in cmake cmd:

```
cmake -DLLVM_APPEND_VC_REV=OFF -GNinja -DCMAKE_BUILD_TYPE=Release 
-DLLVM_CCACHE_BUILD=ON -DLLVM_USE_LINKER=lld -DLLVM_ENABLE_ASSERTIONS=ON 
-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF 
-DCMAKE_C_COMPILER=/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build0/bin/clang
 
-DCMAKE_CXX_COMPILER=/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build0/bin/clang++
 -DLLVM_ENABLE_PLUGINS=OFF '-DLLVM_ENABLE_PROJECTS='\''clang;lld;mlir'\''' 
-DLLVM_USE_SANITIZER=HWAddress -DLLVM_ENABLE_LIBCXX=ON 
'-DCMAKE_C_FLAGS=-nostdinc++ -isystem 
/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/include 
-isystem 
/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/include/c++/v1
 -fsanitize=hwaddress -mllvm -hwasan-use-after-scope=1 
-Wl,--rpath=/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/lib
 -L/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/lib 
-w' '-DCMAKE_CXX_FLAGS=-nostdinc++ -isystem 
/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/include 
-isystem 
/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/include/c++/v1
 -fsanitize=hwaddress -mllvm -hwasan-use-after-scope=1 
-Wl,--rpath=/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/lib
 -L/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/lib 
-w' 
'-DCMAKE_EXE_LINKER_FLAGS=-Wl,--rpath=/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/lib
 -L/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/lib' 
/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm
```

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


[clang] [clang-repl] Lay the foundation of pretty printing for C. (PR #89811)

2024-06-06 Thread Vitaly Buka via cfe-commits

vitalybuka wrote:

It's broken here https://lab.llvm.org/buildbot/#/builders/236/builds/11633

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


[clang] [compiler-rt] [compiler-rt] Realtime Sanitizer: Introduce Realtime Sanitizer (RTSan) backend (PR #92460)

2024-06-04 Thread Vitaly Buka via cfe-commits


@@ -1509,6 +1511,11 @@ void DarwinClang::AddLinkRuntimeLibArgs(const ArgList 
,
 AddLinkSanitizerLibArgs(Args, CmdArgs, "asan");
   }

vitalybuka wrote:

Driver needs tests

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


[clang] [compiler-rt] [compiler-rt] Realtime Sanitizer: Introduce Realtime Sanitizer (RTSan) backend (PR #92460)

2024-06-04 Thread Vitaly Buka via cfe-commits

vitalybuka wrote:

If you want another round, make sure to click `re-request review`

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


[clang] [llvm] [Clang][Sanitizers] Add numerical sanitizer (PR #93783)

2024-06-04 Thread Vitaly Buka via cfe-commits

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


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


[clang] [clang-tools-extra] [libcxx] Reland "[clang] Enable sized deallocation by default in C++14 onwards" (PR #90373)

2024-05-23 Thread Vitaly Buka via cfe-commits

vitalybuka wrote:

Internally ::allocate uses sided new:

```
 void*
allocate(size_t __bytes, size_t __alignment = _S_max_align)
__attribute__((__returns_nonnull__,__alloc_size__(2),__alloc_align__(3)))
{ return ::operator new(__bytes, do_allocate(__bytes, __alignment)); }

```

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


[clang] [clang-tools-extra] [libcxx] Reland "[clang] Enable sized deallocation by default in C++14 onwards" (PR #90373)

2024-05-23 Thread Vitaly Buka via cfe-commits

vitalybuka wrote:

> > > Based on my rough understanding, this is expected?
> > 
> > 
> > What do you mean?
> > Isn't this test needs to be updated or disabled?
> 
> I think this ASAN failure is not caused by this PR because these memorys are 
> allocated/deallocated by

100% sure by this PR
https://lab.llvm.org/buildbot/#/builders/168/builds/20461 only two patches on 
the blame list and the second one is unrelated for sure.

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


[clang] [clang-tools-extra] [libcxx] Reland "[clang] Enable sized deallocation by default in C++14 onwards" (PR #90373)

2024-05-23 Thread Vitaly Buka via cfe-commits

vitalybuka wrote:

> Based on my rough understanding, this is expected?

What do you mean?

Isn't this test needs to be updated or disabled?

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


[clang] [clang-tools-extra] [libcxx] Reland "[clang] Enable sized deallocation by default in C++14 onwards" (PR #90373)

2024-05-22 Thread Vitaly Buka via cfe-commits

vitalybuka wrote:

This one is broken https://lab.llvm.org/buildbot/#/builders/168/builds/20461

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


[clang] c587483 - Revert "[Bounds-Safety] Fix `pragma-attribute-supported-attributes-list.test`"

2024-05-19 Thread Vitaly Buka via cfe-commits

Author: Vitaly Buka
Date: 2024-05-19T06:21:40-07:00
New Revision: c587483da0b50efa04146fde205da1d16731e12e

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

LOG: Revert "[Bounds-Safety] Fix 
`pragma-attribute-supported-attributes-list.test`"

Issue #92687

This reverts commit 112eadd55f06bee15caadff688ea0b45acbfa804.

Added: 


Modified: 
clang/test/Misc/pragma-attribute-supported-attributes-list.test

Removed: 




diff  --git a/clang/test/Misc/pragma-attribute-supported-attributes-list.test 
b/clang/test/Misc/pragma-attribute-supported-attributes-list.test
index 99732694f72a5..fd0e6d71baa80 100644
--- a/clang/test/Misc/pragma-attribute-supported-attributes-list.test
+++ b/clang/test/Misc/pragma-attribute-supported-attributes-list.test
@@ -63,6 +63,7 @@
 // CHECK-NEXT: CoroOnlyDestroyWhenComplete (SubjectMatchRule_record)
 // CHECK-NEXT: CoroReturnType (SubjectMatchRule_record)
 // CHECK-NEXT: CoroWrapper (SubjectMatchRule_function)
+// CHECK-NEXT: CountedBy (SubjectMatchRule_field)
 // CHECK-NEXT: DLLExport (SubjectMatchRule_function, 
SubjectMatchRule_variable, SubjectMatchRule_record, 
SubjectMatchRule_objc_interface)
 // CHECK-NEXT: DLLImport (SubjectMatchRule_function, 
SubjectMatchRule_variable, SubjectMatchRule_record, 
SubjectMatchRule_objc_interface)
 // CHECK-NEXT: Destructor (SubjectMatchRule_function)



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


[clang] 6447abe - Revert "[BoundsSafety] Allow 'counted_by' attribute on pointers in structs in C (#90786)"

2024-05-19 Thread Vitaly Buka via cfe-commits

Author: Vitaly Buka
Date: 2024-05-19T05:44:40-07:00
New Revision: 6447abe067c8088a5cc093fe872719374e174068

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

LOG: Revert "[BoundsSafety] Allow 'counted_by' attribute on pointers in structs 
in C (#90786)"

Memory leak: https://lab.llvm.org/buildbot/#/builders/5/builds/43403

Issue #92687

This reverts commit 0ec3b972e58bcbcdc1bebe1696ea37f2931287c3.

Added: 
clang/test/Sema/attr-counted-by.c

Modified: 
clang/docs/ReleaseNotes.rst
clang/include/clang/AST/Type.h
clang/include/clang/Basic/Attr.td
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/include/clang/Parse/Parser.h
clang/include/clang/Sema/Sema.h
clang/lib/AST/Type.cpp
clang/lib/Parse/ParseDecl.cpp
clang/lib/Parse/ParseObjc.cpp
clang/lib/Sema/SemaDeclAttr.cpp
clang/lib/Sema/SemaType.cpp
clang/lib/Sema/TreeTransform.h

Removed: 
clang/test/AST/attr-counted-by-late-parsed-struct-ptrs.c
clang/test/AST/attr-counted-by-struct-ptrs.c
clang/test/Sema/attr-counted-by-late-parsed-off.c
clang/test/Sema/attr-counted-by-late-parsed-struct-ptrs.c
clang/test/Sema/attr-counted-by-struct-ptrs-sizeless-types.c
clang/test/Sema/attr-counted-by-struct-ptrs.c
clang/test/Sema/attr-counted-by-vla-sizeless-types.c
clang/test/Sema/attr-counted-by-vla.c



diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 2f83f5c6d54e9..7af5869d21768 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -317,8 +317,7 @@ New Compiler Flags
 
 - ``-fexperimental-late-parse-attributes`` enables an experimental feature to
   allow late parsing certain attributes in specific contexts where they would
-  not normally be late parsed. Currently this allows late parsing the
-  `counted_by` attribute in C. See `Attribute Changes in Clang`_.
+  not normally be late parsed.
 
 - ``-fseparate-named-sections`` uses separate unique sections for global
   symbols in named special sections (i.e. symbols annotated with
@@ -407,24 +406,6 @@ Attribute Changes in Clang
 - The ``clspv_libclc_builtin`` attribute has been added to allow clspv
   (`OpenCL-C to Vulkan SPIR-V compiler `_) to 
identify functions coming from libclc
   (`OpenCL-C builtin library `_).
-- The ``counted_by`` attribute is now allowed on pointers that are members of a
-  struct in C.
-
-- The ``counted_by`` attribute can now be late parsed in C when
-  ``-fexperimental-late-parse-attributes`` is passed but only when attribute is
-  used in the declaration attribute position. This allows using the
-  attribute on existing code where it previously impossible to do so without
-  re-ordering struct field declarations would break ABI as shown below.
-
-  .. code-block:: c
-
- struct BufferTy {
-   /* Refering to `count` requires late parsing */
-   char* buffer __counted_by(count);
-   /* Swapping `buffer` and `count` to avoid late parsing would break ABI 
*/
-   size_t count;
- };
-
 
 Improvements to Clang's diagnostics
 ---

diff  --git a/clang/include/clang/AST/Type.h b/clang/include/clang/AST/Type.h
index c7a8e785913b3..da3834f19ca04 100644
--- a/clang/include/clang/AST/Type.h
+++ b/clang/include/clang/AST/Type.h
@@ -2515,7 +2515,6 @@ class alignas(TypeAlignment) Type : public 
ExtQualsTypeCommonBase {
   bool isRecordType() const;
   bool isClassType() const;
   bool isStructureType() const;
-  bool isStructureTypeWithFlexibleArrayMember() const;
   bool isObjCBoxableRecordType() const;
   bool isInterfaceType() const;
   bool isStructureOrClassType() const;

diff  --git a/clang/include/clang/Basic/Attr.td 
b/clang/include/clang/Basic/Attr.td
index 7a7721239a28f..38ee8356583be 100644
--- a/clang/include/clang/Basic/Attr.td
+++ b/clang/include/clang/Basic/Attr.td
@@ -2229,8 +2229,7 @@ def TypeNullUnspecified : TypeAttr {
 def CountedBy : DeclOrTypeAttr {
   let Spellings = [Clang<"counted_by">];
   let Subjects = SubjectList<[Field], ErrorDiag>;
-  let Args = [ExprArgument<"Count">, IntArgument<"NestedLevel", 1>];
-  let LateParsed = LateAttrParseExperimentalExt;
+  let Args = [ExprArgument<"Count">, IntArgument<"NestedLevel">];
   let ParseArgumentsAsUnevaluated = 1;
   let Documentation = [CountedByDocs];
   let LangOpts = [COnly];

diff  --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td 
b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index 8e6596410c5d0..09b1874f9fddd 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -6533,10 +6533,8 @@ def warn_superclass_variable_sized_type_not_at_end : 
Warning<
 
 def 

[clang] ed9007d - Revert "[Bounds-Safety] Temporarily relax a `counted_by` attribute restriction on flexible array members"

2024-05-19 Thread Vitaly Buka via cfe-commits

Author: Vitaly Buka
Date: 2024-05-19T05:44:40-07:00
New Revision: ed9007d0d219726db01f211e9c9ab72fbfe4ecb1

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

LOG: Revert "[Bounds-Safety] Temporarily relax a `counted_by` attribute 
restriction on flexible array members"

Together with 0ec3b972e58bcbcdc1bebe1696ea37f2931287c3
breaks https://lab.llvm.org/buildbot/#/builders/5/builds/43403

Issue #92687

This reverts commit cef6387e52578366c2332275dad88b9953b55336.

Added: 


Modified: 
clang/include/clang/Basic/DiagnosticGroups.td
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/lib/Sema/SemaDeclAttr.cpp
clang/test/Sema/attr-counted-by-vla.c

Removed: 




diff  --git a/clang/include/clang/Basic/DiagnosticGroups.td 
b/clang/include/clang/Basic/DiagnosticGroups.td
index 4fad4d1a0eca7..4cb4f3d999f7a 100644
--- a/clang/include/clang/Basic/DiagnosticGroups.td
+++ b/clang/include/clang/Basic/DiagnosticGroups.td
@@ -1447,10 +1447,6 @@ def FunctionMultiVersioning
 
 def NoDeref : DiagGroup<"noderef">;
 
-// -fbounds-safety and bounds annotation related warnings
-def BoundsSafetyCountedByEltTyUnknownSize :
-  DiagGroup<"bounds-safety-counted-by-elt-type-unknown-size">;
-
 // A group for cross translation unit static analysis related warnings.
 def CrossTU : DiagGroup<"ctu">;
 

diff  --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td 
b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index 1efa3af121c10..8e6596410c5d0 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -6552,7 +6552,7 @@ def err_counted_by_attr_refer_to_union : Error<
 def note_flexible_array_counted_by_attr_field : Note<
   "field %0 declared here">;
 def err_counted_by_attr_pointee_unknown_size : Error<
-  "'counted_by' %select{cannot|should not}3 be applied to %select{"
+  "'counted_by' cannot be applied to %select{"
 "a pointer with pointee|" // pointer
 "an array with element}0" // array
   " of unknown size because %1 is %select{"
@@ -6561,14 +6561,8 @@ def err_counted_by_attr_pointee_unknown_size : Error<
 "a function type|" // CountedByInvalidPointeeTypeKind::FUNCTION
 // CountedByInvalidPointeeTypeKind::FLEXIBLE_ARRAY_MEMBER
 "a struct type with a flexible array member"
-"%select{|. This will be an error in a future compiler version}3"
-""
   "}2">;
 
-def warn_counted_by_attr_elt_type_unknown_size :
-  Warning,
-  InGroup;
-
 let CategoryName = "ARC Semantic Issue" in {
 
 // ARC-mode diagnostics.

diff  --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp
index e816ea3647a7c..c8b71631076ba 100644
--- a/clang/lib/Sema/SemaDeclAttr.cpp
+++ b/clang/lib/Sema/SemaDeclAttr.cpp
@@ -8687,7 +8687,6 @@ static bool CheckCountedByAttrOnField(
   // Note: The `Decl::isFlexibleArrayMemberLike` check earlier on means
   // only `PointeeTy->isStructureTypeWithFlexibleArrayMember()` is reachable
   // when `FieldTy->isArrayType()`.
-  bool ShouldWarn = false;
   if (PointeeTy->isIncompleteType()) {
 InvalidTypeKind = CountedByInvalidPointeeTypeKind::INCOMPLETE;
   } else if (PointeeTy->isSizelessType()) {
@@ -8695,25 +8694,13 @@ static bool CheckCountedByAttrOnField(
   } else if (PointeeTy->isFunctionType()) {
 InvalidTypeKind = CountedByInvalidPointeeTypeKind::FUNCTION;
   } else if (PointeeTy->isStructureTypeWithFlexibleArrayMember()) {
-if (FieldTy->isArrayType()) {
-  // This is a workaround for the Linux kernel that has already adopted
-  // `counted_by` on a FAM where the pointee is a struct with a FAM. This
-  // should be an error because computing the bounds of the array cannot be
-  // done correctly without manually traversing every struct object in the
-  // array at runtime. To allow the code to be built this error is
-  // downgraded to a warning.
-  ShouldWarn = true;
-}
 InvalidTypeKind = CountedByInvalidPointeeTypeKind::FLEXIBLE_ARRAY_MEMBER;
   }
 
   if (InvalidTypeKind != CountedByInvalidPointeeTypeKind::VALID) {
-unsigned DiagID = ShouldWarn
-  ? diag::warn_counted_by_attr_elt_type_unknown_size
-  : diag::err_counted_by_attr_pointee_unknown_size;
-S.Diag(FD->getBeginLoc(), DiagID)
+S.Diag(FD->getBeginLoc(), diag::err_counted_by_attr_pointee_unknown_size)
 << SelectPtrOrArr << PointeeTy << (int)InvalidTypeKind
-<< (ShouldWarn ? 1 : 0) << FD->getSourceRange();
+<< FD->getSourceRange();
 return true;
   }
 

diff  --git a/clang/test/Sema/attr-counted-by-vla.c 
b/clang/test/Sema/attr-counted-by-vla.c
index b25f719f3b95a..3de6bd55e2d8e 100644
--- a/clang/test/Sema/attr-counted-by-vla.c
+++ b/clang/test/Sema/attr-counted-by-vla.c
@@ 

[clang] [Bounds-Safety] Reserve slot in SanitizerHandler enum for Bounds-Safety (PR #91032)

2024-05-18 Thread Vitaly Buka via cfe-commits

https://github.com/vitalybuka commented:

LGTM

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


[clang] Revert "Revert "[OpenMP][TR12] change property of map-type modifier."… (PR #91141)

2024-05-08 Thread Vitaly Buka via cfe-commits

vitalybuka wrote:

> Greetings and hello from the UK!
> 
> it looks as though this commit caused a test failure on the following build 
> bot, is anyone able to take a look see?
> 
> https://lab.llvm.org/buildbot/#/builders/139/builds/65066
> 
> Will give it an hour for a reply before looking at a revert.
> 
> Have a great day all.

I am not looking into this, and not sure if @jyu2-git 
revert is LGTM 

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


[clang] Revert "Revert "[OpenMP][TR12] change property of map-type modifier."… (PR #91141)

2024-05-08 Thread Vitaly Buka via cfe-commits

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


[clang] Revert "Revert "[OpenMP][TR12] change property of map-type modifier."… (PR #91141)

2024-05-08 Thread Vitaly Buka via cfe-commits

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


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


[clang] Reland "[OpenMP][TR12] change property of map-type modifier." (PR #90935)

2024-05-03 Thread Vitaly Buka via cfe-commits

vitalybuka wrote:

Yes, its there
but it's too late

we can't cast to enum invalid values 
it should be like:
```
  unsigned MapType = getOpenMPSimpleClauseType(
  OMPC_map, PP.getSpelling(Tok), P.getLangOpts());
  if (MapType == OMPC_MAP_to || MapType == OMPC_MAP_from ||
  MapType == OMPC_MAP_tofrom || MapType == OMPC_MAP_alloc ||
  MapType == OMPC_MAP_delete || MapType == OMPC_MAP_release)
return static_cast<>(MapType);
  return OMPC_MAP_unkno
```


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


[clang] Reland "[OpenMP][TR12] change property of map-type modifier." (PR #90935)

2024-05-03 Thread Vitaly Buka via cfe-commits

vitalybuka wrote:

```
diff --git a/clang/lib/Parse/ParseOpenMP.cpp b/clang/lib/Parse/ParseOpenMP.cpp
index 53d89ce2fa3e..1a4442f38f6d 100644
--- a/clang/lib/Parse/ParseOpenMP.cpp
+++ b/clang/lib/Parse/ParseOpenMP.cpp
@@ -4326,6 +4326,7 @@ static OpenMPMapClauseKind isMapType(Parser ) {
   OpenMPMapClauseKind MapType =
   static_cast(getOpenMPSimpleClauseType(
   OMPC_map, PP.getSpelling(Tok), P.getLangOpts()));
+  assert((int)MapType < 6);
   return MapType;
 }
```

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


[clang] Reland "[OpenMP][TR12] change property of map-type modifier." (PR #90935)

2024-05-03 Thread Vitaly Buka via cfe-commits

vitalybuka wrote:

> > 7c28408
> 
> good point, maybe not, I scheduled it as with, without rebase. Let's try 
> again.

Still fails after rebase https://lab.llvm.org/buildbot/#/builders/5/builds/43115

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


[clang] Revert "[OpenMP][TR12] change property of map-type modifier." (PR #90885)

2024-05-03 Thread Vitaly Buka via cfe-commits

vitalybuka wrote:

> > BTW, Hi @vitalybuka, do you know how to reproduce the problem with 
> > sanitizer build? Thanks.
> 
> There is a basic instruction, should work with Linux 
> https://github.com/google/sanitizers/wiki/SanitizerBotReproduceBuild I guess 
> this issue should be detectable with appropriate `assert(val > a && val <= 
> b)` a the point of the report.

Still fails after rebase https://lab.llvm.org/buildbot/#/builders/5/builds/43115

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


[clang] Reland "[OpenMP][TR12] change property of map-type modifier." (PR #90935)

2024-05-03 Thread Vitaly Buka via cfe-commits

https://github.com/vitalybuka updated 
https://github.com/llvm/llvm-project/pull/90935

>From 8468a10bf34e4c432b181d40c370043ad21b5801 Mon Sep 17 00:00:00 2001
From: jyu2-git 
Date: Thu, 2 May 2024 20:55:18 -0700
Subject: [PATCH] Revert "Revert "[OpenMP][TR12] change property of map-type
 modifier." (#90885)"

This reverts commit eea81aa29848361eb5b24f24d2af643fdeb9adfd.
---
 .../clang/Basic/DiagnosticParseKinds.td   |   5 +
 clang/lib/Parse/ParseOpenMP.cpp   |  44 +++-
 clang/test/OpenMP/target_ast_print.cpp|  58 ++
 clang/test/OpenMP/target_map_messages.cpp | 105 ++
 4 files changed, 162 insertions(+), 50 deletions(-)

diff --git a/clang/include/clang/Basic/DiagnosticParseKinds.td 
b/clang/include/clang/Basic/DiagnosticParseKinds.td
index fdffb35ea0d955..44bc4e0e130de8 100644
--- a/clang/include/clang/Basic/DiagnosticParseKinds.td
+++ b/clang/include/clang/Basic/DiagnosticParseKinds.td
@@ -1438,6 +1438,9 @@ def err_omp_decl_in_declare_simd_variant : Error<
 def err_omp_sink_and_source_iteration_not_allowd: Error<" '%0 
%select{sink:|source:}1' must be with '%select{omp_cur_iteration - 
1|omp_cur_iteration}1'">;
 def err_omp_unknown_map_type : Error<
   "incorrect map type, expected one of 'to', 'from', 'tofrom', 'alloc', 
'release', or 'delete'">;
+def err_omp_more_one_map_type : Error<"map type is already specified">;
+def note_previous_map_type_specified_here
+: Note<"map type '%0' is previous specified here">;
 def err_omp_unknown_map_type_modifier : Error<
   "incorrect map type modifier, expected one of: 'always', 'close', 'mapper'"
   "%select{|, 'present'|, 'present', 'iterator'}0%select{|, 'ompx_hold'}1">;
@@ -1445,6 +1448,8 @@ def err_omp_map_type_missing : Error<
   "missing map type">;
 def err_omp_map_type_modifier_missing : Error<
   "missing map type modifier">;
+def err_omp_map_modifier_specification_list : Error<
+  "empty modifier-specification-list is not allowed">;
 def err_omp_declare_simd_inbranch_notinbranch : Error<
   "unexpected '%0' clause, '%1' is specified already">;
 def err_omp_expected_clause_argument
diff --git a/clang/lib/Parse/ParseOpenMP.cpp b/clang/lib/Parse/ParseOpenMP.cpp
index 18ba1185ee8de7..b1cff11af590a5 100644
--- a/clang/lib/Parse/ParseOpenMP.cpp
+++ b/clang/lib/Parse/ParseOpenMP.cpp
@@ -4228,13 +4228,20 @@ bool 
Parser::parseMapperModifier(SemaOpenMP::OpenMPVarListDataTy ) {
   return T.consumeClose();
 }
 
+static OpenMPMapClauseKind isMapType(Parser );
+
 /// Parse map-type-modifiers in map clause.
-/// map([ [map-type-modifier[,] [map-type-modifier[,] ...] map-type : ] list)
+/// map([ [map-type-modifier[,] [map-type-modifier[,] ...] [map-type] : ] list)
 /// where, map-type-modifier ::= always | close | mapper(mapper-identifier) |
 /// present
+/// where, map-type ::= alloc | delete | from | release | to | tofrom
 bool Parser::parseMapTypeModifiers(SemaOpenMP::OpenMPVarListDataTy ) {
+  bool HasMapType = false;
+  SourceLocation PreMapLoc = Tok.getLocation();
+  StringRef PreMapName = "";
   while (getCurToken().isNot(tok::colon)) {
 OpenMPMapModifierKind TypeModifier = isMapModifier(*this);
+OpenMPMapClauseKind MapKind = isMapType(*this);
 if (TypeModifier == OMPC_MAP_MODIFIER_always ||
 TypeModifier == OMPC_MAP_MODIFIER_close ||
 TypeModifier == OMPC_MAP_MODIFIER_present ||
@@ -4257,6 +4264,19 @@ bool 
Parser::parseMapTypeModifiers(SemaOpenMP::OpenMPVarListDataTy ) {
 Diag(Data.MapTypeModifiersLoc.back(), diag::err_omp_missing_comma)
 << "map type modifier";
 
+} else if (getLangOpts().OpenMP >= 60 && MapKind != OMPC_MAP_unknown) {
+  if (!HasMapType) {
+HasMapType = true;
+Data.ExtraModifier = MapKind;
+MapKind = OMPC_MAP_unknown;
+PreMapLoc = Tok.getLocation();
+PreMapName = Tok.getIdentifierInfo()->getName();
+  } else {
+Diag(Tok, diag::err_omp_more_one_map_type);
+Diag(PreMapLoc, diag::note_previous_map_type_specified_here)
+<< PreMapName;
+  }
+  ConsumeToken();
 } else {
   // For the case of unknown map-type-modifier or a map-type.
   // Map-type is followed by a colon; the function returns when it
@@ -4267,8 +4287,14 @@ bool 
Parser::parseMapTypeModifiers(SemaOpenMP::OpenMPVarListDataTy ) {
 continue;
   }
   // Potential map-type token as it is followed by a colon.
-  if (PP.LookAhead(0).is(tok::colon))
-return false;
+  if (PP.LookAhead(0).is(tok::colon)) {
+if (getLangOpts().OpenMP >= 60) {
+  break;
+} else {
+  return false;
+}
+  }
+
   Diag(Tok, diag::err_omp_unknown_map_type_modifier)
   << (getLangOpts().OpenMP >= 51 ? (getLangOpts().OpenMP >= 52 ? 2 : 1)
  : 0)
@@ -4278,6 +4304,14 @@ bool 
Parser::parseMapTypeModifiers(SemaOpenMP::OpenMPVarListDataTy ) {
 if (getCurToken().is(tok::comma))
   

[clang] Reland "[OpenMP][TR12] change property of map-type modifier." (PR #90935)

2024-05-03 Thread Vitaly Buka via cfe-commits

vitalybuka wrote:

> 7c28408

good point, maybe not, I scheduled it as with, without rebase.
Let's try again.

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


[clang] Reland "[OpenMP][TR12] change property of map-type modifier." (PR #90935)

2024-05-03 Thread Vitaly Buka via cfe-commits

vitalybuka wrote:

> Looks broken 
> https://lab.llvm.org/buildbot/#/builders/5/builds/43104/steps/9/logs/stdio

This is special build from this PR see `git status` here
https://lab.llvm.org/buildbot/#/builders/5/builds/43104/steps/6/logs/stdio

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


[clang] Reland "[OpenMP][TR12] change property of map-type modifier." (PR #90935)

2024-05-03 Thread Vitaly Buka via cfe-commits

https://github.com/vitalybuka requested changes to this pull request.

Looks broken 
https://lab.llvm.org/buildbot/#/builders/5/builds/43104/steps/9/logs/stdio

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


[clang] Fix sanitize problem. (PR #90800)

2024-05-02 Thread Vitaly Buka via cfe-commits

vitalybuka wrote:

Please include this fix into re-land.

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


[clang] Revert "[OpenMP][TR12] change property of map-type modifier." (PR #90885)

2024-05-02 Thread Vitaly Buka via cfe-commits

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


[clang] Revert "[OpenMP][TR12] change property of map-type modifier." (PR #90885)

2024-05-02 Thread Vitaly Buka via cfe-commits

vitalybuka wrote:

> BTW, Hi @vitalybuka, do you know how to reproduce the problem with sanitizer 
> build? Thanks.

There is a basic instruction, should work with Linux 
https://github.com/google/sanitizers/wiki/SanitizerBotReproduceBuild
I guess this issue should be detectable with appropriate `assert(val > a && val 
<= b)` a the point of the report.

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


[clang] Revert "[OpenMP][TR12] change property of map-type modifier." (PR #90885)

2024-05-02 Thread Vitaly Buka via cfe-commits

vitalybuka wrote:

Oh, it's not landed. I looked at wrong PR. Lets revert if it can't be landed 
soon. 

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


[clang] Revert "[OpenMP][TR12] change property of map-type modifier." (PR #90885)

2024-05-02 Thread Vitaly Buka via cfe-commits

vitalybuka wrote:

> How long do you need?

Looks like it's landed.
Thanks!

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


[clang] Revert "[OpenMP][TR12] change property of map-type modifier." (PR #90885)

2024-05-02 Thread Vitaly Buka via cfe-commits

vitalybuka wrote:

> I already has patch in #90800 waiting for test to finish.

Fix forward is good for something < 1H, but looks like you started 19H ago.
Such cases must be reverted and then fixed.

How long do you need?

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


[clang] [OpenMP][TR12] change property of map-type modifier. (PR #90499)

2024-05-02 Thread Vitaly Buka via cfe-commits

vitalybuka wrote:

I am not sure what should be a correct fix, so I'll revert?

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


[clang] Revert "[OpenMP][TR12] change property of map-type modifier." (PR #90885)

2024-05-02 Thread Vitaly Buka via cfe-commits

https://github.com/vitalybuka created 
https://github.com/llvm/llvm-project/pull/90885

Breaks 
https://lab.llvm.org/buildbot/#/builders/5/builds/43086/steps/9/logs/stdio

Reverts llvm/llvm-project#90499

>From a6ca95f5e2991fb7f857f70436148a6abdecec00 Mon Sep 17 00:00:00 2001
From: Vitaly Buka 
Date: Thu, 2 May 2024 11:32:32 -0700
Subject: [PATCH] Revert "[OpenMP][TR12] change property of map-type modifier.
 (#90499)"

This reverts commit f050660f4a60415cd840f7fba7ac3698c38376d0.
---
 .../clang/Basic/DiagnosticParseKinds.td   |   5 -
 clang/lib/Parse/ParseOpenMP.cpp   |  44 +---
 clang/test/OpenMP/target_ast_print.cpp|  58 --
 clang/test/OpenMP/target_map_messages.cpp | 105 --
 4 files changed, 50 insertions(+), 162 deletions(-)

diff --git a/clang/include/clang/Basic/DiagnosticParseKinds.td 
b/clang/include/clang/Basic/DiagnosticParseKinds.td
index 44bc4e0e130de8..fdffb35ea0d955 100644
--- a/clang/include/clang/Basic/DiagnosticParseKinds.td
+++ b/clang/include/clang/Basic/DiagnosticParseKinds.td
@@ -1438,9 +1438,6 @@ def err_omp_decl_in_declare_simd_variant : Error<
 def err_omp_sink_and_source_iteration_not_allowd: Error<" '%0 
%select{sink:|source:}1' must be with '%select{omp_cur_iteration - 
1|omp_cur_iteration}1'">;
 def err_omp_unknown_map_type : Error<
   "incorrect map type, expected one of 'to', 'from', 'tofrom', 'alloc', 
'release', or 'delete'">;
-def err_omp_more_one_map_type : Error<"map type is already specified">;
-def note_previous_map_type_specified_here
-: Note<"map type '%0' is previous specified here">;
 def err_omp_unknown_map_type_modifier : Error<
   "incorrect map type modifier, expected one of: 'always', 'close', 'mapper'"
   "%select{|, 'present'|, 'present', 'iterator'}0%select{|, 'ompx_hold'}1">;
@@ -1448,8 +1445,6 @@ def err_omp_map_type_missing : Error<
   "missing map type">;
 def err_omp_map_type_modifier_missing : Error<
   "missing map type modifier">;
-def err_omp_map_modifier_specification_list : Error<
-  "empty modifier-specification-list is not allowed">;
 def err_omp_declare_simd_inbranch_notinbranch : Error<
   "unexpected '%0' clause, '%1' is specified already">;
 def err_omp_expected_clause_argument
diff --git a/clang/lib/Parse/ParseOpenMP.cpp b/clang/lib/Parse/ParseOpenMP.cpp
index 53d89ce2fa3e99..480201bc06f613 100644
--- a/clang/lib/Parse/ParseOpenMP.cpp
+++ b/clang/lib/Parse/ParseOpenMP.cpp
@@ -4228,20 +4228,13 @@ bool 
Parser::parseMapperModifier(SemaOpenMP::OpenMPVarListDataTy ) {
   return T.consumeClose();
 }
 
-static OpenMPMapClauseKind isMapType(Parser );
-
 /// Parse map-type-modifiers in map clause.
-/// map([ [map-type-modifier[,] [map-type-modifier[,] ...] [map-type] : ] list)
+/// map([ [map-type-modifier[,] [map-type-modifier[,] ...] map-type : ] list)
 /// where, map-type-modifier ::= always | close | mapper(mapper-identifier) |
 /// present
-/// where, map-type ::= alloc | delete | from | release | to | tofrom
 bool Parser::parseMapTypeModifiers(SemaOpenMP::OpenMPVarListDataTy ) {
-  bool HasMapType = false;
-  SourceLocation PreMapLoc = Tok.getLocation();
-  StringRef PreMapName = "";
   while (getCurToken().isNot(tok::colon)) {
 OpenMPMapModifierKind TypeModifier = isMapModifier(*this);
-OpenMPMapClauseKind MapKind = isMapType(*this);
 if (TypeModifier == OMPC_MAP_MODIFIER_always ||
 TypeModifier == OMPC_MAP_MODIFIER_close ||
 TypeModifier == OMPC_MAP_MODIFIER_present ||
@@ -4264,19 +4257,6 @@ bool 
Parser::parseMapTypeModifiers(SemaOpenMP::OpenMPVarListDataTy ) {
 Diag(Data.MapTypeModifiersLoc.back(), diag::err_omp_missing_comma)
 << "map type modifier";
 
-} else if (getLangOpts().OpenMP >= 60 && MapKind != OMPC_MAP_unknown) {
-  if (!HasMapType) {
-HasMapType = true;
-Data.ExtraModifier = MapKind;
-MapKind = OMPC_MAP_unknown;
-PreMapLoc = Tok.getLocation();
-PreMapName = Tok.getIdentifierInfo()->getName();
-  } else {
-Diag(Tok, diag::err_omp_more_one_map_type);
-Diag(PreMapLoc, diag::note_previous_map_type_specified_here)
-<< PreMapName;
-  }
-  ConsumeToken();
 } else {
   // For the case of unknown map-type-modifier or a map-type.
   // Map-type is followed by a colon; the function returns when it
@@ -4287,14 +4267,8 @@ bool 
Parser::parseMapTypeModifiers(SemaOpenMP::OpenMPVarListDataTy ) {
 continue;
   }
   // Potential map-type token as it is followed by a colon.
-  if (PP.LookAhead(0).is(tok::colon)) {
-if (getLangOpts().OpenMP >= 60) {
-  break;
-} else {
-  return false;
-}
-  }
-
+  if (PP.LookAhead(0).is(tok::colon))
+return false;
   Diag(Tok, diag::err_omp_unknown_map_type_modifier)
   << (getLangOpts().OpenMP >= 51 ? (getLangOpts().OpenMP >= 52 ? 2 : 1)
  : 0)
@@ -4304,14 +4278,6 @@ bool 

[clang] [OpenMP][TR12] change property of map-type modifier. (PR #90499)

2024-05-02 Thread Vitaly Buka via cfe-commits

vitalybuka wrote:

Breaks https://lab.llvm.org/buildbot/#/builders/5/builds/43086


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


[clang] [clang-tools-extra] [libcxx] Reland "[clang] Enable sized deallocation by default in C++14 onwards" (PR #90373)

2024-04-30 Thread Vitaly Buka via cfe-commits

vitalybuka wrote:

> Thanks a lot, that was quick! There is another AddressSanitizer issue that 
> may possibly be fixed by #90292. cc @vitalybuka

Yes, please wait for #90292.


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


[clang] [clang-tools-extra] [libcxx] Revert "[clang] Enable sized deallocation by default in C++14 onwards (#83774)" (PR #90299)

2024-04-26 Thread Vitaly Buka via cfe-commits

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


[clang] [clang-tools-extra] [libcxx] Revert "[clang] Enable sized deallocation by default in C++14 onwards (#83774)" (PR #90299)

2024-04-26 Thread Vitaly Buka via cfe-commits

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


[clang] [clang-tools-extra] [libcxx] Revert "[clang] Enable sized deallocation by default in C++14 onwards (#83774)" (PR #90299)

2024-04-26 Thread Vitaly Buka via cfe-commits

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


[clang] [clang-tools-extra] [libcxx] [clang] Enable sized deallocation by default in C++14 onwards (PR #83774)

2024-04-26 Thread Vitaly Buka via cfe-commits

vitalybuka wrote:

Lets revert #90299 to recover bots before the weekend.


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


[clang] [clang-tools-extra] [libcxx] Revert "[clang] Enable sized deallocation by default in C++14 onwards (#83774)" (PR #90299)

2024-04-26 Thread Vitaly Buka via cfe-commits

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


[clang] [clang-tools-extra] [libcxx] Revert "[clang] Enable sized deallocation by default in C++14 onwards (#83774)" (PR #90299)

2024-04-26 Thread Vitaly Buka via cfe-commits

https://github.com/vitalybuka created 
https://github.com/llvm/llvm-project/pull/90299

https://lab.llvm.org/buildbot/#/builders/168/builds/20063

This reverts commit cf5a8b489464d09dfdd7a48ce7c8b41d3c9bf819.


>From b4c0a3f4835a686a15a3ed90a4058f353f844f26 Mon Sep 17 00:00:00 2001
From: Vitaly Buka 
Date: Fri, 26 Apr 2024 16:50:25 -0700
Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20initia?=
 =?UTF-8?q?l=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.4
---
 .../clangd/unittests/FindTargetTests.cpp  |   4 +-
 .../checkers/misc/new-delete-overloads.cpp|  10 +
 clang/docs/ReleaseNotes.rst   |   5 -
 clang/include/clang/Driver/Options.td |   8 +-
 clang/lib/Driver/ToolChains/Clang.cpp |  13 +-
 clang/lib/Driver/ToolChains/Darwin.cpp|  58 +
 clang/lib/Driver/ToolChains/Darwin.h  |   4 -
 clang/lib/Driver/ToolChains/ZOS.cpp   |   6 -
 clang/test/AST/ast-dump-expr-json.cpp |   2 +-
 clang/test/AST/ast-dump-expr.cpp  |   2 +-
 clang/test/AST/ast-dump-stmt-json.cpp | 244 +-
 clang/test/Analysis/cxxnewexpr-callback.cpp   |   4 +-
 .../basic.stc.dynamic.deallocation/p2.cpp |   2 +-
 clang/test/CXX/drs/cwg292.cpp |  17 +-
 .../test/CXX/expr/expr.unary/expr.new/p14.cpp |   2 +-
 .../CodeGenCXX/cxx1y-sized-deallocation.cpp   |  10 +-
 .../CodeGenCXX/cxx1z-aligned-allocation.cpp   |   6 +-
 .../CodeGenCXX/cxx2a-destroying-delete.cpp|   4 +-
 clang/test/CodeGenCXX/delete-two-arg.cpp  |   4 +-
 clang/test/CodeGenCXX/delete.cpp  |  12 +-
 clang/test/CodeGenCXX/dllimport.cpp   |   4 +-
 clang/test/CodeGenCXX/new.cpp |   6 +-
 .../coro-aligned-alloc-2.cpp  |   2 +
 .../CodeGenCoroutines/coro-aligned-alloc.cpp  |   6 +-
 clang/test/CodeGenCoroutines/coro-alloc.cpp   |   6 +-
 clang/test/CodeGenCoroutines/coro-cleanup.cpp |   6 +-
 clang/test/CodeGenCoroutines/coro-dealloc.cpp |   2 +
 clang/test/CodeGenCoroutines/coro-gro.cpp |   3 +-
 clang/test/CodeGenCoroutines/pr56919.cpp  |   9 +-
 clang/test/Lexer/cxx-features.cpp |  20 +-
 clang/test/PCH/cxx1z-aligned-alloc.cpp|  10 +-
 clang/test/SemaCXX/MicrosoftExtensions.cpp|   8 +-
 .../SemaCXX/builtin-operator-new-delete.cpp   |   2 +-
 .../test/SemaCXX/cxx1y-sized-deallocation.cpp |   2 +-
 .../unavailable_aligned_allocation.cpp|  15 +-
 clang/tools/clang-repl/CMakeLists.txt |  59 -
 clang/unittests/Interpreter/CMakeLists.txt|  59 -
 .../StaticAnalyzer/CallEventTest.cpp  |   2 +-
 clang/www/cxx_status.html |  11 +-
 .../support.dynamic/libcpp_deallocate.sh.cpp  |   3 -
 .../sized_delete_array14.pass.cpp |   8 +-
 .../new.delete.single/sized_delete14.pass.cpp |   8 +-
 42 files changed, 113 insertions(+), 555 deletions(-)

diff --git a/clang-tools-extra/clangd/unittests/FindTargetTests.cpp 
b/clang-tools-extra/clangd/unittests/FindTargetTests.cpp
index 88aae2729904f4a..799a549ff0816e3 100644
--- a/clang-tools-extra/clangd/unittests/FindTargetTests.cpp
+++ b/clang-tools-extra/clangd/unittests/FindTargetTests.cpp
@@ -839,9 +839,7 @@ TEST_F(TargetDeclTest, OverloadExpr) {
   [[delete]] x;
 }
   )cpp";
-  // Sized deallocation is enabled by default in C++14 onwards.
-  EXPECT_DECLS("CXXDeleteExpr",
-   "void operator delete(void *, unsigned long) noexcept");
+  EXPECT_DECLS("CXXDeleteExpr", "void operator delete(void *) noexcept");
 }
 
 TEST_F(TargetDeclTest, DependentExprs) {
diff --git 
a/clang-tools-extra/test/clang-tidy/checkers/misc/new-delete-overloads.cpp 
b/clang-tools-extra/test/clang-tidy/checkers/misc/new-delete-overloads.cpp
index f86fe8a4c5b14f6..78f021144b2e19c 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/misc/new-delete-overloads.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/misc/new-delete-overloads.cpp
@@ -12,6 +12,16 @@ struct S {
 // CHECK-MESSAGES: :[[@LINE+1]]:7: warning: declaration of 'operator new' has 
no matching declaration of 'operator delete' at the same scope
 void *operator new(size_t size) noexcept(false);
 
+struct T {
+  // Sized deallocations are not enabled by default, and so this new/delete 
pair
+  // does not match. However, we expect only one warning, for the new, because
+  // the operator delete is a placement delete and we do not warn on 
mismatching
+  // placement operations.
+  // CHECK-MESSAGES: :[[@LINE+1]]:9: warning: declaration of 'operator new' 
has no matching declaration of 'operator delete' at the same scope
+  void *operator new(size_t size) noexcept;
+  void operator delete(void *ptr, size_t) noexcept; // ok only if sized 
deallocation is enabled
+};
+
 struct U {
   void *operator new(size_t size) noexcept;
   void operator delete(void *ptr) noexcept;
diff --git a/clang/docs/ReleaseNotes.rst 

[clang] [compiler-rt] [asan][windows] Eliminate the static asan runtime on windows (PR #81677)

2024-04-26 Thread Vitaly Buka via cfe-commits

vitalybuka wrote:

It's LGTM, but it's going to be annoying to merge.
I bet this patch has several reasons to be reverted, and will be reverted 
multiple times.
It would be nice to try to split into smaller parts.


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


[clang] [compiler-rt] [asan][windows] Eliminate the static asan runtime on windows (PR #81677)

2024-04-26 Thread Vitaly Buka via cfe-commits


@@ -35,6 +35,9 @@
 // RUN:  %p/../../../../lib/sanitizer_common/sanitizer_coverage_interface.inc  
   \
 // RUN:  | grep -e "INTERFACE_\(WEAK_\)\?FUNCTION" 
   \
 // RUN:  | grep -v "__sanitizer_weak_hook" 
   \
+// RUN:  | grep -v "__sanitizer_override_function" 
   \

vitalybuka wrote:

can we move related changes into a separate patch

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


[clang] [clang-tools-extra] [libcxx] [clang] Enable sized deallocation by default in C++14 onwards (PR #83774)

2024-04-26 Thread Vitaly Buka via cfe-commits

vitalybuka wrote:

Delete uses __get_long_cap()

```
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void 
__set_long_cap(size_type __s) _NOEXCEPT {
__r_.first().__l.__cap_ = __s / __endian_factor;
__r_.first().__l.__is_long_ = true;
  }

  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type 
__get_long_cap() const _NOEXCEPT {
return __r_.first().__l.__cap_ * __endian_factor;
  }
```

And if __set_long_cap() provided with odd number, and __endian_factor == 2, 
__get_long_cap() will be short by 1.

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


[clang] [clang-tools-extra] [libcxx] [clang] Enable sized deallocation by default in C++14 onwards (PR #83774)

2024-04-26 Thread Vitaly Buka via cfe-commits

vitalybuka wrote:

@ldionne looks like a bug in std::string

```
--- a/libcxx/include/string
+++ b/libcxx/include/string
@@ -1123,7 +1123,7 @@ public:
   inline _LIBCPP_CONSTEXPR_SINCE_CXX20 ~basic_string() {
 __annotate_delete();
 if (__is_long())
-  __alloc_traits::deallocate(__alloc(), __get_long_pointer(), 
__get_long_cap());
+  __alloc_traits::deallocate(__alloc(), __get_long_pointer(), 
__get_long_cap() + 1);
   }
 
```

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


[clang] [clang-tools-extra] [libcxx] [clang] Enable sized deallocation by default in C++14 onwards (PR #83774)

2024-04-26 Thread Vitaly Buka via cfe-commits

vitalybuka wrote:

This is causing new/delete mismatch 
https://lab.llvm.org/buildbot/#/builders/168/builds/20063

```
=
==2164144==ERROR: AddressSanitizer: new-delete-type-mismatch on 0x503035b0 
in thread T0:
  object passed to delete has wrong type:
  size of the allocated type:   25 bytes;
  size of the deallocated type: 24 bytes.
#0 0x555c21886d82 in operator delete(void*, unsigned long) 
/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/compiler-rt/lib/asan/asan_new_delete.cpp:155:3
#1 0x555c21a2d47c in __libcpp_operator_delete 
/b/sanitizer-x86_64-linux-bootstrap-asan/build/libcxx_build_asan/include/c++/v1/new:279:3
#2 0x555c21a2d47c in __do_deallocate_handle_size<> 
/b/sanitizer-x86_64-linux-bootstrap-asan/build/libcxx_build_asan/include/c++/v1/new:303:10
#3 0x555c21a2d47c in __libcpp_deallocate 
/b/sanitizer-x86_64-linux-bootstrap-asan/build/libcxx_build_asan/include/c++/v1/new:316:12
#4 0x555c21a2d47c in deallocate 
/b/sanitizer-x86_64-linux-bootstrap-asan/build/libcxx_build_asan/include/c++/v1/__memory/allocator.h:133:7
#5 0x555c21a2d47c in deallocate 
/b/sanitizer-x86_64-linux-bootstrap-asan/build/libcxx_build_asan/include/c++/v1/__memory/allocator_traits.h:312:9
#6 0x555c21a2d47c in ~basic_string 
/b/sanitizer-x86_64-linux-bootstrap-asan/build/libcxx_build_asan/include/c++/v1/string:1126:7
#7 0x555c21a2d47c in 
llvm::TGParser::addDefOne(std::__1::unique_ptr>) 
/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/lib/TableGen/TGParser.cpp:545:22
#8 0x555c21a2bc41 in llvm::TGParser::addEntry(llvm::RecordsEntry) 
/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/lib/TableGen/TGParser.cpp:416:10
#9 0x555c21a5948e in llvm::TGParser::ParseDef(llvm::MultiClass*) 
/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/lib/TableGen/TGParser.cpp:3625:10
#10 0x555c21a5ccab in llvm::TGParser::ParseObject(llvm::MultiClass*) 
/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/lib/TableGen/TGParser.cpp:4325:31
#11 0x555c21a651f1 in ParseObjectList 
/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/lib/TableGen/TGParser.cpp:4356:9
#12 0x555c21a651f1 in llvm::TGParser::ParseFile() 
/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/lib/TableGen/TGParser.cpp:4365:7
#13 0x555c219ba36f in llvm::TableGenMain(char const*, 
std::__1::function) 
/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/lib/TableGen/Main.cpp:125:14
#14 0x555c218986c5 in main 
/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/TableGen/TableGen.cpp:84:10
#15 0x7f0373e2814f  (/lib/x86_64-linux-gnu/libc.so.6+0x2814f) (BuildId: 
6a981b07a3731293c24c10a21397416d3c3d52ed)
#16 0x7f0373e28208 in __libc_start_main 
(/lib/x86_64-linux-gnu/libc.so.6+0x28208) (BuildId: 
6a981b07a3731293c24c10a21397416d3c3d52ed)
#17 0x555c217b2cb4 in _start 
(/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/llvm-min-tblgen+0x134cb4)
0x503035b0 is located 0 bytes inside of 25-byte region 
[0x503035b0,0x503035c9)
allocated by thread T0 here:
#0 0x555c2188611d in operator new(unsigned long) 
/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/compiler-rt/lib/asan/asan_new_delete.cpp:86:3
#1 0x555c219f9c45 in __libcpp_operator_new 
/b/sanitizer-x86_64-linux-bootstrap-asan/build/libcxx_build_asan/include/c++/v1/new:270:10
#2 0x555c219f9c45 in __libcpp_allocate 
/b/sanitizer-x86_64-linux-bootstrap-asan/build/libcxx_build_asan/include/c++/v1/new:294:10
#3 0x555c219f9c45 in allocate 
/b/sanitizer-x86_64-linux-bootstrap-asan/build/libcxx_build_asan/include/c++/v1/__memory/allocator.h:119:32
#4 0x555c219f9c45 in __allocate_at_least > 
/b/sanitizer-x86_64-linux-bootstrap-asan/build/libcxx_build_asan/include/c++/v1/__memory/allocate_at_least.h:41:19
#5 0x555c219f9c45 in __init 
/b/sanitizer-x86_64-linux-bootstrap-asan/build/libcxx_build_asan/include/c++/v1/string:2228:25
#6 0x555c219f9c45 in basic_string 
/b/sanitizer-x86_64-linux-bootstrap-asan/build/libcxx_build_asan/include/c++/v1/string:1071:5
#7 0x555c219f9c45 in llvm::StringInit::getAsUnquotedString() const 
/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/include/llvm/TableGen/Record.h:736:12
#8 0x555c21a2d398 in getNameInitAsString 
/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/include/llvm/TableGen/Record.h:1718:27
#9 0x555c21a2d398 in 
llvm::TGParser::addDefOne(std::__1::unique_ptr>) 
/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/lib/TableGen/TGParser.cpp:545:42
#10 0x555c21a2bc41 in llvm::TGParser::addEntry(llvm::RecordsEntry) 
/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/lib/TableGen/TGParser.cpp:416:10
#11 0x555c21a5948e in llvm::TGParser::ParseDef(llvm::MultiClass*) 

[clang] [llvm] [clang][builtin] Implement __builtin_allow_runtime_check (PR #87568)

2024-04-16 Thread Vitaly Buka via cfe-commits

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


[clang] Revert "Improve stack usage to increase recursive initialization depth" (PR #89006)

2024-04-16 Thread Vitaly Buka via cfe-commits

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


[clang] Revert "Improve stack usage to increase recursive initialization depth" (PR #89006)

2024-04-16 Thread Vitaly Buka via cfe-commits

vitalybuka wrote:

> I would not run clang-format on the revert

Done. Reverted to github generated 1d59298

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


[clang] Revert "Improve stack usage to increase recursive initialization depth" (PR #89006)

2024-04-16 Thread Vitaly Buka via cfe-commits

https://github.com/vitalybuka updated 
https://github.com/llvm/llvm-project/pull/89006

>From 1d59298cd9ed21e1ac860d64f965514a577f45bb Mon Sep 17 00:00:00 2001
From: Vitaly Buka 
Date: Tue, 16 Apr 2024 17:23:47 -0700
Subject: [PATCH 1/2] Revert "Improve stack usage to increase recursive
 initialization depth (#88546)"

This reverts commit 4082a7554521572a65a5a0008c4661a534df659d.
---
 clang/docs/ReleaseNotes.rst   |  6 --
 clang/include/clang/Sema/Initialization.h |  6 +-
 clang/include/clang/Sema/Overload.h   | 70 +--
 clang/lib/Sema/SemaInit.cpp   | 26 -
 clang/lib/Sema/SemaOverload.cpp   | 21 ---
 5 files changed, 75 insertions(+), 54 deletions(-)

diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 4aedfafcb26aea..3752b6ce157600 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -203,12 +203,6 @@ Non-comprehensive list of changes in this release
 - ``__typeof_unqual__`` is available in all C modes as an extension, which 
behaves
   like ``typeof_unqual`` from C23, similar to ``__typeof__`` and ``typeof``.
 
-- Improved stack usage with C++ initialization code. This allows significantly
-  more levels of recursive initialization before reaching stack exhaustion
-  limits. This will positively impact recursive template instantiation code,
-  but should also reduce memory overhead for initializations in general.
-  Fixes #GH88330
-
 New Compiler Flags
 --
 - ``-fsanitize=implicit-bitfield-conversion`` checks implicit truncation and
diff --git a/clang/include/clang/Sema/Initialization.h 
b/clang/include/clang/Sema/Initialization.h
index 1ceacf0f49f568..2072cd8d1c3ef8 100644
--- a/clang/include/clang/Sema/Initialization.h
+++ b/clang/include/clang/Sema/Initialization.h
@@ -1134,7 +1134,7 @@ class InitializationSequence {
   OverloadingResult FailedOverloadResult;
 
   /// The candidate set created when initialization failed.
-  std::unique_ptr FailedCandidateSet;
+  OverloadCandidateSet FailedCandidateSet;
 
   /// The incomplete type that caused a failure.
   QualType FailedIncompleteType;
@@ -1403,9 +1403,7 @@ class InitializationSequence {
   /// Retrieve a reference to the candidate set when overload
   /// resolution fails.
   OverloadCandidateSet () {
-assert(FailedCandidateSet &&
-   "this should have been allocated in the constructor!");
-return *FailedCandidateSet;
+return FailedCandidateSet;
   }
 
   /// Get the overloading result, for when the initialization
diff --git a/clang/include/clang/Sema/Overload.h 
b/clang/include/clang/Sema/Overload.h
index e6f88bbf7c4f47..76311b00d2fc58 100644
--- a/clang/include/clang/Sema/Overload.h
+++ b/clang/include/clang/Sema/Overload.h
@@ -37,7 +37,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 
 namespace clang {
@@ -875,8 +874,7 @@ class Sema;
 ConversionFixItGenerator Fix;
 
 /// Viable - True to indicate that this overload candidate is viable.
-LLVM_PREFERRED_TYPE(bool)
-unsigned Viable : 1;
+bool Viable : 1;
 
 /// Whether this candidate is the best viable function, or tied for being
 /// the best viable function.
@@ -885,14 +883,12 @@ class Sema;
 /// was part of the ambiguity kernel: the minimal non-empty set of viable
 /// candidates such that all elements of the ambiguity kernel are better
 /// than all viable candidates not in the ambiguity kernel.
-LLVM_PREFERRED_TYPE(bool)
-unsigned Best : 1;
+bool Best : 1;
 
 /// IsSurrogate - True to indicate that this candidate is a
 /// surrogate for a conversion to a function pointer or reference
 /// (C++ [over.call.object]).
-LLVM_PREFERRED_TYPE(bool)
-unsigned IsSurrogate : 1;
+bool IsSurrogate : 1;
 
 /// IgnoreObjectArgument - True to indicate that the first
 /// argument's conversion, which for this function represents the
@@ -901,20 +897,18 @@ class Sema;
 /// implicit object argument is just a placeholder) or a
 /// non-static member function when the call doesn't have an
 /// object argument.
-LLVM_PREFERRED_TYPE(bool)
-unsigned IgnoreObjectArgument : 1;
+bool IgnoreObjectArgument : 1;
 
 /// True if the candidate was found using ADL.
-LLVM_PREFERRED_TYPE(CallExpr::ADLCallKind)
-unsigned IsADLCandidate : 1;
+CallExpr::ADLCallKind IsADLCandidate : 1;
 
 /// Whether this is a rewritten candidate, and if so, of what kind?
 LLVM_PREFERRED_TYPE(OverloadCandidateRewriteKind)
 unsigned RewriteKind : 2;
 
 /// FailureKind - The reason why this candidate is not viable.
-LLVM_PREFERRED_TYPE(OverloadFailureKind)
-unsigned FailureKind : 5;
+/// Actually an OverloadFailureKind.
+unsigned char FailureKind;
 
 /// The number of call arguments that were explicitly provided,
 /// to be used while performing partial ordering of function templates.
@@ -978,9 +972,7 @@ class Sema;
   

[clang] Improve stack usage to increase recursive initialization depth (PR #88546)

2024-04-16 Thread Vitaly Buka via cfe-commits


@@ -1163,12 +1136,7 @@ class Sema;
 ConversionSequenceList
 allocateConversionSequences(unsigned NumConversions) {
   ImplicitConversionSequence *Conversions =
-  slabAllocate(NumConversions);
-
-  // Construct the new objects.
-  for (unsigned I = 0; I != NumConversions; ++I)
-new ([I]) ImplicitConversionSequence();
-
+  new ImplicitConversionSequence[NumConversions];

vitalybuka wrote:

Seems unusual to keep ownership in ArrayRef.
Could we make ConversionSequenceList just a std::vector if it owns the memory?

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


[clang] Improve stack usage to increase recursive initialization depth (PR #88546)

2024-04-16 Thread Vitaly Buka via cfe-commits

vitalybuka wrote:

have ideas about leak, but not sure what to do with perf regression and #88330

Proposing revert https://github.com/llvm/llvm-project/pull/89006 

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


[clang] Revert "Improve stack usage to increase recursive initialization depth" (PR #89006)

2024-04-16 Thread Vitaly Buka via cfe-commits

https://github.com/vitalybuka created 
https://github.com/llvm/llvm-project/pull/89006

Reverts llvm/llvm-project#88546

Leak and performance regression.
Details in #88546

>From 1d59298cd9ed21e1ac860d64f965514a577f45bb Mon Sep 17 00:00:00 2001
From: Vitaly Buka 
Date: Tue, 16 Apr 2024 17:23:47 -0700
Subject: [PATCH] Revert "Improve stack usage to increase recursive
 initialization depth (#88546)"

This reverts commit 4082a7554521572a65a5a0008c4661a534df659d.
---
 clang/docs/ReleaseNotes.rst   |  6 --
 clang/include/clang/Sema/Initialization.h |  6 +-
 clang/include/clang/Sema/Overload.h   | 70 +--
 clang/lib/Sema/SemaInit.cpp   | 26 -
 clang/lib/Sema/SemaOverload.cpp   | 21 ---
 5 files changed, 75 insertions(+), 54 deletions(-)

diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 4aedfafcb26aea..3752b6ce157600 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -203,12 +203,6 @@ Non-comprehensive list of changes in this release
 - ``__typeof_unqual__`` is available in all C modes as an extension, which 
behaves
   like ``typeof_unqual`` from C23, similar to ``__typeof__`` and ``typeof``.
 
-- Improved stack usage with C++ initialization code. This allows significantly
-  more levels of recursive initialization before reaching stack exhaustion
-  limits. This will positively impact recursive template instantiation code,
-  but should also reduce memory overhead for initializations in general.
-  Fixes #GH88330
-
 New Compiler Flags
 --
 - ``-fsanitize=implicit-bitfield-conversion`` checks implicit truncation and
diff --git a/clang/include/clang/Sema/Initialization.h 
b/clang/include/clang/Sema/Initialization.h
index 1ceacf0f49f568..2072cd8d1c3ef8 100644
--- a/clang/include/clang/Sema/Initialization.h
+++ b/clang/include/clang/Sema/Initialization.h
@@ -1134,7 +1134,7 @@ class InitializationSequence {
   OverloadingResult FailedOverloadResult;
 
   /// The candidate set created when initialization failed.
-  std::unique_ptr FailedCandidateSet;
+  OverloadCandidateSet FailedCandidateSet;
 
   /// The incomplete type that caused a failure.
   QualType FailedIncompleteType;
@@ -1403,9 +1403,7 @@ class InitializationSequence {
   /// Retrieve a reference to the candidate set when overload
   /// resolution fails.
   OverloadCandidateSet () {
-assert(FailedCandidateSet &&
-   "this should have been allocated in the constructor!");
-return *FailedCandidateSet;
+return FailedCandidateSet;
   }
 
   /// Get the overloading result, for when the initialization
diff --git a/clang/include/clang/Sema/Overload.h 
b/clang/include/clang/Sema/Overload.h
index e6f88bbf7c4f47..76311b00d2fc58 100644
--- a/clang/include/clang/Sema/Overload.h
+++ b/clang/include/clang/Sema/Overload.h
@@ -37,7 +37,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 
 namespace clang {
@@ -875,8 +874,7 @@ class Sema;
 ConversionFixItGenerator Fix;
 
 /// Viable - True to indicate that this overload candidate is viable.
-LLVM_PREFERRED_TYPE(bool)
-unsigned Viable : 1;
+bool Viable : 1;
 
 /// Whether this candidate is the best viable function, or tied for being
 /// the best viable function.
@@ -885,14 +883,12 @@ class Sema;
 /// was part of the ambiguity kernel: the minimal non-empty set of viable
 /// candidates such that all elements of the ambiguity kernel are better
 /// than all viable candidates not in the ambiguity kernel.
-LLVM_PREFERRED_TYPE(bool)
-unsigned Best : 1;
+bool Best : 1;
 
 /// IsSurrogate - True to indicate that this candidate is a
 /// surrogate for a conversion to a function pointer or reference
 /// (C++ [over.call.object]).
-LLVM_PREFERRED_TYPE(bool)
-unsigned IsSurrogate : 1;
+bool IsSurrogate : 1;
 
 /// IgnoreObjectArgument - True to indicate that the first
 /// argument's conversion, which for this function represents the
@@ -901,20 +897,18 @@ class Sema;
 /// implicit object argument is just a placeholder) or a
 /// non-static member function when the call doesn't have an
 /// object argument.
-LLVM_PREFERRED_TYPE(bool)
-unsigned IgnoreObjectArgument : 1;
+bool IgnoreObjectArgument : 1;
 
 /// True if the candidate was found using ADL.
-LLVM_PREFERRED_TYPE(CallExpr::ADLCallKind)
-unsigned IsADLCandidate : 1;
+CallExpr::ADLCallKind IsADLCandidate : 1;
 
 /// Whether this is a rewritten candidate, and if so, of what kind?
 LLVM_PREFERRED_TYPE(OverloadCandidateRewriteKind)
 unsigned RewriteKind : 2;
 
 /// FailureKind - The reason why this candidate is not viable.
-LLVM_PREFERRED_TYPE(OverloadFailureKind)
-unsigned FailureKind : 5;
+/// Actually an OverloadFailureKind.
+unsigned char FailureKind;
 
 /// The number of call arguments that were explicitly provided,
 /// to be used while performing 

[clang] Improve stack usage to increase recursive initialization depth (PR #88546)

2024-04-16 Thread Vitaly Buka via cfe-commits

vitalybuka wrote:

A new memory leak https://lab.llvm.org/buildbot/#/builders/5/builds/42694

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


[clang] [llvm] [clang][builtin] Implement __builtin_allow_runtime_check (PR #87568)

2024-04-12 Thread Vitaly Buka via cfe-commits


@@ -3233,6 +3233,17 @@ Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, 
unsigned BuiltinID,
 if (BuiltinCountZeroBitsGeneric(*this, TheCall))
   return ExprError();
 break;
+
+  case Builtin::BI__builtin_allow_runtime_check: {
+Expr *Arg = TheCall->getArg(0);
+// Check if the argument is a string literal.
+if (!isa(Arg->IgnoreParenImpCasts())) {

vitalybuka wrote:

Resolving in favor of the longer thread above.

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


[clang] [llvm] [clang][builtin] Implement __builtin_allow_runtime_check (PR #87568)

2024-04-12 Thread Vitaly Buka via cfe-commits

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


[clang] [llvm] [clang][builtin] Implement __builtin_allow_runtime_check (PR #87568)

2024-04-12 Thread Vitaly Buka via cfe-commits

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


[clang] [llvm] [clang][builtin] Implement __builtin_allow_runtime_check (PR #87568)

2024-04-12 Thread Vitaly Buka via cfe-commits


@@ -3464,6 +3464,34 @@ Query for this feature with 
``__has_builtin(__builtin_trap)``.
 
 ``__builtin_arm_trap`` is lowered to the ``llvm.aarch64.break`` builtin, and 
then to ``brk #payload``.
 
+``__builtin_allow_runtime_check``

vitalybuka wrote:

Similar __builtin_cpu_is, also works only with literals.

The closest thing I see is c++26 `static_assert` 
https://en.cppreference.com/w/cpp/language/static_assert
And it's parsed in a weird way `EvaluateStaticAssertMessageAsString`
https://godbolt.org/z/Gcf74Ysjs

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


[clang] [llvm] [clang][builtin] Implement __builtin_allow_runtime_check (PR #87568)

2024-04-12 Thread Vitaly Buka via cfe-commits


@@ -3464,6 +3464,34 @@ Query for this feature with 
``__has_builtin(__builtin_trap)``.
 
 ``__builtin_arm_trap`` is lowered to the ``llvm.aarch64.break`` builtin, and 
then to ``brk #payload``.
 
+``__builtin_allow_runtime_check``

vitalybuka wrote:

Not sure how to do that. I would expected that from `__builtin_nan`, but it 
can't do that:
https://godbolt.org/z/hWx47Gqvn

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


[clang] [llvm] [clang][builtin] Implement __builtin_allow_runtime_check (PR #87568)

2024-04-12 Thread Vitaly Buka via cfe-commits

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


[clang] [clang][UBSan] Remove rigid metadata checks for `ubsan-bitfield-conversion` (PR #88116)

2024-04-09 Thread Vitaly Buka via cfe-commits

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


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


[clang] [compiler-rt] Fix "[clang][UBSan] Add implicit conversion check for bitfields" (PR #87761)

2024-04-08 Thread Vitaly Buka via cfe-commits

vitalybuka wrote:

ok
please paste here what ever looks like real failure from the patch
buildbot does not sent me, as I am not on the blame list

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


[clang] [compiler-rt] Fix "[clang][UBSan] Add implicit conversion check for bitfields" (PR #87761)

2024-04-08 Thread Vitaly Buka via cfe-commits

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


[clang] [compiler-rt] Fix "[clang][UBSan] Add implicit conversion check for bitfields" (PR #87761)

2024-04-08 Thread Vitaly Buka via cfe-commits

vitalybuka wrote:

I'll land after presubmit checks


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


[clang] [compiler-rt] Fix "[clang][UBSan] Add implicit conversion check for bitfields" (PR #87761)

2024-04-08 Thread Vitaly Buka via cfe-commits

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


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


[clang] [compiler-rt] Fix "[clang][UBSan] Add implicit conversion check for bitfields" (PR #87761)

2024-04-08 Thread Vitaly Buka via cfe-commits

https://github.com/vitalybuka commented:

Fail i386
```
  UBSan-AddressSanitizer-i386 :: 
TestCases/ImplicitConversion/bitfield-conversion.c
  UBSan-Standalone-i386 :: TestCases/ImplicitConversion/bitfield-conversion.c
```

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


[clang] [compiler-rt] Fix "[clang][UBSan] Add implicit conversion check for bitfields" (PR #87761)

2024-04-05 Thread Vitaly Buka via cfe-commits

vitalybuka wrote:

This is fixed version of https://github.com/llvm/llvm-project/pull/75481 ?

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


[clang] [UBSAN] Preserve ubsan code with ubsan-unique-traps (PR #83470)

2024-04-05 Thread Vitaly Buka via cfe-commits

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


[clang] [UBSAN] Preserve ubsan code with ubsan-unique-traps (PR #83470)

2024-04-05 Thread Vitaly Buka via cfe-commits

vitalybuka wrote:

abandoning

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


[clang] [UBSAN] Preserve ubsan code with ubsan-unique-traps (PR #83470)

2024-04-05 Thread Vitaly Buka via cfe-commits

vitalybuka wrote:

I changed my design, so I don't need that change as is.
Given https://godbolt.org/z/4KfEKq7zb, I can revert your patch, or just leave 
it as is. I have no preference.

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


[clang] [clang][CodeGen] Guard ubsan checks with `llvm.allow.ubsan.check` (PR #87436)

2024-04-05 Thread Vitaly Buka via cfe-commits

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


[clang] [clang][CodeGen] Guard ubsan checks with `llvm.allow.ubsan.check` (PR #87436)

2024-04-05 Thread Vitaly Buka via cfe-commits

vitalybuka wrote:

I will land, and address followup comments, if any.
It does not change behavior without -mllvm flags.

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


[clang] [llvm] [UBSAN] Rename `remove-traps` to `lower-allow-check` (PR #84853)

2024-04-04 Thread Vitaly Buka via cfe-commits

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


[clang] [llvm] [UBSAN] Rename `remove-traps` to `lower-allow-check` (PR #84853)

2024-04-04 Thread Vitaly Buka via cfe-commits

https://github.com/vitalybuka updated 
https://github.com/llvm/llvm-project/pull/84853

>From d98585586148f2084e36d06996d6c9190cec57d7 Mon Sep 17 00:00:00 2001
From: Vitaly Buka 
Date: Mon, 11 Mar 2024 16:32:06 -0700
Subject: [PATCH 1/3] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20ch?=
 =?UTF-8?q?anges=20to=20main=20this=20commit=20is=20based=20on?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.4

[skip ci]
---
 clang/lib/CodeGen/BackendUtil.cpp | 12 +--
 clang/lib/CodeGen/CGExpr.cpp  | 15 +++-
 clang/test/CodeGen/remote-traps.c | 23 -
 llvm/docs/LangRef.rst | 50 ++-
 llvm/include/llvm/IR/Intrinsics.td|  5 ++
 .../SelectionDAG/SelectionDAGBuilder.cpp  |  6 ++
 .../InstCombine/InstCombineCalls.cpp  |  8 ++
 .../Instrumentation/RemoveTrapsPass.cpp   | 26 +++---
 llvm/test/CodeGen/Generic/builtin-hot.ll  | 19 
 .../Transforms/InstCombine/builtin-hot.ll | 25 ++
 .../Transforms/RemoveTraps/remove-traps.ll| 89 +--
 11 files changed, 228 insertions(+), 50 deletions(-)
 create mode 100644 llvm/test/CodeGen/Generic/builtin-hot.ll
 create mode 100644 llvm/test/Transforms/InstCombine/builtin-hot.ll

diff --git a/clang/lib/CodeGen/BackendUtil.cpp 
b/clang/lib/CodeGen/BackendUtil.cpp
index 82b30b8d815629..7eab1c4ed44b89 100644
--- a/clang/lib/CodeGen/BackendUtil.cpp
+++ b/clang/lib/CodeGen/BackendUtil.cpp
@@ -84,7 +84,6 @@
 #include "llvm/Transforms/Scalar/EarlyCSE.h"
 #include "llvm/Transforms/Scalar/GVN.h"
 #include "llvm/Transforms/Scalar/JumpThreading.h"
-#include "llvm/Transforms/Scalar/SimplifyCFG.h"
 #include "llvm/Transforms/Utils/Debugify.h"
 #include "llvm/Transforms/Utils/EntryExitInstrumenter.h"
 #include "llvm/Transforms/Utils/ModuleUtils.h"
@@ -100,9 +99,9 @@ using namespace llvm;
 namespace llvm {
 extern cl::opt PrintPipelinePasses;
 
-cl::opt ClRemoveTraps("clang-remove-traps", cl::Optional,
-cl::desc("Insert remove-traps pass."),
-cl::init(false));
+static cl::opt ClRemoveTraps("clang-remove-traps", cl::Optional,
+   cl::desc("Insert remove-traps pass."),
+   cl::init(false));
 
 // Experiment to move sanitizers earlier.
 static cl::opt ClSanitizeOnOptimizerEarlyEP(
@@ -757,11 +756,6 @@ static void addSanitizers(const Triple ,
 // from `buildInlinerPipeline`, which called after profile matching.
 PB.registerScalarOptimizerLateEPCallback(
 [](FunctionPassManager , OptimizationLevel Level) {
-  // RemoveTrapsPass expects trap blocks preceded by conditional
-  // branches, which usually is not the case without SimplifyCFG.
-  // TODO: Remove `SimplifyCFGPass` after switching to dedicated
-  // intrinsic.
-  FPM.addPass(SimplifyCFGPass());
   FPM.addPass(RemoveTrapsPass());
 });
   }
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index 59a7fe8925001c..3a27622f165995 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/lib/CodeGen/CGExpr.cpp
@@ -56,7 +56,14 @@ using namespace CodeGen;
 // Experiment to make sanitizers easier to debug
 static llvm::cl::opt ClSanitizeDebugDeoptimization(
 "ubsan-unique-traps", llvm::cl::Optional,
-llvm::cl::desc("Deoptimize traps for UBSAN so there is 1 trap per check"),
+llvm::cl::desc("Deoptimize traps for UBSAN so there is 1 trap per check."),
+llvm::cl::init(false));
+
+// TODO: Introduce frontend options to enabled per sanitizers, similar to
+// `fsanitize-trap`.
+static llvm::cl::opt ClSanitizeExpHot(
+"ubsan-exp-hot", llvm::cl::Optional,
+llvm::cl::desc("Pass UBSAN checks if `llvm.experimental.hot()` is true."),
 llvm::cl::init(false));
 
 //======//
@@ -3805,6 +3812,12 @@ void CodeGenFunction::EmitTrapCheck(llvm::Value *Checked,
 SanitizerHandler CheckHandlerID) {
   llvm::BasicBlock *Cont = createBasicBlock("cont");
 
+  if (ClSanitizeExpHot) {
+Checked =
+Builder.CreateOr(Checked, Builder.CreateCall(CGM.getIntrinsic(
+  llvm::Intrinsic::experimental_hot)));
+  }
+
   // If we're optimizing, collapse all calls to trap down to just one per
   // check-type per function to save on code size.
   if ((int)TrapBBs.size() <= CheckHandlerID)
diff --git a/clang/test/CodeGen/remote-traps.c 
b/clang/test/CodeGen/remote-traps.c
index 6751afb96d25f2..16e4ebecb5c326 100644
--- a/clang/test/CodeGen/remote-traps.c
+++ b/clang/test/CodeGen/remote-traps.c
@@ -1,5 +1,7 @@
-// RUN: %clang_cc1 -O1 -emit-llvm -fsanitize=signed-integer-overflow 
-fsanitize-trap=signed-integer-overflow %s -o - | FileCheck %s 
-// RUN: %clang_cc1 -O1 -emit-llvm -fsanitize=signed-integer-overflow 

[clang] [llvm] [UBSAN] Rename `remove-traps` to `lower-allow-check` (PR #84853)

2024-04-04 Thread Vitaly Buka via cfe-commits

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


  1   2   3   4   5   6   7   8   >