Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 9 Jun 2022 18:15:07 GMT
From:      Dimitry Andric <dim@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 40bbef56c944 - stable/13 - Merge llvm-project release/14.x llvmorg-14.0.4-0-g29f1039a7285
Message-ID:  <202206091815.259IF7vJ033537@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by dim:

URL: https://cgit.FreeBSD.org/src/commit/?id=40bbef56c944dc5ebab58e1957bfecd6537ebead

commit 40bbef56c944dc5ebab58e1957bfecd6537ebead
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2022-06-04 12:30:46 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2022-06-09 18:14:08 +0000

    Merge llvm-project release/14.x llvmorg-14.0.4-0-g29f1039a7285
    
    This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
    openmp to llvmorg-14.0.4-0-g29f1039a7285, aka 14.0.4 release.
    
    PR:             261742
    MFC after:      3 days
    
    (cherry picked from commit 2a66634d1bc6d7401adafad4a3be7b9ac6bab8b3)
    
    Bump versions llvm-project release/14.x llvmorg-14.0.4-0-g29f1039a7285
    
    Somehow git rebase made this squashed commit disappear. Restore it.
    
    PR:             261742
    MFC after:      3 days
    
    (cherry picked from commit ab9d54731f43bb6befae75e9fed64da98c9ae1b4)
    
    Update rest of llvm-project build glue for 14.0.4
    
    I completely forgot about updating the generated llvm-project config
    files, which also contain version numbers, etc. Sorry for the churn.
    
    PR:             261742
    Fixes:          ab9d54731f43
    MFC after:      3 days
    
    (cherry picked from commit 809922b01004daf627ad4b8d92c7f98eb579043c)
    
    Add more old clang files to (Optional)ObsoleteFiles.inc
    
    There were a few more libclang_rt libraries added recently, but not yet
    listed in the ObsoleteFiles.inc lists.
    
    MFC after:      3 days
    
    (cherry picked from commit 5e383e360314c875fee648b386493b0dcde5c5f3)
---
 ObsoleteFiles.inc                                  |  311 ++++++
 .../clang/include/clang/AST/ASTContext.h           |    4 +-
 contrib/llvm-project/clang/lib/AST/ASTContext.cpp  |   23 +-
 .../llvm-project/clang/lib/AST/ItaniumMangle.cpp   |  280 ++---
 contrib/llvm-project/clang/lib/AST/TypePrinter.cpp |    3 +-
 .../llvm-project/clang/lib/Basic/TargetInfo.cpp    |    6 +-
 .../llvm-project/clang/lib/CodeGen/CGCUDANV.cpp    |    2 +-
 .../llvm-project/clang/lib/CodeGen/CGExprCXX.cpp   |    2 +-
 .../clang/lib/CodeGen/CodeGenModule.cpp            |   17 +-
 .../llvm-project/clang/lib/CodeGen/CodeGenModule.h |    7 +-
 .../clang/lib/Driver/ToolChains/AMDGPU.cpp         |    2 +-
 .../clang/lib/Driver/ToolChains/Ananas.cpp         |   14 +-
 .../clang/lib/Driver/ToolChains/CommonArgs.cpp     |   12 +
 .../clang/lib/Driver/ToolChains/CommonArgs.h       |    3 +
 .../clang/lib/Driver/ToolChains/Linux.cpp          |   16 +-
 .../clang/lib/Driver/ToolChains/Solaris.cpp        |   12 +-
 .../compiler-rt/lib/tsan/rtl/tsan_rtl_s390x.S      |    2 +
 .../libcxx/include/__ranges/concepts.h             |    4 -
 .../llvm-project/libcxx/include/__ranges/data.h    |    4 +-
 .../llvm-project/libcxx/include/__ranges/size.h    |    4 +-
 contrib/llvm-project/lld/ELF/Arch/AArch64.cpp      |    8 +-
 contrib/llvm-project/lld/ELF/Arch/ARM.cpp          |    8 +-
 contrib/llvm-project/lld/ELF/InputSection.cpp      |    4 +-
 contrib/llvm-project/lld/ELF/Options.td            |    1 +
 .../include/llvm/Support/AArch64TargetParser.def   |    2 +
 .../llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp   |    7 +-
 .../llvm-project/llvm/lib/MC/ELFObjectWriter.cpp   |   20 +-
 contrib/llvm-project/llvm/lib/Support/Host.cpp     |    6 +
 .../llvm/lib/Target/AArch64/AArch64.td             |   18 +
 .../llvm/lib/Target/AArch64/AArch64SchedAmpere1.td | 1136 ++++++++++++++++++++
 .../lib/Target/AArch64/AArch64SchedPredAmpere.td   |   25 +
 .../lib/Target/AArch64/AArch64SchedPredicates.td   |    2 +-
 .../llvm/lib/Target/AArch64/AArch64Subtarget.cpp   |    6 +
 .../llvm/lib/Target/AArch64/AArch64Subtarget.h     |    1 +
 .../llvm/lib/Target/AVR/AVRCallingConv.td          |    2 +
 .../llvm/lib/Target/AVR/AVRInstrInfo.td            |   28 +-
 .../SystemZ/MCTargetDesc/SystemZMCCodeEmitter.cpp  |    9 +-
 .../lib/Target/SystemZ/SystemZISelLowering.cpp     |   16 +-
 .../Transforms/InstCombine/InstCombineAndOrXor.cpp |    6 +-
 .../llvm/lib/Transforms/Scalar/SCCP.cpp            |   23 +-
 etc/mtree/BSD.debug.dist                           |    2 +-
 etc/mtree/BSD.usr.dist                             |    2 +-
 lib/clang/headers/Makefile                         |    2 +-
 lib/clang/include/VCSVersion.inc                   |    6 +-
 lib/clang/include/clang/Basic/Version.inc          |    6 +-
 lib/clang/include/clang/Config/config.h            |    2 +-
 lib/clang/include/lld/Common/Version.inc           |    2 +-
 lib/clang/include/lldb/Version/Version.inc         |    6 +-
 lib/clang/include/llvm/Config/config.h             |    4 +-
 lib/clang/include/llvm/Config/llvm-config.h        |    4 +-
 lib/clang/include/llvm/Support/VCSRevision.h       |    2 +-
 lib/libclang_rt/compiler-rt-vars.mk                |    2 +-
 tools/build/mk/OptionalObsoleteFiles.inc           |  615 +++++------
 53 files changed, 2169 insertions(+), 542 deletions(-)

diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc
index 1a9191fb6985..e9d3a7b61b7a 100644
--- a/ObsoleteFiles.inc
+++ b/ObsoleteFiles.inc
@@ -36,6 +36,317 @@
 #   xargs -n1 | sort | uniq -d;
 # done
 
+# 20220609: new clang import which bumps version from 14.0.3 to 14.0.4
+OLD_FILES+=usr/lib/clang/14.0.3/include/cuda_wrappers/algorithm
+OLD_FILES+=usr/lib/clang/14.0.3/include/cuda_wrappers/complex
+OLD_FILES+=usr/lib/clang/14.0.3/include/cuda_wrappers/new
+OLD_DIRS+=usr/lib/clang/14.0.3/include/cuda_wrappers
+OLD_FILES+=usr/lib/clang/14.0.3/include/fuzzer/FuzzedDataProvider.h
+OLD_DIRS+=usr/lib/clang/14.0.3/include/fuzzer
+OLD_FILES+=usr/lib/clang/14.0.3/include/openmp_wrappers/__clang_openmp_device_functions.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/openmp_wrappers/cmath
+OLD_FILES+=usr/lib/clang/14.0.3/include/openmp_wrappers/complex
+OLD_FILES+=usr/lib/clang/14.0.3/include/openmp_wrappers/complex.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/openmp_wrappers/complex_cmath.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/openmp_wrappers/math.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/openmp_wrappers/new
+OLD_DIRS+=usr/lib/clang/14.0.3/include/openmp_wrappers
+OLD_FILES+=usr/lib/clang/14.0.3/include/ppc_wrappers/emmintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/ppc_wrappers/mm_malloc.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/ppc_wrappers/mmintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/ppc_wrappers/pmmintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/ppc_wrappers/smmintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/ppc_wrappers/tmmintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/ppc_wrappers/xmmintrin.h
+OLD_DIRS+=usr/lib/clang/14.0.3/include/ppc_wrappers
+OLD_FILES+=usr/lib/clang/14.0.3/include/profile/InstrProfData.inc
+OLD_FILES+=usr/lib/clang/14.0.3/include/profile/MemProfData.inc
+OLD_DIRS+=usr/lib/clang/14.0.3/include/profile
+OLD_FILES+=usr/lib/clang/14.0.3/include/sanitizer/allocator_interface.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/sanitizer/asan_interface.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/sanitizer/common_interface_defs.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/sanitizer/coverage_interface.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/sanitizer/dfsan_interface.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/sanitizer/hwasan_interface.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/sanitizer/linux_syscall_hooks.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/sanitizer/lsan_interface.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/sanitizer/memprof_interface.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/sanitizer/msan_interface.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/sanitizer/netbsd_syscall_hooks.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/sanitizer/scudo_interface.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/sanitizer/tsan_interface.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/sanitizer/tsan_interface_atomic.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/sanitizer/ubsan_interface.h
+OLD_DIRS+=usr/lib/clang/14.0.3/include/sanitizer
+OLD_FILES+=usr/lib/clang/14.0.3/include/xray/xray_interface.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/xray/xray_log_interface.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/xray/xray_records.h
+OLD_DIRS+=usr/lib/clang/14.0.3/include/xray
+OLD_FILES+=usr/lib/clang/14.0.3/include/__clang_cuda_builtin_vars.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/__clang_cuda_cmath.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/__clang_cuda_complex_builtins.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/__clang_cuda_device_functions.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/__clang_cuda_intrinsics.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/__clang_cuda_libdevice_declares.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/__clang_cuda_math.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/__clang_cuda_math_forward_declares.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/__clang_cuda_runtime_wrapper.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/__clang_cuda_texture_intrinsics.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/__clang_hip_cmath.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/__clang_hip_libdevice_declares.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/__clang_hip_math.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/__clang_hip_runtime_wrapper.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/__stddef_max_align_t.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/__wmmintrin_aes.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/__wmmintrin_pclmul.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/adxintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/altivec.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/ammintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/amxintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/arm64intr.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/arm_acle.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/arm_bf16.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/arm_cde.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/arm_cmse.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/arm_fp16.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/arm_mve.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/arm_neon.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/arm_neon_sve_bridge.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/arm_sve.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/armintr.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/avx2intrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/avx512bf16intrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/avx512bitalgintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/avx512bwintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/avx512cdintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/avx512dqintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/avx512erintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/avx512fintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/avx512fp16intrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/avx512ifmaintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/avx512ifmavlintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/avx512pfintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/avx512vbmi2intrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/avx512vbmiintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/avx512vbmivlintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/avx512vlbf16intrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/avx512vlbitalgintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/avx512vlbwintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/avx512vlcdintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/avx512vldqintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/avx512vlfp16intrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/avx512vlintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/avx512vlvbmi2intrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/avx512vlvnniintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/avx512vlvp2intersectintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/avx512vnniintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/avx512vp2intersectintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/avx512vpopcntdqintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/avx512vpopcntdqvlintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/avxintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/avxvnniintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/bmi2intrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/bmiintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/builtins.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/cet.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/cetintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/cldemoteintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/clflushoptintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/clwbintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/clzerointrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/cpuid.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/crc32intrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/emmintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/enqcmdintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/f16cintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/float.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/fma4intrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/fmaintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/fxsrintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/gfniintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/hexagon_circ_brev_intrinsics.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/hexagon_protos.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/hexagon_types.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/hresetintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/htmintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/htmxlintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/hvx_hexagon_protos.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/ia32intrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/immintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/intrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/inttypes.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/invpcidintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/iso646.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/keylockerintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/limits.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/lwpintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/lzcntintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/mm3dnow.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/mm_malloc.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/mmintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/module.modulemap
+OLD_FILES+=usr/lib/clang/14.0.3/include/movdirintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/msa.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/mwaitxintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/nmmintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/omp-tools.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/omp.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/ompt.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/opencl-c-base.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/opencl-c.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/pconfigintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/pkuintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/pmmintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/popcntintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/prfchwintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/ptwriteintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/rdseedintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/riscv_vector.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/rtmintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/s390intrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/serializeintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/sgxintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/shaintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/smmintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/stdalign.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/stdarg.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/stdatomic.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/stdbool.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/stddef.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/stdint.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/stdnoreturn.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/tbmintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/tgmath.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/tmmintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/tsxldtrkintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/uintrintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/unwind.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/vadefs.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/vaesintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/varargs.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/vecintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/vpclmulqdqintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/waitpkgintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/wasm_simd128.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/wbnoinvdintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/wmmintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/x86gprintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/x86intrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/xmmintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/xopintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/xsavecintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/xsaveintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/xsaveoptintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/xsavesintrin.h
+OLD_FILES+=usr/lib/clang/14.0.3/include/xtestintrin.h
+OLD_DIRS+=usr/lib/clang/14.0.3/include
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.asan-aarch64.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.asan-aarch64.so
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.asan-arm.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.asan-arm.so
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.asan-armhf.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.asan-armhf.so
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.asan-i386.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.asan-i386.so
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.asan-preinit-aarch64.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.asan-preinit-arm.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.asan-preinit-armhf.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.asan-preinit-i386.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.asan-preinit-x86_64.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.asan-x86_64.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.asan-x86_64.so
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.asan_cxx-aarch64.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.asan_cxx-arm.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.asan_cxx-armhf.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.asan_cxx-i386.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.asan_cxx-x86_64.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.asan_static-i386.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.asan_static-x86_64.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.cfi-aarch64.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.cfi-arm.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.cfi-armhf.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.cfi-i386.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.cfi-x86_64.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.cfi_diag-aarch64.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.cfi_diag-arm.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.cfi_diag-armhf.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.cfi_diag-i386.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.cfi_diag-x86_64.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.dd-aarch64.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.dd-x86_64.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.fuzzer-aarch64.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.fuzzer-x86_64.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.fuzzer_interceptors-x86_64.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.fuzzer_no_main-aarch64.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.fuzzer_no_main-x86_64.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.msan-aarch64.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.msan-x86_64.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.msan_cxx-aarch64.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.msan_cxx-x86_64.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.profile-aarch64.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.profile-arm.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.profile-armhf.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.profile-i386.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.profile-powerpc.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.profile-powerpc64.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.profile-powerpc64le.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.profile-x86_64.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.safestack-aarch64.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.safestack-i386.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.safestack-x86_64.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.stats-aarch64.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.stats-arm.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.stats-armhf.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.stats-i386.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.stats-x86_64.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.stats_client-aarch64.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.stats_client-arm.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.stats_client-armhf.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.stats_client-i386.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.stats_client-x86_64.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.tsan-aarch64.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.tsan-x86_64.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.tsan_cxx-aarch64.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.tsan_cxx-x86_64.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.ubsan_minimal-aarch64.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.ubsan_minimal-arm.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.ubsan_minimal-armhf.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.ubsan_minimal-i386.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.ubsan_minimal-x86_64.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.ubsan_standalone-aarch64.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.ubsan_standalone-arm.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.ubsan_standalone-armhf.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.ubsan_standalone-i386.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.ubsan_standalone-x86_64.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.ubsan_standalone_cxx-aarch64.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.ubsan_standalone_cxx-arm.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.ubsan_standalone_cxx-armhf.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.ubsan_standalone_cxx-i386.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.ubsan_standalone_cxx-x86_64.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.xray-aarch64.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.xray-arm.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.xray-armhf.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.xray-basic-aarch64.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.xray-basic-arm.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.xray-basic-armhf.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.xray-basic-x86_64.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.xray-fdr-aarch64.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.xray-fdr-arm.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.xray-fdr-armhf.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.xray-fdr-x86_64.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.xray-profiling-aarch64.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.xray-profiling-arm.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.xray-profiling-armhf.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.xray-profiling-x86_64.a
+OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.xray-x86_64.a
+OLD_DIRS+=usr/lib/clang/14.0.3/lib/freebsd
+OLD_DIRS+=usr/lib/clang/14.0.3/lib
+OLD_FILES+=usr/lib/clang/14.0.3/share/asan_ignorelist.txt
+OLD_FILES+=usr/lib/clang/14.0.3/share/cfi_ignorelist.txt
+OLD_FILES+=usr/lib/clang/14.0.3/share/msan_ignorelist.txt
+OLD_DIRS+=usr/lib/clang/14.0.3/share
+OLD_DIRS+=usr/lib/clang/14.0.3
+
 # 20220607: libkqueue test updates
 OLD_FILES+=usr/tests/sys/kqueue/libkqueue/kqtest
 
diff --git a/contrib/llvm-project/clang/include/clang/AST/ASTContext.h b/contrib/llvm-project/clang/include/clang/AST/ASTContext.h
index 63c11e237d6c..1bd5d7a6c1d7 100644
--- a/contrib/llvm-project/clang/include/clang/AST/ASTContext.h
+++ b/contrib/llvm-project/clang/include/clang/AST/ASTContext.h
@@ -3279,10 +3279,10 @@ public:
   /// Return a new OMPTraitInfo object owned by this context.
   OMPTraitInfo &getNewOMPTraitInfo();
 
-  /// Whether a C++ static variable may be externalized.
+  /// Whether a C++ static variable or CUDA/HIP kernel may be externalized.
   bool mayExternalizeStaticVar(const Decl *D) const;
 
-  /// Whether a C++ static variable should be externalized.
+  /// Whether a C++ static variable or CUDA/HIP kernel should be externalized.
   bool shouldExternalizeStaticVar(const Decl *D) const;
 
   StringRef getCUIDHash() const;
diff --git a/contrib/llvm-project/clang/lib/AST/ASTContext.cpp b/contrib/llvm-project/clang/lib/AST/ASTContext.cpp
index 76c82f2e177c..e4b3827b8714 100644
--- a/contrib/llvm-project/clang/lib/AST/ASTContext.cpp
+++ b/contrib/llvm-project/clang/lib/AST/ASTContext.cpp
@@ -8551,12 +8551,11 @@ CreateAArch64ABIBuiltinVaListDecl(const ASTContext *Context) {
   RecordDecl *VaListTagDecl = Context->buildImplicitRecord("__va_list");
   if (Context->getLangOpts().CPlusPlus) {
     // namespace std { struct __va_list {
-    NamespaceDecl *NS;
-    NS = NamespaceDecl::Create(const_cast<ASTContext &>(*Context),
-                               Context->getTranslationUnitDecl(),
-                               /*Inline*/ false, SourceLocation(),
-                               SourceLocation(), &Context->Idents.get("std"),
-                               /*PrevDecl*/ nullptr);
+    auto *NS = NamespaceDecl::Create(
+        const_cast<ASTContext &>(*Context), Context->getTranslationUnitDecl(),
+        /*Inline*/ false, SourceLocation(), SourceLocation(),
+        &Context->Idents.get("std"),
+        /*PrevDecl*/ nullptr);
     NS->setImplicit();
     VaListTagDecl->setDeclContext(NS);
   }
@@ -12264,14 +12263,18 @@ bool ASTContext::mayExternalizeStaticVar(const Decl *D) const {
                              (D->hasAttr<CUDAConstantAttr>() &&
                               !D->getAttr<CUDAConstantAttr>()->isImplicit());
   // CUDA/HIP: static managed variables need to be externalized since it is
-  // a declaration in IR, therefore cannot have internal linkage.
-  return IsStaticVar &&
-         (D->hasAttr<HIPManagedAttr>() || IsExplicitDeviceVar);
+  // a declaration in IR, therefore cannot have internal linkage. Kernels in
+  // anonymous name space needs to be externalized to avoid duplicate symbols.
+  return (IsStaticVar &&
+          (D->hasAttr<HIPManagedAttr>() || IsExplicitDeviceVar)) ||
+         (D->hasAttr<CUDAGlobalAttr>() &&
+          basicGVALinkageForFunction(*this, cast<FunctionDecl>(D)) ==
+              GVA_Internal);
 }
 
 bool ASTContext::shouldExternalizeStaticVar(const Decl *D) const {
   return mayExternalizeStaticVar(D) &&
-         (D->hasAttr<HIPManagedAttr>() ||
+         (D->hasAttr<HIPManagedAttr>() || D->hasAttr<CUDAGlobalAttr>() ||
           CUDADeviceVarODRUsedByHost.count(cast<VarDecl>(D)));
 }
 
diff --git a/contrib/llvm-project/clang/lib/AST/ItaniumMangle.cpp b/contrib/llvm-project/clang/lib/AST/ItaniumMangle.cpp
index 2e734e2b28cd..68d4d1271cdb 100644
--- a/contrib/llvm-project/clang/lib/AST/ItaniumMangle.cpp
+++ b/contrib/llvm-project/clang/lib/AST/ItaniumMangle.cpp
@@ -40,65 +40,10 @@ using namespace clang;
 
 namespace {
 
-/// Retrieve the declaration context that should be used when mangling the given
-/// declaration.
-static const DeclContext *getEffectiveDeclContext(const Decl *D) {
-  // The ABI assumes that lambda closure types that occur within
-  // default arguments live in the context of the function. However, due to
-  // the way in which Clang parses and creates function declarations, this is
-  // not the case: the lambda closure type ends up living in the context
-  // where the function itself resides, because the function declaration itself
-  // had not yet been created. Fix the context here.
-  if (const CXXRecordDecl *RD = dyn_cast<CXXRecordDecl>(D)) {
-    if (RD->isLambda())
-      if (ParmVarDecl *ContextParam
-            = dyn_cast_or_null<ParmVarDecl>(RD->getLambdaContextDecl()))
-        return ContextParam->getDeclContext();
-  }
-
-  // Perform the same check for block literals.
-  if (const BlockDecl *BD = dyn_cast<BlockDecl>(D)) {
-    if (ParmVarDecl *ContextParam
-          = dyn_cast_or_null<ParmVarDecl>(BD->getBlockManglingContextDecl()))
-      return ContextParam->getDeclContext();
-  }
-
-  const DeclContext *DC = D->getDeclContext();
-  if (isa<CapturedDecl>(DC) || isa<OMPDeclareReductionDecl>(DC) ||
-      isa<OMPDeclareMapperDecl>(DC)) {
-    return getEffectiveDeclContext(cast<Decl>(DC));
-  }
-
-  if (const auto *VD = dyn_cast<VarDecl>(D))
-    if (VD->isExternC())
-      return VD->getASTContext().getTranslationUnitDecl();
-
-  if (const auto *FD = dyn_cast<FunctionDecl>(D))
-    if (FD->isExternC())
-      return FD->getASTContext().getTranslationUnitDecl();
-
-  return DC->getRedeclContext();
-}
-
-static const DeclContext *getEffectiveParentContext(const DeclContext *DC) {
-  return getEffectiveDeclContext(cast<Decl>(DC));
-}
-
 static bool isLocalContainerContext(const DeclContext *DC) {
   return isa<FunctionDecl>(DC) || isa<ObjCMethodDecl>(DC) || isa<BlockDecl>(DC);
 }
 
-static const RecordDecl *GetLocalClassDecl(const Decl *D) {
-  const DeclContext *DC = getEffectiveDeclContext(D);
-  while (!DC->isNamespace() && !DC->isTranslationUnit()) {
-    if (isLocalContainerContext(DC))
-      return dyn_cast<RecordDecl>(D);
-    D = cast<Decl>(DC);
-    DC = getEffectiveDeclContext(D);
-  }
-  return nullptr;
-}
-
 static const FunctionDecl *getStructor(const FunctionDecl *fn) {
   if (const FunctionTemplateDecl *ftd = fn->getPrimaryTemplate())
     return ftd->getTemplatedDecl();
@@ -126,6 +71,7 @@ class ItaniumMangleContextImpl : public ItaniumMangleContext {
   llvm::DenseMap<DiscriminatorKeyTy, unsigned> Discriminator;
   llvm::DenseMap<const NamedDecl*, unsigned> Uniquifier;
   const DiscriminatorOverrideTy DiscriminatorOverride = nullptr;
+  NamespaceDecl *StdNamespace = nullptr;
 
   bool NeedsUniqueInternalLinkageNames = false;
 
@@ -249,6 +195,16 @@ public:
     return DiscriminatorOverride;
   }
 
+  NamespaceDecl *getStdNamespace();
+
+  const DeclContext *getEffectiveDeclContext(const Decl *D);
+  const DeclContext *getEffectiveParentContext(const DeclContext *DC) {
+    return getEffectiveDeclContext(cast<Decl>(DC));
+  }
+
+  bool isInternalLinkageDecl(const NamedDecl *ND);
+  const DeclContext *IgnoreLinkageSpecDecls(const DeclContext *DC);
+
   /// @}
 };
 
@@ -427,6 +383,15 @@ class CXXNameMangler {
 
   ASTContext &getASTContext() const { return Context.getASTContext(); }
 
+  bool isStd(const NamespaceDecl *NS);
+  bool isStdNamespace(const DeclContext *DC);
+
+  const RecordDecl *GetLocalClassDecl(const Decl *D);
+  const DeclContext *IgnoreLinkageSpecDecls(const DeclContext *DC);
+  bool isSpecializedAs(QualType S, llvm::StringRef Name, QualType A);
+  bool isStdCharSpecialization(const ClassTemplateSpecializationDecl *SD,
+                               llvm::StringRef Name, bool HasAllocator);
+
 public:
   CXXNameMangler(ItaniumMangleContextImpl &C, raw_ostream &Out_,
                  const NamedDecl *D = nullptr, bool NullOut_ = false)
@@ -628,7 +593,71 @@ private:
 
 }
 
-static bool isInternalLinkageDecl(const NamedDecl *ND) {
+NamespaceDecl *ItaniumMangleContextImpl::getStdNamespace() {
+  if (!StdNamespace) {
+    StdNamespace = NamespaceDecl::Create(
+        getASTContext(), getASTContext().getTranslationUnitDecl(),
+        /*Inline*/ false, SourceLocation(), SourceLocation(),
+        &getASTContext().Idents.get("std"),
+        /*PrevDecl*/ nullptr);
+    StdNamespace->setImplicit();
+  }
+  return StdNamespace;
+}
+
+/// Retrieve the declaration context that should be used when mangling the given
+/// declaration.
+const DeclContext *
+ItaniumMangleContextImpl::getEffectiveDeclContext(const Decl *D) {
+  // The ABI assumes that lambda closure types that occur within
+  // default arguments live in the context of the function. However, due to
+  // the way in which Clang parses and creates function declarations, this is
+  // not the case: the lambda closure type ends up living in the context
+  // where the function itself resides, because the function declaration itself
+  // had not yet been created. Fix the context here.
+  if (const CXXRecordDecl *RD = dyn_cast<CXXRecordDecl>(D)) {
+    if (RD->isLambda())
+      if (ParmVarDecl *ContextParam =
+              dyn_cast_or_null<ParmVarDecl>(RD->getLambdaContextDecl()))
+        return ContextParam->getDeclContext();
+  }
+
+  // Perform the same check for block literals.
+  if (const BlockDecl *BD = dyn_cast<BlockDecl>(D)) {
+    if (ParmVarDecl *ContextParam =
+            dyn_cast_or_null<ParmVarDecl>(BD->getBlockManglingContextDecl()))
+      return ContextParam->getDeclContext();
+  }
+
+  // On ARM and AArch64, the va_list tag is always mangled as if in the std
+  // namespace. We do not represent va_list as actually being in the std
+  // namespace in C because this would result in incorrect debug info in C,
+  // among other things. It is important for both languages to have the same
+  // mangling in order for -fsanitize=cfi-icall to work.
+  if (D == getASTContext().getVaListTagDecl()) {
+    const llvm::Triple &T = getASTContext().getTargetInfo().getTriple();
+    if (T.isARM() || T.isThumb() || T.isAArch64())
+      return getStdNamespace();
+  }
+
+  const DeclContext *DC = D->getDeclContext();
+  if (isa<CapturedDecl>(DC) || isa<OMPDeclareReductionDecl>(DC) ||
+      isa<OMPDeclareMapperDecl>(DC)) {
+    return getEffectiveDeclContext(cast<Decl>(DC));
+  }
+
+  if (const auto *VD = dyn_cast<VarDecl>(D))
+    if (VD->isExternC())
+      return getASTContext().getTranslationUnitDecl();
+
+  if (const auto *FD = dyn_cast<FunctionDecl>(D))
+    if (FD->isExternC())
+      return getASTContext().getTranslationUnitDecl();
+
+  return DC->getRedeclContext();
+}
+
+bool ItaniumMangleContextImpl::isInternalLinkageDecl(const NamedDecl *ND) {
   if (ND && ND->getFormalLinkage() == InternalLinkage &&
       !ND->isExternallyVisible() &&
       getEffectiveDeclContext(ND)->isFileContext() &&
@@ -862,18 +891,9 @@ void CXXNameMangler::mangleFunctionEncodingBareType(const FunctionDecl *FD) {
                          MangleReturnType, FD);
 }
 
-static const DeclContext *IgnoreLinkageSpecDecls(const DeclContext *DC) {
-  while (isa<LinkageSpecDecl>(DC)) {
-    DC = getEffectiveParentContext(DC);
-  }
-
-  return DC;
-}
-
 /// Return whether a given namespace is the 'std' namespace.
-static bool isStd(const NamespaceDecl *NS) {
-  if (!IgnoreLinkageSpecDecls(getEffectiveParentContext(NS))
-                                ->isTranslationUnit())
+bool CXXNameMangler::isStd(const NamespaceDecl *NS) {
+  if (!Context.getEffectiveParentContext(NS)->isTranslationUnit())
     return false;
 
   const IdentifierInfo *II = NS->getOriginalNamespace()->getIdentifier();
@@ -882,7 +902,7 @@ static bool isStd(const NamespaceDecl *NS) {
 
 // isStdNamespace - Return whether a given decl context is a toplevel 'std'
 // namespace.
-static bool isStdNamespace(const DeclContext *DC) {
+bool CXXNameMangler::isStdNamespace(const DeclContext *DC) {
   if (!DC->isNamespace())
     return false;
 
@@ -956,6 +976,17 @@ void CXXNameMangler::mangleName(GlobalDecl GD) {
   }
 }
 
+const RecordDecl *CXXNameMangler::GetLocalClassDecl(const Decl *D) {
+  const DeclContext *DC = Context.getEffectiveDeclContext(D);
+  while (!DC->isNamespace() && !DC->isTranslationUnit()) {
+    if (isLocalContainerContext(DC))
+      return dyn_cast<RecordDecl>(D);
+    D = cast<Decl>(DC);
+    DC = Context.getEffectiveDeclContext(D);
+  }
+  return nullptr;
+}
+
 void CXXNameMangler::mangleNameWithAbiTags(GlobalDecl GD,
                                            const AbiTagList *AdditionalAbiTags) {
   const NamedDecl *ND = cast<NamedDecl>(GD.getDecl());
@@ -964,7 +995,7 @@ void CXXNameMangler::mangleNameWithAbiTags(GlobalDecl GD,
   //         ::= [<module-name>] <unscoped-template-name> <template-args>
   //         ::= <local-name>
   //
-  const DeclContext *DC = getEffectiveDeclContext(ND);
+  const DeclContext *DC = Context.getEffectiveDeclContext(ND);
 
   // If this is an extern variable declared locally, the relevant DeclContext
   // is that of the containing namespace, or the translation unit.
@@ -972,13 +1003,13 @@ void CXXNameMangler::mangleNameWithAbiTags(GlobalDecl GD,
   // a proper semantic declaration context!
   if (isLocalContainerContext(DC) && ND->hasLinkage() && !isLambda(ND))
     while (!DC->isNamespace() && !DC->isTranslationUnit())
-      DC = getEffectiveParentContext(DC);
+      DC = Context.getEffectiveParentContext(DC);
   else if (GetLocalClassDecl(ND)) {
     mangleLocalName(GD, AdditionalAbiTags);
     return;
   }
 
-  DC = IgnoreLinkageSpecDecls(DC);
+  assert(!isa<LinkageSpecDecl>(DC) && "context cannot be LinkageSpecDecl");
 
   if (isLocalContainerContext(DC)) {
     mangleLocalName(GD, AdditionalAbiTags);
@@ -1054,7 +1085,7 @@ void CXXNameMangler::mangleModuleNamePrefix(StringRef Name) {
 void CXXNameMangler::mangleTemplateName(const TemplateDecl *TD,
                                         const TemplateArgument *TemplateArgs,
                                         unsigned NumTemplateArgs) {
-  const DeclContext *DC = IgnoreLinkageSpecDecls(getEffectiveDeclContext(TD));
+  const DeclContext *DC = Context.getEffectiveDeclContext(TD);
 
   if (DC->isTranslationUnit() || isStdNamespace(DC)) {
     mangleUnscopedTemplateName(TD, nullptr);
@@ -1070,7 +1101,7 @@ void CXXNameMangler::mangleUnscopedName(GlobalDecl GD,
   //  <unscoped-name> ::= <unqualified-name>
   //                  ::= St <unqualified-name>   # ::std::
 
-  if (isStdNamespace(IgnoreLinkageSpecDecls(getEffectiveDeclContext(ND))))
+  if (isStdNamespace(Context.getEffectiveDeclContext(ND)))
     Out << "St";
 
   mangleUnqualifiedName(GD, AdditionalAbiTags);
@@ -1430,7 +1461,7 @@ void CXXNameMangler::mangleUnqualifiedName(GlobalDecl GD,
       // 12_GLOBAL__N_1 mangling is quite sufficient there, and this better
       // matches GCC anyway, because GCC does not treat anonymous namespaces as
       // implying internal linkage.
-      if (isInternalLinkageDecl(ND))
+      if (Context.isInternalLinkageDecl(ND))
         Out << 'L';
 
       auto *FD = dyn_cast<FunctionDecl>(ND);
@@ -1745,7 +1776,7 @@ void CXXNameMangler::mangleLocalName(GlobalDecl GD,
   // <discriminator> := _ <non-negative number>
   assert(isa<NamedDecl>(D) || isa<BlockDecl>(D));
   const RecordDecl *RD = GetLocalClassDecl(D);
-  const DeclContext *DC = getEffectiveDeclContext(RD ? RD : D);
+  const DeclContext *DC = Context.getEffectiveDeclContext(RD ? RD : D);
 
   Out << 'Z';
 
@@ -1798,13 +1829,13 @@ void CXXNameMangler::mangleLocalName(GlobalDecl GD,
       if (const NamedDecl *PrefixND = getClosurePrefix(BD))
         mangleClosurePrefix(PrefixND, true /*NoFunction*/);
       else
-        manglePrefix(getEffectiveDeclContext(BD), true /*NoFunction*/);
+        manglePrefix(Context.getEffectiveDeclContext(BD), true /*NoFunction*/);
       assert(!AdditionalAbiTags && "Block cannot have additional abi tags");
       mangleUnqualifiedBlock(BD);
     } else {
       const NamedDecl *ND = cast<NamedDecl>(D);
-      mangleNestedName(GD, getEffectiveDeclContext(ND), AdditionalAbiTags,
-                       true /*NoFunction*/);
+      mangleNestedName(GD, Context.getEffectiveDeclContext(ND),
+                       AdditionalAbiTags, true /*NoFunction*/);
     }
   } else if (const BlockDecl *BD = dyn_cast<BlockDecl>(D)) {
     // Mangle a block in a default parameter; see above explanation for
@@ -1843,7 +1874,7 @@ void CXXNameMangler::mangleBlockForPrefix(const BlockDecl *Block) {
     mangleLocalName(Block, /* AdditionalAbiTags */ nullptr);
     return;
   }
-  const DeclContext *DC = getEffectiveDeclContext(Block);
+  const DeclContext *DC = Context.getEffectiveDeclContext(Block);
   if (isLocalContainerContext(DC)) {
     mangleLocalName(Block, /* AdditionalAbiTags */ nullptr);
     return;
@@ -2030,7 +2061,7 @@ void CXXNameMangler::manglePrefix(const DeclContext *DC, bool NoFunction) {
   //           ::= # empty
   //           ::= <substitution>
 
-  DC = IgnoreLinkageSpecDecls(DC);
+  assert(!isa<LinkageSpecDecl>(DC) && "prefix cannot be LinkageSpecDecl");
 
   if (DC->isTranslationUnit())
     return;
@@ -2053,7 +2084,7 @@ void CXXNameMangler::manglePrefix(const DeclContext *DC, bool NoFunction) {
     mangleClosurePrefix(PrefixND, NoFunction);
     mangleUnqualifiedName(ND, nullptr);
   } else {
-    manglePrefix(getEffectiveDeclContext(ND), NoFunction);
+    manglePrefix(Context.getEffectiveDeclContext(ND), NoFunction);
     mangleUnqualifiedName(ND, nullptr);
   }
 
@@ -2107,7 +2138,7 @@ void CXXNameMangler::mangleTemplatePrefix(GlobalDecl GD,
   if (const auto *TTP = dyn_cast<TemplateTemplateParmDecl>(ND)) {
     mangleTemplateParameter(TTP->getDepth(), TTP->getIndex());
   } else {
-    manglePrefix(getEffectiveDeclContext(ND), NoFunction);
+    manglePrefix(Context.getEffectiveDeclContext(ND), NoFunction);
     if (isa<BuiltinTemplateDecl>(ND) || isa<ConceptDecl>(ND))
       mangleUnqualifiedName(GD, nullptr);
     else
@@ -2152,7 +2183,7 @@ void CXXNameMangler::mangleClosurePrefix(const NamedDecl *ND, bool NoFunction) {
     mangleTemplatePrefix(TD, NoFunction);
     mangleTemplateArgs(asTemplateName(TD), *TemplateArgs);
   } else {
-    manglePrefix(getEffectiveDeclContext(ND), NoFunction);
+    manglePrefix(Context.getEffectiveDeclContext(ND), NoFunction);
     mangleUnqualifiedName(ND, nullptr);
   }
 
@@ -5969,56 +6000,61 @@ bool CXXNameMangler::mangleSubstitution(uintptr_t Ptr) {
   return true;
 }
 
-static bool isCharType(QualType T) {
-  if (T.isNull())
+/// Returns whether S is a template specialization of std::Name with a single
+/// argument of type A.
+bool CXXNameMangler::isSpecializedAs(QualType S, llvm::StringRef Name,
+                                     QualType A) {
+  if (S.isNull())
     return false;
 
-  return T->isSpecificBuiltinType(BuiltinType::Char_S) ||
-    T->isSpecificBuiltinType(BuiltinType::Char_U);
-}
-
-/// Returns whether a given type is a template specialization of a given name
-/// with a single argument of type char.
-static bool isCharSpecialization(QualType T, const char *Name) {
-  if (T.isNull())
-    return false;
-
-  const RecordType *RT = T->getAs<RecordType>();
+  const RecordType *RT = S->getAs<RecordType>();
   if (!RT)
     return false;
 
   const ClassTemplateSpecializationDecl *SD =
     dyn_cast<ClassTemplateSpecializationDecl>(RT->getDecl());
-  if (!SD)
+  if (!SD || !SD->getIdentifier()->isStr(Name))
     return false;
 
-  if (!isStdNamespace(getEffectiveDeclContext(SD)))
+  if (!isStdNamespace(Context.getEffectiveDeclContext(SD)))
     return false;
 
   const TemplateArgumentList &TemplateArgs = SD->getTemplateArgs();
   if (TemplateArgs.size() != 1)
     return false;
 
-  if (!isCharType(TemplateArgs[0].getAsType()))
+  if (TemplateArgs[0].getAsType() != A)
     return false;
 
-  return SD->getIdentifier()->getName() == Name;
+  return true;
 }
 
-template <std::size_t StrLen>
-static bool isStreamCharSpecialization(const ClassTemplateSpecializationDecl*SD,
-                                       const char (&Str)[StrLen]) {
-  if (!SD->getIdentifier()->isStr(Str))
+/// Returns whether SD is a template specialization std::Name<char,
+/// std::char_traits<char> [, std::allocator<char>]>
+/// HasAllocator controls whether the 3rd template argument is needed.
+bool CXXNameMangler::isStdCharSpecialization(
+    const ClassTemplateSpecializationDecl *SD, llvm::StringRef Name,
+    bool HasAllocator) {
+  if (!SD->getIdentifier()->isStr(Name))
     return false;
 
   const TemplateArgumentList &TemplateArgs = SD->getTemplateArgs();
-  if (TemplateArgs.size() != 2)
+  if (TemplateArgs.size() != (HasAllocator ? 3 : 2))
+    return false;
+
+  QualType A = TemplateArgs[0].getAsType();
+  if (A.isNull())
+    return false;
+  // Plain 'char' is named Char_S or Char_U depending on the target ABI.
+  if (!A->isSpecificBuiltinType(BuiltinType::Char_S) &&
+      !A->isSpecificBuiltinType(BuiltinType::Char_U))
     return false;
 
-  if (!isCharType(TemplateArgs[0].getAsType()))
+  if (!isSpecializedAs(TemplateArgs[1].getAsType(), "char_traits", A))
     return false;
 
-  if (!isCharSpecialization(TemplateArgs[1].getAsType(), "char_traits"))
+  if (HasAllocator &&
+      !isSpecializedAs(TemplateArgs[2].getAsType(), "allocator", A))
     return false;
 
   return true;
@@ -6031,10 +6067,11 @@ bool CXXNameMangler::mangleStandardSubstitution(const NamedDecl *ND) {
       Out << "St";
       return true;
     }
+    return false;
   }
 
   if (const ClassTemplateDecl *TD = dyn_cast<ClassTemplateDecl>(ND)) {
-    if (!isStdNamespace(getEffectiveDeclContext(TD)))
+    if (!isStdNamespace(Context.getEffectiveDeclContext(TD)))
       return false;
 
     // <substitution> ::= Sa # ::std::allocator
@@ -6048,56 +6085,45 @@ bool CXXNameMangler::mangleStandardSubstitution(const NamedDecl *ND) {
       Out << "Sb";
       return true;
     }
+    return false;
   }
 
   if (const ClassTemplateSpecializationDecl *SD =
         dyn_cast<ClassTemplateSpecializationDecl>(ND)) {
-    if (!isStdNamespace(getEffectiveDeclContext(SD)))
+    if (!isStdNamespace(Context.getEffectiveDeclContext(SD)))
       return false;
 
     //    <substitution> ::= Ss # ::std::basic_string<char,
     //                            ::std::char_traits<char>,
     //                            ::std::allocator<char> >
-    if (SD->getIdentifier()->isStr("basic_string")) {
-      const TemplateArgumentList &TemplateArgs = SD->getTemplateArgs();
-
-      if (TemplateArgs.size() != 3)
-        return false;
-
-      if (!isCharType(TemplateArgs[0].getAsType()))
-        return false;
-
-      if (!isCharSpecialization(TemplateArgs[1].getAsType(), "char_traits"))
-        return false;
-
-      if (!isCharSpecialization(TemplateArgs[2].getAsType(), "allocator"))
-        return false;
-
+    if (isStdCharSpecialization(SD, "basic_string", /*HasAllocator=*/true)) {
       Out << "Ss";
       return true;
     }
 
     //    <substitution> ::= Si # ::std::basic_istream<char,
     //                            ::std::char_traits<char> >
-    if (isStreamCharSpecialization(SD, "basic_istream")) {
+    if (isStdCharSpecialization(SD, "basic_istream", /*HasAllocator=*/false)) {
       Out << "Si";
       return true;
     }
 
     //    <substitution> ::= So # ::std::basic_ostream<char,
*** 2801 LINES SKIPPED ***



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202206091815.259IF7vJ033537>