[clang] [cindex] Add support for calling getFullyQualifiedName to the Python binding. (PR #135420)

2025-04-13 Thread Vlad Serebrennikov via cfe-commits

https://github.com/Endilll commented:

LGTM

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


[clang] clang/AMDGPU: Stop looking for oclc_daz_opt_* control libraries (PR #134805)

2025-04-13 Thread LLVM Continuous Integration via cfe-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `clang-hip-vega20` running 
on `hip-vega20-0` while building `clang` at step 3 "annotate".

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


Here is the relevant piece of the build log for the reference

```
Step 3 (annotate) failure: 
'../llvm-zorg/zorg/buildbot/builders/annotated/hip-build.sh --jobs=' (failure)
...
[36/38] Linking CXX executable External/HIP/memmove-hip-6.3.0
[37/38] Building CXX object 
External/HIP/CMakeFiles/TheNextWeek-hip-6.3.0.dir/workload/ray-tracing/TheNextWeek/main.cc.o
[38/38] Linking CXX executable External/HIP/TheNextWeek-hip-6.3.0
+ build_step 'Testing HIP test-suite'
+ echo '@@@BUILD_STEP Testing HIP test-suite@@@'
+ ninja check-hip-simple
@@@BUILD_STEP Testing HIP test-suite@@@
[0/1] cd 
/home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/test-suite-build/External/HIP
 && 
/home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/bin/llvm-lit
 -sv empty-hip-6.3.0.test with-fopenmp-hip-6.3.0.test saxpy-hip-6.3.0.test 
memmove-hip-6.3.0.test TheNextWeek-hip-6.3.0.test blender.test
-- Testing: 6 tests, 6 workers --
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80
FAIL: test-suite :: External/HIP/blender.test (6 of 6)
 TEST 'test-suite :: External/HIP/blender.test' FAILED 


/home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/test-suite-build/tools/timeit-target
 --timeout 7200 --limit-core 0 --limit-cpu 7200 --limit-file-size 209715200 
--limit-rss-size 838860800 --append-exitstatus --redirect-output 
/home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/test-suite-build/External/HIP/Output/blender.test.out
 --redirect-input /dev/null --summary 
/home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/test-suite-build/External/HIP/Output/blender.test.time
 /bin/bash test_blender.sh
/bin/bash verify_blender.sh 
/home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/test-suite-build/External/HIP/Output/blender.test.out
Begin Blender test.
TEST_SUITE_HIP_ROOT=/opt/botworker/llvm/External/hip
Render /opt/botworker/llvm/External/hip/Blender_Scenes/290skydemo_release.blend
Blender 4.1.1 (hash e1743a0317bc built 2024-04-15 23:47:45)
Read blend: 
"/opt/botworker/llvm/External/hip/Blender_Scenes/290skydemo_release.blend"
Could not open as Ogawa file from provided streams.
Unable to open 
/opt/botworker/llvm/External/hip/Blender_Scenes/290skydemo2_flags.abc
WARN (bke.modifier): source/blender/blenkernel/intern/modifier.cc:425 
BKE_modifier_set_error: Object: "GEO-flag.004", Modifier: "MeshSequenceCache", 
Could not create reader for file //290skydemo2_flags.abc
WARN (bke.modifier): source/blender/blenkernel/intern/modifier.cc:425 
BKE_modifier_set_error: Object: "GEO-flag.003", Modifier: "MeshSequenceCache", 
Could not create reader for file //290skydemo2_flags.abc
WARN (bke.modifier): source/blender/blenkernel/intern/modifier.cc:425 
BKE_modifier_set_error: Object: "GEO-flag", Modifier: "MeshSequenceCache", 
Could not create reader for file //290skydemo2_flags.abc
WARN (bke.modifier): source/blender/blenkernel/intern/modifier.cc:425 
BKE_modifier_set_error: Object: "GEO-flag.001", Modifier: "MeshSequenceCache", 
Could not create reader for file //290skydemo2_flags.abc
WARN (bke.modifier): source/blender/blenkernel/intern/modifier.cc:425 
BKE_modifier_set_error: Object: "GEO-flag.002", Modifier: "MeshSequenceCache", 
Could not create reader for file //290skydemo2_flags.abc
Could not open as Ogawa file from provided streams.
Unable to open 
/opt/botworker/llvm/External/hip/Blender_Scenes/290skydemo2_flags.abc
WARN (bke.modifier): source/blender/blenkernel/intern/modifier.cc:425 
BKE_modifier_set_error: Object: "GEO-flag.002", Modifier: "MeshSequenceCache", 
Could not create reader for file //290skydemo2_flags.abc
WARN (bke.modifier): source/blender/blenkernel/intern/modifier.cc:425 
BKE_modifier_set_error: Object: "GEO-flag.003", Modifier: "MeshSequenceCache", 
Could not create reader for file //290skydemo2_flags.abc
WARN (bke.modifier): source/blender/blenkernel/intern/modifier.cc:425 
BKE_modifier_set_error: Object: "GEO-flag", Modifier: "MeshSequenceCache", 
Could not create reader for file //290skydemo2_flags.abc
WARN (bke.modifier): source/blender/blenkernel/intern/modifier.cc:425 
BKE_modifier_set_error: Object: "GEO-flag.004", Modifier: "MeshSequenceCache", 
Could not create reader for file //290skydemo2_flags.abc
WARN (bke.modifier): source/blender/blenkernel/intern/modifier.cc:425 
BKE_modifier_set_error: Object: "GEO-flag.001", Modifier: "MeshSequenceCache", 
Could not create reader for file //290skydemo2_flags.abc
I0413 07:52:48.786754 1865707 device.cpp:39] HIPEW initialization succeeded
I0413 07:52:48.790038 1865707 device.cpp:45] Found HIPCC hipcc
I0413 07:52:48.848189 1865707 device.cpp:207] Device has compute preemption or 
is not used for display.
I041

[clang] clang/AMDGPU: Stop looking for oclc_daz_opt_* control libraries (PR #134805)

2025-04-13 Thread LLVM Continuous Integration via cfe-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder 
`openmp-offload-sles-build-only` running on `rocm-worker-hw-04-sles` while 
building `clang` at step 7 "Add check check-flang".

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


Here is the relevant piece of the build log for the reference

```
Step 7 (Add check check-flang) failure: test (failure)
 TEST 'Flang :: Driver/omp-driver-offload.f90' FAILED 

Exit Code: 1

Command Output (stderr):
--
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/bin/flang -### 
-fopenmp 
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/flang/test/Driver/omp-driver-offload.f90
 2>&1 | 
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/bin/FileCheck 
--check-prefixes=CHECK-OPENMP 
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/flang/test/Driver/omp-driver-offload.f90
 # RUN: at line 10
+ /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/bin/flang 
-### -fopenmp 
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/flang/test/Driver/omp-driver-offload.f90
+ 
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/bin/FileCheck 
--check-prefixes=CHECK-OPENMP 
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/flang/test/Driver/omp-driver-offload.f90
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/bin/flang -S 
-### 
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/flang/test/Driver/omp-driver-offload.f90
 -o 
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/tools/flang/test/Driver/Output/omp-driver-offload.f90.tmp
 2>&1  -fopenmp --offload-arch=gfx90a --offload-arch=sm_70  
--target=aarch64-unknown-linux-gnu -nogpulib   | 
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/bin/FileCheck 
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/flang/test/Driver/omp-driver-offload.f90
 --check-prefix=OFFLOAD-HOST-AND-DEVICE # RUN: at line 15
+ 
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/bin/FileCheck 
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/flang/test/Driver/omp-driver-offload.f90
 --check-prefix=OFFLOAD-HOST-AND-DEVICE
+ /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/bin/flang -S 
-### 
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/flang/test/Driver/omp-driver-offload.f90
 -o 
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/tools/flang/test/Driver/Output/omp-driver-offload.f90.tmp
 -fopenmp --offload-arch=gfx90a --offload-arch=sm_70 
--target=aarch64-unknown-linux-gnu -nogpulib
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/bin/flang -S 
-### 
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/flang/test/Driver/omp-driver-offload.f90
 -o 
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/tools/flang/test/Driver/Output/omp-driver-offload.f90.tmp
 2>&1  -fopenmp --offload-arch=gfx90a --offload-arch=sm_70 
--offload-host-device  --target=aarch64-unknown-linux-gnu -nogpulib   | 
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/bin/FileCheck 
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/flang/test/Driver/omp-driver-offload.f90
 --check-prefix=OFFLOAD-HOST-AND-DEVICE # RUN: at line 20
+ /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/bin/flang -S 
-### 
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/flang/test/Driver/omp-driver-offload.f90
 -o 
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/tools/flang/test/Driver/Output/omp-driver-offload.f90.tmp
 -fopenmp --offload-arch=gfx90a --offload-arch=sm_70 --offload-host-device 
--target=aarch64-unknown-linux-gnu -nogpulib
+ 
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/bin/FileCheck 
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/flang/test/Driver/omp-driver-offload.f90
 --check-prefix=OFFLOAD-HOST-AND-DEVICE
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/bin/flang -S 
-### 
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/flang/test/Driver/omp-driver-offload.f90
 -o 
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/tools/flang/test/Driver/Output/omp-driver-offload.f90.tmp
 2>&1  -fopenmp --offload-arch=gfx90a --offload-arch=sm_70 --offload-host-only  
--target=aarch64-unknown-linux-gnu -nogpulib   | 
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/bin/FileCheck 
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/flang/test/Driver/omp-driver-offload.f90
 --check-prefix=OFFLOAD-HOST # RUN: at line 30
+ /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/bin/flang -S 
-### 
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/flang/test/Driver/omp-driver-offload.f90
 -o 
/home/botworker/bbot/builds/openmp-offload-sle

[clang] clang/AMDGPU: Stop looking for oclc_daz_opt_* control libraries (PR #134805)

2025-04-13 Thread LLVM Continuous Integration via cfe-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `flang-x86_64-windows` 
running on `minipc-ryzen-win` while building `clang` at step 7 
"test-build-unified-tree-check-flang".

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


Here is the relevant piece of the build log for the reference

```
Step 7 (test-build-unified-tree-check-flang) failure: test (failure)
 TEST 'Flang :: Driver/omp-driver-offload.f90' FAILED 

Exit Code: 1

Command Output (stdout):
--
# RUN: at line 10
c:\buildbot\flang-x86_64-windows\build\bin\flang.exe -### -fopenmp 
C:\buildbot\flang-x86_64-windows\llvm-project\flang\test\Driver\omp-driver-offload.f90
 2>&1 | c:\buildbot\flang-x86_64-windows\build\bin\filecheck.exe 
--check-prefixes=CHECK-OPENMP 
C:\buildbot\flang-x86_64-windows\llvm-project\flang\test\Driver\omp-driver-offload.f90
# executed command: 'c:\buildbot\flang-x86_64-windows\build\bin\flang.exe' 
'-###' -fopenmp 
'C:\buildbot\flang-x86_64-windows\llvm-project\flang\test\Driver\omp-driver-offload.f90'
# executed command: 'c:\buildbot\flang-x86_64-windows\build\bin\filecheck.exe' 
--check-prefixes=CHECK-OPENMP 
'C:\buildbot\flang-x86_64-windows\llvm-project\flang\test\Driver\omp-driver-offload.f90'
# RUN: at line 15
c:\buildbot\flang-x86_64-windows\build\bin\flang.exe -S -### 
C:\buildbot\flang-x86_64-windows\llvm-project\flang\test\Driver\omp-driver-offload.f90
 -o 
C:\buildbot\flang-x86_64-windows\build\tools\flang\test\Driver\Output\omp-driver-offload.f90.tmp
 2>&1  -fopenmp --offload-arch=gfx90a --offload-arch=sm_70  
--target=aarch64-unknown-linux-gnu -nogpulib   | 
c:\buildbot\flang-x86_64-windows\build\bin\filecheck.exe 
C:\buildbot\flang-x86_64-windows\llvm-project\flang\test\Driver\omp-driver-offload.f90
 --check-prefix=OFFLOAD-HOST-AND-DEVICE
# executed command: 'c:\buildbot\flang-x86_64-windows\build\bin\flang.exe' -S 
'-###' 
'C:\buildbot\flang-x86_64-windows\llvm-project\flang\test\Driver\omp-driver-offload.f90'
 -o 
'C:\buildbot\flang-x86_64-windows\build\tools\flang\test\Driver\Output\omp-driver-offload.f90.tmp'
 -fopenmp --offload-arch=gfx90a --offload-arch=sm_70 
--target=aarch64-unknown-linux-gnu -nogpulib
# executed command: 'c:\buildbot\flang-x86_64-windows\build\bin\filecheck.exe' 
'C:\buildbot\flang-x86_64-windows\llvm-project\flang\test\Driver\omp-driver-offload.f90'
 --check-prefix=OFFLOAD-HOST-AND-DEVICE
# RUN: at line 20
c:\buildbot\flang-x86_64-windows\build\bin\flang.exe -S -### 
C:\buildbot\flang-x86_64-windows\llvm-project\flang\test\Driver\omp-driver-offload.f90
 -o 
C:\buildbot\flang-x86_64-windows\build\tools\flang\test\Driver\Output\omp-driver-offload.f90.tmp
 2>&1  -fopenmp --offload-arch=gfx90a --offload-arch=sm_70 
--offload-host-device  --target=aarch64-unknown-linux-gnu -nogpulib   | 
c:\buildbot\flang-x86_64-windows\build\bin\filecheck.exe 
C:\buildbot\flang-x86_64-windows\llvm-project\flang\test\Driver\omp-driver-offload.f90
 --check-prefix=OFFLOAD-HOST-AND-DEVICE
# executed command: 'c:\buildbot\flang-x86_64-windows\build\bin\flang.exe' -S 
'-###' 
'C:\buildbot\flang-x86_64-windows\llvm-project\flang\test\Driver\omp-driver-offload.f90'
 -o 
'C:\buildbot\flang-x86_64-windows\build\tools\flang\test\Driver\Output\omp-driver-offload.f90.tmp'
 -fopenmp --offload-arch=gfx90a --offload-arch=sm_70 --offload-host-device 
--target=aarch64-unknown-linux-gnu -nogpulib
# executed command: 'c:\buildbot\flang-x86_64-windows\build\bin\filecheck.exe' 
'C:\buildbot\flang-x86_64-windows\llvm-project\flang\test\Driver\omp-driver-offload.f90'
 --check-prefix=OFFLOAD-HOST-AND-DEVICE
# RUN: at line 30
c:\buildbot\flang-x86_64-windows\build\bin\flang.exe -S -### 
C:\buildbot\flang-x86_64-windows\llvm-project\flang\test\Driver\omp-driver-offload.f90
 -o 
C:\buildbot\flang-x86_64-windows\build\tools\flang\test\Driver\Output\omp-driver-offload.f90.tmp
 2>&1  -fopenmp --offload-arch=gfx90a --offload-arch=sm_70 --offload-host-only  
--target=aarch64-unknown-linux-gnu -nogpulib   | 
c:\buildbot\flang-x86_64-windows\build\bin\filecheck.exe 
C:\buildbot\flang-x86_64-windows\llvm-project\flang\test\Driver\omp-driver-offload.f90
 --check-prefix=OFFLOAD-HOST
# executed command: 'c:\buildbot\flang-x86_64-windows\build\bin\flang.exe' -S 
'-###' 
'C:\buildbot\flang-x86_64-windows\llvm-project\flang\test\Driver\omp-driver-offload.f90'
 -o 
'C:\buildbot\flang-x86_64-windows\build\tools\flang\test\Driver\Output\omp-driver-offload.f90.tmp'
 -fopenmp --offload-arch=gfx90a --offload-arch=sm_70 --offload-host-only 
--target=aarch64-unknown-linux-gnu -nogpulib
# executed command: 'c:\buildbot\flang-x86_64-windows\build\bin\filecheck.exe' 
'C:\buildbot\flang-x86_64-windows\llvm-project\flang\test\Driver\omp-driver-offload.f90'
 --check-prefix=OFFLOAD-HOST
# RUN: at line 40
c:\buildbot\flang-x86_64-windows\build\bin\flang.exe -S -### 
C:\buildbot\flang-x86_64-windows\llvm-project\flang\test\Driver\omp-driver-offload.f90
 2>&1  -fop

[clang] clang/AMDGPU: Stop looking for oclc_daz_opt_* control libraries (PR #134805)

2025-04-13 Thread LLVM Continuous Integration via cfe-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `ppc64le-flang-rhel-clang` 
running on `ppc64le-flang-rhel-test` while building `clang` at step 6 
"test-build-unified-tree-check-flang".

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


Here is the relevant piece of the build log for the reference

```
Step 6 (test-build-unified-tree-check-flang) failure: test (failure)
 TEST 'Flang :: Driver/omp-driver-offload.f90' FAILED 

Exit Code: 1

Command Output (stderr):
--
/home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/build/bin/flang
 -### -fopenmp 
/home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/flang/test/Driver/omp-driver-offload.f90
 2>&1 | 
/home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/build/bin/FileCheck
 --check-prefixes=CHECK-OPENMP 
/home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/flang/test/Driver/omp-driver-offload.f90
 # RUN: at line 10
+ 
/home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/build/bin/flang
 -### -fopenmp 
/home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/flang/test/Driver/omp-driver-offload.f90
+ 
/home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/build/bin/FileCheck
 --check-prefixes=CHECK-OPENMP 
/home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/flang/test/Driver/omp-driver-offload.f90
/home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/build/bin/flang
 -S -### 
/home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/flang/test/Driver/omp-driver-offload.f90
 -o 
/home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/build/tools/flang/test/Driver/Output/omp-driver-offload.f90.tmp
 2>&1  -fopenmp --offload-arch=gfx90a --offload-arch=sm_70  
--target=aarch64-unknown-linux-gnu -nogpulib   | 
/home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/build/bin/FileCheck
 
/home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/flang/test/Driver/omp-driver-offload.f90
 --check-prefix=OFFLOAD-HOST-AND-DEVICE # RUN: at line 15
+ 
/home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/build/bin/flang
 -S -### 
/home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/flang/test/Driver/omp-driver-offload.f90
 -o 
/home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/build/tools/flang/test/Driver/Output/omp-driver-offload.f90.tmp
 -fopenmp --offload-arch=gfx90a --offload-arch=sm_70 
--target=aarch64-unknown-linux-gnu -nogpulib
+ 
/home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/build/bin/FileCheck
 
/home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/flang/test/Driver/omp-driver-offload.f90
 --check-prefix=OFFLOAD-HOST-AND-DEVICE
/home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/build/bin/flang
 -S -### 
/home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/flang/test/Driver/omp-driver-offload.f90
 -o 
/home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/build/tools/flang/test/Driver/Output/omp-driver-offload.f90.tmp
 2>&1  -fopenmp --offload-arch=gfx90a --offload-arch=sm_70 
--offload-host-device  --target=aarch64-unknown-linux-gnu -nogpulib   | 
/home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/build/bin/FileCheck
 
/home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/flang/test/Driver/omp-driver-offload.f90
 --check-prefix=OFFLOAD-HOST-AND-DEVICE # RUN: at line 20
+ 
/home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/build/bin/flang
 -S -### 
/home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/flang/test/Driver/omp-driver-offload.f90
 -o 
/home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/build/tools/flang/test/Driver/Output/omp-driver-offload.f90.t

[clang] clang/AMDGPU: Stop looking for oclc_daz_opt_* control libraries (PR #134805)

2025-04-13 Thread LLVM Continuous Integration via cfe-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `ppc64-flang-aix` running 
on `ppc64-flang-aix-test` while building `clang` at step 6 
"test-build-unified-tree-check-flang".

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


Here is the relevant piece of the build log for the reference

```
Step 6 (test-build-unified-tree-check-flang) failure: test (failure)
 TEST 'Flang :: Driver/omp-driver-offload.f90' FAILED 

Exit Code: 1

Command Output (stderr):
--
/home/llvm/llvm-external-buildbots/workers/ppc64-flang-aix-test/ppc64-flang-aix-build/build/bin/flang
 -### -fopenmp 
/home/llvm/llvm-external-buildbots/workers/ppc64-flang-aix-test/ppc64-flang-aix-build/llvm-project/flang/test/Driver/omp-driver-offload.f90
 2>&1 | 
/home/llvm/llvm-external-buildbots/workers/ppc64-flang-aix-test/ppc64-flang-aix-build/build/bin/FileCheck
 --check-prefixes=CHECK-OPENMP 
/home/llvm/llvm-external-buildbots/workers/ppc64-flang-aix-test/ppc64-flang-aix-build/llvm-project/flang/test/Driver/omp-driver-offload.f90
 # RUN: at line 10
+ 
/home/llvm/llvm-external-buildbots/workers/ppc64-flang-aix-test/ppc64-flang-aix-build/build/bin/flang
 -### -fopenmp 
/home/llvm/llvm-external-buildbots/workers/ppc64-flang-aix-test/ppc64-flang-aix-build/llvm-project/flang/test/Driver/omp-driver-offload.f90
+ 
/home/llvm/llvm-external-buildbots/workers/ppc64-flang-aix-test/ppc64-flang-aix-build/build/bin/FileCheck
 --check-prefixes=CHECK-OPENMP 
/home/llvm/llvm-external-buildbots/workers/ppc64-flang-aix-test/ppc64-flang-aix-build/llvm-project/flang/test/Driver/omp-driver-offload.f90
/home/llvm/llvm-external-buildbots/workers/ppc64-flang-aix-test/ppc64-flang-aix-build/build/bin/flang
 -S -### 
/home/llvm/llvm-external-buildbots/workers/ppc64-flang-aix-test/ppc64-flang-aix-build/llvm-project/flang/test/Driver/omp-driver-offload.f90
 -o 
/home/llvm/llvm-external-buildbots/workers/ppc64-flang-aix-test/ppc64-flang-aix-build/build/tools/flang/test/Driver/Output/omp-driver-offload.f90.tmp
 2>&1  -fopenmp --offload-arch=gfx90a --offload-arch=sm_70  
--target=aarch64-unknown-linux-gnu -nogpulib   | 
/home/llvm/llvm-external-buildbots/workers/ppc64-flang-aix-test/ppc64-flang-aix-build/build/bin/FileCheck
 
/home/llvm/llvm-external-buildbots/workers/ppc64-flang-aix-test/ppc64-flang-aix-build/llvm-project/flang/test/Driver/omp-driver-offload.f90
 --check-prefix=OFFLOAD-HOST-AND-DEVICE # RUN: at line 15
+ 
/home/llvm/llvm-external-buildbots/workers/ppc64-flang-aix-test/ppc64-flang-aix-build/build/bin/flang
 -S -### 
/home/llvm/llvm-external-buildbots/workers/ppc64-flang-aix-test/ppc64-flang-aix-build/llvm-project/flang/test/Driver/omp-driver-offload.f90
 -o 
/home/llvm/llvm-external-buildbots/workers/ppc64-flang-aix-test/ppc64-flang-aix-build/build/tools/flang/test/Driver/Output/omp-driver-offload.f90.tmp
 -fopenmp --offload-arch=gfx90a --offload-arch=sm_70 
--target=aarch64-unknown-linux-gnu -nogpulib
+ 
/home/llvm/llvm-external-buildbots/workers/ppc64-flang-aix-test/ppc64-flang-aix-build/build/bin/FileCheck
 
/home/llvm/llvm-external-buildbots/workers/ppc64-flang-aix-test/ppc64-flang-aix-build/llvm-project/flang/test/Driver/omp-driver-offload.f90
 --check-prefix=OFFLOAD-HOST-AND-DEVICE
/home/llvm/llvm-external-buildbots/workers/ppc64-flang-aix-test/ppc64-flang-aix-build/build/bin/flang
 -S -### 
/home/llvm/llvm-external-buildbots/workers/ppc64-flang-aix-test/ppc64-flang-aix-build/llvm-project/flang/test/Driver/omp-driver-offload.f90
 -o 
/home/llvm/llvm-external-buildbots/workers/ppc64-flang-aix-test/ppc64-flang-aix-build/build/tools/flang/test/Driver/Output/omp-driver-offload.f90.tmp
 2>&1  -fopenmp --offload-arch=gfx90a --offload-arch=sm_70 
--offload-host-device  --target=aarch64-unknown-linux-gnu -nogpulib   | 
/home/llvm/llvm-external-buildbots/workers/ppc64-flang-aix-test/ppc64-flang-aix-build/build/bin/FileCheck
 
/home/llvm/llvm-external-buildbots/workers/ppc64-flang-aix-test/ppc64-flang-aix-build/llvm-project/flang/test/Driver/omp-driver-offload.f90
 --check-prefix=OFFLOAD-HOST-AND-DEVICE # RUN: at line 20
+ 
/home/llvm/llvm-external-buildbots/workers/ppc64-flang-aix-test/ppc64-flang-aix-build/build/bin/flang
 -S -### 
/home/llvm/llvm-external-buildbots/workers/ppc64-flang-aix-test/ppc64-flang-aix-build/llvm-project/flang/test/Driver/omp-driver-offload.f90
 -o 
/home/llvm/llvm-external-buildbots/workers/ppc64-flang-aix-test/ppc64-flang-aix-build/build/tools/flang/test/Driver/Output/omp-driver-offload.f90.tmp
 -fopenmp --offload-arch=gfx90a --offload-arch=sm_70 --offload-host-device 
--target=aarch64-unknown-linux-gnu -nogpulib
+ 
/home/llvm/llvm-external-buildbots/workers/ppc64-flang-aix-test/ppc64-flang-aix-build/build/bin/FileCheck
 
/home/llvm/llvm-external-buildbots/workers/ppc64-flang-aix-test/ppc64-flang-aix-build/llvm-project/flang/test/Driver/omp-driver-offload.f90
 --check-prefix=OFFLOAD-HOST-AND-DEVICE
/home/llvm/llvm-external-buildbots/worke

[clang] clang/AMDGPU: Stop looking for oclc_daz_opt_* control libraries (PR #134805)

2025-04-13 Thread LLVM Continuous Integration via cfe-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `flang-aarch64-rel-assert` 
running on `linaro-flang-aarch64-rel-assert` while building `clang` at step 6 
"test-build-unified-tree-check-flang".

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


Here is the relevant piece of the build log for the reference

```
Step 6 (test-build-unified-tree-check-flang) failure: test (failure)
 TEST 'Flang :: Driver/omp-driver-offload.f90' FAILED 

Exit Code: 1

Command Output (stderr):
--
/home/tcwg-buildbot/worker/flang-aarch64-rel-assert/build/bin/flang -### 
-fopenmp 
/home/tcwg-buildbot/worker/flang-aarch64-rel-assert/llvm-project/flang/test/Driver/omp-driver-offload.f90
 2>&1 | /home/tcwg-buildbot/worker/flang-aarch64-rel-assert/build/bin/FileCheck 
--check-prefixes=CHECK-OPENMP 
/home/tcwg-buildbot/worker/flang-aarch64-rel-assert/llvm-project/flang/test/Driver/omp-driver-offload.f90
 # RUN: at line 10
+ /home/tcwg-buildbot/worker/flang-aarch64-rel-assert/build/bin/FileCheck 
--check-prefixes=CHECK-OPENMP 
/home/tcwg-buildbot/worker/flang-aarch64-rel-assert/llvm-project/flang/test/Driver/omp-driver-offload.f90
+ /home/tcwg-buildbot/worker/flang-aarch64-rel-assert/build/bin/flang -### 
-fopenmp 
/home/tcwg-buildbot/worker/flang-aarch64-rel-assert/llvm-project/flang/test/Driver/omp-driver-offload.f90
/home/tcwg-buildbot/worker/flang-aarch64-rel-assert/build/bin/flang -S -### 
/home/tcwg-buildbot/worker/flang-aarch64-rel-assert/llvm-project/flang/test/Driver/omp-driver-offload.f90
 -o 
/home/tcwg-buildbot/worker/flang-aarch64-rel-assert/build/tools/flang/test/Driver/Output/omp-driver-offload.f90.tmp
 2>&1  -fopenmp --offload-arch=gfx90a --offload-arch=sm_70  
--target=aarch64-unknown-linux-gnu -nogpulib   | 
/home/tcwg-buildbot/worker/flang-aarch64-rel-assert/build/bin/FileCheck 
/home/tcwg-buildbot/worker/flang-aarch64-rel-assert/llvm-project/flang/test/Driver/omp-driver-offload.f90
 --check-prefix=OFFLOAD-HOST-AND-DEVICE # RUN: at line 15
+ /home/tcwg-buildbot/worker/flang-aarch64-rel-assert/build/bin/flang -S -### 
/home/tcwg-buildbot/worker/flang-aarch64-rel-assert/llvm-project/flang/test/Driver/omp-driver-offload.f90
 -o 
/home/tcwg-buildbot/worker/flang-aarch64-rel-assert/build/tools/flang/test/Driver/Output/omp-driver-offload.f90.tmp
 -fopenmp --offload-arch=gfx90a --offload-arch=sm_70 
--target=aarch64-unknown-linux-gnu -nogpulib
+ /home/tcwg-buildbot/worker/flang-aarch64-rel-assert/build/bin/FileCheck 
/home/tcwg-buildbot/worker/flang-aarch64-rel-assert/llvm-project/flang/test/Driver/omp-driver-offload.f90
 --check-prefix=OFFLOAD-HOST-AND-DEVICE
/home/tcwg-buildbot/worker/flang-aarch64-rel-assert/build/bin/flang -S -### 
/home/tcwg-buildbot/worker/flang-aarch64-rel-assert/llvm-project/flang/test/Driver/omp-driver-offload.f90
 -o 
/home/tcwg-buildbot/worker/flang-aarch64-rel-assert/build/tools/flang/test/Driver/Output/omp-driver-offload.f90.tmp
 2>&1  -fopenmp --offload-arch=gfx90a --offload-arch=sm_70 
--offload-host-device  --target=aarch64-unknown-linux-gnu -nogpulib   | 
/home/tcwg-buildbot/worker/flang-aarch64-rel-assert/build/bin/FileCheck 
/home/tcwg-buildbot/worker/flang-aarch64-rel-assert/llvm-project/flang/test/Driver/omp-driver-offload.f90
 --check-prefix=OFFLOAD-HOST-AND-DEVICE # RUN: at line 20
+ /home/tcwg-buildbot/worker/flang-aarch64-rel-assert/build/bin/FileCheck 
/home/tcwg-buildbot/worker/flang-aarch64-rel-assert/llvm-project/flang/test/Driver/omp-driver-offload.f90
 --check-prefix=OFFLOAD-HOST-AND-DEVICE
+ /home/tcwg-buildbot/worker/flang-aarch64-rel-assert/build/bin/flang -S -### 
/home/tcwg-buildbot/worker/flang-aarch64-rel-assert/llvm-project/flang/test/Driver/omp-driver-offload.f90
 -o 
/home/tcwg-buildbot/worker/flang-aarch64-rel-assert/build/tools/flang/test/Driver/Output/omp-driver-offload.f90.tmp
 -fopenmp --offload-arch=gfx90a --offload-arch=sm_70 --offload-host-device 
--target=aarch64-unknown-linux-gnu -nogpulib
/home/tcwg-buildbot/worker/flang-aarch64-rel-assert/build/bin/flang -S -### 
/home/tcwg-buildbot/worker/flang-aarch64-rel-assert/llvm-project/flang/test/Driver/omp-driver-offload.f90
 -o 
/home/tcwg-buildbot/worker/flang-aarch64-rel-assert/build/tools/flang/test/Driver/Output/omp-driver-offload.f90.tmp
 2>&1  -fopenmp --offload-arch=gfx90a --offload-arch=sm_70 --offload-host-only  
--target=aarch64-unknown-linux-gnu -nogpulib   | 
/home/tcwg-buildbot/worker/flang-aarch64-rel-assert/build/bin/FileCheck 
/home/tcwg-buildbot/worker/flang-aarch64-rel-assert/llvm-project/flang/test/Driver/omp-driver-offload.f90
 --check-prefix=OFFLOAD-HOST # RUN: at line 30
+ /home/tcwg-buildbot/worker/flang-aarch64-rel-assert/build/bin/flang -S -### 
/home/tcwg-buildbot/worker/flang-aarch64-rel-assert/llvm-project/flang/test/Driver/omp-driver-offload.f90
 -o 
/home/tcwg-buildbot/worker/flang-aarch64-rel-assert/build/tools/flang/test/Driver/Output/omp-driver-offload.f90.tmp
 -fopenmp --offload-

[clang] clang/AMDGPU: Stop looking for oclc_daz_opt_* control libraries (PR #134805)

2025-04-13 Thread LLVM Continuous Integration via cfe-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `flang-aarch64-dylib` 
running on `linaro-flang-aarch64-dylib` while building `clang` at step 6 
"test-build-unified-tree-check-flang".

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


Here is the relevant piece of the build log for the reference

```
Step 6 (test-build-unified-tree-check-flang) failure: test (failure)
 TEST 'Flang :: Driver/omp-driver-offload.f90' FAILED 

Exit Code: 1

Command Output (stderr):
--
/home/tcwg-buildbot/worker/flang-aarch64-dylib/build/bin/flang -### -fopenmp 
/home/tcwg-buildbot/worker/flang-aarch64-dylib/llvm-project/flang/test/Driver/omp-driver-offload.f90
 2>&1 | /home/tcwg-buildbot/worker/flang-aarch64-dylib/build/bin/FileCheck 
--check-prefixes=CHECK-OPENMP 
/home/tcwg-buildbot/worker/flang-aarch64-dylib/llvm-project/flang/test/Driver/omp-driver-offload.f90
 # RUN: at line 10
+ /home/tcwg-buildbot/worker/flang-aarch64-dylib/build/bin/flang -### -fopenmp 
/home/tcwg-buildbot/worker/flang-aarch64-dylib/llvm-project/flang/test/Driver/omp-driver-offload.f90
+ /home/tcwg-buildbot/worker/flang-aarch64-dylib/build/bin/FileCheck 
--check-prefixes=CHECK-OPENMP 
/home/tcwg-buildbot/worker/flang-aarch64-dylib/llvm-project/flang/test/Driver/omp-driver-offload.f90
/home/tcwg-buildbot/worker/flang-aarch64-dylib/build/bin/flang -S -### 
/home/tcwg-buildbot/worker/flang-aarch64-dylib/llvm-project/flang/test/Driver/omp-driver-offload.f90
 -o 
/home/tcwg-buildbot/worker/flang-aarch64-dylib/build/tools/flang/test/Driver/Output/omp-driver-offload.f90.tmp
 2>&1  -fopenmp --offload-arch=gfx90a --offload-arch=sm_70  
--target=aarch64-unknown-linux-gnu -nogpulib   | 
/home/tcwg-buildbot/worker/flang-aarch64-dylib/build/bin/FileCheck 
/home/tcwg-buildbot/worker/flang-aarch64-dylib/llvm-project/flang/test/Driver/omp-driver-offload.f90
 --check-prefix=OFFLOAD-HOST-AND-DEVICE # RUN: at line 15
+ /home/tcwg-buildbot/worker/flang-aarch64-dylib/build/bin/flang -S -### 
/home/tcwg-buildbot/worker/flang-aarch64-dylib/llvm-project/flang/test/Driver/omp-driver-offload.f90
 -o 
/home/tcwg-buildbot/worker/flang-aarch64-dylib/build/tools/flang/test/Driver/Output/omp-driver-offload.f90.tmp
 -fopenmp --offload-arch=gfx90a --offload-arch=sm_70 
--target=aarch64-unknown-linux-gnu -nogpulib
+ /home/tcwg-buildbot/worker/flang-aarch64-dylib/build/bin/FileCheck 
/home/tcwg-buildbot/worker/flang-aarch64-dylib/llvm-project/flang/test/Driver/omp-driver-offload.f90
 --check-prefix=OFFLOAD-HOST-AND-DEVICE
/home/tcwg-buildbot/worker/flang-aarch64-dylib/build/bin/flang -S -### 
/home/tcwg-buildbot/worker/flang-aarch64-dylib/llvm-project/flang/test/Driver/omp-driver-offload.f90
 -o 
/home/tcwg-buildbot/worker/flang-aarch64-dylib/build/tools/flang/test/Driver/Output/omp-driver-offload.f90.tmp
 2>&1  -fopenmp --offload-arch=gfx90a --offload-arch=sm_70 
--offload-host-device  --target=aarch64-unknown-linux-gnu -nogpulib   | 
/home/tcwg-buildbot/worker/flang-aarch64-dylib/build/bin/FileCheck 
/home/tcwg-buildbot/worker/flang-aarch64-dylib/llvm-project/flang/test/Driver/omp-driver-offload.f90
 --check-prefix=OFFLOAD-HOST-AND-DEVICE # RUN: at line 20
+ /home/tcwg-buildbot/worker/flang-aarch64-dylib/build/bin/flang -S -### 
/home/tcwg-buildbot/worker/flang-aarch64-dylib/llvm-project/flang/test/Driver/omp-driver-offload.f90
 -o 
/home/tcwg-buildbot/worker/flang-aarch64-dylib/build/tools/flang/test/Driver/Output/omp-driver-offload.f90.tmp
 -fopenmp --offload-arch=gfx90a --offload-arch=sm_70 --offload-host-device 
--target=aarch64-unknown-linux-gnu -nogpulib
+ /home/tcwg-buildbot/worker/flang-aarch64-dylib/build/bin/FileCheck 
/home/tcwg-buildbot/worker/flang-aarch64-dylib/llvm-project/flang/test/Driver/omp-driver-offload.f90
 --check-prefix=OFFLOAD-HOST-AND-DEVICE
/home/tcwg-buildbot/worker/flang-aarch64-dylib/build/bin/flang -S -### 
/home/tcwg-buildbot/worker/flang-aarch64-dylib/llvm-project/flang/test/Driver/omp-driver-offload.f90
 -o 
/home/tcwg-buildbot/worker/flang-aarch64-dylib/build/tools/flang/test/Driver/Output/omp-driver-offload.f90.tmp
 2>&1  -fopenmp --offload-arch=gfx90a --offload-arch=sm_70 --offload-host-only  
--target=aarch64-unknown-linux-gnu -nogpulib   | 
/home/tcwg-buildbot/worker/flang-aarch64-dylib/build/bin/FileCheck 
/home/tcwg-buildbot/worker/flang-aarch64-dylib/llvm-project/flang/test/Driver/omp-driver-offload.f90
 --check-prefix=OFFLOAD-HOST # RUN: at line 30
+ /home/tcwg-buildbot/worker/flang-aarch64-dylib/build/bin/flang -S -### 
/home/tcwg-buildbot/worker/flang-aarch64-dylib/llvm-project/flang/test/Driver/omp-driver-offload.f90
 -o 
/home/tcwg-buildbot/worker/flang-aarch64-dylib/build/tools/flang/test/Driver/Output/omp-driver-offload.f90.tmp
 -fopenmp --offload-arch=gfx90a --offload-arch=sm_70 --offload-host-only 
--target=aarch64-unknown-linux-gnu -nogpulib
+ /home/tcwg-buildbot/worker/flang-aarch64-dylib/build/bin/FileCheck 
/home/tcwg-buildbot/wor

[clang] [clang] Add builtin_get_vtable_pointer and virtual_member_address (PR #135469)

2025-04-13 Thread Oliver Hunt via cfe-commits

https://github.com/ojhunt updated 
https://github.com/llvm/llvm-project/pull/135469

>From 1607a76c4fd2bd7f0c4e834d2935668d51daf55f Mon Sep 17 00:00:00 2001
From: Oliver Hunt 
Date: Sun, 13 Apr 2025 00:47:18 -0700
Subject: [PATCH] [clang] Add builtin_get_vtable_pointer and
 virtual_member_address

These are a pair of builtins to support particularly weird edge
case operations while correctly handling the non-trivial implicit
pointer authentication schemas applied to polymorphic members.

Co-authored-by: Tim Northover
---
 clang/docs/LanguageExtensions.rst |  66 
 clang/docs/ReleaseNotes.rst   |   3 +
 clang/include/clang/Basic/Builtins.td |  12 +
 .../clang/Basic/DiagnosticSemaKinds.td|  19 +
 clang/lib/CodeGen/CGBuiltin.cpp   |  35 ++
 clang/lib/Sema/SemaChecking.cpp   |  92 +
 .../CodeGenCXX/builtin-get-vtable-pointer.cpp | 350 ++
 .../builtin_virtual_member_address.cpp|  68 
 .../SemaCXX/builtin-get-vtable-pointer.cpp| 124 +++
 .../builtin_virtual_member_address.cpp|  60 +++
 10 files changed, 829 insertions(+)
 create mode 100644 clang/test/CodeGenCXX/builtin-get-vtable-pointer.cpp
 create mode 100644 clang/test/CodeGenCXX/builtin_virtual_member_address.cpp
 create mode 100644 clang/test/SemaCXX/builtin-get-vtable-pointer.cpp
 create mode 100644 clang/test/SemaCXX/builtin_virtual_member_address.cpp

diff --git a/clang/docs/LanguageExtensions.rst 
b/clang/docs/LanguageExtensions.rst
index 3b8a9cac6587a..62e3002407631 100644
--- a/clang/docs/LanguageExtensions.rst
+++ b/clang/docs/LanguageExtensions.rst
@@ -3031,6 +3031,72 @@ following way:
 
 Query for this feature with ``__has_builtin(__builtin_offsetof)``.
 
+``__builtin_get_vtable_pointer``
+
+
+``__builtin_get_vtable_pointer`` loads and authenticates the primary vtable
+pointer from an instance of a polymorphic C++ class.
+
+**Syntax**:
+
+.. code-block:: c++
+
+  __builtin_get_vtable_pointer(PolymorphicClass*)
+
+**Example of Use**:
+
+.. code-block:: c++
+
+  struct PolymorphicClass {
+virtual ~PolymorphicClass();
+  };
+
+  PolymorphicClass anInstance;
+  const void* vtablePointer = __builtin_get_vtable_pointer(&anInstance);
+
+**Description**:
+
+The ``__builtin_get_vtable_pointer`` builtin loads the primary vtable
+pointer from a polymorphic C++ type. If the target platform authenticates
+vtable pointers, this builtin will perform the authentication and produce
+the underlying raw pointer. The object being queried must be polymorphic,
+and so must also be a complete type.
+
+Query for this feature with ``__has_builtin(__builtin_get_vtable_pointer)``.
+
+``__builtin_virtual_member_address``
+
+
+``__builtin_virtual_member_address`` loads the function pointer that would
+be called by a virtual method.
+
+**Syntax**:
+
+.. code-block:: c++
+
+  __builtin_virtual_member_address(PolymorphicClass&, Member function pointer)
+
+**Exampe of Use**
+
+.. code-block:: c++
+
+  struct PolymorphicClass {
+virtual ~PolymorphicClass();
+virtual void SomeMethod();
+  };
+
+  PolymorphicClass anInstance;
+  const void* MethodAddress =
+__builtin_virtual_member_address(anInstance, 
&PolymorphicClass::SomeMethod);
+
+**Description**
+
+This builtin returns the dynamic target for virtual dispatch of the requested 
virtual
+method. If the target platform supports pointer authentication, it emits the 
code to
+authenticates the vtable pointer and the virtual function pointer being 
loaded. The returned
+value is an untyped pointer as it cannot reasonably be proved that any given 
use of the returned
+function pointer is correct, so we want to discourage any attempt to do such.
+
 ``__builtin_call_with_static_chain``
 
 
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 11f62bc881b03..16091ba152d70 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -191,6 +191,9 @@ Non-comprehensive list of changes in this release
 - Support parsing the `cc` operand modifier and alias it to the `c` modifier 
(#GH127719).
 - Added `__builtin_elementwise_exp10`.
 - For AMDPGU targets, added `__builtin_v_cvt_off_f32_i4` that maps to the 
`v_cvt_off_f32_i4` instruction.
+- Added `__builtin_get_vtable_pointer` to directly load the primary vtable 
pointer from a
+  polymorphic object and `__builtin_virtual_member_address` to load the real 
function pointer of a
+  virtual method.
 
 New Compiler Flags
 --
diff --git a/clang/include/clang/Basic/Builtins.td 
b/clang/include/clang/Basic/Builtins.td
index 868e5b92acdc9..a55f411343c2d 100644
--- a/clang/include/clang/Basic/Builtins.td
+++ b/clang/include/clang/Basic/Builtins.td
@@ -970,6 +970,18 @@ def IsWithinLifetime : LangBuiltin<"CXX_LANG"> {
   let Prototype = "bool(void*)";
 }
 
+def GetVtablePointer : LangBuiltin<"CXX_LANG"> {
+  let

[clang] clang/AMDGPU: Stop looking for oclc_daz_opt_* control libraries (PR #134805)

2025-04-13 Thread LLVM Continuous Integration via cfe-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `premerge-monolithic-linux` 
running on `premerge-linux-1` while building `clang` at step 7 
"test-build-unified-tree-check-all".

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


Here is the relevant piece of the build log for the reference

```
Step 7 (test-build-unified-tree-check-all) failure: test (failure)
 TEST 'Flang :: Driver/omp-driver-offload.f90' FAILED 

Exit Code: 1

Command Output (stderr):
--
/build/buildbot/premerge-monolithic-linux/build/bin/flang -### -fopenmp 
/build/buildbot/premerge-monolithic-linux/llvm-project/flang/test/Driver/omp-driver-offload.f90
 2>&1 | /build/buildbot/premerge-monolithic-linux/build/bin/FileCheck 
--check-prefixes=CHECK-OPENMP 
/build/buildbot/premerge-monolithic-linux/llvm-project/flang/test/Driver/omp-driver-offload.f90
 # RUN: at line 10
+ /build/buildbot/premerge-monolithic-linux/build/bin/flang -### -fopenmp 
/build/buildbot/premerge-monolithic-linux/llvm-project/flang/test/Driver/omp-driver-offload.f90
+ /build/buildbot/premerge-monolithic-linux/build/bin/FileCheck 
--check-prefixes=CHECK-OPENMP 
/build/buildbot/premerge-monolithic-linux/llvm-project/flang/test/Driver/omp-driver-offload.f90
/build/buildbot/premerge-monolithic-linux/build/bin/flang -S -### 
/build/buildbot/premerge-monolithic-linux/llvm-project/flang/test/Driver/omp-driver-offload.f90
 -o 
/build/buildbot/premerge-monolithic-linux/build/tools/flang/test/Driver/Output/omp-driver-offload.f90.tmp
 2>&1  -fopenmp --offload-arch=gfx90a --offload-arch=sm_70  
--target=aarch64-unknown-linux-gnu -nogpulib   | 
/build/buildbot/premerge-monolithic-linux/build/bin/FileCheck 
/build/buildbot/premerge-monolithic-linux/llvm-project/flang/test/Driver/omp-driver-offload.f90
 --check-prefix=OFFLOAD-HOST-AND-DEVICE # RUN: at line 15
+ /build/buildbot/premerge-monolithic-linux/build/bin/flang -S -### 
/build/buildbot/premerge-monolithic-linux/llvm-project/flang/test/Driver/omp-driver-offload.f90
 -o 
/build/buildbot/premerge-monolithic-linux/build/tools/flang/test/Driver/Output/omp-driver-offload.f90.tmp
 -fopenmp --offload-arch=gfx90a --offload-arch=sm_70 
--target=aarch64-unknown-linux-gnu -nogpulib
+ /build/buildbot/premerge-monolithic-linux/build/bin/FileCheck 
/build/buildbot/premerge-monolithic-linux/llvm-project/flang/test/Driver/omp-driver-offload.f90
 --check-prefix=OFFLOAD-HOST-AND-DEVICE
/build/buildbot/premerge-monolithic-linux/build/bin/flang -S -### 
/build/buildbot/premerge-monolithic-linux/llvm-project/flang/test/Driver/omp-driver-offload.f90
 -o 
/build/buildbot/premerge-monolithic-linux/build/tools/flang/test/Driver/Output/omp-driver-offload.f90.tmp
 2>&1  -fopenmp --offload-arch=gfx90a --offload-arch=sm_70 
--offload-host-device  --target=aarch64-unknown-linux-gnu -nogpulib   | 
/build/buildbot/premerge-monolithic-linux/build/bin/FileCheck 
/build/buildbot/premerge-monolithic-linux/llvm-project/flang/test/Driver/omp-driver-offload.f90
 --check-prefix=OFFLOAD-HOST-AND-DEVICE # RUN: at line 20
+ /build/buildbot/premerge-monolithic-linux/build/bin/FileCheck 
/build/buildbot/premerge-monolithic-linux/llvm-project/flang/test/Driver/omp-driver-offload.f90
 --check-prefix=OFFLOAD-HOST-AND-DEVICE
+ /build/buildbot/premerge-monolithic-linux/build/bin/flang -S -### 
/build/buildbot/premerge-monolithic-linux/llvm-project/flang/test/Driver/omp-driver-offload.f90
 -o 
/build/buildbot/premerge-monolithic-linux/build/tools/flang/test/Driver/Output/omp-driver-offload.f90.tmp
 -fopenmp --offload-arch=gfx90a --offload-arch=sm_70 --offload-host-device 
--target=aarch64-unknown-linux-gnu -nogpulib
/build/buildbot/premerge-monolithic-linux/build/bin/flang -S -### 
/build/buildbot/premerge-monolithic-linux/llvm-project/flang/test/Driver/omp-driver-offload.f90
 -o 
/build/buildbot/premerge-monolithic-linux/build/tools/flang/test/Driver/Output/omp-driver-offload.f90.tmp
 2>&1  -fopenmp --offload-arch=gfx90a --offload-arch=sm_70 --offload-host-only  
--target=aarch64-unknown-linux-gnu -nogpulib   | 
/build/buildbot/premerge-monolithic-linux/build/bin/FileCheck 
/build/buildbot/premerge-monolithic-linux/llvm-project/flang/test/Driver/omp-driver-offload.f90
 --check-prefix=OFFLOAD-HOST # RUN: at line 30
+ /build/buildbot/premerge-monolithic-linux/build/bin/flang -S -### 
/build/buildbot/premerge-monolithic-linux/llvm-project/flang/test/Driver/omp-driver-offload.f90
 -o 
/build/buildbot/premerge-monolithic-linux/build/tools/flang/test/Driver/Output/omp-driver-offload.f90.tmp
 -fopenmp --offload-arch=gfx90a --offload-arch=sm_70 --offload-host-only 
--target=aarch64-unknown-linux-gnu -nogpulib
+ /build/buildbot/premerge-monolithic-linux/build/bin/FileCheck 
/build/buildbot/premerge-monolithic-linux/llvm-project/flang/test/Driver/omp-driver-offload.f90
 --check-prefix=OFFLOAD-HOST
/build/buildbot/premerge-monolithic-linux/build/bin/flang -S -### 
/build/buildbot/premerg

[clang] clang/AMDGPU: Stop looking for oclc_daz_opt_* control libraries (PR #134805)

2025-04-13 Thread LLVM Continuous Integration via cfe-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `flang-aarch64-out-of-tree` 
running on `linaro-flang-aarch64-out-of-tree` while building `clang` at step 9 
"test-build-flang-unified-tree-check-flang".

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


Here is the relevant piece of the build log for the reference

```
Step 9 (test-build-flang-unified-tree-check-flang) failure: test (failure)
 TEST 'Flang :: Driver/omp-driver-offload.f90' FAILED 

Exit Code: 1

Command Output (stderr):
--
/home/tcwg-buildbot/worker/flang-aarch64-out-of-tree/build_flang/bin/flang -### 
-fopenmp 
/home/tcwg-buildbot/worker/flang-aarch64-out-of-tree/llvm-project/flang/test/Driver/omp-driver-offload.f90
 2>&1 | 
/home/tcwg-buildbot/worker/flang-aarch64-out-of-tree/build_llvm/bin/FileCheck 
--check-prefixes=CHECK-OPENMP 
/home/tcwg-buildbot/worker/flang-aarch64-out-of-tree/llvm-project/flang/test/Driver/omp-driver-offload.f90
 # RUN: at line 10
+ /home/tcwg-buildbot/worker/flang-aarch64-out-of-tree/build_flang/bin/flang 
-### -fopenmp 
/home/tcwg-buildbot/worker/flang-aarch64-out-of-tree/llvm-project/flang/test/Driver/omp-driver-offload.f90
+ /home/tcwg-buildbot/worker/flang-aarch64-out-of-tree/build_llvm/bin/FileCheck 
--check-prefixes=CHECK-OPENMP 
/home/tcwg-buildbot/worker/flang-aarch64-out-of-tree/llvm-project/flang/test/Driver/omp-driver-offload.f90
/home/tcwg-buildbot/worker/flang-aarch64-out-of-tree/build_flang/bin/flang -S 
-### 
/home/tcwg-buildbot/worker/flang-aarch64-out-of-tree/llvm-project/flang/test/Driver/omp-driver-offload.f90
 -o 
/home/tcwg-buildbot/worker/flang-aarch64-out-of-tree/build_flang/test/Driver/Output/omp-driver-offload.f90.tmp
 2>&1  -fopenmp --offload-arch=gfx90a --offload-arch=sm_70  
--target=aarch64-unknown-linux-gnu -nogpulib   | 
/home/tcwg-buildbot/worker/flang-aarch64-out-of-tree/build_llvm/bin/FileCheck 
/home/tcwg-buildbot/worker/flang-aarch64-out-of-tree/llvm-project/flang/test/Driver/omp-driver-offload.f90
 --check-prefix=OFFLOAD-HOST-AND-DEVICE # RUN: at line 15
+ /home/tcwg-buildbot/worker/flang-aarch64-out-of-tree/build_flang/bin/flang -S 
-### 
/home/tcwg-buildbot/worker/flang-aarch64-out-of-tree/llvm-project/flang/test/Driver/omp-driver-offload.f90
 -o 
/home/tcwg-buildbot/worker/flang-aarch64-out-of-tree/build_flang/test/Driver/Output/omp-driver-offload.f90.tmp
 -fopenmp --offload-arch=gfx90a --offload-arch=sm_70 
--target=aarch64-unknown-linux-gnu -nogpulib
+ /home/tcwg-buildbot/worker/flang-aarch64-out-of-tree/build_llvm/bin/FileCheck 
/home/tcwg-buildbot/worker/flang-aarch64-out-of-tree/llvm-project/flang/test/Driver/omp-driver-offload.f90
 --check-prefix=OFFLOAD-HOST-AND-DEVICE
/home/tcwg-buildbot/worker/flang-aarch64-out-of-tree/build_flang/bin/flang -S 
-### 
/home/tcwg-buildbot/worker/flang-aarch64-out-of-tree/llvm-project/flang/test/Driver/omp-driver-offload.f90
 -o 
/home/tcwg-buildbot/worker/flang-aarch64-out-of-tree/build_flang/test/Driver/Output/omp-driver-offload.f90.tmp
 2>&1  -fopenmp --offload-arch=gfx90a --offload-arch=sm_70 
--offload-host-device  --target=aarch64-unknown-linux-gnu -nogpulib   | 
/home/tcwg-buildbot/worker/flang-aarch64-out-of-tree/build_llvm/bin/FileCheck 
/home/tcwg-buildbot/worker/flang-aarch64-out-of-tree/llvm-project/flang/test/Driver/omp-driver-offload.f90
 --check-prefix=OFFLOAD-HOST-AND-DEVICE # RUN: at line 20
+ /home/tcwg-buildbot/worker/flang-aarch64-out-of-tree/build_flang/bin/flang -S 
-### 
/home/tcwg-buildbot/worker/flang-aarch64-out-of-tree/llvm-project/flang/test/Driver/omp-driver-offload.f90
 -o 
/home/tcwg-buildbot/worker/flang-aarch64-out-of-tree/build_flang/test/Driver/Output/omp-driver-offload.f90.tmp
 -fopenmp --offload-arch=gfx90a --offload-arch=sm_70 --offload-host-device 
--target=aarch64-unknown-linux-gnu -nogpulib
+ /home/tcwg-buildbot/worker/flang-aarch64-out-of-tree/build_llvm/bin/FileCheck 
/home/tcwg-buildbot/worker/flang-aarch64-out-of-tree/llvm-project/flang/test/Driver/omp-driver-offload.f90
 --check-prefix=OFFLOAD-HOST-AND-DEVICE
/home/tcwg-buildbot/worker/flang-aarch64-out-of-tree/build_flang/bin/flang -S 
-### 
/home/tcwg-buildbot/worker/flang-aarch64-out-of-tree/llvm-project/flang/test/Driver/omp-driver-offload.f90
 -o 
/home/tcwg-buildbot/worker/flang-aarch64-out-of-tree/build_flang/test/Driver/Output/omp-driver-offload.f90.tmp
 2>&1  -fopenmp --offload-arch=gfx90a --offload-arch=sm_70 --offload-host-only  
--target=aarch64-unknown-linux-gnu -nogpulib   | 
/home/tcwg-buildbot/worker/flang-aarch64-out-of-tree/build_llvm/bin/FileCheck 
/home/tcwg-buildbot/worker/flang-aarch64-out-of-tree/llvm-project/flang/test/Driver/omp-driver-offload.f90
 --check-prefix=OFFLOAD-HOST # RUN: at line 30
+ /home/tcwg-buildbot/worker/flang-aarch64-out-of-tree/build_flang/bin/flang -S 
-### 
/home/tcwg-buildbot/worker/flang-aarch64-out-of-tree/llvm-project/flang/test/Driver/omp-driver-offload.f90
 -o 
/home/tcwg-buildbot/worker/

[clang] [clang][bytecode] Fix an inconsistency with loop condition jumps (PR #135530)

2025-04-13 Thread Timm Baeder via cfe-commits

https://github.com/tbaederr created 
https://github.com/llvm/llvm-project/pull/135530

When emitting the jump for e.g. a for loop condition, we used to jump out of 
the CondScope, leaving the scope initialized, because we skipped the 
corresponding Destroy opcode. If that loop was in a loop itself, that outer 
loop could then iterate once more, leading to us initializing a scope that was 
still initialized.
Fix this by also destroying the scope after the EndLabel.

>From 52b7e8519cb4612f0b4dd803762d010145144e24 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timm=20B=C3=A4der?= 
Date: Sat, 12 Apr 2025 17:40:19 +0200
Subject: [PATCH] [clang][bytecode] Fix an inconsistency with loop condition
 jumps

When emitting the jump for e.g. a for loop condition, we used to jump
out of the CondScope, leaving the scope initialized, because we skipped
the corresponding Destroy opcode. If that loop was in a loop itself,
that outer loop could then iterate once more, leading to us initializing
a scope that was still initialized.
Fix this by also destroying the scope after the EndLabel.
---
 clang/lib/AST/ByteCode/Compiler.cpp | 31 +++--
 clang/lib/AST/ByteCode/Compiler.h   |  3 ++-
 2 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/clang/lib/AST/ByteCode/Compiler.cpp 
b/clang/lib/AST/ByteCode/Compiler.cpp
index 86b43585cd292..376daec5cd0d2 100644
--- a/clang/lib/AST/ByteCode/Compiler.cpp
+++ b/clang/lib/AST/ByteCode/Compiler.cpp
@@ -5431,21 +5431,21 @@ bool Compiler::visitForStmt(const ForStmt *S) {
   this->fallthrough(CondLabel);
   this->emitLabel(CondLabel);
 
-  {
-LocalScope CondScope(this);
-if (const DeclStmt *CondDecl = S->getConditionVariableDeclStmt())
-  if (!visitDeclStmt(CondDecl))
-return false;
+  // Start of loop body.
+  LocalScope CondScope(this);
+  if (const DeclStmt *CondDecl = S->getConditionVariableDeclStmt())
+if (!visitDeclStmt(CondDecl))
+  return false;
 
-if (Cond) {
-  if (!this->visitBool(Cond))
-return false;
-  if (!this->jumpFalse(EndLabel))
-return false;
-}
+  if (!this->maybeEmitDeferredVarInit(S->getConditionVariable()))
+return false;
 
-if (!this->maybeEmitDeferredVarInit(S->getConditionVariable()))
+  if (Cond) {
+if (!this->visitBool(Cond))
+  return false;
+if (!this->jumpFalse(EndLabel))
   return false;
+  }
 
 if (Body && !this->visitStmt(Body))
   return false;
@@ -5457,13 +5457,14 @@ bool Compiler::visitForStmt(const ForStmt *S) {
 
 if (!CondScope.destroyLocals())
   return false;
-  }
   if (!this->jump(CondLabel))
 return false;
+  // End of loop body.
 
-  this->fallthrough(EndLabel);
   this->emitLabel(EndLabel);
-  return true;
+  // If we jumped out of the loop above, we still need to clean up the 
condition
+  // scope.
+  return CondScope.destroyLocals();
 }
 
 template 
diff --git a/clang/lib/AST/ByteCode/Compiler.h 
b/clang/lib/AST/ByteCode/Compiler.h
index 256e917728886..858957367d85d 100644
--- a/clang/lib/AST/ByteCode/Compiler.h
+++ b/clang/lib/AST/ByteCode/Compiler.h
@@ -531,9 +531,10 @@ template  class LocalScope : public 
VariableScope {
 if (!Idx)
   return true;
 
+// NB: We are *not* resetting Idx here as to allow multiple
+// calls to destroyLocals().
 bool Success = this->emitDestructors(E);
 this->Ctx->emitDestroy(*Idx, E);
-this->Idx = std::nullopt;
 return Success;
   }
 

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


[clang] [clang][bytecode] Fix an inconsistency with loop condition jumps (PR #135530)

2025-04-13 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang

Author: Timm Baeder (tbaederr)


Changes

When emitting the jump for e.g. a for loop condition, we used to jump out of 
the CondScope, leaving the scope initialized, because we skipped the 
corresponding Destroy opcode. If that loop was in a loop itself, that outer 
loop could then iterate once more, leading to us initializing a scope that was 
still initialized.
Fix this by also destroying the scope after the EndLabel.

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


2 Files Affected:

- (modified) clang/lib/AST/ByteCode/Compiler.cpp (+16-15) 
- (modified) clang/lib/AST/ByteCode/Compiler.h (+2-1) 


``diff
diff --git a/clang/lib/AST/ByteCode/Compiler.cpp 
b/clang/lib/AST/ByteCode/Compiler.cpp
index 86b43585cd292..376daec5cd0d2 100644
--- a/clang/lib/AST/ByteCode/Compiler.cpp
+++ b/clang/lib/AST/ByteCode/Compiler.cpp
@@ -5431,21 +5431,21 @@ bool Compiler::visitForStmt(const ForStmt *S) {
   this->fallthrough(CondLabel);
   this->emitLabel(CondLabel);
 
-  {
-LocalScope CondScope(this);
-if (const DeclStmt *CondDecl = S->getConditionVariableDeclStmt())
-  if (!visitDeclStmt(CondDecl))
-return false;
+  // Start of loop body.
+  LocalScope CondScope(this);
+  if (const DeclStmt *CondDecl = S->getConditionVariableDeclStmt())
+if (!visitDeclStmt(CondDecl))
+  return false;
 
-if (Cond) {
-  if (!this->visitBool(Cond))
-return false;
-  if (!this->jumpFalse(EndLabel))
-return false;
-}
+  if (!this->maybeEmitDeferredVarInit(S->getConditionVariable()))
+return false;
 
-if (!this->maybeEmitDeferredVarInit(S->getConditionVariable()))
+  if (Cond) {
+if (!this->visitBool(Cond))
+  return false;
+if (!this->jumpFalse(EndLabel))
   return false;
+  }
 
 if (Body && !this->visitStmt(Body))
   return false;
@@ -5457,13 +5457,14 @@ bool Compiler::visitForStmt(const ForStmt *S) {
 
 if (!CondScope.destroyLocals())
   return false;
-  }
   if (!this->jump(CondLabel))
 return false;
+  // End of loop body.
 
-  this->fallthrough(EndLabel);
   this->emitLabel(EndLabel);
-  return true;
+  // If we jumped out of the loop above, we still need to clean up the 
condition
+  // scope.
+  return CondScope.destroyLocals();
 }
 
 template 
diff --git a/clang/lib/AST/ByteCode/Compiler.h 
b/clang/lib/AST/ByteCode/Compiler.h
index 256e917728886..858957367d85d 100644
--- a/clang/lib/AST/ByteCode/Compiler.h
+++ b/clang/lib/AST/ByteCode/Compiler.h
@@ -531,9 +531,10 @@ template  class LocalScope : public 
VariableScope {
 if (!Idx)
   return true;
 
+// NB: We are *not* resetting Idx here as to allow multiple
+// calls to destroyLocals().
 bool Success = this->emitDestructors(E);
 this->Ctx->emitDestroy(*Idx, E);
-this->Idx = std::nullopt;
 return Success;
   }
 

``




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


[clang] clang/AMDGPU: Stop looking for oclc_daz_opt_* control libraries (PR #134805)

2025-04-13 Thread LLVM Continuous Integration via cfe-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `flang-aarch64-latest-gcc` 
running on `linaro-flang-aarch64-latest-gcc` while building `clang` at step 6 
"test-build-unified-tree-check-flang".

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


Here is the relevant piece of the build log for the reference

```
Step 6 (test-build-unified-tree-check-flang) failure: test (failure)
 TEST 'Flang :: Driver/omp-driver-offload.f90' FAILED 

Exit Code: 1

Command Output (stderr):
--
/home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/build/bin/flang -### 
-fopenmp 
/home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/llvm-project/flang/test/Driver/omp-driver-offload.f90
 2>&1 | /home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/build/bin/FileCheck 
--check-prefixes=CHECK-OPENMP 
/home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/llvm-project/flang/test/Driver/omp-driver-offload.f90
 # RUN: at line 10
+ /home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/build/bin/flang -### 
-fopenmp 
/home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/llvm-project/flang/test/Driver/omp-driver-offload.f90
+ /home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/build/bin/FileCheck 
--check-prefixes=CHECK-OPENMP 
/home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/llvm-project/flang/test/Driver/omp-driver-offload.f90
/home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/build/bin/flang -S -### 
/home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/llvm-project/flang/test/Driver/omp-driver-offload.f90
 -o 
/home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/build/tools/flang/test/Driver/Output/omp-driver-offload.f90.tmp
 2>&1  -fopenmp --offload-arch=gfx90a --offload-arch=sm_70  
--target=aarch64-unknown-linux-gnu -nogpulib   | 
/home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/build/bin/FileCheck 
/home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/llvm-project/flang/test/Driver/omp-driver-offload.f90
 --check-prefix=OFFLOAD-HOST-AND-DEVICE # RUN: at line 15
+ /home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/build/bin/flang -S -### 
/home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/llvm-project/flang/test/Driver/omp-driver-offload.f90
 -o 
/home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/build/tools/flang/test/Driver/Output/omp-driver-offload.f90.tmp
 -fopenmp --offload-arch=gfx90a --offload-arch=sm_70 
--target=aarch64-unknown-linux-gnu -nogpulib
+ /home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/build/bin/FileCheck 
/home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/llvm-project/flang/test/Driver/omp-driver-offload.f90
 --check-prefix=OFFLOAD-HOST-AND-DEVICE
/home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/build/bin/flang -S -### 
/home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/llvm-project/flang/test/Driver/omp-driver-offload.f90
 -o 
/home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/build/tools/flang/test/Driver/Output/omp-driver-offload.f90.tmp
 2>&1  -fopenmp --offload-arch=gfx90a --offload-arch=sm_70 
--offload-host-device  --target=aarch64-unknown-linux-gnu -nogpulib   | 
/home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/build/bin/FileCheck 
/home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/llvm-project/flang/test/Driver/omp-driver-offload.f90
 --check-prefix=OFFLOAD-HOST-AND-DEVICE # RUN: at line 20
+ /home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/build/bin/flang -S -### 
/home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/llvm-project/flang/test/Driver/omp-driver-offload.f90
 -o 
/home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/build/tools/flang/test/Driver/Output/omp-driver-offload.f90.tmp
 -fopenmp --offload-arch=gfx90a --offload-arch=sm_70 --offload-host-device 
--target=aarch64-unknown-linux-gnu -nogpulib
+ /home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/build/bin/FileCheck 
/home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/llvm-project/flang/test/Driver/omp-driver-offload.f90
 --check-prefix=OFFLOAD-HOST-AND-DEVICE
/home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/build/bin/flang -S -### 
/home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/llvm-project/flang/test/Driver/omp-driver-offload.f90
 -o 
/home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/build/tools/flang/test/Driver/Output/omp-driver-offload.f90.tmp
 2>&1  -fopenmp --offload-arch=gfx90a --offload-arch=sm_70 --offload-host-only  
--target=aarch64-unknown-linux-gnu -nogpulib   | 
/home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/build/bin/FileCheck 
/home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/llvm-project/flang/test/Driver/omp-driver-offload.f90
 --check-prefix=OFFLOAD-HOST # RUN: at line 30
+ /home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/build/bin/flang -S -### 
/home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/llvm-project/flang/test/Driver/omp-driver-offload.f90
 -o 
/home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/build/tools/flang/test/Driver/Output/omp-driver-offload.f90.tmp
 -fopenmp --offload

[clang] clang/AMDGPU: Stop looking for oclc_daz_opt_* control libraries (PR #134805)

2025-04-13 Thread LLVM Continuous Integration via cfe-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `flang-aarch64-sharedlibs` 
running on `linaro-flang-aarch64-sharedlibs` while building `clang` at step 6 
"test-build-unified-tree-check-flang".

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


Here is the relevant piece of the build log for the reference

```
Step 6 (test-build-unified-tree-check-flang) failure: test (failure)
 TEST 'Flang :: Driver/omp-driver-offload.f90' FAILED 

Exit Code: 1

Command Output (stderr):
--
/home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/build/bin/flang -### 
-fopenmp 
/home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/llvm-project/flang/test/Driver/omp-driver-offload.f90
 2>&1 | /home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/build/bin/FileCheck 
--check-prefixes=CHECK-OPENMP 
/home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/llvm-project/flang/test/Driver/omp-driver-offload.f90
 # RUN: at line 10
+ /home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/build/bin/flang -### 
-fopenmp 
/home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/llvm-project/flang/test/Driver/omp-driver-offload.f90
+ /home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/build/bin/FileCheck 
--check-prefixes=CHECK-OPENMP 
/home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/llvm-project/flang/test/Driver/omp-driver-offload.f90
/home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/build/bin/flang -S -### 
/home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/llvm-project/flang/test/Driver/omp-driver-offload.f90
 -o 
/home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/build/tools/flang/test/Driver/Output/omp-driver-offload.f90.tmp
 2>&1  -fopenmp --offload-arch=gfx90a --offload-arch=sm_70  
--target=aarch64-unknown-linux-gnu -nogpulib   | 
/home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/build/bin/FileCheck 
/home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/llvm-project/flang/test/Driver/omp-driver-offload.f90
 --check-prefix=OFFLOAD-HOST-AND-DEVICE # RUN: at line 15
+ /home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/build/bin/FileCheck 
/home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/llvm-project/flang/test/Driver/omp-driver-offload.f90
 --check-prefix=OFFLOAD-HOST-AND-DEVICE
+ /home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/build/bin/flang -S -### 
/home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/llvm-project/flang/test/Driver/omp-driver-offload.f90
 -o 
/home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/build/tools/flang/test/Driver/Output/omp-driver-offload.f90.tmp
 -fopenmp --offload-arch=gfx90a --offload-arch=sm_70 
--target=aarch64-unknown-linux-gnu -nogpulib
/home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/build/bin/flang -S -### 
/home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/llvm-project/flang/test/Driver/omp-driver-offload.f90
 -o 
/home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/build/tools/flang/test/Driver/Output/omp-driver-offload.f90.tmp
 2>&1  -fopenmp --offload-arch=gfx90a --offload-arch=sm_70 
--offload-host-device  --target=aarch64-unknown-linux-gnu -nogpulib   | 
/home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/build/bin/FileCheck 
/home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/llvm-project/flang/test/Driver/omp-driver-offload.f90
 --check-prefix=OFFLOAD-HOST-AND-DEVICE # RUN: at line 20
+ /home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/build/bin/flang -S -### 
/home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/llvm-project/flang/test/Driver/omp-driver-offload.f90
 -o 
/home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/build/tools/flang/test/Driver/Output/omp-driver-offload.f90.tmp
 -fopenmp --offload-arch=gfx90a --offload-arch=sm_70 --offload-host-device 
--target=aarch64-unknown-linux-gnu -nogpulib
+ /home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/build/bin/FileCheck 
/home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/llvm-project/flang/test/Driver/omp-driver-offload.f90
 --check-prefix=OFFLOAD-HOST-AND-DEVICE
/home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/build/bin/flang -S -### 
/home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/llvm-project/flang/test/Driver/omp-driver-offload.f90
 -o 
/home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/build/tools/flang/test/Driver/Output/omp-driver-offload.f90.tmp
 2>&1  -fopenmp --offload-arch=gfx90a --offload-arch=sm_70 --offload-host-only  
--target=aarch64-unknown-linux-gnu -nogpulib   | 
/home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/build/bin/FileCheck 
/home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/llvm-project/flang/test/Driver/omp-driver-offload.f90
 --check-prefix=OFFLOAD-HOST # RUN: at line 30
+ /home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/build/bin/flang -S -### 
/home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/llvm-project/flang/test/Driver/omp-driver-offload.f90
 -o 
/home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/build/tools/flang/test/Driver/Output/omp-driver-offload.f90.tmp
 -fopenmp --offload-

[clang] clang/AMDGPU: Stop looking for oclc_daz_opt_* control libraries (PR #134805)

2025-04-13 Thread LLVM Continuous Integration via cfe-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `flang-aarch64-release` 
running on `linaro-flang-aarch64-release` while building `clang` at step 6 
"test-build-unified-tree-check-flang".

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


Here is the relevant piece of the build log for the reference

```
Step 6 (test-build-unified-tree-check-flang) failure: test (failure)
 TEST 'Flang :: Driver/omp-driver-offload.f90' FAILED 

Exit Code: 1

Command Output (stderr):
--
/home/tcwg-buildbot/worker/flang-aarch64-release/build/bin/flang -### -fopenmp 
/home/tcwg-buildbot/worker/flang-aarch64-release/llvm-project/flang/test/Driver/omp-driver-offload.f90
 2>&1 | /home/tcwg-buildbot/worker/flang-aarch64-release/build/bin/FileCheck 
--check-prefixes=CHECK-OPENMP 
/home/tcwg-buildbot/worker/flang-aarch64-release/llvm-project/flang/test/Driver/omp-driver-offload.f90
 # RUN: at line 10
+ /home/tcwg-buildbot/worker/flang-aarch64-release/build/bin/flang -### 
-fopenmp 
/home/tcwg-buildbot/worker/flang-aarch64-release/llvm-project/flang/test/Driver/omp-driver-offload.f90
+ /home/tcwg-buildbot/worker/flang-aarch64-release/build/bin/FileCheck 
--check-prefixes=CHECK-OPENMP 
/home/tcwg-buildbot/worker/flang-aarch64-release/llvm-project/flang/test/Driver/omp-driver-offload.f90
/home/tcwg-buildbot/worker/flang-aarch64-release/build/bin/flang -S -### 
/home/tcwg-buildbot/worker/flang-aarch64-release/llvm-project/flang/test/Driver/omp-driver-offload.f90
 -o 
/home/tcwg-buildbot/worker/flang-aarch64-release/build/tools/flang/test/Driver/Output/omp-driver-offload.f90.tmp
 2>&1  -fopenmp --offload-arch=gfx90a --offload-arch=sm_70  
--target=aarch64-unknown-linux-gnu -nogpulib   | 
/home/tcwg-buildbot/worker/flang-aarch64-release/build/bin/FileCheck 
/home/tcwg-buildbot/worker/flang-aarch64-release/llvm-project/flang/test/Driver/omp-driver-offload.f90
 --check-prefix=OFFLOAD-HOST-AND-DEVICE # RUN: at line 15
+ /home/tcwg-buildbot/worker/flang-aarch64-release/build/bin/flang -S -### 
/home/tcwg-buildbot/worker/flang-aarch64-release/llvm-project/flang/test/Driver/omp-driver-offload.f90
 -o 
/home/tcwg-buildbot/worker/flang-aarch64-release/build/tools/flang/test/Driver/Output/omp-driver-offload.f90.tmp
 -fopenmp --offload-arch=gfx90a --offload-arch=sm_70 
--target=aarch64-unknown-linux-gnu -nogpulib
+ /home/tcwg-buildbot/worker/flang-aarch64-release/build/bin/FileCheck 
/home/tcwg-buildbot/worker/flang-aarch64-release/llvm-project/flang/test/Driver/omp-driver-offload.f90
 --check-prefix=OFFLOAD-HOST-AND-DEVICE
/home/tcwg-buildbot/worker/flang-aarch64-release/build/bin/flang -S -### 
/home/tcwg-buildbot/worker/flang-aarch64-release/llvm-project/flang/test/Driver/omp-driver-offload.f90
 -o 
/home/tcwg-buildbot/worker/flang-aarch64-release/build/tools/flang/test/Driver/Output/omp-driver-offload.f90.tmp
 2>&1  -fopenmp --offload-arch=gfx90a --offload-arch=sm_70 
--offload-host-device  --target=aarch64-unknown-linux-gnu -nogpulib   | 
/home/tcwg-buildbot/worker/flang-aarch64-release/build/bin/FileCheck 
/home/tcwg-buildbot/worker/flang-aarch64-release/llvm-project/flang/test/Driver/omp-driver-offload.f90
 --check-prefix=OFFLOAD-HOST-AND-DEVICE # RUN: at line 20
+ /home/tcwg-buildbot/worker/flang-aarch64-release/build/bin/FileCheck 
/home/tcwg-buildbot/worker/flang-aarch64-release/llvm-project/flang/test/Driver/omp-driver-offload.f90
 --check-prefix=OFFLOAD-HOST-AND-DEVICE
+ /home/tcwg-buildbot/worker/flang-aarch64-release/build/bin/flang -S -### 
/home/tcwg-buildbot/worker/flang-aarch64-release/llvm-project/flang/test/Driver/omp-driver-offload.f90
 -o 
/home/tcwg-buildbot/worker/flang-aarch64-release/build/tools/flang/test/Driver/Output/omp-driver-offload.f90.tmp
 -fopenmp --offload-arch=gfx90a --offload-arch=sm_70 --offload-host-device 
--target=aarch64-unknown-linux-gnu -nogpulib
/home/tcwg-buildbot/worker/flang-aarch64-release/build/bin/flang -S -### 
/home/tcwg-buildbot/worker/flang-aarch64-release/llvm-project/flang/test/Driver/omp-driver-offload.f90
 -o 
/home/tcwg-buildbot/worker/flang-aarch64-release/build/tools/flang/test/Driver/Output/omp-driver-offload.f90.tmp
 2>&1  -fopenmp --offload-arch=gfx90a --offload-arch=sm_70 --offload-host-only  
--target=aarch64-unknown-linux-gnu -nogpulib   | 
/home/tcwg-buildbot/worker/flang-aarch64-release/build/bin/FileCheck 
/home/tcwg-buildbot/worker/flang-aarch64-release/llvm-project/flang/test/Driver/omp-driver-offload.f90
 --check-prefix=OFFLOAD-HOST # RUN: at line 30
+ /home/tcwg-buildbot/worker/flang-aarch64-release/build/bin/FileCheck 
/home/tcwg-buildbot/worker/flang-aarch64-release/llvm-project/flang/test/Driver/omp-driver-offload.f90
 --check-prefix=OFFLOAD-HOST
+ /home/tcwg-buildbot/worker/flang-aarch64-release/build/bin/flang -S -### 
/home/tcwg-buildbot/worker/flang-aarch64-release/llvm-project/flang/test/Driver/omp-driver-offload.f90
 -o 
/home/tcwg-buildbot/worker/flang-aarch64-re

[clang] [libcxx] [Clang] Add __builtin_common_reference (PR #121199)

2025-04-13 Thread via cfe-commits


@@ -3231,6 +3241,230 @@ static QualType builtinCommonTypeImpl(Sema &S, 
TemplateName BaseTemplate,
   }
 }
 
+static QualType CopyCV(QualType From, QualType To) {
+  if (From.isConstQualified())
+To.addConst();
+  if (From.isVolatileQualified())
+To.addVolatile();
+  return To;
+}
+
+// COND-RES(X, Y) be decltype(false ? declval()() : 
declval()())
+static QualType CondRes(Sema &S, QualType X, QualType Y, SourceLocation Loc) {
+  EnterExpressionEvaluationContext UnevaluatedContext(
+  S, Sema::ExpressionEvaluationContext::Unevaluated);
+  Sema::SFINAETrap SFINAE(S, /*AccessCheckingSFINAE=*/true);
+  Sema::ContextRAII TUContext(S, S.Context.getTranslationUnitDecl());
+
+  // false
+  OpaqueValueExpr CondExpr(SourceLocation(), S.Context.BoolTy, VK_PRValue);
+  ExprResult Cond = &CondExpr;
+
+  // declval()()
+  OpaqueValueExpr LHSExpr(Loc, X.getNonLValueExprType(S.Context),
+  Expr::getValueKindForType(X));
+  ExprResult LHS = &LHSExpr;
+
+  // declval()()
+  OpaqueValueExpr RHSExpr(Loc, Y.getNonLValueExprType(S.Context),
+  Expr::getValueKindForType(Y));
+  ExprResult RHS = &RHSExpr;
+
+  ExprValueKind VK = VK_PRValue;
+  ExprObjectKind OK = OK_Ordinary;
+
+  // decltype(false ? declval()() : declval()())
+  QualType Result = S.CheckConditionalOperands(Cond, LHS, RHS, VK, OK, Loc);
+
+  if (SFINAE.hasErrorOccurred())
+return QualType();
+  if (VK == VK_LValue)
+return S.BuiltinAddLValueReference(Result, Loc);
+  if (VK == VK_XValue)
+return S.BuiltinAddRValueReference(Result, Loc);
+  return Result;
+}
+
+static QualType CommonRef(Sema &S, QualType A, QualType B, SourceLocation Loc) 
{
+  // Given types A and B, let X be remove_reference_t, let Y be
+  // remove_reference_t, and let COMMON-​REF(A, B) be:
+  assert(A->isReferenceType() && B->isReferenceType() &&
+ "A and B have to be ref qualified for a COMMON-REF");
+  auto X = A.getNonReferenceType();
+  auto Y = B.getNonReferenceType();
+
+  // If A and B are both lvalue reference types, COMMON-REF(A, B) is
+  // COND-RES(COPYCV(X, Y) &, COPYCV(​Y, X) &) if that type exists and is a
+  // reference type.
+  if (A->isLValueReferenceType() && B->isLValueReferenceType()) {
+auto CR = CondRes(S, S.BuiltinAddLValueReference(CopyCV(X, Y), Loc),
+  S.BuiltinAddLValueReference(CopyCV(Y, X), Loc), Loc);
+if (CR.isNull() || !CR->isReferenceType())
+  return QualType();
+return CR;
+  }
+
+  // Otherwise, let C be remove_reference_t&&. If A and B
+  // are both rvalue reference types, C is well-formed, and
+  // is_convertible_v && is_convertible_v is true, then
+  // COMMON-REF(A, B) is C.
+  if (A->isRValueReferenceType() && B->isRValueReferenceType()) {
+auto C = CommonRef(S, S.BuiltinAddLValueReference(X, Loc),
+   S.BuiltinAddLValueReference(Y, Loc), Loc);
+if (C.isNull())
+  return QualType();
+
+C = C.getNonReferenceType();
+
+if (S.BuiltinIsConvertible(A, C, Loc) && S.BuiltinIsConvertible(B, C, Loc))
+  return S.BuiltinAddRValueReference(C, Loc);
+return QualType();
+  }
+
+  // Otherwise, if A is an lvalue reference and B is an rvalue reference, then
+  // COMMON-REF(A, B) is COMMON-REF(B, A).
+  if (A->isLValueReferenceType() && B->isRValueReferenceType())
+std::swap(A, B);
+
+  // Otherwise, let D be COMMON-REF(const X&, Y&). If A is an rvalue reference
+  // and B is an lvalue reference and D is well-formed and
+  // is_convertible_v is true, then COMMON-REF(A, B) is D.
+  if (A->isRValueReferenceType() && B->isLValueReferenceType()) {
+auto X2 = X;
+X2.addConst();
+auto D = CommonRef(S, S.BuiltinAddLValueReference(X2, Loc),
+   S.BuiltinAddLValueReference(Y, Loc), Loc);
+if (!D.isNull() && S.BuiltinIsConvertible(A, D, Loc))
+  return D;
+return QualType();
+  }
+
+  // Otherwise, COMMON-REF(A, B) is ill-formed.
+  // This is implemented by returning from the individual branches above.
+
+  llvm_unreachable("The above cases should be exhaustive");
+}
+
+static QualType builtinCommonReferenceImpl(Sema &S,
+   TemplateName CommonReference,
+   TemplateName CommonType,
+   SourceLocation TemplateLoc,
+   ArrayRef Ts) {
+  switch (Ts.size()) {
+  // If sizeof...(T) is zero, there shall be no member type.
+  case 0:
+return QualType();
+
+  // Otherwise, if sizeof...(T) is one, let T0 denote the sole type in the
+  // pack T. The member typedef type shall denote the same type as T0.
+  case 1:
+return Ts[0].getAsType();
+
+  // Otherwise, if sizeof...(T) is two, let T1 and T2 denote the two types in
+  // the pack T. Then
+  case 2: {
+auto T1 = Ts[0].getAsType();
+auto T2 = Ts[1].getAsType();
+
+// Let R be COMMON-REF(T1, T2). If T1 and T2 are reference ty

[clang] [Clang][OpenCL][AMDGPU] Use `byref` for OpenCL kernel arguments (PR #134892)

2025-04-13 Thread Matt Arsenault via cfe-commits

arsenm wrote:

> I might misunderstand it but based on your comment, it doesn't sound like the 
> issue is with using `byref` for aggregate arguments in OpenCL (which is what 
> this PR is trying to do), especially since OpenCL is currently the only 
> language not using it. We already use it for HIP.

Oh, this issue is just for only using byref for all arguments (which is what we 
should eventually do)


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


[clang] [cindex] Add support for calling getFullyQualifiedName to the Python binding. (PR #135420)

2025-04-13 Thread Matheus Izvekov via cfe-commits

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


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


[clang] [Clang][OpenCL][AMDGPU] Use `byref` for aggregate OpenCL kernel arguments (PR #134892)

2025-04-13 Thread Matt Arsenault via cfe-commits

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


[clang] clang/AMDGPU: Stop looking for oclc_daz_opt_* control libraries (PR #134805)

2025-04-13 Thread LLVM Continuous Integration via cfe-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `clang-aarch64-sve-vls` 
running on `linaro-g3-03` while building `clang` at step 7 "ninja check 1".

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


Here is the relevant piece of the build log for the reference

```
Step 7 (ninja check 1) failure: stage 1 checked (failure)
 TEST 'Flang :: Driver/omp-driver-offload.f90' FAILED 

Exit Code: 1

Command Output (stderr):
--
/home/tcwg-buildbot/worker/clang-aarch64-sve-vls/stage1/bin/flang -### -fopenmp 
/home/tcwg-buildbot/worker/clang-aarch64-sve-vls/llvm/flang/test/Driver/omp-driver-offload.f90
 2>&1 | /home/tcwg-buildbot/worker/clang-aarch64-sve-vls/stage1/bin/FileCheck 
--check-prefixes=CHECK-OPENMP 
/home/tcwg-buildbot/worker/clang-aarch64-sve-vls/llvm/flang/test/Driver/omp-driver-offload.f90
 # RUN: at line 10
+ /home/tcwg-buildbot/worker/clang-aarch64-sve-vls/stage1/bin/flang -### 
-fopenmp 
/home/tcwg-buildbot/worker/clang-aarch64-sve-vls/llvm/flang/test/Driver/omp-driver-offload.f90
+ /home/tcwg-buildbot/worker/clang-aarch64-sve-vls/stage1/bin/FileCheck 
--check-prefixes=CHECK-OPENMP 
/home/tcwg-buildbot/worker/clang-aarch64-sve-vls/llvm/flang/test/Driver/omp-driver-offload.f90
/home/tcwg-buildbot/worker/clang-aarch64-sve-vls/stage1/bin/flang -S -### 
/home/tcwg-buildbot/worker/clang-aarch64-sve-vls/llvm/flang/test/Driver/omp-driver-offload.f90
 -o 
/home/tcwg-buildbot/worker/clang-aarch64-sve-vls/stage1/tools/flang/test/Driver/Output/omp-driver-offload.f90.tmp
 2>&1  -fopenmp --offload-arch=gfx90a --offload-arch=sm_70  
--target=aarch64-unknown-linux-gnu -nogpulib   | 
/home/tcwg-buildbot/worker/clang-aarch64-sve-vls/stage1/bin/FileCheck 
/home/tcwg-buildbot/worker/clang-aarch64-sve-vls/llvm/flang/test/Driver/omp-driver-offload.f90
 --check-prefix=OFFLOAD-HOST-AND-DEVICE # RUN: at line 15
+ /home/tcwg-buildbot/worker/clang-aarch64-sve-vls/stage1/bin/FileCheck 
/home/tcwg-buildbot/worker/clang-aarch64-sve-vls/llvm/flang/test/Driver/omp-driver-offload.f90
 --check-prefix=OFFLOAD-HOST-AND-DEVICE
+ /home/tcwg-buildbot/worker/clang-aarch64-sve-vls/stage1/bin/flang -S -### 
/home/tcwg-buildbot/worker/clang-aarch64-sve-vls/llvm/flang/test/Driver/omp-driver-offload.f90
 -o 
/home/tcwg-buildbot/worker/clang-aarch64-sve-vls/stage1/tools/flang/test/Driver/Output/omp-driver-offload.f90.tmp
 -fopenmp --offload-arch=gfx90a --offload-arch=sm_70 
--target=aarch64-unknown-linux-gnu -nogpulib
/home/tcwg-buildbot/worker/clang-aarch64-sve-vls/stage1/bin/flang -S -### 
/home/tcwg-buildbot/worker/clang-aarch64-sve-vls/llvm/flang/test/Driver/omp-driver-offload.f90
 -o 
/home/tcwg-buildbot/worker/clang-aarch64-sve-vls/stage1/tools/flang/test/Driver/Output/omp-driver-offload.f90.tmp
 2>&1  -fopenmp --offload-arch=gfx90a --offload-arch=sm_70 
--offload-host-device  --target=aarch64-unknown-linux-gnu -nogpulib   | 
/home/tcwg-buildbot/worker/clang-aarch64-sve-vls/stage1/bin/FileCheck 
/home/tcwg-buildbot/worker/clang-aarch64-sve-vls/llvm/flang/test/Driver/omp-driver-offload.f90
 --check-prefix=OFFLOAD-HOST-AND-DEVICE # RUN: at line 20
+ /home/tcwg-buildbot/worker/clang-aarch64-sve-vls/stage1/bin/flang -S -### 
/home/tcwg-buildbot/worker/clang-aarch64-sve-vls/llvm/flang/test/Driver/omp-driver-offload.f90
 -o 
/home/tcwg-buildbot/worker/clang-aarch64-sve-vls/stage1/tools/flang/test/Driver/Output/omp-driver-offload.f90.tmp
 -fopenmp --offload-arch=gfx90a --offload-arch=sm_70 --offload-host-device 
--target=aarch64-unknown-linux-gnu -nogpulib
+ /home/tcwg-buildbot/worker/clang-aarch64-sve-vls/stage1/bin/FileCheck 
/home/tcwg-buildbot/worker/clang-aarch64-sve-vls/llvm/flang/test/Driver/omp-driver-offload.f90
 --check-prefix=OFFLOAD-HOST-AND-DEVICE
/home/tcwg-buildbot/worker/clang-aarch64-sve-vls/stage1/bin/flang -S -### 
/home/tcwg-buildbot/worker/clang-aarch64-sve-vls/llvm/flang/test/Driver/omp-driver-offload.f90
 -o 
/home/tcwg-buildbot/worker/clang-aarch64-sve-vls/stage1/tools/flang/test/Driver/Output/omp-driver-offload.f90.tmp
 2>&1  -fopenmp --offload-arch=gfx90a --offload-arch=sm_70 --offload-host-only  
--target=aarch64-unknown-linux-gnu -nogpulib   | 
/home/tcwg-buildbot/worker/clang-aarch64-sve-vls/stage1/bin/FileCheck 
/home/tcwg-buildbot/worker/clang-aarch64-sve-vls/llvm/flang/test/Driver/omp-driver-offload.f90
 --check-prefix=OFFLOAD-HOST # RUN: at line 30
+ /home/tcwg-buildbot/worker/clang-aarch64-sve-vls/stage1/bin/flang -S -### 
/home/tcwg-buildbot/worker/clang-aarch64-sve-vls/llvm/flang/test/Driver/omp-driver-offload.f90
 -o 
/home/tcwg-buildbot/worker/clang-aarch64-sve-vls/stage1/tools/flang/test/Driver/Output/omp-driver-offload.f90.tmp
 -fopenmp --offload-arch=gfx90a --offload-arch=sm_70 --offload-host-only 
--target=aarch64-unknown-linux-gnu -nogpulib
+ /home/tcwg-buildbot/worker/clang-aarch64-sve-vls/stage1/bin/FileCheck 
/home/tcwg-buildbot/worker/clang-aarch64-sve-vls/llvm/flang/test/Driver/omp-driver-offload.f

[clang] 84666d6 - Add back include for AutoConvert.h as it's needed for z/OS (#135430)

2025-04-13 Thread via cfe-commits

Author: Sean Perry
Date: 2025-04-13T03:04:58-07:00
New Revision: 84666d68740bea9eee19399ab5c8622ff2f6e9ca

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

LOG: Add back include for AutoConvert.h as it's needed for z/OS (#135430)

The commit
https://github.com/llvm/llvm-project/commit/a1935fd3809772c06f9a09fa151181642ae92b20
removed an include that is needed when building on z/OS.

Added: 


Modified: 
clang/lib/Basic/SourceManager.cpp

Removed: 




diff  --git a/clang/lib/Basic/SourceManager.cpp 
b/clang/lib/Basic/SourceManager.cpp
index a78ffc1e90ebe..6d6e54b1bec69 100644
--- a/clang/lib/Basic/SourceManager.cpp
+++ b/clang/lib/Basic/SourceManager.cpp
@@ -24,6 +24,7 @@
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/StringSwitch.h"
 #include "llvm/Support/Allocator.h"
+#include "llvm/Support/AutoConvert.h"
 #include "llvm/Support/Capacity.h"
 #include "llvm/Support/Compiler.h"
 #include "llvm/Support/Endian.h"



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


[clang] Add back include for AutoConvert.h as it's needed for z/OS (PR #135430)

2025-04-13 Thread Reid Kleckner via cfe-commits

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


[clang] Add back include for AutoConvert.h as it's needed for z/OS (PR #135430)

2025-04-13 Thread Reid Kleckner via cfe-commits

rnk wrote:

I just happened to look into the implementation of AutoConvert.h, and I see the 
entire interface is defined away when not targeting zOS. This means that all 
call sites need to be conditional on `ifdef __MVS__`, which means we have ugly 
ifdef droppings all over the codebase, which harms readability and 
understandability.

Can whoever owns this redesign the header so that it provides inline functions 
which have default implementations that return false / no_error to disable 
their functionality on non-zOS platforms? Otherwise this failure mode will 
happen again in the future. This seems like feedback that should've come up in 
the original review (https://reviews.llvm.org/D100483), but I don't recognize 
enough of the contributor names there to confirm that there was some approval 
from maintainers or the broader community, it looks like this was mostly 
approved by zOS stakeholders.

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


[clang] [clang][bytecode] Fix an inconsistency with loop condition jumps (PR #135530)

2025-04-13 Thread Timm Baeder via cfe-commits

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


[clang] 09588e9 - [clang][bytecode] Fix an inconsistency with loop condition jumps (#135530)

2025-04-13 Thread via cfe-commits

Author: Timm Baeder
Date: 2025-04-13T12:25:29+02:00
New Revision: 09588e93bbe486ce782de9fba604f5cd184ec446

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

LOG: [clang][bytecode] Fix an inconsistency with loop condition jumps (#135530)

When emitting the jump for e.g. a for loop condition, we used to jump
out of the CondScope, leaving the scope initialized, because we skipped
the corresponding Destroy opcode. If that loop was in a loop itself,
that outer loop could then iterate once more, leading to us initializing
a scope that was still initialized.
Fix this by also destroying the scope after the EndLabel.

Added: 


Modified: 
clang/lib/AST/ByteCode/Compiler.cpp
clang/lib/AST/ByteCode/Compiler.h

Removed: 




diff  --git a/clang/lib/AST/ByteCode/Compiler.cpp 
b/clang/lib/AST/ByteCode/Compiler.cpp
index 86b43585cd292..2e22c85ed5f6d 100644
--- a/clang/lib/AST/ByteCode/Compiler.cpp
+++ b/clang/lib/AST/ByteCode/Compiler.cpp
@@ -5431,39 +5431,39 @@ bool Compiler::visitForStmt(const ForStmt *S) {
   this->fallthrough(CondLabel);
   this->emitLabel(CondLabel);
 
-  {
-LocalScope CondScope(this);
-if (const DeclStmt *CondDecl = S->getConditionVariableDeclStmt())
-  if (!visitDeclStmt(CondDecl))
-return false;
-
-if (Cond) {
-  if (!this->visitBool(Cond))
-return false;
-  if (!this->jumpFalse(EndLabel))
-return false;
-}
-
-if (!this->maybeEmitDeferredVarInit(S->getConditionVariable()))
-  return false;
-
-if (Body && !this->visitStmt(Body))
+  // Start of loop body.
+  LocalScope CondScope(this);
+  if (const DeclStmt *CondDecl = S->getConditionVariableDeclStmt())
+if (!visitDeclStmt(CondDecl))
   return false;
 
-this->fallthrough(IncLabel);
-this->emitLabel(IncLabel);
-if (Inc && !this->discard(Inc))
+  if (Cond) {
+if (!this->visitBool(Cond))
   return false;
-
-if (!CondScope.destroyLocals())
+if (!this->jumpFalse(EndLabel))
   return false;
   }
+  if (!this->maybeEmitDeferredVarInit(S->getConditionVariable()))
+return false;
+
+  if (Body && !this->visitStmt(Body))
+return false;
+
+  this->fallthrough(IncLabel);
+  this->emitLabel(IncLabel);
+  if (Inc && !this->discard(Inc))
+return false;
+
+  if (!CondScope.destroyLocals())
+return false;
   if (!this->jump(CondLabel))
 return false;
+  // End of loop body.
 
-  this->fallthrough(EndLabel);
   this->emitLabel(EndLabel);
-  return true;
+  // If we jumped out of the loop above, we still need to clean up the 
condition
+  // scope.
+  return CondScope.destroyLocals();
 }
 
 template 

diff  --git a/clang/lib/AST/ByteCode/Compiler.h 
b/clang/lib/AST/ByteCode/Compiler.h
index 256e917728886..858957367d85d 100644
--- a/clang/lib/AST/ByteCode/Compiler.h
+++ b/clang/lib/AST/ByteCode/Compiler.h
@@ -531,9 +531,10 @@ template  class LocalScope : public 
VariableScope {
 if (!Idx)
   return true;
 
+// NB: We are *not* resetting Idx here as to allow multiple
+// calls to destroyLocals().
 bool Success = this->emitDestructors(E);
 this->Ctx->emitDestroy(*Idx, E);
-this->Idx = std::nullopt;
 return Success;
   }
 



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


[clang] clang/AMDGPU: Stop looking for oclc_daz_opt_* control libraries (PR #134805)

2025-04-13 Thread Jan Patrick Lehr via cfe-commits

jplehr wrote:

> LLVM Buildbot has detected a new failure on builder `clang-hip-vega20` 
> running on `hip-vega20-0` while building `clang` at step 3 "annotate".
> 
> Full details are available at: 
> https://lab.llvm.org/buildbot/#/builders/123/builds/17410
> 
> Here is the relevant piece of the build log for the reference

Hi, in this bot it is not the flang test that is failing but some HIP blender 
test. Also in https://lab.llvm.org/staging/#/builders/207/builds/1994 this 
produces undefined_reference errors.

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


[clang] clang/AMDGPU: Stop looking for oclc_daz_opt_* control libraries (PR #134805)

2025-04-13 Thread Matt Arsenault via cfe-commits

arsenm wrote:

> Hi, in this bot it is not the flang test that is failing but some HIP blender 
> test. Also in https://lab.llvm.org/staging/#/builders/207/builds/1994 this 
> produces undefined_reference errors.

Is this bot using an antique device libs? 


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


[clang] clang/AMDGPU: Stop looking for oclc_daz_opt_* control libraries (PR #134805)

2025-04-13 Thread Jan Patrick Lehr via cfe-commits

jplehr wrote:

This should be device libs from ROCm 6.3.3.

```
$ apt show rocm-device-libs
Package: rocm-device-libs
Version: 1.0.0.60303-74~22.04
Priority: optional
Section: devel
Maintainer: ROCm Compiler Support 
Installed-Size: 3424 kB
Depends: rocm-core
Homepage: https://github.com/RadeonOpenCompute/ROCm-Device-Libs
Download-Size: 720 kB
APT-Manual-Installed: yes
APT-Sources: https://repo.radeon.com/rocm/apt/6.3.3 jammy/main amd64 Packages
Description: Radeon Open Compute - device libraries
 This package includes LLVM bitcode libraries.
```

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


[clang] [llvm] [HIP][HIPSTDPAR][NFC] Re-order & adapt `hipstdpar` specific passes (PR #134753)

2025-04-13 Thread Matt Arsenault via cfe-commits

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


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


[clang-tools-extra] [clang-tidy] Improve `bugprone-exception-escape`: add stacktrace of escaped exception (PR #134375)

2025-04-13 Thread Baranov Victor via cfe-commits

vbvictor wrote:

Ping, appreciate it if someone will take a look at these changes.

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


[clang] [clang] AST: remove source locations from [Variable/Dependent]SizedArrayType (PR #135511)

2025-04-13 Thread Younan Zhang via cfe-commits

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

thanks

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


[clang] [clang][bytecode] Reject constexpr-unknown pointers from Inc ops (PR #135548)

2025-04-13 Thread Timm Baeder via cfe-commits

https://github.com/tbaederr created 
https://github.com/llvm/llvm-project/pull/135548

We used to accept c++ as a known value here, causing wrong codegen.

>From a64e39a20719b89dd946f404e83d32026f8db377 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timm=20B=C3=A4der?= 
Date: Sun, 13 Apr 2025 16:25:28 +0200
Subject: [PATCH] [clang][bytecode] Reject constexpr-unknown pointers from Inc
 ops

We used to accept c++ as a known value here, causing wrong codegen.
---
 clang/lib/AST/ByteCode/Interp.h |  5 +
 clang/test/AST/ByteCode/codegen.cpp | 11 ++-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/clang/lib/AST/ByteCode/Interp.h b/clang/lib/AST/ByteCode/Interp.h
index 4e84dcc8d551d..b4e15b3ffbe68 100644
--- a/clang/lib/AST/ByteCode/Interp.h
+++ b/clang/lib/AST/ByteCode/Interp.h
@@ -771,6 +771,11 @@ bool IncDecHelper(InterpState &S, CodePtr OpPC, const 
Pointer &Ptr,
   bool CanOverflow) {
   assert(!Ptr.isDummy());
 
+  if (!S.inConstantContext()) {
+if (isConstexprUnknown(Ptr))
+  return false;
+  }
+
   if constexpr (std::is_same_v) {
 if (!S.getLangOpts().CPlusPlus14)
   return Invalid(S, OpPC);
diff --git a/clang/test/AST/ByteCode/codegen.cpp 
b/clang/test/AST/ByteCode/codegen.cpp
index ea2c812f30f6f..7c853a20362b8 100644
--- a/clang/test/AST/ByteCode/codegen.cpp
+++ b/clang/test/AST/ByteCode/codegen.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-linux -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-linux -emit-llvm -o - %s 
| FileCheck %s
 // RUN: %clang_cc1 -triple x86_64-linux -emit-llvm -o - %s 
-fexperimental-new-constant-interpreter | FileCheck %s
 
 #ifdef __SIZEOF_INT128__
@@ -95,3 +95,12 @@ void f(A *a) {
   // CHECK: call void @_ZN1AD1Ev(
   A::E e3 = A().Foo;
 }
+
+int notdead() {
+  auto l = [c=0]() mutable {
+return  c++ < 5 ? 10 : 12;
+  };
+  return l();
+}
+// CHECK: _ZZ7notdeadvEN3$_0clEv
+// CHECK: ret i32 %cond

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


[clang] [Clang][OpenCL][AMDGPU] Use `byref` for aggregate OpenCL kernel arguments (PR #134892)

2025-04-13 Thread Shilei Tian via cfe-commits

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


[clang] [clang][bytecode] Reject constexpr-unknown pointers from Inc ops (PR #135548)

2025-04-13 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang

Author: Timm Baeder (tbaederr)


Changes

We used to accept c++ as a known value here, causing wrong codegen.

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


2 Files Affected:

- (modified) clang/lib/AST/ByteCode/Interp.h (+5) 
- (modified) clang/test/AST/ByteCode/codegen.cpp (+10-1) 


``diff
diff --git a/clang/lib/AST/ByteCode/Interp.h b/clang/lib/AST/ByteCode/Interp.h
index 4e84dcc8d551d..b4e15b3ffbe68 100644
--- a/clang/lib/AST/ByteCode/Interp.h
+++ b/clang/lib/AST/ByteCode/Interp.h
@@ -771,6 +771,11 @@ bool IncDecHelper(InterpState &S, CodePtr OpPC, const 
Pointer &Ptr,
   bool CanOverflow) {
   assert(!Ptr.isDummy());
 
+  if (!S.inConstantContext()) {
+if (isConstexprUnknown(Ptr))
+  return false;
+  }
+
   if constexpr (std::is_same_v) {
 if (!S.getLangOpts().CPlusPlus14)
   return Invalid(S, OpPC);
diff --git a/clang/test/AST/ByteCode/codegen.cpp 
b/clang/test/AST/ByteCode/codegen.cpp
index ea2c812f30f6f..7c853a20362b8 100644
--- a/clang/test/AST/ByteCode/codegen.cpp
+++ b/clang/test/AST/ByteCode/codegen.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-linux -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-linux -emit-llvm -o - %s 
| FileCheck %s
 // RUN: %clang_cc1 -triple x86_64-linux -emit-llvm -o - %s 
-fexperimental-new-constant-interpreter | FileCheck %s
 
 #ifdef __SIZEOF_INT128__
@@ -95,3 +95,12 @@ void f(A *a) {
   // CHECK: call void @_ZN1AD1Ev(
   A::E e3 = A().Foo;
 }
+
+int notdead() {
+  auto l = [c=0]() mutable {
+return  c++ < 5 ? 10 : 12;
+  };
+  return l();
+}
+// CHECK: _ZZ7notdeadvEN3$_0clEv
+// CHECK: ret i32 %cond

``




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


[clang] [cindex] Add support for calling getFullyQualifiedName to the Python binding. (PR #135420)

2025-04-13 Thread Jannick Kremer via cfe-commits

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


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


[clang] [cindex] Add support for calling getFullyQualifiedName to the Python binding. (PR #135420)

2025-04-13 Thread Brian Cody via cfe-commits

https://github.com/epistax updated 
https://github.com/llvm/llvm-project/pull/135420

>From 6fe4155fad0cdbc6ca04e37df143f22f537d5514 Mon Sep 17 00:00:00 2001
From: Brian Cody 
Date: Fri, 11 Apr 2025 14:27:22 -0400
Subject: [PATCH 1/7] [cindex] Add support for calling getFullyQualifiedName to
 the Python binding.

---
 clang/bindings/python/clang/cindex.py | 12 ++
 .../bindings/python/tests/cindex/test_type.py | 22 +++
 clang/docs/ReleaseNotes.rst   |  4 
 clang/include/clang-c/Index.h | 12 ++
 clang/tools/libclang/CXType.cpp   | 17 ++
 clang/tools/libclang/libclang.map |  1 +
 6 files changed, 68 insertions(+)

diff --git a/clang/bindings/python/clang/cindex.py 
b/clang/bindings/python/clang/cindex.py
index 2319534a6f121..5830dc2149348 100644
--- a/clang/bindings/python/clang/cindex.py
+++ b/clang/bindings/python/clang/cindex.py
@@ -2593,6 +2593,17 @@ def get_canonical(self):
 """
 return Type.from_result(conf.lib.clang_getCanonicalType(self), (self,))
 
+def get_fully_qualified_name(self, policy, with_global_ns_prefix = False):
+"""
+Get the fully qualified name for a type.
+
+This includes full qualification of all template parameters.
+
+policy - This PrintingPolicy can further refine the type formatting
+with_global_ns_prefix - If true, function will prepend a '::' to 
qualified names
+"""
+return 
_CXString.from_result(conf.lib.clang_getFullyQualifiedName(self, policy, 
with_global_ns_prefix))
+
 def is_const_qualified(self):
 """Determine whether a Type has the "const" qualifier set.
 
@@ -4022,6 +4033,7 @@ def set_property(self, property, value):
 ("clang_getTypeSpelling", [Type], _CXString),
 ("clang_hashCursor", [Cursor], c_uint),
 ("clang_isAttribute", [CursorKind], bool),
+("clang_getFullyQualifiedName", [Type, PrintingPolicy, c_uint], _CXString),
 ("clang_isConstQualifiedType", [Type], bool),
 ("clang_isCursorDefinition", [Cursor], bool),
 ("clang_isDeclaration", [CursorKind], bool),
diff --git a/clang/bindings/python/tests/cindex/test_type.py 
b/clang/bindings/python/tests/cindex/test_type.py
index a9473e1dc2458..b2a82a00b4f40 100644
--- a/clang/bindings/python/tests/cindex/test_type.py
+++ b/clang/bindings/python/tests/cindex/test_type.py
@@ -535,6 +535,28 @@ def test_pretty(self):
 pp.set_property(PrintingPolicyProperty.SuppressTagKeyword, False)
 self.assertEqual(f.type.get_canonical().pretty_printed(pp), "struct X")
 
+def test_fully_qualified_name(self):
+source = """
+namespace home {
+  class Bar {
+  };
+  class Foo {
+public:
+  void setIt(Bar*);
+  };
+}
+class A : public home::Foo {
+};
+"""
+tu = get_tu(source, lang="cpp")
+c = get_cursor(tu, "A")
+pp = PrintingPolicy.create(c)
+base = list(c.get_children())[0].type.get_declaration()
+set_it = list(base.get_children())[1]
+arg = list(set_it.get_arguments())[0]
+self.assertEqual(arg.type.get_fully_qualified_name(pp), "home::Bar *")
+self.assertEqual(arg.type.get_fully_qualified_name(pp, True), 
"::home::Bar *")
+
 def test_base_classes(self):
 source = """
 class A { int a; };
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 9c45965dc4d82..f228a32acd51d 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -589,6 +589,8 @@ libclang
 
 - Added ``clang_visitCXXMethods``, which allows visiting the methods
   of a class.
+- Added ``clang_getFullyQualifiedName``, which provides fully qualified type 
names as
+  instructed by a PrintingPolicy.
 
 - Fixed a buffer overflow in ``CXString`` implementation. The fix may result in
   increased memory allocation.
@@ -643,6 +645,8 @@ Python Binding Changes
   the cursor is a specialization of.
 - Added ``Type.get_methods``, a binding for ``clang_visitCXXMethods``, which
   allows visiting the methods of a class.
+- Added ``Type.getFullyQualifiedName``, which provides fully qualified type 
names as
+  instructed by a PrintingPolicy.
 
 OpenMP Support
 --
diff --git a/clang/include/clang-c/Index.h b/clang/include/clang-c/Index.h
index 38e2417dcd181..25700a48c928c 100644
--- a/clang/include/clang-c/Index.h
+++ b/clang/include/clang-c/Index.h
@@ -4223,6 +4223,18 @@ CINDEX_LINKAGE CXString 
clang_getCursorPrettyPrinted(CXCursor Cursor,
 CINDEX_LINKAGE CXString clang_getTypePrettyPrinted(CXType CT,
CXPrintingPolicy cxPolicy);
 
+/**
+ * Get the fully qualified name for a type.
+ *
+ * This includes full qualification of all template parameters.
+ *
+ * Policy - Further refine the type formatting
+ * WithGlobalNsPrefix - If non-zero, function will prepe

[clang] ce01e4e - [Clang][OpenCL][AMDGPU] Use `byref` for aggregate OpenCL kernel arguments (#134892)

2025-04-13 Thread via cfe-commits

Author: Shilei Tian
Date: 2025-04-13T10:17:55-04:00
New Revision: ce01e4e2f6cb2a1c37e3acceeac931b2031a02e8

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

LOG: [Clang][OpenCL][AMDGPU] Use `byref` for aggregate OpenCL kernel arguments 
(#134892)

Due to a previous workaround allowing kernels to be called from other
functions,
Clang currently doesn't use the `byref` attribute for aggregate kernel
arguments. The issue was recently resolved in
https://github.com/llvm/llvm-project/pull/115821. With that fix, we can
now
enable the use of `byref` consistently across all languages.

Co-authored-by: Matt Arsenault 

Fixes SWDEV-247226.

Co-authored-by: Matt Arsenault 

Added: 


Modified: 
clang/lib/CodeGen/Targets/AMDGPU.cpp
clang/test/CodeGenOpenCL/addr-space-struct-arg.cl
clang/test/CodeGenOpenCL/amdgpu-abi-struct-arg-byref.cl
clang/test/CodeGenOpenCL/amdgpu-abi-struct-coerce.cl
clang/test/CodeGenOpenCL/opencl-kernel-call.cl

Removed: 




diff  --git a/clang/lib/CodeGen/Targets/AMDGPU.cpp 
b/clang/lib/CodeGen/Targets/AMDGPU.cpp
index db2a2c5740646..bcf039d9f268a 100644
--- a/clang/lib/CodeGen/Targets/AMDGPU.cpp
+++ b/clang/lib/CodeGen/Targets/AMDGPU.cpp
@@ -198,14 +198,10 @@ ABIArgInfo 
AMDGPUABIInfo::classifyKernelArgumentType(QualType Ty) const {
 /*ToAS=*/getContext().getTargetAddressSpace(LangAS::cuda_device));
   }
 
-  // FIXME: Should also use this for OpenCL, but it requires addressing the
-  // problem of kernels being called.
-  //
   // FIXME: This doesn't apply the optimization of coercing pointers in structs
   // to global address space when using byref. This would require implementing 
a
   // new kind of coercion of the in-memory type when for indirect arguments.
-  if (!getContext().getLangOpts().OpenCL && LTy == OrigLTy &&
-  isAggregateTypeForABI(Ty)) {
+  if (LTy == OrigLTy && isAggregateTypeForABI(Ty)) {
 return ABIArgInfo::getIndirectAliased(
 getContext().getTypeAlignInChars(Ty),
 getContext().getTargetAddressSpace(LangAS::opencl_constant),

diff  --git a/clang/test/CodeGenOpenCL/addr-space-struct-arg.cl 
b/clang/test/CodeGenOpenCL/addr-space-struct-arg.cl
index 789aae7a5c34c..49604c6c5e61b 100644
--- a/clang/test/CodeGenOpenCL/addr-space-struct-arg.cl
+++ b/clang/test/CodeGenOpenCL/addr-space-struct-arg.cl
@@ -546,12 +546,10 @@ kernel void KernelLargeTwoMember(struct 
LargeStructTwoMember u) {
 //
 //
 // AMDGCN-LABEL: define dso_local amdgpu_kernel void @KernelLargeOneMember(
-// AMDGCN-SAME: [[STRUCT_LARGESTRUCTONEMEMBER:%.*]] [[U_COERCE:%.*]]) 
#[[ATTR1]] !kernel_arg_addr_space [[META10]] !kernel_arg_access_qual [[META11]] 
!kernel_arg_type [[META16:![0-9]+]] !kernel_arg_base_type [[META16]] 
!kernel_arg_type_qual [[META13]] {
+// AMDGCN-SAME: ptr addrspace(4) noundef 
byref([[STRUCT_LARGESTRUCTONEMEMBER:%.*]]) align 8 [[TMP0:%.*]]) #[[ATTR1]] 
!kernel_arg_addr_space [[META10]] !kernel_arg_access_qual [[META11]] 
!kernel_arg_type [[META16:![0-9]+]] !kernel_arg_base_type [[META16]] 
!kernel_arg_type_qual [[META13]] {
 // AMDGCN-NEXT:  [[ENTRY:.*:]]
 // AMDGCN-NEXT:[[U:%.*]] = alloca [[STRUCT_LARGESTRUCTONEMEMBER]], align 
8, addrspace(5)
-// AMDGCN-NEXT:[[TMP0:%.*]] = getelementptr inbounds nuw 
[[STRUCT_LARGESTRUCTONEMEMBER]], ptr addrspace(5) [[U]], i32 0, i32 0
-// AMDGCN-NEXT:[[TMP1:%.*]] = extractvalue [[STRUCT_LARGESTRUCTONEMEMBER]] 
[[U_COERCE]], 0
-// AMDGCN-NEXT:store [100 x <2 x i32>] [[TMP1]], ptr addrspace(5) 
[[TMP0]], align 8
+// AMDGCN-NEXT:call void @llvm.memcpy.p5.p4.i64(ptr addrspace(5) align 8 
[[U]], ptr addrspace(4) align 8 [[TMP0]], i64 800, i1 false)
 // AMDGCN-NEXT:call void @__clang_ocl_kern_imp_KernelLargeOneMember(ptr 
addrspace(5) noundef byref([[STRUCT_LARGESTRUCTONEMEMBER]]) align 8 [[U]]) 
#[[ATTR4]]
 // AMDGCN-NEXT:ret void
 //
@@ -596,20 +594,15 @@ kernel void KernelLargeTwoMember(struct 
LargeStructTwoMember u) {
 //
 //
 // AMDGCN-LABEL: define dso_local amdgpu_kernel void @KernelTwoMember(
-// AMDGCN-SAME: [[STRUCT_STRUCTTWOMEMBER:%.*]] [[U_COERCE:%.*]]) #[[ATTR1]] 
!kernel_arg_addr_space [[META10]] !kernel_arg_access_qual [[META11]] 
!kernel_arg_type [[META17:![0-9]+]] !kernel_arg_base_type [[META17]] 
!kernel_arg_type_qual [[META13]] {
+// AMDGCN-SAME: ptr addrspace(4) noundef byref([[STRUCT_STRUCTTWOMEMBER:%.*]]) 
align 8 [[TMP0:%.*]]) #[[ATTR1]] !kernel_arg_addr_space [[META10]] 
!kernel_arg_access_qual [[META11]] !kernel_arg_type [[META17:![0-9]+]] 
!kernel_arg_base_type [[META17]] !kernel_arg_type_qual [[META13]] {
 // AMDGCN-NEXT:  [[ENTRY:.*:]]
 // AMDGCN-NEXT:[[U:%.*]] = alloca [[STRUCT_STRUCTTWOMEMBER]], align 8, 
addrspace(5)
-// AMDGCN-NEXT:[[TMP0:%.*]] = getelementptr inbounds nuw 
[[STRUCT_STRUCTTWOMEMBER]], ptr addrspace(5

[clang] [Clang][OpenCL][AMDGPU] Use `byref` for aggregate OpenCL kernel arguments (PR #134892)

2025-04-13 Thread LLVM Continuous Integration via cfe-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `lldb-remote-linux-win` 
running on `as-builder-10` while building `clang` at step 17 
"test-check-lldb-api".

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


Here is the relevant piece of the build log for the reference

```
Step 17 (test-check-lldb-api) failure: Test just built components: 
check-lldb-api completed (failure)
 TEST 'lldb-api :: 
functionalities/thread/concurrent_events/TestConcurrentManySignals.py' FAILED 

Script:
--
C:/Python312/python.exe 
C:/buildbot/as-builder-10/lldb-x-aarch64/llvm-project/lldb\test\API\dotest.py 
-u CXXFLAGS -u CFLAGS --env 
LLVM_LIBS_DIR=C:/buildbot/as-builder-10/lldb-x-aarch64/build/./lib --env 
LLVM_INCLUDE_DIR=C:/buildbot/as-builder-10/lldb-x-aarch64/build/include --env 
LLVM_TOOLS_DIR=C:/buildbot/as-builder-10/lldb-x-aarch64/build/./bin --arch 
aarch64 --build-dir 
C:/buildbot/as-builder-10/lldb-x-aarch64/build/lldb-test-build.noindex 
--lldb-module-cache-dir 
C:/buildbot/as-builder-10/lldb-x-aarch64/build/lldb-test-build.noindex/module-cache-lldb\lldb-api
 --clang-module-cache-dir 
C:/buildbot/as-builder-10/lldb-x-aarch64/build/lldb-test-build.noindex/module-cache-clang\lldb-api
 --executable C:/buildbot/as-builder-10/lldb-x-aarch64/build/./bin/lldb.exe 
--compiler C:/buildbot/as-builder-10/lldb-x-aarch64/build/./bin/clang.exe 
--dsymutil C:/buildbot/as-builder-10/lldb-x-aarch64/build/./bin/dsymutil.exe 
--make C:/ninja/make.exe --llvm-tools-dir 
C:/buildbot/as-builder-10/lldb-x-aarch64/build/./bin --lldb-obj-root 
C:/buildbot/as-builder-10/lldb-x-aarch64/build/tools/lldb --lldb-libs-dir 
C:/buildbot/as-builder-10/lldb-x-aarch64/build/./lib --platform-url 
connect://jetson-agx-0086.lab.llvm.org:1234 --platform-working-dir 
/home/ubuntu/lldb-tests --sysroot c:/buildbot/fs/jetson-agx-ubuntu --env 
ARCH_CFLAGS=-mcpu=cortex-a78 --platform-name remote-linux 
--skip-category=lldb-server 
C:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\lldb\test\API\functionalities\thread\concurrent_events
 -p TestConcurrentManySignals.py
--
Exit Code: 1

Command Output (stdout):
--
lldb version 21.0.0git (https://github.com/llvm/llvm-project.git revision 
ce01e4e2f6cb2a1c37e3acceeac931b2031a02e8)
  clang revision ce01e4e2f6cb2a1c37e3acceeac931b2031a02e8
  llvm revision ce01e4e2f6cb2a1c37e3acceeac931b2031a02e8
Setting up remote platform 'remote-linux'

Connecting to remote platform 'remote-linux' at 
'connect://jetson-agx-0086.lab.llvm.org:1234'...

Connected.

Setting remote platform working directory to '/home/ubuntu/lldb-tests'...

Skipping the following test categories: ['lldb-server', 'dsym', 'gmodules', 
'debugserver', 'objc', 'lldb-dap']


--
Command Output (stderr):
--
FAIL: LLDB 
(C:\buildbot\as-builder-10\lldb-x-aarch64\build\bin\clang.exe-aarch64) :: test 
(TestConcurrentManySignals.ConcurrentManySignals.test)

==

FAIL: test (TestConcurrentManySignals.ConcurrentManySignals.test)

   Test 100 signals from 100 threads.

--

Traceback (most recent call last):

  File 
"C:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\lldb\packages\Python\lldbsuite\test\decorators.py",
 line 148, in wrapper

return func(*args, **kwargs)

   ^

  File 
"C:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\lldb\test\API\functionalities\thread\concurrent_events\TestConcurrentManySignals.py",
 line 16, in test

self.do_thread_actions(num_signal_threads=100)

  File 
"C:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\lldb\packages\Python\lldbsuite\test\concurrent_base.py",
 line 261, in do_thread_actions

...

```



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


[clang] [Clang] Improve ``-Wtautological-overlap-compare`` diagnostics flag (PR #133653)

2025-04-13 Thread Yutong Zhu via cfe-commits

https://github.com/YutongZhuu updated 
https://github.com/llvm/llvm-project/pull/133653

>From ca795c3f27e37ad8a8f165a3b10e9415cbfd66a5 Mon Sep 17 00:00:00 2001
From: Yutong Zhu 
Date: Sat, 12 Apr 2025 15:32:46 -0400
Subject: [PATCH 1/4] Improved the -Wtautological-overlap-compare diagnostics
 to warn about overlapping and non-overlapping ranges involving character
 literals and floating-point literals.

---
 clang/docs/ReleaseNotes.rst   |   3 +
 .../clang/Basic/DiagnosticSemaKinds.td|   2 +-
 clang/lib/Analysis/CFG.cpp| 179 +++---
 clang/lib/Sema/AnalysisBasedWarnings.cpp  |   5 +-
 clang/test/Sema/warn-overlap.c| 119 ++--
 5 files changed, 211 insertions(+), 97 deletions(-)

diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 11f62bc881b03..de5c877cf996b 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -352,6 +352,9 @@ Improvements to Clang's diagnostics
 - Now correctly diagnose a tentative definition of an array with static
   storage duration in pedantic mode in C. (#GH50661)
 
+- Improved the ``-Wtautological-overlap-compare`` diagnostics to warn about 
overlapping and non-overlapping ranges involving character literals and 
floating-point literals. 
+  The warning message for non-overlapping cases has also been improved 
(#GH13473).
+  
 Improvements to Clang's time-trace
 --
 
diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td 
b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index 180ca39bc07e9..c8b5c94676d18 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -10356,7 +10356,7 @@ def warn_tautological_negation_or_compare: Warning<
   "'||' of a value and its negation always evaluates to true">,
   InGroup, DefaultIgnore;
 def warn_tautological_overlap_comparison : Warning<
-  "overlapping comparisons always evaluate to %select{false|true}0">,
+  "%select{non-|}0overlapping comparisons always evaluate to 
%select{false|true}0">,
   InGroup, DefaultIgnore;
 def warn_depr_array_comparison : Warning<
   "comparison between two arrays is deprecated; "
diff --git a/clang/lib/Analysis/CFG.cpp b/clang/lib/Analysis/CFG.cpp
index 9af1e915482da..ec7c1fbfc423a 100644
--- a/clang/lib/Analysis/CFG.cpp
+++ b/clang/lib/Analysis/CFG.cpp
@@ -70,19 +70,18 @@ static SourceLocation GetEndLoc(Decl *D) {
   return D->getLocation();
 }
 
-/// Returns true on constant values based around a single IntegerLiteral.
-/// Allow for use of parentheses, integer casts, and negative signs.
-/// FIXME: it would be good to unify this function with
-/// getIntegerLiteralSubexpressionValue at some point given the similarity
-/// between the functions.
+/// Returns true on constant values based around a single IntegerLiteral,
+/// CharacterLiteral, or FloatingLiteral. Allow for use of parentheses, integer
+/// casts, and negative signs.
 
-static bool IsIntegerLiteralConstantExpr(const Expr *E) {
+static bool IsLiteralConstantExpr(const Expr *E) {
   // Allow parentheses
   E = E->IgnoreParens();
 
   // Allow conversions to different integer kind.
   if (const auto *CE = dyn_cast(E)) {
-if (CE->getCastKind() != CK_IntegralCast)
+if (CE->getCastKind() != CK_IntegralCast &&
+CE->getCastKind() != CK_IntegralToFloating)
   return false;
 E = CE->getSubExpr();
   }
@@ -93,16 +92,16 @@ static bool IsIntegerLiteralConstantExpr(const Expr *E) {
   return false;
 E = UO->getSubExpr();
   }
-
-  return isa(E);
+  return isa(E) || isa(E) ||
+ isa(E);
 }
 
 /// Helper for tryNormalizeBinaryOperator. Attempts to extract an 
IntegerLiteral
-/// constant expression or EnumConstantDecl from the given Expr. If it fails,
-/// returns nullptr.
-static const Expr *tryTransformToIntOrEnumConstant(const Expr *E) {
+/// FloatingLiteral, CharacterLiteral or EnumConstantDecl from the given Expr.
+/// If it fails, returns nullptr.
+static const Expr *tryTransformToLiteralConstant(const Expr *E) {
   E = E->IgnoreParens();
-  if (IsIntegerLiteralConstantExpr(E))
+  if (IsLiteralConstantExpr(E))
 return E;
   if (auto *DR = dyn_cast(E->IgnoreParenImpCasts()))
 return isa(DR->getDecl()) ? DR : nullptr;
@@ -119,7 +118,7 @@ tryNormalizeBinaryOperator(const BinaryOperator *B) {
   BinaryOperatorKind Op = B->getOpcode();
 
   const Expr *MaybeDecl = B->getLHS();
-  const Expr *Constant = tryTransformToIntOrEnumConstant(B->getRHS());
+  const Expr *Constant = tryTransformToLiteralConstant(B->getRHS());
   // Expr looked like `0 == Foo` instead of `Foo == 0`
   if (Constant == nullptr) {
 // Flip the operator
@@ -133,7 +132,7 @@ tryNormalizeBinaryOperator(const BinaryOperator *B) {
   Op = BO_GE;
 
 MaybeDecl = B->getRHS();
-Constant = tryTransformToIntOrEnumConstant(B->getLHS());
+Constant = tryTransformToLiteralConstant(B->getLHS());
   }
 
   return 

[clang] [CIR] cir.call with scalar return type (PR #135552)

2025-04-13 Thread Sirui Mu via cfe-commits

https://github.com/Lancern created 
https://github.com/llvm/llvm-project/pull/135552

This PR introduces support for calling functions with a scalar return type to 
the upstream. This PR also includes an initial version of `CIRGenTargetInfo` 
and related definitions which are essential for the CIRGen of call ops.

Related to #132487 .

>From fcd100485e1a589be20ddd6b9050cdd5e5281fa6 Mon Sep 17 00:00:00 2001
From: Sirui Mu 
Date: Sun, 13 Apr 2025 23:34:21 +0800
Subject: [PATCH] [CIR] cir.call with scalar return type

This patch introduces support for calling functions with a scalar return type to
the upstream. This patch also includes an initial version of CIRGenTargetInfo
and related definitions which are essential for the CIRGen of call ops.
---
 clang/include/clang/CIR/ABIArgInfo.h  | 89 +++
 .../CIR/Dialect/Builder/CIRBaseBuilder.h  |  8 +-
 clang/include/clang/CIR/Dialect/IR/CIROps.td  |  6 +-
 clang/include/clang/CIR/MissingFeatures.h |  4 +
 clang/lib/CIR/CodeGen/ABIInfo.h   | 32 +++
 clang/lib/CIR/CodeGen/CIRGenCall.cpp  | 82 ++---
 clang/lib/CIR/CodeGen/CIRGenCall.h|  4 +
 clang/lib/CIR/CodeGen/CIRGenExpr.cpp  | 24 +++--
 clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp|  7 +-
 clang/lib/CIR/CodeGen/CIRGenFunction.h| 15 +++-
 clang/lib/CIR/CodeGen/CIRGenFunctionInfo.h| 39 +++-
 clang/lib/CIR/CodeGen/CIRGenModule.cpp| 30 +++
 clang/lib/CIR/CodeGen/CIRGenModule.h  |  6 ++
 clang/lib/CIR/CodeGen/CIRGenTypes.cpp | 19 +++-
 clang/lib/CIR/CodeGen/CIRGenTypes.h   |  9 +-
 clang/lib/CIR/CodeGen/CMakeLists.txt  |  1 +
 clang/lib/CIR/CodeGen/TargetInfo.cpp  | 50 +++
 clang/lib/CIR/CodeGen/TargetInfo.h| 41 +
 clang/lib/CIR/Dialect/IR/CIRDialect.cpp   | 29 +-
 clang/test/CIR/CodeGen/call.cpp   | 10 +++
 clang/test/CIR/IR/call.cir| 14 +++
 21 files changed, 480 insertions(+), 39 deletions(-)
 create mode 100644 clang/include/clang/CIR/ABIArgInfo.h
 create mode 100644 clang/lib/CIR/CodeGen/ABIInfo.h
 create mode 100644 clang/lib/CIR/CodeGen/TargetInfo.cpp
 create mode 100644 clang/lib/CIR/CodeGen/TargetInfo.h

diff --git a/clang/include/clang/CIR/ABIArgInfo.h 
b/clang/include/clang/CIR/ABIArgInfo.h
new file mode 100644
index 0..0c2cd85915aa7
--- /dev/null
+++ b/clang/include/clang/CIR/ABIArgInfo.h
@@ -0,0 +1,89 @@
+//==-- ABIArgInfo.h - Abstract info regarding ABI-specific arguments 
---==//
+//
+// 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
+//
+//===--===//
+//
+// Defines ABIArgInfo and associated types used by CIR to track information
+// regarding ABI-coerced types for function arguments and return values. This
+// was moved to the common library as it might be used by both CIRGen and
+// passes.
+//
+//===--===//
+
+#ifndef LLVM_CLANG_CIR_ABIARGINFO_H
+#define LLVM_CLANG_CIR_ABIARGINFO_H
+
+#include "MissingFeatures.h"
+#include "mlir/IR/Types.h"
+
+namespace cir {
+
+class ABIArgInfo {
+public:
+  enum Kind : uint8_t {
+/// Pass the argument directly using the normal converted CIR type,
+/// or by coercing to another specified type stored in 'CoerceToType'). If
+/// an offset is specified (in UIntData), then the argument passed is 
offset
+/// by some number of bytes in the memory representation. A dummy argument
+/// is emitted before the real argument if the specified type stored in
+/// "PaddingType" is not zero.
+Direct,
+
+/// Ignore the argument (treat as void). Useful for void and empty
+/// structs.
+Ignore,
+  };
+
+private:
+  mlir::Type typeData;
+  struct DirectAttrInfo {
+unsigned offset;
+unsigned align;
+  };
+  union {
+DirectAttrInfo directAttr;
+  };
+  Kind theKind;
+
+public:
+  ABIArgInfo(Kind k = Direct) : directAttr{0, 0}, theKind(k) {}
+
+  static ABIArgInfo getDirect(mlir::Type ty = nullptr) {
+ABIArgInfo info(Direct);
+info.setCoerceToType(ty);
+return info;
+  }
+
+  static ABIArgInfo getIgnore() { return ABIArgInfo(Ignore); }
+
+  Kind getKind() const { return theKind; }
+  bool isDirect() const { return theKind == Direct; }
+  bool isIgnore() const { return theKind == Ignore; }
+
+  bool canHaveCoerceToType() const {
+assert(!cir::MissingFeatures::abiArgInfo());
+return isDirect();
+  }
+
+  unsigned getDirectOffset() const {
+assert(!cir::MissingFeatures::abiArgInfo());
+return directAttr.offset;
+  }
+
+  mlir::Type getCoerceToType() const {
+assert(canHaveCoerceToType() && "invalid kind!");
+return typeData;
+  }
+
+  void setCoerceToType(mlir::Type ty) {
+asser

[clang] [CIR] cir.call with scalar return type (PR #135552)

2025-04-13 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clangir

Author: Sirui Mu (Lancern)


Changes

This PR introduces support for calling functions with a scalar return type to 
the upstream. This PR also includes an initial version of `CIRGenTargetInfo` 
and related definitions which are essential for the CIRGen of call ops.

Related to #132487 .

---

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


21 Files Affected:

- (added) clang/include/clang/CIR/ABIArgInfo.h (+89) 
- (modified) clang/include/clang/CIR/Dialect/Builder/CIRBaseBuilder.h (+5-3) 
- (modified) clang/include/clang/CIR/Dialect/IR/CIROps.td (+5-1) 
- (modified) clang/include/clang/CIR/MissingFeatures.h (+4) 
- (added) clang/lib/CIR/CodeGen/ABIInfo.h (+32) 
- (modified) clang/lib/CIR/CodeGen/CIRGenCall.cpp (+72-10) 
- (modified) clang/lib/CIR/CodeGen/CIRGenCall.h (+4) 
- (modified) clang/lib/CIR/CodeGen/CIRGenExpr.cpp (+19-5) 
- (modified) clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp (+2-5) 
- (modified) clang/lib/CIR/CodeGen/CIRGenFunction.h (+11-4) 
- (modified) clang/lib/CIR/CodeGen/CIRGenFunctionInfo.h (+35-4) 
- (modified) clang/lib/CIR/CodeGen/CIRGenModule.cpp (+30) 
- (modified) clang/lib/CIR/CodeGen/CIRGenModule.h (+6) 
- (modified) clang/lib/CIR/CodeGen/CIRGenTypes.cpp (+15-4) 
- (modified) clang/lib/CIR/CodeGen/CIRGenTypes.h (+7-2) 
- (modified) clang/lib/CIR/CodeGen/CMakeLists.txt (+1) 
- (added) clang/lib/CIR/CodeGen/TargetInfo.cpp (+50) 
- (added) clang/lib/CIR/CodeGen/TargetInfo.h (+41) 
- (modified) clang/lib/CIR/Dialect/IR/CIRDialect.cpp (+28-1) 
- (modified) clang/test/CIR/CodeGen/call.cpp (+10) 
- (modified) clang/test/CIR/IR/call.cir (+14) 


``diff
diff --git a/clang/include/clang/CIR/ABIArgInfo.h 
b/clang/include/clang/CIR/ABIArgInfo.h
new file mode 100644
index 0..0c2cd85915aa7
--- /dev/null
+++ b/clang/include/clang/CIR/ABIArgInfo.h
@@ -0,0 +1,89 @@
+//==-- ABIArgInfo.h - Abstract info regarding ABI-specific arguments 
---==//
+//
+// 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
+//
+//===--===//
+//
+// Defines ABIArgInfo and associated types used by CIR to track information
+// regarding ABI-coerced types for function arguments and return values. This
+// was moved to the common library as it might be used by both CIRGen and
+// passes.
+//
+//===--===//
+
+#ifndef LLVM_CLANG_CIR_ABIARGINFO_H
+#define LLVM_CLANG_CIR_ABIARGINFO_H
+
+#include "MissingFeatures.h"
+#include "mlir/IR/Types.h"
+
+namespace cir {
+
+class ABIArgInfo {
+public:
+  enum Kind : uint8_t {
+/// Pass the argument directly using the normal converted CIR type,
+/// or by coercing to another specified type stored in 'CoerceToType'). If
+/// an offset is specified (in UIntData), then the argument passed is 
offset
+/// by some number of bytes in the memory representation. A dummy argument
+/// is emitted before the real argument if the specified type stored in
+/// "PaddingType" is not zero.
+Direct,
+
+/// Ignore the argument (treat as void). Useful for void and empty
+/// structs.
+Ignore,
+  };
+
+private:
+  mlir::Type typeData;
+  struct DirectAttrInfo {
+unsigned offset;
+unsigned align;
+  };
+  union {
+DirectAttrInfo directAttr;
+  };
+  Kind theKind;
+
+public:
+  ABIArgInfo(Kind k = Direct) : directAttr{0, 0}, theKind(k) {}
+
+  static ABIArgInfo getDirect(mlir::Type ty = nullptr) {
+ABIArgInfo info(Direct);
+info.setCoerceToType(ty);
+return info;
+  }
+
+  static ABIArgInfo getIgnore() { return ABIArgInfo(Ignore); }
+
+  Kind getKind() const { return theKind; }
+  bool isDirect() const { return theKind == Direct; }
+  bool isIgnore() const { return theKind == Ignore; }
+
+  bool canHaveCoerceToType() const {
+assert(!cir::MissingFeatures::abiArgInfo());
+return isDirect();
+  }
+
+  unsigned getDirectOffset() const {
+assert(!cir::MissingFeatures::abiArgInfo());
+return directAttr.offset;
+  }
+
+  mlir::Type getCoerceToType() const {
+assert(canHaveCoerceToType() && "invalid kind!");
+return typeData;
+  }
+
+  void setCoerceToType(mlir::Type ty) {
+assert(canHaveCoerceToType() && "invalid kind!");
+typeData = ty;
+  }
+};
+
+} // namespace cir
+
+#endif // LLVM_CLANG_CIR_ABIARGINFO_H
diff --git a/clang/include/clang/CIR/Dialect/Builder/CIRBaseBuilder.h 
b/clang/include/clang/CIR/Dialect/Builder/CIRBaseBuilder.h
index 68a4505ca7a5a..a24006810c1f5 100644
--- a/clang/include/clang/CIR/Dialect/Builder/CIRBaseBuilder.h
+++ b/clang/include/clang/CIR/Dialect/Builder/CIRBaseBuilder.h
@@ -205,13 +205,15 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
   // Call operators
   
/

[clang] [CIR] cir.call with scalar return type (PR #135552)

2025-04-13 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang

Author: Sirui Mu (Lancern)


Changes

This PR introduces support for calling functions with a scalar return type to 
the upstream. This PR also includes an initial version of `CIRGenTargetInfo` 
and related definitions which are essential for the CIRGen of call ops.

Related to #132487 .

---

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


21 Files Affected:

- (added) clang/include/clang/CIR/ABIArgInfo.h (+89) 
- (modified) clang/include/clang/CIR/Dialect/Builder/CIRBaseBuilder.h (+5-3) 
- (modified) clang/include/clang/CIR/Dialect/IR/CIROps.td (+5-1) 
- (modified) clang/include/clang/CIR/MissingFeatures.h (+4) 
- (added) clang/lib/CIR/CodeGen/ABIInfo.h (+32) 
- (modified) clang/lib/CIR/CodeGen/CIRGenCall.cpp (+72-10) 
- (modified) clang/lib/CIR/CodeGen/CIRGenCall.h (+4) 
- (modified) clang/lib/CIR/CodeGen/CIRGenExpr.cpp (+19-5) 
- (modified) clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp (+2-5) 
- (modified) clang/lib/CIR/CodeGen/CIRGenFunction.h (+11-4) 
- (modified) clang/lib/CIR/CodeGen/CIRGenFunctionInfo.h (+35-4) 
- (modified) clang/lib/CIR/CodeGen/CIRGenModule.cpp (+30) 
- (modified) clang/lib/CIR/CodeGen/CIRGenModule.h (+6) 
- (modified) clang/lib/CIR/CodeGen/CIRGenTypes.cpp (+15-4) 
- (modified) clang/lib/CIR/CodeGen/CIRGenTypes.h (+7-2) 
- (modified) clang/lib/CIR/CodeGen/CMakeLists.txt (+1) 
- (added) clang/lib/CIR/CodeGen/TargetInfo.cpp (+50) 
- (added) clang/lib/CIR/CodeGen/TargetInfo.h (+41) 
- (modified) clang/lib/CIR/Dialect/IR/CIRDialect.cpp (+28-1) 
- (modified) clang/test/CIR/CodeGen/call.cpp (+10) 
- (modified) clang/test/CIR/IR/call.cir (+14) 


``diff
diff --git a/clang/include/clang/CIR/ABIArgInfo.h 
b/clang/include/clang/CIR/ABIArgInfo.h
new file mode 100644
index 0..0c2cd85915aa7
--- /dev/null
+++ b/clang/include/clang/CIR/ABIArgInfo.h
@@ -0,0 +1,89 @@
+//==-- ABIArgInfo.h - Abstract info regarding ABI-specific arguments 
---==//
+//
+// 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
+//
+//===--===//
+//
+// Defines ABIArgInfo and associated types used by CIR to track information
+// regarding ABI-coerced types for function arguments and return values. This
+// was moved to the common library as it might be used by both CIRGen and
+// passes.
+//
+//===--===//
+
+#ifndef LLVM_CLANG_CIR_ABIARGINFO_H
+#define LLVM_CLANG_CIR_ABIARGINFO_H
+
+#include "MissingFeatures.h"
+#include "mlir/IR/Types.h"
+
+namespace cir {
+
+class ABIArgInfo {
+public:
+  enum Kind : uint8_t {
+/// Pass the argument directly using the normal converted CIR type,
+/// or by coercing to another specified type stored in 'CoerceToType'). If
+/// an offset is specified (in UIntData), then the argument passed is 
offset
+/// by some number of bytes in the memory representation. A dummy argument
+/// is emitted before the real argument if the specified type stored in
+/// "PaddingType" is not zero.
+Direct,
+
+/// Ignore the argument (treat as void). Useful for void and empty
+/// structs.
+Ignore,
+  };
+
+private:
+  mlir::Type typeData;
+  struct DirectAttrInfo {
+unsigned offset;
+unsigned align;
+  };
+  union {
+DirectAttrInfo directAttr;
+  };
+  Kind theKind;
+
+public:
+  ABIArgInfo(Kind k = Direct) : directAttr{0, 0}, theKind(k) {}
+
+  static ABIArgInfo getDirect(mlir::Type ty = nullptr) {
+ABIArgInfo info(Direct);
+info.setCoerceToType(ty);
+return info;
+  }
+
+  static ABIArgInfo getIgnore() { return ABIArgInfo(Ignore); }
+
+  Kind getKind() const { return theKind; }
+  bool isDirect() const { return theKind == Direct; }
+  bool isIgnore() const { return theKind == Ignore; }
+
+  bool canHaveCoerceToType() const {
+assert(!cir::MissingFeatures::abiArgInfo());
+return isDirect();
+  }
+
+  unsigned getDirectOffset() const {
+assert(!cir::MissingFeatures::abiArgInfo());
+return directAttr.offset;
+  }
+
+  mlir::Type getCoerceToType() const {
+assert(canHaveCoerceToType() && "invalid kind!");
+return typeData;
+  }
+
+  void setCoerceToType(mlir::Type ty) {
+assert(canHaveCoerceToType() && "invalid kind!");
+typeData = ty;
+  }
+};
+
+} // namespace cir
+
+#endif // LLVM_CLANG_CIR_ABIARGINFO_H
diff --git a/clang/include/clang/CIR/Dialect/Builder/CIRBaseBuilder.h 
b/clang/include/clang/CIR/Dialect/Builder/CIRBaseBuilder.h
index 68a4505ca7a5a..a24006810c1f5 100644
--- a/clang/include/clang/CIR/Dialect/Builder/CIRBaseBuilder.h
+++ b/clang/include/clang/CIR/Dialect/Builder/CIRBaseBuilder.h
@@ -205,13 +205,15 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
   // Call operators
   
//=

[clang] [clang][bytecode] Reject constexpr-unknown pointers from Inc ops (PR #135548)

2025-04-13 Thread Timm Baeder via cfe-commits

https://github.com/tbaederr updated 
https://github.com/llvm/llvm-project/pull/135548

>From d26fc41fbfcb7c6c3159e3a7314d84c2ce2785b4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timm=20B=C3=A4der?= 
Date: Sun, 13 Apr 2025 16:25:28 +0200
Subject: [PATCH] [clang][bytecode] Reject constexpr-unknown pointers from Inc
 ops

We used to accept c++ as a known value here, causing wrong codegen.
---
 clang/lib/AST/ByteCode/Interp.cpp   |  2 +-
 clang/lib/AST/ByteCode/Interp.h |  5 +
 clang/test/AST/ByteCode/codegen.cpp | 11 ++-
 3 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/clang/lib/AST/ByteCode/Interp.cpp 
b/clang/lib/AST/ByteCode/Interp.cpp
index 0afd772c73b85..3e1f36da8925f 100644
--- a/clang/lib/AST/ByteCode/Interp.cpp
+++ b/clang/lib/AST/ByteCode/Interp.cpp
@@ -307,7 +307,7 @@ bool isConstexprUnknown(const Pointer &P) {
   if (P.isDummy())
 return false;
   const VarDecl *VD = P.block()->getDescriptor()->asVarDecl();
-  return VD && VD->hasLocalStorage();
+  return VD && VD->hasLocalStorage() && !isa(VD);
 }
 
 bool CheckBCPResult(InterpState &S, const Pointer &Ptr) {
diff --git a/clang/lib/AST/ByteCode/Interp.h b/clang/lib/AST/ByteCode/Interp.h
index 4e84dcc8d551d..b4e15b3ffbe68 100644
--- a/clang/lib/AST/ByteCode/Interp.h
+++ b/clang/lib/AST/ByteCode/Interp.h
@@ -771,6 +771,11 @@ bool IncDecHelper(InterpState &S, CodePtr OpPC, const 
Pointer &Ptr,
   bool CanOverflow) {
   assert(!Ptr.isDummy());
 
+  if (!S.inConstantContext()) {
+if (isConstexprUnknown(Ptr))
+  return false;
+  }
+
   if constexpr (std::is_same_v) {
 if (!S.getLangOpts().CPlusPlus14)
   return Invalid(S, OpPC);
diff --git a/clang/test/AST/ByteCode/codegen.cpp 
b/clang/test/AST/ByteCode/codegen.cpp
index ea2c812f30f6f..7c853a20362b8 100644
--- a/clang/test/AST/ByteCode/codegen.cpp
+++ b/clang/test/AST/ByteCode/codegen.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-linux -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-linux -emit-llvm -o - %s 
| FileCheck %s
 // RUN: %clang_cc1 -triple x86_64-linux -emit-llvm -o - %s 
-fexperimental-new-constant-interpreter | FileCheck %s
 
 #ifdef __SIZEOF_INT128__
@@ -95,3 +95,12 @@ void f(A *a) {
   // CHECK: call void @_ZN1AD1Ev(
   A::E e3 = A().Foo;
 }
+
+int notdead() {
+  auto l = [c=0]() mutable {
+return  c++ < 5 ? 10 : 12;
+  };
+  return l();
+}
+// CHECK: _ZZ7notdeadvEN3$_0clEv
+// CHECK: ret i32 %cond

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


[clang] [CIR] cir.call with scalar return type (PR #135552)

2025-04-13 Thread Sirui Mu via cfe-commits

Lancern wrote:

The CI failure on code formatting seems to be a problem in the code formatter 
script itself rather than in the patch content.

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


[clang] 5f11d64 - [clang-format] Fix a bug in AlignConsecutiveDeclarations (#135516)

2025-04-13 Thread via cfe-commits

Author: Owen Pan
Date: 2025-04-13T09:01:37-07:00
New Revision: 5f11d64cfb44fc0adf3d3235b0e480d930379e9d

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

LOG: [clang-format] Fix a bug in AlignConsecutiveDeclarations (#135516)

Fix #109768

Added: 


Modified: 
clang/lib/Format/WhitespaceManager.cpp
clang/unittests/Format/FormatTest.cpp

Removed: 




diff  --git a/clang/lib/Format/WhitespaceManager.cpp 
b/clang/lib/Format/WhitespaceManager.cpp
index b1e43f0313dbf..cfaadf07edfd0 100644
--- a/clang/lib/Format/WhitespaceManager.cpp
+++ b/clang/lib/Format/WhitespaceManager.cpp
@@ -1012,13 +1012,8 @@ void WhitespaceManager::alignConsecutiveDeclarations() {
   AlignTokens(
   Style,
   [&](Change const &C) {
-if (Style.AlignConsecutiveDeclarations.AlignFunctionPointers) {
-  for (const auto *Prev = C.Tok->Previous; Prev; Prev = Prev->Previous)
-if (Prev->is(tok::equal))
-  return false;
-  if (C.Tok->is(TT_FunctionTypeLParen))
-return true;
-}
+if (C.Tok->is(TT_FunctionTypeLParen))
+  return Style.AlignConsecutiveDeclarations.AlignFunctionPointers;
 if (C.Tok->is(TT_FunctionDeclarationName))
   return Style.AlignConsecutiveDeclarations.AlignFunctionDeclarations;
 if (C.Tok->isNot(TT_StartOfName))

diff  --git a/clang/unittests/Format/FormatTest.cpp 
b/clang/unittests/Format/FormatTest.cpp
index bf3260c6216da..f5c5a9ea4a1fa 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -20207,6 +20207,16 @@ TEST_F(FormatTest, AlignConsecutiveDeclarations) {
"double b();",
AlignmentLeft);
 
+  auto Style = AlignmentLeft;
+  Style.AlignConsecutiveDeclarations.AlignFunctionPointers = true;
+  Style.BinPackParameters = FormatStyle::BPPS_OnePerLine;
+  verifyFormat("int function_name(const wchar_t*  title,\n"
+   "  int x  = 0,\n"
+   "  longextraStyle = 0,\n"
+   "  boolreadOnly   = false,\n"
+   "  FancyClassType* module = nullptr);",
+   Style);
+
   // PAS_Middle
   FormatStyle AlignmentMiddle = Alignment;
   AlignmentMiddle.PointerAlignment = FormatStyle::PAS_Middle;
@@ -20438,7 +20448,7 @@ TEST_F(FormatTest, AlignConsecutiveDeclarations) {
Alignment);
 
   // See PR37175
-  FormatStyle Style = getMozillaStyle();
+  Style = getMozillaStyle();
   Style.AlignConsecutiveDeclarations.Enabled = true;
   verifyFormat("DECOR1 /**/ int8_t /**/ DECOR2 /**/\n"
"foo(int a);",



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


[clang-tools-extra] [clang-tidy] Improve `bugprone-exception-escape`: add stacktrace of escaped exception (PR #134375)

2025-04-13 Thread Piotr Zegar via cfe-commits


@@ -80,13 +80,46 @@ void ExceptionEscapeCheck::check(const 
MatchFinder::MatchResult &Result) {
   if (!MatchedDecl)
 return;
 
-  if (Tracer.analyze(MatchedDecl).getBehaviour() ==
-  utils::ExceptionAnalyzer::State::Throwing)
-// FIXME: We should provide more information about the exact location where
-// the exception is thrown, maybe the full path the exception escapes
-diag(MatchedDecl->getLocation(), "an exception may be thrown in function "
- "%0 which should not throw exceptions")
-<< MatchedDecl;
+  const utils::ExceptionAnalyzer::ExceptionInfo Info =
+  Tracer.analyze(MatchedDecl);
+
+  if (Info.getBehaviour() != utils::ExceptionAnalyzer::State::Throwing) {
+return;
+  }
+
+  diag(MatchedDecl->getLocation(), "an exception may be thrown in function "
+   "%0 which should not throw exceptions")
+  << MatchedDecl;
+
+  const utils::ExceptionAnalyzer::ExceptionInfo::ThrowInfo ThrowInfo =
+  Info.getExceptions().begin()->getSecond();
+
+  if (ThrowInfo.Loc.isInvalid()) {
+return;
+  }
+
+  // FIXME: We should provide exact position of functions calls, not only call
+  // stack of thrown exception.
+  const utils::ExceptionAnalyzer::CallStack &Stack = ThrowInfo.Stack;
+  diag(Stack.front()->getLocation(),
+   "example of unhandled exception throw stack, starting from function %0",

PiotrZSL wrote:

do not use "example", it was thrown or not.

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


[clang] [clang-format] Treat lambda in braced init as inline (PR #135520)

2025-04-13 Thread Owen Pan via cfe-commits

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


[clang] [clang-format] Fix a bug in AlignConsecutiveDeclarations (PR #135516)

2025-04-13 Thread Owen Pan via cfe-commits

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


[clang] c41ef75 - [clang-format] Treat lambda in braced init as inline (#135520)

2025-04-13 Thread via cfe-commits

Author: Owen Pan
Date: 2025-04-13T09:02:46-07:00
New Revision: c41ef751f85ee42f40380d064f44cfd347fb6215

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

LOG: [clang-format] Treat lambda in braced init as inline (#135520)

Fix #125430

Added: 


Modified: 
clang/lib/Format/TokenAnnotator.cpp
clang/unittests/Format/FormatTest.cpp

Removed: 




diff  --git a/clang/lib/Format/TokenAnnotator.cpp 
b/clang/lib/Format/TokenAnnotator.cpp
index 82dc403538c45..ef5f07e2c62ee 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -5569,7 +5569,8 @@ static bool isAllmanBrace(const FormatToken &Tok) {
 // Returns 'true' if 'Tok' is a function argument.
 static bool IsFunctionArgument(const FormatToken &Tok) {
   return Tok.MatchingParen && Tok.MatchingParen->Next &&
- Tok.MatchingParen->Next->isOneOf(tok::comma, tok::r_paren);
+ Tok.MatchingParen->Next->isOneOf(tok::comma, tok::r_paren,
+  tok::r_brace);
 }
 
 static bool

diff  --git a/clang/unittests/Format/FormatTest.cpp 
b/clang/unittests/Format/FormatTest.cpp
index f5c5a9ea4a1fa..b62d49e17c83f 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -23722,6 +23722,7 @@ TEST_F(FormatTest, FormatsLambdas) {
   verifyFormat("function([]() { return b; })", MergeInline);
   verifyFormat("function([]() { return b; }, a)", MergeInline);
   verifyFormat("function(a, []() { return b; })", MergeInline);
+  verifyFormat("auto guard = foo{[&] { exit_status = true; }};", MergeInline);
 
   // Check option "BraceWrapping.BeforeLambdaBody" and 
diff erent state of
   // AllowShortLambdasOnASingleLine



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


[clang-tools-extra] [clang-tidy] Improve `bugprone-exception-escape`: add stacktrace of escaped exception (PR #134375)

2025-04-13 Thread Piotr Zegar via cfe-commits

https://github.com/PiotrZSL commented:

What about unknown exceptions ?
Take a look into https://reviews.llvm.org/D153298, mainly into comments and 
approach if everything is covered in your change.

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


[clang-tools-extra] [clang-tidy] Improve `bugprone-exception-escape`: add stacktrace of escaped exception (PR #134375)

2025-04-13 Thread Piotr Zegar via cfe-commits


@@ -28,6 +29,12 @@ class ExceptionAnalyzer {
  ///< definition.
   };
 
+  /// We use a SetVector to preserve the order of the functions in the call
+  /// stack as well as have fast lookup.
+  using CallStack = llvm::SetVector,
+llvm::DenseSet, 32>;

PiotrZSL wrote:

instead of pointing to FunctionDecl, better would be to point a place in those 
functions where next function is called if possible. 

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


[clang-tools-extra] [clang-tidy] Improve `bugprone-exception-escape`: add stacktrace of escaped exception (PR #134375)

2025-04-13 Thread Piotr Zegar via cfe-commits

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


[clang] [llvm] [HIP][HIPSTDPAR][NFC] Re-order & adapt `hipstdpar` specific passes (PR #134753)

2025-04-13 Thread Alex Voicu via cfe-commits

https://github.com/AlexVlx updated 
https://github.com/llvm/llvm-project/pull/134753

>From a988ecf63dc79d226c2f7aa1430f65d08256888b Mon Sep 17 00:00:00 2001
From: Alex Voicu 
Date: Tue, 8 Apr 2025 00:20:27 +0100
Subject: [PATCH 1/7] Re-order & adapt `hipstdpar` specific passes.

---
 clang/lib/CodeGen/BackendUtil.cpp |  8 
 clang/lib/Driver/ToolChains/HIPAMD.cpp|  7 ---
 .../lib/Target/AMDGPU/AMDGPUTargetMachine.cpp | 20 ---
 3 files changed, 21 insertions(+), 14 deletions(-)

diff --git a/clang/lib/CodeGen/BackendUtil.cpp 
b/clang/lib/CodeGen/BackendUtil.cpp
index 7557cb8408921..fa5e12d4033a5 100644
--- a/clang/lib/CodeGen/BackendUtil.cpp
+++ b/clang/lib/CodeGen/BackendUtil.cpp
@@ -1115,6 +1115,10 @@ void EmitAssemblyHelper::RunOptimizationPipeline(
   if (CodeGenOpts.LinkBitcodePostopt)
 MPM.addPass(LinkInModulesPass(BC));
 
+  if (LangOpts.HIPStdPar && !LangOpts.CUDAIsDevice &&
+  LangOpts.HIPStdParInterposeAlloc)
+  MPM.addPass(HipStdParAllocationInterpositionPass());
+
   // Add a verifier pass if requested. We don't have to do this if the action
   // requires code generation because there will already be a verifier pass in
   // the code-generation pipeline.
@@ -1178,10 +1182,6 @@ void EmitAssemblyHelper::RunOptimizationPipeline(
 return;
   }
 
-  if (LangOpts.HIPStdPar && !LangOpts.CUDAIsDevice &&
-  LangOpts.HIPStdParInterposeAlloc)
-MPM.addPass(HipStdParAllocationInterpositionPass());
-
   // Now that we have all of the passes ready, run them.
   {
 PrettyStackTraceString CrashInfo("Optimizer");
diff --git a/clang/lib/Driver/ToolChains/HIPAMD.cpp 
b/clang/lib/Driver/ToolChains/HIPAMD.cpp
index abb83701759ce..52e35a01be58d 100644
--- a/clang/lib/Driver/ToolChains/HIPAMD.cpp
+++ b/clang/lib/Driver/ToolChains/HIPAMD.cpp
@@ -231,10 +231,11 @@ void HIPAMDToolChain::addClangTargetOptions(
   CC1Args.append({"-fcuda-is-device", "-fno-threadsafe-statics"});
 
   if (!DriverArgs.hasFlag(options::OPT_fgpu_rdc, options::OPT_fno_gpu_rdc,
-  false))
+  false)) {
 CC1Args.append({"-mllvm", "-amdgpu-internalize-symbols"});
-  if (DriverArgs.hasArgNoClaim(options::OPT_hipstdpar))
-CC1Args.append({"-mllvm", "-amdgpu-enable-hipstdpar"});
+if (DriverArgs.hasArgNoClaim(options::OPT_hipstdpar))
+  CC1Args.append({"-mllvm", "-amdgpu-enable-hipstdpar"});
+  }
 
   StringRef MaxThreadsPerBlock =
   DriverArgs.getLastArgValue(options::OPT_gpu_max_threads_per_block_EQ);
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp 
b/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
index 4b5c70f09155f..03b1693244879 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
@@ -802,17 +802,17 @@ void 
AMDGPUTargetMachine::registerPassBuilderCallbacks(PassBuilder &PB) {
 #define GET_PASS_REGISTRY "AMDGPUPassRegistry.def"
 #include "llvm/Passes/TargetPassRegistry.inc"
 
-  PB.registerPipelineStartEPCallback(
-  [](ModulePassManager &PM, OptimizationLevel Level) {
-if (EnableHipStdPar)
-  PM.addPass(HipStdParAcceleratorCodeSelectionPass());
-  });
-
   PB.registerPipelineEarlySimplificationEPCallback(
   [](ModulePassManager &PM, OptimizationLevel Level,
  ThinOrFullLTOPhase Phase) {
-if (!isLTOPreLink(Phase))
+if (!isLTOPreLink(Phase)) {
+  // When we are not using -fgpu-rdc, we can run accelerator code
+  // selection relatively early, but still after linking to prevent
+  // eager removal of potentially reachable symbols.
+  if (EnableHipStdPar)
+PM.addPass(HipStdParAcceleratorCodeSelectionPass());
   PM.addPass(AMDGPUPrintfRuntimeBindingPass());
+}
 
 if (Level == OptimizationLevel::O0)
   return;
@@ -883,6 +883,12 @@ void 
AMDGPUTargetMachine::registerPassBuilderCallbacks(PassBuilder &PB) {
 
   PB.registerFullLinkTimeOptimizationLastEPCallback(
   [this](ModulePassManager &PM, OptimizationLevel Level) {
+// When we are using -fgpu-rdc, we can onky run accelerator code
+// selection after linking to prevent, otherwise we end up removing
+// potentially reachable symbols that were exported as external in 
other
+// modules.
+if (EnableHipStdPar)
+  PM.addPass(HipStdParAcceleratorCodeSelectionPass());
 // We want to support the -lto-partitions=N option as "best effort".
 // For that, we need to lower LDS earlier in the pipeline before the
 // module is partitioned for codegen.

>From 5cd1abb217d7fb2dd1f33c94a4f285b9aacd8dde Mon Sep 17 00:00:00 2001
From: Alex Voicu 
Date: Tue, 8 Apr 2025 00:27:18 +0100
Subject: [PATCH 2/7] Fix formatting.

---
 clang/lib/CodeGen/BackendUtil.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/CodeGen/BackendUtil.cpp 
b/clang/lib/CodeGen/BackendUtil.cpp
index fa5e12d4033a

[clang] [llvm] [HIP][HIPSTDPAR][NFC] Re-order & adapt `hipstdpar` specific passes (PR #134753)

2025-04-13 Thread Alex Voicu via cfe-commits

https://github.com/AlexVlx updated 
https://github.com/llvm/llvm-project/pull/134753

>From a988ecf63dc79d226c2f7aa1430f65d08256888b Mon Sep 17 00:00:00 2001
From: Alex Voicu 
Date: Tue, 8 Apr 2025 00:20:27 +0100
Subject: [PATCH 1/7] Re-order & adapt `hipstdpar` specific passes.

---
 clang/lib/CodeGen/BackendUtil.cpp |  8 
 clang/lib/Driver/ToolChains/HIPAMD.cpp|  7 ---
 .../lib/Target/AMDGPU/AMDGPUTargetMachine.cpp | 20 ---
 3 files changed, 21 insertions(+), 14 deletions(-)

diff --git a/clang/lib/CodeGen/BackendUtil.cpp 
b/clang/lib/CodeGen/BackendUtil.cpp
index 7557cb8408921..fa5e12d4033a5 100644
--- a/clang/lib/CodeGen/BackendUtil.cpp
+++ b/clang/lib/CodeGen/BackendUtil.cpp
@@ -1115,6 +1115,10 @@ void EmitAssemblyHelper::RunOptimizationPipeline(
   if (CodeGenOpts.LinkBitcodePostopt)
 MPM.addPass(LinkInModulesPass(BC));
 
+  if (LangOpts.HIPStdPar && !LangOpts.CUDAIsDevice &&
+  LangOpts.HIPStdParInterposeAlloc)
+  MPM.addPass(HipStdParAllocationInterpositionPass());
+
   // Add a verifier pass if requested. We don't have to do this if the action
   // requires code generation because there will already be a verifier pass in
   // the code-generation pipeline.
@@ -1178,10 +1182,6 @@ void EmitAssemblyHelper::RunOptimizationPipeline(
 return;
   }
 
-  if (LangOpts.HIPStdPar && !LangOpts.CUDAIsDevice &&
-  LangOpts.HIPStdParInterposeAlloc)
-MPM.addPass(HipStdParAllocationInterpositionPass());
-
   // Now that we have all of the passes ready, run them.
   {
 PrettyStackTraceString CrashInfo("Optimizer");
diff --git a/clang/lib/Driver/ToolChains/HIPAMD.cpp 
b/clang/lib/Driver/ToolChains/HIPAMD.cpp
index abb83701759ce..52e35a01be58d 100644
--- a/clang/lib/Driver/ToolChains/HIPAMD.cpp
+++ b/clang/lib/Driver/ToolChains/HIPAMD.cpp
@@ -231,10 +231,11 @@ void HIPAMDToolChain::addClangTargetOptions(
   CC1Args.append({"-fcuda-is-device", "-fno-threadsafe-statics"});
 
   if (!DriverArgs.hasFlag(options::OPT_fgpu_rdc, options::OPT_fno_gpu_rdc,
-  false))
+  false)) {
 CC1Args.append({"-mllvm", "-amdgpu-internalize-symbols"});
-  if (DriverArgs.hasArgNoClaim(options::OPT_hipstdpar))
-CC1Args.append({"-mllvm", "-amdgpu-enable-hipstdpar"});
+if (DriverArgs.hasArgNoClaim(options::OPT_hipstdpar))
+  CC1Args.append({"-mllvm", "-amdgpu-enable-hipstdpar"});
+  }
 
   StringRef MaxThreadsPerBlock =
   DriverArgs.getLastArgValue(options::OPT_gpu_max_threads_per_block_EQ);
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp 
b/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
index 4b5c70f09155f..03b1693244879 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
@@ -802,17 +802,17 @@ void 
AMDGPUTargetMachine::registerPassBuilderCallbacks(PassBuilder &PB) {
 #define GET_PASS_REGISTRY "AMDGPUPassRegistry.def"
 #include "llvm/Passes/TargetPassRegistry.inc"
 
-  PB.registerPipelineStartEPCallback(
-  [](ModulePassManager &PM, OptimizationLevel Level) {
-if (EnableHipStdPar)
-  PM.addPass(HipStdParAcceleratorCodeSelectionPass());
-  });
-
   PB.registerPipelineEarlySimplificationEPCallback(
   [](ModulePassManager &PM, OptimizationLevel Level,
  ThinOrFullLTOPhase Phase) {
-if (!isLTOPreLink(Phase))
+if (!isLTOPreLink(Phase)) {
+  // When we are not using -fgpu-rdc, we can run accelerator code
+  // selection relatively early, but still after linking to prevent
+  // eager removal of potentially reachable symbols.
+  if (EnableHipStdPar)
+PM.addPass(HipStdParAcceleratorCodeSelectionPass());
   PM.addPass(AMDGPUPrintfRuntimeBindingPass());
+}
 
 if (Level == OptimizationLevel::O0)
   return;
@@ -883,6 +883,12 @@ void 
AMDGPUTargetMachine::registerPassBuilderCallbacks(PassBuilder &PB) {
 
   PB.registerFullLinkTimeOptimizationLastEPCallback(
   [this](ModulePassManager &PM, OptimizationLevel Level) {
+// When we are using -fgpu-rdc, we can onky run accelerator code
+// selection after linking to prevent, otherwise we end up removing
+// potentially reachable symbols that were exported as external in 
other
+// modules.
+if (EnableHipStdPar)
+  PM.addPass(HipStdParAcceleratorCodeSelectionPass());
 // We want to support the -lto-partitions=N option as "best effort".
 // For that, we need to lower LDS earlier in the pipeline before the
 // module is partitioned for codegen.

>From 5cd1abb217d7fb2dd1f33c94a4f285b9aacd8dde Mon Sep 17 00:00:00 2001
From: Alex Voicu 
Date: Tue, 8 Apr 2025 00:27:18 +0100
Subject: [PATCH 2/7] Fix formatting.

---
 clang/lib/CodeGen/BackendUtil.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/CodeGen/BackendUtil.cpp 
b/clang/lib/CodeGen/BackendUtil.cpp
index fa5e12d4033a

[clang] 1264d7a - [driver] Generalize the code that adds the path of libflang_rt.runtime.a. (#134362)

2025-04-13 Thread via cfe-commits

Author: Daniel Chen
Date: 2025-04-13T09:22:31-04:00
New Revision: 1264d7a53a4de3094672be2a248db57b213f33ac

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

LOG: [driver] Generalize the code that adds the path of libflang_rt.runtime.a. 
(#134362)

The PR is to generalize the re-use of the `compilerRT` code of adding
the path of `libflang_rt.runtime.a (so)` from AIX and LoP only to all
platforms via a new function `addFlangRTLibPath`.

It also added `-static-libflangrt` and `-shared-libflangrt` compiler
options to allow users choosing which `flang-rt` to link to. It defaults
to shared `flang-rt`, which is consistent with the linker behavior,
except on AIX, it defaults to static.

Also, PR #134320 exposed an issue in PR #131041 that the the overriding
`addFortranRuntimeLibs` is missing the link to `libquadmath`. This PR
also fixed that and restored the test case that PR #131041 broke.

Added: 


Modified: 
clang/include/clang/Driver/Options.td
clang/include/clang/Driver/ToolChain.h
clang/lib/Driver/ToolChain.cpp
clang/lib/Driver/ToolChains/AIX.cpp
clang/lib/Driver/ToolChains/AIX.h
clang/lib/Driver/ToolChains/PPCLinux.cpp
clang/lib/Driver/ToolChains/PPCLinux.h
flang/test/Driver/flang-ld-powerpc.f90
flang/test/Driver/linker-flags.f90

Removed: 




diff  --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index c1020b234b136..affc076a876ad 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -6881,6 +6881,13 @@ let Flags = [TargetSpecific] in {
 defm android_pad_segment : BooleanFFlag<"android-pad-segment">, Group;
 } // let Flags = [TargetSpecific]
 
+def shared_libflangrt : Flag<["-"], "shared-libflangrt">,
+  HelpText<"Link the flang-rt shared library">, Group,
+  Visibility<[FlangOption]>, Flags<[NoArgumentUnused]>;
+def static_libflangrt : Flag<["-"], "static-libflangrt">, 
+  HelpText<"Link the flang-rt static library">, Group,
+  Visibility<[FlangOption]>, Flags<[NoArgumentUnused]>;
+
 
//===--===//
 // FLangOption + NoXarchOption
 
//===--===//

diff  --git a/clang/include/clang/Driver/ToolChain.h 
b/clang/include/clang/Driver/ToolChain.h
index 076e4296c3090..d0059673d6a67 100644
--- a/clang/include/clang/Driver/ToolChain.h
+++ b/clang/include/clang/Driver/ToolChain.h
@@ -521,6 +521,10 @@ class ToolChain {
   addFortranRuntimeLibraryPath(const llvm::opt::ArgList &Args,
llvm::opt::ArgStringList &CmdArgs) const;
 
+  /// Add the path for libflang_rt.runtime.a
+  void addFlangRTLibPath(const llvm::opt::ArgList &Args,
+ llvm::opt::ArgStringList &CmdArgs) const;
+
   const char *getCompilerRTArgString(const llvm::opt::ArgList &Args,
  StringRef Component,
  FileType Type = ToolChain::FT_Static,

diff  --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
index 36d0ae34dec86..97317579c8a50 100644
--- a/clang/lib/Driver/ToolChain.cpp
+++ b/clang/lib/Driver/ToolChain.cpp
@@ -744,9 +744,12 @@ std::string ToolChain::buildCompilerRTBasename(const 
llvm::opt::ArgList &Args,
 Suffix = IsITANMSVCWindows ? ".lib" : ".a";
 break;
   case ToolChain::FT_Shared:
-Suffix = TT.isOSWindows()
- ? (TT.isWindowsGNUEnvironment() ? ".dll.a" : ".lib")
- : ".so";
+if (TT.isOSWindows())
+  Suffix = TT.isWindowsGNUEnvironment() ? ".dll.a" : ".lib";
+else if (TT.isOSAIX())
+  Suffix = ".a";
+else
+  Suffix = ".so";
 break;
   }
 
@@ -816,8 +819,7 @@ void ToolChain::addFortranRuntimeLibs(const ArgList &Args,
   if (AsNeeded)
 addAsNeededOption(*this, Args, CmdArgs, /*as_needed=*/false);
 }
-CmdArgs.push_back("-lflang_rt.runtime");
-addArchSpecificRPath(*this, Args, CmdArgs);
+addFlangRTLibPath(Args, CmdArgs);
 
 // needs libexecinfo for backtrace functions
 if (getTriple().isOSFreeBSD() || getTriple().isOSNetBSD() ||
@@ -850,6 +852,20 @@ void ToolChain::addFortranRuntimeLibraryPath(const 
llvm::opt::ArgList &Args,
 CmdArgs.push_back(Args.MakeArgString("-L" + DefaultLibPath));
 }
 
+void ToolChain::addFlangRTLibPath(const ArgList &Args,
+  llvm::opt::ArgStringList &CmdArgs) const {
+  // Link static flang_rt.runtime.a or shared flang_rt.runtime.so.
+  // On AIX, default to static flang-rt.
+  if (Args.hasFlag(options::OPT_static_libflangrt,
+   options::OPT_shared_libflangrt, getTriple().isOSAIX()))
+CmdArgs.push_back(
+getCompilerRTArgString(Args, "ru

[clang] [flang] [driver] Generalize the code that adds the path of libflang_rt.runtime.a. (PR #134362)

2025-04-13 Thread Daniel Chen via cfe-commits

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


[clang] clang/AMDGPU: Stop looking for oclc_daz_opt_* control libraries (PR #134805)

2025-04-13 Thread Matt Arsenault via cfe-commits

arsenm wrote:

> This should be device libs from ROCm 6.3.3.
> 

We really need these to be part of the compiler distribution. It doesn't really 
work to have this as an imported 3rd party package that's a year old 

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


[clang] ccfb97b - Revert "clang/AMDGPU: Stop looking for oclc_daz_opt_* control libraries (#134805)"

2025-04-13 Thread Matt Arsenault via cfe-commits

Author: Matt Arsenault
Date: 2025-04-13T14:47:39+02:00
New Revision: ccfb97b42174eab118a4e4222c25e986db876563

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

LOG: Revert "clang/AMDGPU: Stop looking for oclc_daz_opt_* control libraries 
(#134805)"

This reverts commit 028429ac452acde227ae0bfafbfe8579c127e1ea and
1004fae222efeee215780c4bb4e64eb82b07fb4f.

These really need to be part of the compiler distribution. Bots are
relying on a nearly year old version to provide bitcode.

Added: 


Modified: 
clang/lib/Driver/ToolChains/AMDGPU.cpp
clang/lib/Driver/ToolChains/ROCm.h
clang/test/Driver/amdgpu-openmp-toolchain.c
clang/test/Driver/hip-device-libs.hip
clang/test/Driver/rocm-device-libs.cl
flang/test/Driver/omp-driver-offload.f90

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/AMDGPU.cpp 
b/clang/lib/Driver/ToolChains/AMDGPU.cpp
index d1de3b91c3525..35ca019795ddc 100644
--- a/clang/lib/Driver/ToolChains/AMDGPU.cpp
+++ b/clang/lib/Driver/ToolChains/AMDGPU.cpp
@@ -65,6 +65,10 @@ void 
RocmInstallationDetector::scanLibDevicePath(llvm::StringRef Path) {
   FiniteOnly.Off = FilePath;
 } else if (BaseName == "oclc_finite_only_on") {
   FiniteOnly.On = FilePath;
+} else if (BaseName == "oclc_daz_opt_on") {
+  DenormalsAreZero.On = FilePath;
+} else if (BaseName == "oclc_daz_opt_off") {
+  DenormalsAreZero.Off = FilePath;
 } else if (BaseName == "oclc_correctly_rounded_sqrt_on") {
   CorrectlyRoundedSqrt.On = FilePath;
 } else if (BaseName == "oclc_correctly_rounded_sqrt_off") {
@@ -881,6 +885,10 @@ void ROCMToolChain::addClangTargetOptions(
 return;
 
   bool Wave64 = isWave64(DriverArgs, Kind);
+  // TODO: There are way too many flags that change this. Do we need to check
+  // them all?
+  bool DAZ = DriverArgs.hasArg(options::OPT_cl_denorms_are_zero) ||
+ getDefaultDenormsAreZeroForTarget(Kind);
   bool FiniteOnly = DriverArgs.hasArg(options::OPT_cl_finite_math_only);
 
   bool UnsafeMathOpt =
@@ -901,7 +909,7 @@ void ROCMToolChain::addClangTargetOptions(
 
   // Add the generic set of libraries.
   BCLibs.append(RocmInstallation->getCommonBitcodeLibs(
-  DriverArgs, LibDeviceFile, Wave64, FiniteOnly, UnsafeMathOpt,
+  DriverArgs, LibDeviceFile, Wave64, DAZ, FiniteOnly, UnsafeMathOpt,
   FastRelaxedMath, CorrectSqrt, ABIVer, GPUSan, false));
 
   for (auto [BCFile, Internalize] : BCLibs) {
@@ -940,8 +948,9 @@ bool RocmInstallationDetector::checkCommonBitcodeLibs(
 llvm::SmallVector
 RocmInstallationDetector::getCommonBitcodeLibs(
 const llvm::opt::ArgList &DriverArgs, StringRef LibDeviceFile, bool Wave64,
-bool FiniteOnly, bool UnsafeMathOpt, bool FastRelaxedMath, bool 
CorrectSqrt,
-DeviceLibABIVersion ABIVer, bool GPUSan, bool isOpenMP) const {
+bool DAZ, bool FiniteOnly, bool UnsafeMathOpt, bool FastRelaxedMath,
+bool CorrectSqrt, DeviceLibABIVersion ABIVer, bool GPUSan,
+bool isOpenMP) const {
   llvm::SmallVector BCLibs;
 
   auto AddBCLib = [&](ToolChain::BitCodeLibraryInfo BCLib,
@@ -960,6 +969,7 @@ RocmInstallationDetector::getCommonBitcodeLibs(
 AddBCLib(getOCKLPath());
   else if (GPUSan && isOpenMP)
 AddBCLib(getOCKLPath(), false);
+  AddBCLib(getDenormalsAreZeroPath(DAZ));
   AddBCLib(getUnsafeMathPath(UnsafeMathOpt || FastRelaxedMath));
   AddBCLib(getFiniteOnlyPath(FiniteOnly || FastRelaxedMath));
   AddBCLib(getCorrectlyRoundedSqrtPath(CorrectSqrt));
@@ -987,6 +997,11 @@ ROCMToolChain::getCommonDeviceLibNames(const 
llvm::opt::ArgList &DriverArgs,
 return {};
 
   // If --hip-device-lib is not set, add the default bitcode libraries.
+  // TODO: There are way too many flags that change this. Do we need to check
+  // them all?
+  bool DAZ = DriverArgs.hasFlag(options::OPT_fgpu_flush_denormals_to_zero,
+options::OPT_fno_gpu_flush_denormals_to_zero,
+getDefaultDenormsAreZeroForTarget(Kind));
   bool FiniteOnly = DriverArgs.hasFlag(
   options::OPT_ffinite_math_only, options::OPT_fno_finite_math_only, 
false);
   bool UnsafeMathOpt =
@@ -1006,7 +1021,7 @@ ROCMToolChain::getCommonDeviceLibNames(const 
llvm::opt::ArgList &DriverArgs,
 getSanitizerArgs(DriverArgs).needsAsanRt();
 
   return RocmInstallation->getCommonBitcodeLibs(
-  DriverArgs, LibDeviceFile, Wave64, FiniteOnly, UnsafeMathOpt,
+  DriverArgs, LibDeviceFile, Wave64, DAZ, FiniteOnly, UnsafeMathOpt,
   FastRelaxedMath, CorrectSqrt, ABIVer, GPUSan, isOpenMP);
 }
 

diff  --git a/clang/lib/Driver/ToolChains/ROCm.h 
b/clang/lib/Driver/ToolChains/ROCm.h
index f002b386e11c7..2a09da0114898 100644
--- a/clang/lib/Driver/ToolChains/ROCm.h
+++ b/clang/lib/Driver/ToolChains/ROCm.h
@@ -137,6 +137,

[clang] [cindex] Add support for calling getFullyQualifiedName to the Python binding. (PR #135420)

2025-04-13 Thread Brian Cody via cfe-commits


@@ -431,6 +431,7 @@ LLVM_19 {
 
 LLVM_20 {
   global:
+clang_getFullyQualifiedName;

epistax wrote:

Thanks, I made a new section.

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


[clang] [cindex] Add support for calling getFullyQualifiedName to the Python binding. (PR #135420)

2025-04-13 Thread Brian Cody via cfe-commits

https://github.com/epistax updated 
https://github.com/llvm/llvm-project/pull/135420

>From 6fe4155fad0cdbc6ca04e37df143f22f537d5514 Mon Sep 17 00:00:00 2001
From: Brian Cody 
Date: Fri, 11 Apr 2025 14:27:22 -0400
Subject: [PATCH 1/7] [cindex] Add support for calling getFullyQualifiedName to
 the Python binding.

---
 clang/bindings/python/clang/cindex.py | 12 ++
 .../bindings/python/tests/cindex/test_type.py | 22 +++
 clang/docs/ReleaseNotes.rst   |  4 
 clang/include/clang-c/Index.h | 12 ++
 clang/tools/libclang/CXType.cpp   | 17 ++
 clang/tools/libclang/libclang.map |  1 +
 6 files changed, 68 insertions(+)

diff --git a/clang/bindings/python/clang/cindex.py 
b/clang/bindings/python/clang/cindex.py
index 2319534a6f121..5830dc2149348 100644
--- a/clang/bindings/python/clang/cindex.py
+++ b/clang/bindings/python/clang/cindex.py
@@ -2593,6 +2593,17 @@ def get_canonical(self):
 """
 return Type.from_result(conf.lib.clang_getCanonicalType(self), (self,))
 
+def get_fully_qualified_name(self, policy, with_global_ns_prefix = False):
+"""
+Get the fully qualified name for a type.
+
+This includes full qualification of all template parameters.
+
+policy - This PrintingPolicy can further refine the type formatting
+with_global_ns_prefix - If true, function will prepend a '::' to 
qualified names
+"""
+return 
_CXString.from_result(conf.lib.clang_getFullyQualifiedName(self, policy, 
with_global_ns_prefix))
+
 def is_const_qualified(self):
 """Determine whether a Type has the "const" qualifier set.
 
@@ -4022,6 +4033,7 @@ def set_property(self, property, value):
 ("clang_getTypeSpelling", [Type], _CXString),
 ("clang_hashCursor", [Cursor], c_uint),
 ("clang_isAttribute", [CursorKind], bool),
+("clang_getFullyQualifiedName", [Type, PrintingPolicy, c_uint], _CXString),
 ("clang_isConstQualifiedType", [Type], bool),
 ("clang_isCursorDefinition", [Cursor], bool),
 ("clang_isDeclaration", [CursorKind], bool),
diff --git a/clang/bindings/python/tests/cindex/test_type.py 
b/clang/bindings/python/tests/cindex/test_type.py
index a9473e1dc2458..b2a82a00b4f40 100644
--- a/clang/bindings/python/tests/cindex/test_type.py
+++ b/clang/bindings/python/tests/cindex/test_type.py
@@ -535,6 +535,28 @@ def test_pretty(self):
 pp.set_property(PrintingPolicyProperty.SuppressTagKeyword, False)
 self.assertEqual(f.type.get_canonical().pretty_printed(pp), "struct X")
 
+def test_fully_qualified_name(self):
+source = """
+namespace home {
+  class Bar {
+  };
+  class Foo {
+public:
+  void setIt(Bar*);
+  };
+}
+class A : public home::Foo {
+};
+"""
+tu = get_tu(source, lang="cpp")
+c = get_cursor(tu, "A")
+pp = PrintingPolicy.create(c)
+base = list(c.get_children())[0].type.get_declaration()
+set_it = list(base.get_children())[1]
+arg = list(set_it.get_arguments())[0]
+self.assertEqual(arg.type.get_fully_qualified_name(pp), "home::Bar *")
+self.assertEqual(arg.type.get_fully_qualified_name(pp, True), 
"::home::Bar *")
+
 def test_base_classes(self):
 source = """
 class A { int a; };
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 9c45965dc4d82..f228a32acd51d 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -589,6 +589,8 @@ libclang
 
 - Added ``clang_visitCXXMethods``, which allows visiting the methods
   of a class.
+- Added ``clang_getFullyQualifiedName``, which provides fully qualified type 
names as
+  instructed by a PrintingPolicy.
 
 - Fixed a buffer overflow in ``CXString`` implementation. The fix may result in
   increased memory allocation.
@@ -643,6 +645,8 @@ Python Binding Changes
   the cursor is a specialization of.
 - Added ``Type.get_methods``, a binding for ``clang_visitCXXMethods``, which
   allows visiting the methods of a class.
+- Added ``Type.getFullyQualifiedName``, which provides fully qualified type 
names as
+  instructed by a PrintingPolicy.
 
 OpenMP Support
 --
diff --git a/clang/include/clang-c/Index.h b/clang/include/clang-c/Index.h
index 38e2417dcd181..25700a48c928c 100644
--- a/clang/include/clang-c/Index.h
+++ b/clang/include/clang-c/Index.h
@@ -4223,6 +4223,18 @@ CINDEX_LINKAGE CXString 
clang_getCursorPrettyPrinted(CXCursor Cursor,
 CINDEX_LINKAGE CXString clang_getTypePrettyPrinted(CXType CT,
CXPrintingPolicy cxPolicy);
 
+/**
+ * Get the fully qualified name for a type.
+ *
+ * This includes full qualification of all template parameters.
+ *
+ * Policy - Further refine the type formatting
+ * WithGlobalNsPrefix - If non-zero, function will prepe

[clang] [cindex] Add support for calling getFullyQualifiedName to the Python binding. (PR #135420)

2025-04-13 Thread Brian Cody via cfe-commits

https://github.com/epistax updated 
https://github.com/llvm/llvm-project/pull/135420

>From 6fe4155fad0cdbc6ca04e37df143f22f537d5514 Mon Sep 17 00:00:00 2001
From: Brian Cody 
Date: Fri, 11 Apr 2025 14:27:22 -0400
Subject: [PATCH 1/6] [cindex] Add support for calling getFullyQualifiedName to
 the Python binding.

---
 clang/bindings/python/clang/cindex.py | 12 ++
 .../bindings/python/tests/cindex/test_type.py | 22 +++
 clang/docs/ReleaseNotes.rst   |  4 
 clang/include/clang-c/Index.h | 12 ++
 clang/tools/libclang/CXType.cpp   | 17 ++
 clang/tools/libclang/libclang.map |  1 +
 6 files changed, 68 insertions(+)

diff --git a/clang/bindings/python/clang/cindex.py 
b/clang/bindings/python/clang/cindex.py
index 2319534a6f121..5830dc2149348 100644
--- a/clang/bindings/python/clang/cindex.py
+++ b/clang/bindings/python/clang/cindex.py
@@ -2593,6 +2593,17 @@ def get_canonical(self):
 """
 return Type.from_result(conf.lib.clang_getCanonicalType(self), (self,))
 
+def get_fully_qualified_name(self, policy, with_global_ns_prefix = False):
+"""
+Get the fully qualified name for a type.
+
+This includes full qualification of all template parameters.
+
+policy - This PrintingPolicy can further refine the type formatting
+with_global_ns_prefix - If true, function will prepend a '::' to 
qualified names
+"""
+return 
_CXString.from_result(conf.lib.clang_getFullyQualifiedName(self, policy, 
with_global_ns_prefix))
+
 def is_const_qualified(self):
 """Determine whether a Type has the "const" qualifier set.
 
@@ -4022,6 +4033,7 @@ def set_property(self, property, value):
 ("clang_getTypeSpelling", [Type], _CXString),
 ("clang_hashCursor", [Cursor], c_uint),
 ("clang_isAttribute", [CursorKind], bool),
+("clang_getFullyQualifiedName", [Type, PrintingPolicy, c_uint], _CXString),
 ("clang_isConstQualifiedType", [Type], bool),
 ("clang_isCursorDefinition", [Cursor], bool),
 ("clang_isDeclaration", [CursorKind], bool),
diff --git a/clang/bindings/python/tests/cindex/test_type.py 
b/clang/bindings/python/tests/cindex/test_type.py
index a9473e1dc2458..b2a82a00b4f40 100644
--- a/clang/bindings/python/tests/cindex/test_type.py
+++ b/clang/bindings/python/tests/cindex/test_type.py
@@ -535,6 +535,28 @@ def test_pretty(self):
 pp.set_property(PrintingPolicyProperty.SuppressTagKeyword, False)
 self.assertEqual(f.type.get_canonical().pretty_printed(pp), "struct X")
 
+def test_fully_qualified_name(self):
+source = """
+namespace home {
+  class Bar {
+  };
+  class Foo {
+public:
+  void setIt(Bar*);
+  };
+}
+class A : public home::Foo {
+};
+"""
+tu = get_tu(source, lang="cpp")
+c = get_cursor(tu, "A")
+pp = PrintingPolicy.create(c)
+base = list(c.get_children())[0].type.get_declaration()
+set_it = list(base.get_children())[1]
+arg = list(set_it.get_arguments())[0]
+self.assertEqual(arg.type.get_fully_qualified_name(pp), "home::Bar *")
+self.assertEqual(arg.type.get_fully_qualified_name(pp, True), 
"::home::Bar *")
+
 def test_base_classes(self):
 source = """
 class A { int a; };
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 9c45965dc4d82..f228a32acd51d 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -589,6 +589,8 @@ libclang
 
 - Added ``clang_visitCXXMethods``, which allows visiting the methods
   of a class.
+- Added ``clang_getFullyQualifiedName``, which provides fully qualified type 
names as
+  instructed by a PrintingPolicy.
 
 - Fixed a buffer overflow in ``CXString`` implementation. The fix may result in
   increased memory allocation.
@@ -643,6 +645,8 @@ Python Binding Changes
   the cursor is a specialization of.
 - Added ``Type.get_methods``, a binding for ``clang_visitCXXMethods``, which
   allows visiting the methods of a class.
+- Added ``Type.getFullyQualifiedName``, which provides fully qualified type 
names as
+  instructed by a PrintingPolicy.
 
 OpenMP Support
 --
diff --git a/clang/include/clang-c/Index.h b/clang/include/clang-c/Index.h
index 38e2417dcd181..25700a48c928c 100644
--- a/clang/include/clang-c/Index.h
+++ b/clang/include/clang-c/Index.h
@@ -4223,6 +4223,18 @@ CINDEX_LINKAGE CXString 
clang_getCursorPrettyPrinted(CXCursor Cursor,
 CINDEX_LINKAGE CXString clang_getTypePrettyPrinted(CXType CT,
CXPrintingPolicy cxPolicy);
 
+/**
+ * Get the fully qualified name for a type.
+ *
+ * This includes full qualification of all template parameters.
+ *
+ * Policy - Further refine the type formatting
+ * WithGlobalNsPrefix - If non-zero, function will prepe

[clang] [cindex] Add support for calling getFullyQualifiedName to the Python binding. (PR #135420)

2025-04-13 Thread Brian Cody via cfe-commits

https://github.com/epistax updated 
https://github.com/llvm/llvm-project/pull/135420

>From 6fe4155fad0cdbc6ca04e37df143f22f537d5514 Mon Sep 17 00:00:00 2001
From: Brian Cody 
Date: Fri, 11 Apr 2025 14:27:22 -0400
Subject: [PATCH 1/4] [cindex] Add support for calling getFullyQualifiedName to
 the Python binding.

---
 clang/bindings/python/clang/cindex.py | 12 ++
 .../bindings/python/tests/cindex/test_type.py | 22 +++
 clang/docs/ReleaseNotes.rst   |  4 
 clang/include/clang-c/Index.h | 12 ++
 clang/tools/libclang/CXType.cpp   | 17 ++
 clang/tools/libclang/libclang.map |  1 +
 6 files changed, 68 insertions(+)

diff --git a/clang/bindings/python/clang/cindex.py 
b/clang/bindings/python/clang/cindex.py
index 2319534a6f121..5830dc2149348 100644
--- a/clang/bindings/python/clang/cindex.py
+++ b/clang/bindings/python/clang/cindex.py
@@ -2593,6 +2593,17 @@ def get_canonical(self):
 """
 return Type.from_result(conf.lib.clang_getCanonicalType(self), (self,))
 
+def get_fully_qualified_name(self, policy, with_global_ns_prefix = False):
+"""
+Get the fully qualified name for a type.
+
+This includes full qualification of all template parameters.
+
+policy - This PrintingPolicy can further refine the type formatting
+with_global_ns_prefix - If true, function will prepend a '::' to 
qualified names
+"""
+return 
_CXString.from_result(conf.lib.clang_getFullyQualifiedName(self, policy, 
with_global_ns_prefix))
+
 def is_const_qualified(self):
 """Determine whether a Type has the "const" qualifier set.
 
@@ -4022,6 +4033,7 @@ def set_property(self, property, value):
 ("clang_getTypeSpelling", [Type], _CXString),
 ("clang_hashCursor", [Cursor], c_uint),
 ("clang_isAttribute", [CursorKind], bool),
+("clang_getFullyQualifiedName", [Type, PrintingPolicy, c_uint], _CXString),
 ("clang_isConstQualifiedType", [Type], bool),
 ("clang_isCursorDefinition", [Cursor], bool),
 ("clang_isDeclaration", [CursorKind], bool),
diff --git a/clang/bindings/python/tests/cindex/test_type.py 
b/clang/bindings/python/tests/cindex/test_type.py
index a9473e1dc2458..b2a82a00b4f40 100644
--- a/clang/bindings/python/tests/cindex/test_type.py
+++ b/clang/bindings/python/tests/cindex/test_type.py
@@ -535,6 +535,28 @@ def test_pretty(self):
 pp.set_property(PrintingPolicyProperty.SuppressTagKeyword, False)
 self.assertEqual(f.type.get_canonical().pretty_printed(pp), "struct X")
 
+def test_fully_qualified_name(self):
+source = """
+namespace home {
+  class Bar {
+  };
+  class Foo {
+public:
+  void setIt(Bar*);
+  };
+}
+class A : public home::Foo {
+};
+"""
+tu = get_tu(source, lang="cpp")
+c = get_cursor(tu, "A")
+pp = PrintingPolicy.create(c)
+base = list(c.get_children())[0].type.get_declaration()
+set_it = list(base.get_children())[1]
+arg = list(set_it.get_arguments())[0]
+self.assertEqual(arg.type.get_fully_qualified_name(pp), "home::Bar *")
+self.assertEqual(arg.type.get_fully_qualified_name(pp, True), 
"::home::Bar *")
+
 def test_base_classes(self):
 source = """
 class A { int a; };
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 9c45965dc4d82..f228a32acd51d 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -589,6 +589,8 @@ libclang
 
 - Added ``clang_visitCXXMethods``, which allows visiting the methods
   of a class.
+- Added ``clang_getFullyQualifiedName``, which provides fully qualified type 
names as
+  instructed by a PrintingPolicy.
 
 - Fixed a buffer overflow in ``CXString`` implementation. The fix may result in
   increased memory allocation.
@@ -643,6 +645,8 @@ Python Binding Changes
   the cursor is a specialization of.
 - Added ``Type.get_methods``, a binding for ``clang_visitCXXMethods``, which
   allows visiting the methods of a class.
+- Added ``Type.getFullyQualifiedName``, which provides fully qualified type 
names as
+  instructed by a PrintingPolicy.
 
 OpenMP Support
 --
diff --git a/clang/include/clang-c/Index.h b/clang/include/clang-c/Index.h
index 38e2417dcd181..25700a48c928c 100644
--- a/clang/include/clang-c/Index.h
+++ b/clang/include/clang-c/Index.h
@@ -4223,6 +4223,18 @@ CINDEX_LINKAGE CXString 
clang_getCursorPrettyPrinted(CXCursor Cursor,
 CINDEX_LINKAGE CXString clang_getTypePrettyPrinted(CXType CT,
CXPrintingPolicy cxPolicy);
 
+/**
+ * Get the fully qualified name for a type.
+ *
+ * This includes full qualification of all template parameters.
+ *
+ * Policy - Further refine the type formatting
+ * WithGlobalNsPrefix - If non-zero, function will prepe

[clang] [clang] Add builtin_get_vtable_pointer and virtual_member_address (PR #135469)

2025-04-13 Thread via cfe-commits

cor3ntin wrote:

> I just noticed there's no documentation for 
> `__builtin_virtual_member_address()` so I'm addressing that.
> 
> Due to code drift and time I realized that they disagree as to whether they 
> should take `C*` or `C&` so I'm going to make them both accept either 
> (existing code means we can't unify on one or the other, but also there's no 
> real reason to not accept either and simply do the correct thing)

most of our builtins take pointers. Accepting both seems unwise.
people might want to do interesting things in sfinae context and if we accept 
everything and anything it will end up causing more pain than it alleviates.

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


[clang] [cindex] Add support for calling getFullyQualifiedName to the Python binding. (PR #135420)

2025-04-13 Thread Brian Cody via cfe-commits

https://github.com/epistax updated 
https://github.com/llvm/llvm-project/pull/135420

>From 6fe4155fad0cdbc6ca04e37df143f22f537d5514 Mon Sep 17 00:00:00 2001
From: Brian Cody 
Date: Fri, 11 Apr 2025 14:27:22 -0400
Subject: [PATCH 1/5] [cindex] Add support for calling getFullyQualifiedName to
 the Python binding.

---
 clang/bindings/python/clang/cindex.py | 12 ++
 .../bindings/python/tests/cindex/test_type.py | 22 +++
 clang/docs/ReleaseNotes.rst   |  4 
 clang/include/clang-c/Index.h | 12 ++
 clang/tools/libclang/CXType.cpp   | 17 ++
 clang/tools/libclang/libclang.map |  1 +
 6 files changed, 68 insertions(+)

diff --git a/clang/bindings/python/clang/cindex.py 
b/clang/bindings/python/clang/cindex.py
index 2319534a6f121..5830dc2149348 100644
--- a/clang/bindings/python/clang/cindex.py
+++ b/clang/bindings/python/clang/cindex.py
@@ -2593,6 +2593,17 @@ def get_canonical(self):
 """
 return Type.from_result(conf.lib.clang_getCanonicalType(self), (self,))
 
+def get_fully_qualified_name(self, policy, with_global_ns_prefix = False):
+"""
+Get the fully qualified name for a type.
+
+This includes full qualification of all template parameters.
+
+policy - This PrintingPolicy can further refine the type formatting
+with_global_ns_prefix - If true, function will prepend a '::' to 
qualified names
+"""
+return 
_CXString.from_result(conf.lib.clang_getFullyQualifiedName(self, policy, 
with_global_ns_prefix))
+
 def is_const_qualified(self):
 """Determine whether a Type has the "const" qualifier set.
 
@@ -4022,6 +4033,7 @@ def set_property(self, property, value):
 ("clang_getTypeSpelling", [Type], _CXString),
 ("clang_hashCursor", [Cursor], c_uint),
 ("clang_isAttribute", [CursorKind], bool),
+("clang_getFullyQualifiedName", [Type, PrintingPolicy, c_uint], _CXString),
 ("clang_isConstQualifiedType", [Type], bool),
 ("clang_isCursorDefinition", [Cursor], bool),
 ("clang_isDeclaration", [CursorKind], bool),
diff --git a/clang/bindings/python/tests/cindex/test_type.py 
b/clang/bindings/python/tests/cindex/test_type.py
index a9473e1dc2458..b2a82a00b4f40 100644
--- a/clang/bindings/python/tests/cindex/test_type.py
+++ b/clang/bindings/python/tests/cindex/test_type.py
@@ -535,6 +535,28 @@ def test_pretty(self):
 pp.set_property(PrintingPolicyProperty.SuppressTagKeyword, False)
 self.assertEqual(f.type.get_canonical().pretty_printed(pp), "struct X")
 
+def test_fully_qualified_name(self):
+source = """
+namespace home {
+  class Bar {
+  };
+  class Foo {
+public:
+  void setIt(Bar*);
+  };
+}
+class A : public home::Foo {
+};
+"""
+tu = get_tu(source, lang="cpp")
+c = get_cursor(tu, "A")
+pp = PrintingPolicy.create(c)
+base = list(c.get_children())[0].type.get_declaration()
+set_it = list(base.get_children())[1]
+arg = list(set_it.get_arguments())[0]
+self.assertEqual(arg.type.get_fully_qualified_name(pp), "home::Bar *")
+self.assertEqual(arg.type.get_fully_qualified_name(pp, True), 
"::home::Bar *")
+
 def test_base_classes(self):
 source = """
 class A { int a; };
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 9c45965dc4d82..f228a32acd51d 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -589,6 +589,8 @@ libclang
 
 - Added ``clang_visitCXXMethods``, which allows visiting the methods
   of a class.
+- Added ``clang_getFullyQualifiedName``, which provides fully qualified type 
names as
+  instructed by a PrintingPolicy.
 
 - Fixed a buffer overflow in ``CXString`` implementation. The fix may result in
   increased memory allocation.
@@ -643,6 +645,8 @@ Python Binding Changes
   the cursor is a specialization of.
 - Added ``Type.get_methods``, a binding for ``clang_visitCXXMethods``, which
   allows visiting the methods of a class.
+- Added ``Type.getFullyQualifiedName``, which provides fully qualified type 
names as
+  instructed by a PrintingPolicy.
 
 OpenMP Support
 --
diff --git a/clang/include/clang-c/Index.h b/clang/include/clang-c/Index.h
index 38e2417dcd181..25700a48c928c 100644
--- a/clang/include/clang-c/Index.h
+++ b/clang/include/clang-c/Index.h
@@ -4223,6 +4223,18 @@ CINDEX_LINKAGE CXString 
clang_getCursorPrettyPrinted(CXCursor Cursor,
 CINDEX_LINKAGE CXString clang_getTypePrettyPrinted(CXType CT,
CXPrintingPolicy cxPolicy);
 
+/**
+ * Get the fully qualified name for a type.
+ *
+ * This includes full qualification of all template parameters.
+ *
+ * Policy - Further refine the type formatting
+ * WithGlobalNsPrefix - If non-zero, function will prepe

[clang] [cindex] Add support for calling getFullyQualifiedName to the Python binding. (PR #135420)

2025-04-13 Thread Brian Cody via cfe-commits


@@ -535,6 +535,28 @@ def test_pretty(self):
 pp.set_property(PrintingPolicyProperty.SuppressTagKeyword, False)
 self.assertEqual(f.type.get_canonical().pretty_printed(pp), "struct X")
 
+def test_fully_qualified_name(self):
+source = """
+namespace home {
+  class Bar {
+  };
+  class Foo {
+public:
+  void setIt(Bar*);
+  };
+}
+class A : public home::Foo {
+};
+"""
+tu = get_tu(source, lang="cpp")
+c = get_cursor(tu, "A")
+pp = PrintingPolicy.create(c)
+base = list(c.get_children())[0].type.get_declaration()
+set_it = list(base.get_children())[1]
+arg = list(set_it.get_arguments())[0]

epistax wrote:

Thanks, didn't occur to me that there would be a more direct route. 

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


[clang] [flang] [driver] Generalize the code that adds the path of libflang_rt.runtime.a. (PR #134362)

2025-04-13 Thread LLVM Continuous Integration via cfe-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `openmp-s390x-linux` 
running on `systemz-1` while building `clang,flang` at step 6 "test-openmp".

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


Here is the relevant piece of the build log for the reference

```
Step 6 (test-openmp) failure: test (failure)
 TEST 'libomp :: tasking/issue-94260-2.c' FAILED 

Exit Code: -11

Command Output (stdout):
--
# RUN: at line 1
/home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/./bin/clang 
-fopenmp   -I 
/home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/runtimes/runtimes-bins/openmp/runtime/src
 -I 
/home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.src/openmp/runtime/test 
-L 
/home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/runtimes/runtimes-bins/openmp/runtime/src
  -fno-omit-frame-pointer -mbackchain -I 
/home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.src/openmp/runtime/test/ompt
 
/home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.src/openmp/runtime/test/tasking/issue-94260-2.c
 -o 
/home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/runtimes/runtimes-bins/openmp/runtime/test/tasking/Output/issue-94260-2.c.tmp
 -lm -latomic && 
/home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/runtimes/runtimes-bins/openmp/runtime/test/tasking/Output/issue-94260-2.c.tmp
# executed command: 
/home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/./bin/clang 
-fopenmp -I 
/home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/runtimes/runtimes-bins/openmp/runtime/src
 -I 
/home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.src/openmp/runtime/test 
-L 
/home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/runtimes/runtimes-bins/openmp/runtime/src
 -fno-omit-frame-pointer -mbackchain -I 
/home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.src/openmp/runtime/test/ompt
 
/home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.src/openmp/runtime/test/tasking/issue-94260-2.c
 -o 
/home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/runtimes/runtimes-bins/openmp/runtime/test/tasking/Output/issue-94260-2.c.tmp
 -lm -latomic
# executed command: 
/home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/runtimes/runtimes-bins/openmp/runtime/test/tasking/Output/issue-94260-2.c.tmp
# note: command had no output on stdout or stderr
# error: command failed with exit status: -11

--




```



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


[libunwind] Update LIBUNWIND_ENABLE_WERROR default value in BuildingLibunwind.rst (PR #135546)

2025-04-13 Thread via cfe-commits

github-actions[bot] wrote:



Thank you for submitting a Pull Request (PR) to the LLVM Project!

This PR will be automatically labeled and the relevant teams will be notified.

If you wish to, you can add reviewers by using the "Reviewers" section on this 
page.

If this is not working for you, it is probably because you do not have write 
permissions for the repository. In which case you can instead tag reviewers by 
name in a comment by using `@` followed by their GitHub username.

If you have received no comments on your PR for a week, you can request a 
review by "ping"ing the PR by adding a comment “Ping”. The common courtesy 
"ping" rate is once a week. Please remember that you are asking for valuable 
time from other developers.

If you have further questions, they may be answered by the [LLVM GitHub User 
Guide](https://llvm.org/docs/GitHub.html).

You can also ask questions in a comment on this PR, on the [LLVM 
Discord](https://discord.com/invite/xS7Z362) or on the 
[forums](https://discourse.llvm.org/).

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


[libunwind] Update LIBUNWIND_ENABLE_WERROR default value in BuildingLibunwind.rst (PR #135546)

2025-04-13 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-libunwind

Author: Firas Khalil Khana (firasuke)


Changes

Hey there,

It seems that `LIBUNWIND_ENABLE_WERROR` defaults to `OFF` according to 
[CMakeLists.txt](https://github.com/llvm/llvm-project/blob/main/libunwind/CMakeLists.txt#L43).

Thanks for your time!

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


1 Files Affected:

- (modified) libunwind/docs/BuildingLibunwind.rst (+1-1) 


``diff
diff --git a/libunwind/docs/BuildingLibunwind.rst 
b/libunwind/docs/BuildingLibunwind.rst
index 8b4f1207d4ba9..c231587fd5022 100644
--- a/libunwind/docs/BuildingLibunwind.rst
+++ b/libunwind/docs/BuildingLibunwind.rst
@@ -91,7 +91,7 @@ libunwind specific options
 
 .. option:: LIBUNWIND_ENABLE_WERROR:BOOL
 
-  **Default**: ``ON``
+  **Default**: ``OFF``
 
   Compile with -Werror
 

``




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


[clang] [flang] [driver] Generalize the code that adds the path of libflang_rt.runtime.a. (PR #134362)

2025-04-13 Thread LLVM Continuous Integration via cfe-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `lldb-aarch64-ubuntu` 
running on `linaro-lldb-aarch64-ubuntu` while building `clang,flang` at step 6 
"test".

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


Here is the relevant piece of the build log for the reference

```
Step 6 (test) failure: build (failure)
...
PASS: lldb-unit :: ValueObject/./LLDBValueObjectTests/8/11 (2113 of 2122)
PASS: lldb-unit :: ValueObject/./LLDBValueObjectTests/9/11 (2114 of 2122)
PASS: lldb-unit :: tools/lldb-server/tests/./LLDBServerTests/0/2 (2115 of 2122)
PASS: lldb-unit :: tools/lldb-server/tests/./LLDBServerTests/1/2 (2116 of 2122)
PASS: lldb-unit :: Utility/./UtilityTests/4/9 (2117 of 2122)
PASS: lldb-unit :: Target/./TargetTests/11/14 (2118 of 2122)
PASS: lldb-unit :: Host/./HostTests/9/12 (2119 of 2122)
PASS: lldb-unit :: Host/./HostTests/3/12 (2120 of 2122)
PASS: lldb-unit :: Process/gdb-remote/./ProcessGdbRemoteTests/8/9 (2121 of 2122)
UNRESOLVED: lldb-api :: tools/lldb-server/TestLldbGdbServer.py (2122 of 2122)
 TEST 'lldb-api :: tools/lldb-server/TestLldbGdbServer.py' 
FAILED 
Script:
--
/usr/bin/python3.10 
/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/dotest.py
 -u CXXFLAGS -u CFLAGS --env 
LLVM_LIBS_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./lib --env 
LLVM_INCLUDE_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/include 
--env LLVM_TOOLS_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin 
--arch aarch64 --build-dir 
/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex 
--lldb-module-cache-dir 
/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex/module-cache-lldb/lldb-api
 --clang-module-cache-dir 
/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex/module-cache-clang/lldb-api
 --executable /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/lldb 
--compiler /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/clang 
--dsymutil /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/dsymutil 
--make /usr/bin/gmake --llvm-tools-dir 
/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin --lldb-obj-root 
/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/tools/lldb --lldb-libs-dir 
/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./lib 
/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/tools/lldb-server
 -p TestLldbGdbServer.py
--
Exit Code: 1

Command Output (stdout):
--
lldb version 21.0.0git (https://github.com/llvm/llvm-project.git revision 
1264d7a53a4de3094672be2a248db57b213f33ac)
  clang revision 1264d7a53a4de3094672be2a248db57b213f33ac
  llvm revision 1264d7a53a4de3094672be2a248db57b213f33ac
Skipping the following test categories: ['libc++', 'dsym', 'gmodules', 
'debugserver', 'objc']

--
Command Output (stderr):
--
UNSUPPORTED: LLDB 
(/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: 
test_Hc_then_Csignal_signals_correct_thread_launch_debugserver 
(TestLldbGdbServer.LldbGdbServerTestCase) (test case does not fall in any 
category of interest for this run) 
PASS: LLDB 
(/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: 
test_Hc_then_Csignal_signals_correct_thread_launch_llgs 
(TestLldbGdbServer.LldbGdbServerTestCase)
PASS: LLDB 
(/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: 
test_Hg_fails_on_another_pid_llgs (TestLldbGdbServer.LldbGdbServerTestCase)
PASS: LLDB 
(/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: 
test_Hg_fails_on_minus_one_pid_llgs (TestLldbGdbServer.LldbGdbServerTestCase)
PASS: LLDB 
(/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: 
test_Hg_fails_on_zero_pid_llgs (TestLldbGdbServer.LldbGdbServerTestCase)
UNSUPPORTED: LLDB 
(/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: 
test_Hg_switches_to_3_threads_launch_debugserver 
(TestLldbGdbServer.LldbGdbServerTestCase) (test case does not fall in any 
category of interest for this run) 
PASS: LLDB 
(/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: 
test_Hg_switches_to_3_threads_launch_llgs 
(TestLldbGdbServer.LldbGdbServerTestCase)
UNSUPPORTED: LLDB 
(/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: 
test_P_and_p_thread_suffix_work_debugserver 
(TestLldbGdbServer.LldbGdbServerTestCase) (test case does not fall in any 
category of interest for this run) 
PASS: LLDB 
(/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: 
test_P_and_p_thread_suffix_work_llgs (TestLldbGdbServer.LldbGdbServerTestCase)
UNSUPPORTED: LLDB 
(/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: 
test_P_writes_all_gpr_registers_debugserver 
(TestLldbGdbServer.LldbGdbServerTestCase) (test case does not fall in any 
category of interest 

[libunwind] Update LIBUNWIND_ENABLE_WERROR default value in BuildingLibunwind.rst (PR #135546)

2025-04-13 Thread Firas Khalil Khana via cfe-commits

https://github.com/firasuke created 
https://github.com/llvm/llvm-project/pull/135546

Hey there,

It seems that `LIBUNWIND_ENABLE_WERROR` defaults to `OFF` according to 
[CMakeLists.txt](https://github.com/llvm/llvm-project/blob/main/libunwind/CMakeLists.txt#L43).

Thanks for your time!

>From 4d76be119779d4e6dca8485f252fdc150f2a5137 Mon Sep 17 00:00:00 2001
From: Firas Khalil Khana 
Date: Sun, 13 Apr 2025 16:35:19 +0300
Subject: [PATCH] Update LIBUNWIND_ENABLE_WERROR default value

---
 libunwind/docs/BuildingLibunwind.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libunwind/docs/BuildingLibunwind.rst 
b/libunwind/docs/BuildingLibunwind.rst
index 8b4f1207d4ba9..c231587fd5022 100644
--- a/libunwind/docs/BuildingLibunwind.rst
+++ b/libunwind/docs/BuildingLibunwind.rst
@@ -91,7 +91,7 @@ libunwind specific options
 
 .. option:: LIBUNWIND_ENABLE_WERROR:BOOL
 
-  **Default**: ``ON``
+  **Default**: ``OFF``
 
   Compile with -Werror
 

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


[clang] 578ca5e - [clang][bytecode] Print jump lines in Function::dump() (#135482)

2025-04-13 Thread via cfe-commits

Author: Timm Baeder
Date: 2025-04-13T15:46:01+02:00
New Revision: 578ca5e469ef1c91a79aa15bc186921ee7faa855

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

LOG: [clang][bytecode] Print jump lines in Function::dump() (#135482)

E.g. for
```c++
constexpr int foo(int b) {
  int a = 1+1;

  for (int i = 0; i < b; ++i) {
++a;
  }
  return a;
}
```

we now print:
```
foo 0x7cc8d4bf0580
frame size: 128
arg size:   8
rvo:0
this arg:   0
0  InitScope 0
16 ConstSint32   1
32 ConstSint32   1
48 AddSint32
56 SetLocalSint3240
72 ConstSint32   0
88 SetLocalSint32104
104GetPtrLocal   104 <-+
120LoadPopSint32   |
128GetPtrParam   0 |
144LoadPopSint32   |
152LTSint32|
160Jf80 --+|
176GetPtrLocal   40   ||
192IncPopSint32  1||
208GetPtrLocal   104  ||
224IncPopSint32  1||
240Jmp   -152 |  --+
256GetPtrLocal   40 <-+
272LoadPopSint32
280Destroy   0
296RetSint32
304Destroy   0
320NoRet
```

Added: 


Modified: 
clang/lib/AST/ByteCode/Disasm.cpp
clang/utils/TableGen/ClangOpcodesEmitter.cpp

Removed: 




diff  --git a/clang/lib/AST/ByteCode/Disasm.cpp 
b/clang/lib/AST/ByteCode/Disasm.cpp
index 12c434029562d..d4c9ce6050b85 100644
--- a/clang/lib/AST/ByteCode/Disasm.cpp
+++ b/clang/lib/AST/ByteCode/Disasm.cpp
@@ -33,39 +33,74 @@
 using namespace clang;
 using namespace clang::interp;
 
-template  inline static T ReadArg(Program &P, CodePtr &OpPC) {
+template 
+inline static std::string printArg(Program &P, CodePtr &OpPC) {
   if constexpr (std::is_pointer_v) {
 uint32_t ID = OpPC.read();
-return reinterpret_cast(P.getNativePointer(ID));
+std::string Result;
+llvm::raw_string_ostream SS(Result);
+SS << reinterpret_cast(P.getNativePointer(ID));
+return Result;
   } else {
-return OpPC.read();
+std::string Result;
+llvm::raw_string_ostream SS(Result);
+auto Arg = OpPC.read();
+SS << Arg;
+return Result;
   }
 }
 
-template <> inline Floating ReadArg(Program &P, CodePtr &OpPC) {
-  Floating F = Floating::deserialize(*OpPC);
+template <> inline std::string printArg(Program &P, CodePtr &OpPC) {
+  auto F = Floating::deserialize(*OpPC);
   OpPC += align(F.bytesToSerialize());
-  return F;
+
+  std::string Result;
+  llvm::raw_string_ostream SS(Result);
+  SS << F;
+  return Result;
 }
 
 template <>
-inline IntegralAP ReadArg>(Program &P, CodePtr &OpPC) 
{
-  IntegralAP I = IntegralAP::deserialize(*OpPC);
-  OpPC += align(I.bytesToSerialize());
-  return I;
-}
+inline std::string printArg>(Program &P, CodePtr &OpPC) {
+  auto F = IntegralAP::deserialize(*OpPC);
+  OpPC += align(F.bytesToSerialize());
 
+  std::string Result;
+  llvm::raw_string_ostream SS(Result);
+  SS << F;
+  return Result;
+}
 template <>
-inline IntegralAP ReadArg>(Program &P, CodePtr &OpPC) {
-  IntegralAP I = IntegralAP::deserialize(*OpPC);
-  OpPC += align(I.bytesToSerialize());
-  return I;
+inline std::string printArg>(Program &P, CodePtr &OpPC) {
+  auto F = IntegralAP::deserialize(*OpPC);
+  OpPC += align(F.bytesToSerialize());
+
+  std::string Result;
+  llvm::raw_string_ostream SS(Result);
+  SS << F;
+  return Result;
 }
 
-template <> inline FixedPoint ReadArg(Program &P, CodePtr &OpPC) {
-  FixedPoint I = FixedPoint::deserialize(*OpPC);
-  OpPC += align(I.bytesToSerialize());
-  return I;
+template <> inline std::string printArg(Program &P, CodePtr &OpPC) 
{
+  auto F = FixedPoint::deserialize(*OpPC);
+  OpPC += align(F.bytesToSerialize());
+
+  std::string Result;
+  llvm::raw_string_ostream SS(Result);
+  SS << F;
+  return Result;
+}
+
+static bool isJumpOpcode(Opcode Op) {
+  return Op == OP_Jmp || Op == OP_Jf || Op == OP_Jt;
+}
+
+static size_t getNumDisplayWidth(size_t N) {
+  unsigned L = 1u, M = 10u;
+  while (M <= N && ++L != std::numeric_limits::digits10 + 1)
+M *= 10u;
+
+  return L;
 }
 
 LLVM_DUMP_METHOD void Function::dump() const { dump(llvm::errs()); }
@@ -80,23 +115,115 @@ LLVM_DUMP_METHOD void Function::dump(llvm::raw_ostream 
&OS) const {
   OS << "rvo:" << hasRVO() << "\n";
   OS << "this arg:   " << hasThisPointer() << "\n";
 
-  auto PrintName = [&OS](const char *Name) {
-OS << Name;
-long N = 30 - strlen(Name);
-if (N > 0)
-  OS.indent(N);
+  struct OpText {
+size_t Addr;
+std::string Op;
+bool IsJump;
+llvm::SmallVector Args;
   };
 
+  auto PrintName = [](const char *Name) -> std::string {
+return std::string(Name);
+  };
+
+  llvm::SmallVector Code;
+  size_t Longes

[clang] [clang][bytecode] Print jump lines in Function::dump() (PR #135482)

2025-04-13 Thread Timm Baeder via cfe-commits

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


[clang] [llvm] [X86][AVX10] Remove VAES and VPCLMULQDQ feature from AVX10.1 (PR #135489)

2025-04-13 Thread LLVM Continuous Integration via cfe-commits

llvm-ci wrote:

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

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


Here is the relevant piece of the build log for the reference

```
Step 2 (annotate) failure: 'python 
../sanitizer_buildbot/sanitizers/zorg/buildbot/builders/sanitizers/buildbot_selector.py'
 (failure)
...
[182/186] Generating MSAN_INST_TEST_OBJECTS.msan_test.cpp.aarch64-with-call.o
[183/186] Generating Msan-aarch64-with-call-Test
[184/186] Generating MSAN_INST_TEST_OBJECTS.msan_test.cpp.aarch64.o
[185/186] Generating Msan-aarch64-Test
[185/186] Running compiler_rt regression tests
llvm-lit: 
/home/b/sanitizer-aarch64-linux/build/llvm-project/llvm/utils/lit/lit/discovery.py:276:
 warning: input 
'/home/b/sanitizer-aarch64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/interception/Unit'
 contained no tests
llvm-lit: 
/home/b/sanitizer-aarch64-linux/build/llvm-project/llvm/utils/lit/lit/discovery.py:276:
 warning: input 
'/home/b/sanitizer-aarch64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/sanitizer_common/Unit'
 contained no tests
llvm-lit: 
/home/b/sanitizer-aarch64-linux/build/llvm-project/llvm/utils/lit/lit/main.py:72:
 note: The test suite configuration requested an individual test timeout of 0 
seconds but a timeout of 900 seconds was requested on the command line. Forcing 
timeout to be 900 seconds.
-- Testing: 6025 tests, 72 workers --
Testing:  0.. 10.. 20.
FAIL: HWAddressSanitizer-aarch64 :: 
TestCases/hwasan_symbolize_stack_overflow.cpp (1595 of 6025)
 TEST 'HWAddressSanitizer-aarch64 :: 
TestCases/hwasan_symbolize_stack_overflow.cpp' FAILED 
Exit Code: 1

Command Output (stderr):
--
rm -rf 
/home/b/sanitizer-aarch64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/hwasan/AARCH64/TestCases/Output/hwasan_symbolize_stack_overflow.cpp.tmp;
 mkdir 
/home/b/sanitizer-aarch64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/hwasan/AARCH64/TestCases/Output/hwasan_symbolize_stack_overflow.cpp.tmp
 # RUN: at line 1
+ rm -rf 
/home/b/sanitizer-aarch64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/hwasan/AARCH64/TestCases/Output/hwasan_symbolize_stack_overflow.cpp.tmp
+ mkdir 
/home/b/sanitizer-aarch64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/hwasan/AARCH64/TestCases/Output/hwasan_symbolize_stack_overflow.cpp.tmp
/home/b/sanitizer-aarch64-linux/build/build_default/./bin/clang
-Wthread-safety -Wthread-safety-reference -Wthread-safety-beta   
-gline-tables-only -fsanitize=hwaddress -fuse-ld=lld -mllvm -hwasan-globals 
-mllvm -hwasan-use-short-granules -mllvm -hwasan-instrument-landing-pads=0 
-mllvm -hwasan-instrument-personality-functions -Wl,--build-id -g 
/home/b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/test/hwasan/TestCases/hwasan_symbolize_stack_overflow.cpp
 -o 
/home/b/sanitizer-aarch64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/hwasan/AARCH64/TestCases/Output/hwasan_symbolize_stack_overflow.cpp.tmp/hwasan_overflow
 # RUN: at line 2
+ /home/b/sanitizer-aarch64-linux/build/build_default/./bin/clang 
-Wthread-safety -Wthread-safety-reference -Wthread-safety-beta 
-gline-tables-only -fsanitize=hwaddress -fuse-ld=lld -mllvm -hwasan-globals 
-mllvm -hwasan-use-short-granules -mllvm -hwasan-instrument-landing-pads=0 
-mllvm -hwasan-instrument-personality-functions -Wl,--build-id -g 
/home/b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/test/hwasan/TestCases/hwasan_symbolize_stack_overflow.cpp
 -o 
/home/b/sanitizer-aarch64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/hwasan/AARCH64/TestCases/Output/hwasan_symbolize_stack_overflow.cpp.tmp/hwasan_overflow
env 
HWASAN_OPTIONS=disable_allocator_tagging=1:random_tags=0:fail_without_syscall_abi=0:symbolize=0
 not  
/home/b/sanitizer-aarch64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/hwasan/AARCH64/TestCases/Output/hwasan_symbolize_stack_overflow.cpp.tmp/hwasan_overflow
 16 2>&1 | 
/home/b/sanitizer-aarch64-linux/build/build_default/bin/hwasan_symbolize 
--symbols 
/home/b/sanitizer-aarch64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/hwasan/AARCH64/TestCases/Output/hwasan_symbolize_stack_overflow.cpp.tmp
 --index | FileCheck 
/home/b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/test/hwasan/TestCases/hwasan_symbolize_stack_overflow.cpp
 --check-prefixes=CHECK,AFTER0 # RUN: at line 3
+ env 
HWASAN_OPTIONS=disable_allocator_tagging=1:random_tags=0:fail_without_syscall_abi=0:symbolize=0
 not 
/home/b/sanitizer-aarch64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/hwasan/AARCH64/TestCases/Output/hwasan_symbolize_stack_overflow.cpp.tmp/hwasan_overflow
 16
+ /home/b/sanitizer-aarch64-linux/build/build_d

[clang] [llvm] [X86][AVX10] Remove VAES and VPCLMULQDQ feature from AVX10.1 (PR #135489)

2025-04-13 Thread via cfe-commits

llvmbot wrote:

/pull-request llvm/llvm-project#135577

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


[clang] Clang: Add elementwise minnum/maxnum builtin functions (PR #129207)

2025-04-13 Thread LLVM Continuous Integration via cfe-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder 
`clang-cmake-x86_64-avx512-win` running on `avx512-intel64-win` while building 
`clang` at step 4 "cmake stage 1".

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


Here is the relevant piece of the build log for the reference

```
Step 4 (cmake stage 1) failure: 'cmake -G ...' (failure)
'cmake' is not recognized as an internal or external command,
operable program or batch file.

```



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


[clang] [llvm] [RISCV] Add Andes XAndesperf (Andes Performance) extension. (PR #135110)

2025-04-13 Thread Kito Cheng via cfe-commits


@@ -0,0 +1,34 @@
+# XAndesPerf - Andes Performance Extension
+# RUN: llvm-mc %s -triple=riscv64 -mattr=+xandesperf -show-encoding \
+# RUN: | FileCheck -check-prefixes=CHECK-ASM,CHECK-ASM-AND-OBJ %s
+# RUN: llvm-mc -filetype=obj -triple riscv64 -mattr=+xandesperf < %s \
+# RUN: | llvm-objdump --mattr=+xandesperf -M no-aliases --no-print-imm-hex 
-d -r - \
+# RUN: | FileCheck -check-prefixes=CHECK-ASM-AND-OBJ %s
+
+# CHECK-ASM-AND-OBJ: lea.b.ze t0, t1, t3
+# CHECK-ASM: encoding: [0xdb,0x02,0xc3,0x11]
+nds.lea.b.ze t0, t1, t3
+
+# CHECK-ASM-AND-OBJ: lea.h.ze a0, a1, a3
+# CHECK-ASM: encoding: [0x5b,0x85,0xd5,0x12]
+nds.lea.h.ze a0, a1, a3
+
+# CHECK-ASM-AND-OBJ: lea.w.ze s0, s1, s3
+# CHECK-ASM: encoding: [0x5b,0x84,0x34,0x15]
+nds.lea.w.ze s0, s1, s3
+
+# CHECK-ASM-AND-OBJ: lea.d.ze a3, a4, a5
+# CHECK-ASM: encoding: [0xdb,0x06,0xf7,0x16]
+nds.lea.d.ze a3, a4, a5
+
+# CHECK-ASM-AND-OBJ: lwugp t0, 9568
+# CHECK-ASM: encoding: [0xab,0x62,0x04,0x56]
+nds.lwugp t0, 0x2560
+
+# CHECK-ASM-AND-OBJ: ldgp t0, -9568
+# CHECK-ASM: encoding: [0xab,0xb2,0x7b,0xaa]
+nds.ldgp t0, -0x2560
+
+# CHECK-ASM-AND-OBJ: sdgp t0, 9568

kito-cheng wrote:

`nds.` prefix?

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


[clang] [llvm] [RISCV] Add Andes XAndesperf (Andes Performance) extension. (PR #135110)

2025-04-13 Thread Kito Cheng via cfe-commits


@@ -0,0 +1,105 @@
+# XAndesPerf - Andes Performance Extension
+# RUN: llvm-mc %s -triple=riscv32 -mattr=+xandesperf -show-encoding \
+# RUN: | FileCheck -check-prefixes=CHECK-ASM,CHECK-ASM-AND-OBJ %s
+# RUN: llvm-mc -filetype=obj -triple riscv32 -mattr=+xandesperf < %s \
+# RUN: | llvm-objdump --mattr=+xandesperf -M no-aliases --no-print-imm-hex 
-d -r - \
+# RUN: | FileCheck -check-prefixes=CHECK-OBJ,CHECK-OBJ32,CHECK-ASM-AND-OBJ 
%s
+# RUN: llvm-mc %s -triple=riscv64 -mattr=+xandesperf -show-encoding \
+# RUN: | FileCheck -check-prefixes=CHECK-ASM,CHECK-ASM-AND-OBJ %s
+# RUN: llvm-mc -filetype=obj -triple riscv64 -mattr=+xandesperf < %s \
+# RUN: | llvm-objdump --mattr=+xandesperf -M no-aliases --no-print-imm-hex 
-d -r - \
+# RUN: | FileCheck -check-prefixes=CHECK-OBJ,CHECK-OBJ64,CHECK-ASM-AND-OBJ 
%s
+
+# CHECK-OBJ: nds.bbc a0, 16, 0x200
+# CHECK-ASM: nds.bbc a0, 16, 512
+# CHECK-ASM: encoding: [0x5b,0x70,0x05,0x21]
+nds.bbc a0, 16, 512
+
+# CHECK-OBJ32: nds.bbs a1, 21, 0xff04
+# CHECK-OBJ64: nds.bbs a1, 21, 0xff04
+# CHECK-ASM: nds.bbs a1, 21, -256
+# CHECK-ASM: encoding: [0x5b,0xf0,0x55,0xf1]
+nds.bbs a1, 21, -256
+
+# CHECK-OBJ: beqc t0, 23, 0x108
+# CHECK-ASM: beqc t0, 23, 256
+# CHECK-ASM: encoding: [0x5b,0xd0,0x72,0x11]
+nds.beqc t0, 23, 256
+
+# CHECK-OBJ32: bnec t1, 9, 0xff8c
+# CHECK-OBJ64: bnec t1, 9, 0xff8c
+# CHECK-ASM: bnec t1, 9, -128

kito-cheng wrote:

`nds.`

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


[clang] [llvm] [RISCV] Add Andes XAndesperf (Andes Performance) extension. (PR #135110)

2025-04-13 Thread Kito Cheng via cfe-commits


@@ -0,0 +1,105 @@
+# XAndesPerf - Andes Performance Extension
+# RUN: llvm-mc %s -triple=riscv32 -mattr=+xandesperf -show-encoding \
+# RUN: | FileCheck -check-prefixes=CHECK-ASM,CHECK-ASM-AND-OBJ %s
+# RUN: llvm-mc -filetype=obj -triple riscv32 -mattr=+xandesperf < %s \
+# RUN: | llvm-objdump --mattr=+xandesperf -M no-aliases --no-print-imm-hex 
-d -r - \
+# RUN: | FileCheck -check-prefixes=CHECK-OBJ,CHECK-OBJ32,CHECK-ASM-AND-OBJ 
%s
+# RUN: llvm-mc %s -triple=riscv64 -mattr=+xandesperf -show-encoding \
+# RUN: | FileCheck -check-prefixes=CHECK-ASM,CHECK-ASM-AND-OBJ %s
+# RUN: llvm-mc -filetype=obj -triple riscv64 -mattr=+xandesperf < %s \
+# RUN: | llvm-objdump --mattr=+xandesperf -M no-aliases --no-print-imm-hex 
-d -r - \
+# RUN: | FileCheck -check-prefixes=CHECK-OBJ,CHECK-OBJ64,CHECK-ASM-AND-OBJ 
%s
+
+# CHECK-OBJ: nds.bbc a0, 16, 0x200
+# CHECK-ASM: nds.bbc a0, 16, 512
+# CHECK-ASM: encoding: [0x5b,0x70,0x05,0x21]
+nds.bbc a0, 16, 512
+
+# CHECK-OBJ32: nds.bbs a1, 21, 0xff04
+# CHECK-OBJ64: nds.bbs a1, 21, 0xff04
+# CHECK-ASM: nds.bbs a1, 21, -256
+# CHECK-ASM: encoding: [0x5b,0xf0,0x55,0xf1]
+nds.bbs a1, 21, -256
+
+# CHECK-OBJ: beqc t0, 23, 0x108
+# CHECK-ASM: beqc t0, 23, 256
+# CHECK-ASM: encoding: [0x5b,0xd0,0x72,0x11]
+nds.beqc t0, 23, 256
+
+# CHECK-OBJ32: bnec t1, 9, 0xff8c
+# CHECK-OBJ64: bnec t1, 9, 0xff8c
+# CHECK-ASM: bnec t1, 9, -128
+# CHECK-ASM: encoding: [0x5b,0x60,0x93,0xb8]
+nds.bnec t1, 9, -128
+
+# CHECK-ASM-AND-OBJ: bfoz a0, a1, 9, 13
+# CHECK-ASM: encoding: [0x5b,0xa5,0xd5,0x24]
+nds.bfoz a0, a1, 9, 13
+
+# CHECK-ASM-AND-OBJ: bfos t0, t1, 23, 3
+# CHECK-ASM: encoding: [0xdb,0x32,0x33,0x5c]
+nds.bfos t0, t1, 23, 3
+
+# CHECK-ASM-AND-OBJ: lea.h t0, t1, t3
+# CHECK-ASM: encoding: [0xdb,0x02,0xc3,0x0b]
+nds.lea.h t0, t1, t3
+
+# CHECK-ASM-AND-OBJ: lea.w a0, a1, a3
+# CHECK-ASM: encoding: [0x5b,0x85,0xd5,0x0c]
+nds.lea.w a0, a1, a3
+
+# CHECK-ASM-AND-OBJ: lea.d s0, s1, s3
+# CHECK-ASM: encoding: [0x5b,0x84,0x34,0x0f]
+nds.lea.d s0, s1, s3
+
+# CHECK-ASM-AND-OBJ: addigp t0, 9568
+# CHECK-ASM: encoding: [0x8b,0x12,0x04,0x56]
+nds.addigp t0, 0x2560
+
+# CHECK-ASM-AND-OBJ: lbgp t0, -9568
+# CHECK-ASM: encoding: [0x8b,0x82,0x1b,0xaa]
+nds.lbgp t0, -0x2560
+
+# CHECK-ASM-AND-OBJ: lbugp t0, 9568
+# CHECK-ASM: encoding: [0x8b,0x22,0x04,0x56]
+nds.lbugp t0, 0x2560
+
+# CHECK-ASM-AND-OBJ: lhgp t0, -9568
+# CHECK-ASM: encoding: [0xab,0x92,0x1b,0xaa]
+nds.lhgp t0, -0x2560
+
+# CHECK-ASM-AND-OBJ: lhugp t0, 9568
+# CHECK-ASM: encoding: [0xab,0x52,0x04,0x56]
+nds.lhugp t0, 0x2560
+
+# CHECK-ASM-AND-OBJ: lwgp t0, -9568
+# CHECK-ASM: encoding: [0xab,0xa2,0x3b,0xaa]
+nds.lwgp t0, -0x2560
+
+# CHECK-ASM-AND-OBJ: sbgp t0, 9568
+# CHECK-ASM: encoding: [0x0b,0x30,0x54,0x56]
+nds.sbgp t0, 0x2560
+
+# CHECK-ASM-AND-OBJ: shgp t0, -9568
+# CHECK-ASM: encoding: [0xab,0x80,0x5b,0xaa]
+nds.shgp t0, -0x2560
+
+# CHECK-ASM-AND-OBJ: swgp t0, 9568
+# CHECK-ASM: encoding: [0x2b,0x40,0x54,0x56]
+nds.swgp t0, 0x2560
+
+# CHECK-ASM-AND-OBJ: ffb t0, t1, t3
+# CHECK-ASM: encoding: [0xdb,0x02,0xc3,0x21]
+nds.ffb t0, t1, t3
+
+# CHECK-ASM-AND-OBJ: ffzmism a0, a1, a3
+# CHECK-ASM: encoding: [0x5b,0x85,0xd5,0x22]
+nds.ffzmism a0, a1, a3
+
+# CHECK-ASM-AND-OBJ: ffmism s0, s1, s3
+# CHECK-ASM: encoding: [0x5b,0x84,0x34,0x25]
+nds.ffmism s0, s1, s3
+
+# CHECK-ASM-AND-OBJ: flmism s0, s1, s3
+# CHECK-ASM: encoding: [0x5b,0x84,0x34,0x27]

kito-cheng wrote:

`nds.` prefix?

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


[clang] [llvm] [RISCV] Add Andes XAndesperf (Andes Performance) extension. (PR #135110)

2025-04-13 Thread Kito Cheng via cfe-commits


@@ -0,0 +1,105 @@
+# XAndesPerf - Andes Performance Extension
+# RUN: llvm-mc %s -triple=riscv32 -mattr=+xandesperf -show-encoding \
+# RUN: | FileCheck -check-prefixes=CHECK-ASM,CHECK-ASM-AND-OBJ %s
+# RUN: llvm-mc -filetype=obj -triple riscv32 -mattr=+xandesperf < %s \
+# RUN: | llvm-objdump --mattr=+xandesperf -M no-aliases --no-print-imm-hex 
-d -r - \
+# RUN: | FileCheck -check-prefixes=CHECK-OBJ,CHECK-OBJ32,CHECK-ASM-AND-OBJ 
%s
+# RUN: llvm-mc %s -triple=riscv64 -mattr=+xandesperf -show-encoding \
+# RUN: | FileCheck -check-prefixes=CHECK-ASM,CHECK-ASM-AND-OBJ %s
+# RUN: llvm-mc -filetype=obj -triple riscv64 -mattr=+xandesperf < %s \
+# RUN: | llvm-objdump --mattr=+xandesperf -M no-aliases --no-print-imm-hex 
-d -r - \
+# RUN: | FileCheck -check-prefixes=CHECK-OBJ,CHECK-OBJ64,CHECK-ASM-AND-OBJ 
%s
+
+# CHECK-OBJ: nds.bbc a0, 16, 0x200
+# CHECK-ASM: nds.bbc a0, 16, 512
+# CHECK-ASM: encoding: [0x5b,0x70,0x05,0x21]
+nds.bbc a0, 16, 512
+
+# CHECK-OBJ32: nds.bbs a1, 21, 0xff04
+# CHECK-OBJ64: nds.bbs a1, 21, 0xff04
+# CHECK-ASM: nds.bbs a1, 21, -256
+# CHECK-ASM: encoding: [0x5b,0xf0,0x55,0xf1]
+nds.bbs a1, 21, -256
+
+# CHECK-OBJ: beqc t0, 23, 0x108
+# CHECK-ASM: beqc t0, 23, 256

kito-cheng wrote:

`nds.`?

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


[clang] [llvm] [RISCV] Add Andes XAndesperf (Andes Performance) extension. (PR #135110)

2025-04-13 Thread Kito Cheng via cfe-commits


@@ -0,0 +1,34 @@
+# XAndesPerf - Andes Performance Extension
+# RUN: llvm-mc %s -triple=riscv64 -mattr=+xandesperf -show-encoding \
+# RUN: | FileCheck -check-prefixes=CHECK-ASM,CHECK-ASM-AND-OBJ %s
+# RUN: llvm-mc -filetype=obj -triple riscv64 -mattr=+xandesperf < %s \
+# RUN: | llvm-objdump --mattr=+xandesperf -M no-aliases --no-print-imm-hex 
-d -r - \
+# RUN: | FileCheck -check-prefixes=CHECK-ASM-AND-OBJ %s
+
+# CHECK-ASM-AND-OBJ: lea.b.ze t0, t1, t3
+# CHECK-ASM: encoding: [0xdb,0x02,0xc3,0x11]
+nds.lea.b.ze t0, t1, t3
+
+# CHECK-ASM-AND-OBJ: lea.h.ze a0, a1, a3
+# CHECK-ASM: encoding: [0x5b,0x85,0xd5,0x12]
+nds.lea.h.ze a0, a1, a3
+
+# CHECK-ASM-AND-OBJ: lea.w.ze s0, s1, s3
+# CHECK-ASM: encoding: [0x5b,0x84,0x34,0x15]
+nds.lea.w.ze s0, s1, s3
+
+# CHECK-ASM-AND-OBJ: lea.d.ze a3, a4, a5
+# CHECK-ASM: encoding: [0xdb,0x06,0xf7,0x16]
+nds.lea.d.ze a3, a4, a5
+
+# CHECK-ASM-AND-OBJ: lwugp t0, 9568
+# CHECK-ASM: encoding: [0xab,0x62,0x04,0x56]
+nds.lwugp t0, 0x2560
+
+# CHECK-ASM-AND-OBJ: ldgp t0, -9568
+# CHECK-ASM: encoding: [0xab,0xb2,0x7b,0xaa]
+nds.ldgp t0, -0x2560
+
+# CHECK-ASM-AND-OBJ: sdgp t0, 9568
+# CHECK-ASM: encoding: [0x2b,0x70,0x54,0x56]
+nds.sdgp t0, 0x2560

kito-cheng wrote:

`nds.` prefix seems not check in the `CHECK-ASM-AND-OBJ`?

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


[clang] Clang: Add elementwise minnum/maxnum builtin functions (PR #129207)

2025-04-13 Thread YunQiang Su via cfe-commits

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


[clang] [llvm] [ARM] Adding diagnostics for mcmodel=tiny when used in invalid targets (PR #125643)

2025-04-13 Thread via cfe-commits

ShashwathiNavada wrote:

ping @cor3ntin

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


[clang] [llvm] [RISCV] Add Andes XAndesperf (Andes Performance) extension. (PR #135110)

2025-04-13 Thread Kito Cheng via cfe-commits

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


[clang] [Clang] Handle default template arguments for alias CTAD guides (PR #134807)

2025-04-13 Thread Younan Zhang via cfe-commits


@@ -690,6 +690,23 @@ SmallVector 
TemplateParamsReferencedInTemplateArgumentList(
   SemaRef.MarkUsedTemplateParameters(
   DeducedArgs, TemplateParamsList->getDepth(), ReferencedTemplateParams);
 
+  auto MarkDefaultArgs = [&](auto *Param) {
+if (!Param || !Param->hasDefaultArgument())
+  return;
+SemaRef.MarkUsedTemplateParameters(
+Param->getDefaultArgument().getArgument(),
+TemplateParamsList->getDepth(), ReferencedTemplateParams);
+  };
+
+  for (unsigned Index = 0; Index < TemplateParamsList->size(); ++Index) {
+if (!ReferencedTemplateParams[Index])
+  continue;
+auto *Param = TemplateParamsList->getParam(Index);
+MarkDefaultArgs(dyn_cast(Param));
+MarkDefaultArgs(dyn_cast(Param));
+MarkDefaultArgs(dyn_cast(Param));
+  }
+

zyn0217 wrote:

@mizvekov I looked into `ConvertDeducedTemplateArguments` and I'm afraid it 
won't help

In deduction guide synthesizing, we have a unique template parameter transform 
that does handle default parameters (which also covers non-alias deduction 
guide synthesizing) so when we find a parameter (e.g. `U` in example) used by 
the RHS (`A`), we form a new TTP on top of the TTP `U = T`. And, as `T` is 
not referenced by `A`, the declaration of which won't be created anyway, so 
we ended up with a problematic `template >` in 
the eventual CTAD guide.

```cpp
template  struct A {};

template 
using AA = A;
```

This is where the problem lies. And with `ConvertDeducedTemplateArguments`, 
which would substitute the default arguments with the deduced ones in 
non-rewrite mode, we end up building Subst* nodes that we never want in CTAD.

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


[libunwind] Update LIBUNWIND_ENABLE_WERROR default value in BuildingLibunwind.rst (PR #135546)

2025-04-13 Thread via cfe-commits

github-actions[bot] wrote:



@firasuke 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/135546
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libunwind] dd107b2 - Update LIBUNWIND_ENABLE_WERROR default value in BuildingLibunwind.rst (#135546)

2025-04-13 Thread via cfe-commits

Author: Firas Khalil Khana
Date: 2025-04-13T09:41:30-07:00
New Revision: dd107b20daedbc49dc3003ae2cb2e846267c308c

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

LOG: Update LIBUNWIND_ENABLE_WERROR default value in BuildingLibunwind.rst 
(#135546)

`LIBUNWIND_ENABLE_WERROR` defaults to `OFF` according to
[CMakeLists.txt](https://github.com/llvm/llvm-project/blob/main/libunwind/CMakeLists.txt#L43).

Added: 


Modified: 
libunwind/docs/BuildingLibunwind.rst

Removed: 




diff  --git a/libunwind/docs/BuildingLibunwind.rst 
b/libunwind/docs/BuildingLibunwind.rst
index 8b4f1207d4ba9..c231587fd5022 100644
--- a/libunwind/docs/BuildingLibunwind.rst
+++ b/libunwind/docs/BuildingLibunwind.rst
@@ -91,7 +91,7 @@ libunwind specific options
 
 .. option:: LIBUNWIND_ENABLE_WERROR:BOOL
 
-  **Default**: ``ON``
+  **Default**: ``OFF``
 
   Compile with -Werror
 



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


[libunwind] Update LIBUNWIND_ENABLE_WERROR default value in BuildingLibunwind.rst (PR #135546)

2025-04-13 Thread Fangrui Song via cfe-commits

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


[clang] [clang-tools-extra] [clang] implement printing of canonical expressions (PR #135133)

2025-04-13 Thread Matheus Izvekov via cfe-commits

https://github.com/mizvekov updated 
https://github.com/llvm/llvm-project/pull/135133

>From aaf5482c91f73431e1290cab640d01f4b3f39692 Mon Sep 17 00:00:00 2001
From: Matheus Izvekov 
Date: Thu, 10 Apr 2025 02:52:36 -0300
Subject: [PATCH] [clang] implement printing of canonical expressions

This patch extends the canonicalization printing policy to cover expressions
and template names, and wires that up to the template argument printer,
covering expressions, and to the expression within a dependent decltype.

This is helpful for debugging, or if these expressions somehow end up
in diagnostics, as without this patch they can print as completely unrelated
expressions, which can be quite confusing.

This is because expressions are not uniqued, unlike types, and
when a template specialization containing an expression is the first to be
canonicalized, the expression ends up appearing in the canonical type of
subsequent equivalent specializations.

Fixes https://github.com/llvm/llvm-project/issues/92292
---
 .../StaticAccessedThroughInstanceCheck.cpp|2 +-
 .../clang-tidy/utils/Matchers.cpp |2 +-
 clang/include/clang/AST/PrettyPrinter.h   |6 +-
 clang/lib/AST/DeclPrinter.cpp |4 +-
 clang/lib/AST/JSONNodeDumper.cpp  |2 +
 clang/lib/AST/StmtPrinter.cpp |6 +-
 clang/lib/AST/TemplateBase.cpp|7 +-
 clang/lib/AST/TemplateName.cpp|   10 +-
 clang/lib/AST/TextNodeDumper.cpp  |2 +
 clang/lib/AST/TypePrinter.cpp |   16 +-
 clang/lib/CodeGen/CGDebugInfo.cpp |2 +-
 clang/lib/Sema/SemaTemplate.cpp   |2 +-
 clang/test/AST/ast-dump-templates.cpp | 1022 +
 .../test/CXX/temp/temp.decls/temp.mem/p5.cpp  |   17 +
 clang/unittests/AST/TypePrinterTest.cpp   |2 +-
 15 files changed, 1080 insertions(+), 22 deletions(-)

diff --git 
a/clang-tools-extra/clang-tidy/readability/StaticAccessedThroughInstanceCheck.cpp
 
b/clang-tools-extra/clang-tidy/readability/StaticAccessedThroughInstanceCheck.cpp
index 08adc7134cfea..fffb136e5a332 100644
--- 
a/clang-tools-extra/clang-tidy/readability/StaticAccessedThroughInstanceCheck.cpp
+++ 
b/clang-tools-extra/clang-tidy/readability/StaticAccessedThroughInstanceCheck.cpp
@@ -69,7 +69,7 @@ void StaticAccessedThroughInstanceCheck::check(
   PrintingPolicyWithSuppressedTag.SuppressTagKeyword = true;
   PrintingPolicyWithSuppressedTag.SuppressUnwrittenScope = true;
 
-  PrintingPolicyWithSuppressedTag.PrintCanonicalTypes =
+  PrintingPolicyWithSuppressedTag.PrintAsCanonical =
   !BaseExpr->getType()->isTypedefNameType();
 
   std::string BaseTypeName =
diff --git a/clang-tools-extra/clang-tidy/utils/Matchers.cpp 
b/clang-tools-extra/clang-tidy/utils/Matchers.cpp
index 742dc6fda8c92..4974a9cdb9f4b 100644
--- a/clang-tools-extra/clang-tidy/utils/Matchers.cpp
+++ b/clang-tools-extra/clang-tidy/utils/Matchers.cpp
@@ -33,7 +33,7 @@ bool MatchesAnyListedTypeNameMatcher::matches(
 
   PrintingPolicy PrintingPolicyWithSuppressedTag(
   Finder->getASTContext().getLangOpts());
-  PrintingPolicyWithSuppressedTag.PrintCanonicalTypes = CanonicalTypes;
+  PrintingPolicyWithSuppressedTag.PrintAsCanonical = CanonicalTypes;
   PrintingPolicyWithSuppressedTag.SuppressElaboration = true;
   PrintingPolicyWithSuppressedTag.SuppressScope = false;
   PrintingPolicyWithSuppressedTag.SuppressTagKeyword = true;
diff --git a/clang/include/clang/AST/PrettyPrinter.h 
b/clang/include/clang/AST/PrettyPrinter.h
index 91818776b770c..5a98ae1987b16 100644
--- a/clang/include/clang/AST/PrettyPrinter.h
+++ b/clang/include/clang/AST/PrettyPrinter.h
@@ -76,7 +76,7 @@ struct PrintingPolicy {
 MSWChar(LO.MicrosoftExt && !LO.WChar), IncludeNewlines(true),
 MSVCFormatting(false), ConstantsAsWritten(false),
 SuppressImplicitBase(false), FullyQualifiedName(false),
-PrintCanonicalTypes(false), PrintInjectedClassNameWithArguments(true),
+PrintAsCanonical(false), PrintInjectedClassNameWithArguments(true),
 UsePreferredNames(true), AlwaysIncludeTypeForTemplateArgument(false),
 CleanUglifiedParameters(false), EntireContentsOfLargeArray(true),
 UseEnumerators(true), UseHLSLTypes(LO.HLSL) {}
@@ -310,9 +310,9 @@ struct PrintingPolicy {
   LLVM_PREFERRED_TYPE(bool)
   unsigned FullyQualifiedName : 1;
 
-  /// Whether to print types as written or canonically.
+  /// Whether to print entities as written or canonically.
   LLVM_PREFERRED_TYPE(bool)
-  unsigned PrintCanonicalTypes : 1;
+  unsigned PrintAsCanonical : 1;
 
   /// Whether to print an InjectedClassNameType with template arguments or as
   /// written. When a template argument is unnamed, printing it results in
diff --git a/clang/lib/AST/DeclPrinter.cpp b/clang/lib/AST/DeclPrinter.cpp
index 28098b242d494..22da5bf251ecd 100644
--- a/clang/lib/AST/DeclPrinter.cpp
+++ b/clang/lib/AST/DeclPrinter.cpp
@@ -735,7 +735,7

[clang] [clang-format]: Add `Custom` to `ShortFunctionStyle`; add new AllowShortFunctionsOnASingleLineOptions for granular setup (PR #134337)

2025-04-13 Thread Owen Pan via cfe-commits

owenca wrote:

We should stick to the table in 
https://github.com/llvm/llvm-project/pull/134337#discussion_r2028339995 and 
deprecate `SFS_InlineOnly`, `SFS_Empty`, and `SFS_Inline`.

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


[clang] [clang][bytecode] Reject constexpr-unknown pointers from Inc ops (PR #135548)

2025-04-13 Thread Timm Baeder via cfe-commits

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


[libunwind] Update LIBUNWIND_ENABLE_WERROR default value in BuildingLibunwind.rst (PR #135546)

2025-04-13 Thread Fangrui Song via cfe-commits

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


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


[clang] [clang][bytecode] Reject constexpr-unknown pointers from Inc ops (PR #135548)

2025-04-13 Thread LLVM Continuous Integration via cfe-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `flang-x86_64-windows` 
running on `minipc-ryzen-win` while building `clang` at step 6 
"build-unified-tree".

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


Here is the relevant piece of the build log for the reference

```
Step 6 (build-unified-tree) failure: build (failure)
...
39.742 [116/12/22] Linking CXX executable bin\sancov.exe
39.778 [115/12/23] Linking CXX executable bin\sanstats.exe
39.819 [114/12/24] Linking CXX executable bin\llvm-xray.exe
39.821 [113/12/25] Linking CXX executable bin\obj2yaml.exe
39.841 [112/12/26] Generating ../../bin/llvm-dlltool.exe
41.429 [111/12/27] Linking CXX executable bin\llvm-objcopy.exe
41.938 [110/12/28] Linking CXX executable bin\llvm-dwarfdump.exe
43.870 [109/12/29] Linking CXX executable bin\llvm-readobj.exe
44.419 [108/12/30] Linking CXX executable bin\llvm-ctxprof-util.exe
45.339 [107/12/31] Linking CXX executable bin\mlir-opt.exe
FAILED: bin/mlir-opt.exe 
C:\Windows\system32\cmd.exe /C "cd . && "C:\Program Files\CMake\bin\cmake.exe" 
-E vs_link_exe --msvc-ver=1943 
--intdir=tools\mlir\tools\mlir-opt\CMakeFiles\mlir-opt.dir 
--rc=C:\PROGRA~2\WI3CF2~1\10\bin\100220~1.0\x64\rc.exe 
--mt=C:\PROGRA~2\WI3CF2~1\10\bin\100220~1.0\x64\mt.exe --manifests  -- 
C:\PROGRA~1\MICROS~2\2022\COMMUN~1\VC\Tools\MSVC\1443~1.348\bin\Hostx64\x64\link.exe
 /nologo @CMakeFiles\mlir-opt.rsp  /out:bin\mlir-opt.exe 
/implib:lib\mlir-opt.lib /pdb:bin\mlir-opt.pdb /version:0.0 /machine:x64 
/STACK:1000 /INCREMENTAL:NO /subsystem:console && cd ."
LINK: command 
"C:\PROGRA~1\MICROS~2\2022\COMMUN~1\VC\Tools\MSVC\1443~1.348\bin\Hostx64\x64\link.exe
 /nologo @CMakeFiles\mlir-opt.rsp /out:bin\mlir-opt.exe 
/implib:lib\mlir-opt.lib /pdb:bin\mlir-opt.pdb /version:0.0 /machine:x64 
/STACK:1000 /INCREMENTAL:NO /subsystem:console /MANIFEST:EMBED,ID=1" failed 
(exit code 0) with the following output:

  Version 14.43.34809.0

  ExceptionCode= C005
  ExceptionFlags   = 
  ExceptionAddress = 7FF658EE36A2 (7FF658EC) 
"C:\PROGRA~1\MICROS~2\2022\COMMUN~1\VC\Tools\MSVC\1443~1.348\bin\Hostx64\x64\link.exe"
  NumberParameters = 0002
  ExceptionInformation[ 0] = 0
  ExceptionInformation[ 1] = 

CONTEXT:
  Rax= 2A6DC610340  R8 = 4
  Rbx= AAAB  R9 = 0
  Rcx= 2C9  R10= 2A6DD160138
  Rdx= 2A6D6909630  R11= C1
  Rsp= DDD3BFBF40  R12= 0
  Rbp= DDD3BFC040  E13= 2A6DECFAB00

  Rsi= A64E  R14= 3A64

  Rdi= 2000  R15= 2A6DFD9F478

  Rip= 7FF658EE36A2  EFlags = 10206

  SegCs  = 33  SegDs  = 2B

  SegSs  = 2B  SegEs  = 2B

  SegFs  = 53  SegGs  = 2B

  Dr0= 0  Dr3= 0

  Dr1= 0  Dr6= 0

  Dr2= 0  Dr7= 0


```



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


[clang] 974bda8 - [clang][bytecode] Reject constexpr-unknown pointers from Inc ops (#135548)

2025-04-13 Thread via cfe-commits

Author: Timm Baeder
Date: 2025-04-13T18:57:55+02:00
New Revision: 974bda8f61e056f90b17baa6db686c91d20ebe9d

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

LOG: [clang][bytecode] Reject constexpr-unknown pointers from Inc ops (#135548)

We used to accept c++ as a known value here, causing wrong codegen.

Added: 


Modified: 
clang/lib/AST/ByteCode/Interp.cpp
clang/lib/AST/ByteCode/Interp.h
clang/test/AST/ByteCode/codegen.cpp

Removed: 




diff  --git a/clang/lib/AST/ByteCode/Interp.cpp 
b/clang/lib/AST/ByteCode/Interp.cpp
index 0afd772c73b85..3e1f36da8925f 100644
--- a/clang/lib/AST/ByteCode/Interp.cpp
+++ b/clang/lib/AST/ByteCode/Interp.cpp
@@ -307,7 +307,7 @@ bool isConstexprUnknown(const Pointer &P) {
   if (P.isDummy())
 return false;
   const VarDecl *VD = P.block()->getDescriptor()->asVarDecl();
-  return VD && VD->hasLocalStorage();
+  return VD && VD->hasLocalStorage() && !isa(VD);
 }
 
 bool CheckBCPResult(InterpState &S, const Pointer &Ptr) {

diff  --git a/clang/lib/AST/ByteCode/Interp.h b/clang/lib/AST/ByteCode/Interp.h
index 4e84dcc8d551d..b4e15b3ffbe68 100644
--- a/clang/lib/AST/ByteCode/Interp.h
+++ b/clang/lib/AST/ByteCode/Interp.h
@@ -771,6 +771,11 @@ bool IncDecHelper(InterpState &S, CodePtr OpPC, const 
Pointer &Ptr,
   bool CanOverflow) {
   assert(!Ptr.isDummy());
 
+  if (!S.inConstantContext()) {
+if (isConstexprUnknown(Ptr))
+  return false;
+  }
+
   if constexpr (std::is_same_v) {
 if (!S.getLangOpts().CPlusPlus14)
   return Invalid(S, OpPC);

diff  --git a/clang/test/AST/ByteCode/codegen.cpp 
b/clang/test/AST/ByteCode/codegen.cpp
index ea2c812f30f6f..7c853a20362b8 100644
--- a/clang/test/AST/ByteCode/codegen.cpp
+++ b/clang/test/AST/ByteCode/codegen.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-linux -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-linux -emit-llvm -o - %s 
| FileCheck %s
 // RUN: %clang_cc1 -triple x86_64-linux -emit-llvm -o - %s 
-fexperimental-new-constant-interpreter | FileCheck %s
 
 #ifdef __SIZEOF_INT128__
@@ -95,3 +95,12 @@ void f(A *a) {
   // CHECK: call void @_ZN1AD1Ev(
   A::E e3 = A().Foo;
 }
+
+int notdead() {
+  auto l = [c=0]() mutable {
+return  c++ < 5 ? 10 : 12;
+  };
+  return l();
+}
+// CHECK: _ZZ7notdeadvEN3$_0clEv
+// CHECK: ret i32 %cond



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


[clang] [llvm] [X86][AVX10] Remove VAES and VPCLMULQDQ feature from AVX10.1 (PR #135489)

2025-04-13 Thread Phoebe Wang via cfe-commits

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


[clang] [clang-format]: Add `Custom` to `ShortFunctionStyle`; add new AllowShortFunctionsOnASingleLineOptions for granular setup (PR #134337)

2025-04-13 Thread via cfe-commits

https://github.com/irymarchyk updated 
https://github.com/llvm/llvm-project/pull/134337

>From df25a8bbfd827085265c51a44bedbf38deebbab4 Mon Sep 17 00:00:00 2001
From: Ivan Rymarchyk <>
Date: Sat, 29 Mar 2025 13:54:32 -0700
Subject: [PATCH 1/6] [clang-format]: Add `Custom` to `ShortFunctionStyle`; add
 new AllowShortFunctionsOnASingleLineOptions for granular setup
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The current clang-format configuration option AllowShortFunctionsOnASingleLine 
uses a single enum (ShortFunctionStyle) to control when short function 
definitions can be merged onto a single line. This enum provides predefined 
combinations of conditions (e.g., None, Empty only, Inline only, Inline 
including Empty, All).

This approach has limitations:

1. **Lack of Granularity:** Users cannot specify arbitrary combinations of 
conditions. For example, a user might want to allow merging for both empty 
functions and short top-level functions, but not for short functions defined 
within classes. This is not possible with the current enum options except by 
choosing All, which might merge more than desired.

2. **Inflexibility:** Adding new conditions for merging (e.g., distinguishing 
between member functions and constructors, handling lambdas specifically) would 
require adding many new combined enum values, leading to a combinatorial 
explosion and making the configuration complex.

3. **Implicit Behavior:** Some options imply others (e.g., Inline implies 
Empty), which might not always be intuitive or desired.

The goal is to replace this single-choice enum with a more flexible mechanism 
allowing users to specify a set of conditions that must be met for a short 
function to be merged onto a single line.

**Proposed Solution**

1. Introduce a new configuration option: AllowShortFunctionsOnSingleLineOptions.

2. This option will accept a list of strings, where each string represents a 
specific condition allowing merging.

3. **Backward Compatibility:**

- If AllowShortFunctionsOnSingleLineOptions is present in the 
configuration, it takes precedence.

- If AllowShortFunctionsOnSingleLineOptions is not present, but the old 
AllowShortFunctionsOnASingleLine is present, the old option should be parsed 
and mapped to the corresponding new semantics for compatibility.
---
 clang/docs/ClangFormatStyleOptions.rst  |  64 +++
 clang/include/clang/Format/Format.h |  70 
 clang/lib/Format/Format.cpp |  52 +
 clang/lib/Format/TokenAnnotator.cpp |   7 +-
 clang/lib/Format/UnwrappedLineFormatter.cpp |   9 +-
 clang/unittests/Format/ConfigParseTest.cpp  |   6 ++
 clang/unittests/Format/FormatTest.cpp   | 111 
 7 files changed, 310 insertions(+), 9 deletions(-)

diff --git a/clang/docs/ClangFormatStyleOptions.rst 
b/clang/docs/ClangFormatStyleOptions.rst
index 9ecac68ae72bf..167701cf6585d 100644
--- a/clang/docs/ClangFormatStyleOptions.rst
+++ b/clang/docs/ClangFormatStyleOptions.rst
@@ -1959,6 +1959,70 @@ the configuration (without a prefix: ``Auto``).
   };
   void f() { bar(); }
 
+  * ``SFS_Custom`` (in configuration: ``Custom``)
+Configure merge behavior using AllowShortFunctionsOnASingleLineOptions
+
+
+
+.. _AllowShortFunctionsOnASingleLineOptions:
+
+**AllowShortFunctionsOnASingleLineOptions** (``ShortFunctionMergeFlags``) 
:versionbadge:`clang-format 21` :ref:`¶ 
`
+  Precise control over merging short functions
+
+  If ``AllowShortFunctionsOnASingleLine`` is set to ``Custom``, use this to
+  specify behavior in different situations.
+
+  .. code-block:: yaml
+
+# Example of usage:
+AllowShortFunctionsOnASingleLine: Custom
+AllowShortFunctionsOnASingleLineOptions:
+  Empty: false
+  Inline: true
+  All: false
+
+  Nested configuration flags:
+
+  Precise control over merging short functions
+
+  .. code-block:: c++
+
+# Should be declared this way:
+AllowShortFunctionsOnASingleLine: Custom
+AllowShortFunctionsOnASingleLineOptions:
+  Empty: false
+  Inline: true
+  All: false
+
+  * ``bool Empty`` Only merge empty functions.
+
+.. code-block:: c++
+
+  void f() {}
+  void f2() {
+bar2();
+  }
+
+  * ``bool Inline`` Only merge functions defined inside a class.
+
+.. code-block:: c++
+
+  class Foo {
+void f() { foo(); }
+  };
+  void f() {
+foo();
+  }
+  void f() {}
+
+  * ``bool All`` Merge all functions fitting on a single line.
+
+.. code-block:: c++
+
+  class Foo {
+void f() { foo(); }
+  };
+  void f() { bar(); }
 
 
 .. _AllowShortIfStatementsOnASingleLine:
diff --git a/clang/include/clang/Format/Format.h 
b/clang/include/clang/Format/Format.h
index fec47a248abb4..96b1ecab04e63 100644
--- a/clang/include/clang/Format/Format.h
+++ b/clang/include/clang/Format/Format.h
@@ -871,6 +871,8 @@ struct FormatStyle {
 /

[clang] [clang-format]: Add `Custom` to `ShortFunctionStyle`; add new AllowShortFunctionsOnASingleLineOptions for granular setup (PR #134337)

2025-04-13 Thread via cfe-commits

irymarchyk wrote:

> We should stick to the table in [#134337 
> (comment)](https://github.com/llvm/llvm-project/pull/134337#discussion_r2028339995)
>  and deprecate `SFS_InlineOnly`, `SFS_Empty`, and `SFS_Inline`.

Thanks, I marked options as 'deprecated'. Mapping is done in Format.cpp.

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


[libunwind] [libunwind][Haiku] Fix signal frame unwinding (PR #135367)

2025-04-13 Thread via cfe-commits


@@ -3032,6 +2983,162 @@ int UnwindCursor::stepThroughSigReturn(Registers_s390x &) {
 #endif // defined(_LIBUNWIND_CHECK_LINUX_SIGRETURN) &&
// defined(_LIBUNWIND_TARGET_S390X)
 
+#if defined(_LIBUNWIND_CHECK_HAIKU_SIGRETURN)
+
+#if defined(B_HAIKU_32_BIT)
+typedef Elf32_Sym elf_sym;
+#define ELF_ST_TYPE ELF32_ST_TYPE
+#elif defined(B_HAIKU_64_BIT)
+typedef Elf64_Sym elf_sym;
+#define ELF_ST_TYPE ELF64_ST_TYPE
+#endif
+
+// Private syscall declared as a weak symbol to prevent ABI breaks.
+extern "C" status_t __attribute__((weak))
+_kern_read_kernel_image_symbols(image_id id, elf_sym *symbolTable,
+int32 *_symbolCount, char *stringTable,
+size_t *_stringTableSize, addr_t *_imageDelta);
+
+static addr_t signalHandlerBegin = 0;
+static addr_t signalHandlerEnd = 0;
+
+template 
+bool UnwindCursor::setInfoForSigReturn() {
+  if (signalHandlerBegin == 0) {
+// If we do not have the addresses yet, find them now.
+
+// Determine if the private function is there and usable.
+if (_kern_read_kernel_image_symbols == nullptr) {
+  signalHandlerBegin = (addr_t)-1;
+  return false;
+}
+
+// Get the system commpage and enumerate its symbols.
+image_id commpageImage = -1;
+image_info info;
+int32 cookie = 0;
+while (get_next_image_info(B_SYSTEM_TEAM, &cookie, &info) == B_OK) {

waddlesplash wrote:

It appears GNU libunwind does. FreeBSD at least has a similar setup to Linux 
with a different magic number.

If what's going on here is just that the signal handler trampoline and its size 
need to be found, perhaps we can make it properly enumerable by 
`dl_iterate_phdr`? That may be more work but will probably be more portable too?

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


[clang] Clang: Add elementwise minnum/maxnum builtin functions (PR #129207)

2025-04-13 Thread YunQiang Su via cfe-commits

https://github.com/wzssyqa updated 
https://github.com/llvm/llvm-project/pull/129207

>From 679f92557d62acd87bf521050db7c2aee527293a Mon Sep 17 00:00:00 2001
From: YunQiang Su 
Date: Fri, 28 Feb 2025 16:09:04 +0800
Subject: [PATCH 1/6] Clang: Add minnum/maxnum builtin functions support

With https://github.com/llvm/llvm-project/pull/112852, we claimed
that llvm.minnum and llvm.maxnum should treat +0.0>-0.0,
while libc doesn't require fmin(3)/fmax(3) for it.

To make llvm.minnum/llvm.maxnum easy to use, we define the builtin
functions for them, include
__builtin_minnum
__builtin_elementwise_minnum
__builtin_minnum
__builtin_elementwise_minnum
__builtin_minnum
__builtin_elementwise_minnum
__builtin_minnum
__builtin_maxnum
__builtin_elementwise_maxnum
__builtin_maxnum
__builtin_elementwise_maxnum
__builtin_maxnum
__builtin_elementwise_maxnum
__builtin_maxnum

All of them support _Float16, float, double, long double.
---
 clang/include/clang/Basic/Builtins.td  |  24 ++
 clang/include/clang/Sema/Sema.h|   1 +
 clang/lib/CodeGen/CGBuiltin.cpp|  26 ++
 clang/lib/Sema/SemaChecking.cpp|  45 
 clang/test/CodeGen/builtin-maxnum-minnum.c | 269 +
 5 files changed, 365 insertions(+)
 create mode 100644 clang/test/CodeGen/builtin-maxnum-minnum.c

diff --git a/clang/include/clang/Basic/Builtins.td 
b/clang/include/clang/Basic/Builtins.td
index 868e5b92acdc9..3afc4ac15b43f 100644
--- a/clang/include/clang/Basic/Builtins.td
+++ b/clang/include/clang/Basic/Builtins.td
@@ -209,6 +209,18 @@ def FmaxF16F128 : Builtin, F16F128MathTemplate {
   let Prototype = "T(T, T)";
 }
 
+def MinNum : Builtin {
+  let Spellings = ["__builtin_minnum"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const, 
CustomTypeChecking, Constexpr];
+  let Prototype = "void(...)";
+}
+
+def MaxNum : Builtin {
+  let Spellings = ["__builtin_maxnum"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const, 
CustomTypeChecking, Constexpr];
+  let Prototype = "void(...)";
+}
+
 def FminF16F128 : Builtin, F16F128MathTemplate {
   let Spellings = ["__builtin_fmin"];
   let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const, Constexpr];
@@ -1304,6 +1316,18 @@ def ElementwiseMin : Builtin {
   let Prototype = "void(...)";
 }
 
+def ElementwiseMaxNum : Builtin {
+  let Spellings = ["__builtin_elementwise_maxnum"];
+  let Attributes = [NoThrow, Const, CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def ElementwiseMinNum : Builtin {
+  let Spellings = ["__builtin_elementwise_minnum"];
+  let Attributes = [NoThrow, Const, CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
 def ElementwiseMaximum : Builtin {
   let Spellings = ["__builtin_elementwise_maximum"];
   let Attributes = [NoThrow, Const, CustomTypeChecking];
diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index 0595e3dff3bb9..06daa5304ec21 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -2597,6 +2597,7 @@ class Sema final : public SemaBase {
   ExprResult AtomicOpsOverloaded(ExprResult TheCallResult,
  AtomicExpr::AtomicOp Op);
 
+  bool BuiltinMaxNumMinNumMath(CallExpr *TheCall);
   /// \param FPOnly restricts the arguments to floating-point types.
   bool BuiltinElementwiseMath(CallExpr *TheCall,
   EltwiseBuiltinArgTyRestriction ArgTyRestr =
diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index fe55dfffc1cbe..15f6bcded5e4c 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -2629,6 +2629,16 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl 
GD, unsigned BuiltinID,
Intrinsic::minnum,

Intrinsic::experimental_constrained_minnum));
 
+case Builtin::BI__builtin_maxnum:
+  return RValue::get(emitBinaryMaybeConstrainedFPBuiltin(
+  *this, E, Intrinsic::maxnum,
+  Intrinsic::experimental_constrained_maxnum));
+
+case Builtin::BI__builtin_minnum:
+  return RValue::get(emitBinaryMaybeConstrainedFPBuiltin(
+  *this, E, Intrinsic::minnum,
+  Intrinsic::experimental_constrained_minnum));
+
 case Builtin::BIfmaximum_num:
 case Builtin::BIfmaximum_numf:
 case Builtin::BIfmaximum_numl:
@@ -3818,6 +3828,22 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl 
GD, unsigned BuiltinID,
 return RValue::get(Result);
   }
 
+  case Builtin::BI__builtin_elementwise_maxnum: {
+Value *Op0 = EmitScalarExpr(E->getArg(0));
+Value *Op1 = EmitScalarExpr(E->getArg(1));
+Value *Result = Builder.CreateBinaryIntrinsic(llvm::Intrinsic::maxnum, Op0,
+  Op1, nullptr, "elt.maxnum");
+return RValue::get(Result);
+  }
+
+  case Builtin::BI__builtin_elementwise_minnum: {
+Value 

[libunwind] [libunwind][Haiku] Fix signal frame unwinding (PR #135367)

2025-04-13 Thread Trung Nguyen via cfe-commits


@@ -3032,6 +2983,162 @@ int UnwindCursor::stepThroughSigReturn(Registers_s390x &) {
 #endif // defined(_LIBUNWIND_CHECK_LINUX_SIGRETURN) &&
// defined(_LIBUNWIND_TARGET_S390X)
 
+#if defined(_LIBUNWIND_CHECK_HAIKU_SIGRETURN)
+
+#if defined(B_HAIKU_32_BIT)
+typedef Elf32_Sym elf_sym;
+#define ELF_ST_TYPE ELF32_ST_TYPE
+#elif defined(B_HAIKU_64_BIT)
+typedef Elf64_Sym elf_sym;
+#define ELF_ST_TYPE ELF64_ST_TYPE
+#endif
+
+// Private syscall declared as a weak symbol to prevent ABI breaks.
+extern "C" status_t __attribute__((weak))
+_kern_read_kernel_image_symbols(image_id id, elf_sym *symbolTable,
+int32 *_symbolCount, char *stringTable,
+size_t *_stringTableSize, addr_t *_imageDelta);
+
+static addr_t signalHandlerBegin = 0;
+static addr_t signalHandlerEnd = 0;
+
+template 
+bool UnwindCursor::setInfoForSigReturn() {
+  if (signalHandlerBegin == 0) {
+// If we do not have the addresses yet, find them now.
+
+// Determine if the private function is there and usable.
+if (_kern_read_kernel_image_symbols == nullptr) {
+  signalHandlerBegin = (addr_t)-1;
+  return false;
+}
+
+// Get the system commpage and enumerate its symbols.
+image_id commpageImage = -1;
+image_info info;
+int32 cookie = 0;
+while (get_next_image_info(B_SYSTEM_TEAM, &cookie, &info) == B_OK) {

trungnt2910 wrote:

`dl_iterate_phdr` iterates through _program headers_, which the `commpage` does 
not seem to have.

See also:
https://github.com/haiku/haiku/blob/a1e94e45fc773750e0d106532299bf6da8d0e513/src/libs/bsd/dl_iterate_phdr.c#L43-L47

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


  1   2   3   >