From 38d8389c38684b751ab220d495fd2dde3ea1cca5 Mon Sep 17 00:00:00 2001 From: Pavel Kosov Date: Thu, 16 Mar 2023 15:32:55 +0300 Subject: [PATCH 1/2] Reset for further merge llvm15 Signed-off-by: Pavel Kosov --- .gitee/ISSUE_TEMPLATE.en.md | 21 - .gitee/PULL_REQUEST_TEMPLATE.en.md | 4 - .github/workflows/clang-tests.yml | 43 - .github/workflows/libclang-abi-tests.yml | 151 -- .github/workflows/libclc-tests.yml | 53 - .github/workflows/lld-tests.yml | 43 - .github/workflows/lldb-tests.yml | 50 - .github/workflows/llvm-tests.yml | 178 -- .github/workflows/main-branch-sync.yml | 25 + OAT.xml | 224 -- OpenHarmonyDevelopmentGuidelines.md | 37 - README.OpenSource | 11 - README.md | 3 - README_zh.md | 74 - .../cppcoreguidelines/CMakeLists.txt | 1 + .../CppCoreGuidelinesTidyModule.cpp | 3 + .../PreferMemberInitializerCheck.cpp | 246 ++ .../PreferMemberInitializerCheck.h | 41 + .../readability/IdentifierNamingCheck.cpp | 4 - clang-tools-extra/clangd/ClangdLSPServer.cpp | 5 - clang-tools-extra/clangd/Config.h | 15 +- clang-tools-extra/clangd/ConfigCompile.cpp | 52 +- clang-tools-extra/clangd/ConfigFragment.h | 50 +- clang-tools-extra/clangd/ConfigProvider.cpp | 27 +- clang-tools-extra/clangd/ConfigProvider.h | 6 +- clang-tools-extra/clangd/ConfigYAML.cpp | 14 +- .../clangd/GlobalCompilationDatabase.cpp | 20 +- clang-tools-extra/clangd/ParsedAST.cpp | 4 +- clang-tools-extra/clangd/Protocol.cpp | 46 +- clang-tools-extra/clangd/TidyProvider.cpp | 4 +- .../clangd/quality/CompletionModel.cmake | 5 +- clang-tools-extra/clangd/refactor/Rename.cpp | 4 +- .../clangd/support/CMakeLists.txt | 1 - clang-tools-extra/clangd/support/Function.h | 2 +- clang-tools-extra/clangd/support/Path.cpp | 39 - clang-tools-extra/clangd/support/Path.h | 18 - clang-tools-extra/clangd/tool/ClangdMain.cpp | 4 +- .../clangd/unittests/CMakeLists.txt | 2 - .../clangd/unittests/ConfigCompileTests.cpp | 94 +- .../clangd/unittests/ConfigYAMLTests.cpp | 11 +- .../clangd/unittests/RenameTests.cpp | 46 - .../clangd/unittests/TidyProviderTests.cpp | 60 - .../clangd/unittests/support/PathTests.cpp | 37 - clang-tools-extra/docs/ReleaseNotes.rst | 185 +- ...reguidelines-prefer-member-initializer.rst | 103 + .../checks/readability-deleted-default.rst | 20 +- ...ize-use-default-member-init-assignment.cpp | 31 + ...izer-modernize-use-default-member-init.cpp | 30 + ...reguidelines-prefer-member-initializer.cpp | 490 ++++ .../unittests/clang-tidy/CMakeLists.txt | 2 +- clang/docs/ClangCommandLineReference.rst | 4 - clang/docs/ReleaseNotes.rst | 185 +- clang/docs/analyzer/checkers.rst | 2 - clang/include/clang/AST/ASTContext.h | 3 - clang/include/clang/AST/DeclCXX.h | 6 - clang/include/clang/AST/Mangle.h | 3 - .../clang/AST/MangleNumberingContext.h | 5 - clang/include/clang/AST/RecursiveASTVisitor.h | 12 - clang/include/clang/ASTMatchers/ASTMatchers.h | 2 +- clang/include/clang/Basic/Attr.td | 1 - clang/include/clang/Basic/CodeGenOptions.def | 3 - clang/include/clang/Basic/CodeGenOptions.h | 6 - clang/include/clang/Basic/LangOptions.def | 2 +- clang/include/clang/Basic/LangOptions.h | 2 +- clang/include/clang/Driver/Options.td | 15 +- clang/include/clang/Driver/ToolChain.h | 3 +- .../include/clang/Lex/VariadicMacroSupport.h | 10 +- clang/include/clang/Sema/Sema.h | 18 +- .../clang/StaticAnalyzer/Checkers/Checkers.td | 42 - clang/lib/AST/ASTImporter.cpp | 2 - clang/lib/AST/CXXABI.h | 5 +- clang/lib/AST/DeclCXX.cpp | 14 - clang/lib/AST/ExprConstant.cpp | 31 +- clang/lib/AST/ItaniumCXXABI.cpp | 6 - clang/lib/AST/ItaniumMangle.cpp | 346 +-- clang/lib/AST/MicrosoftCXXABI.cpp | 33 +- clang/lib/ASTMatchers/ASTMatchFinder.cpp | 48 +- clang/lib/ASTMatchers/ASTMatchersInternal.cpp | 2 +- clang/lib/Basic/ProfileList.cpp | 1 - clang/lib/Basic/TargetInfo.cpp | 3 +- clang/lib/Basic/Targets.cpp | 32 +- clang/lib/Basic/Targets/ARM.cpp | 2 +- clang/lib/Basic/Targets/OSTargets.h | 63 - clang/lib/Basic/Targets/PPC.cpp | 4 +- clang/lib/Basic/Targets/RISCV.cpp | 6 +- clang/lib/Basic/Targets/X86.cpp | 3 +- clang/lib/Basic/Targets/X86.h | 22 - clang/lib/CodeGen/ABIInfo.h | 1 - clang/lib/CodeGen/CGBuilder.h | 9 +- clang/lib/CodeGen/CGBuiltin.cpp | 5 +- clang/lib/CodeGen/CGCUDANV.cpp | 8 - clang/lib/CodeGen/CGCXX.cpp | 6 +- clang/lib/CodeGen/CGCall.cpp | 5 - clang/lib/CodeGen/CGExprAgg.cpp | 2 +- clang/lib/CodeGen/CGOpenMPRuntime.cpp | 34 +- clang/lib/CodeGen/CodeGenFunction.h | 14 +- clang/lib/CodeGen/CodeGenModule.cpp | 14 +- clang/lib/CodeGen/TargetInfo.cpp | 8 +- clang/lib/Driver/CMakeLists.txt | 1 - clang/lib/Driver/Driver.cpp | 7 +- clang/lib/Driver/SanitizerArgs.cpp | 2 +- clang/lib/Driver/ToolChain.cpp | 6 - clang/lib/Driver/ToolChains/Arch/ARM.cpp | 2 - clang/lib/Driver/ToolChains/Arch/Mips.cpp | 21 +- clang/lib/Driver/ToolChains/Arch/RISCV.cpp | 7 +- clang/lib/Driver/ToolChains/BareMetal.h | 2 +- clang/lib/Driver/ToolChains/Clang.cpp | 23 +- clang/lib/Driver/ToolChains/CommonArgs.cpp | 24 +- clang/lib/Driver/ToolChains/Gnu.cpp | 19 +- clang/lib/Driver/ToolChains/Linux.cpp | 9 + clang/lib/Driver/ToolChains/MSVC.cpp | 6 +- clang/lib/Driver/ToolChains/OHOS.cpp | 456 ---- clang/lib/Driver/ToolChains/OHOS.h | 103 - clang/lib/Driver/ToolChains/OpenBSD.cpp | 1 - clang/lib/Format/TokenAnnotator.cpp | 12 +- clang/lib/Format/UnwrappedLineFormatter.cpp | 9 +- clang/lib/Format/UnwrappedLineParser.cpp | 89 +- clang/lib/Format/UnwrappedLineParser.h | 12 +- clang/lib/Frontend/CompilerInvocation.cpp | 7 +- clang/lib/Frontend/InitPreprocessor.cpp | 4 +- clang/lib/Headers/avx512fintrin.h | 16 +- clang/lib/Headers/ppc_wrappers/xmmintrin.h | 9 +- clang/lib/Lex/Preprocessor.cpp | 8 +- clang/lib/Lex/TokenLexer.cpp | 10 +- clang/lib/Parse/ParseDecl.cpp | 3 +- clang/lib/Sema/Sema.cpp | 43 +- clang/lib/Sema/SemaChecking.cpp | 5 +- clang/lib/Sema/SemaCodeComplete.cpp | 21 +- clang/lib/Sema/SemaDecl.cpp | 91 +- clang/lib/Sema/SemaExpr.cpp | 2 +- clang/lib/Sema/SemaLambda.cpp | 10 +- clang/lib/Sema/SemaOpenMP.cpp | 23 +- clang/lib/Sema/TreeTransform.h | 7 +- clang/lib/Serialization/ASTReaderDecl.cpp | 1 - clang/lib/Serialization/ASTWriter.cpp | 1 - .../StaticAnalyzer/Checkers/CMakeLists.txt | 4 - .../Checkers/OpenHarmony/MemcpyChecker.cpp | 112 - .../OpenHarmony/PrintSensitiveInfoChecker.cpp | 304 --- .../OpenHarmony/SignalHandlerChecker.cpp | 250 -- .../OpenHarmony/UnixAPIArgsChecker.cpp | 239 -- clang/test/Analysis/memcpy_s.c | 36 - clang/test/Analysis/print-sensitive-info.c | 23 - clang/test/Analysis/signal-handler.c | 16 - clang/test/Analysis/unix-api.c | 28 +- .../CodeCompletion/function-overloads.cpp | 6 - clang/test/CodeCompletion/member-access.c | 7 - clang/test/CodeGen/X86/avx512-reduceIntrin.c | 68 +- .../CodeGen/aarch64-fix-cortex-a53-835769.c | 2 - clang/test/CodeGen/altivec.c | 3 + clang/test/CodeGen/arm64-abi-vector.c | 1 - clang/test/CodeGen/attr-mustprogress-0.c | 184 ++ clang/test/CodeGen/attr-mustprogress-0.cpp | 183 ++ ...r-mustprogress.c => attr-mustprogress-1.c} | 124 +- .../attr-mustprogress-1.cpp} | 195 +- .../builtins-bpf-preserve-field-info-4.c | 12 +- .../test/CodeGen/builtins-ppc-fpconstrained.c | 3 - clang/test/CodeGen/complex-builtins.c | 3 +- clang/test/CodeGen/complex-libcalls.c | 3 +- clang/test/CodeGen/enable_if.c | 34 +- clang/test/CodeGen/function-attributes.c | 2 +- clang/test/CodeGen/math-builtins.c | 1 - clang/test/CodeGen/matrix-type-builtins.c | 300 +-- clang/test/CodeGen/merge-functions.c | 22 - clang/test/CodeGen/ppc-xmmintrin.c | 6 +- clang/test/CodeGen/profile-filter.c | 20 +- clang/test/CodeGen/pseudo-probe-emit.c | 8 +- clang/test/CodeGenCUDA/unnamed-types.cu | 27 +- .../2009-05-04-PureConstNounwind.cpp | 8 +- .../builtin-is-constant-evaluated.cpp | 92 - clang/test/CodeGenCXX/clang-abi-compat.cpp | 99 +- .../debug-info-gline-tables-only-codeview.cpp | 2 +- clang/test/CodeGenCXX/enable_if.cpp | 2 +- clang/test/CodeGenCXX/mangle-abi-tag.cpp | 2 +- clang/test/CodeGenCXX/mangle-alignof.cpp | 25 - clang/test/CodeGenCXX/mangle-concept.cpp | 4 +- clang/test/CodeGenCXX/mangle-template.cpp | 4 +- clang/test/CodeGenCXX/mangle.cpp | 2 +- .../test/CodeGenCXX/matrix-type-builtins.cpp | 22 +- clang/test/CodeGenCXX/matrix-type.cpp | 16 +- .../CodeGenCXX/microsoft-uuidof-mangling.cpp | 42 +- clang/test/CodeGenCXX/trivial_abi.cpp | 18 - clang/test/CodeGenObjC/matrix-type-builtins.m | 4 +- clang/test/CodeGenOpenCL/sampler.cl | 12 +- .../Inputs/ohos_native_tree/llvm/bin/.keep | 0 .../llvm/include/c++/v1/.keep | 0 .../c++/a7_hard_neon-vfpv4/libc++.so | 0 .../lib/arm-liteos-ohos/c++/a7_soft/libc++.so | 0 .../c++/a7_softfp_neon-vfpv4/libc++.so | 0 .../lib/clang/x.y.z/lib/arm-liteos-ohos/.keep | 0 .../arm-liteos-ohos/a7_hard_neon-vfpv4/.keep | 0 .../a7_hard_neon-vfpv4/clang_rt.crtbegin.o | 0 .../a7_hard_neon-vfpv4/clang_rt.crtend.o | 0 .../a7_hard_neon-vfpv4/libclang_rt.builtins.a | 0 .../x.y.z/lib/arm-liteos-ohos/a7_soft/.keep | 0 .../a7_soft/clang_rt.crtbegin.o | 0 .../arm-liteos-ohos/a7_soft/clang_rt.crtend.o | 0 .../a7_soft/libclang_rt.builtins.a | 0 .../a7_softfp_neon-vfpv4/.keep | 0 .../a7_softfp_neon-vfpv4/clang_rt.crtbegin.o | 0 .../a7_softfp_neon-vfpv4/clang_rt.crtend.o | 0 .../libclang_rt.builtins.a | 0 .../lib/arm-liteos-ohos/clang_rt.crtbegin.o | 0 .../lib/arm-liteos-ohos/clang_rt.crtend.o | 0 .../arm-liteos-ohos/libclang_rt.builtins.a | 0 .../sysroot/usr/include/.keep | 0 .../sysroot/usr/include/arm-liteos-ohos/.keep | 0 .../ohos_native_tree/sysroot/usr/lib/.keep | 0 .../sysroot/usr/lib/arm-liteos-ohos/.keep | 0 .../arm-liteos-ohos/a7_hard_neon-vfpv4/.keep | 0 .../usr/lib/arm-liteos-ohos/a7_soft/.keep | 0 .../a7_softfp_neon-vfpv4/.keep | 0 clang/test/Driver/Xlinker-args.c | 2 +- clang/test/Driver/as-fno-integrated-as.c | 3 - clang/test/Driver/cl-inputs.c | 6 +- clang/test/Driver/cl-link-at-file.c | 2 +- clang/test/Driver/cl-link.c | 22 +- clang/test/Driver/fenable-merge-functions.cpp | 28 - clang/test/Driver/linux-ld.c | 14 + clang/test/Driver/mips-as.c | 10 +- clang/test/Driver/mips-integrated-as.s | 6 +- clang/test/Driver/msvc-link.c | 8 +- clang/test/Driver/ohos.c | 249 -- clang/test/Driver/ohos.cpp | 123 - clang/test/Driver/openbsd.cpp | 4 +- clang/test/Driver/ppc-f128-support-check.c | 4 +- clang/test/Driver/pseudo-probe-lto.c | 10 - clang/test/Driver/riscv-arch.c | 6 +- clang/test/Driver/sanitizer-ld.c | 8 - clang/test/Frontend/fixed_point_unary.c | 4 +- clang/test/Lexer/cxx-features.cpp | 3 +- clang/test/OpenMP/critical_codegen.cpp | 25 - clang/test/OpenMP/linking.c | 4 +- clang/test/OpenMP/master_codegen.cpp | 35 - clang/test/OpenMP/nvptx_allocate_messages.cpp | 3 +- .../nvptx_target_exceptions_messages.cpp | 1 - .../nvptx_unsupported_type_messages.cpp | 149 +- .../OpenMP/target_attribute_convergent.cpp | 13 - ..._teams_distribute_parallel_for_codegen.cpp | 4 +- ...ams_distribute_parallel_for_if_codegen.cpp | 10 +- ..._distribute_parallel_for_order_codegen.cpp | 2 +- ...s_distribute_parallel_for_simd_codegen.cpp | 2 +- ...istribute_parallel_for_simd_if_codegen.cpp | 10 +- .../test/OpenMP/teams_distribute_codegen.cpp | 2 +- .../teams_distribute_parallel_for_codegen.cpp | 2 +- ...s_distribute_parallel_for_simd_codegen.cpp | 2 +- .../OpenMP/teams_distribute_simd_codegen.cpp | 2 +- .../Preprocessor/macro_fn_comma_swallow2.c | 5 + clang/test/Preprocessor/macro_vaopt_check.cpp | 12 +- .../test/Preprocessor/macro_vaopt_expand.cpp | 4 +- clang/test/Preprocessor/ohos.c | 17 - .../test/Preprocessor/riscv-target-features.c | 18 +- clang/test/Sema/libbuiltins-ctype-powerpc64.c | 2 +- clang/test/Sema/libbuiltins-ctype-x86_64.c | 2 +- clang/test/Sema/static-assert.c | 11 - .../SemaCXX/constant-expression-cxx2a.cpp | 10 - .../test/SemaCXX/cxx2a-constexpr-dynalloc.cpp | 34 - .../SemaCXX/cxx2a-three-way-comparison.cpp | 20 +- clang/tools/scan-view/CMakeLists.txt | 1 - clang/tools/scan-view/share/Reporter.py | 183 -- .../ASTMatchers/ASTMatchersTraversalTest.cpp | 259 -- clang/unittests/CMakeLists.txt | 4 +- clang/unittests/Format/FormatTest.cpp | 135 +- clang/unittests/Sema/CodeCompleteTest.cpp | 1 - clang/www/cxx_status.html | 2 +- compiler-rt/CMakeLists.txt | 19 +- compiler-rt/cmake/Modules/AddCompilerRT.cmake | 6 +- .../cmake/Modules/CompilerRTUtils.cmake | 14 +- compiler-rt/cmake/base-config-ix.cmake | 3 - compiler-rt/cmake/config-ix.cmake | 49 +- compiler-rt/lib/asan/asan_allocator.h | 2 +- compiler-rt/lib/asan/asan_fake_stack.cpp | 2 +- compiler-rt/lib/asan/asan_internal.h | 2 +- compiler-rt/lib/asan/asan_linux.cpp | 7 +- compiler-rt/lib/asan/asan_malloc_linux.cpp | 4 +- compiler-rt/lib/asan/tests/asan_test.cpp | 4 +- compiler-rt/lib/builtins/CMakeLists.txt | 15 +- compiler-rt/lib/builtins/divtf3.c | 2 +- compiler-rt/lib/builtins/emutls.c | 4 +- compiler-rt/lib/builtins/fp_div_impl.inc | 2 +- compiler-rt/lib/builtins/int_util.h | 4 - compiler-rt/lib/cfi/CMakeLists.txt | 2 +- compiler-rt/lib/fuzzer/FuzzerInterceptors.cpp | 1 - compiler-rt/lib/hwasan/hwasan.cpp | 2 +- .../lib/hwasan/hwasan_dynamic_shadow.cpp | 2 +- compiler-rt/lib/interception/interception.h | 4 +- .../interception/interception_type_test.cpp | 4 +- compiler-rt/lib/lsan/lsan_common.h | 3 +- compiler-rt/lib/msan/tests/msan_test.cpp | 2 - .../sanitizer_common/sanitizer_allocator.cpp | 2 +- .../sanitizer_common_interceptors.inc | 6 +- .../sanitizer_common_interceptors_ioctl.inc | 11 +- .../sanitizer_common_syscalls.inc | 4 +- .../lib/sanitizer_common/sanitizer_errno.h | 3 +- .../lib/sanitizer_common/sanitizer_flags.inc | 9 +- .../sanitizer_internal_defs.h | 6 +- .../lib/sanitizer_common/sanitizer_linux.cpp | 28 +- .../lib/sanitizer_common/sanitizer_linux.h | 5 +- .../sanitizer_linux_libcdep.cpp | 8 +- .../lib/sanitizer_common/sanitizer_platform.h | 15 +- .../sanitizer_platform_interceptors.h | 23 +- .../sanitizer_platform_limits_linux.cpp | 6 +- .../sanitizer_platform_limits_posix.cpp | 45 +- .../sanitizer_platform_limits_posix.h | 33 +- .../lib/sanitizer_common/sanitizer_posix.cpp | 4 +- .../sanitizer_posix_libcdep.cpp | 16 +- .../sanitizer_common/sanitizer_stackdepot.cpp | 3 +- .../sanitizer_common/sanitizer_stackdepot.h | 3 +- .../sanitizer_stoptheworld_linux_libcdep.cpp | 12 +- .../sanitizer_symbolizer_report.cpp | 2 +- .../sanitizer_unwind_linux_libcdep.cpp | 2 +- compiler-rt/lib/scudo/scudo_flags.inc | 2 +- compiler-rt/lib/scudo/scudo_platform.h | 8 +- .../lib/ubsan/ubsan_signals_standalone.cpp | 2 +- compiler-rt/test/asan/CMakeLists.txt | 2 +- .../asan/TestCases/Linux/lit.local.cfg.py | 2 +- .../test/asan/TestCases/Linux/odr_c_test.c | 2 +- .../test/asan/TestCases/Linux/shmctl.cpp | 4 +- compiler-rt/test/asan/lit.cfg.py | 2 +- compiler-rt/test/builtins/Unit/divtf3_test.c | 5 - compiler-rt/test/lit.common.cfg.py | 72 +- compiler-rt/test/lit.common.configured.in | 1 - .../ohos_family_commands/ohos_common.py | 45 - .../ohos_family_commands/ohos_compile.py | 52 - .../ohos_family_commands/ohos_run.py | 38 - data/llvm_build.png | Bin 34465 -> 0 bytes data/one_time_setup.png | Bin 21555 -> 0 bytes libcxx/CMakeLists.txt | 16 +- libcxx/cmake/Modules/HandleLibCXXABI.cmake | 2 - libcxx/cmake/caches/FreeBSD.cmake | 9 - libcxx/cmake/config-ix.cmake | 2 - libcxx/include/CMakeLists.txt | 38 +- libcxx/include/__availability | 43 - libcxx/include/__bit_reference | 34 +- libcxx/include/__config | 3 +- libcxx/include/__locale | 23 +- libcxx/include/__threading_support | 2 +- libcxx/include/atomic | 3 - libcxx/include/bit | 2 +- libcxx/include/fstream | 6 +- libcxx/include/limits | 4 +- libcxx/include/memory | 74 +- .../android/locale_bionic.h | 6 +- .../{__support => support}/fuchsia/xlocale.h | 6 +- .../{__support => support}/ibm/limits.h | 2 +- .../ibm/locale_mgmt_aix.h | 2 +- .../{__support => support}/ibm/nanosleep.h | 0 .../{__support => support}/ibm/support.h | 2 +- .../{__support => support}/ibm/xlocale.h | 7 +- .../{__support => support}/musl/xlocale.h | 2 +- .../{__support => support}/newlib/xlocale.h | 6 +- .../{__support => support}/nuttx/xlocale.h | 6 +- .../{__support => support}/openbsd/xlocale.h | 4 +- .../solaris/floatingpoint.h | 0 .../{__support => support}/solaris/wchar.h | 0 .../{__support => support}/solaris/xlocale.h | 0 .../win32/limits_msvc_win32.h | 2 +- .../win32/locale_win32.h | 2 +- .../xlocale/__nop_locale_mgmt.h | 2 +- .../xlocale/__posix_l_fallback.h | 2 +- .../xlocale/__strtonum_fallback.h | 2 +- libcxx/include/version | 16 +- libcxx/src/CMakeLists.txt | 12 +- libcxx/src/atomic.cpp | 6 - libcxx/src/include/config_elast.h | 2 - libcxx/src/locale.cpp | 2 +- libcxx/src/support/solaris/xlocale.cpp | 2 +- libcxx/src/support/win32/locale_win32.cpp | 2 +- libcxx/src/support/win32/support.cpp | 2 +- libcxx/src/support/win32/thread_win32.cpp | 2 +- .../test/libcxx/debug/extern-templates.sh.cpp | 2 +- .../allocator_types.cxx2a.pass.cpp | 23 +- .../allocator_void.cxx2a.pass.cpp} | 28 +- .../libcxx/gdb/gdb_pretty_printer_test.py | 20 +- .../libcxx/gdb/gdb_pretty_printer_test.sh.cpp | 25 +- .../allocator_void.trivial.compile.pass.cpp | 34 - .../trivial_abi/unique_ptr_ret.pass.cpp | 4 - .../memory/trivial_abi/weak_ptr_ret.pass.cpp | 5 +- .../end.to.end/expected.pass.cpp | 2 +- .../fs.req.macros/feature_macro.pass.cpp | 30 + .../atomic.version.pass.cpp | 8 +- .../barrier.version.pass.cpp | 8 +- .../filesystem.version.pass.cpp | 48 +- .../latch.version.pass.cpp | 8 +- .../semaphore.version.pass.cpp | 8 +- .../shared_mutex.version.pass.cpp | 28 +- .../version.version.pass.cpp | 108 +- .../default.allocator/allocator.ctor.pass.cpp | 44 +- .../default.allocator/allocator.dtor.pass.cpp | 3 +- .../allocator_pointers.pass.cpp | 4 +- ...cator_types.deprecated_in_cxx17.verify.cpp | 35 +- .../allocator_types.pass.cpp | 54 +- ...llocator_types.removed_in_cxx20.verify.cpp | 11 +- ...cator_void.deprecated_in_cxx17.verify.cpp} | 18 +- .../unique_ptr_Y.pass.cpp | 90 - .../unique_ptr.pass.cpp | 88 +- .../tuple.tuple/tuple.cnstr/deduct.pass.cpp | 2 +- libcxx/utils/ci/run-buildbot | 4 +- libcxx/utils/gdb/libcxx/printers.py | 44 +- .../generate_feature_test_macro_components.py | 26 +- libcxxabi/CMakeLists.txt | 15 +- libcxxabi/src/abort_message.cpp | 4 +- libcxxabi/src/demangle/ItaniumDemangle.h | 68 +- libcxxabi/test/test_demangle.pass.cpp | 14 +- libunwind/CMakeLists.txt | 15 +- libunwind/include/libunwind.h | 12 - libunwind/src/AddressSpace.hpp | 10 +- libunwind/src/DwarfInstructions.hpp | 6 +- libunwind/src/Registers.hpp | 280 +-- libunwind/src/UnwindRegistersRestore.S | 89 +- libunwind/src/UnwindRegistersSave.S | 154 +- libunwind/src/libunwind.cpp | 4 +- lld/ELF/Config.h | 2 - lld/ELF/Driver.cpp | 46 +- lld/ELF/InputSection.cpp | 5 +- lld/ELF/LTO.cpp | 2 - lld/ELF/Options.td | 4 - lld/ELF/ScriptParser.cpp | 1 - lld/ELF/SyntheticSections.cpp | 4 +- lld/ELF/Writer.cpp | 6 +- lld/docs/ReleaseNotes.rst | 108 +- lld/test/ELF/lto/opt-level.ll | 6 +- lld/test/ELF/lto/parallel.ll | 4 +- lld/test/ELF/non-abs-reloc.s | 18 +- lld/test/ELF/version-script-weak.s | 13 - lld/test/lit.cfg.py | 4 +- lld/test/wasm/lto/parallel.ll | 4 +- lldb/CMakeLists.txt | 22 +- lldb/cmake/modules/FindPythonAndSwig.cmake | 11 - lldb/cmake/modules/LLDBConfig.cmake | 2 +- lldb/docs/man/lldb.rst | 4 +- lldb/include/lldb/Host/HostInfo.h | 3 - lldb/include/lldb/Host/MainLoop.h | 3 +- lldb/include/lldb/Host/ohos/HostInfoOHOS.h | 32 - .../lldb/Interpreter/OptionGroupPlatform.h | 5 - lldb/include/lldb/Target/ModuleCache.h | 1 - lldb/include/lldb/Target/PathMappingList.h | 17 +- lldb/include/lldb/Target/Platform.h | 7 - .../Target/ThreadPlanStepOverBreakpoint.h | 2 - .../include/lldb/Target/ThreadPlanStepRange.h | 1 - .../Python/lldbsuite/test/builders/builder.py | 17 +- .../Python/lldbsuite/test/concurrent_base.py | 2 +- .../Python/lldbsuite/test/decorators.py | 3 - .../Python/lldbsuite/test/lldbplatformutil.py | 2 - .../Python/lldbsuite/test/lldbtest.py | 107 +- .../tools/lldb-server/gdbremote_testcase.py | 8 +- .../source/Commands/CommandObjectPlatform.cpp | 7 +- lldb/source/Core/Module.cpp | 12 +- lldb/source/Core/SourceManager.cpp | 18 +- lldb/source/Expression/IRInterpreter.cpp | 90 +- lldb/source/Host/CMakeLists.txt | 7 +- lldb/source/Host/common/MainLoop.cpp | 8 +- lldb/source/Host/common/Socket.cpp | 2 +- lldb/source/Host/common/TCPSocket.cpp | 2 - lldb/source/Host/ohos/HostInfoOHOS.cpp | 94 - lldb/source/Host/posix/DomainSocket.cpp | 2 +- lldb/source/Host/posix/HostInfoPosix.cpp | 2 +- .../Host/posix/ProcessLauncherPosixFork.cpp | 2 +- .../Interpreter/OptionGroupPlatform.cpp | 14 +- .../POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp | 50 +- .../POSIX-DYLD/DynamicLoaderPOSIXDYLD.h | 3 - .../Clang/ClangUserExpression.cpp | 2 +- .../Clang/CppModuleConfiguration.cpp | 43 +- .../Clang/CppModuleConfiguration.h | 8 +- lldb/source/Plugins/Platform/CMakeLists.txt | 2 - .../Plugins/Platform/HOS/CMakeLists.txt | 4 - .../source/Plugins/Platform/HOS/HdcClient.cpp | 808 ------- lldb/source/Plugins/Platform/HOS/HdcClient.h | 138 -- .../Plugins/Platform/HOS/PlatformHOS.cpp | 500 ---- .../source/Plugins/Platform/HOS/PlatformHOS.h | 86 - .../HOS/PlatformHOSRemoteGDBServer.cpp | 244 -- .../Platform/HOS/PlatformHOSRemoteGDBServer.h | 65 - .../Plugins/Platform/Linux/PlatformLinux.cpp | 2 +- .../Plugins/Platform/OHOS/CMakeLists.txt | 13 - .../Plugins/Platform/OHOS/HdcClient.cpp | 405 ---- lldb/source/Plugins/Platform/OHOS/HdcClient.h | 93 - .../Plugins/Platform/OHOS/PlatformOHOS.cpp | 300 --- .../Plugins/Platform/OHOS/PlatformOHOS.h | 83 - .../OHOS/PlatformOHOSRemoteGDBServer.cpp | 284 --- .../OHOS/PlatformOHOSRemoteGDBServer.h | 65 - lldb/source/Plugins/Process/CMakeLists.txt | 2 +- .../Linux/NativeRegisterContextLinux_arm64.h | 5 - lldb/source/Plugins/Process/Linux/Procfs.h | 2 +- .../Process/Utility/InferiorCallPOSIX.cpp | 5 +- .../GDBRemoteCommunicationServerCommon.cpp | 14 +- lldb/source/Symbol/LineEntry.cpp | 8 +- lldb/source/Target/ModuleCache.cpp | 46 +- lldb/source/Target/PathMappingList.cpp | 90 +- lldb/source/Target/Platform.cpp | 16 +- lldb/source/Target/StopInfo.cpp | 9 +- lldb/source/Target/TargetList.cpp | 9 +- lldb/source/Target/ThreadPlanStepInRange.cpp | 12 +- .../Target/ThreadPlanStepOverBreakpoint.cpp | 55 +- lldb/source/Target/ThreadPlanStepRange.cpp | 7 - lldb/source/Utility/ArchSpec.cpp | 4 +- .../Utility/TildeExpressionResolver.cpp | 4 +- .../API/api/command-return-object/Makefile | 1 - .../thread_plan_user_breakpoint/Makefile | 8 - .../TestThreadPlanUserBreakpoint.py | 132 -- .../thread_plan_user_breakpoint/main.cpp | 11 - .../libstdcpp/list/Makefile | 2 +- .../libstdcpp/map/TestDataFormatterStdMap.py | 3 +- .../load_after_attach/Makefile | 9 - .../load_after_attach/TestLoadAfterAttach.py | 63 - .../functionalities/load_after_attach/b.cpp | 1 - .../load_after_attach/main.cpp | 45 - .../plugins/command_plugin/Makefile | 1 - lldb/test/API/lang/c/fpeval/Makefile | 3 - lldb/test/API/lang/c/fpeval/TestFPEval.py | 34 - lldb/test/API/lang/c/fpeval/main.c | 10 - .../API/python_api/target/TestTargetAPI.py | 4 - .../lldb-server/TestGdbRemoteCompletion.py | 6 +- .../TestGdbRemoteMemoryAllocation.py | 1 - .../TestPlatformProcessConnect.py | 2 +- .../TestGdbRemote_QPassSignals.py | 1 - .../thread-name/TestGdbRemoteThreadName.py | 1 - .../lldb-vscode/attach/TestVSCode_attach.py | 1 - .../runInTerminal/TestVSCode_runInTerminal.py | 35 +- lldb/tools/driver/Driver.cpp | 4 +- lldb/tools/lldb-server/CMakeLists.txt | 2 +- lldb/tools/lldb-vscode/FifoFiles.cpp | 10 +- lldb/tools/lldb-vscode/FifoFiles.h | 1 - lldb/tools/lldb-vscode/IOStream.cpp | 2 +- lldb/tools/lldb-vscode/IOStream.h | 2 - lldb/tools/lldb-vscode/RunInTerminal.cpp | 6 +- lldb/tools/lldb-vscode/VSCode.h | 2 - lldb/tools/lldb-vscode/lldb-vscode.cpp | 7 +- .../Expression/CppModuleConfigurationTest.cpp | 42 +- lldb/unittests/Target/CMakeLists.txt | 1 - lldb/unittests/Target/FindFileTest.cpp | 97 - lldb/unittests/Target/PathMappingListTest.cpp | 28 +- llvm-build/Makefile | 228 -- llvm-build/OHOS.cmake | 22 - llvm-build/README.md | 126 - llvm-build/build.py | 2091 ----------------- llvm-build/build_cpython-mingw.sh | 81 - llvm-build/build_musl.sh | 121 - llvm-build/env_prepare.sh | 113 - llvm-build/mingw.py | 277 --- llvm-build/toolchain_readme.md | 26 - llvm-build/windres.sh | 64 - llvm/CMakeLists.txt | 10 +- llvm/cmake/config-ix.cmake | 1 - llvm/cmake/unwind.h | 1 - llvm/docs/LangRef.rst | 14 +- llvm/docs/ReleaseNotes.rst | 93 +- llvm/include/llvm-c/Core.h | 24 +- llvm/include/llvm-c/ExecutionEngine.h | 3 - llvm/include/llvm-c/Orc.h | 7 +- llvm/include/llvm/ADT/Any.h | 7 +- llvm/include/llvm/ADT/Triple.h | 36 +- llvm/include/llvm/Analysis/AssumptionCache.h | 2 +- llvm/include/llvm/BinaryFormat/ELF.h | 2 - .../llvm/BinaryFormat/MinidumpConstants.def | 1 - llvm/include/llvm/Bitcode/LLVMBitCodes.h | 1 - llvm/include/llvm/CodeGen/FastISel.h | 5 +- .../llvm/CodeGen/GlobalISel/LegalizerHelper.h | 1 - llvm/include/llvm/CodeGen/MachineFrameInfo.h | 15 - llvm/include/llvm/CodeGen/MachineInstr.h | 7 - llvm/include/llvm/CodeGen/StackProtector.h | 2 - .../llvm/CodeGen/StackProtectorRetLowering.h | 57 - .../llvm/CodeGen/TargetFrameLowering.h | 29 - llvm/include/llvm/CodeGen/TargetLowering.h | 4 - llvm/include/llvm/Config/config.h.cmake | 3 - .../DWARF/DWARFAbbreviationDeclaration.h | 10 - llvm/include/llvm/Demangle/ItaniumDemangle.h | 68 +- .../include/llvm/Frontend/OpenMP/OMPKinds.def | 4 +- llvm/include/llvm/IR/Attributes.td | 3 - llvm/include/llvm/IR/Constant.h | 4 - llvm/include/llvm/IR/Function.h | 2 +- llvm/include/llvm/IR/InstrTypes.h | 3 + llvm/include/llvm/IR/Instruction.h | 7 - llvm/include/llvm/IR/IntrinsicInst.h | 8 +- llvm/include/llvm/IR/Intrinsics.td | 6 +- llvm/include/llvm/IR/IntrinsicsRISCV.td | 7 +- llvm/include/llvm/IR/MatrixBuilder.h | 4 +- llvm/include/llvm/IR/Metadata.h | 18 - llvm/include/llvm/IR/Operator.h | 5 - llvm/include/llvm/IR/PseudoProbe.h | 27 +- llvm/include/llvm/LTO/Config.h | 3 - .../llvm/Passes/StandardInstrumentations.h | 2 - llvm/include/llvm/ProfileData/ProfileCommon.h | 3 - llvm/include/llvm/ProfileData/SampleProf.h | 29 +- .../llvm/ProfileData/SampleProfReader.h | 4 - llvm/include/llvm/Support/CommandLine.h | 13 - llvm/include/llvm/Support/Host.h | 14 - llvm/include/llvm/Target/CodeGenCWrappers.h | 31 - .../Transforms/IPO/SampleContextTracker.h | 19 +- .../llvm/Transforms/IPO/SampleProfileProbe.h | 41 - llvm/include/llvm/Transforms/Utils/Cloning.h | 7 - .../Vectorize/LoopVectorizationLegality.h | 15 +- llvm/lib/Analysis/ConstantFolding.cpp | 15 +- llvm/lib/Analysis/DemandedBits.cpp | 2 +- llvm/lib/Analysis/IVDescriptors.cpp | 5 +- llvm/lib/Analysis/InstructionSimplify.cpp | 8 +- .../lib/Analysis/MemoryDependenceAnalysis.cpp | 4 +- llvm/lib/Analysis/MemorySSA.cpp | 26 + llvm/lib/Analysis/ScalarEvolution.cpp | 4 - llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp | 81 - llvm/lib/Analysis/ValueTracking.cpp | 43 +- llvm/lib/AsmParser/LLParser.cpp | 1 - llvm/lib/AsmParser/LLToken.h | 1 - llvm/lib/Bitcode/Reader/BitcodeReader.cpp | 4 - llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | 2 - llvm/lib/CodeGen/CMakeLists.txt | 1 - llvm/lib/CodeGen/CodeGenPrepare.cpp | 6 +- .../lib/CodeGen/GlobalISel/CombinerHelper.cpp | 9 +- llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp | 5 +- .../CodeGen/GlobalISel/LegalizerHelper.cpp | 49 +- .../LiveDebugValues/VarLocBasedImpl.cpp | 4 +- llvm/lib/CodeGen/LiveRangeShrink.cpp | 3 +- llvm/lib/CodeGen/LocalStackSlotAllocation.cpp | 35 +- llvm/lib/CodeGen/MachineInstr.cpp | 3 +- llvm/lib/CodeGen/PrologEpilogInserter.cpp | 231 +- llvm/lib/CodeGen/SafeStack.cpp | 3 +- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 41 +- llvm/lib/CodeGen/SelectionDAG/FastISel.cpp | 10 +- .../SelectionDAG/SelectionDAGBuilder.cpp | 5 +- .../CodeGen/SelectionDAG/SelectionDAGISel.cpp | 33 +- .../CodeGen/SelectionDAG/TargetLowering.cpp | 31 +- llvm/lib/CodeGen/StackMaps.cpp | 12 +- llvm/lib/CodeGen/StackProtector.cpp | 55 +- .../lib/CodeGen/StackProtectorRetLowering.cpp | 111 - llvm/lib/CodeGen/TargetFrameLoweringImpl.cpp | 14 - .../lib/CodeGen/TwoAddressInstructionPass.cpp | 8 +- llvm/lib/DebugInfo/DWARF/DWARFDie.cpp | 35 +- llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp | 5 - .../ExecutionEngineBindings.cpp | 3 - .../ExecutionEngine/Orc/OrcV2CBindings.cpp | 2 +- .../Orc/TargetProcess/RegisterEHFrames.cpp | 28 +- .../RuntimeDyld/RTDyldMemoryManager.cpp | 4 +- llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp | 17 +- llvm/lib/IR/Attributes.cpp | 13 +- llvm/lib/IR/AutoUpgrade.cpp | 42 - llvm/lib/IR/ConstantFold.cpp | 59 +- llvm/lib/IR/Constants.cpp | 12 - llvm/lib/IR/Core.cpp | 35 - llvm/lib/IR/Function.cpp | 3 +- llvm/lib/IR/Instruction.cpp | 14 - llvm/lib/IR/Operator.cpp | 20 +- llvm/lib/IR/PseudoProbe.cpp | 41 - llvm/lib/IR/Verifier.cpp | 7 +- llvm/lib/LTO/LTO.cpp | 2 - llvm/lib/LTO/LTOBackend.cpp | 3 - llvm/lib/MC/ELFObjectWriter.cpp | 11 - llvm/lib/Passes/PassBuilder.cpp | 6 - llvm/lib/Passes/PassRegistry.def | 1 - llvm/lib/Passes/StandardInstrumentations.cpp | 1 - .../ProfileData/Coverage/CoverageMapping.cpp | 1 + .../lib/ProfileData/ProfileSummaryBuilder.cpp | 34 - llvm/lib/ProfileData/SampleProfReader.cpp | 99 +- llvm/lib/ProfileData/SampleProfWriter.cpp | 15 +- llvm/lib/Support/AArch64TargetParser.cpp | 2 +- llvm/lib/Support/ARMTargetParser.cpp | 2 +- llvm/lib/Support/CommandLine.cpp | 25 +- llvm/lib/Support/Host.cpp | 68 +- llvm/lib/Support/Triple.cpp | 80 +- llvm/lib/Support/Windows/Path.inc | 24 +- llvm/lib/Target/AArch64/AArch64ArkGc.td | 1263 ---------- .../AArch64/AArch64ArkGcCallingConvention.td | 512 ---- llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp | 13 - .../Target/AArch64/AArch64FrameLowering.cpp | 30 - .../lib/Target/AArch64/AArch64FrameLowering.h | 15 +- .../Target/AArch64/AArch64ISelLowering.cpp | 58 +- llvm/lib/Target/AArch64/AArch64InstrInfo.td | 8 - .../Target/AArch64/AArch64RegisterInfo.cpp | 11 - .../AArch64StackProtectorRetLowering.cpp | 99 - .../AArch64StackProtectorRetLowering.h | 39 - llvm/lib/Target/AArch64/CMakeLists.txt | 8 +- .../AArch64/GISel/AArch64CallLowering.cpp | 10 +- .../GISel/AArch64InstructionSelector.cpp | 2 +- .../AArch64/MCTargetDesc/AArch64MCAsmInfo.cpp | 2 +- .../AMDGPU/AMDGPULateCodeGenPrepare.cpp | 2 +- .../Target/AMDGPU/SIShrinkInstructions.cpp | 24 +- .../Target/AMDGPU/Utils/AMDGPUPALMetadata.cpp | 4 +- llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp | 22 +- llvm/lib/Target/ARM/ARMBlockPlacement.cpp | 7 +- llvm/lib/Target/ARM/ARMISelLowering.cpp | 6 +- llvm/lib/Target/ARM/ARMLowOverheadLoops.cpp | 20 +- llvm/lib/Target/ARM/ARMSubtarget.h | 6 +- llvm/lib/Target/ARM/ARMTargetMachine.cpp | 3 +- .../Target/ARM/MVEGatherScatterLowering.cpp | 5 +- llvm/lib/Target/ARM/MVETailPredication.cpp | 4 - llvm/lib/Target/ARM/MVEVPTBlockPass.cpp | 13 +- llvm/lib/Target/BPF/BPFMIPeephole.cpp | 3 - llvm/lib/Target/BPF/BPFPreserveDIType.cpp | 9 - llvm/lib/Target/BPF/BPFTargetMachine.cpp | 6 - llvm/lib/Target/BPF/BPFTargetMachine.h | 2 - llvm/lib/Target/BPF/BPFTargetTransformInfo.h | 61 - llvm/lib/Target/BPF/BTF.def | 1 - llvm/lib/Target/BPF/BTFDebug.cpp | 62 +- llvm/lib/Target/BPF/BTFDebug.h | 11 +- llvm/lib/Target/BPF/CMakeLists.txt | 2 - llvm/lib/Target/Mips/MipsAsmPrinter.cpp | 10 +- llvm/lib/Target/Mips/MipsISelLowering.cpp | 8 - llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp | 6 - llvm/lib/Target/PowerPC/PPCFrameLowering.cpp | 365 ++- llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp | 6 - llvm/lib/Target/PowerPC/PPCISelLowering.cpp | 117 +- llvm/lib/Target/PowerPC/PPCISelLowering.h | 4 - llvm/lib/Target/PowerPC/PPCRegisterInfo.td | 43 +- .../Target/PowerPC/PPCTargetTransformInfo.cpp | 21 - .../Target/PowerPC/PPCTargetTransformInfo.h | 3 - .../Target/RISCV/AsmParser/RISCVAsmParser.cpp | 13 +- .../RISCV/MCTargetDesc/RISCVAsmBackend.h | 12 +- .../RISCV/MCTargetDesc/RISCVELFStreamer.cpp | 70 +- .../RISCV/MCTargetDesc/RISCVELFStreamer.h | 5 - .../MCTargetDesc/RISCVTargetStreamer.cpp | 12 +- .../RISCV/MCTargetDesc/RISCVTargetStreamer.h | 9 - llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp | 35 +- llvm/lib/Target/RISCV/RISCVCleanupVSETVLI.cpp | 37 +- .../Target/RISCV/RISCVExpandPseudoInsts.cpp | 11 +- llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp | 118 +- llvm/lib/Target/RISCV/RISCVISelDAGToDAG.h | 5 +- llvm/lib/Target/RISCV/RISCVISelLowering.cpp | 2 - llvm/lib/Target/RISCV/RISCVInstrFormatsV.td | 23 +- llvm/lib/Target/RISCV/RISCVInstrInfoB.td | 67 + llvm/lib/Target/RISCV/RISCVInstrInfoV.td | 116 +- .../Target/RISCV/RISCVInstrInfoVPseudos.td | 253 +- .../Target/RISCV/RISCVInstrInfoVSDPatterns.td | 6 +- .../Target/SystemZ/SystemZISelLowering.cpp | 27 +- llvm/lib/Target/VE/VE.h | 10 +- .../WebAssemblyLowerEmscriptenEHSjLj.cpp | 13 +- .../X86/Disassembler/X86Disassembler.cpp | 1 - llvm/lib/Target/X86/X86FastISel.cpp | 8 - llvm/lib/Target/X86/X86FrameLowering.cpp | 67 +- llvm/lib/Target/X86/X86FrameLowering.h | 5 - llvm/lib/Target/X86/X86ISelLowering.cpp | 16 +- llvm/lib/Target/X86/X86InstrAVX512.td | 4 +- llvm/lib/Target/X86/X86InstrCompiler.td | 11 +- llvm/lib/Target/X86/X86InstrSSE.td | 16 +- llvm/lib/Target/X86/X86RegisterInfo.cpp | 6 - llvm/lib/Transforms/Coroutines/CoroEarly.cpp | 9 - llvm/lib/Transforms/Coroutines/CoroFrame.cpp | 31 +- llvm/lib/Transforms/IPO/ConstantMerge.cpp | 2 - .../lib/Transforms/IPO/ForceFunctionAttrs.cpp | 1 - llvm/lib/Transforms/IPO/FunctionAttrs.cpp | 10 +- .../Transforms/IPO/SampleContextTracker.cpp | 118 +- llvm/lib/Transforms/IPO/SampleProfile.cpp | 713 +----- .../lib/Transforms/IPO/SampleProfileProbe.cpp | 162 +- .../InstCombine/InstCombineAndOrXor.cpp | 17 +- .../InstCombine/InstCombineCasts.cpp | 1 - .../Transforms/InstCombine/InstCombinePHI.cpp | 8 +- .../InstCombine/InstCombineSelect.cpp | 5 +- .../InstCombine/InstCombineShifts.cpp | 58 +- .../InstCombineSimplifyDemanded.cpp | 8 +- .../InstCombine/InstructionCombining.cpp | 7 +- llvm/lib/Transforms/Scalar/ADCE.cpp | 2 +- llvm/lib/Transforms/Scalar/JumpThreading.cpp | 10 - llvm/lib/Transforms/Scalar/LoopRerollPass.cpp | 6 - llvm/lib/Transforms/Scalar/LoopUnswitch.cpp | 10 +- .../Scalar/LowerConstantIntrinsics.cpp | 8 +- .../Scalar/LowerMatrixIntrinsics.cpp | 22 +- .../Scalar/RewriteStatepointsForGC.cpp | 10 - llvm/lib/Transforms/Scalar/SCCP.cpp | 7 +- llvm/lib/Transforms/Scalar/SROA.cpp | 38 +- .../lib/Transforms/Utils/AMDGPUEmitPrintf.cpp | 2 +- llvm/lib/Transforms/Utils/BuildLibCalls.cpp | 67 + llvm/lib/Transforms/Utils/CloneFunction.cpp | 8 - llvm/lib/Transforms/Utils/CodeExtractor.cpp | 1 - llvm/lib/Transforms/Utils/InlineFunction.cpp | 100 +- llvm/lib/Transforms/Utils/Local.cpp | 33 +- llvm/lib/Transforms/Utils/LoopPeel.cpp | 19 +- llvm/lib/Transforms/Utils/SimplifyCFG.cpp | 19 +- .../Vectorize/LoopVectorizationLegality.cpp | 14 +- .../Vectorize/LoopVectorizationPlanner.h | 4 - .../Transforms/Vectorize/LoopVectorize.cpp | 40 +- .../Analysis/MemorySSA/lifetime-simple.ll | 9 +- llvm/test/Bitcode/upgrade-ptr-annotation.ll | 45 - .../test/Bitcode/upgrade-ptr-annotation.ll.bc | Bin 1524 -> 0 bytes llvm/test/Bitcode/upgrade-var-annotation.ll | 15 - .../test/Bitcode/upgrade-var-annotation.ll.bc | Bin 1232 -> 0 bytes .../CodeGen/AArch64/GlobalISel/huge-switch.ll | 22 - .../AArch64/GlobalISel/legalize-fptoi.mir | 57 +- .../GlobalISel/prelegalizercombiner-br.mir | 24 - .../GlobalISel/select-vector-shift.mir | 4 +- .../CodeGen/AArch64/arm64-platform-reg.ll | 1 - llvm/test/CodeGen/AArch64/atomicrmw-O0.ll | 697 ------ llvm/test/CodeGen/AArch64/cfguard-checks.ll | 4 +- llvm/test/CodeGen/AArch64/emutls.ll | 4 - llvm/test/CodeGen/AArch64/emutls_generic.ll | 12 - llvm/test/CodeGen/AArch64/landingpad-ifcvt.ll | 2 +- llvm/test/CodeGen/AArch64/pr48188.ll | 27 - .../test/CodeGen/AArch64/reloc-specifiers.mir | 4 +- llvm/test/CodeGen/AArch64/seh_funclet_x1.ll | 2 +- .../AArch64/stack-protector-musttail.ll | 66 - .../AArch64/vecreduce-fmax-legalization.ll | 62 +- .../AArch64/vecreduce-fmin-legalization.ll | 62 +- llvm/test/CodeGen/AArch64/win64-no-uwtable.ll | 4 +- .../CodeGen/AArch64/windows-extern-weak.ll | 2 +- .../CodeGen/AArch64/wineh-try-catch-nobase.ll | 6 +- llvm/test/CodeGen/AArch64/wineh-try-catch.ll | 18 +- ...amdgpu-codegenprepare-fold-binop-select.ll | 2 +- .../shrink-instructions-illegal-fold.mir | 23 - .../ARM/Windows/stack-protector-musttail.ll | 56 - llvm/test/CodeGen/ARM/atomic-64bit.ll | 35 +- llvm/test/CodeGen/ARM/emutls.ll | 4 - llvm/test/CodeGen/ARM/emutls_generic.ll | 4 - .../machine-outliner-stack-fixup-thumb.mir | 20 +- .../CodeGen/BPF/BTF/builtin-btf-type-id-2.ll | 73 - llvm/test/CodeGen/BPF/BTF/double.ll | 58 - .../BPF/BTF/extern-var-func-weak-section.ll | 13 +- .../CodeGen/BPF/BTF/extern-var-section.ll | 9 +- .../BPF/BTF/extern-var-weak-section.ll | 9 +- llvm/test/CodeGen/BPF/BTF/float.ll | 58 - llvm/test/CodeGen/BPF/BTF/weak-global-3.ll | 86 - llvm/test/CodeGen/BPF/remove_truncate_8.ll | 41 - llvm/test/CodeGen/Mips/abiflags-2008-fp64.ll | 18 - llvm/test/CodeGen/Mips/madd-msub.ll | 76 - llvm/test/CodeGen/PowerPC/arg_promotion.ll | 108 - llvm/test/CodeGen/PowerPC/asm-template-I.ll | 19 - .../PowerPC/handle-f16-storage-type.ll | 4 - .../PowerPC/inline-asm-physical-fpr-spe.ll | 23 - .../PowerPC/inline-asm-physical-fpr.ll | 26 - llvm/test/CodeGen/PowerPC/p10-splatImm32.ll | 10 - .../PowerPC/ppc64-inlineasm-clobber.ll | 264 --- llvm/test/CodeGen/PowerPC/pr46759.ll | 46 +- llvm/test/CodeGen/PowerPC/pr48519.ll | 2 - llvm/test/CodeGen/PowerPC/pr49092.ll | 39 - llvm/test/CodeGen/PowerPC/pr49509.ll | 81 - .../PowerPC/stack-clash-prologue-nounwind.ll | 222 +- .../CodeGen/PowerPC/stack-clash-prologue.ll | 577 ++--- llvm/test/CodeGen/RISCV/attributes.ll | 8 +- llvm/test/CodeGen/RISCV/emutls.ll | 307 --- llvm/test/CodeGen/RISCV/emutls_generic.ll | 75 - llvm/test/CodeGen/RISCV/module-target-abi2.ll | 4 +- llvm/test/CodeGen/RISCV/rv32Zbp.ll | 504 ++++ llvm/test/CodeGen/RISCV/rv64Zbp.ll | 306 +++ .../CodeGen/RISCV/rvv/cleanup-vsetivli.mir | 46 - .../RISCV/rvv/rv32-vsetvli-intrinsics.ll | 3 +- .../RISCV/rvv/rv64-vsetvli-intrinsics.ll | 3 +- .../CodeGen/RISCV/rvv/vdiv-sdnode-rv32.ll | 88 +- .../CodeGen/RISCV/rvv/vdiv-sdnode-rv64.ll | 88 +- .../CodeGen/RISCV/rvv/vdivu-sdnode-rv32.ll | 88 +- .../CodeGen/RISCV/rvv/vdivu-sdnode-rv64.ll | 88 +- llvm/test/CodeGen/RISCV/rvv/vle1-rv32.ll | 94 - llvm/test/CodeGen/RISCV/rvv/vle1-rv64.ll | 94 - llvm/test/CodeGen/RISCV/rvv/vmslt-rv32.ll | 60 +- llvm/test/CodeGen/RISCV/rvv/vmslt-rv64.ll | 72 +- llvm/test/CodeGen/RISCV/rvv/vmsltu-rv32.ll | 60 +- llvm/test/CodeGen/RISCV/rvv/vmsltu-rv64.ll | 72 +- llvm/test/CodeGen/RISCV/rvv/vse1-rv32.ll | 94 - llvm/test/CodeGen/RISCV/rvv/vse1-rv64.ll | 94 - .../{rvv/vfrec7-rv32.ll => vfrece7-rv32.ll} | 300 +-- .../{rvv/vfrec7-rv64.ll => vfrece7-rv64.ll} | 300 +-- .../vfrsqrt7-rv32.ll => vfrsqrte7-rv32.ll} | 300 +-- .../vfrsqrt7-rv64.ll => vfrsqrte7-rv64.ll} | 300 +-- llvm/test/CodeGen/SystemZ/args-11.ll | 54 - llvm/test/CodeGen/SystemZ/shift-12.ll | 94 +- .../cond-vector-reduce-mve-codegen.ll | 82 +- .../LowOverheadLoops/extending-loads.ll | 44 + .../Thumb2/LowOverheadLoops/fast-fp-loops.ll | 22 + .../LowOverheadLoops/mve-tail-data-types.ll | 121 + .../CodeGen/Thumb2/LowOverheadLoops/nested.ll | 30 + .../Thumb2/LowOverheadLoops/reductions.ll | 10 + .../Thumb2/LowOverheadLoops/remat-vctp.ll | 2 +- .../LowOverheadLoops/skip-vpt-debug.mir | 330 --- .../LowOverheadLoops/tail-pred-basic.ll | 45 + .../LowOverheadLoops/tail-pred-const.ll | 40 + .../tail-pred-disabled-in-loloops.ll | 4 + .../tail-pred-intrinsic-add-sat.ll | 2 + .../tail-pred-intrinsic-fabs.ll | 1 + .../tail-pred-intrinsic-round.ll | 6 + .../tail-pred-intrinsic-sub-sat.ll | 2 + .../LowOverheadLoops/tail-pred-reduce.ll | 25 + .../LowOverheadLoops/tail-pred-widen.ll | 28 +- .../varying-outer-2d-reduction.ll | 1 + .../LowOverheadLoops/vector-arith-codegen.ll | 89 +- .../vector-reduce-mve-tail.ll | 9 + llvm/test/CodeGen/Thumb2/block-placement.mir | 4 +- llvm/test/CodeGen/Thumb2/lsll0.ll | 2 +- llvm/test/CodeGen/Thumb2/mve-fma-loops.ll | 156 +- .../CodeGen/Thumb2/mve-gather-increment.ll | 2 + .../Thumb2/mve-gather-optimisation-deep.ll | 73 +- .../Thumb2/mve-gather-scatter-optimisation.ll | 85 +- llvm/test/CodeGen/Thumb2/mve-gather-unused.ll | 38 - llvm/test/CodeGen/Thumb2/mve-phireg.ll | 2 +- llvm/test/CodeGen/Thumb2/mve-pred-xor.ll | 4 +- llvm/test/CodeGen/Thumb2/mve-selectcc.ll | 2 +- .../Thumb2/mve-tailpred-loopinvariant.ll | 145 -- .../CodeGen/Thumb2/mve-vecreduce-loops.ll | 15 + .../CodeGen/Thumb2/mve-vpt-block-debug.mir | 110 - llvm/test/CodeGen/Thumb2/mve-vqdmulh.ll | 22 +- .../WebAssembly/lower-em-exceptions.ll | 12 +- llvm/test/CodeGen/X86/emutls-pic.ll | 4 - llvm/test/CodeGen/X86/emutls-pie.ll | 8 - llvm/test/CodeGen/X86/emutls.ll | 4 - llvm/test/CodeGen/X86/emutls_generic.ll | 12 - llvm/test/CodeGen/X86/freeze.ll | 23 - llvm/test/CodeGen/X86/horizontal-shuffle-3.ll | 11 - llvm/test/CodeGen/X86/pr49162.ll | 33 - llvm/test/CodeGen/X86/pr49393.ll | 55 - llvm/test/CodeGen/X86/pr49467.ll | 27 - llvm/test/CodeGen/X86/pr49587.ll | 33 - llvm/test/CodeGen/X86/shift-double.ll | 44 +- llvm/test/CodeGen/X86/stores-merging.ll | 96 +- llvm/test/CodeGen/X86/tailcc-ssp.ll | 26 - .../X86/vector-shuffle-combining-avx.ll | 155 -- .../MIR/X86/live-debug-values-restore.mir | 2 +- llvm/test/DebugInfo/implicit-const-test2.s | 34 - llvm/test/Feature/OperandBundles/adce.ll | 4 +- llvm/test/LTO/X86/parallel.ll | 4 +- .../AArch64/{coff-separator.s => coff-gnu.s} | 2 - llvm/test/MC/AArch64/coff-relocations.s | 110 +- llvm/test/MC/Disassembler/X86/x86-64-avx.txt | 37 - llvm/test/MC/Disassembler/X86/x86-64-avx2.txt | 13 - llvm/test/MC/Disassembler/X86/x86-64.txt | 10 +- llvm/test/MC/Mips/elf-relsym.s | 10 +- llvm/test/MC/Mips/mips_lo16.s | 22 - llvm/test/MC/Mips/xgot.s | 4 +- llvm/test/MC/RISCV/attribute-arch.s | 8 +- llvm/test/MC/RISCV/rv32zbp-invalid.s | 18 + llvm/test/MC/RISCV/rv32zbp-valid.s | 12 + llvm/test/MC/RISCV/rv64zbp-invalid.s | 14 + llvm/test/MC/RISCV/rv64zbp-valid.s | 12 + llvm/test/MC/RISCV/rvv/aliases.s | 16 +- llvm/test/MC/RISCV/rvv/fothers.s | 16 +- llvm/test/MC/RISCV/rvv/invalid.s | 9 - llvm/test/MC/RISCV/rvv/load.s | 310 ++- llvm/test/MC/RISCV/rvv/store.s | 118 +- llvm/test/MC/RISCV/rvv/vsetvl.s | 18 - llvm/test/MC/RISCV/rvv/zvlsseg.s | 1680 +++++++++++++ llvm/test/MC/X86/intel-syntax-x86-64-avx.s | 4 - .../MC/X86/intel-syntax-x86-64-avx512f_vl.s | 3 - llvm/test/Transforms/ADCE/dce_pure_call.ll | 2 +- llvm/test/Transforms/ADCE/willreturn.ll | 18 - .../AArch64/expand-atomicrmw-xchg-fp.ll | 4 +- llvm/test/Transforms/BDCE/dce-pure.ll | 2 +- llvm/test/Transforms/BDCE/dead-void-ro.ll | 2 +- llvm/test/Transforms/BDCE/willreturn.ll | 18 - .../Transforms/ConstantMerge/dont-merge.ll | 12 - .../Transforms/Coroutines/coro-byval-param.ll | 127 - .../Coroutines/coro-noalias-param.ll | 40 - llvm/test/Transforms/GVN/storeinvgroup.ll | 21 - llvm/test/Transforms/GVNSink/assumption.ll | 32 - .../test/Transforms/IRCE/decrementing-loop.ll | 11 +- .../IndVarSimplify/eliminate-exit.ll | 56 - .../promote-iv-to-eliminate-casts.ll | 62 - .../Transforms/InferFunctionAttrs/annotate.ll | 42 +- llvm/test/Transforms/Inline/noalias3.ll | 35 - llvm/test/Transforms/Inline/pr50270.ll | 71 - .../Transforms/InstCombine/apint-shift.ll | 2 +- .../canonicalize-ashr-shl-to-masking.ll | 2 +- .../canonicalize-lshr-shl-to-masking.ll | 2 +- .../canonicalize-shl-lshr-to-masking.ll | 2 +- llvm/test/Transforms/InstCombine/icmp.ll | 4 +- llvm/test/Transforms/InstCombine/not-add.ll | 28 - ...nput-masking-after-truncation-variant-a.ll | 4 +- ...nput-masking-after-truncation-variant-b.ll | 4 +- ...nput-masking-after-truncation-variant-c.ll | 4 +- ...nput-masking-after-truncation-variant-d.ll | 4 +- ...nput-masking-after-truncation-variant-e.ll | 4 +- ...dant-left-shift-input-masking-variant-a.ll | 4 +- ...dant-left-shift-input-masking-variant-b.ll | 4 +- ...dant-left-shift-input-masking-variant-c.ll | 4 +- ...dant-left-shift-input-masking-variant-d.ll | 4 +- ...dant-left-shift-input-masking-variant-e.ll | 4 +- ...undant-left-shift-input-masking-pr49778.ll | 20 - .../InstCombine/select-binop-cmp.ll | 19 +- .../InstCombine/select-imm-canon.ll | 38 - .../InstCombine/select-of-bittest.ll | 6 +- .../InstCombine/shift-add-inseltpoison.ll | 12 +- llvm/test/Transforms/InstCombine/shift-add.ll | 12 +- .../Transforms/InstCombine/zext-or-icmp.ll | 66 - .../ConstProp/InsertElement-inseltpoison.ll | 2 +- .../InstSimplify/ConstProp/InsertElement.ll | 2 +- .../Transforms/InstSimplify/ConstProp/cast.ll | 4 +- .../InstSimplify/ConstProp/poison.ll | 4 +- .../InstSimplify/ConstProp/shift.ll | 24 +- .../vector-undef-elts-inseltpoison.ll | 2 +- .../ConstProp/vector-undef-elts.ll | 2 +- .../ConstProp/vscale-inseltpoison.ll | 16 +- .../InstSimplify/ConstProp/vscale.ll | 16 +- llvm/test/Transforms/InstSimplify/div.ll | 39 +- llvm/test/Transforms/InstSimplify/rem.ll | 31 +- llvm/test/Transforms/InstSimplify/select.ll | 13 - llvm/test/Transforms/InstSimplify/undef.ll | 87 +- .../JumpThreading/noalias-scope-decl.ll | 63 - .../test/Transforms/LoopReroll/extra_instr.ll | 268 --- .../peel-loop-noalias-scope-decl.ll | 149 -- .../partial-unswitch-update-memoryssa.ll | 76 - .../LoopUnswitch/partial-unswitch.ll | 36 + .../LoopVectorize/Hexagon/maximum-vf-crash.ll | 29 - .../LoopVectorize/X86/force-ifcvt.ll | 42 + .../LoopVectorize/X86/masked_load_store.ll | 48 +- .../X86/tail_folding_and_assume_safety.ll | 4 +- .../x86-interleaved-accesses-masked-group.ll | 12 +- .../LoopVectorize/if-conversion-nest.ll | 2 +- .../LoopVectorize/if-pred-non-void.ll | 2 +- .../Transforms/LoopVectorize/if-reduction.ll | 8 +- .../LoopVectorize/irregular_type.ll | 27 - llvm/test/Transforms/LoopVectorize/pr48832.ll | 40 - .../LoopVectorize/reduction-inloop-pred.ll | 4 +- .../LoopVectorize/reduction-inloop.ll | 4 +- .../Transforms/LoopVectorize/reduction-ptr.ll | 40 - .../constant-intrinsics.ll | 8 - .../strided-load-double.ll | 33 +- .../strided-store-double.ll | 33 +- llvm/test/Transforms/MemCpyOpt/lifetime.ll | 27 +- llvm/test/Transforms/OpenMP/add_attributes.ll | 6 +- .../SCCP/pr49582-iterator-invalidation.ll | 854 ------- llvm/test/Transforms/SROA/basictest.ll | 128 +- llvm/test/Transforms/SROA/phi-gep.ll | 2 +- llvm/test/Transforms/SROA/select-gep.ll | 2 +- llvm/test/Transforms/SROA/tbaa-struct2.ll | 51 - llvm/test/Transforms/SafeStack/AArch64/abi.ll | 2 - .../Transforms/SafeStack/AArch64/abi_ssp.ll | 2 - .../SafeStack/AArch64/unreachable.ll | 2 - .../Inputs/indirect-call-csspgo.prof | 10 - .../Inputs/profile-context-order.prof | 38 - .../Inputs/profile-topdown-order.prof | 36 - .../Inputs/pseudo-probe-inline.prof | 18 - .../Inputs/pseudo-probe-update.prof | 8 - .../SampleProfile/csspgo-inline-debug.ll | 166 -- .../SampleProfile/csspgo-inline-icall.ll | 63 - .../Transforms/SampleProfile/csspgo-inline.ll | 179 -- .../SampleProfile/csspgo-summary.ll | 153 -- .../SampleProfile/profile-context-order.ll | 186 -- .../profile-context-tracker-debug.ll | 25 +- .../SampleProfile/profile-context-tracker.ll | 15 +- .../SampleProfile/profile-topdown-order.ll | 179 -- .../SampleProfile/pseudo-probe-emit-inline.ll | 20 +- .../SampleProfile/pseudo-probe-emit.ll | 22 +- .../SampleProfile/pseudo-probe-inline.ll | 187 -- .../SampleProfile/pseudo-probe-instcombine.ll | 66 - .../SampleProfile/pseudo-probe-instsched.ll | 33 - .../SampleProfile/pseudo-probe-peep.ll | 30 - .../SampleProfile/pseudo-probe-profile.ll | 42 +- .../SampleProfile/pseudo-probe-twoaddr.ll | 38 - .../SampleProfile/pseudo-probe-update.ll | 45 - .../SampleProfile/pseudo-probe-verify.ll | 77 - llvm/test/Transforms/SampleProfile/remarks.ll | 4 +- .../Transforms/SimplifyCFG/poison-merge.ll | 200 -- .../Transforms/SimplifyCFG/sink-inf-loop.ll | 49 - .../X86/insert-binop-inseltpoison.ll | 4 +- .../X86/insert-binop-with-constant.ll | 42 +- .../VectorCombine/X86/insert-binop.ll | 6 +- llvm/test/Verifier/matrix-intrinsics.ll | 44 +- llvm/test/tools/gold/X86/parallel.ll | 4 +- .../tools/llvm-cov/Inputs/instrprof-comdat.h | 2 +- .../test/tools/llvm-cov/branch-c-general.test | 12 +- .../tools/llvm-cov/branch-logical-mixed.cpp | 4 +- .../tools/llvm-cov/branch-noShowBranch.test | 4 +- llvm/test/tools/llvm-cov/branch-templates.cpp | 16 +- .../tools/llvm-cov/ignore-filename-regex.test | 4 +- .../tools/llvm-dwp/X86/absolute_paths.test | 37 - .../llvm-elfabi/preserve-dates-stub.test | 4 +- .../tools/llvm-elfabi/preserve-dates-tbe.test | 4 +- .../llvm-objdump/X86/disassemble-gdtls.s | 19 - .../X86/source-interleave-no-debug-info.test | 6 +- .../X86/source-interleave-prefix.test | 9 + .../test/tools/llvm-objdump/ohos-headers.test | 16 - .../llvm-profdata/Inputs/cs-sample.proftext | 36 - .../llvm-profdata/cs-sample-profile.test | 4 - .../Inputs/inline-cs-noprobe.perfscript | 6 - .../recursion-compression-noprobe.perfbin | Bin 15352 -> 0 bytes .../recursion-compression-noprobe.perfscript | 4 - .../recursion-compression-pseudoprobe.perfbin | Bin 13584 -> 0 bytes ...cursion-compression-pseudoprobe.perfscript | 23 - .../test/tools/llvm-profgen/cs-extbinary.test | 14 - llvm/test/tools/llvm-profgen/disassemble.s | 2 +- .../tools/llvm-profgen/inline-cs-noprobe.test | 15 +- .../llvm-profgen/inline-cs-pseudoprobe.test | 19 +- .../llvm-profgen/invalid-perfscript.test | 9 - .../llvm-profgen/merge-cold-profile.test | 70 - .../llvm-profgen/noinline-cs-noprobe.test | 12 +- .../llvm-profgen/noinline-cs-pseudoprobe.test | 18 +- .../llvm-profgen/pseudoprobe-decoding.test | 2 +- .../recursion-compression-noprobe.test | 66 - .../recursion-compression-pseudoprobe.test | 170 -- llvm/test/tools/llvm-profgen/symbolize.ll | 2 +- .../llvm-readobj/ELF/program-headers.test | 222 +- .../llvm-symbolizer/output-style-inlined.test | 21 - llvm/tools/llvm-cov/CoverageSummaryInfo.cpp | 6 +- llvm/tools/llvm-cov/CoverageSummaryInfo.h | 5 - llvm/tools/llvm-dwp/llvm-dwp.cpp | 4 +- llvm/tools/llvm-exegesis/lib/X86/Target.cpp | 21 +- llvm/tools/llvm-objdump/ELFDump.cpp | 3 - llvm/tools/llvm-objdump/llvm-objdump.cpp | 30 +- llvm/tools/llvm-profdata/llvm-profdata.cpp | 2 +- llvm/tools/llvm-profgen/PerfReader.cpp | 253 +- llvm/tools/llvm-profgen/PerfReader.h | 236 +- llvm/tools/llvm-profgen/ProfileGenerator.cpp | 314 +-- llvm/tools/llvm-profgen/ProfileGenerator.h | 157 +- llvm/tools/llvm-profgen/ProfiledBinary.cpp | 76 +- llvm/tools/llvm-profgen/ProfiledBinary.h | 25 +- llvm/tools/llvm-profgen/PseudoProbe.cpp | 40 +- llvm/tools/llvm-profgen/PseudoProbe.h | 17 +- llvm/tools/llvm-profgen/llvm-profgen.cpp | 6 +- llvm/tools/llvm-readobj/ELFDumper.cpp | 2 - .../tools/llvm-symbolizer/llvm-symbolizer.cpp | 7 +- llvm/unittests/IR/ConstantsTest.cpp | 25 +- .../ProfileData/CoverageMappingTest.cpp | 2 +- llvm/unittests/Support/CommandLineTest.cpp | 22 - llvm/unittests/tools/CMakeLists.txt | 2 +- .../tools/llvm-profgen/CMakeLists.txt | 11 - .../llvm-profgen/ContextCompressionTest.cpp | 36 - llvm/utils/TableGen/IntrinsicEmitter.cpp | 4 +- .../gn/secondary/libcxx/include/BUILD.gn | 38 +- llvm/utils/gn/secondary/llvm/version.gni | 2 +- llvm/utils/lit/lit/TestingConfig.py | 1 - llvm/utils/lit/lit/__init__.py | 2 +- llvm/utils/lit/lit/llvm/config.py | 4 +- llvm/utils/release/build_llvm_package.bat | 4 +- .../include/gtest/internal/gtest-port-arch.h | 3 - .../unittest/googletest/src/gtest-port.cc | 2 +- openmp/CMakeLists.txt | 11 +- openmp/docs/ReleaseNotes.rst | 26 +- openmp/docs/design/Runtimes.rst | 5 +- .../Modules/LibomptargetGetDependencies.cmake | 4 +- .../deviceRTLs/common/src/omp_data.cu | 7 +- .../deviceRTLs/nvptx/CMakeLists.txt | 53 +- openmp/libomptarget/include/omptarget.h | 16 +- .../plugins/remote/CMakeLists.txt | 11 +- openmp/libomptarget/src/exports | 3 +- openmp/libomptarget/src/interface.cpp | 15 +- openmp/libomptarget/src/omptarget.cpp | 41 +- openmp/libomptarget/src/private.h | 4 +- .../libomptarget/test/offloading/assert.cpp | 8 - .../libomptarget/test/offloading/bug49021.cpp | 85 - .../libomptarget/test/offloading/bug49334.cpp | 148 -- openmp/runtime/CMakeLists.txt | 6 +- openmp/runtime/cmake/config-ix.cmake | 5 - openmp/runtime/src/CMakeLists.txt | 12 +- openmp/runtime/src/kmp.h | 3 +- openmp/runtime/src/kmp_config.h.cmake | 4 +- openmp/runtime/src/kmp_i18n.cpp | 3 +- openmp/runtime/src/kmp_runtime.cpp | 21 +- openmp/runtime/src/kmp_settings.cpp | 10 +- openmp/runtime/src/kmp_tasking.cpp | 3 +- openmp/runtime/test/lit.cfg | 2 +- .../capacity_mix_threads.cpp | 45 - .../hidden_helper_task/capacity_nthreads.cpp | 31 - .../tasking/hidden_helper_task/depend.cpp | 4 +- .../test/tasking/hidden_helper_task/gtid.cpp | 4 +- polly/lib/CodeGen/IslNodeBuilder.cpp | 16 +- polly/lib/CodeGen/LoopGenerators.cpp | 3 +- polly/lib/CodeGen/LoopGeneratorsGOMP.cpp | 4 +- polly/lib/CodeGen/LoopGeneratorsKMP.cpp | 24 +- polly/lib/CodeGen/PerfMonitor.cpp | 24 +- polly/lib/External/ppcg/external.c | 167 +- polly/lib/External/ppcg/print.c | 1 - 1141 files changed, 11454 insertions(+), 34980 deletions(-) delete mode 100644 .gitee/ISSUE_TEMPLATE.en.md delete mode 100644 .gitee/PULL_REQUEST_TEMPLATE.en.md delete mode 100644 .github/workflows/clang-tests.yml delete mode 100644 .github/workflows/libclang-abi-tests.yml delete mode 100644 .github/workflows/libclc-tests.yml delete mode 100644 .github/workflows/lld-tests.yml delete mode 100644 .github/workflows/lldb-tests.yml delete mode 100644 .github/workflows/llvm-tests.yml create mode 100644 .github/workflows/main-branch-sync.yml delete mode 100644 OAT.xml delete mode 100644 OpenHarmonyDevelopmentGuidelines.md delete mode 100644 README.OpenSource delete mode 100644 README_zh.md create mode 100644 clang-tools-extra/clang-tidy/cppcoreguidelines/PreferMemberInitializerCheck.cpp create mode 100644 clang-tools-extra/clang-tidy/cppcoreguidelines/PreferMemberInitializerCheck.h delete mode 100644 clang-tools-extra/clangd/support/Path.cpp delete mode 100644 clang-tools-extra/clangd/unittests/TidyProviderTests.cpp delete mode 100644 clang-tools-extra/clangd/unittests/support/PathTests.cpp create mode 100644 clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-prefer-member-initializer.rst create mode 100644 clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-prefer-member-initializer-modernize-use-default-member-init-assignment.cpp create mode 100644 clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-prefer-member-initializer-modernize-use-default-member-init.cpp create mode 100644 clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-prefer-member-initializer.cpp delete mode 100644 clang/lib/Driver/ToolChains/OHOS.cpp delete mode 100644 clang/lib/Driver/ToolChains/OHOS.h delete mode 100644 clang/lib/StaticAnalyzer/Checkers/OpenHarmony/MemcpyChecker.cpp delete mode 100644 clang/lib/StaticAnalyzer/Checkers/OpenHarmony/PrintSensitiveInfoChecker.cpp delete mode 100644 clang/lib/StaticAnalyzer/Checkers/OpenHarmony/SignalHandlerChecker.cpp delete mode 100644 clang/lib/StaticAnalyzer/Checkers/OpenHarmony/UnixAPIArgsChecker.cpp delete mode 100644 clang/test/Analysis/memcpy_s.c delete mode 100644 clang/test/Analysis/print-sensitive-info.c delete mode 100644 clang/test/Analysis/signal-handler.c create mode 100644 clang/test/CodeGen/attr-mustprogress-0.c create mode 100644 clang/test/CodeGen/attr-mustprogress-0.cpp rename clang/test/CodeGen/{attr-mustprogress.c => attr-mustprogress-1.c} (47%) rename clang/test/{CodeGenCXX/attr-mustprogress.cpp => CodeGen/attr-mustprogress-1.cpp} (43%) delete mode 100644 clang/test/CodeGen/merge-functions.c delete mode 100644 clang/test/CodeGenCXX/mangle-alignof.cpp delete mode 100644 clang/test/Driver/Inputs/ohos_native_tree/llvm/bin/.keep delete mode 100644 clang/test/Driver/Inputs/ohos_native_tree/llvm/include/c++/v1/.keep delete mode 100644 clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/arm-liteos-ohos/c++/a7_hard_neon-vfpv4/libc++.so delete mode 100644 clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/arm-liteos-ohos/c++/a7_soft/libc++.so delete mode 100644 clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/arm-liteos-ohos/c++/a7_softfp_neon-vfpv4/libc++.so delete mode 100644 clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/.keep delete mode 100644 clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_hard_neon-vfpv4/.keep delete mode 100644 clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_hard_neon-vfpv4/clang_rt.crtbegin.o delete mode 100644 clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_hard_neon-vfpv4/clang_rt.crtend.o delete mode 100644 clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_hard_neon-vfpv4/libclang_rt.builtins.a delete mode 100644 clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_soft/.keep delete mode 100644 clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_soft/clang_rt.crtbegin.o delete mode 100644 clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_soft/clang_rt.crtend.o delete mode 100644 clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_soft/libclang_rt.builtins.a delete mode 100644 clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_softfp_neon-vfpv4/.keep delete mode 100644 clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_softfp_neon-vfpv4/clang_rt.crtbegin.o delete mode 100644 clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_softfp_neon-vfpv4/clang_rt.crtend.o delete mode 100644 clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_softfp_neon-vfpv4/libclang_rt.builtins.a delete mode 100644 clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/clang_rt.crtbegin.o delete mode 100644 clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/clang_rt.crtend.o delete mode 100644 clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/libclang_rt.builtins.a delete mode 100644 clang/test/Driver/Inputs/ohos_native_tree/sysroot/usr/include/.keep delete mode 100644 clang/test/Driver/Inputs/ohos_native_tree/sysroot/usr/include/arm-liteos-ohos/.keep delete mode 100644 clang/test/Driver/Inputs/ohos_native_tree/sysroot/usr/lib/.keep delete mode 100644 clang/test/Driver/Inputs/ohos_native_tree/sysroot/usr/lib/arm-liteos-ohos/.keep delete mode 100644 clang/test/Driver/Inputs/ohos_native_tree/sysroot/usr/lib/arm-liteos-ohos/a7_hard_neon-vfpv4/.keep delete mode 100644 clang/test/Driver/Inputs/ohos_native_tree/sysroot/usr/lib/arm-liteos-ohos/a7_soft/.keep delete mode 100644 clang/test/Driver/Inputs/ohos_native_tree/sysroot/usr/lib/arm-liteos-ohos/a7_softfp_neon-vfpv4/.keep delete mode 100644 clang/test/Driver/as-fno-integrated-as.c delete mode 100644 clang/test/Driver/fenable-merge-functions.cpp delete mode 100644 clang/test/Driver/ohos.c delete mode 100644 clang/test/Driver/ohos.cpp delete mode 100644 clang/test/Driver/pseudo-probe-lto.c delete mode 100644 clang/test/OpenMP/target_attribute_convergent.cpp delete mode 100644 clang/test/Preprocessor/ohos.c delete mode 100644 clang/tools/scan-view/share/Reporter.py delete mode 100755 compiler-rt/test/sanitizer_common/ohos_family_commands/ohos_common.py delete mode 100755 compiler-rt/test/sanitizer_common/ohos_family_commands/ohos_compile.py delete mode 100755 compiler-rt/test/sanitizer_common/ohos_family_commands/ohos_run.py delete mode 100644 data/llvm_build.png delete mode 100644 data/one_time_setup.png delete mode 100644 libcxx/cmake/caches/FreeBSD.cmake rename libcxx/include/{__support => support}/android/locale_bionic.h (90%) rename libcxx/include/{__support => support}/fuchsia/xlocale.h (74%) rename libcxx/include/{__support => support}/ibm/limits.h (97%) rename libcxx/include/{__support => support}/ibm/locale_mgmt_aix.h (96%) rename libcxx/include/{__support => support}/ibm/nanosleep.h (100%) rename libcxx/include/{__support => support}/ibm/support.h (95%) rename libcxx/include/{__support => support}/ibm/xlocale.h (97%) rename libcxx/include/{__support => support}/musl/xlocale.h (95%) rename libcxx/include/{__support => support}/newlib/xlocale.h (82%) rename libcxx/include/{__support => support}/nuttx/xlocale.h (70%) rename libcxx/include/{__support => support}/openbsd/xlocale.h (78%) rename libcxx/include/{__support => support}/solaris/floatingpoint.h (100%) rename libcxx/include/{__support => support}/solaris/wchar.h (100%) rename libcxx/include/{__support => support}/solaris/xlocale.h (100%) rename libcxx/include/{__support => support}/win32/limits_msvc_win32.h (96%) rename libcxx/include/{__support => support}/win32/locale_win32.h (99%) rename libcxx/include/{__support => support}/xlocale/__nop_locale_mgmt.h (94%) rename libcxx/include/{__support => support}/xlocale/__posix_l_fallback.h (98%) rename libcxx/include/{__support => support}/xlocale/__strtonum_fallback.h (96%) rename libcxx/test/{std/utilities/memory/default.allocator/allocator_types.void.compile.pass.cpp => libcxx/depr/depr.default.allocator/allocator_void.cxx2a.pass.cpp} (51%) delete mode 100644 libcxx/test/libcxx/memory/allocator_void.trivial.compile.pass.cpp create mode 100644 libcxx/test/std/input.output/filesystems/fs.req.macros/feature_macro.pass.cpp rename libcxx/test/std/utilities/memory/default.allocator/{PR50299.compile.pass.cpp => allocator_void.deprecated_in_cxx17.verify.cpp} (45%) delete mode 100644 lldb/include/lldb/Host/ohos/HostInfoOHOS.h delete mode 100644 lldb/source/Host/ohos/HostInfoOHOS.cpp delete mode 100644 lldb/source/Plugins/Platform/HOS/CMakeLists.txt delete mode 100644 lldb/source/Plugins/Platform/HOS/HdcClient.cpp delete mode 100644 lldb/source/Plugins/Platform/HOS/HdcClient.h delete mode 100644 lldb/source/Plugins/Platform/HOS/PlatformHOS.cpp delete mode 100644 lldb/source/Plugins/Platform/HOS/PlatformHOS.h delete mode 100644 lldb/source/Plugins/Platform/HOS/PlatformHOSRemoteGDBServer.cpp delete mode 100644 lldb/source/Plugins/Platform/HOS/PlatformHOSRemoteGDBServer.h delete mode 100644 lldb/source/Plugins/Platform/OHOS/CMakeLists.txt delete mode 100644 lldb/source/Plugins/Platform/OHOS/HdcClient.cpp delete mode 100644 lldb/source/Plugins/Platform/OHOS/HdcClient.h delete mode 100644 lldb/source/Plugins/Platform/OHOS/PlatformOHOS.cpp delete mode 100644 lldb/source/Plugins/Platform/OHOS/PlatformOHOS.h delete mode 100644 lldb/source/Plugins/Platform/OHOS/PlatformOHOSRemoteGDBServer.cpp delete mode 100644 lldb/source/Plugins/Platform/OHOS/PlatformOHOSRemoteGDBServer.h delete mode 100644 lldb/test/API/functionalities/breakpoint/thread_plan_user_breakpoint/Makefile delete mode 100644 lldb/test/API/functionalities/breakpoint/thread_plan_user_breakpoint/TestThreadPlanUserBreakpoint.py delete mode 100644 lldb/test/API/functionalities/breakpoint/thread_plan_user_breakpoint/main.cpp delete mode 100644 lldb/test/API/functionalities/load_after_attach/Makefile delete mode 100644 lldb/test/API/functionalities/load_after_attach/TestLoadAfterAttach.py delete mode 100644 lldb/test/API/functionalities/load_after_attach/b.cpp delete mode 100644 lldb/test/API/functionalities/load_after_attach/main.cpp delete mode 100644 lldb/test/API/lang/c/fpeval/Makefile delete mode 100644 lldb/test/API/lang/c/fpeval/TestFPEval.py delete mode 100644 lldb/test/API/lang/c/fpeval/main.c delete mode 100644 lldb/unittests/Target/FindFileTest.cpp delete mode 100644 llvm-build/Makefile delete mode 100644 llvm-build/OHOS.cmake delete mode 100644 llvm-build/README.md delete mode 100755 llvm-build/build.py delete mode 100755 llvm-build/build_cpython-mingw.sh delete mode 100755 llvm-build/build_musl.sh delete mode 100755 llvm-build/env_prepare.sh delete mode 100755 llvm-build/mingw.py delete mode 100644 llvm-build/toolchain_readme.md delete mode 100755 llvm-build/windres.sh delete mode 100644 llvm/include/llvm/CodeGen/StackProtectorRetLowering.h delete mode 100644 llvm/lib/CodeGen/StackProtectorRetLowering.cpp delete mode 100644 llvm/lib/Target/AArch64/AArch64ArkGc.td delete mode 100644 llvm/lib/Target/AArch64/AArch64ArkGcCallingConvention.td delete mode 100644 llvm/lib/Target/AArch64/AArch64StackProtectorRetLowering.cpp delete mode 100644 llvm/lib/Target/AArch64/AArch64StackProtectorRetLowering.h delete mode 100644 llvm/lib/Target/BPF/BPFTargetTransformInfo.h delete mode 100644 llvm/test/Bitcode/upgrade-ptr-annotation.ll delete mode 100644 llvm/test/Bitcode/upgrade-ptr-annotation.ll.bc delete mode 100644 llvm/test/Bitcode/upgrade-var-annotation.ll delete mode 100644 llvm/test/Bitcode/upgrade-var-annotation.ll.bc delete mode 100644 llvm/test/CodeGen/AArch64/GlobalISel/huge-switch.ll delete mode 100644 llvm/test/CodeGen/AArch64/atomicrmw-O0.ll delete mode 100644 llvm/test/CodeGen/AArch64/pr48188.ll delete mode 100644 llvm/test/CodeGen/AArch64/stack-protector-musttail.ll delete mode 100644 llvm/test/CodeGen/AMDGPU/shrink-instructions-illegal-fold.mir delete mode 100644 llvm/test/CodeGen/ARM/Windows/stack-protector-musttail.ll delete mode 100644 llvm/test/CodeGen/BPF/BTF/builtin-btf-type-id-2.ll delete mode 100644 llvm/test/CodeGen/BPF/BTF/double.ll delete mode 100644 llvm/test/CodeGen/BPF/BTF/float.ll delete mode 100644 llvm/test/CodeGen/BPF/BTF/weak-global-3.ll delete mode 100644 llvm/test/CodeGen/BPF/remove_truncate_8.ll delete mode 100644 llvm/test/CodeGen/Mips/abiflags-2008-fp64.ll delete mode 100644 llvm/test/CodeGen/PowerPC/arg_promotion.ll delete mode 100644 llvm/test/CodeGen/PowerPC/asm-template-I.ll delete mode 100644 llvm/test/CodeGen/PowerPC/inline-asm-physical-fpr-spe.ll delete mode 100644 llvm/test/CodeGen/PowerPC/inline-asm-physical-fpr.ll delete mode 100644 llvm/test/CodeGen/PowerPC/ppc64-inlineasm-clobber.ll delete mode 100644 llvm/test/CodeGen/PowerPC/pr49092.ll delete mode 100644 llvm/test/CodeGen/PowerPC/pr49509.ll delete mode 100644 llvm/test/CodeGen/RISCV/emutls.ll delete mode 100644 llvm/test/CodeGen/RISCV/emutls_generic.ll delete mode 100644 llvm/test/CodeGen/RISCV/rvv/cleanup-vsetivli.mir delete mode 100644 llvm/test/CodeGen/RISCV/rvv/vle1-rv32.ll delete mode 100644 llvm/test/CodeGen/RISCV/rvv/vle1-rv64.ll delete mode 100644 llvm/test/CodeGen/RISCV/rvv/vse1-rv32.ll delete mode 100644 llvm/test/CodeGen/RISCV/rvv/vse1-rv64.ll rename llvm/test/CodeGen/RISCV/{rvv/vfrec7-rv32.ll => vfrece7-rv32.ll} (45%) rename llvm/test/CodeGen/RISCV/{rvv/vfrec7-rv64.ll => vfrece7-rv64.ll} (45%) rename llvm/test/CodeGen/RISCV/{rvv/vfrsqrt7-rv32.ll => vfrsqrte7-rv32.ll} (44%) rename llvm/test/CodeGen/RISCV/{rvv/vfrsqrt7-rv64.ll => vfrsqrte7-rv64.ll} (44%) delete mode 100644 llvm/test/CodeGen/SystemZ/args-11.ll delete mode 100644 llvm/test/CodeGen/Thumb2/LowOverheadLoops/skip-vpt-debug.mir delete mode 100644 llvm/test/CodeGen/Thumb2/mve-gather-unused.ll delete mode 100644 llvm/test/CodeGen/Thumb2/mve-tailpred-loopinvariant.ll delete mode 100644 llvm/test/CodeGen/Thumb2/mve-vpt-block-debug.mir delete mode 100644 llvm/test/CodeGen/X86/pr49162.ll delete mode 100644 llvm/test/CodeGen/X86/pr49393.ll delete mode 100644 llvm/test/CodeGen/X86/pr49467.ll delete mode 100644 llvm/test/CodeGen/X86/pr49587.ll delete mode 100644 llvm/test/CodeGen/X86/tailcc-ssp.ll delete mode 100644 llvm/test/DebugInfo/implicit-const-test2.s rename llvm/test/MC/AArch64/{coff-separator.s => coff-gnu.s} (74%) delete mode 100644 llvm/test/MC/Disassembler/X86/x86-64-avx.txt delete mode 100644 llvm/test/MC/Disassembler/X86/x86-64-avx2.txt delete mode 100644 llvm/test/MC/Mips/mips_lo16.s delete mode 100644 llvm/test/Transforms/ADCE/willreturn.ll delete mode 100644 llvm/test/Transforms/BDCE/willreturn.ll delete mode 100644 llvm/test/Transforms/Coroutines/coro-byval-param.ll delete mode 100644 llvm/test/Transforms/Coroutines/coro-noalias-param.ll delete mode 100644 llvm/test/Transforms/GVN/storeinvgroup.ll delete mode 100644 llvm/test/Transforms/GVNSink/assumption.ll delete mode 100644 llvm/test/Transforms/Inline/noalias3.ll delete mode 100644 llvm/test/Transforms/Inline/pr50270.ll delete mode 100644 llvm/test/Transforms/InstCombine/redundant-left-shift-input-masking-pr49778.ll delete mode 100644 llvm/test/Transforms/JumpThreading/noalias-scope-decl.ll delete mode 100644 llvm/test/Transforms/LoopReroll/extra_instr.ll delete mode 100644 llvm/test/Transforms/LoopUnroll/peel-loop-noalias-scope-decl.ll delete mode 100644 llvm/test/Transforms/LoopUnswitch/partial-unswitch-update-memoryssa.ll delete mode 100644 llvm/test/Transforms/LoopVectorize/Hexagon/maximum-vf-crash.ll create mode 100644 llvm/test/Transforms/LoopVectorize/X86/force-ifcvt.ll delete mode 100644 llvm/test/Transforms/LoopVectorize/irregular_type.ll delete mode 100644 llvm/test/Transforms/LoopVectorize/pr48832.ll delete mode 100644 llvm/test/Transforms/LoopVectorize/reduction-ptr.ll delete mode 100644 llvm/test/Transforms/SCCP/pr49582-iterator-invalidation.ll delete mode 100644 llvm/test/Transforms/SROA/tbaa-struct2.ll delete mode 100644 llvm/test/Transforms/SampleProfile/Inputs/indirect-call-csspgo.prof delete mode 100644 llvm/test/Transforms/SampleProfile/Inputs/profile-context-order.prof delete mode 100644 llvm/test/Transforms/SampleProfile/Inputs/profile-topdown-order.prof delete mode 100644 llvm/test/Transforms/SampleProfile/Inputs/pseudo-probe-inline.prof delete mode 100644 llvm/test/Transforms/SampleProfile/Inputs/pseudo-probe-update.prof delete mode 100644 llvm/test/Transforms/SampleProfile/csspgo-inline-debug.ll delete mode 100644 llvm/test/Transforms/SampleProfile/csspgo-inline-icall.ll delete mode 100644 llvm/test/Transforms/SampleProfile/csspgo-inline.ll delete mode 100644 llvm/test/Transforms/SampleProfile/csspgo-summary.ll delete mode 100644 llvm/test/Transforms/SampleProfile/profile-context-order.ll delete mode 100644 llvm/test/Transforms/SampleProfile/profile-topdown-order.ll delete mode 100644 llvm/test/Transforms/SampleProfile/pseudo-probe-inline.ll delete mode 100644 llvm/test/Transforms/SampleProfile/pseudo-probe-instcombine.ll delete mode 100644 llvm/test/Transforms/SampleProfile/pseudo-probe-instsched.ll delete mode 100644 llvm/test/Transforms/SampleProfile/pseudo-probe-peep.ll delete mode 100644 llvm/test/Transforms/SampleProfile/pseudo-probe-twoaddr.ll delete mode 100644 llvm/test/Transforms/SampleProfile/pseudo-probe-update.ll delete mode 100644 llvm/test/Transforms/SampleProfile/pseudo-probe-verify.ll delete mode 100644 llvm/test/Transforms/SimplifyCFG/poison-merge.ll delete mode 100644 llvm/test/Transforms/SimplifyCFG/sink-inf-loop.ll delete mode 100644 llvm/test/tools/llvm-dwp/X86/absolute_paths.test delete mode 100644 llvm/test/tools/llvm-objdump/X86/disassemble-gdtls.s delete mode 100644 llvm/test/tools/llvm-objdump/ohos-headers.test delete mode 100644 llvm/test/tools/llvm-profdata/Inputs/cs-sample.proftext delete mode 100644 llvm/test/tools/llvm-profdata/cs-sample-profile.test delete mode 100755 llvm/test/tools/llvm-profgen/Inputs/recursion-compression-noprobe.perfbin delete mode 100644 llvm/test/tools/llvm-profgen/Inputs/recursion-compression-noprobe.perfscript delete mode 100755 llvm/test/tools/llvm-profgen/Inputs/recursion-compression-pseudoprobe.perfbin delete mode 100644 llvm/test/tools/llvm-profgen/Inputs/recursion-compression-pseudoprobe.perfscript delete mode 100644 llvm/test/tools/llvm-profgen/cs-extbinary.test delete mode 100644 llvm/test/tools/llvm-profgen/invalid-perfscript.test delete mode 100644 llvm/test/tools/llvm-profgen/merge-cold-profile.test delete mode 100644 llvm/test/tools/llvm-profgen/recursion-compression-noprobe.test delete mode 100644 llvm/test/tools/llvm-profgen/recursion-compression-pseudoprobe.test delete mode 100644 llvm/unittests/tools/llvm-profgen/CMakeLists.txt delete mode 100644 llvm/unittests/tools/llvm-profgen/ContextCompressionTest.cpp delete mode 100644 openmp/libomptarget/test/offloading/assert.cpp delete mode 100644 openmp/libomptarget/test/offloading/bug49021.cpp delete mode 100644 openmp/libomptarget/test/offloading/bug49334.cpp delete mode 100644 openmp/runtime/test/tasking/hidden_helper_task/capacity_mix_threads.cpp delete mode 100644 openmp/runtime/test/tasking/hidden_helper_task/capacity_nthreads.cpp diff --git a/.gitee/ISSUE_TEMPLATE.en.md b/.gitee/ISSUE_TEMPLATE.en.md deleted file mode 100644 index e1522ec4010a..000000000000 --- a/.gitee/ISSUE_TEMPLATE.en.md +++ /dev/null @@ -1,21 +0,0 @@ -## Bug Description -A clear and concise description of what the bug is - -## Reproduction -Steps to reproduce the behavior -1. ... -2. ... -3. ... - -## Expected behavior -A clear and concise description of what is expected to happen - -## Environment -- Architecture -- OS, version, etc -- Version of the toolchain -- ... - -## Additional context -- Any other context which may help to reproduce and/or fix the issue. -- Supporting files (minimal test case) diff --git a/.gitee/PULL_REQUEST_TEMPLATE.en.md b/.gitee/PULL_REQUEST_TEMPLATE.en.md deleted file mode 100644 index f6d433f6d188..000000000000 --- a/.gitee/PULL_REQUEST_TEMPLATE.en.md +++ /dev/null @@ -1,4 +0,0 @@ -## PR Description -A clear and concise description of changes and rationale. Provide a link to external references / discussion if appropriate - -Development Guidelines: https://gitee.com/openharmony/third_party_llvm-project/blob/master/OpenHarmonyDevelopmentGuidelines.md diff --git a/.github/workflows/clang-tests.yml b/.github/workflows/clang-tests.yml deleted file mode 100644 index d37637e4b927..000000000000 --- a/.github/workflows/clang-tests.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: Clang Tests - -on: - push: - branches: - - 'release/**' - paths: - - 'clang/**' - - 'llvm/**' - - '.github/workflows/clang-tests.yml' - pull_request: - paths: - - 'clang/**' - - 'llvm/**' - - '.github/workflows/clang-tests.yml' - -jobs: - build_clang: - name: clang check-all - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: - - ubuntu-latest - - windows-latest - - macOS-latest - steps: - - name: Setup Windows - if: startsWith(matrix.os, 'windows') - uses: llvm/actions/setup-windows@main - with: - arch: amd64 - - name: Install Ninja - uses: llvm/actions/install-ninja@main - - uses: actions/checkout@v1 - with: - fetch-depth: 250 - - name: Test clang - uses: llvm/actions/build-test-llvm-project@main - with: - cmake_args: -G Ninja -DLLVM_ENABLE_PROJECTS="clang" -DCMAKE_BUILD_TYPE=Release - build_target: check-clang diff --git a/.github/workflows/libclang-abi-tests.yml b/.github/workflows/libclang-abi-tests.yml deleted file mode 100644 index c7d1993ba006..000000000000 --- a/.github/workflows/libclang-abi-tests.yml +++ /dev/null @@ -1,151 +0,0 @@ -name: libclang ABI Tests - -on: - push: - branches: - - 'release/**' - paths: - - 'clang/**' - - '.github/workflows/libclang-abi-tests.yml' - pull_request: - paths: - - 'clang/**' - - '.github/workflows/libclang-abi-tests.yml' - -jobs: - abi-dump-setup: - runs-on: ubuntu-latest - outputs: - BASELINE_REF: ${{ steps.vars.outputs.BASELINE_REF }} - ABI_HEADERS: ${{ steps.vars.outputs.ABI_HEADERS }} - ABI_LIBS: ${{ steps.vars.outputs.ABI_LIBS }} - BASELINE_VERSION_MAJOR: ${{ steps.vars.outputs.BASELINE_VERSION_MAJOR }} - BASELINE_VERSION_MINOR: ${{ steps.vars.outputs.BASELINE_VERSION_MINOR }} - LLVM_VERSION_MAJOR: ${{ steps.version.outputs.LLVM_VERSION_MAJOR }} - LLVM_VERSION_MINOR: ${{ steps.version.outputs.LLVM_VERSION_MINOR }} - LLVM_VERSION_PATCH: ${{ steps.version.outputs.LLVM_VERSION_PATCH }} - steps: - - name: Checkout source - uses: actions/checkout@v1 - with: - fetch-depth: 250 - - - name: Get LLVM version - id: version - uses: llvm/actions/get-llvm-version@main - - - name: Setup Variables - id: vars - run: | - minor_version=0 - remote_repo='https://github.com/llvm/llvm-project' - if [ ${{ steps.version.outputs.LLVM_VERSION_MINOR }} -ne 0 -o ${{ steps.version.outputs.LLVM_VERSION_PATCH }} -eq 0 ]; then - major_version=$(( ${{ steps.version.outputs.LLVM_VERSION_MAJOR }} - 1)) - baseline_ref="llvmorg-$major_version.0.0" - - # If there is a minor release, we want to use that as the base line. - minor_ref=`git ls-remote --refs -t $remote_repo llvmorg-$major_version.[1-9].[0-9] | tail -n1 | grep -o 'llvmorg-.\+' || true` - if [ -n "$minor_ref" ]; then - baseline_ref=$minor_ref - else - # Check if we have a release candidate - rc_ref=`git ls-remote --refs -t $remote_repo llvmorg-$major_version.[1-9].[0-9]-rc* | tail -n1 | grep -o 'llvmorg-.\+' || true` - if [ -n "$rc_ref" ]; then - baseline_ref=$rc_ref - fi - fi - echo ::set-output name=BASELINE_VERSION_MAJOR::$major_version - echo ::set-output name=BASELINE_REF::$baseline_ref - echo ::set-output name=ABI_HEADERS::clang-c - echo ::set-output name=ABI_LIBS::libclang.so - else - echo ::set-output name=BASELINE_VERSION_MAJOR::${{ steps.version.outputs.LLVM_VERSION_MAJOR }} - echo ::set-output name=BASELINE_REF::llvmorg-${{ steps.version.outputs.LLVM_VERSION_MAJOR }}.0.0 - echo ::set-output name=ABI_HEADERS::. - echo ::set-output name=ABI_LIBS::libclang.so libclang-cpp.so - fi - - - abi-dump: - needs: abi-dump-setup - runs-on: ubuntu-latest - strategy: - matrix: - name: - - build-baseline - - build-latest - include: - - name: build-baseline - llvm_version_major: ${{ needs.abi-dump-setup.outputs.BASELINE_VERSION_MAJOR }} - ref: ${{ needs.abi-dump-setup.outputs.BASELINE_REF }} - repo: llvm/llvm-project - - name: build-latest - llvm_version_major: ${{ needs.abi-dump-setup.outputs.LLVM_VERSION_MAJOR }} - ref: ${{ github.sha }} - repo: ${{ github.repository }} - steps: - - name: Install Ninja - uses: llvm/actions/install-ninja@main - - name: Install abi-compliance-checker - run: | - sudo apt-get install abi-dumper autoconf pkg-config - - name: Install universal-ctags - run: | - git clone https://github.com/universal-ctags/ctags.git - cd ctags - ./autogen.sh - ./configure - sudo make install - - name: Download source code - uses: llvm/actions/get-llvm-project-src@main - with: - ref: ${{ matrix.ref }} - repo: ${{ matrix.repo }} - - name: Configure - run: | - mkdir install - cmake -B build -S llvm -G Ninja -DLLVM_ENABLE_PROJECTS=clang -DCMAKE_BUILD_TYPE=Debug -DLLVM_TARGETS_TO_BUILD="" -DLLVM_BUILD_LLVM_DYLIB=ON -DLLVM_LINK_LLVM_DYLIB=ON -DCMAKE_C_FLAGS_DEBUG="-g1 -Og" -DCMAKE_CXX_FLAGS_DEBUG="-g1 -Og" -DCMAKE_INSTALL_PREFIX=`pwd`/install llvm - - name: Build - run: ninja -C build/ ${{ needs.abi-dump-setup.outputs.ABI_LIBS }} install-clang-headers - - name: Dump ABI - run: | - parallel abi-dumper -lver ${{ matrix.ref }} -skip-cxx -public-headers ./install/include/${{ needs.abi-dump-setup.outputs.ABI_HEADERS }} -o {}-${{ matrix.ref }}.abi ./build/lib/{} ::: ${{ needs.abi-dump-setup.outputs.ABI_LIBS }} - for lib in ${{ needs.abi-dump-setup.outputs.ABI_LIBS }}; do - # Remove symbol versioning from dumps, so we can compare across major versions. - sed -i 's/LLVM_${{ matrix.llvm_version_major }}/LLVM_NOVERSION/' $lib-${{ matrix.ref }}.abi - done - - name: Upload ABI file - uses: actions/upload-artifact@v2 - with: - name: ${{ matrix.name }} - path: "*${{ matrix.ref }}.abi" - - abi-compare: - runs-on: ubuntu-latest - needs: - - abi-dump-setup - - abi-dump - steps: - - name: Download baseline - uses: actions/download-artifact@v1 - with: - name: build-baseline - - name: Download latest - uses: actions/download-artifact@v1 - with: - name: build-latest - - - name: Install abi-compliance-checker - run: sudo apt-get install abi-compliance-checker - - name: Compare ABI - run: | - for lib in ${{ needs.abi-dump-setup.outputs.ABI_LIBS }}; do - abi-compliance-checker -lib $lib -old build-baseline/$lib*.abi -new build-latest/$lib*.abi - done - - name: Upload ABI Comparison - if: always() - uses: actions/upload-artifact@v2 - with: - name: compat-report-${{ github.sha }} - path: compat_reports/ - diff --git a/.github/workflows/libclc-tests.yml b/.github/workflows/libclc-tests.yml deleted file mode 100644 index 6be01c839f44..000000000000 --- a/.github/workflows/libclc-tests.yml +++ /dev/null @@ -1,53 +0,0 @@ -name: libclc Tests - -on: - push: - branches: - - 'release/**' - paths: - - 'clang/**' - - 'llvm/**' - - 'libclc/**' - - '.github/workflows/libclc-tests.yml' - pull_request: - paths: - - 'clang/**' - - 'llvm/**' - - 'libclc/**' - - '.github/workflows/libclc-tests.yml' - -jobs: - build_libclc: - name: libclc test - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: - - ubuntu-latest - # Disable build on windows, because I can't figure out where llvm-config is. - #- windows-latest - - macOS-latest - steps: - - name: Setup Windows - if: startsWith(matrix.os, 'windows') - uses: llvm/actions/setup-windows@main - with: - arch: amd64 - - name: Install Ninja - uses: llvm/actions/install-ninja@main - - uses: actions/checkout@v1 - with: - fetch-depth: 250 - - name: Build clang - uses: llvm/actions/build-test-llvm-project@main - with: - cmake_args: -G Ninja -DLLVM_ENABLE_PROJECTS="clang" -DCMAKE_BUILD_TYPE=Release - build_target: "" - - name: Build and test libclc - # spirv targets require llvm-spirv, so skip building them until we figure out - # how to install this tool. - run: | - cmake -G Ninja -S libclc -B libclc-build -DLLVM_CONFIG=`pwd`/build/bin/llvm-config -DLIBCLC_TARGETS_TO_BUILD="amdgcn--;amdgcn--amdhsa;r600--;nvptx--;nvptx64--;nvptx--nvidiacl;nvptx64--nvidiacl" - ninja -C libclc-build - ninja -C libclc-build test diff --git a/.github/workflows/lld-tests.yml b/.github/workflows/lld-tests.yml deleted file mode 100644 index 1e5540d2fc4d..000000000000 --- a/.github/workflows/lld-tests.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: LLD Tests - -on: - push: - branches: - - 'release/**' - paths: - - 'lld/**' - - 'llvm/**' - - '.github/workflows/lld-tests.yml' - pull_request: - paths: - - 'lld/**' - - 'llvm/**' - - '.github/workflows/lld-tests.yml' - -jobs: - build_lld: - name: lld check-all - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: - - ubuntu-latest - - windows-latest - - macOS-latest - steps: - - name: Setup Windows - if: startsWith(matrix.os, 'windows') - uses: llvm/actions/setup-windows@main - with: - arch: amd64 - - name: Install Ninja - uses: llvm/actions/install-ninja@main - - uses: actions/checkout@v1 - with: - fetch-depth: 250 - - name: Test lld - uses: llvm/actions/build-test-llvm-project@main - with: - cmake_args: -G Ninja -DLLVM_ENABLE_PROJECTS="lld" -DCMAKE_BUILD_TYPE=Release - build_target: check-lld diff --git a/.github/workflows/lldb-tests.yml b/.github/workflows/lldb-tests.yml deleted file mode 100644 index 1658c0e001a0..000000000000 --- a/.github/workflows/lldb-tests.yml +++ /dev/null @@ -1,50 +0,0 @@ -name: lldb Tests - -on: - push: - branches: - - 'release/**' - paths: - - 'clang/**' - - 'llvm/**' - - 'lldb/**' - - '.github/workflows/lldb-tests.yml' - pull_request: - paths: - - 'clang/**' - - 'llvm/**' - - 'lldb/**' - - '.github/workflows/lldb-tests.yml' - -jobs: - build_lldb: - name: lldb build - runs-on: ${{ matrix.os }} - # Workaround for build faliure on Mac OS X: llvm.org/PR46190, https://github.com/actions/virtual-environments/issues/2274 - env: - CPLUS_INCLUDE_PATH: /usr/local/opt/llvm/include/c++/v1:/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include - strategy: - fail-fast: false - matrix: - os: - - ubuntu-latest - - windows-latest - - macOS-latest - steps: - - name: Setup Windows - if: startsWith(matrix.os, 'windows') - uses: llvm/actions/setup-windows@main - with: - arch: amd64 - - name: Install Ninja - uses: llvm/actions/install-ninja@main - - uses: actions/checkout@v1 - with: - fetch-depth: 250 - - name: Build lldb - uses: llvm/actions/build-test-llvm-project@main - with: - # Mac OS requries that libcxx is enabled for lldb tests, so we need to disable them. - cmake_args: -G Ninja -DLLVM_ENABLE_PROJECTS="clang;lldb" -DCMAKE_BUILD_TYPE=Release -DLLDB_INCLUDE_TESTS=OFF - # check-lldb is not consistent, so we only build lldb. - build_target: "" diff --git a/.github/workflows/llvm-tests.yml b/.github/workflows/llvm-tests.yml deleted file mode 100644 index bb011c0dafbb..000000000000 --- a/.github/workflows/llvm-tests.yml +++ /dev/null @@ -1,178 +0,0 @@ -name: LLVM Tests - -on: - push: - branches: - - 'release/**' - paths: - - 'llvm/**' - - '.github/workflows/llvm-tests.yml' - pull_request: - paths: - - 'llvm/**' - - '.github/workflows/llvm-tests.yml' - -jobs: - build_llvm: - name: llvm check-all - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: - - ubuntu-latest - - windows-latest - - macOS-latest - steps: - - name: Setup Windows - if: startsWith(matrix.os, 'windows') - uses: llvm/actions/setup-windows@main - with: - arch: amd64 - - name: Install Ninja - uses: llvm/actions/install-ninja@main - - uses: actions/checkout@v1 - with: - fetch-depth: 250 - - name: Test llvm - uses: llvm/actions/build-test-llvm-project@main - with: - cmake_args: -G Ninja -DCMAKE_BUILD_TYPE=Release - - abi-dump-setup: - runs-on: ubuntu-latest - outputs: - BASELINE_REF: ${{ steps.vars.outputs.BASELINE_REF }} - ABI_HEADERS: ${{ steps.vars.outputs.ABI_HEADERS }} - BASELINE_VERSION_MAJOR: ${{ steps.vars.outputs.BASELINE_VERSION_MAJOR }} - LLVM_VERSION_MAJOR: ${{ steps.version.outputs.LLVM_VERSION_MAJOR }} - LLVM_VERSION_MINOR: ${{ steps.version.outputs.LLVM_VERSION_MINOR }} - LLVM_VERSION_PATCH: ${{ steps.version.outputs.LLVM_VERSION_PATCH }} - steps: - - name: Checkout source - uses: actions/checkout@v1 - with: - fetch-depth: 250 - - - name: Get LLVM version - id: version - uses: llvm/actions/get-llvm-version@main - - - name: Setup Variables - id: vars - run: | - if [ ${{ steps.version.outputs.LLVM_VERSION_MINOR }} -ne 0 -o ${{ steps.version.outputs.LLVM_VERSION_PATCH }} -eq 0 ]; then - echo ::set-output name=BASELINE_VERSION_MAJOR::$(( ${{ steps.version.outputs.LLVM_VERSION_MAJOR }} - 1)) - echo ::set-output name=ABI_HEADERS::llvm-c - else - echo ::set-output name=BASELINE_VERSION_MAJOR::${{ steps.version.outputs.LLVM_VERSION_MAJOR }} - echo ::set-output name=ABI_HEADERS::. - fi - - abi-dump: - needs: abi-dump-setup - runs-on: ubuntu-latest - strategy: - matrix: - name: - - build-baseline - - build-latest - include: - - name: build-baseline - llvm_version_major: ${{ needs.abi-dump-setup.outputs.BASELINE_VERSION_MAJOR }} - ref: llvmorg-${{ needs.abi-dump-setup.outputs.BASELINE_VERSION_MAJOR }}.0.0 - repo: llvm/llvm-project - - name: build-latest - llvm_version_major: ${{ needs.abi-dump-setup.outputs.LLVM_VERSION_MAJOR }} - ref: ${{ github.sha }} - repo: ${{ github.repository }} - steps: - - name: Install Ninja - uses: llvm/actions/install-ninja@main - - name: Install abi-compliance-checker - run: | - sudo apt-get install abi-dumper autoconf pkg-config - - name: Install universal-ctags - run: | - git clone https://github.com/universal-ctags/ctags.git - cd ctags - ./autogen.sh - ./configure - sudo make install - - name: Download source code - uses: llvm/actions/get-llvm-project-src@main - with: - ref: ${{ matrix.ref }} - repo: ${{ matrix.repo }} - - name: Configure - run: | - mkdir install - cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug -DLLVM_TARGETS_TO_BUILD="" -DLLVM_BUILD_LLVM_DYLIB=ON -DCMAKE_C_FLAGS_DEBUG="-g1 -Og" -DCMAKE_CXX_FLAGS_DEBUG="-g1 -Og" -DCMAKE_INSTALL_PREFIX=`pwd`/install llvm - - name: Build - # Need to run install-LLVM twice to ensure the symlink is installed (this is a bug). - run: | - ninja -C build install-LLVM - ninja -C build install-LLVM - ninja -C build install-llvm-headers - - name: Dump ABI - run: | - if [ "${{ needs.abi-dump-setup.outputs.ABI_HEADERS }}" = "llvm-c" ]; then - nm ./install/lib/libLLVM.so | awk "/T _LLVM/ || /T LLVM/ { print $3 }" | sort -u | sed -e "s/^_//g" | cut -d ' ' -f 3 > llvm.symbols - # Even though the -symbols-list option doesn't seem to filter out the symbols, I believe it speeds up processing, so I'm leaving it in. - export EXTRA_ARGS="-symbols-list llvm.symbols" - else - touch llvm.symbols - fi - abi-dumper $EXTRA_ARGS -lver ${{ matrix.ref }} -skip-cxx -public-headers ./install/include/${{ needs.abi-dump-setup.outputs.ABI_HEADERS }} -o ${{ matrix.ref }}.abi ./install/lib/libLLVM.so - # Remove symbol versioning from dumps, so we can compare across major versions. - sed -i 's/LLVM_${{ matrix.llvm_version_major }}/LLVM_NOVERSION/' ${{ matrix.ref }}.abi - - name: Upload ABI file - uses: actions/upload-artifact@v1 - with: - name: ${{ matrix.name }} - path: ${{ matrix.ref }}.abi - - - name: Upload symbol list file - if: matrix.name == 'build-baseline' - uses: actions/upload-artifact@v1 - with: - name: symbol-list - path: llvm.symbols - - abi-compare: - runs-on: ubuntu-latest - needs: - - abi-dump-setup - - abi-dump - steps: - - name: Download baseline - uses: actions/download-artifact@v1 - with: - name: build-baseline - - name: Download latest - uses: actions/download-artifact@v1 - with: - name: build-latest - - name: Download symbol list - uses: actions/download-artifact@v1 - with: - name: symbol-list - - - name: Install abi-compliance-checker - run: sudo apt-get install abi-compliance-checker - - name: Compare ABI - run: | - if [ -s symbol-list/llvm.symbols ]; then - # This option doesn't seem to work with the ABI dumper, so passing it here. - export EXTRA_ARGS="-symbols-list symbol-list/llvm.symbols" - fi - # FIXME: Reading of gzip'd abi files on the GitHub runners stop - # working some time in March of 2021, likely due to a change in the - # runner's environment. - abi-compliance-checker $EXTRA_ARGS -l libLLVM.so -old build-baseline/*.abi -new build-latest/*.abi || test "${{ needs.abi-dump-setup.outputs.ABI_HEADERS }}" = "llvm-c" - - name: Upload ABI Comparison - if: always() - uses: actions/upload-artifact@v1 - with: - name: compat-report-${{ github.sha }} - path: compat_reports/ diff --git a/.github/workflows/main-branch-sync.yml b/.github/workflows/main-branch-sync.yml new file mode 100644 index 000000000000..5ea360e281d6 --- /dev/null +++ b/.github/workflows/main-branch-sync.yml @@ -0,0 +1,25 @@ +name: main branch sync + +on: + push: + branches: + - 'main' + +jobs: + branch_sync: + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@v2 + with: + # persist-credentials: false allows us to use our own credentials for + # pushing to the repository. Otherwise, the default github actions token + # is used. + persist-credentials: false + fetch-depth: 0 + + - name: Update branch + env: + LLVMBOT_TOKEN: ${{ secrets.LLVMBOT_MAIN_SYNC }} + run: | + git push https://$LLVMBOT_TOKEN@github.com/${{ github.repository }} HEAD:master diff --git a/OAT.xml b/OAT.xml deleted file mode 100644 index fe34bbf4d4a4..000000000000 --- a/OAT.xml +++ /dev/null @@ -1,224 +0,0 @@ - - - - - - llvm/LICENSE.TXT|clang/LICENSE.TXT|libcxx/LICENSE.TXT|lldb/LICENSE.TXT|clang-tools-extra/LICENSE.TXT|llvm/utils/lit/LICENSE.TXT|llvm/tools/msbuild/license.txt|llvm/tools/msbuild/license.txt|clang-tools-extra/clang-tidy/cert/LICENSE.TXT|clang-tools-extra/clang-tidy/hicpp/LICENSE.TXT|libclc/LICENSE.TXT|llvm/include/llvm/Support/LICENSE.TXT - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/OpenHarmonyDevelopmentGuidelines.md b/OpenHarmonyDevelopmentGuidelines.md deleted file mode 100644 index 212f6596d863..000000000000 --- a/OpenHarmonyDevelopmentGuidelines.md +++ /dev/null @@ -1,37 +0,0 @@ -## Generic Guidelines - ---------------------- - -### LLVM-related rules - -All changes should adhere to LLVM Developer Policy / Coding Standarts: -- https://llvm.org/docs/CodingStandards.html -- https://llvm.org/docs/DeveloperPolicy.html - ---------------------- - -### Mark changes properly - -All OHOS-related changes to mainline LLVM / clang code MUST be clearly marked such as: - -``` -unsigned LoopSizeThreshold = 32; // OHOS_LOCAL -``` - -or in case of multiline change: - -``` -// OHOS_LOCAL begin - -Some local OHOS change - -// OHOS_LOCAL begin -``` - -The presence of such marks greatly simplifies porting such code snippets to new LLVM versions. All such changes MUST be accompanied with a test case that MUST fail should the change is reverted. - ---------------------- - -### ABI Breakage - -All ABI-breaking changes MUST be scheduled to a major toolchain releases. One should explicitly discuss and document such changes. Ideally ABI-breaking change should cause linking error, it should not cause silent and hard to track bugs. diff --git a/README.OpenSource b/README.OpenSource deleted file mode 100644 index 999365386775..000000000000 --- a/README.OpenSource +++ /dev/null @@ -1,11 +0,0 @@ -[ - { - "Name": "LLVM", - "License": "Apache License v2.0 with LLVM Exceptions", - "License File": "./libunwind/LICENSE.TXT ./lld/LICENSE.TXT ./polly/tools/GPURuntime/LICENSE.TXT ./libcxxabi/LICENSE.TXT ./llvm/include/llvm/Support/LICENSE.TXT ./llvm/utils/unittest/googletest/LICENSE.TXT ./llvm/LICENSE.TXT ./compiler-rt/LICENSE.TXT ./clang-tools-extra/clang-tidy/cert/LICENSE.TXT ./clang-tools-extra/clang-tidy/hicpp/LICENSE.TXT ./clang-tools-extra/LICENSE.TXT ./lldb/LICENSE.TXT ./llgo/LICENSE.TXT ./libcxx/LICENSE.TXT ./clang/LICENSE.TXT ./libclc/LICENSE.TXT ./parallel-libs/acxxel/LICENSE.TXT", - "Version Number": "12.0.1", - "Owner": "sunqiang13@huawei.com", - "Upstream URL": "http://llvm.org/", - "Description": "The LLVM Project is a collection of modular and reusable compiler and toolchain technologies. Despite its name, LLVM has little to do with traditional virtual machines. The name \"LLVM\" itself is not an acronym; it is the full name of the project." - } -] diff --git a/README.md b/README.md index d3aea8de20fa..6e02ee378eb3 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,6 @@ the [libc++ C++ standard library](https://libcxx.llvm.org), the [LLD linker](https://lld.llvm.org), and more. ### Getting the Source Code and Building LLVM -We recommend that you base on the guide [llvm-build](https://gitee.com/openharmony-sig/third_party_llvm-project/blob/master/llvm-build/README.md) to get the source code and build it for OpenHarmony platform. The LLVM Getting Started documentation may be out of date. The [Clang Getting Started](http://clang.llvm.org/get_started.html) page might have more @@ -109,5 +108,3 @@ Consult the page for detailed information on configuring and compiling LLVM. You can visit [Directory Layout](https://llvm.org/docs/GettingStarted.html#directory-layout) to learn about the layout of the source code tree. - -For the llvm construction of openharmony, please refer to [llvm-build](https://gitee.com/openharmony-sig/third_party_llvm-project/blob/master/llvm-build/README.md). \ No newline at end of file diff --git a/README_zh.md b/README_zh.md deleted file mode 100644 index edd3e6d6129a..000000000000 --- a/README_zh.md +++ /dev/null @@ -1,74 +0,0 @@ -# LLVM编译器基础架构 - -此目录及其子目录包含LLVM的源代码,LLVM是一个用于构建高度优化的编译器、优化器和运行时环境的工具包。 - -自述文件简要介绍了如何开始构建LLVM。有关如何为LLVM项目做出贡献的更多信息,请查看 [为LLVM做出贡献](https://llvm.org/docs/Contributing.html) 指南。 - -## LLVM系统入门 - -取自 [https://llvm.org/docs/GettingStarted.html](https://gitee.com/link?target=https%3A%2F%2Fllvm.org%2Fdocs%2FGettingStarted.html). - -### 概述 - -欢迎来到LLVM项目! - -LLVM项目有多个组件。该项目的核心本身被称为“LLVM”。这包含处理中间表示并将其转换为对象文件所需的所有工具、库和头文件。工具包括汇编器、反汇编器、位码分析器和位码优化器。它还包含基本的回归测试。 - -类C语言使用 [Clang](https://clang.llvm.org/) 前端。此组件将C、C++、目标-C和目标-C++代码编译为LLVM位码,并使用LLVM将其编译为目标文件。 - -其他组件包括:[libc++ C++ 标准库](https://libcxx.llvm.org/),[LLD链接器](https://lld.llvm.org/) 等。 - -### 获取源代码并构建LLVM - -在OpenHarmony中,我们建议您基于[llvm-build](https://gitee.com/openharmony-sig/third_party_llvm-project/blob/master/llvm-build/README.md)的指导获取源码并进行构建。 - -LLVM入门文档可能已过期。[Clang入门](https://clang.llvm.org/get_started.html) 页面可能有更准确的信息。 - -这是获取和构建LLVM源的示例工作流和配置: - -1. Checkout LLVM (包括Clang等相关子项目): - - - `git clone https://github.com/llvm/llvm-project.git` - - 或 在 Windows上, `git clone --config core.autocrlf=false https://github.com/llvm/llvm-project.git` - -2. 配置和构建LLVM和Clang: - - - `cd llvm-project` - - - `mkdir build` - - - `cd build` - - - `cmake -G [options] ../llvm` - - 一些常见的构建系统生成器有: - - - `Ninja`---用于生成 [Ninja](https://ninja-build.org/) 构建文件。大多数llvm开发人员使用Ninja。 - - `Unix Makefiles` --- 用于生成与make兼容的并行makefile。 - - `Visual Studio` --- 用于生成Visual Studio项目和解决方案。 - - `Xcode` --- 用于生成Xcode项目。 - - 一些常见选项: - - - `-DLLVM_ENABLE_PROJECTS='...'` --- 要额外构建的LLVM子项目的分号分隔列表。可以包括:clang、clang-tools-extra、libcxx、libcxxabi、libunwind、lldb、编译器-rt、lld、波莉或调试信息测试中的任何一个。 - - 例如,要构建LLVM、Clang、libcxx和libcxxabi,请使用 `-DLLVM_ENABLE_PROJECTS="clang;libcxx;libcxxabi"`. - - - `-DCMAKE_INSTALL_PREFIX=directory` --- 为*目录* 指定要安装LLVM工具和库的完整路径名 (默认 `/usr/local`). - - - `-DCMAKE_BUILD_TYPE=type` --- *类型* 的有效选项为 调试、发布、带调试信息发布 和最小尺寸发布。默认值为调试。 - - - `-DLLVM_ENABLE_ASSERTIONS=On` --- 在启用断言检查的情况下编译(调试编译的默认值为Yes,所有其他编译类型的默认值为No)。 - - - `cmake --build . [-- [options] ]` 或直接在上面指定的构建系统。 - - - 默认目标(即 `ninja` or `make`)将构建所有LLVM。 - - `check-all`目标(即`ninja check-all`)将运行回归测试,以确保一切都正常工作。 - - CMake将为每个工具和库生成目标,大多数LLVM子项目生成自己的`check-`目标。 - - 运行串行构建将是 **缓慢** 。要提高速度,请尝试运行并行构建。默认情况下,这是在“make”中完成的;对于`make`,请使用选项`-j NNN`,其中`NNN`是并行作业的数量,例如您拥有的CPU数量。 - - - 有关详细信息,请参阅 [CMake](https://llvm.org/docs/CMake.html) - -请参阅 [LLVM入门](https://llvm.org/docs/GettingStarted.html#getting-started-with-llvm) 页面,了解有关配置和编译LLVM的详细信息。您可以访问 [目录布局](https://llvm.org/docs/GettingStarted.html#directory-layout) 以了解源代码树的布局。 - -有关Openharmony的llvm构建请参考[llvm-build](https://gitee.com/openharmony-sig/third_party_llvm-project/blob/master/llvm-build/README.md)。 diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/CMakeLists.txt b/clang-tools-extra/clang-tidy/cppcoreguidelines/CMakeLists.txt index 39c2c552eb73..a9f5b3e0c15b 100644 --- a/clang-tools-extra/clang-tidy/cppcoreguidelines/CMakeLists.txt +++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/CMakeLists.txt @@ -13,6 +13,7 @@ add_clang_library(clangTidyCppCoreGuidelinesModule NarrowingConversionsCheck.cpp NoMallocCheck.cpp OwningMemoryCheck.cpp + PreferMemberInitializerCheck.cpp ProBoundsArrayToPointerDecayCheck.cpp ProBoundsConstantArrayIndexCheck.cpp ProBoundsPointerArithmeticCheck.cpp diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/CppCoreGuidelinesTidyModule.cpp b/clang-tools-extra/clang-tidy/cppcoreguidelines/CppCoreGuidelinesTidyModule.cpp index 4cb5022888d3..bf613109f0eb 100644 --- a/clang-tools-extra/clang-tidy/cppcoreguidelines/CppCoreGuidelinesTidyModule.cpp +++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/CppCoreGuidelinesTidyModule.cpp @@ -22,6 +22,7 @@ #include "NarrowingConversionsCheck.h" #include "NoMallocCheck.h" #include "OwningMemoryCheck.h" +#include "PreferMemberInitializerCheck.h" #include "ProBoundsArrayToPointerDecayCheck.h" #include "ProBoundsConstantArrayIndexCheck.h" #include "ProBoundsPointerArithmeticCheck.h" @@ -66,6 +67,8 @@ public: "cppcoreguidelines-non-private-member-variables-in-classes"); CheckFactories.registerCheck( "cppcoreguidelines-owning-memory"); + CheckFactories.registerCheck( + "cppcoreguidelines-prefer-member-initializer"); CheckFactories.registerCheck( "cppcoreguidelines-pro-bounds-array-to-pointer-decay"); CheckFactories.registerCheck( diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/PreferMemberInitializerCheck.cpp b/clang-tools-extra/clang-tidy/cppcoreguidelines/PreferMemberInitializerCheck.cpp new file mode 100644 index 000000000000..2d7500943860 --- /dev/null +++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/PreferMemberInitializerCheck.cpp @@ -0,0 +1,246 @@ +//===--- PreferMemberInitializerCheck.cpp - clang-tidy -------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "PreferMemberInitializerCheck.h" +#include "clang/AST/ASTContext.h" +#include "clang/ASTMatchers/ASTMatchFinder.h" +#include "clang/Lex/Lexer.h" + +using namespace clang::ast_matchers; + +namespace clang { +namespace tidy { +namespace cppcoreguidelines { + +static bool isControlStatement(const Stmt *S) { + return isa(S); +} + +static bool isNoReturnCallStatement(const Stmt *S) { + const auto *Call = dyn_cast(S); + if (!Call) + return false; + + const FunctionDecl *Func = Call->getDirectCallee(); + if (!Func) + return false; + + return Func->isNoReturn(); +} + +static bool isLiteral(const Expr *E) { + return isa(E); +} + +static bool isUnaryExprOfLiteral(const Expr *E) { + if (const auto *UnOp = dyn_cast(E)) + return isLiteral(UnOp->getSubExpr()); + return false; +} + +static bool shouldBeDefaultMemberInitializer(const Expr *Value) { + if (isLiteral(Value) || isUnaryExprOfLiteral(Value)) + return true; + + if (const auto *DRE = dyn_cast(Value)) + return isa(DRE->getDecl()); + + return false; +} + +static const std::pair +isAssignmentToMemberOf(const RecordDecl *Rec, const Stmt *S) { + if (const auto *BO = dyn_cast(S)) { + if (BO->getOpcode() != BO_Assign) + return std::make_pair(nullptr, nullptr); + + const auto *ME = dyn_cast(BO->getLHS()->IgnoreParenImpCasts()); + if (!ME) + return std::make_pair(nullptr, nullptr); + + const auto *Field = dyn_cast(ME->getMemberDecl()); + if (!Field) + return std::make_pair(nullptr, nullptr); + + if (isa(ME->getBase())) + return std::make_pair(Field, BO->getRHS()->IgnoreParenImpCasts()); + } else if (const auto *COCE = dyn_cast(S)) { + if (COCE->getOperator() != OO_Equal) + return std::make_pair(nullptr, nullptr); + + const auto *ME = + dyn_cast(COCE->getArg(0)->IgnoreParenImpCasts()); + if (!ME) + return std::make_pair(nullptr, nullptr); + + const auto *Field = dyn_cast(ME->getMemberDecl()); + if (!Field) + return std::make_pair(nullptr, nullptr); + + if (isa(ME->getBase())) + return std::make_pair(Field, COCE->getArg(1)->IgnoreParenImpCasts()); + } + + return std::make_pair(nullptr, nullptr); +} + +PreferMemberInitializerCheck::PreferMemberInitializerCheck( + StringRef Name, ClangTidyContext *Context) + : ClangTidyCheck(Name, Context), + IsUseDefaultMemberInitEnabled( + Context->isCheckEnabled("modernize-use-default-member-init")), + UseAssignment(OptionsView("modernize-use-default-member-init", + Context->getOptions().CheckOptions, Context) + .get("UseAssignment", false)) {} + +void PreferMemberInitializerCheck::storeOptions( + ClangTidyOptions::OptionMap &Opts) { + Options.store(Opts, "UseAssignment", UseAssignment); +} + +void PreferMemberInitializerCheck::registerMatchers(MatchFinder *Finder) { + Finder->addMatcher( + cxxConstructorDecl(hasBody(compoundStmt()), unless(isInstantiated())) + .bind("ctor"), + this); +} + +void PreferMemberInitializerCheck::check( + const MatchFinder::MatchResult &Result) { + const auto *Ctor = Result.Nodes.getNodeAs("ctor"); + const auto *Body = cast(Ctor->getBody()); + + const CXXRecordDecl *Class = Ctor->getParent(); + SourceLocation InsertPos; + bool FirstToCtorInits = true; + + for (const Stmt *S : Body->body()) { + if (S->getBeginLoc().isMacroID()) { + StringRef MacroName = + Lexer::getImmediateMacroName(S->getBeginLoc(), *Result.SourceManager, + getLangOpts()); + if (MacroName.contains_lower("assert")) + return; + } + if (isControlStatement(S)) + return; + + if (isNoReturnCallStatement(S)) + return; + + if (const auto *CondOp = dyn_cast(S)) { + if (isNoReturnCallStatement(CondOp->getLHS()) || + isNoReturnCallStatement(CondOp->getRHS())) + return; + } + + const FieldDecl *Field; + const Expr *InitValue; + std::tie(Field, InitValue) = isAssignmentToMemberOf(Class, S); + if (Field) { + if (IsUseDefaultMemberInitEnabled && getLangOpts().CPlusPlus11 && + Ctor->isDefaultConstructor() && + (getLangOpts().CPlusPlus20 || !Field->isBitField()) && + (!isa(Class->getDeclContext()) || + !cast(Class->getDeclContext())->isUnion()) && + shouldBeDefaultMemberInitializer(InitValue)) { + auto Diag = + diag(S->getBeginLoc(), "%0 should be initialized in an in-class" + " default member initializer") + << Field; + + SourceLocation FieldEnd = + Lexer::getLocForEndOfToken(Field->getSourceRange().getEnd(), 0, + *Result.SourceManager, getLangOpts()); + Diag << FixItHint::CreateInsertion(FieldEnd, + UseAssignment ? " = " : "{") + << FixItHint::CreateInsertionFromRange( + FieldEnd, + CharSourceRange(InitValue->getSourceRange(), true)) + << FixItHint::CreateInsertion(FieldEnd, UseAssignment ? "" : "}"); + + SourceLocation SemiColonEnd = + Lexer::findNextToken(S->getEndLoc(), *Result.SourceManager, + getLangOpts()) + ->getEndLoc(); + CharSourceRange StmtRange = + CharSourceRange::getCharRange(S->getBeginLoc(), SemiColonEnd); + + Diag << FixItHint::CreateRemoval(StmtRange); + } else { + auto Diag = + diag(S->getBeginLoc(), "%0 should be initialized in a member" + " initializer of the constructor") + << Field; + + bool AddComma = false; + if (!Ctor->getNumCtorInitializers() && FirstToCtorInits) { + SourceLocation BodyPos = Ctor->getBody()->getBeginLoc(); + SourceLocation NextPos = Ctor->getBeginLoc(); + do { + InsertPos = NextPos; + NextPos = Lexer::findNextToken(NextPos, *Result.SourceManager, + getLangOpts()) + ->getLocation(); + } while (NextPos != BodyPos); + InsertPos = Lexer::getLocForEndOfToken( + InsertPos, 0, *Result.SourceManager, getLangOpts()); + + Diag << FixItHint::CreateInsertion(InsertPos, " : "); + } else { + bool Found = false; + for (const auto *Init : Ctor->inits()) { + if (Init->isMemberInitializer()) { + if (Result.SourceManager->isBeforeInTranslationUnit( + Field->getLocation(), Init->getMember()->getLocation())) { + InsertPos = Init->getSourceLocation(); + Found = true; + break; + } + } + } + + if (!Found) { + if (Ctor->getNumCtorInitializers()) { + InsertPos = Lexer::getLocForEndOfToken( + (*Ctor->init_rbegin())->getSourceRange().getEnd(), 0, + *Result.SourceManager, getLangOpts()); + } + Diag << FixItHint::CreateInsertion(InsertPos, ", "); + } else { + AddComma = true; + } + } + Diag << FixItHint::CreateInsertion(InsertPos, Field->getName()) + << FixItHint::CreateInsertion(InsertPos, "(") + << FixItHint::CreateInsertionFromRange( + InsertPos, + CharSourceRange(InitValue->getSourceRange(), true)) + << FixItHint::CreateInsertion(InsertPos, ")"); + if (AddComma) + Diag << FixItHint::CreateInsertion(InsertPos, ", "); + + SourceLocation SemiColonEnd = + Lexer::findNextToken(S->getEndLoc(), *Result.SourceManager, + getLangOpts()) + ->getEndLoc(); + CharSourceRange StmtRange = + CharSourceRange::getCharRange(S->getBeginLoc(), SemiColonEnd); + + Diag << FixItHint::CreateRemoval(StmtRange); + FirstToCtorInits = false; + } + } + } +} + +} // namespace cppcoreguidelines +} // namespace tidy +} // namespace clang diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/PreferMemberInitializerCheck.h b/clang-tools-extra/clang-tidy/cppcoreguidelines/PreferMemberInitializerCheck.h new file mode 100644 index 000000000000..dbef7c98d8e3 --- /dev/null +++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/PreferMemberInitializerCheck.h @@ -0,0 +1,41 @@ +//===--- PreferMemberInitializerCheck.h - clang-tidy ------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CPPCOREGUIDELINES_PREFERMEMBERINITIALIZERCHECK_H +#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CPPCOREGUIDELINES_PREFERMEMBERINITIALIZERCHECK_H + +#include "../ClangTidyCheck.h" + +namespace clang { +namespace tidy { +namespace cppcoreguidelines { + +/// Finds member initializations in the constructor body which can be placed +/// into the initialization list instead. +/// +/// For the user-facing documentation see: +/// http://clang.llvm.org/extra/clang-tidy/checks/cppcoreguidelines-prefer-member-initializer.html +class PreferMemberInitializerCheck : public ClangTidyCheck { +public: + PreferMemberInitializerCheck(StringRef Name, ClangTidyContext *Context); + bool isLanguageVersionSupported(const LangOptions &LangOpts) const override { + return LangOpts.CPlusPlus; + } + void storeOptions(ClangTidyOptions::OptionMap &Opts) override; + void registerMatchers(ast_matchers::MatchFinder *Finder) override; + void check(const ast_matchers::MatchFinder::MatchResult &Result) override; + + const bool IsUseDefaultMemberInitEnabled; + const bool UseAssignment; +}; + +} // namespace cppcoreguidelines +} // namespace tidy +} // namespace clang + +#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CPPCOREGUIDELINES_PREFERMEMBERINITIALIZERCHECK_H diff --git a/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp b/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp index 867b074ca6db..d33040a00e15 100644 --- a/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp +++ b/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp @@ -352,10 +352,6 @@ static bool isParamInMainLikeFunction(const ParmVarDecl &ParmDecl, return false; if (FDecl->getAccess() != AS_public && FDecl->getAccess() != AS_none) return false; - // If the function doesn't have a name thats an identifier, can occur of the - // function is an operator overload, bail out early. - if (!FDecl->getDeclName().isIdentifier()) - return false; enum MainType { None, Main, WMain }; auto IsCharPtrPtr = [](QualType QType) -> MainType { if (QType.isNull()) diff --git a/clang-tools-extra/clangd/ClangdLSPServer.cpp b/clang-tools-extra/clangd/ClangdLSPServer.cpp index 35aed2166f03..dc89ebd59fe2 100644 --- a/clang-tools-extra/clangd/ClangdLSPServer.cpp +++ b/clang-tools-extra/clangd/ClangdLSPServer.cpp @@ -510,11 +510,6 @@ void ClangdLSPServer::onInitialize(const InitializeParams &Params, "semanticTokens request, choosing the latter (no notifications)."); Opts.TheiaSemanticHighlighting = false; } - if (Opts.TheiaSemanticHighlighting) { - log("Using legacy semanticHighlights notification, which will be removed " - "in clangd 13. Clients should use the standard semanticTokens " - "request instead."); - } if (Params.rootUri && *Params.rootUri) Opts.WorkspaceRoot = std::string(Params.rootUri->file()); diff --git a/clang-tools-extra/clangd/Config.h b/clang-tools-extra/clangd/Config.h index 391632cb086a..44ca283b6a0e 100644 --- a/clang-tools-extra/clangd/Config.h +++ b/clang-tools-extra/clangd/Config.h @@ -90,13 +90,6 @@ struct Config { struct { bool SuppressAll = false; llvm::StringSet<> Suppress; - - /// Configures what clang-tidy checks to run and options to use with them. - struct { - // A comma-seperated list of globs specify which clang-tidy checks to run. - std::string Checks; - llvm::StringMap CheckOptions; - } ClangTidy; } Diagnostics; /// Style of the codebase. @@ -106,6 +99,14 @@ struct Config { // ::). All nested namespaces are affected as well. std::vector FullyQualifiedNamespaces; } Style; + + /// Configures what clang-tidy checks to run and options to use with them. + struct { + // A comma-seperated list of globs to specify which clang-tidy checks to + // run. + std::string Checks; + llvm::StringMap CheckOptions; + } ClangTidy; }; } // namespace clangd diff --git a/clang-tools-extra/clangd/ConfigCompile.cpp b/clang-tools-extra/clangd/ConfigCompile.cpp index 7d5466778a81..e82c6e159421 100644 --- a/clang-tools-extra/clangd/ConfigCompile.cpp +++ b/clang-tools-extra/clangd/ConfigCompile.cpp @@ -31,7 +31,6 @@ #include "Features.inc" #include "TidyProvider.h" #include "support/Logger.h" -#include "support/Path.h" #include "support/Trace.h" #include "llvm/ADT/None.h" #include "llvm/ADT/Optional.h" @@ -101,13 +100,10 @@ struct FragmentCompiler { llvm::SourceMgr *SourceMgr; // Normalized Fragment::SourceInfo::Directory. std::string FragmentDirectory; - bool Trusted = false; - llvm::Optional - compileRegex(const Located &Text, - llvm::Regex::RegexFlags Flags = llvm::Regex::NoFlags) { + llvm::Optional compileRegex(const Located &Text) { std::string Anchored = "^(" + *Text + ")$"; - llvm::Regex Result(Anchored, Flags); + llvm::Regex Result(Anchored); std::string RegexError; if (!Result.isValid(RegexError)) { diag(Error, "Invalid regex " + Anchored + ": " + RegexError, Text.Range); @@ -184,7 +180,6 @@ struct FragmentCompiler { } void compile(Fragment &&F) { - Trusted = F.Source.Trusted; if (!F.Source.Directory.empty()) { FragmentDirectory = llvm::sys::path::convert_to_slash(F.Source.Directory); if (FragmentDirectory.back() != '/') @@ -194,21 +189,16 @@ struct FragmentCompiler { compile(std::move(F.CompileFlags)); compile(std::move(F.Index)); compile(std::move(F.Diagnostics)); + compile(std::move(F.ClangTidy)); } void compile(Fragment::IfBlock &&F) { if (F.HasUnrecognizedCondition) Out.Conditions.push_back([&](const Params &) { return false; }); -#ifdef CLANGD_PATH_CASE_INSENSITIVE - llvm::Regex::RegexFlags Flags = llvm::Regex::IgnoreCase; -#else - llvm::Regex::RegexFlags Flags = llvm::Regex::NoFlags; -#endif - auto PathMatch = std::make_unique>(); for (auto &Entry : F.PathMatch) { - if (auto RE = compileRegex(Entry, Flags)) + if (auto RE = compileRegex(Entry)) PathMatch->push_back(std::move(*RE)); } if (!PathMatch->empty()) { @@ -229,7 +219,7 @@ struct FragmentCompiler { auto PathExclude = std::make_unique>(); for (auto &Entry : F.PathExclude) { - if (auto RE = compileRegex(Entry, Flags)) + if (auto RE = compileRegex(Entry)) PathExclude->push_back(std::move(*RE)); } if (!PathExclude->empty()) { @@ -321,18 +311,10 @@ struct FragmentCompiler { void compile(Fragment::IndexBlock::ExternalBlock &&External, llvm::SMRange BlockRange) { - if (External.Server && !Trusted) { - diag(Error, - "Remote index may not be specified by untrusted configuration. " - "Copy this into user config to use it.", - External.Server->Range); - return; - } #ifndef CLANGD_ENABLE_REMOTE if (External.Server) { - elog("Clangd isn't compiled with remote index support, ignoring Server: " - "{0}", - *External.Server); + diag(Error, "Clangd isn't compiled with remote index support, ignoring " + "Server." External.Server->Range); External.Server.reset(); } #endif @@ -368,8 +350,7 @@ struct FragmentCompiler { return; Spec.MountPoint = std::move(*AbsPath); Out.Apply.push_back([Spec(std::move(Spec))](const Params &P, Config &C) { - if (P.Path.empty() || !pathStartsWith(Spec.MountPoint, P.Path, - llvm::sys::path::Style::posix)) + if (!P.Path.startswith(Spec.MountPoint)) return; C.Index.External = Spec; // Disable background indexing for the files under the mountpoint. @@ -398,8 +379,6 @@ struct FragmentCompiler { for (llvm::StringRef N : Normalized) C.Diagnostics.Suppress.insert(N); }); - - compile(std::move(F.ClangTidy)); } void compile(Fragment::StyleBlock &&F) { @@ -443,7 +422,7 @@ struct FragmentCompiler { CurSpec += Str; } - void compile(Fragment::DiagnosticsBlock::ClangTidyBlock &&F) { + void compile(Fragment::ClangTidyBlock &&F) { std::string Checks; for (auto &CheckGlob : F.Add) appendTidyCheckSpec(Checks, CheckGlob, true); @@ -454,9 +433,8 @@ struct FragmentCompiler { if (!Checks.empty()) Out.Apply.push_back( [Checks = std::move(Checks)](const Params &, Config &C) { - C.Diagnostics.ClangTidy.Checks.append( - Checks, - C.Diagnostics.ClangTidy.Checks.empty() ? /*skip comma*/ 1 : 0, + C.ClangTidy.Checks.append( + Checks, C.ClangTidy.Checks.empty() ? /*skip comma*/ 1 : 0, std::string::npos); }); if (!F.CheckOptions.empty()) { @@ -467,8 +445,8 @@ struct FragmentCompiler { Out.Apply.push_back( [CheckOptions = std::move(CheckOptions)](const Params &, Config &C) { for (auto &StringPair : CheckOptions) - C.Diagnostics.ClangTidy.CheckOptions.insert_or_assign( - StringPair.first, StringPair.second); + C.ClangTidy.CheckOptions.insert_or_assign(StringPair.first, + StringPair.second); }); } } @@ -498,8 +476,8 @@ CompiledFragment Fragment::compile(DiagnosticCallback D) && { trace::Span Tracer("ConfigCompile"); SPAN_ATTACH(Tracer, "ConfigFile", ConfigFile); auto Result = std::make_shared(); - vlog("Config fragment: compiling {0}:{1} -> {2} (trusted={3})", ConfigFile, - LineCol.first, Result.get(), Source.Trusted); + vlog("Config fragment: compiling {0}:{1} -> {2}", ConfigFile, LineCol.first, + Result.get()); FragmentCompiler{*Result, D, Source.Manager.get()}.compile(std::move(*this)); // Return as cheaply-copyable wrapper. diff --git a/clang-tools-extra/clangd/ConfigFragment.h b/clang-tools-extra/clangd/ConfigFragment.h index c98ca3a2dd52..5b67c49fe154 100644 --- a/clang-tools-extra/clangd/ConfigFragment.h +++ b/clang-tools-extra/clangd/ConfigFragment.h @@ -94,9 +94,6 @@ struct Fragment { /// Absolute path to directory the fragment is associated with. Relative /// paths mentioned in the fragment are resolved against this. std::string Directory; - /// Whether this fragment is allowed to make critical security/privacy - /// decisions. - bool Trusted = false; }; SourceInfo Source; @@ -206,29 +203,6 @@ struct Fragment { /// (e.g. by disabling a clang-tidy check, or the -Wunused compile flag). /// This often has other advantages, such as skipping some analysis. std::vector> Suppress; - - /// Controls how clang-tidy will run over the code base. - /// - /// The settings are merged with any settings found in .clang-tidy - /// configiration files with these ones taking precedence. - struct ClangTidyBlock { - std::vector> Add; - /// List of checks to disable. - /// Takes precedence over Add. To enable all llvm checks except include - /// order: - /// Add: llvm-* - /// Remove: llvm-include-onder - std::vector> Remove; - - /// A Key-Value pair list of options to pass to clang-tidy checks - /// These take precedence over options specified in clang-tidy - /// configuration files. Example: - /// CheckOptions: - /// readability-braces-around-statements.ShortStatementLines: 2 - std::vector, Located>> - CheckOptions; - }; - ClangTidyBlock ClangTidy; }; DiagnosticsBlock Diagnostics; @@ -241,6 +215,30 @@ struct Fragment { std::vector> FullyQualifiedNamespaces; }; StyleBlock Style; + + /// Controls how clang-tidy will run over the code base. + /// + /// The settings are merged with any settings found in .clang-tidy + /// configiration files with these ones taking precedence. + // FIXME: move this to Diagnostics.Tidy. + struct ClangTidyBlock { + std::vector> Add; + /// List of checks to disable. + /// Takes precedence over Add. To enable all llvm checks except include + /// order: + /// Add: llvm-* + /// Remove: llvm-include-onder + std::vector> Remove; + + /// A Key-Value pair list of options to pass to clang-tidy checks + /// These take precedence over options specified in clang-tidy configuration + /// files. Example: + /// CheckOptions: + /// readability-braces-around-statements.ShortStatementLines: 2 + std::vector, Located>> + CheckOptions; + }; + ClangTidyBlock ClangTidy; }; } // namespace config diff --git a/clang-tools-extra/clangd/ConfigProvider.cpp b/clang-tools-extra/clangd/ConfigProvider.cpp index 6dfb00b14fc6..05b2ba50566d 100644 --- a/clang-tools-extra/clangd/ConfigProvider.cpp +++ b/clang-tools-extra/clangd/ConfigProvider.cpp @@ -34,7 +34,7 @@ public: : FileCache(Path), Directory(Directory) {} void get(const ThreadsafeFS &TFS, DiagnosticCallback DC, - std::chrono::steady_clock::time_point FreshTime, bool Trusted, + std::chrono::steady_clock::time_point FreshTime, std::vector &Out) const { read( TFS, FreshTime, @@ -43,7 +43,6 @@ public: if (Data) for (auto &Fragment : Fragment::parseYAML(*Data, path(), DC)) { Fragment.Source.Directory = Directory; - Fragment.Source.Trusted = Trusted; CachedValue.push_back(std::move(Fragment).compile(DC)); } }, @@ -53,38 +52,35 @@ public: std::unique_ptr Provider::fromYAMLFile(llvm::StringRef AbsPath, llvm::StringRef Directory, - const ThreadsafeFS &FS, - bool Trusted) { + const ThreadsafeFS &FS) { class AbsFileProvider : public Provider { mutable FileConfigCache Cache; // threadsafe const ThreadsafeFS &FS; - bool Trusted; std::vector getFragments(const Params &P, DiagnosticCallback DC) const override { std::vector Result; - Cache.get(FS, DC, P.FreshTime, Trusted, Result); + Cache.get(FS, DC, P.FreshTime, Result); return Result; }; public: AbsFileProvider(llvm::StringRef Path, llvm::StringRef Directory, - const ThreadsafeFS &FS, bool Trusted) - : Cache(Path, Directory), FS(FS), Trusted(Trusted) { + const ThreadsafeFS &FS) + : Cache(Path, Directory), FS(FS) { assert(llvm::sys::path::is_absolute(Path)); } }; - return std::make_unique(AbsPath, Directory, FS, Trusted); + return std::make_unique(AbsPath, Directory, FS); } std::unique_ptr Provider::fromAncestorRelativeYAMLFiles(llvm::StringRef RelPath, - const ThreadsafeFS &FS, bool Trusted) { + const ThreadsafeFS &FS) { class RelFileProvider : public Provider { std::string RelPath; const ThreadsafeFS &FS; - bool Trusted; mutable std::mutex Mu; // Keys are the (posix-style) ancestor directory, not the config within it. @@ -132,19 +128,18 @@ Provider::fromAncestorRelativeYAMLFiles(llvm::StringRef RelPath, // This will take a (per-file) lock for each file that actually exists. std::vector Result; for (FileConfigCache *Cache : Caches) - Cache->get(FS, DC, P.FreshTime, Trusted, Result); + Cache->get(FS, DC, P.FreshTime, Result); return Result; }; public: - RelFileProvider(llvm::StringRef RelPath, const ThreadsafeFS &FS, - bool Trusted) - : RelPath(RelPath), FS(FS), Trusted(Trusted) { + RelFileProvider(llvm::StringRef RelPath, const ThreadsafeFS &FS) + : RelPath(RelPath), FS(FS) { assert(llvm::sys::path::is_relative(RelPath)); } }; - return std::make_unique(RelPath, FS, Trusted); + return std::make_unique(RelPath, FS); } std::unique_ptr diff --git a/clang-tools-extra/clangd/ConfigProvider.h b/clang-tools-extra/clangd/ConfigProvider.h index 428438b67f14..25d9450f28a7 100644 --- a/clang-tools-extra/clangd/ConfigProvider.h +++ b/clang-tools-extra/clangd/ConfigProvider.h @@ -69,8 +69,7 @@ public: /// Directory will be used to resolve relative paths in the fragments. static std::unique_ptr fromYAMLFile(llvm::StringRef AbsPath, llvm::StringRef Directory, - const ThreadsafeFS &, - bool Trusted = false); + const ThreadsafeFS &); // Reads fragments from YAML files found relative to ancestors of Params.Path. // // All fragments that exist are returned, starting from distant ancestors. @@ -79,8 +78,7 @@ public: // // If Params does not specify a path, no fragments are returned. static std::unique_ptr - fromAncestorRelativeYAMLFiles(llvm::StringRef RelPath, const ThreadsafeFS &, - bool Trusted = false); + fromAncestorRelativeYAMLFiles(llvm::StringRef RelPath, const ThreadsafeFS &); /// A provider that includes fragments from all the supplied providers. /// Order is preserved; later providers take precedence over earlier ones. diff --git a/clang-tools-extra/clangd/ConfigYAML.cpp b/clang-tools-extra/clangd/ConfigYAML.cpp index 348ee9dd1f75..7aaff5565497 100644 --- a/clang-tools-extra/clangd/ConfigYAML.cpp +++ b/clang-tools-extra/clangd/ConfigYAML.cpp @@ -62,7 +62,7 @@ public: Dict.handle("CompileFlags", [&](Node &N) { parse(F.CompileFlags, N); }); Dict.handle("Index", [&](Node &N) { parse(F.Index, N); }); Dict.handle("Style", [&](Node &N) { parse(F.Style, N); }); - Dict.handle("Diagnostics", [&](Node &N) { parse(F.Diagnostics, N); }); + Dict.handle("ClangTidy", [&](Node &N) { parse(F.ClangTidy, N); }); Dict.parse(N); return !(N.failed() || HadError); } @@ -110,17 +110,7 @@ private: Dict.parse(N); } - void parse(Fragment::DiagnosticsBlock &F, Node &N) { - DictParser Dict("Diagnostics", this); - Dict.handle("Suppress", [&](Node &N) { - if (auto Values = scalarValues(N)) - F.Suppress = std::move(*Values); - }); - Dict.handle("ClangTidy", [&](Node &N) { parse(F.ClangTidy, N); }); - Dict.parse(N); - } - - void parse(Fragment::DiagnosticsBlock::ClangTidyBlock &F, Node &N) { + void parse(Fragment::ClangTidyBlock &F, Node &N) { DictParser Dict("ClangTidy", this); Dict.handle("Add", [&](Node &N) { if (auto Values = scalarValues(N)) diff --git a/clang-tools-extra/clangd/GlobalCompilationDatabase.cpp b/clang-tools-extra/clangd/GlobalCompilationDatabase.cpp index a38c8a57d161..1a5379acfe7d 100644 --- a/clang-tools-extra/clangd/GlobalCompilationDatabase.cpp +++ b/clang-tools-extra/clangd/GlobalCompilationDatabase.cpp @@ -34,7 +34,6 @@ #include #include #include -#include #include #include #include @@ -396,6 +395,20 @@ DirectoryBasedGlobalCompilationDatabase::getCompileCommand(PathRef File) const { return None; } +// For platforms where paths are case-insensitive (but case-preserving), +// we need to do case-insensitive comparisons and use lowercase keys. +// FIXME: Make Path a real class with desired semantics instead. +// This class is not the only place this problem exists. +// FIXME: Mac filesystems default to case-insensitive, but may be sensitive. + +static std::string maybeCaseFoldPath(PathRef Path) { +#if defined(_WIN32) || defined(__APPLE__) + return Path.lower(); +#else + return std::string(Path); +#endif +} + std::vector DirectoryBasedGlobalCompilationDatabase::getDirectoryCaches( llvm::ArrayRef Dirs) const { @@ -554,10 +567,7 @@ public: } ~BroadcastThread() { - { - std::lock_guard Lock(Mu); - ShouldStop.store(true, std::memory_order_release); - } + ShouldStop.store(true, std::memory_order_release); CV.notify_all(); Thread.join(); } diff --git a/clang-tools-extra/clangd/ParsedAST.cpp b/clang-tools-extra/clangd/ParsedAST.cpp index 1020282f5ee8..403d3fe3e64f 100644 --- a/clang-tools-extra/clangd/ParsedAST.cpp +++ b/clang-tools-extra/clangd/ParsedAST.cpp @@ -316,8 +316,8 @@ ParsedAST::build(llvm::StringRef Filename, const ParseInputs &Inputs, Check->registerMatchers(&CTFinder); } - const Config& Cfg = Config::current(); - ASTDiags.setLevelAdjuster([&](DiagnosticsEngine::Level DiagLevel, + ASTDiags.setLevelAdjuster([&, &Cfg(Config::current())]( + DiagnosticsEngine::Level DiagLevel, const clang::Diagnostic &Info) { if (Cfg.Diagnostics.SuppressAll || isBuiltinDiagnosticSuppressed(Info.getID(), Cfg.Diagnostics.Suppress)) diff --git a/clang-tools-extra/clangd/Protocol.cpp b/clang-tools-extra/clangd/Protocol.cpp index 76cf813e6808..78110dc0de60 100644 --- a/clang-tools-extra/clangd/Protocol.cpp +++ b/clang-tools-extra/clangd/Protocol.cpp @@ -27,21 +27,6 @@ namespace clang { namespace clangd { -namespace { - -// Helper that doesn't treat `null` and absent fields as failures. -template -bool mapOptOrNull(const llvm::json::Value &Params, llvm::StringLiteral Prop, - T &Out, llvm::json::Path P) { - auto *O = Params.getAsObject(); - assert(O); - auto *V = O->get(Prop); - // Field is missing or null. - if (!V || V->getAsNull().hasValue()) - return true; - return fromJSON(*V, Out, P.field(Prop)); -} -} // namespace char LSPError::ID; @@ -505,7 +490,7 @@ bool fromJSON(const llvm::json::Value &Params, DidChangeTextDocumentParams &R, return O && O.map("textDocument", R.textDocument) && O.map("contentChanges", R.contentChanges) && O.map("wantDiagnostics", R.wantDiagnostics) && - mapOptOrNull(Params, "forceRebuild", R.forceRebuild, P); + O.mapOptional("forceRebuild", R.forceRebuild); } bool fromJSON(const llvm::json::Value &E, FileChangeType &Out, @@ -595,10 +580,10 @@ bool fromJSON(const llvm::json::Value &Params, Diagnostic &R, llvm::json::Path P) { llvm::json::ObjectMapper O(Params, P); return O && O.map("range", R.range) && O.map("message", R.message) && - mapOptOrNull(Params, "severity", R.severity, P) && - mapOptOrNull(Params, "category", R.category, P) && - mapOptOrNull(Params, "code", R.code, P) && - mapOptOrNull(Params, "source", R.source, P); + O.mapOptional("severity", R.severity) && + O.mapOptional("category", R.category) && + O.mapOptional("code", R.code) && O.mapOptional("source", R.source); + return true; } llvm::json::Value toJSON(const PublishDiagnosticsParams &PDP) { @@ -833,7 +818,7 @@ bool fromJSON(const llvm::json::Value &Params, CompletionContext &R, llvm::json::ObjectMapper O(Params, P); int TriggerKind; if (!O || !O.map("triggerKind", TriggerKind) || - !mapOptOrNull(Params, "triggerCharacter", R.triggerCharacter, P)) + !O.mapOptional("triggerCharacter", R.triggerCharacter)) return false; R.triggerKind = static_cast(TriggerKind); return true; @@ -1136,8 +1121,8 @@ bool fromJSON(const llvm::json::Value &Params, ConfigurationSettings &S, llvm::json::ObjectMapper O(Params, P); if (!O) return true; // 'any' type in LSP. - return mapOptOrNull(Params, "compilationDatabaseChanges", - S.compilationDatabaseChanges, P); + return O.mapOptional("compilationDatabaseChanges", + S.compilationDatabaseChanges); } bool fromJSON(const llvm::json::Value &Params, InitializationOptions &Opts, @@ -1148,8 +1133,8 @@ bool fromJSON(const llvm::json::Value &Params, InitializationOptions &Opts, return fromJSON(Params, Opts.ConfigSettings, P) && O.map("compilationDatabasePath", Opts.compilationDatabasePath) && - mapOptOrNull(Params, "fallbackFlags", Opts.fallbackFlags, P) && - mapOptOrNull(Params, "clangdFileStatus", Opts.FileStatus, P); + O.mapOptional("fallbackFlags", Opts.fallbackFlags) && + O.mapOptional("clangdFileStatus", Opts.FileStatus); } bool fromJSON(const llvm::json::Value &E, TypeHierarchyDirection &Out, @@ -1205,11 +1190,10 @@ bool fromJSON(const llvm::json::Value &Params, TypeHierarchyItem &I, return O && O.map("name", I.name) && O.map("kind", I.kind) && O.map("uri", I.uri) && O.map("range", I.range) && O.map("selectionRange", I.selectionRange) && - mapOptOrNull(Params, "detail", I.detail, P) && - mapOptOrNull(Params, "deprecated", I.deprecated, P) && - mapOptOrNull(Params, "parents", I.parents, P) && - mapOptOrNull(Params, "children", I.children, P) && - mapOptOrNull(Params, "data", I.data, P); + O.mapOptional("detail", I.detail) && + O.mapOptional("deprecated", I.deprecated) && + O.mapOptional("parents", I.parents) && + O.mapOptional("children", I.children) && O.mapOptional("data", I.data); } bool fromJSON(const llvm::json::Value &Params, @@ -1254,7 +1238,7 @@ bool fromJSON(const llvm::json::Value &Params, CallHierarchyItem &I, return O && O.map("name", I.name) && O.map("kind", I.kind) && O.map("uri", I.uri) && O.map("range", I.range) && O.map("selectionRange", I.selectionRange) && - mapOptOrNull(Params, "data", I.data, P); + O.mapOptional("data", I.data); } bool fromJSON(const llvm::json::Value &Params, diff --git a/clang-tools-extra/clangd/TidyProvider.cpp b/clang-tools-extra/clangd/TidyProvider.cpp index bcf1cd5a6183..0a9f12221287 100644 --- a/clang-tools-extra/clangd/TidyProvider.cpp +++ b/clang-tools-extra/clangd/TidyProvider.cpp @@ -106,7 +106,7 @@ public: llvm::SmallVector Caches; { std::lock_guard Lock(Mu); - for (auto I = path::rbegin(Parent), E = path::rend(Parent); I != E; ++I) { + for (auto I = path::begin(Parent), E = path::end(Parent); I != E; ++I) { assert(I->end() >= Parent.begin() && I->end() <= Parent.end() && "Canonical path components should be substrings"); llvm::StringRef Ancestor(Parent.begin(), I->end() - Parent.begin()); @@ -255,7 +255,7 @@ TidyProvider disableUnusableChecks(llvm::ArrayRef ExtraBadChecks) { TidyProviderRef provideClangdConfig() { return [](tidy::ClangTidyOptions &Opts, llvm::StringRef) { - const auto &CurTidyConfig = Config::current().Diagnostics.ClangTidy; + const auto &CurTidyConfig = Config::current().ClangTidy; if (!CurTidyConfig.Checks.empty()) mergeCheckList(Opts.Checks, CurTidyConfig.Checks); diff --git a/clang-tools-extra/clangd/quality/CompletionModel.cmake b/clang-tools-extra/clangd/quality/CompletionModel.cmake index dc0c0cde4dab..60c6d2aa8433 100644 --- a/clang-tools-extra/clangd/quality/CompletionModel.cmake +++ b/clang-tools-extra/clangd/quality/CompletionModel.cmake @@ -4,10 +4,9 @@ # ${CMAKE_CURRENT_BINARY_DIR}. The generated header # will define a C++ class called ${cpp_class} - which may be a # namespace-qualified class name. -set(CLANGD_COMPLETION_MODEL_COMPILER ${CMAKE_CURRENT_LIST_DIR}/CompletionModelCodegen.py) function(gen_decision_forest model filename cpp_class) - set(model_compiler ${CLANGD_COMPLETION_MODEL_COMPILER}) - + set(model_compiler ${CMAKE_SOURCE_DIR}/../clang-tools-extra/clangd/quality/CompletionModelCodegen.py) + set(output_dir ${CMAKE_CURRENT_BINARY_DIR}) set(header_file ${output_dir}/${filename}.h) set(cpp_file ${output_dir}/${filename}.cpp) diff --git a/clang-tools-extra/clangd/refactor/Rename.cpp b/clang-tools-extra/clangd/refactor/Rename.cpp index a857b3479871..d3c7da96a441 100644 --- a/clang-tools-extra/clangd/refactor/Rename.cpp +++ b/clang-tools-extra/clangd/refactor/Rename.cpp @@ -68,7 +68,7 @@ llvm::Optional getOtherRefFile(const Decl &D, StringRef MainFile, if (OtherFile) return; if (auto RefFilePath = filePath(R.Location, /*HintFilePath=*/MainFile)) { - if (!pathEqual(*RefFilePath, MainFile)) + if (*RefFilePath != MainFile) OtherFile = *RefFilePath; } }); @@ -474,7 +474,7 @@ findOccurrencesOutsideFile(const NamedDecl &RenameDecl, if ((R.Kind & RefKind::Spelled) == RefKind::Unknown) return; if (auto RefFilePath = filePath(R.Location, /*HintFilePath=*/MainFile)) { - if (!pathEqual(*RefFilePath, MainFile)) + if (*RefFilePath != MainFile) AffectedFiles[*RefFilePath].push_back(toRange(R.Location)); } }); diff --git a/clang-tools-extra/clangd/support/CMakeLists.txt b/clang-tools-extra/clangd/support/CMakeLists.txt index fc7d7a28117b..f0fe073eb136 100644 --- a/clang-tools-extra/clangd/support/CMakeLists.txt +++ b/clang-tools-extra/clangd/support/CMakeLists.txt @@ -23,7 +23,6 @@ add_clang_library(clangdSupport Logger.cpp Markup.cpp MemoryTree.cpp - Path.cpp Shutdown.cpp Threading.cpp ThreadsafeFS.cpp diff --git a/clang-tools-extra/clangd/support/Function.h b/clang-tools-extra/clangd/support/Function.h index 936800d56985..2cac1b1e7f67 100644 --- a/clang-tools-extra/clangd/support/Function.h +++ b/clang-tools-extra/clangd/support/Function.h @@ -51,7 +51,7 @@ public: Subscription &operator=(Subscription &&Other) { // If *this is active, unsubscribe. if (Parent) { - std::lock_guard Lock(Parent->ListenersMu); + std::lock_guard(Parent->ListenersMu); llvm::erase_if(Parent->Listeners, [&](const std::pair &P) { return P.second == ListenerID; diff --git a/clang-tools-extra/clangd/support/Path.cpp b/clang-tools-extra/clangd/support/Path.cpp deleted file mode 100644 index a7907cffe60c..000000000000 --- a/clang-tools-extra/clangd/support/Path.cpp +++ /dev/null @@ -1,39 +0,0 @@ -//===--- Path.cpp -------------------------------------------*- C++-*------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#include "support/Path.h" -#include "llvm/Support/Path.h" -namespace clang { -namespace clangd { - -#ifdef CLANGD_PATH_CASE_INSENSITIVE -std::string maybeCaseFoldPath(PathRef Path) { return Path.lower(); } -bool pathEqual(PathRef A, PathRef B) { return A.equals_lower(B); } -#else // NOT CLANGD_PATH_CASE_INSENSITIVE -std::string maybeCaseFoldPath(PathRef Path) { return Path.str(); } -bool pathEqual(PathRef A, PathRef B) { return A == B; } -#endif // CLANGD_PATH_CASE_INSENSITIVE - -bool pathStartsWith(PathRef Ancestor, PathRef Path, - llvm::sys::path::Style Style) { - assert(llvm::sys::path::is_absolute(Ancestor) && - llvm::sys::path::is_absolute(Path)); - // If ancestor ends with a separator drop that, so that we can match /foo/ as - // a parent of /foo. - if (llvm::sys::path::is_separator(Ancestor.back(), Style)) - Ancestor = Ancestor.drop_back(); - // Ensure Path starts with Ancestor. - if (!pathEqual(Ancestor, Path.take_front(Ancestor.size()))) - return false; - Path = Path.drop_front(Ancestor.size()); - // Then make sure either two paths are equal or Path has a separator - // afterwards. - return Path.empty() || llvm::sys::path::is_separator(Path.front(), Style); -} -} // namespace clangd -} // namespace clang diff --git a/clang-tools-extra/clangd/support/Path.h b/clang-tools-extra/clangd/support/Path.h index 938d7d7e99c9..4d4ad7f49047 100644 --- a/clang-tools-extra/clangd/support/Path.h +++ b/clang-tools-extra/clangd/support/Path.h @@ -10,14 +10,8 @@ #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_SUPPORT_PATH_H #include "llvm/ADT/StringRef.h" -#include "llvm/Support/Path.h" #include -/// Whether current platform treats paths case insensitively. -#if defined(_WIN32) || defined(__APPLE__) -#define CLANGD_PATH_CASE_INSENSITIVE -#endif - namespace clang { namespace clangd { @@ -28,18 +22,6 @@ using Path = std::string; /// signatures. using PathRef = llvm::StringRef; -// For platforms where paths are case-insensitive (but case-preserving), -// we need to do case-insensitive comparisons and use lowercase keys. -// FIXME: Make Path a real class with desired semantics instead. -std::string maybeCaseFoldPath(PathRef Path); -bool pathEqual(PathRef, PathRef); - -/// Checks if \p Ancestor is a proper ancestor of \p Path. This is just a -/// smarter lexical prefix match, e.g: foo/bar/baz doesn't start with foo/./bar. -/// Both \p Ancestor and \p Path must be absolute. -bool pathStartsWith( - PathRef Ancestor, PathRef Path, - llvm::sys::path::Style Style = llvm::sys::path::Style::native); } // namespace clangd } // namespace clang diff --git a/clang-tools-extra/clangd/tool/ClangdMain.cpp b/clang-tools-extra/clangd/tool/ClangdMain.cpp index 99c3d97ce35d..fe69079bfe67 100644 --- a/clang-tools-extra/clangd/tool/ClangdMain.cpp +++ b/clang-tools-extra/clangd/tool/ClangdMain.cpp @@ -831,8 +831,8 @@ clangd accepts flags on the commandline, and in the CLANGD_FLAGS environment var if (llvm::sys::path::user_config_directory(UserConfig)) { llvm::sys::path::append(UserConfig, "clangd", "config.yaml"); vlog("User config file is {0}", UserConfig); - ProviderStack.push_back(config::Provider::fromYAMLFile( - UserConfig, /*Directory=*/"", TFS, /*Trusted=*/true)); + ProviderStack.push_back( + config::Provider::fromYAMLFile(UserConfig, /*Directory=*/"", TFS)); } else { elog("Couldn't determine user config file, not loading"); } diff --git a/clang-tools-extra/clangd/unittests/CMakeLists.txt b/clang-tools-extra/clangd/unittests/CMakeLists.txt index c396c6f5873b..adf4ac827cce 100644 --- a/clang-tools-extra/clangd/unittests/CMakeLists.txt +++ b/clang-tools-extra/clangd/unittests/CMakeLists.txt @@ -93,7 +93,6 @@ add_unittest(ClangdUnitTests ClangdTests TestIndex.cpp TestTU.cpp TestWorkspace.cpp - TidyProviderTests.cpp TypeHierarchyTests.cpp URITests.cpp XRefsTests.cpp @@ -104,7 +103,6 @@ add_unittest(ClangdUnitTests ClangdTests support/FunctionTests.cpp support/MarkupTests.cpp support/MemoryTreeTests.cpp - support/PathTests.cpp support/ThreadingTests.cpp support/TestTracer.cpp support/TraceTests.cpp diff --git a/clang-tools-extra/clangd/unittests/ConfigCompileTests.cpp b/clang-tools-extra/clangd/unittests/ConfigCompileTests.cpp index a3738681bec5..ef24b5d8417f 100644 --- a/clang-tools-extra/clangd/unittests/ConfigCompileTests.cpp +++ b/clang-tools-extra/clangd/unittests/ConfigCompileTests.cpp @@ -99,25 +99,6 @@ TEST_F(ConfigCompileTests, Condition) { Frag.If.PathMatch.emplace_back("ba*r"); EXPECT_FALSE(compileAndApply()); EXPECT_THAT(Diags.Diagnostics, IsEmpty()); - - // Only matches case-insensitively. - Frag = {}; - Frag.If.PathMatch.emplace_back("B.*R"); - EXPECT_THAT(Diags.Diagnostics, IsEmpty()); -#ifdef CLANGD_PATH_CASE_INSENSITIVE - EXPECT_TRUE(compileAndApply()); -#else - EXPECT_FALSE(compileAndApply()); -#endif - - Frag = {}; - Frag.If.PathExclude.emplace_back("B.*R"); - EXPECT_THAT(Diags.Diagnostics, IsEmpty()); -#ifdef CLANGD_PATH_CASE_INSENSITIVE - EXPECT_FALSE(compileAndApply()); -#else - EXPECT_TRUE(compileAndApply()); -#endif } TEST_F(ConfigCompileTests, CompileCommands) { @@ -278,36 +259,32 @@ TEST_F(ConfigCompileTests, DiagnosticSuppression) { } TEST_F(ConfigCompileTests, Tidy) { - auto &Tidy = Frag.Diagnostics.ClangTidy; - Tidy.Add.emplace_back("bugprone-use-after-move"); - Tidy.Add.emplace_back("llvm-*"); - Tidy.Remove.emplace_back("llvm-include-order"); - Tidy.Remove.emplace_back("readability-*"); - Tidy.CheckOptions.emplace_back( + Frag.ClangTidy.Add.emplace_back("bugprone-use-after-move"); + Frag.ClangTidy.Add.emplace_back("llvm-*"); + Frag.ClangTidy.Remove.emplace_back("llvm-include-order"); + Frag.ClangTidy.Remove.emplace_back("readability-*"); + Frag.ClangTidy.CheckOptions.emplace_back( std::make_pair(std::string("StrictMode"), std::string("true"))); - Tidy.CheckOptions.emplace_back(std::make_pair( + Frag.ClangTidy.CheckOptions.emplace_back(std::make_pair( std::string("example-check.ExampleOption"), std::string("0"))); EXPECT_TRUE(compileAndApply()); EXPECT_EQ( - Conf.Diagnostics.ClangTidy.Checks, + Conf.ClangTidy.Checks, "bugprone-use-after-move,llvm-*,-llvm-include-order,-readability-*"); - EXPECT_EQ(Conf.Diagnostics.ClangTidy.CheckOptions.size(), 2U); - EXPECT_EQ(Conf.Diagnostics.ClangTidy.CheckOptions.lookup("StrictMode"), - "true"); - EXPECT_EQ(Conf.Diagnostics.ClangTidy.CheckOptions.lookup( - "example-check.ExampleOption"), + EXPECT_EQ(Conf.ClangTidy.CheckOptions.size(), 2U); + EXPECT_EQ(Conf.ClangTidy.CheckOptions.lookup("StrictMode"), "true"); + EXPECT_EQ(Conf.ClangTidy.CheckOptions.lookup("example-check.ExampleOption"), "0"); EXPECT_THAT(Diags.Diagnostics, IsEmpty()); } TEST_F(ConfigCompileTests, TidyBadChecks) { - auto &Tidy = Frag.Diagnostics.ClangTidy; - Tidy.Add.emplace_back("unknown-check"); - Tidy.Remove.emplace_back("*"); - Tidy.Remove.emplace_back("llvm-includeorder"); + Frag.ClangTidy.Add.emplace_back("unknown-check"); + Frag.ClangTidy.Remove.emplace_back("*"); + Frag.ClangTidy.Remove.emplace_back("llvm-includeorder"); EXPECT_TRUE(compileAndApply()); // Ensure bad checks are stripped from the glob. - EXPECT_EQ(Conf.Diagnostics.ClangTidy.Checks, "-*"); + EXPECT_EQ(Conf.ClangTidy.Checks, "-*"); EXPECT_THAT( Diags.Diagnostics, ElementsAre( @@ -318,35 +295,21 @@ TEST_F(ConfigCompileTests, TidyBadChecks) { DiagKind(llvm::SourceMgr::DK_Warning)))); } -TEST_F(ConfigCompileTests, ExternalServerNeedsTrusted) { - Fragment::IndexBlock::ExternalBlock External; - External.Server.emplace("xxx"); - Frag.Index.External = std::move(External); - compileAndApply(); - EXPECT_THAT( - Diags.Diagnostics, - ElementsAre(DiagMessage( - "Remote index may not be specified by untrusted configuration. " - "Copy this into user config to use it."))); - EXPECT_FALSE(Conf.Index.External.hasValue()); -} - TEST_F(ConfigCompileTests, ExternalBlockWarnOnMultipleSource) { - Frag.Source.Trusted = true; Fragment::IndexBlock::ExternalBlock External; External.File.emplace(""); External.Server.emplace(""); Frag.Index.External = std::move(External); compileAndApply(); + llvm::StringLiteral ExpectedDiag = #ifdef CLANGD_ENABLE_REMOTE - EXPECT_THAT( - Diags.Diagnostics, - Contains(AllOf(DiagMessage("Exactly one of File or Server must be set."), - DiagKind(llvm::SourceMgr::DK_Error)))); + "Exactly one of File or Server must be set."; #else - ASSERT_TRUE(Conf.Index.External.hasValue()); - EXPECT_EQ(Conf.Index.External->Kind, Config::ExternalIndexSpec::File); + "Clangd isn't compiled with remote index support, ignoring Server."; #endif + EXPECT_THAT(Diags.Diagnostics, + Contains(AllOf(DiagMessage(ExpectedDiag), + DiagKind(llvm::SourceMgr::DK_Error)))); } TEST_F(ConfigCompileTests, ExternalBlockErrOnNoSource) { @@ -439,23 +402,6 @@ TEST_F(ConfigCompileTests, ExternalBlockMountPoint) { ASSERT_THAT(Diags.Diagnostics, IsEmpty()); ASSERT_TRUE(Conf.Index.External); EXPECT_THAT(Conf.Index.External->MountPoint, FooPath); - - // Only matches case-insensitively. - BazPath = testPath("fOo/baz.h", llvm::sys::path::Style::posix); - BazPath = llvm::sys::path::convert_to_slash(BazPath); - Parm.Path = BazPath; - - FooPath = testPath("FOO/", llvm::sys::path::Style::posix); - FooPath = llvm::sys::path::convert_to_slash(FooPath); - Frag = GetFrag("", FooPath.c_str()); - compileAndApply(); - ASSERT_THAT(Diags.Diagnostics, IsEmpty()); -#ifdef CLANGD_PATH_CASE_INSENSITIVE - ASSERT_TRUE(Conf.Index.External); - EXPECT_THAT(Conf.Index.External->MountPoint, FooPath); -#else - ASSERT_FALSE(Conf.Index.External); -#endif } } // namespace } // namespace config diff --git a/clang-tools-extra/clangd/unittests/ConfigYAMLTests.cpp b/clang-tools-extra/clangd/unittests/ConfigYAMLTests.cpp index e1c81344de20..25d468ba604a 100644 --- a/clang-tools-extra/clangd/unittests/ConfigYAMLTests.cpp +++ b/clang-tools-extra/clangd/unittests/ConfigYAMLTests.cpp @@ -60,11 +60,10 @@ CompileFlags: Index: Background: Skip --- -Diagnostics: - ClangTidy: - CheckOptions: - IgnoreMacros: true - example-check.ExampleOption: 0 +ClangTidy: + CheckOptions: + IgnoreMacros: true + example-check.ExampleOption: 0 )yaml"; auto Results = Fragment::parseYAML(YAML, "config.yaml", Diags.callback()); EXPECT_THAT(Diags.Diagnostics, IsEmpty()); @@ -78,7 +77,7 @@ Diagnostics: ASSERT_TRUE(Results[2].Index.Background); EXPECT_EQ("Skip", *Results[2].Index.Background.getValue()); - EXPECT_THAT(Results[3].Diagnostics.ClangTidy.CheckOptions, + EXPECT_THAT(Results[3].ClangTidy.CheckOptions, ElementsAre(PairVal("IgnoreMacros", "true"), PairVal("example-check.ExampleOption", "0"))); } diff --git a/clang-tools-extra/clangd/unittests/RenameTests.cpp b/clang-tools-extra/clangd/unittests/RenameTests.cpp index b2c83a1a4303..4bc03796bb2b 100644 --- a/clang-tools-extra/clangd/unittests/RenameTests.cpp +++ b/clang-tools-extra/clangd/unittests/RenameTests.cpp @@ -1067,52 +1067,6 @@ TEST(RenameTest, Renameable) { } } -MATCHER_P(newText, T, "") { return arg.newText == T; } - -TEST(RenameTest, IndexMergeMainFile) { - Annotations Code("int ^x();"); - TestTU TU = TestTU::withCode(Code.code()); - TU.Filename = "main.cc"; - auto AST = TU.build(); - - auto Main = testPath("main.cc"); - - auto Rename = [&](const SymbolIndex *Idx) { - auto GetDirtyBuffer = [&](PathRef Path) -> llvm::Optional { - return Code.code().str(); // Every file has the same content. - }; - RenameOptions Opts; - Opts.AllowCrossFile = true; - RenameInputs Inputs{Code.point(), "xPrime", AST, Main, - Idx, Opts, GetDirtyBuffer}; - auto Results = rename(Inputs); - EXPECT_TRUE(bool(Results)) << llvm::toString(Results.takeError()); - return std::move(*Results); - }; - - // We do not expect to see duplicated edits from AST vs index. - auto Results = Rename(TU.index().get()); - EXPECT_THAT(Results.GlobalChanges.keys(), ElementsAre(Main)); - EXPECT_THAT(Results.GlobalChanges[Main].asTextEdits(), - ElementsAre(newText("xPrime"))); - - // Sanity check: we do expect to see index results! - TU.Filename = "other.cc"; - Results = Rename(TU.index().get()); - EXPECT_THAT(Results.GlobalChanges.keys(), - UnorderedElementsAre(Main, testPath("other.cc"))); - -#ifdef CLANGD_PATH_CASE_INSENSITIVE - // On case-insensitive systems, no duplicates if AST vs index case differs. - // https://github.com/clangd/clangd/issues/665 - TU.Filename = "MAIN.CC"; - Results = Rename(TU.index().get()); - EXPECT_THAT(Results.GlobalChanges.keys(), ElementsAre(Main)); - EXPECT_THAT(Results.GlobalChanges[Main].asTextEdits(), - ElementsAre(newText("xPrime"))); -#endif -} - TEST(RenameTest, MainFileReferencesOnly) { // filter out references not from main file. llvm::StringRef Test = diff --git a/clang-tools-extra/clangd/unittests/TidyProviderTests.cpp b/clang-tools-extra/clangd/unittests/TidyProviderTests.cpp deleted file mode 100644 index a16c87456a1a..000000000000 --- a/clang-tools-extra/clangd/unittests/TidyProviderTests.cpp +++ /dev/null @@ -1,60 +0,0 @@ -//===-- TidyProviderTests.cpp - Clang tidy configuration provider tests ---===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#include "TestFS.h" -#include "TidyProvider.h" -#include "gtest/gtest.h" - -namespace clang { -namespace clangd { - -namespace { - -TEST(TidyProvider, NestedDirectories) { - MockFS FS; - FS.Files[testPath(".clang-tidy")] = R"yaml( - Checks: 'llvm-*' - CheckOptions: - - key: TestKey - value: 1 -)yaml"; - FS.Files[testPath("sub1/.clang-tidy")] = R"yaml( - Checks: 'misc-*' - CheckOptions: - - key: TestKey - value: 2 -)yaml"; - FS.Files[testPath("sub1/sub2/.clang-tidy")] = R"yaml( - Checks: 'bugprone-*' - CheckOptions: - - key: TestKey - value: 3 - InheritParentConfig: true -)yaml"; - - TidyProvider Provider = provideClangTidyFiles(FS); - - auto BaseOptions = getTidyOptionsForFile(Provider, testPath("File.cpp")); - ASSERT_TRUE(BaseOptions.Checks.hasValue()); - EXPECT_EQ(*BaseOptions.Checks, "llvm-*"); - EXPECT_EQ(BaseOptions.CheckOptions.lookup("TestKey").Value, "1"); - - auto Sub1Options = getTidyOptionsForFile(Provider, testPath("sub1/File.cpp")); - ASSERT_TRUE(Sub1Options.Checks.hasValue()); - EXPECT_EQ(*Sub1Options.Checks, "misc-*"); - EXPECT_EQ(Sub1Options.CheckOptions.lookup("TestKey").Value, "2"); - - auto Sub2Options = - getTidyOptionsForFile(Provider, testPath("sub1/sub2/File.cpp")); - ASSERT_TRUE(Sub2Options.Checks.hasValue()); - EXPECT_EQ(*Sub2Options.Checks, "misc-*,bugprone-*"); - EXPECT_EQ(Sub2Options.CheckOptions.lookup("TestKey").Value, "3"); -} -} // namespace -} // namespace clangd -} // namespace clang diff --git a/clang-tools-extra/clangd/unittests/support/PathTests.cpp b/clang-tools-extra/clangd/unittests/support/PathTests.cpp deleted file mode 100644 index 599c76926d30..000000000000 --- a/clang-tools-extra/clangd/unittests/support/PathTests.cpp +++ /dev/null @@ -1,37 +0,0 @@ -//===-- PathTests.cpp -------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#include "TestFS.h" -#include "support/Path.h" -#include "gmock/gmock.h" -#include "gtest/gtest.h" - -namespace clang { -namespace clangd { -namespace { -TEST(PathTests, IsAncestor) { - EXPECT_TRUE(pathStartsWith(testPath("foo"), testPath("foo"))); - EXPECT_TRUE(pathStartsWith(testPath("foo/"), testPath("foo"))); - - EXPECT_FALSE(pathStartsWith(testPath("foo"), testPath("fooz"))); - EXPECT_FALSE(pathStartsWith(testPath("foo/"), testPath("fooz"))); - - EXPECT_TRUE(pathStartsWith(testPath("foo"), testPath("foo/bar"))); - EXPECT_TRUE(pathStartsWith(testPath("foo/"), testPath("foo/bar"))); - -#ifdef CLANGD_PATH_CASE_INSENSITIVE - EXPECT_TRUE(pathStartsWith(testPath("fOo"), testPath("foo/bar"))); - EXPECT_TRUE(pathStartsWith(testPath("foo"), testPath("fOo/bar"))); -#else - EXPECT_FALSE(pathStartsWith(testPath("fOo"), testPath("foo/bar"))); - EXPECT_FALSE(pathStartsWith(testPath("foo"), testPath("fOo/bar"))); -#endif -} -} // namespace -} // namespace clangd -} // namespace clang diff --git a/clang-tools-extra/docs/ReleaseNotes.rst b/clang-tools-extra/docs/ReleaseNotes.rst index 29321bb3eb04..2960aad5a556 100644 --- a/clang-tools-extra/docs/ReleaseNotes.rst +++ b/clang-tools-extra/docs/ReleaseNotes.rst @@ -47,9 +47,6 @@ Major New Features Improvements to clangd ---------------------- -Performance -^^^^^^^^^^^ - - clangd's memory usage is significantly reduced on most Linux systems. In particular, memory usage should not increase dramatically over time. @@ -62,172 +59,6 @@ Performance systems can disable this using ``--malloc_trim=0`` or the CMake flag ``-DCLANGD_MALLOC_TRIM=0``. -- Added the `$/memoryUsage request - `_: an LSP extension. - This provides a breakdown of the memory clangd thinks it is using (excluding - malloc overhead etc). The clangd VSCode extension supports showing the memory - usage tree. - -Parsing and selection -^^^^^^^^^^^^^^^^^^^^^ - -- Improved navigation of broken code in C using Recovery AST. (This has been - enabled for C++ since clangd 11). - -- Types are understood more often in broken code. (This is the first release - where Recovery AST preserves speculated types). - -- Heuristic resolution for dependent names in templates. - -Code completion -^^^^^^^^^^^^^^^ - -- Higher priority for symbols that were already used in this file, and symbols - from namespaces mentioned in this file. (Estimated 3% accuracy improvement) - -- Introduced a ranking algorithm trained on snippets from a large C++ codebase. - Use the flag ``--ranking-model=decision_forest`` to try this (Estimated 6% - accuracy improvement). This mode is likely to become the default in future. - - Note: this is a generic model, not specialized for your code. clangd does not - collect any data from your code to train code completion. - -- Signature help works with functions with template-dependent parameter types. - -Go to definition -^^^^^^^^^^^^^^^^ - -- Selecting an ``auto`` or ``decltype`` keyword will attempt to navigate to - a definition of the deduced type. - -- Improved handling of aliases: navigate to the underlying entity more often. - -- Better understanding of declaration vs definition for Objective-C classes and - protocols. - -- Selecting a pure-virtual method shows its overrides. - -Find references -^^^^^^^^^^^^^^^ - -- Indexes are smarter about not returning stale references when code is deleted. - -- References in implementation files are always indexed, so results should be - more complete. - -- Find-references on a virtual method shows references to overridden methods. - -New navigation features -^^^^^^^^^^^^^^^^^^^^^^^ - -- Call hierarchy (``textDocument/callHierarchy``) is supported. - Only incoming calls are available. - -- Go to implementation (``textDocument/implementation``) is supported on - abstract classes, and on virtual methods. - -- Symbol search (``workspace/symbol``) queries may be partially qualified. - That is, typing ``b::Foo`` will match the symbol ``a::b::c::Foo``. - -Refactoring -^^^^^^^^^^^ - -- New refactoring: populate ``switch`` statement with cases. - (This acts as a fix for the ``-Wswitch-enum`` warning). - -- Renaming templates is supported, and many other complex cases were fixed. - -- Attempting to rename to an invalid or conflicting name can produce an error - message rather than broken code. (Not all cases are detected!) - -- The accuracy of many code actions has been improved. - -Hover -^^^^^ - -- Hovers for ``auto`` and ``decltype`` show the type in the same style as other - hovers. ``this`` is also now supported. - -- Displayed type names are more consistent and idiomatic. - -Semantic highlighting -^^^^^^^^^^^^^^^^^^^^^ - -- Inactive preprocessor regions (``#ifdef``) are highlighted as comments. - -- clangd 12 is the last release with support for the non-standard - ``textDocument/semanticHighlights`` notification. Clients sholud migrate to - the ``textDocument/semanticTokens`` request added in LSP 3.16. - -Remote index (alpha) -^^^^^^^^^^^^^^^^^^^^ - -- clangd can now connect to a remote index server instead of building a project - index locally. This saves resources in large codebases that are slow to index. - -- The server program is ``clangd-index-server``, and it consumes index files - produced by ``clangd-indexer``. - -- This feature requires clangd to be built with the CMake flag - ``-DCLANGD_ENABLE_REMOTE=On``, which requires GRPC libraries and is not - enabled by default. Unofficial releases of the remote-index-enabled client - and server tools are at https://github.com/clangd/clangd/releases - -- Large projects can deploy a shared server, and check in a ``.clangd`` file - to enable it (in the ``Index.External`` section). We hope to provide such a - server for ``llvm-project`` itself in the near future. - -Configuration -^^^^^^^^^^^^^ - -- Static and remote indexes can be configured in the ``Index.External`` section. - Different static indexes can now be used for different files. - (Obsoletes the flag ``--index-file``). - -- Diagnostics can be filtered or suppressed in the ``Diagnostics`` section. - -- Clang-tidy checks can be enabled/disabled in the ``Diagnostics.ClangTidy`` - section. (Obsoletes the flag ``--clang-tidy-checks``). - -- The compilation database directory can be configured in the ``CompileFlags`` - section. Different compilation databases can now be specified for different - files. (Obsoletes the flag ``--compile-commands-dir``). - -- Errors in loaded configuration files are published as LSP diagnostics, and so - should be shown in your editor. - -`Full reference of configuration options `_ - -System integration -^^^^^^^^^^^^^^^^^^ - -- Changes to ``compile_commands.json`` and ``compile_flags.txt`` will take - effect the next time a file is parsed, without restarting clangd. - -- ``clangd --check=`` can be run on the command-line to simulate - opening a file without actually using an editor. This can be useful to - reproduce crashes or aother problems. - -- Various fixes to handle filenames correctly (and case-insensitively) on - windows. - -- If incoming LSP messages are malformed, the logs now contain details. - -Miscellaneous -^^^^^^^^^^^^^ - -- "Show AST" request - (`textDocument/ast `_) - added as an LSP extension. This displays a simplified view of the clang AST - for selected code. The clangd VSCode extension supports this. - -- clangd should no longer crash while loading old or corrupt index files. - -- The flags ``--index``, ``--recovery-ast`` and ``-suggest-missing-includes`` - have been retired. These features are now always enabled. - -- Too many stability and correctness fixes to mention. - Improvements to clang-doc ------------------------- @@ -290,6 +121,12 @@ New checks Finds structs that are inefficiently packed or aligned, and recommends packing and/or aligning of said structs as needed. +- New :doc:`cppcoreguidelines-prefer-member-initializer + ` check. + + Finds member initializations in the constructor body which can be placed into + the initialization list instead. + - New :doc:`bugprone-misplaced-pointer-arithmetic-in-alloc ` check. @@ -358,16 +195,6 @@ Changes in existing checks Added `std::basic_string_view` to default list of ``string``-like types. -Deprecated checks -^^^^^^^^^^^^^^^^^ - -- The :doc:`readability-deleted-default - ` check has been deprecated. - - The clang warning `Wdefaulted-function-deleted - `_ - will diagnose the same issues and is enabled by default. - Improvements to include-fixer ----------------------------- diff --git a/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-prefer-member-initializer.rst b/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-prefer-member-initializer.rst new file mode 100644 index 000000000000..5a5ee3e57a8c --- /dev/null +++ b/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-prefer-member-initializer.rst @@ -0,0 +1,103 @@ +.. title:: clang-tidy - cppcoreguidelines-prefer-member-initializer + +cppcoreguidelines-prefer-member-initializer +=========================================== + +Finds member initializations in the constructor body which can be converted +into member initializers of the constructor instead. This not only improves +the readability of the code but also positively affects its performance. +Class-member assignments inside a control statement or following the first +control statement are ignored. + +This check implements `C.49 `_ from the CppCoreGuidelines. + +If the language version is `C++ 11` or above, the constructor is the default +constructor of the class, the field is not a bitfield (only in case of earlier +language version than `C++ 20`), furthermore the assigned value is a literal, +negated literal or ``enum`` constant then the preferred place of the +initialization is at the class member declaration. + +This latter rule is `C.48 `_ from CppCoreGuidelines. + +Please note, that this check does not enforce this latter rule for +initializations already implemented as member initializers. For that purpose +see check `modernize-use-default-member-init `_. + +Example 1 +--------- + +.. code-block:: c++ + + class C { + int n; + int m; + public: + C() { + n = 1; // Literal in default constructor + if (dice()) + return; + m = 1; + } + }; + +Here ``n`` can be initialized using a default member initializer, unlike +``m``, as ``m``'s initialization follows a control statement (``if``): + +.. code-block:: c++ + + class C { + int n{1}; + int m; + public: + C() { + if (dice()) + return; + m = 1; + } + +Example 2 +--------- + +.. code-block:: c++ + + class C { + int n; + int m; + public: + C(int nn, int mm) { + n = nn; // Neither default constructor nor literal + if (dice()) + return; + m = mm; + } + }; + +Here ``n`` can be initialized in the constructor initialization list, unlike +``m``, as ``m``'s initialization follows a control statement (``if``): + +.. code-block:: c++ + + C(int nn, int mm) : n(nn) { + if (dice()) + return; + m = mm; + } + +.. option:: UseAssignment + + If this option is set to `true` (default is `false`), the check will initialize + members with an assignment. In this case the fix of the first example looks + like this: + +.. code-block:: c++ + + class C { + int n = 1; + int m; + public: + C() { + if (dice()) + return; + m = 1; + } + }; diff --git a/clang-tools-extra/docs/clang-tidy/checks/readability-deleted-default.rst b/clang-tools-extra/docs/clang-tidy/checks/readability-deleted-default.rst index 5f2083e00061..00134eb05484 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/readability-deleted-default.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/readability-deleted-default.rst @@ -3,6 +3,20 @@ readability-deleted-default =========================== -This check has been deprecated prefer to make use of the `Wdefaulted-function-deleted -`_ -flag. +Checks that constructors and assignment operators marked as ``= default`` are +not actually deleted by the compiler. + +.. code-block:: c++ + + class Example { + public: + // This constructor is deleted because I is missing a default value. + Example() = default; + // This is fine. + Example(const Example& Other) = default; + // This operator is deleted because I cannot be assigned (it is const). + Example& operator=(const Example& Other) = default; + + private: + const int I; + }; diff --git a/clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-prefer-member-initializer-modernize-use-default-member-init-assignment.cpp b/clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-prefer-member-initializer-modernize-use-default-member-init-assignment.cpp new file mode 100644 index 000000000000..dc6cb7606a0d --- /dev/null +++ b/clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-prefer-member-initializer-modernize-use-default-member-init-assignment.cpp @@ -0,0 +1,31 @@ +// RUN: %check_clang_tidy %s cppcoreguidelines-prefer-member-initializer,modernize-use-default-member-init %t -- \ +// RUN: -config="{CheckOptions: [{key: modernize-use-default-member-init.UseAssignment, value: 1}]}" + +class Simple1 { + int n; + // CHECK-FIXES: int n = 0; + double x; + // CHECK-FIXES: double x = 0.0; + +public: + Simple1() { + n = 0; + // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: 'n' should be initialized in an in-class default member initializer [cppcoreguidelines-prefer-member-initializer] + // CHECK-FIXES: {{^\ *$}} + x = 0.0; + // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: 'x' should be initialized in an in-class default member initializer [cppcoreguidelines-prefer-member-initializer] + // CHECK-FIXES: {{^\ *$}} + } + + Simple1(int nn, double xx) { + // CHECK-FIXES: Simple1(int nn, double xx) : n(nn), x(xx) { + n = nn; + // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: 'n' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer] + // CHECK-FIXES: {{^\ *$}} + x = xx; + // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: 'x' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer] + // CHECK-FIXES: {{^\ *$}} + } + + ~Simple1() = default; +}; diff --git a/clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-prefer-member-initializer-modernize-use-default-member-init.cpp b/clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-prefer-member-initializer-modernize-use-default-member-init.cpp new file mode 100644 index 000000000000..fe5bb7c3bb98 --- /dev/null +++ b/clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-prefer-member-initializer-modernize-use-default-member-init.cpp @@ -0,0 +1,30 @@ +// RUN: %check_clang_tidy %s cppcoreguidelines-prefer-member-initializer,modernize-use-default-member-init %t + +class Simple1 { + int n; + // CHECK-FIXES: int n{0}; + double x; + // CHECK-FIXES: double x{0.0}; + +public: + Simple1() { + n = 0; + // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: 'n' should be initialized in an in-class default member initializer [cppcoreguidelines-prefer-member-initializer] + // CHECK-FIXES: {{^\ *$}} + x = 0.0; + // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: 'x' should be initialized in an in-class default member initializer [cppcoreguidelines-prefer-member-initializer] + // CHECK-FIXES: {{^\ *$}} + } + + Simple1(int nn, double xx) { + // CHECK-FIXES: Simple1(int nn, double xx) : n(nn), x(xx) { + n = nn; + // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: 'n' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer] + // CHECK-FIXES: {{^\ *$}} + x = xx; + // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: 'x' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer] + // CHECK-FIXES: {{^\ *$}} + } + + ~Simple1() = default; +}; diff --git a/clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-prefer-member-initializer.cpp b/clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-prefer-member-initializer.cpp new file mode 100644 index 000000000000..b5c04c32c9fa --- /dev/null +++ b/clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-prefer-member-initializer.cpp @@ -0,0 +1,490 @@ +// RUN: %check_clang_tidy %s cppcoreguidelines-prefer-member-initializer %t -- -- -fcxx-exceptions + +extern void __assert_fail (__const char *__assertion, __const char *__file, + unsigned int __line, __const char *__function) + __attribute__ ((__noreturn__)); +#define assert(expr) \ + ((expr) ? (void)(0) : __assert_fail (#expr, __FILE__, __LINE__, __func__)) + +class Simple1 { + int n; + double x; + +public: + Simple1() { + // CHECK-FIXES: Simple1() : n(0), x(0.0) { + n = 0; + // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: 'n' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer] + // CHECK-FIXES: {{^\ *$}} + x = 0.0; + // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: 'x' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer] + // CHECK-FIXES: {{^\ *$}} + } + + Simple1(int nn, double xx) { + // CHECK-FIXES: Simple1(int nn, double xx) : n(nn), x(xx) { + n = nn; + // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: 'n' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer] + // CHECK-FIXES: {{^\ *$}} + x = xx; + // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: 'x' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer] + // CHECK-FIXES: {{^\ *$}} + } + + ~Simple1() = default; +}; + +class Simple2 { + int n; + double x; + +public: + Simple2() : n(0) { + // CHECK-FIXES: Simple2() : n(0), x(0.0) { + x = 0.0; + // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: 'x' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer] + // CHECK-FIXES: {{^\ *$}} + } + + Simple2(int nn, double xx) : n(nn) { + // CHECK-FIXES: Simple2(int nn, double xx) : n(nn), x(xx) { + x = xx; + // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: 'x' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer] + // CHECK-FIXES: {{^\ *$}} + } + + ~Simple2() = default; +}; + +class Simple3 { + int n; + double x; + +public: + Simple3() : x(0.0) { + // CHECK-FIXES: Simple3() : n(0), x(0.0) { + n = 0; + // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: 'n' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer] + // CHECK-FIXES: {{^\ *$}} + } + + Simple3(int nn, double xx) : x(xx) { + // CHECK-FIXES: Simple3(int nn, double xx) : n(nn), x(xx) { + n = nn; + // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: 'n' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer] + // CHECK-FIXES: {{^\ *$}} + } + + ~Simple3() = default; +}; + +int something_int(); +double something_double(); + +class Simple4 { + int n; + +public: + Simple4() { + // CHECK-FIXES: Simple4() : n(something_int()) { + n = something_int(); + // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: 'n' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer] + // CHECK-FIXES: {{^\ *$}} + } + + ~Simple4() = default; +}; + +static bool dice(); + +class Complex1 { + int n; + int m; + +public: + Complex1() : n(0) { + if (dice()) + m = 1; + // NO-MESSAGES: initialization of 'm' is nested in a conditional expression + } + + ~Complex1() = default; +}; + +class Complex2 { + int n; + int m; + +public: + Complex2() : n(0) { + if (!dice()) + return; + m = 1; + // NO-MESSAGES: initialization of 'm' follows a conditional expression + } + + ~Complex2() = default; +}; + +class Complex3 { + int n; + int m; + +public: + Complex3() : n(0) { + while (dice()) + m = 1; + // NO-MESSAGES: initialization of 'm' is nested in a conditional loop + } + + ~Complex3() = default; +}; + +class Complex4 { + int n; + int m; + +public: + Complex4() : n(0) { + while (!dice()) + return; + m = 1; + // NO-MESSAGES: initialization of 'm' follows a conditional loop + } + + ~Complex4() = default; +}; + +class Complex5 { + int n; + int m; + +public: + Complex5() : n(0) { + do { + m = 1; + // NO-MESSAGES: initialization of 'm' is nested in a conditional loop + } while (dice()); + } + + ~Complex5() = default; +}; + +class Complex6 { + int n; + int m; + +public: + Complex6() : n(0) { + do { + return; + } while (!dice()); + m = 1; + // NO-MESSAGES: initialization of 'm' follows a conditional loop + } + + ~Complex6() = default; +}; + +class Complex7 { + int n; + int m; + +public: + Complex7() : n(0) { + for (int i = 2; i < 1; ++i) { + m = 1; + } + // NO-MESSAGES: initialization of 'm' is nested into a conditional loop + } + + ~Complex7() = default; +}; + +class Complex8 { + int n; + int m; + +public: + Complex8() : n(0) { + for (int i = 0; i < 2; ++i) { + return; + } + m = 1; + // NO-MESSAGES: initialization of 'm' follows a conditional loop + } + + ~Complex8() = default; +}; + +class Complex9 { + int n; + int m; + +public: + Complex9() : n(0) { + switch (dice()) { + case 1: + m = 1; + // NO-MESSAGES: initialization of 'm' is nested in a conditional expression + break; + default: + break; + } + } + + ~Complex9() = default; +}; + +class Complex10 { + int n; + int m; + +public: + Complex10() : n(0) { + switch (dice()) { + case 1: + return; + break; + default: + break; + } + m = 1; + // NO-MESSAGES: initialization of 'm' follows a conditional expression + } + + ~Complex10() = default; +}; + +class E {}; +int risky(); // may throw + +class Complex11 { + int n; + int m; + +public: + Complex11() : n(0) { + try { + risky(); + m = 1; + // NO-MESSAGES: initialization of 'm' follows is nested in a try-block + } catch (const E& e) { + return; + } + } + + ~Complex11() = default; +}; + +class Complex12 { + int n; + int m; + +public: + Complex12() : n(0) { + try { + risky(); + } catch (const E& e) { + return; + } + m = 1; + // NO-MESSAGES: initialization of 'm' follows a try-block + } + + ~Complex12() = default; +}; + +class Complex13 { + int n; + int m; + +public: + Complex13() : n(0) { + return; + m = 1; + // NO-MESSAGES: initialization of 'm' follows a return statement + } + + ~Complex13() = default; +}; + +class Complex14 { + int n; + int m; + +public: + Complex14() : n(0) { + goto X; + m = 1; + // NO-MESSAGES: initialization of 'm' follows a goto statement + X: + ; + } + + ~Complex14() = default; +}; + +void returning(); + +class Complex15 { + int n; + int m; + +public: + Complex15() : n(0) { + // CHECK-FIXES: Complex15() : n(0), m(1) { + returning(); + m = 1; + // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: 'm' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer] + // CHECK-FIXES: {{^\ *$}} + } + + ~Complex15() = default; +}; + +[[noreturn]] void not_returning(); + +class Complex16 { + int n; + int m; + +public: + Complex16() : n(0) { + not_returning(); + m = 1; + // NO-MESSAGES: initialization of 'm' follows a non-returning function call + } + + ~Complex16() = default; +}; + +class Complex17 { + int n; + int m; + +public: + Complex17() : n(0) { + throw 1; + m = 1; + // NO-MESSAGES: initialization of 'm' follows a 'throw' statement; + } + + ~Complex17() = default; +}; + +class Complex18 { + int n; + +public: + Complex18() try { + n = risky(); + // NO-MESSAGES: initialization of 'n' in a 'try' body; + } catch (const E& e) { + n = 0; + } + + ~Complex18() = default; +}; + +class Complex19 { + int n; +public: + Complex19() { + // CHECK-FIXES: Complex19() : n(0) { + n = 0; + // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: 'n' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer] + // CHECK-FIXES: {{^\ *$}} + } + + explicit Complex19(int) { + // CHECK-FIXES: Complex19(int) : n(12) { + n = 12; + // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: 'n' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer] + // CHECK-FIXES: {{^\ *$}} + } + + ~Complex19() = default; +}; + +class Complex20 { + int n; + int m; + +public: + Complex20(int k) : n(0) { + assert(k > 0); + m = 1; + // NO-MESSAGES: initialization of 'm' follows an assertion + } + + ~Complex20() = default; +}; + +class VeryComplex1 { + int n1, n2, n3; + double x1, x2, x3; + int n4, n5, n6; + double x4, x5, x6; + + VeryComplex1() : n3(something_int()), x3(something_double()), + n5(something_int()), x4(something_double()), + x5(something_double()) { + // CHECK-FIXES: VeryComplex1() : n2(something_int()), n1(something_int()), n3(something_int()), x2(something_double()), x1(something_double()), x3(something_double()), + // CHECK-FIXES: n4(something_int()), n5(something_int()), n6(something_int()), x4(something_double()), + // CHECK-FIXES: x5(something_double()), x6(something_double()) { + +// FIXME: Order of elements on the constructor initializer list should match +// the order of the declaration of the fields. Thus the correct fixes +// should look like these: +// + // C ECK-FIXES: VeryComplex1() : n2(something_int()), n1(something_int()), n3(something_int()), x2(something_double()), x1(something_double()), x3(something_double()), + // C ECK-FIXES: n4(something_int()), n5(something_int()), n6(something_int()), x4(something_double()), + // C ECK-FIXES: x5(something_double()), x6(something_double()) { +// +// However, the Diagnostics Engine processes fixes in the order of the +// diagnostics and insertions to the same position are handled in left to +// right order thus in the case two adjacent fields are initialized +// inside the constructor in reverse order the provided fix is a +// constructor initializer list that does not match the order of the +// declaration of the fields. + + x2 = something_double(); + // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: 'x2' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer] + // CHECK-FIXES: {{^\ *$}} + n2 = something_int(); + // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: 'n2' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer] + // CHECK-FIXES: {{^\ *$}} + x6 = something_double(); + // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: 'x6' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer] + // CHECK-FIXES: {{^\ *$}} + x1 = something_double(); + // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: 'x1' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer] + // CHECK-FIXES: {{^\ *$}} + n6 = something_int(); + // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: 'n6' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer] + // CHECK-FIXES: {{^\ *$}} + n1 = something_int(); + // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: 'n1' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer] + // CHECK-FIXES: {{^\ *$}} + n4 = something_int(); + // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: 'n4' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer] + // CHECK-FIXES: {{^\ *$}} + } +}; + +struct Outside { + int n; + double x; + Outside(); +}; + +Outside::Outside() { + // CHECK-FIXES: Outside::Outside() : n(1), x(1.0) { + n = 1; + // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: 'n' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer] + // CHECK-FIXES: {{^\ *$}} + x = 1.0; + // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: 'x' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer] + // CHECK-FIXES: {{^\ *$}} +} diff --git a/clang-tools-extra/unittests/clang-tidy/CMakeLists.txt b/clang-tools-extra/unittests/clang-tidy/CMakeLists.txt index 05d330dd8033..be35b71d15cf 100644 --- a/clang-tools-extra/unittests/clang-tidy/CMakeLists.txt +++ b/clang-tools-extra/unittests/clang-tidy/CMakeLists.txt @@ -1,6 +1,7 @@ set(LLVM_LINK_COMPONENTS FrontendOpenMP Support + TestingSupport ) get_filename_component(CLANG_LINT_SOURCE_DIR @@ -45,5 +46,4 @@ target_link_libraries(ClangTidyTests clangTidyObjCModule clangTidyReadabilityModule clangTidyUtils - LLVMTestingSupport ) diff --git a/clang/docs/ClangCommandLineReference.rst b/clang/docs/ClangCommandLineReference.rst index 2a9b3fc03123..0ec99315a130 100644 --- a/clang/docs/ClangCommandLineReference.rst +++ b/clang/docs/ClangCommandLineReference.rst @@ -2185,10 +2185,6 @@ Enable stack protectors for all functions Enable stack protectors for some functions vulnerable to stack smashing. Compared to -fstack-protector, this uses a stronger heuristic that includes functions containing arrays of any size (and any type), as well as any calls to alloca or the taking of an address from a local variable -.. option:: -fstack-protector-ret - -Enable stack protectors for all functions with return address check - .. option:: -fstack-size-section, -fno-stack-size-section Emit section containing metadata on function stack sizes diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 460a62734e90..3001d6feb631 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -73,15 +73,31 @@ New Compiler Flags - ... -- AArch64 options ``-moutline-atomics``, ``-mno-outline-atomics`` to enable - and disable calls to helper functions implementing atomic operations. These - out-of-line helpers like '__aarch64_cas8_relax' will detect at runtime - AArch64 Large System Extensions (LSE) availability and either use their - atomic instructions, or falls back to LL/SC loop. These options do not apply - if the compilation target supports LSE. Atomic instructions are used directly - in that case. The option's behaviour mirrors GCC, the helpers are implemented - both in compiler-rt and libgcc. - +- -fpch-codegen and -fpch-debuginfo generate shared code and/or debuginfo + for contents of a precompiled header in a separate object file. This object + file needs to be linked in, but its contents do not need to be generated + for other objects using the precompiled header. This should usually save + compile time. If not using clang-cl, the separate object file needs to + be created explicitly from the precompiled header. + Example of use: + + .. code-block:: console + + $ clang++ -x c++-header header.h -o header.pch -fpch-codegen -fpch-debuginfo + $ clang++ -c header.pch -o shared.o + $ clang++ -c source.cpp -o source.o -include-pch header.pch + $ clang++ -o binary source.o shared.o + + - Using -fpch-instantiate-templates when generating the precompiled header + usually increases the amount of code/debuginfo that can be shared. + - In some cases, especially when building with optimizations enabled, using + -fpch-codegen may generate so much code in the shared object that compiling + it may be a net loss in build time. + - Since headers may bring in private symbols of other libraries, it may be + sometimes necessary to discard unused symbols (such as by adding + -Wl,--gc-sections on ELF platforms to the linking command, and possibly + adding -fdata-sections -ffunction-sections to the command generating + the shared object). - New option ``-fbinutils-version=`` specifies the targeted binutils version. For example, ``-fbinutils-version=2.35`` means compatibility with GNU as/ld before 2.35 is not needed: new features can be used and there is no need to @@ -93,10 +109,6 @@ Deprecated Compiler Flags The following options are deprecated and ignored. They will be removed in future versions of Clang. -- The clang-cl ``/fallback`` flag, which made clang-cl invoke Microsoft Visual - C++ on files it couldn't compile itself, has been deprecated. It will be - removed in Clang 13. - - ... Modified Compiler Flags @@ -114,16 +126,6 @@ Modified Compiler Flags This behavior matches newer GCC. (`D91760 `_) (`D92054 `_) -- Support has been added for the following processors (command-line identifiers - in parentheses): - - - Arm Cortex-A78C (cortex-a78c). - - Arm Cortex-R82 (cortex-r82). - - Arm Neoverse V1 (neoverse-v1). - - Arm Neoverse N2 (neoverse-n2). - - Fujitsu A64FX (a64fx). - For example, to select architecture support and tuning for Neoverse-V1 based - systems, use ``-mcpu=neoverse-v1``. Removed Compiler Flags ------------------------- @@ -138,18 +140,6 @@ New Pragmas in Clang - ... -Modified Pragmas in Clang -------------------------- - -- The "#pragma clang loop vectorize_width" has been extended to support an - optional 'fixed|scalable' argument, which can be used to indicate that the - compiler should use fixed-width or scalable vectorization. Fixed-width is - assumed by default. - - Scalable or vector length agnostic vectorization is an experimental feature - for targets that support scalable vectors. For more information please refer - to the Clang Language Extensions documentation. - Attribute Changes in Clang -------------------------- @@ -160,21 +150,6 @@ Attribute Changes in Clang Windows Support --------------- -- Implicitly add ``.exe`` suffix for MinGW targets, even when cross compiling. - (This matches a change from GCC 8.) - -- Windows on Arm64: programs using the C standard library's setjmp and longjmp - functions may crash with a "Security check failure or stack buffer overrun" - exception. To workaround (with reduced security), compile with - /guard:cf,nolongjmp. - -- Windows on Arm64: LLVM 12 adds official binary release hosted on - Windows on Arm64. The binary is built and tested by Linaro alongside - AArch64 and ARM 32-bit Linux binary releases. This first WoA release - includes Clang compiler, LLD Linker, and compiler-rt runtime libraries. - Work on LLDB, sanitizer support, OpenMP, and other features is in progress - and will be included in future Windows on Arm64 LLVM releases. - C Language Changes in Clang --------------------------- @@ -192,38 +167,10 @@ C++1z Feature Support Objective-C Language Changes in Clang ------------------------------------- -OpenCL Kernel Language Changes in Clang ---------------------------------------- - -- Improved online documentation: :doc:`UsersManual` and :doc:`OpenCLSupport` - pages. -- Added ``-cl-std=CL3.0`` and predefined version macro for OpenCL 3.0. -- Added ``-cl-std=CL1.0`` and mapped to the existing OpenCL 1.0 functionality. -- Improved OpenCL extension handling per target. -- Added clang extension for function pointers ``__cl_clang_function_pointers`` - and variadic functions ``__cl_clang_variadic_functions``, more details can be - found in :doc:`LanguageExtensions`. -- Removed extensions without kernel language changes: - ``cl_khr_select_fprounding_mode``, ``cl_khr_gl_sharing``, ``cl_khr_icd``, - ``cl_khr_gl_event``, ``cl_khr_d3d10_sharing``, ``cl_khr_context_abort``, - ``cl_khr_d3d11_sharing``, ``cl_khr_dx9_media_sharing``, - ``cl_khr_image2d_from_buffer``, ``cl_khr_initialize_memory``, - ``cl_khr_gl_depth_images``, ``cl_khr_spir``, ``cl_khr_egl_event``, - ``cl_khr_egl_image``, ``cl_khr_terminate_context``. -- Improved diagnostics for unevaluated ``vec_step`` expression. -- Allow nested pointers (e.g. pointer-to-pointer) kernel arguments beyond OpenCL - 1.2. -- Added ``global_device`` and ``global_host`` address spaces for USM - allocations. - -Miscellaneous improvements in C++ for OpenCL support: - -- Added diagnostics for pointers to member functions and references to - functions. -- Added support of ``vec_step`` builtin. -- Fixed ICE on address spaces with forwarding references and templated copy - constructors. -- Removed warning for variadic macro use. +OpenCL C Language Changes in Clang +---------------------------------- + +... ABI Changes in Clang -------------------- @@ -300,41 +247,15 @@ release of Clang. Users of the build system should adjust accordingly. AST Matchers ------------ -- The ``mapAnyOf()`` matcher was added. This allows convenient matching of - different AST nodes which have a compatible matcher API. For example, - ``mapAnyOf(ifStmt, forStmt).with(hasCondition(integerLiteral()))`` - matches any ``IfStmt`` or ``ForStmt`` with a integer literal as the - condition. - -- The ``binaryOperation()`` matcher allows matching expressions which - appear like binary operators in the code, even if they are really - ``CXXOperatorCallExpr`` for example. It is based on the ``mapAnyOf()`` - matcher functionality. The matcher API for the latter node has been - extended with ``hasLHS()`` etc to facilitate the abstraction. - -- Matcher API for ``CXXRewrittenBinaryOperator`` has been added. In addition - to explicit matching with the ``cxxRewrittenBinaryOperator()`` matcher, the - ``binaryOperation()`` matches on nodes of this type. - -- The behavior of ``TK_IgnoreUnlessSpelledInSource`` with the ``traverse()`` - matcher has been changed to no longer match on template instantiations or on +- The behavior of TK_IgnoreUnlessSpelledInSource with the traverse() matcher + has been changed to no longer match on template instantiations or on implicit nodes which are not spelled in the source. -- The ``TK_IgnoreImplicitCastsAndParentheses`` traversal kind was removed. It - is recommended to use ``TK_IgnoreUnlessSpelledInSource`` instead. +- The TK_IgnoreImplicitCastsAndParentheses traversal kind was removed. It + is recommended to use TK_IgnoreUnlessSpelledInSource instead. -- The behavior of the ``forEach()`` matcher was changed to not internally - ignore implicit and parenthesis nodes. This makes it consistent with - the ``has()`` matcher. Uses of ``forEach()`` relying on the old behavior - can now use the ``traverse()`` matcher or ``ignoringParenCasts()``. - -- Several AST Matchers have been changed to match based on the active - traversal mode. For example, ``argumentCountIs()`` matches the number of - arguments written in the source, ignoring default arguments represented - by ``CXXDefaultArgExpr`` nodes. - -- Improvements in AST Matchers allow more matching of template declarations, - independent of their template instantations. +- The behavior of the forEach() matcher was changed to not internally ignore + implicit and parenthesis nodes. clang-format ------------ @@ -389,9 +310,6 @@ clang-format ``AlignConsecutiveDeclarations`` and ``AlignConsecutiveMacros`` have been modified to allow alignment across empty lines and/or comments. -- Support for Whitesmiths has been improved, with fixes for ``namespace`` blocks - and ``case`` blocks and labels. - libclang -------- @@ -400,38 +318,7 @@ libclang Static Analyzer --------------- -.. 3ff220de9009 [analyzer][StdLibraryFunctionsChecker] Add POSIX networking functions -.. ...And a million other patches. -- Improve the analyzer's understanding of several POSIX functions. - -.. https://reviews.llvm.org/D86533#2238207 -- Greatly improved the analyzer’s constraint solver by better understanding - when constraints are imposed on multiple symbolic values that are known to be - equal or known to be non-equal. It will now also efficiently reject impossible - if-branches between known comparison expressions. (Incorrectly stated as a - 11.0.0 feature in the previous release notes) - -.. 820e8d8656ec [Analyzer][WebKit] UncountedLambdaCaptureChecker -- New checker: :ref:`webkit.UncountedLambdaCapturesChecker` - is a WebKit coding convention checker that flags raw pointers to - reference-counted objects captured by lambdas and suggests using intrusive - reference-counting smart pointers instead. - -.. 8a64689e264c [Analyzer][WebKit] UncountedLocalVarsChecker -- New checker: :ref:`alpha.webkit.UncountedLocalVarsChecker` - is a WebKit coding convention checker that intends to make sure that any - uncounted local variable is backed by a ref-counted object with lifetime that - is strictly larger than the scope of the uncounted local variable. - -.. i914f6c4ff8a4 [StaticAnalyzer] Support struct annotations in FuchsiaHandleChecker -- ``fuchia.HandleChecker`` now recognizes handles in structs; All the handles - referenced by the structure (direct value or ptr) would be treated as - containing the release/use/acquire annotations directly. - -.. 8deaec122ec6 [analyzer] Update Fuchsia checker to catch releasing unowned handles. -- Fuchsia checkers can detect the release of an unowned handle. - -- Numerous fixes and improvements to bug report generation. +- ... .. _release-notes-ubsan: diff --git a/clang/docs/analyzer/checkers.rst b/clang/docs/analyzer/checkers.rst index d851845396ac..b47be97eef96 100644 --- a/clang/docs/analyzer/checkers.rst +++ b/clang/docs/analyzer/checkers.rst @@ -2538,8 +2538,6 @@ We also define a set of safe transformations which if passed a safe value as an - casts - unary operators like ``&`` or ``*`` -.. _alpha-webkit-UncountedLocalVarsChecker: - alpha.webkit.UncountedLocalVarsChecker """""""""""""""""""""""""""""""""""""" The goal of this rule is to make sure that any uncounted local variable is backed by a ref-counted object with lifetime that is strictly larger than the scope of the uncounted local variable. To be on the safe side we require the scope of an uncounted variable to be embedded in the scope of ref-counted object that backs it. diff --git a/clang/include/clang/AST/ASTContext.h b/clang/include/clang/AST/ASTContext.h index ae69a68608b7..ce47d54e44b0 100644 --- a/clang/include/clang/AST/ASTContext.h +++ b/clang/include/clang/AST/ASTContext.h @@ -538,9 +538,6 @@ private: /// need them (like static local vars). llvm::MapVector MangleNumbers; llvm::MapVector StaticLocalNumbers; - /// Mapping the associated device lambda mangling number if present. - mutable llvm::DenseMap - DeviceLambdaManglingNumbers; /// Mapping that stores parameterIndex values for ParmVarDecls when /// that value exceeds the bitfield size of ParmVarDeclBits.ParameterIndex. diff --git a/clang/include/clang/AST/DeclCXX.h b/clang/include/clang/AST/DeclCXX.h index 89006b1cfa7f..e32101bb2276 100644 --- a/clang/include/clang/AST/DeclCXX.h +++ b/clang/include/clang/AST/DeclCXX.h @@ -1735,12 +1735,6 @@ public: getLambdaData().HasKnownInternalLinkage = HasKnownInternalLinkage; } - /// Set the device side mangling number. - void setDeviceLambdaManglingNumber(unsigned Num) const; - - /// Retrieve the device side mangling number. - unsigned getDeviceLambdaManglingNumber() const; - /// Returns the inheritance model used for this record. MSInheritanceModel getMSInheritanceModel() const; diff --git a/clang/include/clang/AST/Mangle.h b/clang/include/clang/AST/Mangle.h index 7b6495d85eb6..0e8d6dd53d8a 100644 --- a/clang/include/clang/AST/Mangle.h +++ b/clang/include/clang/AST/Mangle.h @@ -96,9 +96,6 @@ public: virtual bool shouldMangleCXXName(const NamedDecl *D) = 0; virtual bool shouldMangleStringLiteral(const StringLiteral *SL) = 0; - virtual bool isDeviceMangleContext() const { return false; } - virtual void setDeviceMangleContext(bool) {} - // FIXME: consider replacing raw_ostream & with something like SmallString &. void mangleName(GlobalDecl GD, raw_ostream &); virtual void mangleCXXName(GlobalDecl GD, raw_ostream &) = 0; diff --git a/clang/include/clang/AST/MangleNumberingContext.h b/clang/include/clang/AST/MangleNumberingContext.h index eb33759682d6..f1ca6a05dbaf 100644 --- a/clang/include/clang/AST/MangleNumberingContext.h +++ b/clang/include/clang/AST/MangleNumberingContext.h @@ -52,11 +52,6 @@ public: /// this context. virtual unsigned getManglingNumber(const TagDecl *TD, unsigned MSLocalManglingNumber) = 0; - - /// Retrieve the mangling number of a new lambda expression with the - /// given call operator within the device context. No device number is - /// assigned if there's no device numbering context is associated. - virtual unsigned getDeviceManglingNumber(const CXXMethodDecl *) { return 0; } }; } // end namespace clang diff --git a/clang/include/clang/AST/RecursiveASTVisitor.h b/clang/include/clang/AST/RecursiveASTVisitor.h index 7870cea198a7..505ea700fd0e 100644 --- a/clang/include/clang/AST/RecursiveASTVisitor.h +++ b/clang/include/clang/AST/RecursiveASTVisitor.h @@ -186,9 +186,6 @@ public: /// code, e.g., implicit constructors and destructors. bool shouldVisitImplicitCode() const { return false; } - /// Return whether this visitor should recurse into lambda body - bool shouldVisitLambdaBody() const { return true; } - /// Return whether this visitor should traverse post-order. bool shouldTraversePostOrder() const { return false; } @@ -2060,15 +2057,6 @@ bool RecursiveASTVisitor::TraverseFunctionHelper(FunctionDecl *D) { // by clang. (!D->isDefaulted() || getDerived().shouldVisitImplicitCode()); - if (const auto *MD = dyn_cast(D)) { - if (const CXXRecordDecl *RD = MD->getParent()) { - if (RD->isLambda() && - declaresSameEntity(RD->getLambdaCallOperator(), MD)) { - VisitBody = VisitBody && getDerived().shouldVisitLambdaBody(); - } - } - } - if (VisitBody) { TRY_TO(TraverseStmt(D->getBody())); // Function body. } diff --git a/clang/include/clang/ASTMatchers/ASTMatchers.h b/clang/include/clang/ASTMatchers/ASTMatchers.h index 031fa4682c3a..6f6dfab59a39 100644 --- a/clang/include/clang/ASTMatchers/ASTMatchers.h +++ b/clang/include/clang/ASTMatchers/ASTMatchers.h @@ -344,7 +344,7 @@ extern const internal::VariadicAllOfMatcher decl; /// int number = 42; /// auto [foo, bar] = std::make_pair{42, 42}; /// \endcode -extern const internal::VariadicDynCastAllOfMatcher +extern const internal::VariadicAllOfMatcher decompositionDecl; /// Matches a declaration of a linkage specification. diff --git a/clang/include/clang/Basic/Attr.td b/clang/include/clang/Basic/Attr.td index f62b547b72f5..bfd50f6a6779 100644 --- a/clang/include/clang/Basic/Attr.td +++ b/clang/include/clang/Basic/Attr.td @@ -840,7 +840,6 @@ def Availability : InheritableAttr { .Case("tvos_app_extension", "tvOS (App Extension)") .Case("watchos_app_extension", "watchOS (App Extension)") .Case("swift", "Swift") - .Case("ohos", "OpenHOS") .Default(llvm::StringRef()); } static llvm::StringRef getPlatformNameSourceSpelling(llvm::StringRef Platform) { diff --git a/clang/include/clang/Basic/CodeGenOptions.def b/clang/include/clang/Basic/CodeGenOptions.def index 9d53b5b923bb..5c8af65326ed 100644 --- a/clang/include/clang/Basic/CodeGenOptions.def +++ b/clang/include/clang/Basic/CodeGenOptions.def @@ -266,9 +266,6 @@ CODEGENOPT(VectorizeLoop , 1, 0) ///< Run loop vectorizer. CODEGENOPT(VectorizeSLP , 1, 0) ///< Run SLP vectorizer. CODEGENOPT(ProfileSampleAccurate, 1, 0) ///< Sample profile is accurate. -/// Treat loops as finite: language, always, never. -ENUM_CODEGENOPT(FiniteLoops, FiniteLoopsKind, 2, FiniteLoopsKind::Language) - /// Attempt to use register sized accesses to bit-fields in structures, when /// possible. CODEGENOPT(UseRegisterSizedBitfieldAccess , 1, 0) diff --git a/clang/include/clang/Basic/CodeGenOptions.h b/clang/include/clang/Basic/CodeGenOptions.h index c550817f0f69..73d41e3293c6 100644 --- a/clang/include/clang/Basic/CodeGenOptions.h +++ b/clang/include/clang/Basic/CodeGenOptions.h @@ -140,12 +140,6 @@ public: All, // Keep all frame pointers. }; - enum FiniteLoopsKind { - Language, // Not specified, use language standard. - Always, // All loops are assumed to be finite. - Never, // No loop is assumed to be finite. - }; - /// The code model to use (-mcmodel). std::string CodeModel; diff --git a/clang/include/clang/Basic/LangOptions.def b/clang/include/clang/Basic/LangOptions.def index 02375ba9d0b7..c01f0cca9c9c 100644 --- a/clang/include/clang/Basic/LangOptions.def +++ b/clang/include/clang/Basic/LangOptions.def @@ -324,7 +324,7 @@ ENUM_LANGOPT(ExternDeclNoDLLStorageClassVisibility, Visibility, 3, HiddenVisibil BENIGN_LANGOPT(SemanticInterposition , 1, 0, "semantic interposition") BENIGN_LANGOPT(HalfNoSemanticInterposition, 1, 0, "Like -fno-semantic-interposition but don't use local aliases") -ENUM_LANGOPT(StackProtector, StackProtectorMode, 3, SSPOff, +ENUM_LANGOPT(StackProtector, StackProtectorMode, 2, SSPOff, "stack protector mode") ENUM_LANGOPT(TrivialAutoVarInit, TrivialAutoVarInitKind, 2, TrivialAutoVarInitKind::Uninitialized, "trivial automatic variable initialization") diff --git a/clang/include/clang/Basic/LangOptions.h b/clang/include/clang/Basic/LangOptions.h index a16ac81f785d..d8bd2a8b52fc 100644 --- a/clang/include/clang/Basic/LangOptions.h +++ b/clang/include/clang/Basic/LangOptions.h @@ -61,7 +61,7 @@ public: using RoundingMode = llvm::RoundingMode; enum GCMode { NonGC, GCOnly, HybridGC }; - enum StackProtectorMode { SSPOff, SSPOn, SSPStrong, SSPReq, SSPRet }; + enum StackProtectorMode { SSPOff, SSPOn, SSPStrong, SSPReq }; // Automatic variables live on the stack, and when trivial they're usually // uninitialized because it's undefined behavior to use them without diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index d710897c0f29..42c5319041d0 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -1147,7 +1147,7 @@ def fprofile_update_EQ : Joined<["-"], "fprofile-update=">, defm pseudo_probe_for_profiling : BoolFOption<"pseudo-probe-for-profiling", CodeGenOpts<"PseudoProbeForProfiling">, DefaultFalse, PosFlag, NegFlag, - BothFlags<[NoXarchOption, CC1Option], " pseudo probes for sample profiling">>; + BothFlags<[NoXarchOption, CC1Option], " pseudo probes for sample profiler">>; def forder_file_instrumentation : Flag<["-"], "forder-file-instrumentation">, Group, Flags<[CC1Option, CoreOption]>, HelpText<"Generate instrumented code to collect order file into default.profraw file (overridden by '=' form of option or LLVM_PROFILE_FILE env var)">; @@ -2258,8 +2258,6 @@ defm signed_char : OptOutFFlag<"signed-char", "char is signed", "char is unsigne def fsplit_stack : Flag<["-"], "fsplit-stack">, Group; def fstack_protector_all : Flag<["-"], "fstack-protector-all">, Group, HelpText<"Enable stack protectors for all functions">; -def fstack_protector_ret : Flag<["-"], "fstack-protector-ret">, Group, - HelpText<"Enable stack protectors for all functions with return address check">; defm stack_clash_protection : BoolFOption<"stack-clash-protection", CodeGenOpts<"StackClashProtector">, DefaultFalse, PosFlag, NegFlag, @@ -2412,13 +2410,6 @@ def fno_unroll_loops : Flag<["-"], "fno-unroll-loops">, Group, defm reroll_loops : BoolFOption<"reroll-loops", CodeGenOpts<"RerollLoops">, DefaultFalse, PosFlag, NegFlag>; -def ffinite_loops: Flag<["-"], "ffinite-loops">, Group, - HelpText<"Assume all loops are finite.">, Flags<[CC1Option]>; -def fno_finite_loops: Flag<["-"], "fno-finite-loops">, Group, - HelpText<"Do not assume that any loop is finite.">, Flags<[CC1Option]>; - -def fenable_merge_functions : Flag<["-"], "fenable-merge-functions">, Group, - HelpText<"Enables Merge Functions optimization">; def ftrigraphs : Flag<["-"], "ftrigraphs">, Group, HelpText<"Process trigraph sequences">, Flags<[CC1Option]>; def fno_trigraphs : Flag<["-"], "fno-trigraphs">, Group, @@ -5117,9 +5108,9 @@ def static_define : Flag<["-"], "static-define">, HelpText<"Should __STATIC__ be defined">, MarshallingInfoFlag>; def stack_protector : Separate<["-"], "stack-protector">, - HelpText<"Enable stack protectors">, Values<"0,1,2,3,4">, + HelpText<"Enable stack protectors">, Values<"0,1,2,3">, NormalizedValuesScope<"LangOptions">, - NormalizedValues<["SSPOff", "SSPOn", "SSPStrong", "SSPReq", "SSPRet"]>, + NormalizedValues<["SSPOff", "SSPOn", "SSPStrong", "SSPReq"]>, MarshallingInfoString, "SSPOff">, AutoNormalizeEnum; def stack_protector_buffer_size : Separate<["-"], "stack-protector-buffer-size">, HelpText<"Lower bound for a buffer to be considered for stack protection">, diff --git a/clang/include/clang/Driver/ToolChain.h b/clang/include/clang/Driver/ToolChain.h index 9ead01d68335..28c37a44e1eb 100644 --- a/clang/include/clang/Driver/ToolChain.h +++ b/clang/include/clang/Driver/ToolChain.h @@ -441,8 +441,7 @@ public: // Returns /lib//. This is used by runtimes (such // as OpenMP) to find arch-specific libraries. - // OHOS specific: make this function virtual to override in OHOS.cpp - virtual std::string getArchSpecificLibPath() const; + std::string getArchSpecificLibPath() const; // Returns part of above. virtual StringRef getOSLibName() const; diff --git a/clang/include/clang/Lex/VariadicMacroSupport.h b/clang/include/clang/Lex/VariadicMacroSupport.h index 119f02201fc6..989e0ac703c9 100644 --- a/clang/include/clang/Lex/VariadicMacroSupport.h +++ b/clang/include/clang/Lex/VariadicMacroSupport.h @@ -39,14 +39,17 @@ namespace clang { assert(Ident__VA_ARGS__->isPoisoned() && "__VA_ARGS__ should be poisoned " "outside an ISO C/C++ variadic " "macro definition!"); - assert(Ident__VA_OPT__->isPoisoned() && "__VA_OPT__ should be poisoned!"); + assert( + !Ident__VA_OPT__ || + (Ident__VA_OPT__->isPoisoned() && "__VA_OPT__ should be poisoned!")); } /// Client code should call this function just before the Preprocessor is /// about to Lex tokens from the definition of a variadic (ISO C/C++) macro. void enterScope() { Ident__VA_ARGS__->setIsPoisoned(false); - Ident__VA_OPT__->setIsPoisoned(false); + if (Ident__VA_OPT__) + Ident__VA_OPT__->setIsPoisoned(false); } /// Client code should call this function as soon as the Preprocessor has @@ -55,7 +58,8 @@ namespace clang { /// (might be explicitly called, and then reinvoked via the destructor). void exitScope() { Ident__VA_ARGS__->setIsPoisoned(true); - Ident__VA_OPT__->setIsPoisoned(true); + if (Ident__VA_OPT__) + Ident__VA_OPT__->setIsPoisoned(true); } ~VariadicMacroScopeGuard() { exitScope(); } diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h index 2530a2776373..7f7c84eb1b1d 100644 --- a/clang/include/clang/Sema/Sema.h +++ b/clang/include/clang/Sema/Sema.h @@ -6558,7 +6558,7 @@ public: /// Number lambda for linkage purposes if necessary. void handleLambdaNumbering( CXXRecordDecl *Class, CXXMethodDecl *Method, - Optional> Mangling = None); + Optional> Mangling = None); /// Endow the lambda scope info with the relevant properties. void buildLambdaScope(sema::LambdaScopeInfo *LSI, @@ -11948,8 +11948,8 @@ public: /// if (diagIfOpenMPDeviceCode(Loc, diag::err_vla_unsupported)) /// return ExprError(); /// // Otherwise, continue parsing as normal. - SemaDiagnosticBuilder - diagIfOpenMPDeviceCode(SourceLocation Loc, unsigned DiagID, FunctionDecl *FD); + SemaDiagnosticBuilder diagIfOpenMPDeviceCode(SourceLocation Loc, + unsigned DiagID); /// Creates a SemaDiagnosticBuilder that emits the diagnostic if the current /// context is "used as host code". @@ -11965,19 +11965,17 @@ public: /// return ExprError(); /// // Otherwise, continue parsing as normal. SemaDiagnosticBuilder diagIfOpenMPHostCode(SourceLocation Loc, - unsigned DiagID, FunctionDecl *FD); + unsigned DiagID); - SemaDiagnosticBuilder targetDiag(SourceLocation Loc, unsigned DiagID, - FunctionDecl *FD = nullptr); + SemaDiagnosticBuilder targetDiag(SourceLocation Loc, unsigned DiagID); SemaDiagnosticBuilder targetDiag(SourceLocation Loc, - const PartialDiagnostic &PD, - FunctionDecl *FD = nullptr) { - return targetDiag(Loc, PD.getDiagID(), FD) << PD; + const PartialDiagnostic &PD) { + return targetDiag(Loc, PD.getDiagID()) << PD; } /// Check if the expression is allowed to be used in expressions for the /// offloading devices. - void checkDeviceDecl(ValueDecl *D, SourceLocation Loc); + void checkDeviceDecl(const ValueDecl *D, SourceLocation Loc); enum CUDAFunctionTarget { CFT_Device, diff --git a/clang/include/clang/StaticAnalyzer/Checkers/Checkers.td b/clang/include/clang/StaticAnalyzer/Checkers/Checkers.td index fa04d9c5f6c6..444b00d73f0b 100644 --- a/clang/include/clang/StaticAnalyzer/Checkers/Checkers.td +++ b/clang/include/clang/StaticAnalyzer/Checkers/Checkers.td @@ -119,8 +119,6 @@ def FuchsiaAlpha : Package<"fuchsia">, ParentPackage; def WebKit : Package<"webkit">; def WebKitAlpha : Package<"webkit">, ParentPackage; -def OpenHarmony : Package<"openharmony">; - //===----------------------------------------------------------------------===// // Core Checkers. //===----------------------------------------------------------------------===// @@ -1675,43 +1673,3 @@ def UncountedLocalVarsChecker : Checker<"UncountedLocalVarsChecker">, Documentation; } // end alpha.webkit - -// OHOS_LOCAL begin - -//===----------------------------------------------------------------------===// -// OpenHarmony checkers. -//===----------------------------------------------------------------------===// - -let ParentPackage = OpenHarmony in { -def UnixAPIArgsChecker : Checker<"UnixAPIArgs">, - HelpText<"Check for open unix api arguments">, - Documentation; - -def MemcpyChecker : Checker<"Memcpy">, - HelpText<"Check for memcpy_s api arguments">, - Documentation; - -def PrintSensitiveInfoChecker : Checker<"PrintSensitiveInfo">, - HelpText<"Check for sensitive information disclosure">, - CheckerOptions<[ - CmdLineOption, - ]>, - Documentation; - -def SignalHandlerChecker : Checker<"SignalHandler">, - HelpText<"Check for signal handler">, - CheckerOptions<[ - CmdLineOption, - ]>, - Documentation; -} - -// OHOS_LOCAL end diff --git a/clang/lib/AST/ASTImporter.cpp b/clang/lib/AST/ASTImporter.cpp index 0d723fbbcd8c..085c50c0667b 100644 --- a/clang/lib/AST/ASTImporter.cpp +++ b/clang/lib/AST/ASTImporter.cpp @@ -2848,8 +2848,6 @@ ExpectedDecl ASTNodeImporter::VisitRecordDecl(RecordDecl *D) { return CDeclOrErr.takeError(); D2CXX->setLambdaMangling(DCXX->getLambdaManglingNumber(), *CDeclOrErr, DCXX->hasKnownLambdaInternalLinkage()); - D2CXX->setDeviceLambdaManglingNumber( - DCXX->getDeviceLambdaManglingNumber()); } else if (DCXX->isInjectedClassName()) { // We have to be careful to do a similar dance to the one in // Sema::ActOnStartCXXMemberDeclarations diff --git a/clang/lib/AST/CXXABI.h b/clang/lib/AST/CXXABI.h index ca9424bcb7a4..31cb36918726 100644 --- a/clang/lib/AST/CXXABI.h +++ b/clang/lib/AST/CXXABI.h @@ -22,9 +22,8 @@ class ASTContext; class CXXConstructorDecl; class DeclaratorDecl; class Expr; -class MangleContext; -class MangleNumberingContext; class MemberPointerType; +class MangleNumberingContext; /// Implements C++ ABI-specific semantic analysis functions. class CXXABI { @@ -76,8 +75,6 @@ public: /// Creates an instance of a C++ ABI class. CXXABI *CreateItaniumCXXABI(ASTContext &Ctx); CXXABI *CreateMicrosoftCXXABI(ASTContext &Ctx); -std::unique_ptr -createItaniumNumberingContext(MangleContext *); } #endif diff --git a/clang/lib/AST/DeclCXX.cpp b/clang/lib/AST/DeclCXX.cpp index 0375f9b4432e..0368ada0b81c 100644 --- a/clang/lib/AST/DeclCXX.cpp +++ b/clang/lib/AST/DeclCXX.cpp @@ -1593,20 +1593,6 @@ Decl *CXXRecordDecl::getLambdaContextDecl() const { return getLambdaData().ContextDecl.get(Source); } -void CXXRecordDecl::setDeviceLambdaManglingNumber(unsigned Num) const { - assert(isLambda() && "Not a lambda closure type!"); - if (Num) - getASTContext().DeviceLambdaManglingNumbers[this] = Num; -} - -unsigned CXXRecordDecl::getDeviceLambdaManglingNumber() const { - assert(isLambda() && "Not a lambda closure type!"); - auto I = getASTContext().DeviceLambdaManglingNumbers.find(this); - if (I != getASTContext().DeviceLambdaManglingNumbers.end()) - return I->second; - return 0; -} - static CanQualType GetConversionType(ASTContext &Context, NamedDecl *Conv) { QualType T = cast(Conv->getUnderlyingDecl()->getAsFunction()) diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp index 1bdad771a923..56181bbe1166 100644 --- a/clang/lib/AST/ExprConstant.cpp +++ b/clang/lib/AST/ExprConstant.cpp @@ -3497,8 +3497,8 @@ static bool diagnoseMutableFields(EvalInfo &Info, const Expr *E, AccessKinds AK, static bool lifetimeStartedInEvaluation(EvalInfo &Info, APValue::LValueBase Base, bool MutableSubobject = false) { - // A temporary or transient heap allocation we created. - if (Base.getCallIndex() || Base.is()) + // A temporary we created. + if (Base.getCallIndex()) return true; switch (Info.IsEvaluatingDecl) { @@ -10009,7 +10009,6 @@ bool RecordExprEvaluator::VisitLambdaExpr(const LambdaExpr *E) { auto *CaptureInitIt = E->capture_init_begin(); const LambdaCapture *CaptureIt = ClosureClass->captures_begin(); bool Success = true; - const ASTRecordLayout &Layout = Info.Ctx.getASTRecordLayout(ClosureClass); for (const auto *Field : ClosureClass->fields()) { assert(CaptureInitIt != E->capture_init_end()); // Get the initializer for this field @@ -10020,13 +10019,8 @@ bool RecordExprEvaluator::VisitLambdaExpr(const LambdaExpr *E) { if (!CurFieldInit) return Error(E); - LValue Subobject = This; - - if (!HandleLValueMember(Info, E, Subobject, Field, &Layout)) - return false; - APValue &FieldVal = Result.getStructField(Field->getFieldIndex()); - if (!EvaluateInPlace(FieldVal, Info, Subobject, CurFieldInit)) { + if (!EvaluateInPlace(FieldVal, Info, This, CurFieldInit)) { if (!Info.keepEvaluatingAfterFailure()) return false; Success = false; @@ -14792,14 +14786,11 @@ bool Expr::EvaluateAsLValue(EvalResult &Result, const ASTContext &Ctx, static bool EvaluateDestruction(const ASTContext &Ctx, APValue::LValueBase Base, APValue DestroyedValue, QualType Type, - SourceLocation Loc, Expr::EvalStatus &EStatus, - bool IsConstantDestruction) { - EvalInfo Info(Ctx, EStatus, - IsConstantDestruction ? EvalInfo::EM_ConstantExpression - : EvalInfo::EM_ConstantFold); + SourceLocation Loc, Expr::EvalStatus &EStatus) { + EvalInfo Info(Ctx, EStatus, EvalInfo::EM_ConstantExpression); Info.setEvaluatingDecl(Base, DestroyedValue, EvalInfo::EvaluatingDeclKind::Dtor); - Info.InConstantContext = IsConstantDestruction; + Info.InConstantContext = true; LValue LVal; LVal.set(Base); @@ -14853,8 +14844,7 @@ bool Expr::EvaluateAsConstantExpr(EvalResult &Result, const ASTContext &Ctx, // If this is a class template argument, it's required to have constant // destruction too. if (Kind == ConstantExprKind::ClassTemplateArgument && - (!EvaluateDestruction(Ctx, Base, Result.Val, T, getBeginLoc(), Result, - true) || + (!EvaluateDestruction(Ctx, Base, Result.Val, T, getBeginLoc(), Result) || Result.HasSideEffects)) { // FIXME: Prefix a note to indicate that the problem is lack of constant // destruction. @@ -14920,10 +14910,6 @@ bool VarDecl::evaluateDestruction( Expr::EvalStatus EStatus; EStatus.Diag = &Notes; - // Only treat the destruction as constant destruction if we formally have - // constant initialization (or are usable in a constant expression). - bool IsConstantDestruction = hasConstantInitialization(); - // Make a copy of the value for the destructor to mutate, if we know it. // Otherwise, treat the value as default-initialized; if the destructor works // anyway, then the destruction is constant (and must be essentially empty). @@ -14934,8 +14920,7 @@ bool VarDecl::evaluateDestruction( return false; if (!EvaluateDestruction(getASTContext(), this, std::move(DestroyedValue), - getType(), getLocation(), EStatus, - IsConstantDestruction) || + getType(), getLocation(), EStatus) || EStatus.HasSideEffects) return false; diff --git a/clang/lib/AST/ItaniumCXXABI.cpp b/clang/lib/AST/ItaniumCXXABI.cpp index be10258a2d77..069add8464ae 100644 --- a/clang/lib/AST/ItaniumCXXABI.cpp +++ b/clang/lib/AST/ItaniumCXXABI.cpp @@ -258,9 +258,3 @@ public: CXXABI *clang::CreateItaniumCXXABI(ASTContext &Ctx) { return new ItaniumCXXABI(Ctx); } - -std::unique_ptr -clang::createItaniumNumberingContext(MangleContext *Mangler) { - return std::make_unique( - cast(Mangler)); -} diff --git a/clang/lib/AST/ItaniumMangle.cpp b/clang/lib/AST/ItaniumMangle.cpp index 5cad84a96845..6c8d5687c64a 100644 --- a/clang/lib/AST/ItaniumMangle.cpp +++ b/clang/lib/AST/ItaniumMangle.cpp @@ -125,8 +125,6 @@ class ItaniumMangleContextImpl : public ItaniumMangleContext { llvm::DenseMap Discriminator; llvm::DenseMap Uniquifier; - bool IsDevCtx = false; - public: explicit ItaniumMangleContextImpl(ASTContext &Context, DiagnosticsEngine &Diags) @@ -139,10 +137,6 @@ public: bool shouldMangleStringLiteral(const StringLiteral *) override { return false; } - - bool isDeviceMangleContext() const override { return IsDevCtx; } - void setDeviceMangleContext(bool IsDev) override { IsDevCtx = IsDev; } - void mangleCXXName(GlobalDecl GD, raw_ostream &) override; void mangleThunk(const CXXMethodDecl *MD, const ThunkInfo &Thunk, raw_ostream &) override; @@ -552,8 +546,8 @@ private: unsigned knownArity); void mangleCastExpression(const Expr *E, StringRef CastEncoding); void mangleInitListElements(const InitListExpr *InitList); - void mangleExpression(const Expr *E, unsigned Arity = UnknownArity, - bool AsTemplateArg = false); + void mangleDeclRefExpr(const NamedDecl *D); + void mangleExpression(const Expr *E, unsigned Arity = UnknownArity); void mangleCXXCtorType(CXXCtorType T, const CXXRecordDecl *InheritedFrom); void mangleCXXDtorType(CXXDtorType T); @@ -564,7 +558,6 @@ private: unsigned NumTemplateArgs); void mangleTemplateArgs(TemplateName TN, const TemplateArgumentList &AL); void mangleTemplateArg(TemplateArgument A, bool NeedExactType); - void mangleTemplateArgExpr(const Expr *E); void mangleValueInTemplateArg(QualType T, const APValue &V, bool TopLevel, bool NeedExactType = false); @@ -733,17 +726,9 @@ void CXXNameMangler::mangleFunctionEncodingBareType(const FunctionDecl *FD) { EnableIfAttr *EIA = dyn_cast(*I); if (!EIA) continue; - if (Context.getASTContext().getLangOpts().getClangABICompat() > - LangOptions::ClangABI::Ver11) { - mangleTemplateArgExpr(EIA->getCond()); - } else { - // Prior to Clang 12, we hardcoded the X/E around enable-if's argument, - // even though should not include an X/E around - // . - Out << 'X'; - mangleExpression(EIA->getCond()); - Out << 'E'; - } + Out << 'X'; + mangleExpression(EIA->getCond()); + Out << 'E'; } Out << 'E'; FunctionTypeDepth.pop(Saved); @@ -1852,15 +1837,7 @@ void CXXNameMangler::mangleLambda(const CXXRecordDecl *Lambda) { // (in lexical order) with that same and context. // // The AST keeps track of the number for us. - // - // In CUDA/HIP, to ensure the consistent lamba numbering between the device- - // and host-side compilations, an extra device mangle context may be created - // if the host-side CXX ABI has different numbering for lambda. In such case, - // if the mangle context is that device-side one, use the device-side lambda - // mangling number for this lambda. - unsigned Number = Context.isDeviceMangleContext() - ? Lambda->getDeviceLambdaManglingNumber() - : Lambda->getLambdaManglingNumber(); + unsigned Number = Lambda->getLambdaManglingNumber(); assert(Number > 0 && "Lambda should be mangled as an unnamed class"); if (Number > 1) mangleNumber(Number - 2); @@ -3551,8 +3528,8 @@ void CXXNameMangler::mangleType(const DependentSizedMatrixType *T) { Out << "u" << VendorQualifier.size() << VendorQualifier; Out << "I"; - mangleTemplateArgExpr(T->getRowExpr()); - mangleTemplateArgExpr(T->getColumnExpr()); + mangleTemplateArg(T->getRowExpr(), false); + mangleTemplateArg(T->getColumnExpr(), false); mangleType(T->getElementType()); Out << "E"; } @@ -3894,8 +3871,33 @@ void CXXNameMangler::mangleInitListElements(const InitListExpr *InitList) { mangleExpression(InitList->getInit(i)); } -void CXXNameMangler::mangleExpression(const Expr *E, unsigned Arity, - bool AsTemplateArg) { +void CXXNameMangler::mangleDeclRefExpr(const NamedDecl *D) { + switch (D->getKind()) { + default: + // ::= L E # external name + Out << 'L'; + mangle(D); + Out << 'E'; + break; + + case Decl::ParmVar: + mangleFunctionParam(cast(D)); + break; + + case Decl::EnumConstant: { + const EnumConstantDecl *ED = cast(D); + mangleIntegerLiteral(ED->getType(), ED->getInitVal()); + break; + } + + case Decl::NonTypeTemplateParm: + const NonTypeTemplateParmDecl *PD = cast(D); + mangleTemplateParameter(PD->getDepth(), PD->getIndex()); + break; + } +} + +void CXXNameMangler::mangleExpression(const Expr *E, unsigned Arity) { // ::= // ::= // ::= @@ -3909,64 +3911,18 @@ void CXXNameMangler::mangleExpression(const Expr *E, unsigned Arity, // ::= at # alignof (a type) // ::= // ::= - // ::= fpT # 'this' expression (part of ) // ::= sr # dependent name // ::= sr # dependent template-id // ::= ds # expr.*expr // ::= sZ # size of a parameter pack // ::= sZ # size of a function parameter pack - // ::= u * E # vendor extended expression // ::= // ::= L E # integer literal - // ::= L E # floating literal - // ::= L E # string literal - // ::= L E # nullptr literal "LDnE" - // ::= L 0 E # null pointer template argument - // ::= L _ E # complex floating point literal (C99); not used by clang + // ::= L E # floating literal // ::= L E # external name + // ::= fpT # 'this' expression QualType ImplicitlyConvertedToType; - // A top-level expression that's not needs to be wrapped in - // X...E in a template arg. - bool IsPrimaryExpr = true; - auto NotPrimaryExpr = [&] { - if (AsTemplateArg && IsPrimaryExpr) - Out << 'X'; - IsPrimaryExpr = false; - }; - - auto MangleDeclRefExpr = [&](const NamedDecl *D) { - switch (D->getKind()) { - default: - // ::= L E # external name - Out << 'L'; - mangle(D); - Out << 'E'; - break; - - case Decl::ParmVar: - NotPrimaryExpr(); - mangleFunctionParam(cast(D)); - break; - - case Decl::EnumConstant: { - // - const EnumConstantDecl *ED = cast(D); - mangleIntegerLiteral(ED->getType(), ED->getInitVal()); - break; - } - - case Decl::NonTypeTemplateParm: - NotPrimaryExpr(); - const NonTypeTemplateParmDecl *PD = cast(D); - mangleTemplateParameter(PD->getDepth(), PD->getIndex()); - break; - } - }; - - // 'goto recurse' is used when handling a simple "unwrapping" node which - // produces no output, where ImplicitlyConvertedToType and AsTemplateArg need - // to be preserved. recurse: switch (E->getStmtClass()) { case Expr::NoStmtClass: @@ -4038,7 +3994,6 @@ recurse: case Expr::SourceLocExprClass: case Expr::BuiltinBitCastExprClass: { - NotPrimaryExpr(); if (!NullOut) { // As bad as this diagnostic is, it's better than crashing. DiagnosticsEngine &Diags = Context.getDiags(); @@ -4046,48 +4001,33 @@ recurse: "cannot yet mangle expression type %0"); Diags.Report(E->getExprLoc(), DiagID) << E->getStmtClassName() << E->getSourceRange(); - return; } break; } case Expr::CXXUuidofExprClass: { - NotPrimaryExpr(); const CXXUuidofExpr *UE = cast(E); - // As of clang 12, uuidof uses the vendor extended expression - // mangling. Previously, it used a special-cased nonstandard extension. - if (Context.getASTContext().getLangOpts().getClangABICompat() > - LangOptions::ClangABI::Ver11) { - Out << "u8__uuidof"; - if (UE->isTypeOperand()) - mangleType(UE->getTypeOperand(Context.getASTContext())); - else - mangleTemplateArgExpr(UE->getExprOperand()); - Out << 'E'; + if (UE->isTypeOperand()) { + QualType UuidT = UE->getTypeOperand(Context.getASTContext()); + Out << "u8__uuidoft"; + mangleType(UuidT); } else { - if (UE->isTypeOperand()) { - QualType UuidT = UE->getTypeOperand(Context.getASTContext()); - Out << "u8__uuidoft"; - mangleType(UuidT); - } else { - Expr *UuidExp = UE->getExprOperand(); - Out << "u8__uuidofz"; - mangleExpression(UuidExp); - } + Expr *UuidExp = UE->getExprOperand(); + Out << "u8__uuidofz"; + mangleExpression(UuidExp, Arity); } break; } // Even gcc-4.5 doesn't mangle this. case Expr::BinaryConditionalOperatorClass: { - NotPrimaryExpr(); DiagnosticsEngine &Diags = Context.getDiags(); unsigned DiagID = Diags.getCustomDiagID(DiagnosticsEngine::Error, "?: operator with omitted middle operand cannot be mangled"); Diags.Report(E->getExprLoc(), DiagID) << E->getStmtClassName() << E->getSourceRange(); - return; + break; } // These are used for internal purposes and cannot be meaningfully mangled. @@ -4095,7 +4035,6 @@ recurse: llvm_unreachable("cannot mangle opaque value; mangling wrong thing?"); case Expr::InitListExprClass: { - NotPrimaryExpr(); Out << "il"; mangleInitListElements(cast(E)); Out << "E"; @@ -4103,7 +4042,6 @@ recurse: } case Expr::DesignatedInitExprClass: { - NotPrimaryExpr(); auto *DIE = cast(E); for (const auto &Designator : DIE->designators()) { if (Designator.isFieldDesignator()) { @@ -4125,27 +4063,27 @@ recurse: } case Expr::CXXDefaultArgExprClass: - E = cast(E)->getExpr(); - goto recurse; + mangleExpression(cast(E)->getExpr(), Arity); + break; case Expr::CXXDefaultInitExprClass: - E = cast(E)->getExpr(); - goto recurse; + mangleExpression(cast(E)->getExpr(), Arity); + break; case Expr::CXXStdInitializerListExprClass: - E = cast(E)->getSubExpr(); - goto recurse; + mangleExpression(cast(E)->getSubExpr(), Arity); + break; case Expr::SubstNonTypeTemplateParmExprClass: - E = cast(E)->getReplacement(); - goto recurse; + mangleExpression(cast(E)->getReplacement(), + Arity); + break; case Expr::UserDefinedLiteralClass: // We follow g++'s approach of mangling a UDL as a call to the literal // operator. case Expr::CXXMemberCallExprClass: // fallthrough case Expr::CallExprClass: { - NotPrimaryExpr(); const CallExpr *CE = cast(E); // ::= cp * E @@ -4176,7 +4114,6 @@ recurse: } case Expr::CXXNewExprClass: { - NotPrimaryExpr(); const CXXNewExpr *New = cast(E); if (New->isGlobalNew()) Out << "gs"; Out << (New->isArray() ? "na" : "nw"); @@ -4212,7 +4149,6 @@ recurse: } case Expr::CXXPseudoDestructorExprClass: { - NotPrimaryExpr(); const auto *PDE = cast(E); if (const Expr *Base = PDE->getBase()) mangleMemberExprBase(Base, PDE->isArrow()); @@ -4239,7 +4175,6 @@ recurse: } case Expr::MemberExprClass: { - NotPrimaryExpr(); const MemberExpr *ME = cast(E); mangleMemberExpr(ME->getBase(), ME->isArrow(), ME->getQualifier(), nullptr, @@ -4250,7 +4185,6 @@ recurse: } case Expr::UnresolvedMemberExprClass: { - NotPrimaryExpr(); const UnresolvedMemberExpr *ME = cast(E); mangleMemberExpr(ME->isImplicitAccess() ? nullptr : ME->getBase(), ME->isArrow(), ME->getQualifier(), nullptr, @@ -4261,7 +4195,6 @@ recurse: } case Expr::CXXDependentScopeMemberExprClass: { - NotPrimaryExpr(); const CXXDependentScopeMemberExpr *ME = cast(E); mangleMemberExpr(ME->isImplicitAccess() ? nullptr : ME->getBase(), @@ -4274,7 +4207,6 @@ recurse: } case Expr::UnresolvedLookupExprClass: { - NotPrimaryExpr(); const UnresolvedLookupExpr *ULE = cast(E); mangleUnresolvedName(ULE->getQualifier(), ULE->getName(), ULE->getTemplateArgs(), ULE->getNumTemplateArgs(), @@ -4283,7 +4215,6 @@ recurse: } case Expr::CXXUnresolvedConstructExprClass: { - NotPrimaryExpr(); const CXXUnresolvedConstructExpr *CE = cast(E); unsigned N = CE->getNumArgs(); @@ -4294,7 +4225,7 @@ recurse: mangleType(CE->getType()); mangleInitListElements(IL); Out << "E"; - break; + return; } Out << "cv"; @@ -4306,17 +4237,14 @@ recurse: } case Expr::CXXConstructExprClass: { - // An implicit cast is silent, thus may contain . const auto *CE = cast(E); if (!CE->isListInitialization() || CE->isStdInitListInitialization()) { assert( CE->getNumArgs() >= 1 && (CE->getNumArgs() == 1 || isa(CE->getArg(1))) && "implicit CXXConstructExpr must have one argument"); - E = cast(E)->getArg(0); - goto recurse; + return mangleExpression(cast(E)->getArg(0)); } - NotPrimaryExpr(); Out << "il"; for (auto *E : CE->arguments()) mangleExpression(E); @@ -4325,7 +4253,6 @@ recurse: } case Expr::CXXTemporaryObjectExprClass: { - NotPrimaryExpr(); const auto *CE = cast(E); unsigned N = CE->getNumArgs(); bool List = CE->isListInitialization(); @@ -4355,20 +4282,17 @@ recurse: } case Expr::CXXScalarValueInitExprClass: - NotPrimaryExpr(); Out << "cv"; mangleType(E->getType()); Out << "_E"; break; case Expr::CXXNoexceptExprClass: - NotPrimaryExpr(); Out << "nx"; mangleExpression(cast(E)->getOperand()); break; case Expr::UnaryExprOrTypeTraitExprClass: { - // Non-instantiation-dependent traits are an integer literal. const UnaryExprOrTypeTraitExpr *SAE = cast(E); if (!SAE->isInstantiationDependent()) { @@ -4388,41 +4312,13 @@ recurse: break; } - NotPrimaryExpr(); // But otherwise, they are not. - - auto MangleAlignofSizeofArg = [&] { - if (SAE->isArgumentType()) { - Out << 't'; - mangleType(SAE->getArgumentType()); - } else { - Out << 'z'; - mangleExpression(SAE->getArgumentExpr()); - } - }; - switch(SAE->getKind()) { case UETT_SizeOf: Out << 's'; - MangleAlignofSizeofArg(); break; case UETT_PreferredAlignOf: - // As of clang 12, we mangle __alignof__ differently than alignof. (They - // have acted differently since Clang 8, but were previously mangled the - // same.) - if (Context.getASTContext().getLangOpts().getClangABICompat() > - LangOptions::ClangABI::Ver11) { - Out << "u11__alignof__"; - if (SAE->isArgumentType()) - mangleType(SAE->getArgumentType()); - else - mangleTemplateArgExpr(SAE->getArgumentExpr()); - Out << 'E'; - break; - } - LLVM_FALLTHROUGH; case UETT_AlignOf: Out << 'a'; - MangleAlignofSizeofArg(); break; case UETT_VecStep: { DiagnosticsEngine &Diags = Context.getDiags(); @@ -4440,11 +4336,17 @@ recurse: return; } } + if (SAE->isArgumentType()) { + Out << 't'; + mangleType(SAE->getArgumentType()); + } else { + Out << 'z'; + mangleExpression(SAE->getArgumentExpr()); + } break; } case Expr::CXXThrowExprClass: { - NotPrimaryExpr(); const CXXThrowExpr *TE = cast(E); // ::= tw # throw expression // ::= tr # rethrow @@ -4458,7 +4360,6 @@ recurse: } case Expr::CXXTypeidExprClass: { - NotPrimaryExpr(); const CXXTypeidExpr *TIE = cast(E); // ::= ti # typeid (type) // ::= te # typeid (expression) @@ -4473,7 +4374,6 @@ recurse: } case Expr::CXXDeleteExprClass: { - NotPrimaryExpr(); const CXXDeleteExpr *DE = cast(E); // ::= [gs] dl # [::] delete expr // ::= [gs] da # [::] delete [] expr @@ -4484,7 +4384,6 @@ recurse: } case Expr::UnaryOperatorClass: { - NotPrimaryExpr(); const UnaryOperator *UO = cast(E); mangleOperatorName(UnaryOperator::getOverloadedOperator(UO->getOpcode()), /*Arity=*/1); @@ -4493,7 +4392,6 @@ recurse: } case Expr::ArraySubscriptExprClass: { - NotPrimaryExpr(); const ArraySubscriptExpr *AE = cast(E); // Array subscript is treated as a syntactically weird form of @@ -4505,7 +4403,6 @@ recurse: } case Expr::MatrixSubscriptExprClass: { - NotPrimaryExpr(); const MatrixSubscriptExpr *ME = cast(E); Out << "ixix"; mangleExpression(ME->getBase()); @@ -4516,7 +4413,6 @@ recurse: case Expr::CompoundAssignOperatorClass: // fallthrough case Expr::BinaryOperatorClass: { - NotPrimaryExpr(); const BinaryOperator *BO = cast(E); if (BO->getOpcode() == BO_PtrMemD) Out << "ds"; @@ -4529,7 +4425,6 @@ recurse: } case Expr::CXXRewrittenBinaryOperatorClass: { - NotPrimaryExpr(); // The mangled form represents the original syntax. CXXRewrittenBinaryOperator::DecomposedForm Decomposed = cast(E)->getDecomposedForm(); @@ -4541,7 +4436,6 @@ recurse: } case Expr::ConditionalOperatorClass: { - NotPrimaryExpr(); const ConditionalOperator *CO = cast(E); mangleOperatorName(OO_Conditional, /*Arity=*/3); mangleExpression(CO->getCond()); @@ -4557,22 +4451,19 @@ recurse: } case Expr::ObjCBridgedCastExprClass: { - NotPrimaryExpr(); // Mangle ownership casts as a vendor extended operator __bridge, // __bridge_transfer, or __bridge_retain. StringRef Kind = cast(E)->getBridgeKindName(); Out << "v1U" << Kind.size() << Kind; - mangleCastExpression(E, "cv"); - break; } + // Fall through to mangle the cast itself. + LLVM_FALLTHROUGH; case Expr::CStyleCastExprClass: - NotPrimaryExpr(); mangleCastExpression(E, "cv"); break; case Expr::CXXFunctionalCastExprClass: { - NotPrimaryExpr(); auto *Sub = cast(E)->getSubExpr()->IgnoreImplicit(); // FIXME: Add isImplicit to CXXConstructExpr. if (auto *CCE = dyn_cast(Sub)) @@ -4592,28 +4483,22 @@ recurse: } case Expr::CXXStaticCastExprClass: - NotPrimaryExpr(); mangleCastExpression(E, "sc"); break; case Expr::CXXDynamicCastExprClass: - NotPrimaryExpr(); mangleCastExpression(E, "dc"); break; case Expr::CXXReinterpretCastExprClass: - NotPrimaryExpr(); mangleCastExpression(E, "rc"); break; case Expr::CXXConstCastExprClass: - NotPrimaryExpr(); mangleCastExpression(E, "cc"); break; case Expr::CXXAddrspaceCastExprClass: - NotPrimaryExpr(); mangleCastExpression(E, "ac"); break; case Expr::CXXOperatorCallExprClass: { - NotPrimaryExpr(); const CXXOperatorCallExpr *CE = cast(E); unsigned NumArgs = CE->getNumArgs(); // A CXXOperatorCallExpr for OO_Arrow models only semantics, not syntax @@ -4627,8 +4512,9 @@ recurse: } case Expr::ParenExprClass: - E = cast(E)->getSubExpr(); - goto recurse; + mangleExpression(cast(E)->getSubExpr(), Arity); + break; + case Expr::ConceptSpecializationExprClass: { // ::= L E # external name @@ -4642,12 +4528,10 @@ recurse: } case Expr::DeclRefExprClass: - // MangleDeclRefExpr helper handles primary-vs-nonprimary - MangleDeclRefExpr(cast(E)->getDecl()); + mangleDeclRefExpr(cast(E)->getDecl()); break; case Expr::SubstNonTypeTemplateParmPackExprClass: - NotPrimaryExpr(); // FIXME: not clear how to mangle this! // template class A { // template void foo(U (&x)[N]...); @@ -4656,16 +4540,14 @@ recurse: break; case Expr::FunctionParmPackExprClass: { - NotPrimaryExpr(); // FIXME: not clear how to mangle this! const FunctionParmPackExpr *FPPE = cast(E); Out << "v110_SUBSTPACK"; - MangleDeclRefExpr(FPPE->getParameterPack()); + mangleDeclRefExpr(FPPE->getParameterPack()); break; } case Expr::DependentScopeDeclRefExprClass: { - NotPrimaryExpr(); const DependentScopeDeclRefExpr *DRE = cast(E); mangleUnresolvedName(DRE->getQualifier(), DRE->getDeclName(), DRE->getTemplateArgs(), DRE->getNumTemplateArgs(), @@ -4674,27 +4556,24 @@ recurse: } case Expr::CXXBindTemporaryExprClass: - E = cast(E)->getSubExpr(); - goto recurse; + mangleExpression(cast(E)->getSubExpr()); + break; case Expr::ExprWithCleanupsClass: - E = cast(E)->getSubExpr(); - goto recurse; + mangleExpression(cast(E)->getSubExpr(), Arity); + break; case Expr::FloatingLiteralClass: { - // const FloatingLiteral *FL = cast(E); mangleFloatLiteral(FL->getType(), FL->getValue()); break; } case Expr::FixedPointLiteralClass: - // Currently unimplemented -- might be in future? mangleFixedPointLiteral(); break; case Expr::CharacterLiteralClass: - // Out << 'L'; mangleType(E->getType()); Out << cast(E)->getValue(); @@ -4703,21 +4582,18 @@ recurse: // FIXME. __objc_yes/__objc_no are mangled same as true/false case Expr::ObjCBoolLiteralExprClass: - // Out << "Lb"; Out << (cast(E)->getValue() ? '1' : '0'); Out << 'E'; break; case Expr::CXXBoolLiteralExprClass: - // Out << "Lb"; Out << (cast(E)->getValue() ? '1' : '0'); Out << 'E'; break; case Expr::IntegerLiteralClass: { - // llvm::APSInt Value(cast(E)->getValue()); if (E->getType()->isSignedIntegerType()) Value.setIsSigned(true); @@ -4726,7 +4602,6 @@ recurse: } case Expr::ImaginaryLiteralClass: { - // const ImaginaryLiteral *IE = cast(E); // Mangle as if a complex literal. // Proposal from David Vandevoorde, 2010.06.30. @@ -4750,7 +4625,6 @@ recurse: } case Expr::StringLiteralClass: { - // // Revised proposal from David Vandervoorde, 2010.07.15. Out << 'L'; assert(isa(E->getType())); @@ -4760,25 +4634,21 @@ recurse: } case Expr::GNUNullExprClass: - // // Mangle as if an integer literal 0. mangleIntegerLiteral(E->getType(), llvm::APSInt(32)); break; case Expr::CXXNullPtrLiteralExprClass: { - // Out << "LDnE"; break; } case Expr::PackExpansionExprClass: - NotPrimaryExpr(); Out << "sp"; mangleExpression(cast(E)->getPattern()); break; case Expr::SizeOfPackExprClass: { - NotPrimaryExpr(); auto *SPE = cast(E); if (SPE->isPartiallySubstituted()) { Out << "sP"; @@ -4803,12 +4673,12 @@ recurse: break; } - case Expr::MaterializeTemporaryExprClass: - E = cast(E)->getSubExpr(); - goto recurse; + case Expr::MaterializeTemporaryExprClass: { + mangleExpression(cast(E)->getSubExpr()); + break; + } case Expr::CXXFoldExprClass: { - NotPrimaryExpr(); auto *FE = cast(E); if (FE->isLeftFold()) Out << (FE->getInit() ? "fL" : "fl"); @@ -4830,34 +4700,27 @@ recurse: } case Expr::CXXThisExprClass: - NotPrimaryExpr(); Out << "fpT"; break; case Expr::CoawaitExprClass: // FIXME: Propose a non-vendor mangling. - NotPrimaryExpr(); Out << "v18co_await"; mangleExpression(cast(E)->getOperand()); break; case Expr::DependentCoawaitExprClass: // FIXME: Propose a non-vendor mangling. - NotPrimaryExpr(); Out << "v18co_await"; mangleExpression(cast(E)->getOperand()); break; case Expr::CoyieldExprClass: // FIXME: Propose a non-vendor mangling. - NotPrimaryExpr(); Out << "v18co_yield"; mangleExpression(cast(E)->getOperand()); break; } - - if (AsTemplateArg && !IsPrimaryExpr) - Out << 'E'; } /// Mangle an expression which refers to a parameter variable. @@ -5107,9 +4970,26 @@ void CXXNameMangler::mangleTemplateArg(TemplateArgument A, bool NeedExactType) { Out << "Dp"; mangleType(A.getAsTemplateOrTemplatePattern()); break; - case TemplateArgument::Expression: - mangleTemplateArgExpr(A.getAsExpr()); + case TemplateArgument::Expression: { + // It's possible to end up with a DeclRefExpr here in certain + // dependent cases, in which case we should mangle as a + // declaration. + const Expr *E = A.getAsExpr()->IgnoreParenImpCasts(); + if (const DeclRefExpr *DRE = dyn_cast(E)) { + const ValueDecl *D = DRE->getDecl(); + if (isa(D) || isa(D)) { + Out << 'L'; + mangle(D); + Out << 'E'; + break; + } + } + + Out << 'X'; + mangleExpression(E); + Out << 'E'; break; + } case TemplateArgument::Integral: mangleIntegerLiteral(A.getIntegralType(), A.getAsIntegral()); break; @@ -5164,38 +5044,6 @@ void CXXNameMangler::mangleTemplateArg(TemplateArgument A, bool NeedExactType) { } } -void CXXNameMangler::mangleTemplateArgExpr(const Expr *E) { - ASTContext &Ctx = Context.getASTContext(); - if (Ctx.getLangOpts().getClangABICompat() > LangOptions::ClangABI::Ver11) { - mangleExpression(E, UnknownArity, /*AsTemplateArg=*/true); - return; - } - - // Prior to Clang 12, we didn't omit the X .. E around - // correctly in cases where the template argument was - // constructed from an expression rather than an already-evaluated - // literal. In such a case, we would then e.g. emit 'XLi0EE' instead of - // 'Li0E'. - // - // We did special-case DeclRefExpr to attempt to DTRT for that one - // expression-kind, but while doing so, unfortunately handled ParmVarDecl - // (subtype of VarDecl) _incorrectly_, and emitted 'L_Z .. E' instead of - // the proper 'Xfp_E'. - E = E->IgnoreParenImpCasts(); - if (const DeclRefExpr *DRE = dyn_cast(E)) { - const ValueDecl *D = DRE->getDecl(); - if (isa(D) || isa(D)) { - Out << 'L'; - mangle(D); - Out << 'E'; - return; - } - } - Out << 'X'; - mangleExpression(E); - Out << 'E'; -} - /// Determine whether a given value is equivalent to zero-initialization for /// the purpose of discarding a trailing portion of a 'tl' mangling. /// diff --git a/clang/lib/AST/MicrosoftCXXABI.cpp b/clang/lib/AST/MicrosoftCXXABI.cpp index 166aa3b3bd60..f9f9fe985b6f 100644 --- a/clang/lib/AST/MicrosoftCXXABI.cpp +++ b/clang/lib/AST/MicrosoftCXXABI.cpp @@ -16,7 +16,6 @@ #include "clang/AST/Attr.h" #include "clang/AST/CXXInheritance.h" #include "clang/AST/DeclCXX.h" -#include "clang/AST/Mangle.h" #include "clang/AST/MangleNumberingContext.h" #include "clang/AST/RecordLayout.h" #include "clang/AST/Type.h" @@ -65,19 +64,6 @@ public: } }; -class MSHIPNumberingContext : public MicrosoftNumberingContext { - std::unique_ptr DeviceCtx; - -public: - MSHIPNumberingContext(MangleContext *DeviceMangler) { - DeviceCtx = createItaniumNumberingContext(DeviceMangler); - } - - unsigned getDeviceManglingNumber(const CXXMethodDecl *CallOperator) override { - return DeviceCtx->getManglingNumber(CallOperator); - } -}; - class MicrosoftCXXABI : public CXXABI { ASTContext &Context; llvm::SmallDenseMap RecordToCopyCtor; @@ -87,20 +73,8 @@ class MicrosoftCXXABI : public CXXABI { llvm::SmallDenseMap UnnamedTagDeclToTypedefNameDecl; - // MangleContext for device numbering context, which is based on Itanium C++ - // ABI. - std::unique_ptr DeviceMangler; - public: - MicrosoftCXXABI(ASTContext &Ctx) : Context(Ctx) { - if (Context.getLangOpts().CUDA && Context.getAuxTargetInfo()) { - assert(Context.getTargetInfo().getCXXABI().isMicrosoft() && - Context.getAuxTargetInfo()->getCXXABI().isItaniumFamily() && - "Unexpected combination of C++ ABIs."); - DeviceMangler.reset( - Context.createMangleContext(Context.getAuxTargetInfo())); - } - } + MicrosoftCXXABI(ASTContext &Ctx) : Context(Ctx) { } MemberPointerInfo getMemberPointerInfo(const MemberPointerType *MPT) const override; @@ -159,10 +133,6 @@ public: std::unique_ptr createMangleNumberingContext() const override { - if (Context.getLangOpts().CUDA && Context.getAuxTargetInfo()) { - assert(DeviceMangler && "Missing device mangler"); - return std::make_unique(DeviceMangler.get()); - } return std::make_unique(); } }; @@ -296,3 +266,4 @@ CXXABI::MemberPointerInfo MicrosoftCXXABI::getMemberPointerInfo( CXXABI *clang::CreateMicrosoftCXXABI(ASTContext &Ctx) { return new MicrosoftCXXABI(Ctx); } + diff --git a/clang/lib/ASTMatchers/ASTMatchFinder.cpp b/clang/lib/ASTMatchers/ASTMatchFinder.cpp index 69957a952d17..8ddd3c87e09d 100644 --- a/clang/lib/ASTMatchers/ASTMatchFinder.cpp +++ b/clang/lib/ASTMatchers/ASTMatchFinder.cpp @@ -243,14 +243,10 @@ public: return true; ScopedIncrement ScopedDepth(&CurrentDepth); if (auto *Init = Node->getInit()) - if (!traverse(*Init)) + if (!match(*Init)) return false; - if (!match(*Node->getLoopVariable())) - return false; - if (match(*Node->getRangeInit())) - if (!VisitorBase::TraverseStmt(Node->getRangeInit())) - return false; - if (!match(*Node->getBody())) + if (!match(*Node->getLoopVariable()) || !match(*Node->getRangeInit()) || + !match(*Node->getBody())) return false; return VisitorBase::TraverseStmt(Node->getBody()); } @@ -295,7 +291,7 @@ public: if (!match(*Node->getBody())) return false; - return VisitorBase::TraverseStmt(Node->getBody()); + return true; } bool shouldVisitTemplateInstantiations() const { return true; } @@ -492,21 +488,15 @@ public: bool dataTraverseNode(Stmt *S, DataRecursionQueue *Queue) { if (auto *RF = dyn_cast(S)) { - { - ASTNodeNotAsIsSourceScope RAII(this, true); - TraverseStmt(RF->getInit()); - // Don't traverse under the loop variable - match(*RF->getLoopVariable()); - TraverseStmt(RF->getRangeInit()); - } - { - ASTNodeNotSpelledInSourceScope RAII(this, true); - for (auto *SubStmt : RF->children()) { - if (SubStmt != RF->getBody()) - TraverseStmt(SubStmt); + for (auto *SubStmt : RF->children()) { + if (SubStmt == RF->getInit() || SubStmt == RF->getLoopVarStmt() || + SubStmt == RF->getRangeInit() || SubStmt == RF->getBody()) { + TraverseStmt(SubStmt, Queue); + } else { + ASTNodeNotSpelledInSourceScope RAII(this, true); + TraverseStmt(SubStmt, Queue); } } - TraverseStmt(RF->getBody()); return true; } else if (auto *RBO = dyn_cast(S)) { { @@ -566,9 +556,9 @@ public: if (LE->hasExplicitResultType()) TraverseTypeLoc(Proto.getReturnLoc()); TraverseStmt(LE->getTrailingRequiresClause()); - } - TraverseStmt(LE->getBody()); + TraverseStmt(LE->getBody()); + } return true; } return RecursiveASTVisitor::dataTraverseNode(S, Queue); @@ -707,10 +697,6 @@ public: bool shouldVisitTemplateInstantiations() const { return true; } bool shouldVisitImplicitCode() const { return true; } - // We visit the lambda body explicitly, so instruct the RAV - // to not visit it on our behalf too. - bool shouldVisitLambdaBody() const { return false; } - bool IsMatchingInASTNodeNotSpelledInSource() const override { return TraversingASTNodeNotSpelledInSource; } @@ -837,14 +823,6 @@ private: if (EnableCheckProfiling) Timer.setBucket(&TimeByBucket[MP.second->getID()]); BoundNodesTreeBuilder Builder; - - { - TraversalKindScope RAII(getASTContext(), MP.first.getTraversalKind()); - if (getASTContext().getParentMapContext().traverseIgnored(DynNode) != - DynNode) - continue; - } - if (MP.first.matches(DynNode, this, &Builder)) { MatchVisitor Visitor(ActiveASTContext, MP.second); Builder.visitMatches(&Visitor); diff --git a/clang/lib/ASTMatchers/ASTMatchersInternal.cpp b/clang/lib/ASTMatchers/ASTMatchersInternal.cpp index 705f1cdf3153..6c7e14e3499a 100644 --- a/clang/lib/ASTMatchers/ASTMatchersInternal.cpp +++ b/clang/lib/ASTMatchers/ASTMatchersInternal.cpp @@ -732,7 +732,7 @@ const internal::VariadicDynCastAllOfMatcher typeAliasDecl; const internal::VariadicDynCastAllOfMatcher typeAliasTemplateDecl; const internal::VariadicAllOfMatcher decl; -const internal::VariadicDynCastAllOfMatcher decompositionDecl; +const internal::VariadicAllOfMatcher decompositionDecl; const internal::VariadicDynCastAllOfMatcher linkageSpecDecl; const internal::VariadicDynCastAllOfMatcher namedDecl; diff --git a/clang/lib/Basic/ProfileList.cpp b/clang/lib/Basic/ProfileList.cpp index 2cb05c1c3c07..56bc37a79301 100644 --- a/clang/lib/Basic/ProfileList.cpp +++ b/clang/lib/Basic/ProfileList.cpp @@ -82,7 +82,6 @@ static StringRef getSectionName(CodeGenOptions::ProfileInstrKind Kind) { case CodeGenOptions::ProfileCSIRInstr: return "csllvm"; } - llvm_unreachable("Unhandled CodeGenOptions::ProfileInstrKind enum"); } llvm::Optional diff --git a/clang/lib/Basic/TargetInfo.cpp b/clang/lib/Basic/TargetInfo.cpp index d727d9991443..642ee753d224 100644 --- a/clang/lib/Basic/TargetInfo.cpp +++ b/clang/lib/Basic/TargetInfo.cpp @@ -68,8 +68,7 @@ TargetInfo::TargetInfo(const llvm::Triple &T) : TargetOpts(), Triple(T) { // alignment on 64-bit systems and 8-byte alignment on 32-bit systems. See // https://www.gnu.org/software/libc/manual/html_node/Malloc-Examples.html. // This alignment guarantee also applies to Windows and Android. - if (T.isGNUEnvironment() || T.isWindowsMSVCEnvironment() || T.isAndroid() || - T.isOHOSFamily()) + if (T.isGNUEnvironment() || T.isWindowsMSVCEnvironment() || T.isAndroid()) NewAlign = Triple.isArch64Bit() ? 128 : Triple.isArch32Bit() ? 64 : 0; else NewAlign = 0; // Infer from basic type alignment. diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp index 59fd19eb826d..90a67d03b7b2 100644 --- a/clang/lib/Basic/Targets.cpp +++ b/clang/lib/Basic/Targets.cpp @@ -143,12 +143,7 @@ TargetInfo *AllocateTarget(const llvm::Triple &Triple, case llvm::Triple::Fuchsia: return new FuchsiaTargetInfo(Triple, Opts); case llvm::Triple::Linux: - switch (Triple.getEnvironment()) { - default: - return new LinuxTargetInfo(Triple, Opts); - case llvm::Triple::OpenHOS: - return new OHOSTargetInfo(Triple, Opts); - } + return new LinuxTargetInfo(Triple, Opts); case llvm::Triple::NetBSD: return new NetBSDTargetInfo(Triple, Opts); case llvm::Triple::OpenBSD: @@ -188,14 +183,7 @@ TargetInfo *AllocateTarget(const llvm::Triple &Triple, case llvm::Triple::CloudABI: return new CloudABITargetInfo(Triple, Opts); case llvm::Triple::Linux: - switch (Triple.getEnvironment()) { - default: - return new LinuxTargetInfo(Triple, Opts); - case llvm::Triple::OpenHOS: - return new OHOSTargetInfo(Triple, Opts); - } - case llvm::Triple::LiteOS: - return new OHOSTargetInfo(Triple, Opts); + return new LinuxTargetInfo(Triple, Opts); case llvm::Triple::FreeBSD: return new FreeBSDTargetInfo(Triple, Opts); case llvm::Triple::NetBSD: @@ -270,12 +258,7 @@ TargetInfo *AllocateTarget(const llvm::Triple &Triple, case llvm::Triple::mipsel: switch (os) { case llvm::Triple::Linux: - switch (Triple.getEnvironment()) { - default: - return new LinuxTargetInfo(Triple, Opts); - case llvm::Triple::OpenHOS: - return new OHOSTargetInfo(Triple, Opts); - } + return new LinuxTargetInfo(Triple, Opts); case llvm::Triple::RTEMS: return new RTEMSTargetInfo(Triple, Opts); case llvm::Triple::FreeBSD: @@ -425,12 +408,7 @@ TargetInfo *AllocateTarget(const llvm::Triple &Triple, case llvm::Triple::Fuchsia: return new FuchsiaTargetInfo(Triple, Opts); case llvm::Triple::Linux: - switch (Triple.getEnvironment()) { - default: - return new LinuxTargetInfo(Triple, Opts); - case llvm::Triple::OpenHOS: - return new OHOSTargetInfo(Triple, Opts); - } + return new LinuxTargetInfo(Triple, Opts); default: return new RISCV64TargetInfo(Triple, Opts); } @@ -568,8 +546,6 @@ TargetInfo *AllocateTarget(const llvm::Triple &Triple, return new LinuxTargetInfo(Triple, Opts); case llvm::Triple::Android: return new AndroidX86_64TargetInfo(Triple, Opts); - case llvm::Triple::OpenHOS: - return new OHOSX86_64TargetInfo(Triple, Opts); } } case llvm::Triple::DragonFly: diff --git a/clang/lib/Basic/Targets/ARM.cpp b/clang/lib/Basic/Targets/ARM.cpp index cca55956b2f4..a2c96ad12a76 100644 --- a/clang/lib/Basic/Targets/ARM.cpp +++ b/clang/lib/Basic/Targets/ARM.cpp @@ -305,7 +305,7 @@ ARMTargetInfo::ARMTargetInfo(const llvm::Triple &Triple, default: if (IsNetBSD) setABI("apcs-gnu"); - else if (IsOpenBSD || Triple.isOHOSFamily()) + else if (IsOpenBSD) setABI("aapcs-linux"); else setABI("aapcs"); diff --git a/clang/lib/Basic/Targets/OSTargets.h b/clang/lib/Basic/Targets/OSTargets.h index 295e68426752..67fa1a537fea 100644 --- a/clang/lib/Basic/Targets/OSTargets.h +++ b/clang/lib/Basic/Targets/OSTargets.h @@ -947,69 +947,6 @@ public: : WebAssemblyOSTargetInfo(Triple, Opts) {} }; -// OHOS target -template -class LLVM_LIBRARY_VISIBILITY OHOSTargetInfo : public OSTargetInfo { -protected: - void getOSDefines(const LangOptions &Opts, const llvm::Triple &Triple, - MacroBuilder &Builder) const override { - // Linux defines; list based off of gcc output - DefineStd(Builder, "unix", Opts); - - Builder.defineMacro("__ELF__"); - - // Generic OHOS target defines - if (Triple.isOHOSFamily()) { - Builder.defineMacro("__OHOS_FAMILY__", "1"); - - unsigned Maj, Min, Rev; - Triple.getEnvironmentVersion(Maj, Min, Rev); - this->PlatformName = "ohos"; - this->PlatformMinVersion = VersionTuple(Maj, Min, Rev); - if (Maj) { - Builder.defineMacro("__OHOS_Major__", Twine(Maj)); - Builder.defineMacro("__OHOS_Minor__", Twine(Min)); - Builder.defineMacro("__OHOS_Micro__", Twine(Rev)); - } - } - - if (Triple.isOpenHOS()) - Builder.defineMacro("__OHOS__"); - - if (Triple.isOSLinux()) { - DefineStd(Builder, "linux", Opts); - } else if (Triple.isOSLiteOS()) { - Builder.defineMacro("__LITEOS__"); - } - - if (Opts.POSIXThreads) - Builder.defineMacro("_REENTRANT"); - if (Opts.CPlusPlus) - Builder.defineMacro("_GNU_SOURCE"); - if (this->HasFloat128) - Builder.defineMacro("__FLOAT128__"); - } - -public: - OHOSTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts) - : OSTargetInfo(Triple, Opts) { - this->WIntType = TargetInfo::UnsignedInt; - - switch (Triple.getArch()) { - default: - break; - case llvm::Triple::x86: - case llvm::Triple::x86_64: - this->HasFloat128 = true; - break; - } - } - - const char *getStaticInitSectionSpecifier() const override { - return ".text.startup"; - } -}; - } // namespace targets } // namespace clang #endif // LLVM_CLANG_LIB_BASIC_TARGETS_OSTARGETS_H diff --git a/clang/lib/Basic/Targets/PPC.cpp b/clang/lib/Basic/Targets/PPC.cpp index 6c3036836c6d..cfede6e6e756 100644 --- a/clang/lib/Basic/Targets/PPC.cpp +++ b/clang/lib/Basic/Targets/PPC.cpp @@ -57,7 +57,6 @@ bool PPCTargetInfo::handleTargetFeatures(std::vector &Features, } else if (Feature == "+pcrelative-memops") { HasPCRelativeMemops = true; } else if (Feature == "+spe" || Feature == "+efpu2") { - HasStrictFP = false; HasSPE = true; LongDoubleWidth = LongDoubleAlign = 64; LongDoubleFormat = &llvm::APFloat::IEEEdouble(); @@ -319,6 +318,9 @@ bool PPCTargetInfo::initFeatureMap( .Case("pwr9", true) .Case("pwr8", true) .Default(false); + Features["float128"] = llvm::StringSwitch(CPU) + .Case("pwr9", true) + .Default(false); Features["spe"] = llvm::StringSwitch(CPU) .Case("8548", true) diff --git a/clang/lib/Basic/Targets/RISCV.cpp b/clang/lib/Basic/Targets/RISCV.cpp index 786201ea340d..0bf02e605740 100644 --- a/clang/lib/Basic/Targets/RISCV.cpp +++ b/clang/lib/Basic/Targets/RISCV.cpp @@ -150,7 +150,7 @@ void RISCVTargetInfo::getTargetDefines(const LangOptions &Opts, } if (HasV) { - Builder.defineMacro("__riscv_v", "10000"); + Builder.defineMacro("__riscv_v", "1000000"); Builder.defineMacro("__riscv_vector"); } @@ -191,10 +191,10 @@ void RISCVTargetInfo::getTargetDefines(const LangOptions &Opts, Builder.defineMacro("__riscv_zfh", "1000"); if (HasZvamo) - Builder.defineMacro("__riscv_zvamo", "10000"); + Builder.defineMacro("__riscv_zvamo", "1000000"); if (HasZvlsseg) - Builder.defineMacro("__riscv_zvlsseg", "10000"); + Builder.defineMacro("__riscv_zvlsseg", "1000000"); } /// Return true if has this feature, need to sync with handleTargetFeatures. diff --git a/clang/lib/Basic/Targets/X86.cpp b/clang/lib/Basic/Targets/X86.cpp index c5ad1c7d2c2e..694a8095e336 100644 --- a/clang/lib/Basic/Targets/X86.cpp +++ b/clang/lib/Basic/Targets/X86.cpp @@ -513,11 +513,10 @@ void X86TargetInfo::getTargetDefines(const LangOptions &Opts, case CK_K8: case CK_K8SSE3: case CK_x86_64: - defineCPUMacros(Builder, "k8"); - break; case CK_x86_64_v2: case CK_x86_64_v3: case CK_x86_64_v4: + defineCPUMacros(Builder, "k8"); break; case CK_AMDFAM10: defineCPUMacros(Builder, "amdfam10"); diff --git a/clang/lib/Basic/Targets/X86.h b/clang/lib/Basic/Targets/X86.h index 2b8e9bbe16b3..91a365c7d405 100644 --- a/clang/lib/Basic/Targets/X86.h +++ b/clang/lib/Basic/Targets/X86.h @@ -909,28 +909,6 @@ public: LongDoubleFormat = &llvm::APFloat::IEEEquad(); } }; - -// x86_32 OHOS target -class LLVM_LIBRARY_VISIBILITY OHOSX86_32TargetInfo - : public OHOSTargetInfo { -public: - OHOSX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts) - : OHOSTargetInfo(Triple, Opts) { - SuitableAlign = 32; - LongDoubleWidth = 64; - LongDoubleFormat = &llvm::APFloat::IEEEdouble(); - } -}; - -// x86_64 OHOS target -class LLVM_LIBRARY_VISIBILITY OHOSX86_64TargetInfo - : public OHOSTargetInfo { -public: - OHOSX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts) - : OHOSTargetInfo(Triple, Opts) { - LongDoubleFormat = &llvm::APFloat::IEEEquad(); - } -}; } // namespace targets } // namespace clang #endif // LLVM_CLANG_LIB_BASIC_TARGETS_X86_H diff --git a/clang/lib/CodeGen/ABIInfo.h b/clang/lib/CodeGen/ABIInfo.h index 035b6e5a293c..56f0dd4322d2 100644 --- a/clang/lib/CodeGen/ABIInfo.h +++ b/clang/lib/CodeGen/ABIInfo.h @@ -89,7 +89,6 @@ namespace swiftcall { QualType Ty) const = 0; bool isAndroid() const; - bool isOHOSFamily() const; /// Emit the target dependent code to load a value of /// \arg Ty from the \c __builtin_ms_va_list pointed to by \arg VAListAddr. diff --git a/clang/lib/CodeGen/CGBuilder.h b/clang/lib/CodeGen/CGBuilder.h index 82cdd95ac7e0..38e96c0f4ee6 100644 --- a/clang/lib/CodeGen/CGBuilder.h +++ b/clang/lib/CodeGen/CGBuilder.h @@ -66,20 +66,19 @@ public: // Note that we intentionally hide the CreateLoad APIs that don't // take an alignment. llvm::LoadInst *CreateLoad(Address Addr, const llvm::Twine &Name = "") { - return CreateAlignedLoad(Addr.getElementType(), Addr.getPointer(), + return CreateAlignedLoad(Addr.getPointer(), Addr.getAlignment().getAsAlign(), Name); } llvm::LoadInst *CreateLoad(Address Addr, const char *Name) { // This overload is required to prevent string literals from // ending up in the IsVolatile overload. - return CreateAlignedLoad(Addr.getElementType(), Addr.getPointer(), + return CreateAlignedLoad(Addr.getPointer(), Addr.getAlignment().getAsAlign(), Name); } llvm::LoadInst *CreateLoad(Address Addr, bool IsVolatile, const llvm::Twine &Name = "") { - return CreateAlignedLoad(Addr.getElementType(), Addr.getPointer(), - Addr.getAlignment().getAsAlign(), IsVolatile, - Name); + return CreateAlignedLoad( + Addr.getPointer(), Addr.getAlignment().getAsAlign(), IsVolatile, Name); } using CGBuilderBaseTy::CreateAlignedLoad; diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp index a62e1b0986e9..113541bd5024 100644 --- a/clang/lib/CodeGen/CGBuiltin.cpp +++ b/clang/lib/CodeGen/CGBuiltin.cpp @@ -13794,14 +13794,12 @@ Value *CodeGenFunction::EmitX86BuiltinExpr(unsigned BuiltinID, case X86::BI__builtin_ia32_reduce_fadd_ps512: { Function *F = CGM.getIntrinsic(Intrinsic::vector_reduce_fadd, Ops[1]->getType()); - Builder.getFastMathFlags().setAllowReassoc(true); return Builder.CreateCall(F, {Ops[0], Ops[1]}); } case X86::BI__builtin_ia32_reduce_fmul_pd512: case X86::BI__builtin_ia32_reduce_fmul_ps512: { Function *F = CGM.getIntrinsic(Intrinsic::vector_reduce_fmul, Ops[1]->getType()); - Builder.getFastMathFlags().setAllowReassoc(true); return Builder.CreateCall(F, {Ops[0], Ops[1]}); } case X86::BI__builtin_ia32_reduce_mul_d512: @@ -14473,12 +14471,11 @@ Value *CodeGenFunction::EmitX86BuiltinExpr(unsigned BuiltinID, break; } - llvm::Type *Ty = FixedVectorType::get(Builder.getInt64Ty(), 2); Value *InOps[9]; InOps[0] = Ops[2]; for (int i = 0; i != 8; ++i) { Value *Ptr = Builder.CreateConstGEP1_32(Ops[1], i); - InOps[i + 1] = Builder.CreateAlignedLoad(Ty, Ptr, Align(16)); + InOps[i + 1] = Builder.CreateAlignedLoad(Ptr, Align(16)); } Value *Call = Builder.CreateCall(CGM.getIntrinsic(IID), InOps); diff --git a/clang/lib/CodeGen/CGCUDANV.cpp b/clang/lib/CodeGen/CGCUDANV.cpp index e03631a7243a..33a2d6f4483e 100644 --- a/clang/lib/CodeGen/CGCUDANV.cpp +++ b/clang/lib/CodeGen/CGCUDANV.cpp @@ -184,14 +184,6 @@ CGNVCUDARuntime::CGNVCUDARuntime(CodeGenModule &CGM) CharPtrTy = llvm::PointerType::getUnqual(Types.ConvertType(Ctx.CharTy)); VoidPtrTy = cast(Types.ConvertType(Ctx.VoidPtrTy)); VoidPtrPtrTy = VoidPtrTy->getPointerTo(); - if (CGM.getContext().getAuxTargetInfo()) { - // If the host and device have different C++ ABIs, mark it as the device - // mangle context so that the mangling needs to retrieve the additonal - // device lambda mangling number instead of the regular host one. - DeviceMC->setDeviceMangleContext( - CGM.getContext().getTargetInfo().getCXXABI().isMicrosoft() && - CGM.getContext().getAuxTargetInfo()->getCXXABI().isItaniumFamily()); - } } llvm::FunctionCallee CGNVCUDARuntime::getSetupArgumentFn() const { diff --git a/clang/lib/CodeGen/CGCXX.cpp b/clang/lib/CodeGen/CGCXX.cpp index 641740c37a68..a4bd2c6d5da0 100644 --- a/clang/lib/CodeGen/CGCXX.cpp +++ b/clang/lib/CodeGen/CGCXX.cpp @@ -252,8 +252,8 @@ static CGCallee BuildAppleKextVirtualCall(CodeGenFunction &CGF, "No kext in Microsoft ABI"); CodeGenModule &CGM = CGF.CGM; llvm::Value *VTable = CGM.getCXXABI().getAddrOfVTable(RD, CharUnits()); - Ty = Ty->getPointerTo(); - VTable = CGF.Builder.CreateBitCast(VTable, Ty->getPointerTo()); + Ty = Ty->getPointerTo()->getPointerTo(); + VTable = CGF.Builder.CreateBitCast(VTable, Ty); assert(VTable && "BuildVirtualCall = kext vtbl pointer is null"); uint64_t VTableIndex = CGM.getItaniumVTableContext().getMethodVTableIndex(GD); const VTableLayout &VTLayout = CGM.getItaniumVTableContext().getVTableLayout(RD); @@ -264,7 +264,7 @@ static CGCallee BuildAppleKextVirtualCall(CodeGenFunction &CGF, llvm::Value *VFuncPtr = CGF.Builder.CreateConstInBoundsGEP1_64(VTable, VTableIndex, "vfnkxt"); llvm::Value *VFunc = CGF.Builder.CreateAlignedLoad( - Ty, VFuncPtr, llvm::Align(CGF.PointerAlignInBytes)); + VFuncPtr, llvm::Align(CGF.PointerAlignInBytes)); CGCallee Callee(GD, VFunc); return Callee; } diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp index bc7582c67989..42801372189b 100644 --- a/clang/lib/CodeGen/CGCall.cpp +++ b/clang/lib/CodeGen/CGCall.cpp @@ -1995,14 +1995,9 @@ void CodeGenModule::ConstructAttributeList( if (TargetDecl->hasAttr()) { FuncAttrs.addAttribute(llvm::Attribute::ReadNone); FuncAttrs.addAttribute(llvm::Attribute::NoUnwind); - // gcc specifies that 'const' functions have greater restrictions than - // 'pure' functions, so they also cannot have infinite loops. - FuncAttrs.addAttribute(llvm::Attribute::WillReturn); } else if (TargetDecl->hasAttr()) { FuncAttrs.addAttribute(llvm::Attribute::ReadOnly); FuncAttrs.addAttribute(llvm::Attribute::NoUnwind); - // gcc specifies that 'pure' functions cannot have infinite loops. - FuncAttrs.addAttribute(llvm::Attribute::WillReturn); } else if (TargetDecl->hasAttr()) { FuncAttrs.addAttribute(llvm::Attribute::ArgMemOnly); FuncAttrs.addAttribute(llvm::Attribute::NoUnwind); diff --git a/clang/lib/CodeGen/CGExprAgg.cpp b/clang/lib/CodeGen/CGExprAgg.cpp index f3ab91559d30..60ea1b2af037 100644 --- a/clang/lib/CodeGen/CGExprAgg.cpp +++ b/clang/lib/CodeGen/CGExprAgg.cpp @@ -2056,7 +2056,7 @@ void CodeGenFunction::EmitAggregateCopy(LValue Dest, LValue Src, QualType Ty, Record->hasTrivialCopyAssignment() || Record->hasTrivialMoveConstructor() || Record->hasTrivialMoveAssignment() || - Record->hasAttr() || Record->isUnion()) && + Record->isUnion()) && "Trying to aggregate-copy a type without a trivial copy/move " "constructor or assignment operator"); // Ignore empty classes in C++. diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp index caa5291ff6fa..57cc2d60e2af 100644 --- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp +++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp @@ -409,7 +409,6 @@ class InlinedOpenMPRegionRAII { llvm::DenseMap LambdaCaptureFields; FieldDecl *LambdaThisCaptureField = nullptr; const CodeGen::CGBlockInfo *BlockInfo = nullptr; - bool NoInheritance = false; public: /// Constructs region for combined constructs. @@ -417,19 +416,16 @@ public: /// a list of functions used for code generation of implicitly inlined /// regions. InlinedOpenMPRegionRAII(CodeGenFunction &CGF, const RegionCodeGenTy &CodeGen, - OpenMPDirectiveKind Kind, bool HasCancel, - bool NoInheritance = true) - : CGF(CGF), NoInheritance(NoInheritance) { + OpenMPDirectiveKind Kind, bool HasCancel) + : CGF(CGF) { // Start emission for the construct. CGF.CapturedStmtInfo = new CGOpenMPInlinedRegionInfo( CGF.CapturedStmtInfo, CodeGen, Kind, HasCancel); - if (NoInheritance) { - std::swap(CGF.LambdaCaptureFields, LambdaCaptureFields); - LambdaThisCaptureField = CGF.LambdaThisCaptureField; - CGF.LambdaThisCaptureField = nullptr; - BlockInfo = CGF.BlockInfo; - CGF.BlockInfo = nullptr; - } + std::swap(CGF.LambdaCaptureFields, LambdaCaptureFields); + LambdaThisCaptureField = CGF.LambdaThisCaptureField; + CGF.LambdaThisCaptureField = nullptr; + BlockInfo = CGF.BlockInfo; + CGF.BlockInfo = nullptr; } ~InlinedOpenMPRegionRAII() { @@ -438,11 +434,9 @@ public: cast(CGF.CapturedStmtInfo)->getOldCSI(); delete CGF.CapturedStmtInfo; CGF.CapturedStmtInfo = OldCSI; - if (NoInheritance) { - std::swap(CGF.LambdaCaptureFields, LambdaCaptureFields); - CGF.LambdaThisCaptureField = LambdaThisCaptureField; - CGF.BlockInfo = BlockInfo; - } + std::swap(CGF.LambdaCaptureFields, LambdaCaptureFields); + CGF.LambdaThisCaptureField = LambdaThisCaptureField; + CGF.BlockInfo = BlockInfo; } }; @@ -3859,7 +3853,7 @@ static void emitPrivatesInit(CodeGenFunction &CGF, // Processing for implicitly captured variables. InlinedOpenMPRegionRAII Region( CGF, [](CodeGenFunction &, PrePostActionTy &) {}, OMPD_unknown, - /*HasCancel=*/false, /*NoInheritance=*/true); + /*HasCancel=*/false); SharedRefLValue = CGF.EmitLValue(Pair.second.OriginalRef); } if (Type->isArrayType()) { @@ -6220,9 +6214,7 @@ void CGOpenMPRuntime::emitInlinedDirective(CodeGenFunction &CGF, bool HasCancel) { if (!CGF.HaveInsertPoint()) return; - InlinedOpenMPRegionRAII Region(CGF, CodeGen, InnerKind, HasCancel, - InnerKind != OMPD_critical && - InnerKind != OMPD_master); + InlinedOpenMPRegionRAII Region(CGF, CodeGen, InnerKind, HasCancel); CGF.CapturedStmtInfo->EmitBody(CGF, /*S=*/nullptr); } @@ -9900,7 +9892,7 @@ void CGOpenMPRuntime::emitTargetNumIterationsCall( llvm::Value *Args[] = {RTLoc, DeviceID, NumIterations}; CGF.EmitRuntimeCall( OMPBuilder.getOrCreateRuntimeFunction( - CGM.getModule(), OMPRTL___kmpc_push_target_tripcount_mapper), + CGM.getModule(), OMPRTL___kmpc_push_target_tripcount), Args); } }; diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h index 80b8818fda60..8eb7adbc8fcb 100644 --- a/clang/lib/CodeGen/CodeGenFunction.h +++ b/clang/lib/CodeGen/CodeGenFunction.h @@ -507,23 +507,12 @@ public: /// True if the C++ Standard Requires Progress. bool CPlusPlusWithProgress() { - if (CGM.getCodeGenOpts().getFiniteLoops() == - CodeGenOptions::FiniteLoopsKind::Never) - return false; - return getLangOpts().CPlusPlus11 || getLangOpts().CPlusPlus14 || getLangOpts().CPlusPlus17 || getLangOpts().CPlusPlus20; } /// True if the C Standard Requires Progress. bool CWithProgress() { - if (CGM.getCodeGenOpts().getFiniteLoops() == - CodeGenOptions::FiniteLoopsKind::Always) - return true; - if (CGM.getCodeGenOpts().getFiniteLoops() == - CodeGenOptions::FiniteLoopsKind::Never) - return false; - return getLangOpts().C11 || getLangOpts().C17 || getLangOpts().C2x; } @@ -4775,8 +4764,7 @@ inline llvm::Value *DominatingLLVMValue::restore(CodeGenFunction &CGF, // Otherwise, it should be an alloca instruction, as set up in save(). auto alloca = cast(value.getPointer()); - return CGF.Builder.CreateAlignedLoad(alloca->getAllocatedType(), alloca, - alloca->getAlign()); + return CGF.Builder.CreateAlignedLoad(alloca, alloca->getAlign()); } } // end namespace CodeGen diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 0b9932785d85..31afbc6b4262 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -1677,8 +1677,6 @@ void CodeGenModule::SetLLVMFunctionAttributesForDefinition(const Decl *D, B.addAttribute(llvm::Attribute::StackProtectStrong); else if (LangOpts.getStackProtector() == LangOptions::SSPReq) B.addAttribute(llvm::Attribute::StackProtectReq); - else if (LangOpts.getStackProtector() == LangOptions::SSPRet) - B.addAttribute(llvm::Attribute::StackProtectRet); } if (!D) { @@ -6217,17 +6215,15 @@ llvm::SanitizerStatReport &CodeGenModule::getSanStats() { return *SanStats; } - llvm::Value * CodeGenModule::createOpenCLIntToSamplerConversion(const Expr *E, CodeGenFunction &CGF) { llvm::Constant *C = ConstantEmitter(CGF).emitAbstract(E, E->getType()); - auto *SamplerT = getOpenCLRuntime().getSamplerType(E->getType().getTypePtr()); - auto *FTy = llvm::FunctionType::get(SamplerT, {C->getType()}, false); - auto *Call = CGF.Builder.CreateCall( - CreateRuntimeFunction(FTy, "__translate_sampler_initializer"), {C}); - Call->setCallingConv(Call->getCalledFunction()->getCallingConv()); - return Call; + auto SamplerT = getOpenCLRuntime().getSamplerType(E->getType().getTypePtr()); + auto FTy = llvm::FunctionType::get(SamplerT, {C->getType()}, false); + return CGF.Builder.CreateCall(CreateRuntimeFunction(FTy, + "__translate_sampler_initializer"), + {C}); } CharUnits CodeGenModule::getNaturalPointeeTypeAlignment( diff --git a/clang/lib/CodeGen/TargetInfo.cpp b/clang/lib/CodeGen/TargetInfo.cpp index 4b916b729aeb..bcd24292ff41 100644 --- a/clang/lib/CodeGen/TargetInfo.cpp +++ b/clang/lib/CodeGen/TargetInfo.cpp @@ -223,10 +223,6 @@ const CodeGenOptions &ABIInfo::getCodeGenOpts() const { bool ABIInfo::isAndroid() const { return getTarget().getTriple().isAndroid(); } -bool ABIInfo::isOHOSFamily() const { - return getTarget().getTriple().isOHOSFamily(); -} - bool ABIInfo::isHomogeneousAggregateBaseType(QualType Ty) const { return false; } @@ -5611,7 +5607,7 @@ ABIArgInfo AArch64ABIInfo::coerceIllegalVector(QualType Ty) const { uint64_t Size = getContext().getTypeSize(Ty); // Android promotes <2 x i8> to i16, not i32 - if ((isAndroid() || isOHOSFamily()) && (Size <= 16)) { + if (isAndroid() && (Size <= 16)) { llvm::Type *ResType = llvm::Type::getInt16Ty(getVMContext()); return ABIArgInfo::getDirect(ResType); } @@ -6162,7 +6158,7 @@ public: case llvm::Triple::MuslEABIHF: return true; default: - return getTarget().getTriple().isOHOSFamily(); + return false; } } diff --git a/clang/lib/Driver/CMakeLists.txt b/clang/lib/Driver/CMakeLists.txt index 7dca74742803..aeffcf0bb43a 100644 --- a/clang/lib/Driver/CMakeLists.txt +++ b/clang/lib/Driver/CMakeLists.txt @@ -63,7 +63,6 @@ add_clang_library(clangDriver ToolChains/Myriad.cpp ToolChains/NaCl.cpp ToolChains/NetBSD.cpp - ToolChains/OHOS.cpp ToolChains/OpenBSD.cpp ToolChains/PS4CPU.cpp ToolChains/RISCVToolchain.cpp diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp index 71e3df95cb1f..418e1d3e8ec9 100644 --- a/clang/lib/Driver/Driver.cpp +++ b/clang/lib/Driver/Driver.cpp @@ -37,7 +37,6 @@ #include "ToolChains/Myriad.h" #include "ToolChains/NaCl.h" #include "ToolChains/NetBSD.h" -#include "ToolChains/OHOS.h" #include "ToolChains/OpenBSD.h" #include "ToolChains/PPCLinux.h" #include "ToolChains/PS4CPU.h" @@ -5119,8 +5118,7 @@ const ToolChain &Driver::getToolChain(const ArgList &Args, Args); else if (Target.getArch() == llvm::Triple::ve) TC = std::make_unique(*this, Target, Args); - else if (Target.isOHOSFamily()) - TC = std::make_unique(*this, Target, Args); + else TC = std::make_unique(*this, Target, Args); break; @@ -5178,9 +5176,6 @@ const ToolChain &Driver::getToolChain(const ArgList &Args, case llvm::Triple::Hurd: TC = std::make_unique(*this, Target, Args); break; - case llvm::Triple::LiteOS: - TC = std::make_unique(*this, Target, Args); - break; case llvm::Triple::ZOS: TC = std::make_unique(*this, Target, Args); break; diff --git a/clang/lib/Driver/SanitizerArgs.cpp b/clang/lib/Driver/SanitizerArgs.cpp index 571ec812670a..5c275353b679 100644 --- a/clang/lib/Driver/SanitizerArgs.cpp +++ b/clang/lib/Driver/SanitizerArgs.cpp @@ -766,7 +766,7 @@ SanitizerArgs::SanitizerArgs(const ToolChain &TC, TC.getTriple().isAndroid() || TC.getTriple().isOSFuchsia() || TC.getTriple().isOSDarwin()); - ImplicitCfiRuntime = TC.getTriple().isAndroid() || TC.getTriple().isOHOSFamily(); + ImplicitCfiRuntime = TC.getTriple().isAndroid(); if (AllAddedKinds & SanitizerKind::Address) { NeedPIE |= TC.getTriple().isOSFuchsia(); diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp index 5dc8f6720b38..b2ddef141a75 100644 --- a/clang/lib/Driver/ToolChain.cpp +++ b/clang/lib/Driver/ToolChain.cpp @@ -823,13 +823,7 @@ std::string ToolChain::ComputeLLVMTriple(const ArgList &Args, Triple.setEnvironment(isHardFloat ? Triple::MuslEABIHF : Triple::MuslEABI); break; - case Triple::OpenHOS: - break; default: { - if (Triple.isOSLiteOS()) { - Triple.setEnvironment(Triple::OpenHOS); - break; - } arm::FloatABI DefaultABI = arm::getDefaultFloatABI(Triple); if (DefaultABI != arm::FloatABI::Invalid && isHardFloat != (DefaultABI == arm::FloatABI::Hard)) { diff --git a/clang/lib/Driver/ToolChains/Arch/ARM.cpp b/clang/lib/Driver/ToolChains/Arch/ARM.cpp index a812bcb58873..ef590db1eecd 100644 --- a/clang/lib/Driver/ToolChains/Arch/ARM.cpp +++ b/clang/lib/Driver/ToolChains/Arch/ARM.cpp @@ -211,8 +211,6 @@ arm::FloatABI arm::getDefaultFloatABI(const llvm::Triple &Triple) { return FloatABI::SoftFP; default: - if (Triple.isOHOSFamily()) - return FloatABI::Soft; switch (Triple.getEnvironment()) { case llvm::Triple::GNUEABIHF: case llvm::Triple::MuslEABIHF: diff --git a/clang/lib/Driver/ToolChains/Arch/Mips.cpp b/clang/lib/Driver/ToolChains/Arch/Mips.cpp index c6a6b0ca25c3..5a509dbb2bd3 100644 --- a/clang/lib/Driver/ToolChains/Arch/Mips.cpp +++ b/clang/lib/Driver/ToolChains/Arch/Mips.cpp @@ -56,13 +56,6 @@ void mips::getMipsCPUAndABI(const ArgList &Args, const llvm::Triple &Triple, DefMips64CPU = "mips3"; } - // OHOS_LOCAL begin - // TODO: Which mips64 cpu will supported by OHOS? - if (Triple.isOpenHOS()) { - DefMips32CPU = "mips32r2"; - } - // OHOS_LOCAL end - if (Arg *A = Args.getLastArg(clang::driver::options::OPT_march_EQ, options::OPT_mcpu_EQ)) CPUName = A->getValue(); @@ -314,10 +307,6 @@ void mips::getMIPSTargetFeatures(const Driver &D, const llvm::Triple &Triple, } else D.Diag(diag::err_drv_unsupported_option_argument) << A->getOption().getName() << Val; - // OHOS_LOCAL begin - } else if (Triple.isOpenHOS()) { - Features.push_back("+nan2008"); - // OHOS_LOCAL end } if (Arg *A = Args.getLastArg(options::OPT_mabs_EQ)) { @@ -367,11 +356,6 @@ void mips::getMIPSTargetFeatures(const Driver &D, const llvm::Triple &Triple, Features.push_back("+nooddspreg"); } else Features.push_back("+fp64"); - // OHOS_LOCAL begin - } else if (Triple.isOpenHOS()) { - // Set FP64 as default in OHOS - Features.push_back("+fp64"); - // OHOS_LOCAL end } else if (mips::shouldUseFPXX(Args, Triple, CPUName, ABIName, FloatABI)) { Features.push_back("+fpxx"); Features.push_back("+nooddspreg"); @@ -482,6 +466,11 @@ bool mips::isFP64ADefault(const llvm::Triple &Triple, StringRef CPUName) { bool mips::isFPXXDefault(const llvm::Triple &Triple, StringRef CPUName, StringRef ABIName, mips::FloatABI FloatABI) { + if (Triple.getVendor() != llvm::Triple::ImaginationTechnologies && + Triple.getVendor() != llvm::Triple::MipsTechnologies && + !Triple.isAndroid()) + return false; + if (ABIName != "32") return false; diff --git a/clang/lib/Driver/ToolChains/Arch/RISCV.cpp b/clang/lib/Driver/ToolChains/Arch/RISCV.cpp index 57142464e568..ffae47e5672e 100644 --- a/clang/lib/Driver/ToolChains/Arch/RISCV.cpp +++ b/clang/lib/Driver/ToolChains/Arch/RISCV.cpp @@ -63,7 +63,7 @@ isExperimentalExtension(StringRef Ext) { Ext == "zbr" || Ext == "zbs" || Ext == "zbt" || Ext == "zbproposedc") return RISCVExtensionVersion{"0", "93"}; if (Ext == "v" || Ext == "zvamo" || Ext == "zvlsseg") - return RISCVExtensionVersion{"0", "10"}; + return RISCVExtensionVersion{"1", "0"}; if (Ext == "zfh") return RISCVExtensionVersion{"0", "1"}; return None; @@ -554,9 +554,8 @@ void riscv::getRISCVTargetFeatures(const Driver &D, const llvm::Triple &Triple, if (Args.hasArg(options::OPT_ffixed_x31)) Features.push_back("+reserve-x31"); - // lld does not support relocations used by -mrelax on RISC-V - bool DefaultMRelax = !Triple.isOpenHOS(); - if (Args.hasFlag(options::OPT_mrelax, options::OPT_mno_relax, DefaultMRelax)) + // -mrelax is default, unless -mno-relax is specified. + if (Args.hasFlag(options::OPT_mrelax, options::OPT_mno_relax, true)) Features.push_back("+relax"); else Features.push_back("-relax"); diff --git a/clang/lib/Driver/ToolChains/BareMetal.h b/clang/lib/Driver/ToolChains/BareMetal.h index c29fe67a898b..a6d4922a380f 100644 --- a/clang/lib/Driver/ToolChains/BareMetal.h +++ b/clang/lib/Driver/ToolChains/BareMetal.h @@ -34,7 +34,7 @@ protected: Tool *buildLinker() const override; public: - bool IsIntegratedAssemblerDefault() const override { return true; } + bool useIntegratedAs() const override { return true; } bool isCrossCompiling() const override { return true; } bool isPICDefault() const override { return false; } bool isPIEDefault() const override { return false; } diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index d3ec5c5329ae..fdb8a58cd1b3 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -1702,7 +1702,7 @@ void Clang::AddAArch64TargetArgs(const ArgList &Args, CmdArgs.push_back("-aarch64-fix-cortex-a53-835769=1"); else CmdArgs.push_back("-aarch64-fix-cortex-a53-835769=0"); - } else if (Triple.isAndroid() || Triple.isOHOSFamily()) { + } else if (Triple.isAndroid()) { // Enabled A53 errata (835769) workaround by default on android CmdArgs.push_back("-mllvm"); CmdArgs.push_back("-aarch64-fix-cortex-a53-835769=1"); @@ -3007,7 +3007,6 @@ static void RenderSSPOptions(const Driver &D, const ToolChain &TC, if (Arg *A = Args.getLastArg(options::OPT_fno_stack_protector, options::OPT_fstack_protector_all, - options::OPT_fstack_protector_ret, options::OPT_fstack_protector_strong, options::OPT_fstack_protector)) { if (A->getOption().matches(options::OPT_fstack_protector)) @@ -3015,8 +3014,6 @@ static void RenderSSPOptions(const Driver &D, const ToolChain &TC, std::max<>(LangOptions::SSPOn, DefaultStackProtectorLevel); else if (A->getOption().matches(options::OPT_fstack_protector_strong)) StackProtectorLevel = LangOptions::SSPStrong; - else if (A->getOption().matches(options::OPT_fstack_protector_ret)) - StackProtectorLevel = LangOptions::SSPRet; else if (A->getOption().matches(options::OPT_fstack_protector_all)) StackProtectorLevel = LangOptions::SSPReq; } else { @@ -4672,14 +4669,20 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, } } + if (Triple.isOSAIX() && Args.hasArg(options::OPT_maltivec)) { + if (Args.getLastArg(options::OPT_mabi_EQ_vec_extabi)) { + CmdArgs.push_back("-mabi=vec-extabi"); + } else { + D.Diag(diag::err_aix_default_altivec_abi); + } + } + if (Arg *A = Args.getLastArg(options::OPT_mabi_EQ_vec_extabi, options::OPT_mabi_EQ_vec_default)) { if (!Triple.isOSAIX()) D.Diag(diag::err_drv_unsupported_opt_for_target) << A->getSpelling() << RawTriple.str(); - if (A->getOption().getID() == options::OPT_mabi_EQ_vec_extabi) - CmdArgs.push_back("-mabi=vec-extabi"); - else + if (A->getOption().getID() == options::OPT_mabi_EQ_vec_default) D.Diag(diag::err_aix_default_altivec_abi); } @@ -5623,16 +5626,10 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, if (A->getOption().matches(options::OPT_freroll_loops)) CmdArgs.push_back("-freroll-loops"); - Args.AddLastArg(CmdArgs, options::OPT_ffinite_loops, - options::OPT_fno_finite_loops); - Args.AddLastArg(CmdArgs, options::OPT_fwritable_strings); Args.AddLastArg(CmdArgs, options::OPT_funroll_loops, options::OPT_fno_unroll_loops); - if (Args.hasArg(options::OPT_fenable_merge_functions)) - CmdArgs.push_back(Args.MakeArgString("-fmerge-functions")); - Args.AddLastArg(CmdArgs, options::OPT_pthread); if (Args.hasFlag(options::OPT_mspeculative_load_hardening, diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp index ce90569494c1..6a95aa5ec628 100644 --- a/clang/lib/Driver/ToolChains/CommonArgs.cpp +++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp @@ -605,11 +605,6 @@ void tools::addLTOOptions(const ToolChain &ToolChain, const ArgList &Args, CmdArgs.push_back("-plugin-opt=new-pass-manager"); } - // Pass an option to enable pseudo probe emission. - if (Args.hasFlag(options::OPT_fpseudo_probe_for_profiling, - options::OPT_fno_pseudo_probe_for_profiling, false)) - CmdArgs.push_back("-plugin-opt=pseudo-probe-for-profiling"); - // Setup statistics file output. SmallString<128> StatsFile = getStatsFileName(Args, Output, Input, D); if (!StatsFile.empty()) @@ -753,7 +748,7 @@ void tools::linkSanitizerRuntimeDeps(const ToolChain &TC, CmdArgs.push_back(getAsNeededOption(TC, false)); // There's no libpthread or librt on RTEMS & Android. if (TC.getTriple().getOS() != llvm::Triple::RTEMS && - !TC.getTriple().isAndroid() && !TC.getTriple().isOHOSFamily()) { + !TC.getTriple().isAndroid()) { CmdArgs.push_back("-lpthread"); if (!TC.getTriple().isOSOpenBSD()) CmdArgs.push_back("-lrt"); @@ -1132,18 +1127,6 @@ tools::ParsePICArgs(const ToolChain &ToolChain, const ArgList &Args) { } } - // OHOS-specific defaults for PIC/PIE - if (Triple.isOHOSFamily()) { - switch (Triple.getArch()) { - case llvm::Triple::aarch64: - PIC = true; // "-fpic" - break; - - default: - break; - } - } - // OpenBSD-specific defaults for PIE if (Triple.isOSOpenBSD()) { switch (ToolChain.getArch()) { @@ -1403,11 +1386,6 @@ static LibGccType getLibGccType(const Driver &D, const ArgList &Args) { static void AddUnwindLibrary(const ToolChain &TC, const Driver &D, ArgStringList &CmdArgs, const ArgList &Args) { ToolChain::UnwindLibType UNW = TC.GetUnwindLibType(Args); - if (TC.getTriple().isOHOSFamily() && UNW != ToolChain::UNW_None) { - CmdArgs.push_back("-l:libunwind.a"); - return; - } - // Targets that don't use unwind libraries. if (TC.getTriple().isAndroid() || TC.getTriple().isOSIAMCU() || TC.getTriple().isOSBinFormatWasm() || diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp index bcaf75e25b25..1d8a3cdce92a 100644 --- a/clang/lib/Driver/ToolChains/Gnu.cpp +++ b/clang/lib/Driver/ToolChains/Gnu.cpp @@ -393,7 +393,6 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA, const llvm::Triple &Triple = getToolChain().getEffectiveTriple(); const llvm::Triple::ArchType Arch = ToolChain.getArch(); - const bool isOHOSFamily = ToolChain.getTriple().isOHOSFamily(); const bool isAndroid = ToolChain.getTriple().isAndroid(); const bool IsIAMCU = ToolChain.getTriple().isOSIAMCU(); const bool IsVE = ToolChain.getTriple().isVE(); @@ -449,7 +448,7 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA, // Most Android ARM64 targets should enable the linker fix for erratum // 843419. Only non-Cortex-A53 devices are allowed to skip this flag. - if (Arch == llvm::Triple::aarch64 && (isAndroid || isOHOSFamily)) { + if (Arch == llvm::Triple::aarch64 && isAndroid) { std::string CPU = getCPUName(Args, Triple); if (CPU.empty() || CPU == "generic" || CPU == "cortex-a53") CmdArgs.push_back("--fix-cortex-a53-843419"); @@ -457,8 +456,8 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA, // Android does not allow shared text relocations. Emit a warning if the // user's code contains any. - if (isAndroid || isOHOSFamily) - CmdArgs.push_back("--warn-shared-textrel"); + if (isAndroid) + CmdArgs.push_back("--warn-shared-textrel"); ToolChain.addExtraOpts(CmdArgs); @@ -616,8 +615,7 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA, AddRunTimeLibs(ToolChain, D, CmdArgs, Args); - // We don't need libpthread neither for bionic nor for musl - if (WantPthread && !isAndroid && !isOHOSFamily) + if (WantPthread && !isAndroid) CmdArgs.push_back("-lpthread"); if (Args.hasArg(options::OPT_fsplit_stack)) @@ -2076,8 +2074,8 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes( // lifetime or initialization issues. static const char *const AArch64LibDirs[] = {"/lib64", "/lib"}; static const char *const AArch64Triples[] = { - "aarch64-none-linux-gnu", "aarch64-linux-gnu", "aarch64-redhat-linux", - "aarch64-suse-linux", "aarch64-linux-android", "aarch64-linux-ohos"}; + "aarch64-none-linux-gnu", "aarch64-linux-gnu", "aarch64-redhat-linux", + "aarch64-suse-linux", "aarch64-linux-android"}; static const char *const AArch64beLibDirs[] = {"/lib"}; static const char *const AArch64beTriples[] = {"aarch64_be-none-linux-gnu", "aarch64_be-linux-gnu"}; @@ -2105,8 +2103,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes( "x86_64-redhat-linux", "x86_64-suse-linux", "x86_64-manbo-linux-gnu", "x86_64-linux-gnu", "x86_64-slackware-linux", "x86_64-unknown-linux", - "x86_64-amazon-linux", "x86_64-linux-android", - "x86_64-linux-ohos"}; + "x86_64-amazon-linux", "x86_64-linux-android"}; static const char *const X32LibDirs[] = {"/libx32"}; static const char *const X86LibDirs[] = {"/lib32", "/lib"}; static const char *const X86Triples[] = { @@ -2124,7 +2121,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes( static const char *const MIPSELLibDirs[] = {"/lib"}; static const char *const MIPSELTriples[] = { "mipsel-linux-gnu", "mips-img-linux-gnu", "mipsisa32r6el-linux-gnu", - "mipsel-linux-android", "mipsel-linux-ohos"}; + "mipsel-linux-android"}; static const char *const MIPS64LibDirs[] = {"/lib64", "/lib"}; static const char *const MIPS64Triples[] = { diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp index 9663a7390ada..e17a6bd4bdd2 100644 --- a/clang/lib/Driver/ToolChains/Linux.cpp +++ b/clang/lib/Driver/ToolChains/Linux.cpp @@ -236,6 +236,15 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args) ExtraOpts.push_back("relro"); } + if (Triple.isAndroid() && Triple.isAndroidVersionLT(29)) { + // https://github.com/android/ndk/issues/1196 + // The unwinder used by the crash handler on versions of Android prior to + // API 29 did not correctly handle binaries built with rosegment, which is + // enabled by default for LLD. Android only supports LLD, so it's not an + // issue that this flag is not accepted by other linkers. + ExtraOpts.push_back("--no-rosegment"); + } + // Android ARM/AArch64 use max-page-size=4096 to reduce VMA usage. Note, lld // from 11 onwards default max-page-size to 65536 for both ARM and AArch64. if ((Triple.isARM() || Triple.isAArch64()) && Triple.isAndroid()) { diff --git a/clang/lib/Driver/ToolChains/MSVC.cpp b/clang/lib/Driver/ToolChains/MSVC.cpp index 13943b6c404a..f4b7a57e0bb7 100644 --- a/clang/lib/Driver/ToolChains/MSVC.cpp +++ b/clang/lib/Driver/ToolChains/MSVC.cpp @@ -11,7 +11,6 @@ #include "Darwin.h" #include "clang/Basic/CharInfo.h" #include "clang/Basic/Version.h" -#include "clang/Config/config.h" #include "clang/Driver/Compilation.h" #include "clang/Driver/Driver.h" #include "clang/Driver/DriverDiagnostic.h" @@ -521,10 +520,7 @@ void visualstudio::Linker::ConstructJob(Compilation &C, const JobAction &JA, // translate 'lld' into 'lld-link', and in the case of the regular msvc // linker, we need to use a special search algorithm. llvm::SmallString<128> linkPath; - StringRef Linker - = Args.getLastArgValue(options::OPT_fuse_ld_EQ, CLANG_DEFAULT_LINKER); - if (Linker.empty()) - Linker = "link"; + StringRef Linker = Args.getLastArgValue(options::OPT_fuse_ld_EQ, "link"); if (Linker.equals_lower("lld")) Linker = "lld-link"; diff --git a/clang/lib/Driver/ToolChains/OHOS.cpp b/clang/lib/Driver/ToolChains/OHOS.cpp deleted file mode 100644 index fe952bbf9b7e..000000000000 --- a/clang/lib/Driver/ToolChains/OHOS.cpp +++ /dev/null @@ -1,456 +0,0 @@ -//===--- OHOS.cpp - OHOS ToolChain Implementations --------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#include "OHOS.h" -#include "Arch/ARM.h" -#include "CommonArgs.h" -#include "clang/Config/config.h" -#include "clang/Driver/Compilation.h" -#include "clang/Driver/Driver.h" -#include "clang/Driver/DriverDiagnostic.h" -#include "clang/Driver/Options.h" -#include "clang/Driver/SanitizerArgs.h" -#include "llvm/Option/ArgList.h" -#include "llvm/ProfileData/InstrProf.h" -#include "llvm/Support/FileSystem.h" -#include "llvm/Support/Path.h" -#include "llvm/Support/VirtualFileSystem.h" -#include "llvm/Support/ScopedPrinter.h" - -using namespace clang::driver; -using namespace clang::driver::toolchains; -using namespace clang::driver::tools; -using namespace clang; -using namespace llvm::opt; -using namespace clang::driver::tools::arm; - -using tools::addMultilibFlag; -using tools::addPathIfExists; - -static bool findOHOSMuslMultilibs(const Multilib::flags_list &Flags, - DetectedMultilibs &Result) { - MultilibSet Multilibs; - Multilibs.push_back(Multilib()); - // -mcpu=cortex-a7 - // -mfloat-abi=soft -mfloat-abi=softfp -mfloat-abi=hard - // -mfpu=neon-vfpv4 - Multilibs.push_back(Multilib("a7_soft", {}, {}, 1) - .flag("+mcpu=cortex-a7") - .flag("+mfloat-abi=soft")); - - Multilibs.push_back(Multilib("a7_softfp_neon-vfpv4", {}, {}, 1) - .flag("+mcpu=cortex-a7") - .flag("+mfloat-abi=softfp") - .flag("+mfpu=neon-vfpv4")); - - Multilibs.push_back(Multilib("a7_hard_neon-vfpv4", {}, {}, 1) - .flag("+mcpu=cortex-a7") - .flag("+mfloat-abi=hard") - .flag("+mfpu=neon-vfpv4")); - - Multilibs.push_back(Multilib("nanlegacy", {}, {}, 1) - .flag("+mnan=legacy")); - - if (Multilibs.select(Flags, Result.SelectedMultilib)) { - Result.Multilibs = Multilibs; - return true; - } - return false; -} - -static bool findOHOSMultilibs(const Driver &D, - const ToolChain &TC, - const llvm::Triple &TargetTriple, - StringRef Path, const ArgList &Args, - DetectedMultilibs &Result) { - Multilib::flags_list Flags; - - bool IsA7 = false; - if (const Arg *A = Args.getLastArg(options::OPT_mcpu_EQ)) - IsA7 = A->getValue() == StringRef("cortex-a7"); - addMultilibFlag(IsA7, "mcpu=cortex-a7", Flags); - - bool IsMFPU = false; - if (const Arg *A = Args.getLastArg(options::OPT_mfpu_EQ)) - IsMFPU = A->getValue() == StringRef("neon-vfpv4"); - addMultilibFlag(IsMFPU, "mfpu=neon-vfpv4", Flags); - - tools::arm::FloatABI ARMFloatABI = getARMFloatABI(D, TargetTriple, Args); - addMultilibFlag((ARMFloatABI == tools::arm::FloatABI::Soft), - "mfloat-abi=soft", Flags); - addMultilibFlag((ARMFloatABI == tools::arm::FloatABI::SoftFP), - "mfloat-abi=softfp", Flags); - addMultilibFlag((ARMFloatABI == tools::arm::FloatABI::Hard), - "mfloat-abi=hard", Flags); - - bool IsLegacy = false; - if (const Arg *A = Args.getLastArg(options::OPT_mnan_EQ)) - IsLegacy = A->getValue() != StringRef("2008"); - addMultilibFlag(IsLegacy, "mnan=legacy", Flags); - - return findOHOSMuslMultilibs(Flags, Result); -} - -std::string OHOS::getMultiarchTriple(const llvm::Triple &T) const { - // For most architectures, just use whatever we have rather than trying to be - // clever. - switch (T.getArch()) { - default: - break; - - // We use the existence of '/lib/' as a directory to detect some - // common linux triples that don't quite match the Clang triple for both - // 32-bit and 64-bit targets. Multiarch fixes its install triples to these - // regardless of what the actual target triple is. - case llvm::Triple::arm: - case llvm::Triple::thumb: - return T.isOSLiteOS() ? "arm-liteos-ohos" : "arm-linux-ohos"; - case llvm::Triple::riscv32: - return "riscv32-liteos-ohos"; - case llvm::Triple::riscv64: - return "riscv64-linux-ohos"; - case llvm::Triple::mipsel: - return "mipsel-linux-ohos"; - case llvm::Triple::x86: - return "i686-linux-ohos"; - case llvm::Triple::x86_64: - return "x86_64-linux-ohos"; - case llvm::Triple::aarch64: - return "aarch64-linux-ohos"; - } - return T.str(); -} - -std::string OHOS::getMultiarchTriple(const Driver &D, - const llvm::Triple &TargetTriple, - StringRef SysRoot) const { - return getMultiarchTriple(TargetTriple); -} - -static std::string makePath(const std::initializer_list &IL) { - SmallString<128> P; - for (const auto &S : IL) - llvm::sys::path::append(P, S); - return static_cast(P.str()); -} - -/// OHOS Toolchain -OHOS::OHOS(const Driver &D, const llvm::Triple &Triple, const ArgList &Args) - : Generic_ELF(D, Triple, Args) { - std::string SysRoot = computeSysRoot(); - - // Select the correct multilib according to the given arguments. - DetectedMultilibs Result; - findOHOSMultilibs(D, *this, Triple, "", Args, Result); - Multilibs = Result.Multilibs; - SelectedMultilib = Result.SelectedMultilib; - - getFilePaths().clear(); - if (D.CCCIsCXX()) { - if (auto CXXStdlibPath = getCXXStdlibPath()) - getFilePaths().push_back(*CXXStdlibPath); - } - - std::string CandidateLibPath = getArchSpecificLibPath(); - if (getVFS().exists(CandidateLibPath)) - getFilePaths().push_back(CandidateLibPath); - - getLibraryPaths().clear(); - if (auto RuntimePath = getRuntimePath()) - getLibraryPaths().push_back(*RuntimePath); - - // OHOS sysroots contain a library directory for each supported OS - // version as well as some unversioned libraries in the usual multiarch - // directory. Support --target=aarch64-linux-ohosX.Y.Z or - // --target=aarch64-linux-ohosX.Y or --target=aarch64-linux-ohosX - unsigned Major; - unsigned Minor; - unsigned Micro; - Triple.getEnvironmentVersion(Major, Minor, Micro); - path_list &Paths = getFilePaths(); - std::string SysRootLibPath = makePath({SysRoot, "usr", "lib"}); - std::string MultiarchTriple = getMultiarchTriple(getTriple()); - addPathIfExists(D, makePath({SysRootLibPath, SelectedMultilib.gccSuffix()}), - Paths); - addPathIfExists(D, - makePath({D.Dir, "..", "lib", MultiarchTriple, - SelectedMultilib.gccSuffix()}), - Paths); - - // For compatibility with arm-liteos sysroot - // FIXME: Remove this when we'll use arm-liteos sysroot produced by build.py. - addPathIfExists( - D, - makePath({SysRootLibPath, MultiarchTriple, SelectedMultilib.gccSuffix()}), - Paths); -} - -std::string OHOS::ComputeEffectiveClangTriple(const ArgList &Args, - types::ID InputType) const { - // Don't modify this, it is impact of the toolchain and target init process. - return ComputeLLVMTriple(Args, InputType); -} - -ToolChain::RuntimeLibType OHOS::GetRuntimeLibType( - const ArgList &Args) const { - if (Arg *A = Args.getLastArg(clang::driver::options::OPT_rtlib_EQ)) { - StringRef Value = A->getValue(); - if (Value != "compiler-rt") - getDriver().Diag(clang::diag::err_drv_invalid_rtlib_name) - << A->getAsString(Args); - } - - return ToolChain::RLT_CompilerRT; -} - -ToolChain::CXXStdlibType -OHOS::GetCXXStdlibType(const ArgList &Args) const { - if (Arg *A = Args.getLastArg(options::OPT_stdlib_EQ)) { - StringRef Value = A->getValue(); - if (Value != "libc++") - getDriver().Diag(diag::err_drv_invalid_stdlib_name) - << A->getAsString(Args); - } - - return ToolChain::CST_Libcxx; -} - -void OHOS::AddClangSystemIncludeArgs(const ArgList &DriverArgs, - ArgStringList &CC1Args) const { - const Driver &D = getDriver(); - const llvm::Triple &Triple = getTriple(); - std::string SysRoot = computeSysRoot(); - - if (DriverArgs.hasArg(options::OPT_nostdinc)) - return; - - if (!DriverArgs.hasArg(options::OPT_nobuiltininc)) { - SmallString<128> P(D.ResourceDir); - llvm::sys::path::append(P, "include"); - addSystemInclude(DriverArgs, CC1Args, P); - } - - if (DriverArgs.hasArg(options::OPT_nostdlibinc)) - return; - - // Check for configure-time C include directories. - StringRef CIncludeDirs(C_INCLUDE_DIRS); - if (CIncludeDirs != "") { - SmallVector dirs; - CIncludeDirs.split(dirs, ":"); - for (StringRef dir : dirs) { - StringRef Prefix = - llvm::sys::path::is_absolute(dir) ? StringRef(SysRoot) : ""; - addExternCSystemInclude(DriverArgs, CC1Args, Prefix + dir); - } - return; - } - - addExternCSystemInclude(DriverArgs, CC1Args, - SysRoot + "/usr/include/" + - getMultiarchTriple(Triple)); - addExternCSystemInclude(DriverArgs, CC1Args, SysRoot + "/include"); - addExternCSystemInclude(DriverArgs, CC1Args, SysRoot + "/usr/include"); -} - -void OHOS::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs, - ArgStringList &CC1Args) const { - if (DriverArgs.hasArg(options::OPT_nostdlibinc) || - DriverArgs.hasArg(options::OPT_nostdincxx)) - return; - - switch (GetCXXStdlibType(DriverArgs)) { - case ToolChain::CST_Libcxx: { - std::string Path = makePath({getDriver().Dir, "..", "include", - "libcxx-ohos", "include", "c++", "v1"}); - addSystemInclude(DriverArgs, CC1Args, Path); - break; - } - - default: - llvm_unreachable("invalid stdlib name"); - } -} - -void OHOS::AddCXXStdlibLibArgs(const ArgList &Args, - ArgStringList &CmdArgs) const { - switch (GetCXXStdlibType(Args)) { - case ToolChain::CST_Libcxx: - CmdArgs.push_back("-lc++"); - CmdArgs.push_back("-lc++abi"); - CmdArgs.push_back("-lunwind"); - break; - - case ToolChain::CST_Libstdcxx: - llvm_unreachable("invalid stdlib name"); - } -} - -std::string OHOS::computeSysRoot() const { - std::string SysRoot = - !getDriver().SysRoot.empty() - ? getDriver().SysRoot - : makePath({getDriver().getInstalledDir(), "..", "..", "sysroot"}); - if (!llvm::sys::fs::exists(SysRoot)) - return std::string(); - - std::string ArchRoot = makePath({SysRoot, getMultiarchTriple(getTriple())}); - return llvm::sys::fs::exists(ArchRoot) ? ArchRoot : SysRoot; -} - -Optional OHOS::getRuntimePath() const { - SmallString<128> P; - const Driver &D = getDriver(); - const llvm::Triple &Triple = getTriple(); - - // First try the triple passed to driver as --target=. - P.assign(D.ResourceDir); - llvm::sys::path::append(P, "lib", D.getTargetTriple(), SelectedMultilib.gccSuffix()); - if (getVFS().exists(P)) - return llvm::Optional(static_cast(P.str())); - - // Second try the normalized triple. - P.assign(D.ResourceDir); - llvm::sys::path::append(P, "lib", Triple.str(), SelectedMultilib.gccSuffix()); - if (getVFS().exists(P)) - return llvm::Optional(static_cast(P.str())); - - // Third try the effective triple. - P.assign(D.ResourceDir); - std::string SysRoot = computeSysRoot(); - llvm::sys::path::append(P, "lib", getMultiarchTriple(Triple), - SelectedMultilib.gccSuffix()); - if (getVFS().exists(P)) - return llvm::Optional(static_cast(P.str())); - - return None; -} - -Optional OHOS::getCXXStdlibPath() const { - const Driver &D = getDriver(); - std::string SysRoot = computeSysRoot(); - const std::string &MultiarchTriple = getMultiarchTriple(getTriple()); - - const std::string &P = makePath({D.Dir, "..", "lib", MultiarchTriple, "c++", - SelectedMultilib.gccSuffix()}); - if (getVFS().exists(P)) - return llvm::Optional(P); - - return None; -} - -std::string OHOS::getDynamicLinker(const ArgList &Args) const { - const llvm::Triple &Triple = getTriple(); - const llvm::Triple::ArchType Arch = getArch(); - - assert(Triple.isMusl()); - std::string ArchName; - bool IsArm = false; - - switch (Arch) { - case llvm::Triple::arm: - case llvm::Triple::thumb: - ArchName = "arm"; - IsArm = true; - break; - case llvm::Triple::armeb: - case llvm::Triple::thumbeb: - ArchName = "armeb"; - IsArm = true; - break; - default: - ArchName = Triple.getArchName().str(); - } - if (IsArm && - (tools::arm::getARMFloatABI(*this, Args) == tools::arm::FloatABI::Hard)) - ArchName += "hf"; - - return "/lib/ld-musl-" + ArchName + ".so.1"; -} - -std::string OHOS::getCompilerRT(const ArgList &Args, StringRef Component, - FileType Type) const { - SmallString<128> Path(getDriver().ResourceDir); - llvm::sys::path::append(Path, "lib", getMultiarchTriple(getTriple()), - SelectedMultilib.gccSuffix()); - const char *Prefix = - Type == ToolChain::FT_Object ? "" : "lib"; - const char *Suffix; - switch (Type) { - case ToolChain::FT_Object: - Suffix = ".o"; - break; - case ToolChain::FT_Static: - Suffix = ".a"; - break; - case ToolChain::FT_Shared: - Suffix = ".so"; - break; - } - llvm::sys::path::append( - Path, Prefix + Twine("clang_rt.") + Component + Suffix); - return static_cast(Path.str()); -} - -void OHOS::addExtraOpts(llvm::opt::ArgStringList &CmdArgs) const { - CmdArgs.push_back("-z"); - CmdArgs.push_back("now"); - CmdArgs.push_back("-z"); - CmdArgs.push_back("relro"); - CmdArgs.push_back("-z"); - CmdArgs.push_back("max-page-size=4096"); - // .gnu.hash section is not compatible with the MIPS target - if (getArch() != llvm::Triple::mipsel) { - CmdArgs.push_back("--hash-style=gnu"); - // FIXME: gnu or both??? - CmdArgs.push_back("--hash-style=both"); - } -#ifdef ENABLE_LINKER_BUILD_ID - CmdArgs.push_back("--build-id"); -#endif - CmdArgs.push_back("--enable-new-dtags"); -} - -SanitizerMask OHOS::getSupportedSanitizers() const { - SanitizerMask Res = ToolChain::getSupportedSanitizers(); - Res |= SanitizerKind::Address; - Res |= SanitizerKind::PointerCompare; - Res |= SanitizerKind::PointerSubtract; - Res |= SanitizerKind::Fuzzer; - Res |= SanitizerKind::FuzzerNoLink; - Res |= SanitizerKind::Memory; - Res |= SanitizerKind::Vptr; - Res |= SanitizerKind::SafeStack; - Res |= SanitizerKind::Scudo; - Res |= SanitizerKind::KernelAddress; - Res |= SanitizerKind::KernelMemory; - // TODO: Support TSAN and HWASAN and update mask. - return Res; -} - -// TODO: Make a base class for Linux and OHOS and move this there. -void OHOS::addProfileRTLibs(const llvm::opt::ArgList &Args, - llvm::opt::ArgStringList &CmdArgs) const { - // Add linker option -u__llvm_profile_runtime to cause runtime - // initialization module to be linked in. - if (needsProfileRT(Args)) - CmdArgs.push_back(Args.MakeArgString( - Twine("-u", llvm::getInstrProfRuntimeHookVarName()))); - ToolChain::addProfileRTLibs(Args, CmdArgs); -} - -std::string OHOS::getArchSpecificLibPath() const { - llvm::Triple Triple = getTriple(); - return makePath({getDriver().ResourceDir, "lib", getMultiarchTriple(Triple)}); -} - -ToolChain::UnwindLibType OHOS::GetUnwindLibType(const llvm::opt::ArgList &Args) const { - if (const Arg *A = Args.getLastArg(options::OPT_unwindlib_EQ)) - return Generic_ELF::GetUnwindLibType(Args); - return GetDefaultUnwindLibType(); -} \ No newline at end of file diff --git a/clang/lib/Driver/ToolChains/OHOS.h b/clang/lib/Driver/ToolChains/OHOS.h deleted file mode 100644 index 002ee71f7b90..000000000000 --- a/clang/lib/Driver/ToolChains/OHOS.h +++ /dev/null @@ -1,103 +0,0 @@ -//===--- OHOS.h - OHOS ToolChain Implementations ----------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_OHOS_H -#define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_OHOS_H - -#include "Linux.h" -#include "clang/Driver/Tool.h" -#include "clang/Driver/ToolChain.h" - -namespace clang { -namespace driver { -namespace toolchains { - -class LLVM_LIBRARY_VISIBILITY OHOS : public Generic_ELF { -public: - OHOS(const Driver &D, const llvm::Triple &Triple, - const llvm::opt::ArgList &Args); - - bool HasNativeLLVMSupport() const override { return true; } - bool IsIntegratedAssemblerDefault() const override { return true; } - bool IsMathErrnoDefault() const override { return false; } - RuntimeLibType GetDefaultRuntimeLibType() const override { - return ToolChain::RLT_CompilerRT; - } - CXXStdlibType GetDefaultCXXStdlibType() const override { - return ToolChain::CST_Libcxx; - } - // Not add -funwind-tables by default - bool IsUnwindTablesDefault(const llvm::opt::ArgList &Args) const override { - return false; - } - bool isPICDefault() const override { return false; } - bool isPIEDefault() const override { return true; } - bool isPICDefaultForced() const override { return false; } - bool isNoExecStackDefault() const override { return true; } - bool useRelaxRelocations() const override { return false; } - UnwindLibType GetUnwindLibType(const llvm::opt::ArgList &Args) const override; - UnwindLibType GetDefaultUnwindLibType() const override { return UNW_CompilerRT; } - - std::string ComputeEffectiveClangTriple(const llvm::opt::ArgList &Args, - types::ID InputType = types::TY_INVALID) const override; - - RuntimeLibType - GetRuntimeLibType(const llvm::opt::ArgList &Args) const override; - CXXStdlibType - GetCXXStdlibType(const llvm::opt::ArgList &Args) const override; - - void - AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs, - llvm::opt::ArgStringList &CC1Args) const override; - void - AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList &DriverArgs, - llvm::opt::ArgStringList &CC1Args) const override; - void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args, - llvm::opt::ArgStringList &CmdArgs) const override; - - std::string computeSysRoot() const override; - std::string getDynamicLinker(const llvm::opt::ArgList &Args) const override; - - std::string - getCompilerRT(const llvm::opt::ArgList &Args, StringRef Component, - FileType Type = ToolChain::FT_Static) const override; - - const char *getDefaultLinker() const override { - return "ld.lld"; - } - - Tool *buildLinker() const override { - return new tools::gnutools::Linker(*this); - } - Tool *buildAssembler() const override { - return new tools::gnutools::Assembler(*this); - } - - Optional getRuntimePath() const override; - Optional getCXXStdlibPath() const override; - -protected: - std::string getMultiarchTriple(const llvm::Triple &T) const; - std::string getMultiarchTriple(const Driver &D, - const llvm::Triple &TargetTriple, - StringRef SysRoot) const override; - void addExtraOpts(llvm::opt::ArgStringList &CmdArgs) const override; - SanitizerMask getSupportedSanitizers() const override; - void addProfileRTLibs(const llvm::opt::ArgList &Args, - llvm::opt::ArgStringList &CmdArgs) const override; - std::string getArchSpecificLibPath() const override; - -private: - Multilib SelectedMultilib; -}; - -} // end namespace toolchains -} // end namespace driver -} // end namespace clang - -#endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_OHOS_H diff --git a/clang/lib/Driver/ToolChains/OpenBSD.cpp b/clang/lib/Driver/ToolChains/OpenBSD.cpp index e162165b2561..f155d74632f9 100644 --- a/clang/lib/Driver/ToolChains/OpenBSD.cpp +++ b/clang/lib/Driver/ToolChains/OpenBSD.cpp @@ -296,7 +296,6 @@ void OpenBSD::AddCXXStdlibLibArgs(const ArgList &Args, CmdArgs.push_back(Profiling ? "-lc++_p" : "-lc++"); CmdArgs.push_back(Profiling ? "-lc++abi_p" : "-lc++abi"); - CmdArgs.push_back(Profiling ? "-lpthread_p" : "-lpthread"); } std::string OpenBSD::getCompilerRT(const ArgList &Args, diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index 82d6cfed308d..34c291ecc492 100755 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -1917,12 +1917,12 @@ private: if (Tok.Next->isOneOf(tok::identifier, tok::kw_this)) return true; - // Look for a cast `( x ) (`. - if (Tok.Next->is(tok::l_paren) && Tok.Previous && Tok.Previous->Previous) { - if (Tok.Previous->is(tok::identifier) && - Tok.Previous->Previous->is(tok::l_paren)) - return true; - } + if (Tok.Next->is(tok::l_paren) && + !(Tok.Previous && Tok.Previous->is(tok::identifier) && + Tok.Previous->Previous && + Tok.Previous->Previous->isOneOf(tok::arrowstar, tok::arrow, + tok::star))) + return true; if (!Tok.Next->Next) return false; diff --git a/clang/lib/Format/UnwrappedLineFormatter.cpp b/clang/lib/Format/UnwrappedLineFormatter.cpp index 7d197310e65b..d1138bbc9c36 100644 --- a/clang/lib/Format/UnwrappedLineFormatter.cpp +++ b/clang/lib/Format/UnwrappedLineFormatter.cpp @@ -371,7 +371,7 @@ private: if (Previous->is(tok::comment)) Previous = Previous->getPreviousNonComment(); if (Previous) { - if (Previous->is(tok::greater) && !I[-1]->InPPDirective) + if (Previous->is(tok::greater)) return 0; if (Previous->is(tok::identifier)) { const FormatToken *PreviousPrevious = @@ -1281,6 +1281,13 @@ void UnwrappedLineFormatter::formatFirstToken( if (Newlines) Indent = NewlineIndent; + // If in Whitemsmiths mode, indent start and end of blocks + if (Style.BreakBeforeBraces == FormatStyle::BS_Whitesmiths) { + if (RootToken.isOneOf(tok::l_brace, tok::r_brace, tok::kw_case, + tok::kw_default)) + Indent += Style.IndentWidth; + } + // Preprocessor directives get indented before the hash only if specified if (Style.IndentPPDirectives != FormatStyle::PPDIS_BeforeHash && (Line.Type == LT_PreprocessorDirective || diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp index bec18bd5d8df..f689a6361a3a 100644 --- a/clang/lib/Format/UnwrappedLineParser.cpp +++ b/clang/lib/Format/UnwrappedLineParser.cpp @@ -579,23 +579,17 @@ size_t UnwrappedLineParser::computePPHash() const { return h; } -void UnwrappedLineParser::parseBlock(bool MustBeDeclaration, unsigned AddLevels, - bool MunchSemi, - bool UnindentWhitesmithsBraces) { +void UnwrappedLineParser::parseBlock(bool MustBeDeclaration, bool AddLevel, + bool MunchSemi) { assert(FormatTok->isOneOf(tok::l_brace, TT_MacroBlockBegin) && "'{' or macro block token expected"); const bool MacroBlock = FormatTok->is(TT_MacroBlockBegin); FormatTok->setBlockKind(BK_Block); - // For Whitesmiths mode, jump to the next level prior to skipping over the - // braces. - if (AddLevels > 0 && Style.BreakBeforeBraces == FormatStyle::BS_Whitesmiths) - ++Line->Level; - size_t PPStartHash = computePPHash(); unsigned InitialLevel = Line->Level; - nextToken(/*LevelDifference=*/AddLevels); + nextToken(/*LevelDifference=*/AddLevel ? 1 : 0); if (MacroBlock && FormatTok->is(tok::l_paren)) parseParens(); @@ -608,16 +602,10 @@ void UnwrappedLineParser::parseBlock(bool MustBeDeclaration, unsigned AddLevels, ? (UnwrappedLine::kInvalidIndex) : (CurrentLines->size() - 1 - NbPreprocessorDirectives); - // Whitesmiths is weird here. The brace needs to be indented for the namespace - // block, but the block itself may not be indented depending on the style - // settings. This allows the format to back up one level in those cases. - if (UnindentWhitesmithsBraces) - --Line->Level; - ScopedDeclarationState DeclarationState(*Line, DeclarationScopeStack, MustBeDeclaration); - if (AddLevels > 0u && Style.BreakBeforeBraces != FormatStyle::BS_Whitesmiths) - Line->Level += AddLevels; + if (AddLevel) + ++Line->Level; parseLevel(/*HasOpeningBrace=*/true); if (eof()) @@ -633,7 +621,7 @@ void UnwrappedLineParser::parseBlock(bool MustBeDeclaration, unsigned AddLevels, size_t PPEndHash = computePPHash(); // Munch the closing brace. - nextToken(/*LevelDifference=*/-AddLevels); + nextToken(/*LevelDifference=*/AddLevel ? -1 : 0); if (MacroBlock && FormatTok->is(tok::l_paren)) parseParens(); @@ -649,7 +637,6 @@ void UnwrappedLineParser::parseBlock(bool MustBeDeclaration, unsigned AddLevels, nextToken(); Line->Level = InitialLevel; - FormatTok->setBlockKind(BK_Block); if (PPStartHash == PPEndHash) { Line->MatchingOpeningBlockLineIndex = OpeningLineIndex; @@ -2141,34 +2128,15 @@ void UnwrappedLineParser::parseNamespace() { if (ShouldBreakBeforeBrace(Style, InitialToken)) addUnwrappedLine(); - unsigned AddLevels = - Style.NamespaceIndentation == FormatStyle::NI_All || - (Style.NamespaceIndentation == FormatStyle::NI_Inner && - DeclarationScopeStack.size() > 1) - ? 1u - : 0u; - bool ManageWhitesmithsBraces = - AddLevels == 0u && - Style.BreakBeforeBraces == FormatStyle::BS_Whitesmiths; - - // If we're in Whitesmiths mode, indent the brace if we're not indenting - // the whole block. - if (ManageWhitesmithsBraces) - ++Line->Level; - - parseBlock(/*MustBeDeclaration=*/true, AddLevels, - /*MunchSemi=*/true, - /*UnindentWhitesmithsBraces=*/ManageWhitesmithsBraces); - + bool AddLevel = Style.NamespaceIndentation == FormatStyle::NI_All || + (Style.NamespaceIndentation == FormatStyle::NI_Inner && + DeclarationScopeStack.size() > 1); + parseBlock(/*MustBeDeclaration=*/true, AddLevel); // Munch the semicolon after a namespace. This is more common than one would // think. Putting the semicolon into its own line is very ugly. if (FormatTok->Tok.is(tok::semi)) nextToken(); - - addUnwrappedLine(AddLevels > 0 ? LineLevel::Remove : LineLevel::Keep); - - if (ManageWhitesmithsBraces) - --Line->Level; + addUnwrappedLine(); } // FIXME: Add error handling. } @@ -2254,11 +2222,6 @@ void UnwrappedLineParser::parseDoWhile() { return; } - // If in Whitesmiths mode, the line with the while() needs to be indented - // to the same level as the block. - if (Style.BreakBeforeBraces == FormatStyle::BS_Whitesmiths) - ++Line->Level; - nextToken(); parseStructuralElement(); } @@ -2271,19 +2234,25 @@ void UnwrappedLineParser::parseLabel(bool LeftAlignLabel) { if (LeftAlignLabel) Line->Level = 0; + bool RemoveWhitesmithsCaseIndent = + (!Style.IndentCaseBlocks && + Style.BreakBeforeBraces == FormatStyle::BS_Whitesmiths); + + if (RemoveWhitesmithsCaseIndent) + --Line->Level; + if (!Style.IndentCaseBlocks && CommentsBeforeNextToken.empty() && FormatTok->Tok.is(tok::l_brace)) { - CompoundStatementIndenter Indenter(this, Line->Level, - Style.BraceWrapping.AfterCaseLabel, - Style.BraceWrapping.IndentBraces); + CompoundStatementIndenter Indenter( + this, Line->Level, Style.BraceWrapping.AfterCaseLabel, + Style.BraceWrapping.IndentBraces || RemoveWhitesmithsCaseIndent); parseBlock(/*MustBeDeclaration=*/false); if (FormatTok->Tok.is(tok::kw_break)) { if (Style.BraceWrapping.AfterControlStatement == FormatStyle::BWACS_Always) { addUnwrappedLine(); - if (!Style.IndentCaseBlocks && - Style.BreakBeforeBraces == FormatStyle::BS_Whitesmiths) { + if (RemoveWhitesmithsCaseIndent) { Line->Level++; } } @@ -2951,29 +2920,17 @@ LLVM_ATTRIBUTE_UNUSED static void printDebugInfo(const UnwrappedLine &Line, llvm::dbgs() << "\n"; } -void UnwrappedLineParser::addUnwrappedLine(LineLevel AdjustLevel) { +void UnwrappedLineParser::addUnwrappedLine() { if (Line->Tokens.empty()) return; LLVM_DEBUG({ if (CurrentLines == &Lines) printDebugInfo(*Line); }); - - // If this line closes a block when in Whitesmiths mode, remember that - // information so that the level can be decreased after the line is added. - // This has to happen after the addition of the line since the line itself - // needs to be indented. - bool ClosesWhitesmithsBlock = - Line->MatchingOpeningBlockLineIndex != UnwrappedLine::kInvalidIndex && - Style.BreakBeforeBraces == FormatStyle::BS_Whitesmiths; - CurrentLines->push_back(std::move(*Line)); Line->Tokens.clear(); Line->MatchingOpeningBlockLineIndex = UnwrappedLine::kInvalidIndex; Line->FirstStartColumn = 0; - - if (ClosesWhitesmithsBlock && AdjustLevel == LineLevel::Remove) - --Line->Level; if (CurrentLines == &Lines && !PreprocessorDirectives.empty()) { CurrentLines->append( std::make_move_iterator(PreprocessorDirectives.begin()), diff --git a/clang/lib/Format/UnwrappedLineParser.h b/clang/lib/Format/UnwrappedLineParser.h index ce135fac5e57..02b328cb72de 100644 --- a/clang/lib/Format/UnwrappedLineParser.h +++ b/clang/lib/Format/UnwrappedLineParser.h @@ -85,9 +85,8 @@ private: void reset(); void parseFile(); void parseLevel(bool HasOpeningBrace); - void parseBlock(bool MustBeDeclaration, unsigned AddLevels = 1u, - bool MunchSemi = true, - bool UnindentWhitesmithsBraces = false); + void parseBlock(bool MustBeDeclaration, bool AddLevel = true, + bool MunchSemi = true); void parseChildBlock(); void parsePPDirective(); void parsePPDefine(); @@ -141,12 +140,7 @@ private: bool tryToParsePropertyAccessor(); void tryToParseJSFunction(); bool tryToParseSimpleAttribute(); - - // Used by addUnwrappedLine to denote whether to keep or remove a level - // when resetting the line state. - enum class LineLevel { Remove, Keep }; - - void addUnwrappedLine(LineLevel AdjustLevel = LineLevel::Remove); + void addUnwrappedLine(); bool eof() const; // LevelDifference is the difference of levels after and before the current // token. For example: diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index 5c5cf46150e2..d8be4ea14868 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -1037,6 +1037,7 @@ bool CompilerInvocation::ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, Opts.UnrollLoops = Args.hasFlag(OPT_funroll_loops, OPT_fno_unroll_loops, (Opts.OptimizationLevel > 1)); + Opts.BinutilsVersion = std::string(Args.getLastArgValue(OPT_fbinutils_version_EQ)); @@ -1323,10 +1324,6 @@ bool CompilerInvocation::ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, Opts.EmitVersionIdentMetadata = Args.hasFlag(OPT_Qy, OPT_Qn, true); - if (Args.hasArg(options::OPT_ffinite_loops)) - Opts.FiniteLoops = CodeGenOptions::FiniteLoopsKind::Always; - else if (Args.hasArg(options::OPT_fno_finite_loops)) - Opts.FiniteLoops = CodeGenOptions::FiniteLoopsKind::Never; return Success; } @@ -2473,8 +2470,6 @@ void CompilerInvocation::ParseLangArgs(LangOptions &Opts, ArgList &Args, bool IsTargetSpecified = Opts.OpenMPIsDevice || Args.hasArg(options::OPT_fopenmp_targets_EQ); - Opts.ConvergentFunctions = Opts.ConvergentFunctions || Opts.OpenMPIsDevice; - if (Opts.OpenMP || Opts.OpenMPSimd) { if (int Version = getLastArgIntValue( Args, OPT_fopenmp_version_EQ, diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp index 1b783ac5d152..d47ad1b74649 100644 --- a/clang/lib/Frontend/InitPreprocessor.cpp +++ b/clang/lib/Frontend/InitPreprocessor.cpp @@ -565,7 +565,7 @@ static void InitializeCPlusPlusFeatureTestMacros(const LangOptions &LangOpts, Builder.defineMacro("__cpp_aggregate_bases", "201603L"); Builder.defineMacro("__cpp_structured_bindings", "201606L"); Builder.defineMacro("__cpp_nontype_template_args", - "201411L"); // (not latest) + LangOpts.CPlusPlus20 ? "201911L" : "201411L"); Builder.defineMacro("__cpp_fold_expressions", "201603L"); Builder.defineMacro("__cpp_guaranteed_copy_elision", "201606L"); Builder.defineMacro("__cpp_nontype_template_parameter_auto", "201606L"); @@ -1038,8 +1038,6 @@ static void InitializePredefinedMacros(const TargetInfo &TI, Builder.defineMacro("__SSP_STRONG__", "2"); else if (LangOpts.getStackProtector() == LangOptions::SSPReq) Builder.defineMacro("__SSP_ALL__", "3"); - else if (LangOpts.getStackProtector() == LangOptions::SSPRet) - Builder.defineMacro("__SSP_RET__", "4"); if (PPOpts.SetUpStaticAnalyzer) Builder.defineMacro("__clang_analyzer__"); diff --git a/clang/lib/Headers/avx512fintrin.h b/clang/lib/Headers/avx512fintrin.h index f226382cbb2c..2ee4350b14d4 100644 --- a/clang/lib/Headers/avx512fintrin.h +++ b/clang/lib/Headers/avx512fintrin.h @@ -9297,12 +9297,9 @@ _mm512_mask_abs_pd(__m512d __W, __mmask8 __K, __m512d __A) /* Vector-reduction arithmetic accepts vectors as inputs and produces scalars as * outputs. This class of vector operation forms the basis of many scientific - * computations. In vector-reduction arithmetic, the evaluation order is + * computations. In vector-reduction arithmetic, the evaluation off is * independent of the order of the input elements of V. - * For floating point types, we always assume the elements are reassociable even - * if -fast-math is off. - * Used bisection method. At each step, we partition the vector with previous * step in half, and the operation is performed on its two halves. * This takes log2(n) steps where n is the number of elements in the vector. @@ -9348,11 +9345,8 @@ _mm512_mask_reduce_or_epi64(__mmask8 __M, __m512i __W) { return __builtin_ia32_reduce_or_q512(__W); } -// -0.0 is used to ignore the start value since it is the neutral value of -// floating point addition. For more information, please refer to -// https://llvm.org/docs/LangRef.html#llvm-vector-reduce-fadd-intrinsic static __inline__ double __DEFAULT_FN_ATTRS512 _mm512_reduce_add_pd(__m512d __W) { - return __builtin_ia32_reduce_fadd_pd512(-0.0, __W); + return __builtin_ia32_reduce_fadd_pd512(0.0, __W); } static __inline__ double __DEFAULT_FN_ATTRS512 _mm512_reduce_mul_pd(__m512d __W) { @@ -9362,7 +9356,7 @@ static __inline__ double __DEFAULT_FN_ATTRS512 _mm512_reduce_mul_pd(__m512d __W) static __inline__ double __DEFAULT_FN_ATTRS512 _mm512_mask_reduce_add_pd(__mmask8 __M, __m512d __W) { __W = _mm512_maskz_mov_pd(__M, __W); - return __builtin_ia32_reduce_fadd_pd512(-0.0, __W); + return __builtin_ia32_reduce_fadd_pd512(0.0, __W); } static __inline__ double __DEFAULT_FN_ATTRS512 @@ -9417,7 +9411,7 @@ _mm512_mask_reduce_or_epi32(__mmask16 __M, __m512i __W) { static __inline__ float __DEFAULT_FN_ATTRS512 _mm512_reduce_add_ps(__m512 __W) { - return __builtin_ia32_reduce_fadd_ps512(-0.0f, __W); + return __builtin_ia32_reduce_fadd_ps512(0.0f, __W); } static __inline__ float __DEFAULT_FN_ATTRS512 @@ -9428,7 +9422,7 @@ _mm512_reduce_mul_ps(__m512 __W) { static __inline__ float __DEFAULT_FN_ATTRS512 _mm512_mask_reduce_add_ps(__mmask16 __M, __m512 __W) { __W = _mm512_maskz_mov_ps(__M, __W); - return __builtin_ia32_reduce_fadd_ps512(-0.0f, __W); + return __builtin_ia32_reduce_fadd_ps512(0.0f, __W); } static __inline__ float __DEFAULT_FN_ATTRS512 diff --git a/clang/lib/Headers/ppc_wrappers/xmmintrin.h b/clang/lib/Headers/ppc_wrappers/xmmintrin.h index 0e45b96769f8..0f429fa04081 100644 --- a/clang/lib/Headers/ppc_wrappers/xmmintrin.h +++ b/clang/lib/Headers/ppc_wrappers/xmmintrin.h @@ -28,7 +28,7 @@ Most SSE scalar float intrinsic operations can be performed more efficiently as C language float scalar operations or optimized to use vector SIMD operations. We recommend this for new applications. */ -#error "Please read comment above. Use -DNO_WARN_X86_INTRINSICS to disable this error." +#error "Please read comment above. Use -DNO_WARN_X86_INTRINSICS to disable this error." #endif #ifndef _XMMINTRIN_H_INCLUDED @@ -62,13 +62,14 @@ /* The Intel API is flexible enough that we must allow aliasing with other vector types, and their scalar components. */ -typedef vector float __m128 __attribute__((__may_alias__)); +typedef float __m128 __attribute__ ((__vector_size__ (16), __may_alias__)); /* Unaligned version of the same type. */ -typedef vector float __m128_u __attribute__((__may_alias__, __aligned__(1))); +typedef float __m128_u __attribute__ ((__vector_size__ (16), __may_alias__, + __aligned__ (1))); /* Internal data types for implementing the intrinsics. */ -typedef vector float __v4sf; +typedef float __v4sf __attribute__ ((__vector_size__ (16))); /* Create an undefined vector. */ extern __inline __m128 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) diff --git a/clang/lib/Lex/Preprocessor.cpp b/clang/lib/Lex/Preprocessor.cpp index 177786d90390..94f1ce91f884 100644 --- a/clang/lib/Lex/Preprocessor.cpp +++ b/clang/lib/Lex/Preprocessor.cpp @@ -119,8 +119,12 @@ Preprocessor::Preprocessor(std::shared_ptr PPOpts, // a macro. They get unpoisoned where it is allowed. (Ident__VA_ARGS__ = getIdentifierInfo("__VA_ARGS__"))->setIsPoisoned(); SetPoisonReason(Ident__VA_ARGS__,diag::ext_pp_bad_vaargs_use); - (Ident__VA_OPT__ = getIdentifierInfo("__VA_OPT__"))->setIsPoisoned(); - SetPoisonReason(Ident__VA_OPT__,diag::ext_pp_bad_vaopt_use); + if (getLangOpts().CPlusPlus20) { + (Ident__VA_OPT__ = getIdentifierInfo("__VA_OPT__"))->setIsPoisoned(); + SetPoisonReason(Ident__VA_OPT__,diag::ext_pp_bad_vaopt_use); + } else { + Ident__VA_OPT__ = nullptr; + } // Initialize the pragma handlers. RegisterBuiltinPragmas(); diff --git a/clang/lib/Lex/TokenLexer.cpp b/clang/lib/Lex/TokenLexer.cpp index da5681aaf478..97cb2cf0bb8c 100644 --- a/clang/lib/Lex/TokenLexer.cpp +++ b/clang/lib/Lex/TokenLexer.cpp @@ -148,12 +148,12 @@ bool TokenLexer::MaybeRemoveCommaBeforeVaArgs( return false; // GCC removes the comma in the expansion of " ... , ## __VA_ARGS__ " if - // __VA_ARGS__ is empty, but not in strict C99 mode where there are no - // named arguments, where it remains. In all other modes, including C99 - // with GNU extensions, it is removed regardless of named arguments. + // __VA_ARGS__ is empty, but not in strict mode where there are no + // named arguments, where it remains. With GNU extensions, it is removed + // regardless of named arguments. // Microsoft also appears to support this extension, unofficially. - if (PP.getLangOpts().C99 && !PP.getLangOpts().GNUMode - && Macro->getNumParams() < 2) + if (!PP.getLangOpts().GNUMode && !PP.getLangOpts().MSVCCompat && + Macro->getNumParams() < 2) return false; // Is a comma available to be removed? diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp index 347d992b1643..571164139630 100644 --- a/clang/lib/Parse/ParseDecl.cpp +++ b/clang/lib/Parse/ParseDecl.cpp @@ -4216,7 +4216,7 @@ void Parser::ParseStructUnionBody(SourceLocation RecordLoc, } // Parse _Static_assert declaration. - if (Tok.isOneOf(tok::kw__Static_assert, tok::kw_static_assert)) { + if (Tok.is(tok::kw__Static_assert)) { SourceLocation DeclEnd; ParseStaticAssertDeclaration(DeclEnd); continue; @@ -5180,7 +5180,6 @@ bool Parser::isDeclarationSpecifier(bool DisambiguatingWithExpression) { case tok::kw_friend: // static_assert-declaration - case tok::kw_static_assert: case tok::kw__Static_assert: // GNU typeof support. diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp index 450f9c020f7f..55cb3aee6194 100644 --- a/clang/lib/Sema/Sema.cpp +++ b/clang/lib/Sema/Sema.cpp @@ -14,7 +14,6 @@ #include "UsedDeclVisitor.h" #include "clang/AST/ASTContext.h" #include "clang/AST/ASTDiagnostic.h" -#include "clang/AST/Decl.h" #include "clang/AST/DeclCXX.h" #include "clang/AST/DeclFriend.h" #include "clang/AST/DeclObjC.h" @@ -538,13 +537,6 @@ void Sema::diagnoseZeroToNullptrConversion(CastKind Kind, const Expr* E) { if (E->IgnoreParenImpCasts()->getType()->isNullPtrType()) return; - // Don't diagnose the conversion from a 0 literal to a null pointer argument - // in a synthesized call to operator<=>. - if (!CodeSynthesisContexts.empty() && - CodeSynthesisContexts.back().Kind == - CodeSynthesisContext::RewritingOperatorAsSpaceship) - return; - // If it is a macro from system header, and if the macro name is not "NULL", // do not warn. SourceLocation MaybeMacroLoc = E->getBeginLoc(); @@ -1741,12 +1733,11 @@ Sema::SemaDiagnosticBuilder::~SemaDiagnosticBuilder() { } } -Sema::SemaDiagnosticBuilder -Sema::targetDiag(SourceLocation Loc, unsigned DiagID, FunctionDecl *FD) { - FD = FD ? FD : getCurFunctionDecl(); +Sema::SemaDiagnosticBuilder Sema::targetDiag(SourceLocation Loc, + unsigned DiagID) { if (LangOpts.OpenMP) - return LangOpts.OpenMPIsDevice ? diagIfOpenMPDeviceCode(Loc, DiagID, FD) - : diagIfOpenMPHostCode(Loc, DiagID, FD); + return LangOpts.OpenMPIsDevice ? diagIfOpenMPDeviceCode(Loc, DiagID) + : diagIfOpenMPHostCode(Loc, DiagID); if (getLangOpts().CUDA) return getLangOpts().CUDAIsDevice ? CUDADiagIfDeviceCode(Loc, DiagID) : CUDADiagIfHostCode(Loc, DiagID); @@ -1755,7 +1746,7 @@ Sema::targetDiag(SourceLocation Loc, unsigned DiagID, FunctionDecl *FD) { return SYCLDiagIfDeviceCode(Loc, DiagID); return SemaDiagnosticBuilder(SemaDiagnosticBuilder::K_Immediate, Loc, DiagID, - FD, *this); + getCurFunctionDecl(), *this); } Sema::SemaDiagnosticBuilder Sema::Diag(SourceLocation Loc, unsigned DiagID, @@ -1774,14 +1765,15 @@ Sema::SemaDiagnosticBuilder Sema::Diag(SourceLocation Loc, unsigned DiagID, DiagID, getCurFunctionDecl(), *this); } - SemaDiagnosticBuilder DB = getLangOpts().CUDAIsDevice - ? CUDADiagIfDeviceCode(Loc, DiagID) - : CUDADiagIfHostCode(Loc, DiagID); + SemaDiagnosticBuilder DB = + getLangOpts().CUDAIsDevice + ? CUDADiagIfDeviceCode(Loc, DiagID) + : CUDADiagIfHostCode(Loc, DiagID); SetIsLastErrorImmediate(DB.isImmediate()); return DB; } -void Sema::checkDeviceDecl(ValueDecl *D, SourceLocation Loc) { +void Sema::checkDeviceDecl(const ValueDecl *D, SourceLocation Loc) { if (isUnevaluatedContext()) return; @@ -1799,17 +1791,13 @@ void Sema::checkDeviceDecl(ValueDecl *D, SourceLocation Loc) { return; } - // Try to associate errors with the lexical context, if that is a function, or - // the value declaration otherwise. - FunctionDecl *FD = - isa(C) ? cast(C) : dyn_cast(D); auto CheckType = [&](QualType Ty) { if (Ty->isDependentType()) return; if (Ty->isExtIntType()) { if (!Context.getTargetInfo().hasExtIntType()) { - targetDiag(Loc, diag::err_device_unsupported_type, FD) + targetDiag(Loc, diag::err_device_unsupported_type) << D << false /*show bit size*/ << 0 /*bitsize*/ << Ty << Context.getTargetInfo().getTriple().str(); } @@ -1822,12 +1810,11 @@ void Sema::checkDeviceDecl(ValueDecl *D, SourceLocation Loc) { !Context.getTargetInfo().hasFloat128Type()) || (Ty->isIntegerType() && Context.getTypeSize(Ty) == 128 && !Context.getTargetInfo().hasInt128Type())) { - if (targetDiag(Loc, diag::err_device_unsupported_type, FD) + targetDiag(Loc, diag::err_device_unsupported_type) << D << true /*show bit size*/ << static_cast(Context.getTypeSize(Ty)) << Ty - << Context.getTargetInfo().getTriple().str()) - D->setInvalidDecl(); - targetDiag(D->getLocation(), diag::note_defined_here, FD) << D; + << Context.getTargetInfo().getTriple().str(); + targetDiag(D->getLocation(), diag::note_defined_here) << D; } }; @@ -1839,8 +1826,6 @@ void Sema::checkDeviceDecl(ValueDecl *D, SourceLocation Loc) { CheckType(ParamTy); CheckType(FPTy->getReturnType()); } - if (const auto *FNPTy = dyn_cast(Ty)) - CheckType(FNPTy->getReturnType()); } /// Looks through the macro-expansion chain for the given diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index 2b55712d44c2..2d3d36f4adad 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -2623,10 +2623,7 @@ static bool isValidBPFPreserveEnumValueArg(Expr *Arg) { return false; const auto *CE = dyn_cast(UO->getSubExpr()); - if (!CE) - return false; - if (CE->getCastKind() != CK_IntegralToPointer && - CE->getCastKind() != CK_NullToPointer) + if (!CE || CE->getCastKind() != CK_IntegralToPointer) return false; // The integer must be from an EnumConstantDecl. diff --git a/clang/lib/Sema/SemaCodeComplete.cpp b/clang/lib/Sema/SemaCodeComplete.cpp index be04970979b3..c2785fd60fc2 100644 --- a/clang/lib/Sema/SemaCodeComplete.cpp +++ b/clang/lib/Sema/SemaCodeComplete.cpp @@ -5158,20 +5158,6 @@ private: llvm::DenseMap Results; }; - -// If \p Base is ParenListExpr, assume a chain of comma operators and pick the -// last expr. We expect other ParenListExprs to be resolved to e.g. constructor -// calls before here. (So the ParenListExpr should be nonempty, but check just -// in case) -Expr *unwrapParenList(Expr *Base) { - if (auto *PLE = llvm::dyn_cast_or_null(Base)) { - if (PLE->getNumExprs() == 0) - return nullptr; - Base = PLE->getExpr(PLE->getNumExprs() - 1); - } - return Base; -} - } // namespace void Sema::CodeCompleteMemberReferenceExpr(Scope *S, Expr *Base, @@ -5179,8 +5165,6 @@ void Sema::CodeCompleteMemberReferenceExpr(Scope *S, Expr *Base, SourceLocation OpLoc, bool IsArrow, bool IsBaseExprStatement, QualType PreferredType) { - Base = unwrapParenList(Base); - OtherOpBase = unwrapParenList(OtherOpBase); if (!Base || !CodeCompleter) return; @@ -5613,13 +5597,12 @@ ProduceSignatureHelp(Sema &SemaRef, Scope *S, QualType Sema::ProduceCallSignatureHelp(Scope *S, Expr *Fn, ArrayRef Args, SourceLocation OpenParLoc) { - Fn = unwrapParenList(Fn); - if (!CodeCompleter || !Fn) + if (!CodeCompleter) return QualType(); // FIXME: Provide support for variadic template functions. // Ignore type-dependent call expressions entirely. - if (Fn->isTypeDependent() || anyNullArguments(Args)) + if (!Fn || Fn->isTypeDependent() || anyNullArguments(Args)) return QualType(); // In presence of dependent args we surface all possible signatures using the // non-dependent args in the prefix. Afterwards we do a post filtering to make diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 66826a8b3ba7..3ee0c43097d7 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -9420,9 +9420,6 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC, } } - if (LangOpts.SYCLIsDevice || (LangOpts.OpenMP && LangOpts.OpenMPIsDevice)) - checkDeviceDecl(NewFD, D.getBeginLoc()); - if (!getLangOpts().CPlusPlus) { // Perform semantic checking on the function declaration. if (!NewFD->isInvalidDecl() && NewFD->isMain()) @@ -14922,8 +14919,7 @@ void Sema::AddKnownFunctionAttributes(FunctionDecl *FD) { // errno in those environments even though it could set errno based on the // C standard. const llvm::Triple &Trip = Context.getTargetInfo().getTriple(); - if ((Trip.isGNUEnvironment() || Trip.isAndroid() || Trip.isOSMSVCRT() || - Trip.isOHOSFamily()) && + if ((Trip.isGNUEnvironment() || Trip.isAndroid() || Trip.isOSMSVCRT()) && !FD->hasAttr()) { switch (BuiltinID) { case Builtin::BI__builtin_fma: @@ -18333,51 +18329,42 @@ Sema::FunctionEmissionStatus Sema::getEmissionStatus(FunctionDecl *FD, if (FD->isDependentContext()) return FunctionEmissionStatus::TemplateDiscarded; - // Check whether this function is an externally visible definition. - auto IsEmittedForExternalSymbol = [this, FD]() { - // We have to check the GVA linkage of the function's *definition* -- if we - // only have a declaration, we don't know whether or not the function will - // be emitted, because (say) the definition could include "inline". - FunctionDecl *Def = FD->getDefinition(); - - return Def && !isDiscardableGVALinkage( - getASTContext().GetGVALinkageForFunction(Def)); - }; - + FunctionEmissionStatus OMPES = FunctionEmissionStatus::Unknown; if (LangOpts.OpenMPIsDevice) { - // In OpenMP device mode we will not emit host only functions, or functions - // we don't need due to their linkage. Optional DevTy = OMPDeclareTargetDeclAttr::getDeviceType(FD->getCanonicalDecl()); - // DevTy may be changed later by - // #pragma omp declare target to(*) device_type(*). - // Therefore DevTyhaving no value does not imply host. The emission status - // will be checked again at the end of compilation unit with Final = true. - if (DevTy.hasValue()) + if (DevTy.hasValue()) { if (*DevTy == OMPDeclareTargetDeclAttr::DT_Host) - return FunctionEmissionStatus::OMPDiscarded; - // If we have an explicit value for the device type, or we are in a target - // declare context, we need to emit all extern and used symbols. - if (isInOpenMPDeclareTargetContext() || DevTy.hasValue()) - if (IsEmittedForExternalSymbol()) - return FunctionEmissionStatus::Emitted; - // Device mode only emits what it must, if it wasn't tagged yet and needed, - // we'll omit it. - if (Final) - return FunctionEmissionStatus::OMPDiscarded; - } else if (LangOpts.OpenMP > 45) { - // In OpenMP host compilation prior to 5.0 everything was an emitted host - // function. In 5.0, no_host was introduced which might cause a function to - // be ommitted. - Optional DevTy = - OMPDeclareTargetDeclAttr::getDeviceType(FD->getCanonicalDecl()); - if (DevTy.hasValue()) - if (*DevTy == OMPDeclareTargetDeclAttr::DT_NoHost) - return FunctionEmissionStatus::OMPDiscarded; - } - - if (Final && LangOpts.OpenMP && !LangOpts.CUDA) - return FunctionEmissionStatus::Emitted; + OMPES = FunctionEmissionStatus::OMPDiscarded; + else if (*DevTy == OMPDeclareTargetDeclAttr::DT_NoHost || + *DevTy == OMPDeclareTargetDeclAttr::DT_Any) { + OMPES = FunctionEmissionStatus::Emitted; + } + } + } else if (LangOpts.OpenMP) { + // In OpenMP 4.5 all the functions are host functions. + if (LangOpts.OpenMP <= 45) { + OMPES = FunctionEmissionStatus::Emitted; + } else { + Optional DevTy = + OMPDeclareTargetDeclAttr::getDeviceType(FD->getCanonicalDecl()); + // In OpenMP 5.0 or above, DevTy may be changed later by + // #pragma omp declare target to(*) device_type(*). Therefore DevTy + // having no value does not imply host. The emission status will be + // checked again at the end of compilation unit. + if (DevTy.hasValue()) { + if (*DevTy == OMPDeclareTargetDeclAttr::DT_NoHost) { + OMPES = FunctionEmissionStatus::OMPDiscarded; + } else if (*DevTy == OMPDeclareTargetDeclAttr::DT_Host || + *DevTy == OMPDeclareTargetDeclAttr::DT_Any) + OMPES = FunctionEmissionStatus::Emitted; + } else if (Final) + OMPES = FunctionEmissionStatus::Emitted; + } + } + if (OMPES == FunctionEmissionStatus::OMPDiscarded || + (OMPES == FunctionEmissionStatus::Emitted && !LangOpts.CUDA)) + return OMPES; if (LangOpts.CUDA) { // When compiling for device, host functions are never emitted. Similarly, @@ -18391,7 +18378,17 @@ Sema::FunctionEmissionStatus Sema::getEmissionStatus(FunctionDecl *FD, (T == Sema::CFT_Device || T == Sema::CFT_Global)) return FunctionEmissionStatus::CUDADiscarded; - if (IsEmittedForExternalSymbol()) + // Check whether this function is externally visible -- if so, it's + // known-emitted. + // + // We have to check the GVA linkage of the function's *definition* -- if we + // only have a declaration, we don't know whether or not the function will + // be emitted, because (say) the definition could include "inline". + FunctionDecl *Def = FD->getDefinition(); + + if (Def && + !isDiscardableGVALinkage(getASTContext().GetGVALinkageForFunction(Def)) + && (!LangOpts.OpenMP || OMPES == FunctionEmissionStatus::Emitted)) return FunctionEmissionStatus::Emitted; } diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index ae8508d6c601..45616dadcbee 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -373,7 +373,7 @@ bool Sema::DiagnoseUseOfDecl(NamedDecl *D, ArrayRef Locs, } if (LangOpts.SYCLIsDevice || (LangOpts.OpenMP && LangOpts.OpenMPIsDevice)) { - if (auto *VD = dyn_cast(D)) + if (const auto *VD = dyn_cast(D)) checkDeviceDecl(VD, Loc); if (!Context.getTargetInfo().isTLSSupported()) diff --git a/clang/lib/Sema/SemaLambda.cpp b/clang/lib/Sema/SemaLambda.cpp index c1c6a4bf5c68..af61c82c2002 100644 --- a/clang/lib/Sema/SemaLambda.cpp +++ b/clang/lib/Sema/SemaLambda.cpp @@ -432,16 +432,15 @@ CXXMethodDecl *Sema::startLambdaDefinition(CXXRecordDecl *Class, void Sema::handleLambdaNumbering( CXXRecordDecl *Class, CXXMethodDecl *Method, - Optional> Mangling) { + Optional> Mangling) { if (Mangling) { + unsigned ManglingNumber; bool HasKnownInternalLinkage; - unsigned ManglingNumber, DeviceManglingNumber; Decl *ManglingContextDecl; - std::tie(HasKnownInternalLinkage, ManglingNumber, DeviceManglingNumber, - ManglingContextDecl) = Mangling.getValue(); + std::tie(ManglingNumber, HasKnownInternalLinkage, ManglingContextDecl) = + Mangling.getValue(); Class->setLambdaMangling(ManglingNumber, ManglingContextDecl, HasKnownInternalLinkage); - Class->setDeviceLambdaManglingNumber(DeviceManglingNumber); return; } @@ -477,7 +476,6 @@ void Sema::handleLambdaNumbering( unsigned ManglingNumber = MCtx->getManglingNumber(Method); Class->setLambdaMangling(ManglingNumber, ManglingContextDecl, HasKnownInternalLinkage); - Class->setDeviceLambdaManglingNumber(MCtx->getDeviceManglingNumber(Method)); } } diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp index 4063c185388d..78707484f588 100644 --- a/clang/lib/Sema/SemaOpenMP.cpp +++ b/clang/lib/Sema/SemaOpenMP.cpp @@ -1884,7 +1884,8 @@ void Sema::popOpenMPFunctionRegion(const FunctionScopeInfo *OldFSI) { static bool isOpenMPDeviceDelayedContext(Sema &S) { assert(S.LangOpts.OpenMP && S.LangOpts.OpenMPIsDevice && "Expected OpenMP device compilation."); - return !S.isInOpenMPTargetExecutionDirective(); + return !S.isInOpenMPTargetExecutionDirective() && + !S.isInOpenMPDeclareTargetContext(); } namespace { @@ -1897,11 +1898,11 @@ enum class FunctionEmissionStatus { } // anonymous namespace Sema::SemaDiagnosticBuilder Sema::diagIfOpenMPDeviceCode(SourceLocation Loc, - unsigned DiagID, - FunctionDecl *FD) { + unsigned DiagID) { assert(LangOpts.OpenMP && LangOpts.OpenMPIsDevice && "Expected OpenMP device compilation."); + FunctionDecl *FD = getCurFunctionDecl(); SemaDiagnosticBuilder::Kind Kind = SemaDiagnosticBuilder::K_Nop; if (FD) { FunctionEmissionStatus FES = getEmissionStatus(FD); @@ -1910,13 +1911,6 @@ Sema::SemaDiagnosticBuilder Sema::diagIfOpenMPDeviceCode(SourceLocation Loc, Kind = SemaDiagnosticBuilder::K_Immediate; break; case FunctionEmissionStatus::Unknown: - // TODO: We should always delay diagnostics here in case a target - // region is in a function we do not emit. However, as the - // current diagnostics are associated with the function containing - // the target region and we do not emit that one, we would miss out - // on diagnostics for the target region itself. We need to anchor - // the diagnostics with the new generated function *or* ensure we - // emit diagnostics associated with the surrounding function. Kind = isOpenMPDeviceDelayedContext(*this) ? SemaDiagnosticBuilder::K_Deferred : SemaDiagnosticBuilder::K_Immediate; @@ -1931,15 +1925,14 @@ Sema::SemaDiagnosticBuilder Sema::diagIfOpenMPDeviceCode(SourceLocation Loc, } } - return SemaDiagnosticBuilder(Kind, Loc, DiagID, FD, *this); + return SemaDiagnosticBuilder(Kind, Loc, DiagID, getCurFunctionDecl(), *this); } Sema::SemaDiagnosticBuilder Sema::diagIfOpenMPHostCode(SourceLocation Loc, - unsigned DiagID, - FunctionDecl *FD) { + unsigned DiagID) { assert(LangOpts.OpenMP && !LangOpts.OpenMPIsDevice && "Expected OpenMP host compilation."); - FunctionEmissionStatus FES = getEmissionStatus(FD); + FunctionEmissionStatus FES = getEmissionStatus(getCurFunctionDecl()); SemaDiagnosticBuilder::Kind Kind = SemaDiagnosticBuilder::K_Nop; switch (FES) { case FunctionEmissionStatus::Emitted: @@ -1955,7 +1948,7 @@ Sema::SemaDiagnosticBuilder Sema::diagIfOpenMPHostCode(SourceLocation Loc, break; } - return SemaDiagnosticBuilder(Kind, Loc, DiagID, FD, *this); + return SemaDiagnosticBuilder(Kind, Loc, DiagID, getCurFunctionDecl(), *this); } static OpenMPDefaultmapClauseKind diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h index 3c68f9458e58..0a596e50658b 100644 --- a/clang/lib/Sema/TreeTransform.h +++ b/clang/lib/Sema/TreeTransform.h @@ -12504,11 +12504,10 @@ TreeTransform::TransformLambdaExpr(LambdaExpr *E) { E->getCaptureDefault()); getDerived().transformedLocalDecl(OldClass, {Class}); - Optional> Mangling; + Optional> Mangling; if (getDerived().ReplacingOriginal()) - Mangling = std::make_tuple(OldClass->hasKnownLambdaInternalLinkage(), - OldClass->getLambdaManglingNumber(), - OldClass->getDeviceLambdaManglingNumber(), + Mangling = std::make_tuple(OldClass->getLambdaManglingNumber(), + OldClass->hasKnownLambdaInternalLinkage(), OldClass->getLambdaContextDecl()); // Build the call operator. diff --git a/clang/lib/Serialization/ASTReaderDecl.cpp b/clang/lib/Serialization/ASTReaderDecl.cpp index 18ab4666a7d8..6bfb9bd783b5 100644 --- a/clang/lib/Serialization/ASTReaderDecl.cpp +++ b/clang/lib/Serialization/ASTReaderDecl.cpp @@ -1748,7 +1748,6 @@ void ASTDeclReader::ReadCXXDefinitionData( Lambda.NumExplicitCaptures = Record.readInt(); Lambda.HasKnownInternalLinkage = Record.readInt(); Lambda.ManglingNumber = Record.readInt(); - D->setDeviceLambdaManglingNumber(Record.readInt()); Lambda.ContextDecl = readDeclID(); Lambda.Captures = (Capture *)Reader.getContext().Allocate( sizeof(Capture) * Lambda.NumCaptures); diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp index 40900af6f9e0..6bfa7b0e7d6d 100644 --- a/clang/lib/Serialization/ASTWriter.cpp +++ b/clang/lib/Serialization/ASTWriter.cpp @@ -5667,7 +5667,6 @@ void ASTRecordWriter::AddCXXDefinitionData(const CXXRecordDecl *D) { Record->push_back(Lambda.NumExplicitCaptures); Record->push_back(Lambda.HasKnownInternalLinkage); Record->push_back(Lambda.ManglingNumber); - Record->push_back(D->getDeviceLambdaManglingNumber()); AddDeclRef(D->getLambdaContextDecl()); AddTypeSourceInfo(Lambda.MethodTyInfo); for (unsigned I = 0, N = Lambda.NumCaptures; I != N; ++I) { diff --git a/clang/lib/StaticAnalyzer/Checkers/CMakeLists.txt b/clang/lib/StaticAnalyzer/Checkers/CMakeLists.txt index f7823b4090fb..eb4f30137732 100644 --- a/clang/lib/StaticAnalyzer/Checkers/CMakeLists.txt +++ b/clang/lib/StaticAnalyzer/Checkers/CMakeLists.txt @@ -129,10 +129,6 @@ add_clang_library(clangStaticAnalyzerCheckers WebKit/UncountedCallArgsChecker.cpp WebKit/UncountedLambdaCapturesChecker.cpp WebKit/UncountedLocalVarsChecker.cpp - OpenHarmony/UnixAPIArgsChecker.cpp - OpenHarmony/MemcpyChecker.cpp - OpenHarmony/PrintSensitiveInfoChecker.cpp - OpenHarmony/SignalHandlerChecker.cpp LINK_LIBS clangAST diff --git a/clang/lib/StaticAnalyzer/Checkers/OpenHarmony/MemcpyChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/OpenHarmony/MemcpyChecker.cpp deleted file mode 100644 index 0f80e0e458e0..000000000000 --- a/clang/lib/StaticAnalyzer/Checkers/OpenHarmony/MemcpyChecker.cpp +++ /dev/null @@ -1,112 +0,0 @@ -//== MemcpyChecker.cpp ------------------------------*- C++ -*--==// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file defines MemcpyChecker, which is a path-sensitive check -// looking for mismatch src and dest buffer length may cause buffer overflow. -// -//===----------------------------------------------------------------------===// - -#include "clang/StaticAnalyzer/Checkers/BuiltinCheckerRegistration.h" -#include "clang/StaticAnalyzer/Core/BugReporter/BugType.h" -#include "clang/StaticAnalyzer/Core/Checker.h" -#include "clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h" -#include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h" -#include "clang/StaticAnalyzer/Core/PathSensitive/DynamicSize.h" - -using namespace clang; -using namespace ento; - -namespace { -class MemcpyChecker : public Checker { - CallDescription MemcpyS; - - std::unique_ptr OverflowBugType; -public: - MemcpyChecker(); - void checkPreCall(const CallEvent &Call, CheckerContext &C) const; -}; - -MemcpyChecker::MemcpyChecker() - : MemcpyS("memcpy_s") { - OverflowBugType.reset( - new BugType(this, "Unsafe buffer operation", categories::UnixAPI)); - } - -void MemcpyChecker::checkPreCall(const CallEvent &Call, CheckerContext &C) const { - if (!Call.isCalled(MemcpyS)) { - return; - } - - SValBuilder &SVB = C.getSValBuilder(); - ProgramStateRef state = C.getState(); - SVal dstAddrSVal = Call.getArgSVal(0); - SVal srcLengthSVal = Call.getArgSVal(3); - - const MemRegion *dstAddrMR = dstAddrSVal.getAsRegion(); - if (!dstAddrMR) { - return; - } - - const ElementRegion *dstAddrER = dyn_cast(dstAddrMR); - if (!dstAddrER) { - return; - } - - DefinedOrUnknownSVal Idx = dstAddrER->getIndex().castAs(); - Optional IdxSVal = Idx.getAs(); - if (!IdxSVal) { - return; - } - - DefinedOrUnknownSVal ElementCount = getDynamicElementCount( - state, dstAddrER->getSuperRegion(), C.getSValBuilder(), dstAddrER->getValueType()); - - Optional dstAddrLenSVal = ElementCount.getAs(); - if (!dstAddrLenSVal) { - return; - } - - Optional srcLengthDSVal = srcLengthSVal.getAs(); - if (!srcLengthDSVal) { - return; - } - - SVal srcLenDSval = SVB.evalBinOp(state, BO_Add, *srcLengthDSVal, *IdxSVal, SVB.getArrayIndexType()); - - SVal dstLessThanSrcLength = SVB.evalBinOp(state, BO_LT, *dstAddrLenSVal, srcLenDSval, SVB.getConditionType()); - - Optional dstLessThanSrcLengthDVal = dstLessThanSrcLength.getAs(); - if (!dstLessThanSrcLengthDVal) { - return; - } - - if (state->assume(*dstLessThanSrcLengthDVal, true)) { - // it is possible that dst less than src length - ExplodedNode *ErrNode = C.generateNonFatalErrorNode(); - // If we've already reached this node on another path, return. - if (!ErrNode) - return; - - // Generate the report. - auto R = std::make_unique( - *OverflowBugType, "memcpy_s(): src length may be larger than dst length", ErrNode); - R->addRange(Call.getSourceRange()); - C.emitReport(std::move(R)); - return; - } -} -} - -void ento::registerMemcpyChecker(CheckerManager &mgr) { - mgr.registerChecker(); -} - -// This checker should be enabled regardless of how language options are set. -bool ento::shouldRegisterMemcpyChecker(const CheckerManager &mgr) { - return true; -} diff --git a/clang/lib/StaticAnalyzer/Checkers/OpenHarmony/PrintSensitiveInfoChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/OpenHarmony/PrintSensitiveInfoChecker.cpp deleted file mode 100644 index e613f05961f3..000000000000 --- a/clang/lib/StaticAnalyzer/Checkers/OpenHarmony/PrintSensitiveInfoChecker.cpp +++ /dev/null @@ -1,304 +0,0 @@ -//== PrintSensitiveInfoChecker.cpp ------------------------------*- C++ -*--==// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file defines PrintSensitiveInfoChecker, checks for sensitive information leak -// such as printing password in log. -// -//===----------------------------------------------------------------------===// - -#include -#include - -#include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h" -#include "clang/StaticAnalyzer/Checkers/BuiltinCheckerRegistration.h" -#include "clang/StaticAnalyzer/Core/BugReporter/BugType.h" -#include "clang/StaticAnalyzer/Core/Checker.h" -#include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h" -#include "Yaml.h" - -using namespace std; -using namespace clang; -using namespace ento; - -namespace { - struct SensitiveState { - private: - bool sensitive; - - public: - bool isSensitive() const { return sensitive; } - void setSensitive(bool B) { sensitive = B; } - - bool operator==(const SensitiveState &X) const { - return sensitive == X.sensitive; - } - void Profile(llvm::FoldingSetNodeID &ID) const { - ID.AddBoolean(sensitive); - } - }; - - class PrintSensitiveInfoChecker : public Checker, - check::PreStmt, - check::PreStmt> { - public: - // lowercase string in following sets - set m_sensitive_var_set; - set m_sensitive_func_set; - set m_output_set; - - struct SensitiveValueConfiguration { - struct SensitiveList { - string type; - vector list; - }; - vector sensitiveList; - }; - - PrintSensitiveInfoChecker(); - ~PrintSensitiveInfoChecker(){}; - - void checkPreStmt(const DeclStmt *declStmt, CheckerContext &c) const; - void checkPreStmt(const BinaryOperator *BO, CheckerContext &c) const; - void checkPreStmt(const CallExpr *call, CheckerContext &c) const; - - void saveVardeclStateForBo(const Expr *lhs, const Expr *rhs, CheckerContext &c) const; - void saveVardeclStateForDeclStmt(const DeclStmt *ds, CheckerContext &c) const; - const VarDecl *GetVarDeclFromExpr(const Expr *E) const; - string GetCurrentCalleeName(const CallExpr *CE) const; - - void parseConfiguration(CheckerManager &mgr, const std::string &Option, const SensitiveValueConfiguration *config); - string convertStrToLowerCase(string str) const; - - void report(const Stmt *Opera, const string &msg, CheckerContext &c) const; - }; -} - -using sensitiveConfig = PrintSensitiveInfoChecker::SensitiveValueConfiguration; -LLVM_YAML_IS_SEQUENCE_VECTOR(sensitiveConfig::SensitiveList) - -namespace llvm { - namespace yaml { - template <> - struct MappingTraits { - static void mapping(IO &io, sensitiveConfig &info) { - io.mapRequired("List", info.sensitiveList); - } - }; - - template <> - struct MappingTraits { - static void mapping(IO &io, sensitiveConfig::SensitiveList &info) { - io.mapRequired("type", info.type); - io.mapOptional("value", info.list); - } - }; - } // end namespace yaml -} // end namespace llvm - -REGISTER_MAP_WITH_PROGRAMSTATE(SensitiveInfoMap, const VarDecl *, SensitiveState) - -PrintSensitiveInfoChecker::PrintSensitiveInfoChecker() { - // some base patterns in set - m_sensitive_var_set.insert("password"); - m_sensitive_var_set.insert("passwd"); - m_sensitive_func_set.insert("getpassword"); - m_output_set.insert("hilog"); -} - -const VarDecl *PrintSensitiveInfoChecker::GetVarDeclFromExpr(const Expr *E) const { - if (const auto *DRE = dyn_cast(E)) { - if (const VarDecl *VD = dyn_cast(DRE->getDecl())) { - return VD; - } - } - return nullptr; -} - -string PrintSensitiveInfoChecker::GetCurrentCalleeName(const CallExpr *CE) const { - return CE->getDirectCallee()->getNameInfo().getName().getAsString(); -} - -string PrintSensitiveInfoChecker::convertStrToLowerCase(string str) const { - transform(str.begin(), str.end(), str.begin(), [](unsigned char c){ return tolower(c); }); - return str; -} - -void PrintSensitiveInfoChecker::parseConfiguration(CheckerManager &mgr, const std::string &Option, const SensitiveValueConfiguration *config) { - if (config) { - for (auto &sl : config->sensitiveList) { - if (sl.type == "fnCall") { - for (auto value : sl.list) { - m_sensitive_func_set.insert(convertStrToLowerCase(value)); - } - } - else if (sl.type == "varName") { - for (auto value : sl.list) { - m_sensitive_var_set.insert(convertStrToLowerCase(value)); - } - } - else if (sl.type == "outputFn") { - for (auto value : sl.list) { - m_output_set.insert(convertStrToLowerCase(value)); - } - } else { - mgr.reportInvalidCheckerOptionValue( - this, Option, - "a valid key: fnCall, varName, outputFn"); - } - } - } -} - -void PrintSensitiveInfoChecker::report(const Stmt *operaExpr, const string &msg, CheckerContext &context) const { - if (operaExpr == nullptr) { - return; - } - AnalysisDeclContext *declContext = - context.getAnalysisManager().getAnalysisDeclContext(context.getStackFrame()->getDecl()); - PathDiagnosticLocation location = - PathDiagnosticLocation::createBegin(operaExpr, context.getSourceManager(), declContext); - - SourceRange range = operaExpr->getSourceRange(); - if (!(declContext->getDecl())) { - return; - } - context.getBugReporter().EmitBasicReport(declContext->getDecl(), this, - "PrintSensitiveInfo", "Indicator of poor code quality", msg, - location, range); - context.addTransition(); -} - -void PrintSensitiveInfoChecker::checkPreStmt(const DeclStmt *ds, CheckerContext &c) const { - if (ds == nullptr) { - return; - } - saveVardeclStateForDeclStmt(ds, c); -} - -void PrintSensitiveInfoChecker::checkPreStmt(const BinaryOperator *binary, CheckerContext &c) const { - - if (binary == nullptr) { - return; - } - if (binary->getOpcode() == clang::BO_Assign) - { - const Expr *lhs = binary->getLHS()->IgnoreParenImpCasts(); - const Expr *rhs = binary->getRHS()->IgnoreParenImpCasts(); - if (lhs == nullptr || rhs == nullptr) - { - return; - } - saveVardeclStateForBo(lhs, rhs, c); - } -} - -void PrintSensitiveInfoChecker::checkPreStmt(const CallExpr *call, CheckerContext &c) const { - if (call == nullptr) { - return; - } - string funcName = GetCurrentCalleeName(call); - if (m_output_set.find(convertStrToLowerCase(funcName)) == m_output_set.end()) { - return; - } - unsigned int nums = call->getNumArgs(); - - for (unsigned int i = 0; i < nums; i++) { - const Expr *arg = call->getArg(i)->IgnoreParenImpCasts(); - if (arg == nullptr) { - continue; - } - - const VarDecl *varDecl = GetVarDeclFromExpr(arg); - if (varDecl == nullptr) { - continue; - } - // check by variable's name only - if (m_sensitive_var_set.find(convertStrToLowerCase(varDecl->getNameAsString())) != m_sensitive_var_set.end()) { - string msg = varDecl->getNameAsString() + " is a sensitive information"; - report(call, msg, c); - continue; - } - // check by state map - ProgramStateRef state = c.getState(); - const SensitiveState *sens = state->get(varDecl); - if (sens == nullptr) { - continue; - } - if (sens->isSensitive()) { - // report bug - string msg = varDecl->getNameAsString() + " is a sensitive information"; - report(call, msg, c); - } - } -} - -void PrintSensitiveInfoChecker::saveVardeclStateForBo(const Expr *lhs, const Expr *rhs, - CheckerContext &c) const { - if (rhs == nullptr || lhs == nullptr) { - return; - } - const VarDecl *varDecl = GetVarDeclFromExpr(lhs); - if (varDecl == nullptr) { - return; - } - if (isa(rhs)) { - const CallExpr *call = llvm::dyn_cast_or_null(rhs); - string funcName = GetCurrentCalleeName(call); - if (m_sensitive_func_set.find(convertStrToLowerCase(funcName)) != m_sensitive_func_set.end()) { - ProgramStateRef state = c.getState(); - SensitiveState sens; - sens.setSensitive(true); - state = state->set(varDecl, sens); - c.addTransition(state); - } - } -} - -void PrintSensitiveInfoChecker::saveVardeclStateForDeclStmt(const DeclStmt *ds, CheckerContext &c) const { - - const VarDecl *varDecl = llvm::dyn_cast_or_null(ds->getSingleDecl()); - if (varDecl == nullptr) { - return; - } - const Expr *expr = varDecl->getInit()->IgnoreParenImpCasts(); - if (expr == nullptr) { - return; - } - - if (isa(expr)) { - const CallExpr *call = llvm::dyn_cast_or_null(expr); - string funcName = GetCurrentCalleeName(call); - if (m_sensitive_func_set.find(convertStrToLowerCase(funcName)) != m_sensitive_func_set.end()) { - ProgramStateRef state = c.getState(); - SensitiveState sens; - sens.setSensitive(true); - state = state->set(varDecl, sens); - c.addTransition(state); - } - } -} - -//===----------------------------------------------------------------------===// -// Registration. -//===----------------------------------------------------------------------===// - -void ento::registerPrintSensitiveInfoChecker(CheckerManager &mgr) { - auto *Checker = mgr.registerChecker(); - string Option{"Config"}; - StringRef ConfigFile = mgr.getAnalyzerOptions().getCheckerStringOption(Checker, Option); - llvm::Optional obj = getConfiguration(mgr, Checker, Option, ConfigFile); - // If no Config is provided, obj is null - if (obj) { - Checker->parseConfiguration(mgr, Option, obj.getPointer()); - } -} - -// This checker should be enabled regardless of how language options are set. -bool ento::shouldRegisterPrintSensitiveInfoChecker(const CheckerManager &mgr) { - return true; -} diff --git a/clang/lib/StaticAnalyzer/Checkers/OpenHarmony/SignalHandlerChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/OpenHarmony/SignalHandlerChecker.cpp deleted file mode 100644 index 067a8e9cb1de..000000000000 --- a/clang/lib/StaticAnalyzer/Checkers/OpenHarmony/SignalHandlerChecker.cpp +++ /dev/null @@ -1,250 +0,0 @@ -//== SignalHandlerChecker.cpp ------------------------------*- C++ -*--==// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file defines SignalHandlerChecker, checks for calling non-async-safe -// functionos within signalhandler function -// -//===----------------------------------------------------------------------===// - -#include -#include - -#include "clang/AST/ASTContext.h" -#include "clang/ASTMatchers/ASTMatchFinder.h" -#include "clang/StaticAnalyzer/Checkers/BuiltinCheckerRegistration.h" -#include "clang/StaticAnalyzer/Core/BugReporter/BugReporter.h" -#include "clang/StaticAnalyzer/Core/BugReporter/BugType.h" -#include "clang/StaticAnalyzer/Core/Checker.h" -#include "clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h" -#include "llvm/ADT/DenseSet.h" -#include "Yaml.h" - -using namespace std; -using namespace clang; -using namespace ento; -using namespace ast_matchers; - -namespace { - static bool isSystemCall(const FunctionDecl *FD) { - return FD->getASTContext().getSourceManager().isInSystemHeader( - FD->getCanonicalDecl()->getLocation()); - } - AST_MATCHER(FunctionDecl, isSystemCallCheck) { return isSystemCall(&Node); } - - class SignalHandlerChecker : public Checker { - public: - set m_async_safe_func_set; - struct FunctionConfiguration - { - struct FunctionList { - string type; - vector list; - }; - vector functionList; - }; - void checkEndOfTranslationUnit(const TranslationUnitDecl *TU, - AnalysisManager &AM, - BugReporter &BR) const; - void parseConfiguration(CheckerManager &mgr, - const std::string &Option, - const FunctionConfiguration *config); - }; - - class Callback : public MatchFinder::MatchCallback { - const SignalHandlerChecker *C; - BugReporter &BR; - AnalysisDeclContext *ADC; - const llvm::StringSet<> StrictConformingFunctions = { - "signal", "abort", "_Exit", "quick_exit"}; - - public : - void run(const MatchFinder::MatchResult &Result) override; - void Report(const Stmt *stmt, const string &msg); - bool isSystemCallAllowed(const FunctionDecl *FD) const; - Callback(const SignalHandlerChecker *C, - BugReporter &BR, AnalysisDeclContext *ADC) - : C(C), BR(BR), ADC(ADC) {} - }; -} - -using functionConfig = SignalHandlerChecker::FunctionConfiguration; -LLVM_YAML_IS_SEQUENCE_VECTOR(functionConfig::FunctionList) - -namespace llvm -{ - namespace yaml - { - template <> - struct MappingTraits - { - static void mapping(IO &io, functionConfig &info) - { - io.mapRequired("List", info.functionList); - } - }; - - template <> - struct MappingTraits - { - static void mapping(IO &io, functionConfig::FunctionList &info) - { - io.mapRequired("type", info.type); - io.mapOptional("value", info.list); - } - }; - } // end namespace yaml -} // end namespace llvm - -void SignalHandlerChecker::parseConfiguration(CheckerManager &mgr, - const std::string &Option, - const FunctionConfiguration *config) { - if (config) { - for (auto &sl : config->functionList) { - if (sl.type == "asyncSafeFunction") { - for (auto &value : sl.list) { - m_async_safe_func_set.insert(value); - } - } else { - mgr.reportInvalidCheckerOptionValue( - this, Option, - "a valid key: asyncSafeFunction"); - } - } - } -} - -void SignalHandlerChecker::checkEndOfTranslationUnit(const TranslationUnitDecl *TU, - AnalysisManager &AM, - BugReporter &BR) const { - MatchFinder F; - Callback CB(this, BR, AM.getAnalysisDeclContext(TU)); - - auto SignalFunction = functionDecl(hasAnyName("signal", "::signal", "::std::signal"), - parameterCountIs(2), isSystemCallCheck()); - auto HandlerExpr = - declRefExpr(hasDeclaration(functionDecl().bind("handler_decl"))) - .bind("handler_expr"); - F.addMatcher((callExpr(callee(SignalFunction), hasArgument(1, HandlerExpr)) - .bind("register_call")), &CB); - F.matchAST(AM.getASTContext()); -} - -void Callback::run(const MatchFinder::MatchResult &Result) { - const auto *HandlerDecl = Result.Nodes.getNodeAs("handler_decl"); - const auto *HandlerExpr = Result.Nodes.getNodeAs("handler_expr"); - llvm::DenseSet SeenFunctions; - - // The worklist of the callgraph visitation algorithm. - queue CalledFunctions; - - auto ProcessFunction = [&](const FunctionDecl *F, const Expr *CallOrRef) { - if (F == nullptr || CallOrRef == nullptr) { - return false; - } - // Ensure that canonical declaration is used. - F = F->getCanonicalDecl(); - - // Do not visit function if already encountered. - if (!SeenFunctions.insert(F).second) - return true; - // Check if the call is allowed. - // Non-system calls are not considered. - if (isSystemCall(F)) { - if (isSystemCallAllowed(F)) { - return true; - } - // disallowed - const string funcName = F->getNameInfo().getName().getAsString(); - string msg = "The non-async-safe function '" + funcName + "' cannot be used in the callback function of signal"; - Report(CallOrRef, msg); - return false; - } - - // Get the body of the encountered non-system call function. - const FunctionDecl *FBody; - if (!F->hasBody(FBody)) { - const string funcName = F->getNameInfo().getName().getAsString(); - string msg = "The non-async-safe function '" + funcName + "' cannot be used in the callback function of signal"; - Report(CallOrRef, msg); - return false; - } - - // Collect all called functions. - auto Matches = match(decl(forEachDescendant(callExpr().bind("call"))), - *FBody, FBody->getASTContext()); - for (const auto &Match: Matches) { - const auto *CE = Match.getNodeAs("call"); - if (CE && isa(CE->getCalleeDecl())) { - CalledFunctions.push(CE); - } - } - return true; - }; - - if (!ProcessFunction(HandlerDecl, HandlerExpr)) - return; - - // Visit the definition of every function referenced by the handler function. - // Check for allowed function calls. - while (!CalledFunctions.empty()) { - const CallExpr *FunctionCall = CalledFunctions.front(); - CalledFunctions.pop(); - // At insertion we have already ensured that only function calls are there. - const auto *F = cast(FunctionCall->getCalleeDecl()); - - if (!ProcessFunction(F, FunctionCall)) - break; - } -} - -bool Callback::isSystemCallAllowed(const FunctionDecl *FD) const { - const IdentifierInfo *II = FD->getIdentifier(); - // Unnamed functions are not explicitly allowed. - if (!II) - return false; - - // user defined in yaml configuration - if (C->m_async_safe_func_set.count(II->getName().str())) { - return true; - } - - if (StrictConformingFunctions.count(II->getName())) - return true; - - return false; -} - -void Callback::Report(const Stmt *stmt, const std::string &msg) -{ - PathDiagnosticLocation ceLoc = PathDiagnosticLocation::createBegin(stmt, BR.getSourceManager(), ADC); - SourceRange r = stmt->getSourceRange(); - if (ADC->getDecl() == nullptr) { - return; - } - BR.EmitBasicReport(ADC->getDecl(), C, - "SignalHandlerChecker", "Indicator of Poor Code Quality", msg, ceLoc, r); -} - -//===----------------------------------------------------------------------===// -// Registration. -//===----------------------------------------------------------------------===// - -void ento::registerSignalHandlerChecker(CheckerManager &mgr) { - auto *Checker = mgr.registerChecker(); - std::string Option{"Config"}; - StringRef ConfigFile = mgr.getAnalyzerOptions().getCheckerStringOption(Checker, Option); - llvm::Optional obj = getConfiguration(mgr, Checker, Option, ConfigFile); - if (obj) { - Checker->parseConfiguration(mgr, Option, obj.getPointer()); - } -} - -// This checker should be enabled regardless of how language options are set. -bool ento::shouldRegisterSignalHandlerChecker(const CheckerManager &mgr) { - return true; -} diff --git a/clang/lib/StaticAnalyzer/Checkers/OpenHarmony/UnixAPIArgsChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/OpenHarmony/UnixAPIArgsChecker.cpp deleted file mode 100644 index c4747fcdfe33..000000000000 --- a/clang/lib/StaticAnalyzer/Checkers/OpenHarmony/UnixAPIArgsChecker.cpp +++ /dev/null @@ -1,239 +0,0 @@ -//== UnixAPIArgsChecker.cpp ------------------------------*- C++ -*--==// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This defines UnixAPIArgsChecker, which is a path-sensitive checker -// looking for open a file with open() with GROUP and OTHER having -// write or execute permission -// -//===----------------------------------------------------------------------===// - -#include "clang/StaticAnalyzer/Checkers/BuiltinCheckerRegistration.h" -#include "clang/Basic/TargetInfo.h" -#include "clang/StaticAnalyzer/Core/BugReporter/BugType.h" -#include "clang/StaticAnalyzer/Core/Checker.h" -#include "clang/StaticAnalyzer/Core/CheckerManager.h" -#include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h" -#include "llvm/ADT/Optional.h" -#include "llvm/ADT/STLExtras.h" -#include "llvm/ADT/SmallString.h" -#include "llvm/ADT/StringExtras.h" -#include "llvm/Support/raw_ostream.h" - -using namespace clang; -using namespace ento; - -enum class OpenVariant { - /// The standard open() call: - /// int open(const char *pathname, int flags, mode_t mode); - Open, - - /// The variant taking a directory file descriptor and a relative path: - /// int openat(int fd, const char *pathname, int flags, mode_t mode); - OpenAt -}; - -namespace { -class UnixAPIArgsChecker : public Checker< check::PreStmt > { - mutable std::unique_ptr BT_open; - // value of O_CREAT flag - const uint64_t Val_O_CREAT = 0100; - // value of mode being checked - const uint64_t Val_MODE = 0133; - -public: - void checkPreStmt(const CallExpr *CE, CheckerContext &C) const; - - void CheckOpen(CheckerContext &C, const CallExpr *CE) const; - void CheckOpenAt(CheckerContext &C, const CallExpr *CE) const; - - void CheckOpenVariant(CheckerContext &C, - const CallExpr *CE, OpenVariant Variant) const; - - void ReportOpenBug(CheckerContext &C, - ProgramStateRef State, - const char *Msg, - SourceRange SR) const; -}; -} //end anonymous namespace - -static void LazyInitialize(const CheckerBase *Checker, - std::unique_ptr &BT, - const char *name) { - if (BT) - return; - BT.reset(new BugType(Checker, name, categories::UnixAPI)); -} - -//===----------------------------------------------------------------------===// -// "open" (man 2 open) -//===----------------------------------------------------------------------===/ - -void UnixAPIArgsChecker::checkPreStmt(const CallExpr *CE, - CheckerContext &C) const { - const FunctionDecl *FD = C.getCalleeDecl(CE); - if (!FD || FD->getKind() != Decl::Function) - return; - - // Don't treat functions in namespaces with the same name a Unix function - // as a call to the Unix function. - const DeclContext *NamespaceCtx = FD->getEnclosingNamespaceContext(); - if (NamespaceCtx && isa(NamespaceCtx)) - return; - - StringRef FName = C.getCalleeName(FD); - if (FName.empty()) - return; - - if (FName == "open") - CheckOpen(C, CE); - - else if (FName == "openat") - CheckOpenAt(C, CE); -} -void UnixAPIArgsChecker::ReportOpenBug(CheckerContext &C, - ProgramStateRef State, - const char *Msg, - SourceRange SR) const { - ExplodedNode *N = C.generateErrorNode(State); - if (!N) - return; - - LazyInitialize(this, BT_open, "Improper use of 'open'"); - - auto Report = std::make_unique(*BT_open, Msg, N); - Report->addRange(SR); - C.emitReport(std::move(Report)); -} - -void UnixAPIArgsChecker::CheckOpen(CheckerContext &C, - const CallExpr *CE) const { - CheckOpenVariant(C, CE, OpenVariant::Open); -} - -void UnixAPIArgsChecker::CheckOpenAt(CheckerContext &C, - const CallExpr *CE) const { - CheckOpenVariant(C, CE, OpenVariant::OpenAt); -} - -void UnixAPIArgsChecker::CheckOpenVariant(CheckerContext &C, - const CallExpr *CE, - OpenVariant Variant) const { - // The index of the argument taking the flags open flags (O_RDONLY, - // O_WRONLY, O_CREAT, etc.), - unsigned int FlagsArgIndex; - switch (Variant) { - case OpenVariant::Open: - FlagsArgIndex = 1; - break; - case OpenVariant::OpenAt: - FlagsArgIndex = 2; - break; - }; - - // All calls should at least provide arguments up to the 'flags' parameter. - unsigned int MinArgCount = FlagsArgIndex + 1; - - // If the flags has O_CREAT set then open/openat() require an additional - // argument specifying the file mode (permission bits) for the created file. - unsigned int CreateModeArgIndex = FlagsArgIndex + 1; - - // The create mode argument should be the last argument. - unsigned int MaxArgCount = CreateModeArgIndex + 1; - - ProgramStateRef state = C.getState(); - - // Checked via UnixAPIChecker - if (CE->getNumArgs() < MinArgCount || CE->getNumArgs() > MaxArgCount) { - return; - } else if (CE->getNumArgs() == MaxArgCount) { - const Expr *Arg = CE->getArg(CreateModeArgIndex); - QualType QT = Arg->getType(); - if (!QT->isIntegerType()) { - return; - } - } - - // Now check if oflags has O_CREAT set. - const Expr *oflagsEx = CE->getArg(FlagsArgIndex); - const SVal V = C.getSVal(oflagsEx); - if (!V.getAs()) { - // The case where 'V' can be a location can only be due to a bad header, - // so in this case bail out. - return; - } - NonLoc oflags = V.castAs(); - NonLoc ocreateFlag = C.getSValBuilder() - .makeIntVal(Val_O_CREAT, oflagsEx->getType()).castAs(); - SVal maskedFlagsUC = C.getSValBuilder().evalBinOpNN(state, BO_And, - oflags, ocreateFlag, - oflagsEx->getType()); - if (maskedFlagsUC.isUnknownOrUndef()) - return; - DefinedSVal maskedFlags = maskedFlagsUC.castAs(); - - // Check if maskedFlags is non-zero. - ProgramStateRef trueState, falseState; - std::tie(trueState, falseState) = state->assume(maskedFlags); - - // Only emit an error if the value of 'maskedFlags' is properly - // constrained; - if (!(trueState && !falseState)) - return; - - if (CE->getNumArgs() < MaxArgCount) { - return; - } - - // Now check mode when O_CREAT flag is set, GROUP and OTHER should not - // have write or execute permission - const Expr *createModeEx = CE->getArg(CreateModeArgIndex); - const SVal CM = C.getSVal(createModeEx); - if (!CM.getAs()) { - return; - } - NonLoc createMode = CM.castAs(); - NonLoc createModeCheck = C.getSValBuilder(). - makeIntVal(Val_MODE, createModeEx->getType()).castAs(); - - SVal maskedCreateMode = C.getSValBuilder().evalBinOpNN(state, BO_And, - createMode, createModeCheck, - createModeEx->getType()); - if (maskedCreateMode.isUnknownOrUndef()) - return; - DefinedSVal maskedCreateModeSVal = maskedCreateMode.castAs(); - - // Check if maskedFlags is non-zero. - ProgramStateRef t, f; - std::tie(t, f) = state->assume(maskedCreateModeSVal); - - // Only emit an error if the value of 'maskedFlags' is properly - // constrained; - if (t && !f) { - SmallString<256> SBuf; - llvm::raw_svector_ostream OS(SBuf); - OS << "Open() system call, GROUP/OTHER should not have write or execute permission"; - ReportOpenBug(C, t, - SBuf.c_str(), - createModeEx->getSourceRange()); - } -} - -//===----------------------------------------------------------------------===// -// Registration. -//===----------------------------------------------------------------------===// - -#define REGISTER_CHECKER(CHECKERNAME) \ - void ento::register##CHECKERNAME(CheckerManager &mgr) { \ - mgr.registerChecker(); \ - } \ - \ - bool ento::shouldRegister##CHECKERNAME(const CheckerManager &mgr) { \ - return true; \ - } - -REGISTER_CHECKER(UnixAPIArgsChecker) diff --git a/clang/test/Analysis/memcpy_s.c b/clang/test/Analysis/memcpy_s.c deleted file mode 100644 index d945a4b4a969..000000000000 --- a/clang/test/Analysis/memcpy_s.c +++ /dev/null @@ -1,36 +0,0 @@ -//===----------------------------------------------------------------------===// -// 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 -//===----------------------------------------------------------------------===// - -// RUN: %clang_analyze_cc1 -analyzer-checker=openharmony -verify %s - -int memcpy_s(char *dst, int dstLen, char *src, int srcLen) { - return dstLen; -} - -void check1(int dstLen, int srcLen) { - char dstStr[dstLen]; - char srcStr[srcLen]; - memcpy_s(dstStr, sizeof(dstStr), srcStr, srcLen); // expected-warning{{memcpy_s(): src length may be larger than dst length}} -} - -void check2() { - char dstStr[20]; - char srcStr[10]; - memcpy_s(dstStr, sizeof(dstStr), srcStr, 10); // no-warning -} - -void check3() { - char dstStr[10]; - char srcStr[20]; - memcpy_s(dstStr, sizeof(dstStr), srcStr, 20); // expected-warning{{memcpy_s(): src length may be larger than dst length}} -} - -void check4() { - char dstStr[20]; - char srcStr[10]; - memcpy_s(&dstStr[15], 10, srcStr, 10); // expected-warning{{memcpy_s(): src length may be larger than dst length}} - memcpy_s(&dstStr[5], 10, srcStr, 10); // no-warning -} diff --git a/clang/test/Analysis/print-sensitive-info.c b/clang/test/Analysis/print-sensitive-info.c deleted file mode 100644 index 66d67373f7dd..000000000000 --- a/clang/test/Analysis/print-sensitive-info.c +++ /dev/null @@ -1,23 +0,0 @@ -// RUN: %clang_analyze_cc1 -analyzer-checker=openharmony -verify %s - -void HILOG(int x, int y) { - return; -} - -int getPassword() { - return 1; -} - -void test1() { - int x = getPassword(); - int y = getPassword(); - HILOG(x, y); - // expected-warning@-1 {{x is a sensitive information}} - // expected-warning@-2 {{y is a sensitive information}} -} - -void test2(int password, int passwd) { - HILOG(password, passwd); - // expected-warning@-1 {{password is a sensitive information}} - // expected-warning@-2 {{passwd is a sensitive information}} -} diff --git a/clang/test/Analysis/signal-handler.c b/clang/test/Analysis/signal-handler.c deleted file mode 100644 index ad3025c5a0b2..000000000000 --- a/clang/test/Analysis/signal-handler.c +++ /dev/null @@ -1,16 +0,0 @@ -// RUN: %clang_analyze_cc1 -analyzer-checker=openharmony -verify %s -// expected-no-diagnostics - -#define SIGINT 1 -void sighandler1(int); -int printf(const char *, ...); -void signal(int, void *); - -int main () { - signal(SIGINT, sighandler1); - return 0; -} - -void sighandler1(int signum) { - printf("in signalhandler1"); -} diff --git a/clang/test/Analysis/unix-api.c b/clang/test/Analysis/unix-api.c index 4adca811bfee..64ff3c0fccf4 100644 --- a/clang/test/Analysis/unix-api.c +++ b/clang/test/Analysis/unix-api.c @@ -1,19 +1,9 @@ -//===----------------------------------------------------------------------===// -// 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 -//===----------------------------------------------------------------------===// - -// RUN: %clang_analyze_cc1 -analyzer-checker=core,unix.API,openharmony -verify %s +// RUN: %clang_analyze_cc1 -analyzer-checker=core,unix.API -verify %s #ifndef O_RDONLY #define O_RDONLY 0 #endif -#ifndef O_CREAT -#define O_CREAT 0100 -#endif - #ifndef NULL #define NULL ((void*) 0) #endif @@ -100,19 +90,3 @@ void open_8(const char *path) { if (fd > -1) close(fd); } - -void open_9(const char *path) { - int fd; - int mode = 0631; - fd = open(path, O_CREAT, mode); // expected-warning{{Open() system call, GROUP/OTHER should not have write or execute permission}} - if (fd > -1) - close(fd); -} - -void open_10(const char *path) { - int fd; - int mode = 0644; - fd = open(path, O_CREAT, mode); // no-warning - if (fd > -1) - close(fd); -} \ No newline at end of file diff --git a/clang/test/CodeCompletion/function-overloads.cpp b/clang/test/CodeCompletion/function-overloads.cpp index 7b8ccef1d580..11c864c28107 100644 --- a/clang/test/CodeCompletion/function-overloads.cpp +++ b/clang/test/CodeCompletion/function-overloads.cpp @@ -21,8 +21,6 @@ namespace NS { void test_adl() { NS::X x; g(x, x); - (void)(f)(1, 2, 3); - (void)(test, test, test, f)(1, 2, 3); } // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:10:9 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s @@ -33,10 +31,6 @@ void test_adl() { // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:10:21 %s -o - | FileCheck -check-prefix=CHECK-CC4 %s // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:23:7 %s -o - | \ // RUN: FileCheck -check-prefix=CHECK-CC5 %s -// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:24:13 %s -o - | \ -// RUN: FileCheck -check-prefix=CHECK-CC1 %s -// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:25:31 %s -o - | \ -// RUN: FileCheck -check-prefix=CHECK-CC1 %s // CHECK-CC1: OVERLOAD: [#int#]f(<#float x#>, float y) // CHECK-CC1: OVERLOAD: [#int#]f(<#int i#>) // CHECK-CC1-NOT, CHECK-CC2-NOT: OVERLOAD: A( diff --git a/clang/test/CodeCompletion/member-access.c b/clang/test/CodeCompletion/member-access.c index 545349f71731..72afbf2ff947 100644 --- a/clang/test/CodeCompletion/member-access.c +++ b/clang/test/CodeCompletion/member-access.c @@ -29,10 +29,3 @@ void test3(struct Point2 *p) { // RUN: %clang_cc1 -fsyntax-only -code-completion-with-fixits -code-completion-at=%s:24:5 %s -o - | FileCheck -check-prefix=CHECK-CC3 %s // CHECK-CC3: x (requires fix-it: {24:4-24:5} to "->") - -void test4(struct Point *p) { - (int)(p)->x; - (int)(0,1,2,3,4,p)->x; -} -// RUN: %clang_cc1 -fsyntax-only -code-completion-with-fixits -code-completion-at=%s:34:13 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s -// RUN: %clang_cc1 -fsyntax-only -code-completion-with-fixits -code-completion-at=%s:35:23 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s diff --git a/clang/test/CodeGen/X86/avx512-reduceIntrin.c b/clang/test/CodeGen/X86/avx512-reduceIntrin.c index 62580ca1914e..d8a1130f3cef 100644 --- a/clang/test/CodeGen/X86/avx512-reduceIntrin.c +++ b/clang/test/CodeGen/X86/avx512-reduceIntrin.c @@ -11,13 +11,13 @@ long long test_mm512_reduce_add_epi64(__m512i __W){ long long test_mm512_reduce_mul_epi64(__m512i __W){ // CHECK-LABEL: @test_mm512_reduce_mul_epi64( // CHECK: call i64 @llvm.vector.reduce.mul.v8i64(<8 x i64> %{{.*}}) - return _mm512_reduce_mul_epi64(__W); + return _mm512_reduce_mul_epi64(__W); } long long test_mm512_reduce_or_epi64(__m512i __W){ // CHECK-LABEL: @test_mm512_reduce_or_epi64( // CHECK: call i64 @llvm.vector.reduce.or.v8i64(<8 x i64> %{{.*}}) - return _mm512_reduce_or_epi64(__W); + return _mm512_reduce_or_epi64(__W); } long long test_mm512_reduce_and_epi64(__m512i __W){ @@ -31,7 +31,7 @@ long long test_mm512_mask_reduce_add_epi64(__mmask8 __M, __m512i __W){ // CHECK: bitcast i8 %{{.*}} to <8 x i1> // CHECK: select <8 x i1> %{{.*}}, <8 x i64> %{{.*}}, <8 x i64> %{{.*}} // CHECK: call i64 @llvm.vector.reduce.add.v8i64(<8 x i64> %{{.*}}) - return _mm512_mask_reduce_add_epi64(__M, __W); + return _mm512_mask_reduce_add_epi64(__M, __W); } long long test_mm512_mask_reduce_mul_epi64(__mmask8 __M, __m512i __W){ @@ -39,7 +39,7 @@ long long test_mm512_mask_reduce_mul_epi64(__mmask8 __M, __m512i __W){ // CHECK: bitcast i8 %{{.*}} to <8 x i1> // CHECK: select <8 x i1> %{{.*}}, <8 x i64> %{{.*}}, <8 x i64> %{{.*}} // CHECK: call i64 @llvm.vector.reduce.mul.v8i64(<8 x i64> %{{.*}}) - return _mm512_mask_reduce_mul_epi64(__M, __W); + return _mm512_mask_reduce_mul_epi64(__M, __W); } long long test_mm512_mask_reduce_and_epi64(__mmask8 __M, __m512i __W){ @@ -47,7 +47,7 @@ long long test_mm512_mask_reduce_and_epi64(__mmask8 __M, __m512i __W){ // CHECK: bitcast i8 %{{.*}} to <8 x i1> // CHECK: select <8 x i1> %{{.*}}, <8 x i64> %{{.*}}, <8 x i64> %{{.*}} // CHECK: call i64 @llvm.vector.reduce.and.v8i64(<8 x i64> %{{.*}}) - return _mm512_mask_reduce_and_epi64(__M, __W); + return _mm512_mask_reduce_and_epi64(__M, __W); } long long test_mm512_mask_reduce_or_epi64(__mmask8 __M, __m512i __W){ @@ -55,30 +55,30 @@ long long test_mm512_mask_reduce_or_epi64(__mmask8 __M, __m512i __W){ // CHECK: bitcast i8 %{{.*}} to <8 x i1> // CHECK: select <8 x i1> %{{.*}}, <8 x i64> %{{.*}}, <8 x i64> %{{.*}} // CHECK: call i64 @llvm.vector.reduce.or.v8i64(<8 x i64> %{{.*}}) - return _mm512_mask_reduce_or_epi64(__M, __W); + return _mm512_mask_reduce_or_epi64(__M, __W); } int test_mm512_reduce_add_epi32(__m512i __W){ // CHECK-LABEL: @test_mm512_reduce_add_epi32( // CHECK: call i32 @llvm.vector.reduce.add.v16i32(<16 x i32> %{{.*}}) - return _mm512_reduce_add_epi32(__W); + return _mm512_reduce_add_epi32(__W); } int test_mm512_reduce_mul_epi32(__m512i __W){ // CHECK-LABEL: @test_mm512_reduce_mul_epi32( // CHECK: call i32 @llvm.vector.reduce.mul.v16i32(<16 x i32> %{{.*}}) - return _mm512_reduce_mul_epi32(__W); + return _mm512_reduce_mul_epi32(__W); } int test_mm512_reduce_or_epi32(__m512i __W){ // CHECK: call i32 @llvm.vector.reduce.or.v16i32(<16 x i32> %{{.*}}) - return _mm512_reduce_or_epi32(__W); + return _mm512_reduce_or_epi32(__W); } int test_mm512_reduce_and_epi32(__m512i __W){ // CHECK-LABEL: @test_mm512_reduce_and_epi32( // CHECK: call i32 @llvm.vector.reduce.and.v16i32(<16 x i32> %{{.*}}) - return _mm512_reduce_and_epi32(__W); + return _mm512_reduce_and_epi32(__W); } int test_mm512_mask_reduce_add_epi32(__mmask16 __M, __m512i __W){ @@ -86,7 +86,7 @@ int test_mm512_mask_reduce_add_epi32(__mmask16 __M, __m512i __W){ // CHECK: bitcast i16 %{{.*}} to <16 x i1> // CHECK: select <16 x i1> %{{.*}}, <16 x i32> %{{.*}}, <16 x i32> %{{.*}} // CHECK: call i32 @llvm.vector.reduce.add.v16i32(<16 x i32> %{{.*}}) - return _mm512_mask_reduce_add_epi32(__M, __W); + return _mm512_mask_reduce_add_epi32(__M, __W); } int test_mm512_mask_reduce_mul_epi32(__mmask16 __M, __m512i __W){ @@ -94,7 +94,7 @@ int test_mm512_mask_reduce_mul_epi32(__mmask16 __M, __m512i __W){ // CHECK: bitcast i16 %{{.*}} to <16 x i1> // CHECK: select <16 x i1> %{{.*}}, <16 x i32> %{{.*}}, <16 x i32> %{{.*}} // CHECK: call i32 @llvm.vector.reduce.mul.v16i32(<16 x i32> %{{.*}}) - return _mm512_mask_reduce_mul_epi32(__M, __W); + return _mm512_mask_reduce_mul_epi32(__M, __W); } int test_mm512_mask_reduce_and_epi32(__mmask16 __M, __m512i __W){ @@ -102,7 +102,7 @@ int test_mm512_mask_reduce_and_epi32(__mmask16 __M, __m512i __W){ // CHECK: bitcast i16 %{{.*}} to <16 x i1> // CHECK: select <16 x i1> %{{.*}}, <16 x i32> %{{.*}}, <16 x i32> %{{.*}} // CHECK: call i32 @llvm.vector.reduce.and.v16i32(<16 x i32> %{{.*}}) - return _mm512_mask_reduce_and_epi32(__M, __W); + return _mm512_mask_reduce_and_epi32(__M, __W); } int test_mm512_mask_reduce_or_epi32(__mmask16 __M, __m512i __W){ @@ -110,65 +110,61 @@ int test_mm512_mask_reduce_or_epi32(__mmask16 __M, __m512i __W){ // CHECK: bitcast i16 %{{.*}} to <16 x i1> // CHECK: select <16 x i1> %{{.*}}, <16 x i32> %{{.*}}, <16 x i32> %{{.*}} // CHECK: call i32 @llvm.vector.reduce.or.v16i32(<16 x i32> %{{.*}}) - return _mm512_mask_reduce_or_epi32(__M, __W); + return _mm512_mask_reduce_or_epi32(__M, __W); } -double test_mm512_reduce_add_pd(__m512d __W, double ExtraAddOp){ +double test_mm512_reduce_add_pd(__m512d __W){ // CHECK-LABEL: @test_mm512_reduce_add_pd( -// CHECK-NOT: reassoc -// CHECK: call reassoc double @llvm.vector.reduce.fadd.v8f64(double -0.000000e+00, <8 x double> %{{.*}}) -// CHECK-NOT: reassoc - return _mm512_reduce_add_pd(__W) + ExtraAddOp; +// CHECK: call double @llvm.vector.reduce.fadd.v8f64(double 0.000000e+00, <8 x double> %{{.*}}) + return _mm512_reduce_add_pd(__W); } -double test_mm512_reduce_mul_pd(__m512d __W, double ExtraMulOp){ +double test_mm512_reduce_mul_pd(__m512d __W){ // CHECK-LABEL: @test_mm512_reduce_mul_pd( -// CHECK-NOT: reassoc -// CHECK: call reassoc double @llvm.vector.reduce.fmul.v8f64(double 1.000000e+00, <8 x double> %{{.*}}) -// CHECK-NOT: reassoc - return _mm512_reduce_mul_pd(__W) * ExtraMulOp; +// CHECK: call double @llvm.vector.reduce.fmul.v8f64(double 1.000000e+00, <8 x double> %{{.*}}) + return _mm512_reduce_mul_pd(__W); } float test_mm512_reduce_add_ps(__m512 __W){ // CHECK-LABEL: @test_mm512_reduce_add_ps( -// CHECK: call reassoc float @llvm.vector.reduce.fadd.v16f32(float -0.000000e+00, <16 x float> %{{.*}}) - return _mm512_reduce_add_ps(__W); +// CHECK: call float @llvm.vector.reduce.fadd.v16f32(float 0.000000e+00, <16 x float> %{{.*}}) + return _mm512_reduce_add_ps(__W); } float test_mm512_reduce_mul_ps(__m512 __W){ // CHECK-LABEL: @test_mm512_reduce_mul_ps( -// CHECK: call reassoc float @llvm.vector.reduce.fmul.v16f32(float 1.000000e+00, <16 x float> %{{.*}}) - return _mm512_reduce_mul_ps(__W); +// CHECK: call float @llvm.vector.reduce.fmul.v16f32(float 1.000000e+00, <16 x float> %{{.*}}) + return _mm512_reduce_mul_ps(__W); } double test_mm512_mask_reduce_add_pd(__mmask8 __M, __m512d __W){ // CHECK-LABEL: @test_mm512_mask_reduce_add_pd( // CHECK: bitcast i8 %{{.*}} to <8 x i1> // CHECK: select <8 x i1> %{{.*}}, <8 x double> %{{.*}}, <8 x double> %{{.*}} -// CHECK: call reassoc double @llvm.vector.reduce.fadd.v8f64(double -0.000000e+00, <8 x double> %{{.*}}) - return _mm512_mask_reduce_add_pd(__M, __W); +// CHECK: call double @llvm.vector.reduce.fadd.v8f64(double 0.000000e+00, <8 x double> %{{.*}}) + return _mm512_mask_reduce_add_pd(__M, __W); } double test_mm512_mask_reduce_mul_pd(__mmask8 __M, __m512d __W){ // CHECK-LABEL: @test_mm512_mask_reduce_mul_pd( // CHECK: bitcast i8 %{{.*}} to <8 x i1> // CHECK: select <8 x i1> %{{.*}}, <8 x double> %{{.*}}, <8 x double> %{{.*}} -// CHECK: call reassoc double @llvm.vector.reduce.fmul.v8f64(double 1.000000e+00, <8 x double> %{{.*}}) - return _mm512_mask_reduce_mul_pd(__M, __W); +// CHECK: call double @llvm.vector.reduce.fmul.v8f64(double 1.000000e+00, <8 x double> %{{.*}}) + return _mm512_mask_reduce_mul_pd(__M, __W); } float test_mm512_mask_reduce_add_ps(__mmask16 __M, __m512 __W){ // CHECK-LABEL: @test_mm512_mask_reduce_add_ps( // CHECK: bitcast i16 %{{.*}} to <16 x i1> // CHECK: select <16 x i1> %{{.*}}, <16 x float> {{.*}}, <16 x float> {{.*}} -// CHECK: call reassoc float @llvm.vector.reduce.fadd.v16f32(float -0.000000e+00, <16 x float> %{{.*}}) - return _mm512_mask_reduce_add_ps(__M, __W); +// CHECK: call float @llvm.vector.reduce.fadd.v16f32(float 0.000000e+00, <16 x float> %{{.*}}) + return _mm512_mask_reduce_add_ps(__M, __W); } float test_mm512_mask_reduce_mul_ps(__mmask16 __M, __m512 __W){ // CHECK-LABEL: @test_mm512_mask_reduce_mul_ps( // CHECK: bitcast i16 %{{.*}} to <16 x i1> // CHECK: select <16 x i1> %{{.*}}, <16 x float> {{.*}}, <16 x float> %{{.*}} -// CHECK: call reassoc float @llvm.vector.reduce.fmul.v16f32(float 1.000000e+00, <16 x float> %{{.*}}) - return _mm512_mask_reduce_mul_ps(__M, __W); +// CHECK: call float @llvm.vector.reduce.fmul.v16f32(float 1.000000e+00, <16 x float> %{{.*}}) + return _mm512_mask_reduce_mul_ps(__M, __W); } diff --git a/clang/test/CodeGen/aarch64-fix-cortex-a53-835769.c b/clang/test/CodeGen/aarch64-fix-cortex-a53-835769.c index 74949c91ae6c..c6a38b20074a 100644 --- a/clang/test/CodeGen/aarch64-fix-cortex-a53-835769.c +++ b/clang/test/CodeGen/aarch64-fix-cortex-a53-835769.c @@ -9,8 +9,6 @@ // RUN: %clang -O3 -target aarch64-android-eabi %s -S -o- \ // RUN: | FileCheck --check-prefix=CHECK-YES --check-prefix=CHECK %s -// RUN: %clang -O3 -target aarch64-linux-ohos %s -S -o- \ -// RUN: | FileCheck --check-prefix=CHECK-YES --check-prefix=CHECK %s // RUN: %clang -O3 -target aarch64-android-eabi -mfix-cortex-a53-835769 %s -S -o- \ // RUN: | FileCheck --check-prefix=CHECK-YES --check-prefix=CHECK %s // RUN: %clang -O3 -target aarch64-android-eabi -mno-fix-cortex-a53-835769 %s -S -o- \ diff --git a/clang/test/CodeGen/altivec.c b/clang/test/CodeGen/altivec.c index 86b570f15d08..d69c34d82190 100644 --- a/clang/test/CodeGen/altivec.c +++ b/clang/test/CodeGen/altivec.c @@ -6,6 +6,9 @@ // RUN: %clang_cc1 -target-feature +altivec -mabi=vec-extabi -target-cpu pwr8 -triple powerpc64-unknown-aix -emit-llvm %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-BE // RUN: not %clang_cc1 -target-feature +altivec -mabi=vec-default -target-cpu pwr8 -triple powerpc-unknown-aix -emit-llvm %s 2>&1 | FileCheck %s --check-prefix=AIX-ERROR // RUN: not %clang_cc1 -target-feature +altivec -mabi=vec-default -target-cpu pwr8 -triple powerpc64-unknown-aix -emit-llvm %s 2>&1 | FileCheck %s --check-prefix=AIX-ERROR + +// RUN: not %clang -S -emit-llvm -maltivec -mcpu=pwr8 -target powerpc-unknown-aix %s 2>&1 | FileCheck %s --check-prefix=AIX-ERROR +// RUN: not %clang -S -emit-llvm -maltivec -mcpu=pwr8 -target powerpc64-unknown-aix %s 2>&1 | FileCheck %s --check-prefix=AIX-ERROR // RUN: %clang -S -emit-llvm -maltivec -mabi=vec-extabi -mcpu=pwr8 -target powerpc-unknown-aix %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-BE // RUN: %clang -S -emit-llvm -maltivec -mabi=vec-extabi -mcpu=pwr8 -target powerpc64-unknown-aix %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-BE // RUN: not %clang -S -emit-llvm -maltivec -mabi=vec-default -mcpu=pwr8 -triple powerpc-unknown-aix -emit-llvm %s 2>&1 | FileCheck %s --check-prefix=AIX-ERROR diff --git a/clang/test/CodeGen/arm64-abi-vector.c b/clang/test/CodeGen/arm64-abi-vector.c index 56a1d18073e2..da4af7a8cc82 100644 --- a/clang/test/CodeGen/arm64-abi-vector.c +++ b/clang/test/CodeGen/arm64-abi-vector.c @@ -1,6 +1,5 @@ // RUN: %clang_cc1 -triple arm64-apple-ios7 -target-abi darwinpcs -emit-llvm -o - %s | FileCheck %s // RUN: %clang_cc1 -triple aarch64-linux-android -emit-llvm -o - %s | FileCheck -check-prefix=ANDROID %s -// RUN: %clang_cc1 -triple aarch64-linux-ohos -emit-llvm -o - %s | FileCheck -check-prefix=ANDROID %s #include diff --git a/clang/test/CodeGen/attr-mustprogress-0.c b/clang/test/CodeGen/attr-mustprogress-0.c new file mode 100644 index 000000000000..2af24e88ceef --- /dev/null +++ b/clang/test/CodeGen/attr-mustprogress-0.c @@ -0,0 +1,184 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --check-attributes +// RUN: %clang_cc1 -std=c89 -triple=x86_64-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -std=c99 -triple=x86_64-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck %s + +int a = 0; +int b = 0; + +// CHECK: Function Attrs: noinline nounwind optnone +// CHECK-LABEL: @f1( +// CHECK-NEXT: entry: +// CHECK-NEXT: br label [[FOR_COND:%.*]] +// CHECK: for.cond: +// CHECK-NEXT: br i1 true, label [[FOR_BODY:%.*]], label [[FOR_END:%.*]] +// CHECK: for.body: +// CHECK-NEXT: br label [[FOR_COND]] +// CHECK: for.end: +// CHECK-NEXT: ret void +// +void f1() { + for (; 1;) { + } +} + +// CHECK: Function Attrs: noinline nounwind optnone +// CHECK-LABEL: @f2( +// CHECK-NEXT: entry: +// CHECK-NEXT: br label [[FOR_COND:%.*]] +// CHECK: for.cond: +// CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* @a, align 4 +// CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* @b, align 4 +// CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]] +// CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY:%.*]], label [[FOR_END:%.*]] +// CHECK: for.body: +// CHECK-NEXT: br label [[FOR_COND]] +// CHECK: for.end: +// CHECK-NEXT: ret void +// +void f2() { + for (; a == b;) { + } +} + +// CHECK: Function Attrs: noinline nounwind optnone +// CHECK-LABEL: @F( +// CHECK-NEXT: entry: +// CHECK-NEXT: br label [[FOR_COND:%.*]] +// CHECK: for.cond: +// CHECK-NEXT: br i1 true, label [[FOR_BODY:%.*]], label [[FOR_END:%.*]] +// CHECK: for.body: +// CHECK-NEXT: br label [[FOR_COND]] +// CHECK: for.end: +// CHECK-NEXT: br label [[FOR_COND1:%.*]] +// CHECK: for.cond1: +// CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* @a, align 4 +// CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* @b, align 4 +// CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]] +// CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY2:%.*]], label [[FOR_END3:%.*]] +// CHECK: for.body2: +// CHECK-NEXT: br label [[FOR_COND1]] +// CHECK: for.end3: +// CHECK-NEXT: ret void +// +void F() { + for (; 1;) { + } + for (; a == b;) { + } +} + +// CHECK: Function Attrs: noinline nounwind optnone +// CHECK-LABEL: @w1( +// CHECK-NEXT: entry: +// CHECK-NEXT: br label [[WHILE_BODY:%.*]] +// CHECK: while.body: +// CHECK-NEXT: br label [[WHILE_BODY]] +// +void w1() { + while (1) { + } +} + +// CHECK: Function Attrs: noinline nounwind optnone +// CHECK-LABEL: @w2( +// CHECK-NEXT: entry: +// CHECK-NEXT: br label [[WHILE_COND:%.*]] +// CHECK: while.cond: +// CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* @a, align 4 +// CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* @b, align 4 +// CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]] +// CHECK-NEXT: br i1 [[CMP]], label [[WHILE_BODY:%.*]], label [[WHILE_END:%.*]] +// CHECK: while.body: +// CHECK-NEXT: br label [[WHILE_COND]] +// CHECK: while.end: +// CHECK-NEXT: ret void +// +void w2() { + while (a == b) { + } +} + +// CHECK: Function Attrs: noinline nounwind optnone +// CHECK-LABEL: @W( +// CHECK-NEXT: entry: +// CHECK-NEXT: br label [[WHILE_COND:%.*]] +// CHECK: while.cond: +// CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* @a, align 4 +// CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* @b, align 4 +// CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]] +// CHECK-NEXT: br i1 [[CMP]], label [[WHILE_BODY:%.*]], label [[WHILE_END:%.*]] +// CHECK: while.body: +// CHECK-NEXT: br label [[WHILE_COND]] +// CHECK: while.end: +// CHECK-NEXT: br label [[WHILE_BODY2:%.*]] +// CHECK: while.body2: +// CHECK-NEXT: br label [[WHILE_BODY2]] +// +void W() { + while (a == b) { + } + while (1) { + } +} + +// CHECK: Function Attrs: noinline nounwind optnone +// CHECK-LABEL: @d1( +// CHECK-NEXT: entry: +// CHECK-NEXT: br label [[DO_BODY:%.*]] +// CHECK: do.body: +// CHECK-NEXT: br label [[DO_COND:%.*]] +// CHECK: do.cond: +// CHECK-NEXT: br i1 true, label [[DO_BODY]], label [[DO_END:%.*]] +// CHECK: do.end: +// CHECK-NEXT: ret void +// +void d1() { + do { + } while (1); +} + +// CHECK: Function Attrs: noinline nounwind optnone +// CHECK-LABEL: @d2( +// CHECK-NEXT: entry: +// CHECK-NEXT: br label [[DO_BODY:%.*]] +// CHECK: do.body: +// CHECK-NEXT: br label [[DO_COND:%.*]] +// CHECK: do.cond: +// CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* @a, align 4 +// CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* @b, align 4 +// CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]] +// CHECK-NEXT: br i1 [[CMP]], label [[DO_BODY]], label [[DO_END:%.*]] +// CHECK: do.end: +// CHECK-NEXT: ret void +// +void d2() { + do { + } while (a == b); +} + +// CHECK: Function Attrs: noinline nounwind optnone +// CHECK-LABEL: @D( +// CHECK-NEXT: entry: +// CHECK-NEXT: br label [[DO_BODY:%.*]] +// CHECK: do.body: +// CHECK-NEXT: br label [[DO_COND:%.*]] +// CHECK: do.cond: +// CHECK-NEXT: br i1 true, label [[DO_BODY]], label [[DO_END:%.*]] +// CHECK: do.end: +// CHECK-NEXT: br label [[DO_BODY1:%.*]] +// CHECK: do.body1: +// CHECK-NEXT: br label [[DO_COND2:%.*]] +// CHECK: do.cond2: +// CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* @a, align 4 +// CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* @b, align 4 +// CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]] +// CHECK-NEXT: br i1 [[CMP]], label [[DO_BODY1]], label [[DO_END3:%.*]] +// CHECK: do.end3: +// CHECK-NEXT: ret void +// +void D() { + do { + } while (1); + do { + } while (a == b); +} diff --git a/clang/test/CodeGen/attr-mustprogress-0.cpp b/clang/test/CodeGen/attr-mustprogress-0.cpp new file mode 100644 index 000000000000..3a180cc6b5ad --- /dev/null +++ b/clang/test/CodeGen/attr-mustprogress-0.cpp @@ -0,0 +1,183 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --check-attributes +// RUN: %clang_cc1 -std=c++98 -triple=x86_64-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck %s + +int a = 0; +int b = 0; + +// CHECK: Function Attrs: noinline nounwind optnone +// CHECK-LABEL: @_Z2f1v( +// CHECK-NEXT: entry: +// CHECK-NEXT: br label [[FOR_COND:%.*]] +// CHECK: for.cond: +// CHECK-NEXT: br i1 true, label [[FOR_BODY:%.*]], label [[FOR_END:%.*]] +// CHECK: for.body: +// CHECK-NEXT: br label [[FOR_COND]] +// CHECK: for.end: +// CHECK-NEXT: ret void +// +void f1() { + for (; 1;) { + } +} + +// CHECK: Function Attrs: noinline nounwind optnone +// CHECK-LABEL: @_Z2f2v( +// CHECK-NEXT: entry: +// CHECK-NEXT: br label [[FOR_COND:%.*]] +// CHECK: for.cond: +// CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* @a, align 4 +// CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* @b, align 4 +// CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]] +// CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY:%.*]], label [[FOR_END:%.*]] +// CHECK: for.body: +// CHECK-NEXT: br label [[FOR_COND]] +// CHECK: for.end: +// CHECK-NEXT: ret void +// +void f2() { + for (; a == b;) { + } +} + +// CHECK: Function Attrs: noinline nounwind optnone +// CHECK-LABEL: @_Z1Fv( +// CHECK-NEXT: entry: +// CHECK-NEXT: br label [[FOR_COND:%.*]] +// CHECK: for.cond: +// CHECK-NEXT: br i1 true, label [[FOR_BODY:%.*]], label [[FOR_END:%.*]] +// CHECK: for.body: +// CHECK-NEXT: br label [[FOR_COND]] +// CHECK: for.end: +// CHECK-NEXT: br label [[FOR_COND1:%.*]] +// CHECK: for.cond1: +// CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* @a, align 4 +// CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* @b, align 4 +// CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]] +// CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY2:%.*]], label [[FOR_END3:%.*]] +// CHECK: for.body2: +// CHECK-NEXT: br label [[FOR_COND1]] +// CHECK: for.end3: +// CHECK-NEXT: ret void +// +void F() { + for (; 1;) { + } + for (; a == b;) { + } +} + +// CHECK: Function Attrs: noinline nounwind optnone +// CHECK-LABEL: @_Z2w1v( +// CHECK-NEXT: entry: +// CHECK-NEXT: br label [[WHILE_BODY:%.*]] +// CHECK: while.body: +// CHECK-NEXT: br label [[WHILE_BODY]] +// +void w1() { + while (1) { + } +} + +// CHECK: Function Attrs: noinline nounwind optnone +// CHECK-LABEL: @_Z2w2v( +// CHECK-NEXT: entry: +// CHECK-NEXT: br label [[WHILE_COND:%.*]] +// CHECK: while.cond: +// CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* @a, align 4 +// CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* @b, align 4 +// CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]] +// CHECK-NEXT: br i1 [[CMP]], label [[WHILE_BODY:%.*]], label [[WHILE_END:%.*]] +// CHECK: while.body: +// CHECK-NEXT: br label [[WHILE_COND]] +// CHECK: while.end: +// CHECK-NEXT: ret void +// +void w2() { + while (a == b) { + } +} + +// CHECK: Function Attrs: noinline nounwind optnone +// CHECK-LABEL: @_Z1Wv( +// CHECK-NEXT: entry: +// CHECK-NEXT: br label [[WHILE_COND:%.*]] +// CHECK: while.cond: +// CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* @a, align 4 +// CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* @b, align 4 +// CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]] +// CHECK-NEXT: br i1 [[CMP]], label [[WHILE_BODY:%.*]], label [[WHILE_END:%.*]] +// CHECK: while.body: +// CHECK-NEXT: br label [[WHILE_COND]] +// CHECK: while.end: +// CHECK-NEXT: br label [[WHILE_BODY2:%.*]] +// CHECK: while.body2: +// CHECK-NEXT: br label [[WHILE_BODY2]] +// +void W() { + while (a == b) { + } + while (1) { + } +} + +// CHECK: Function Attrs: noinline nounwind optnone +// CHECK-LABEL: @_Z2d1v( +// CHECK-NEXT: entry: +// CHECK-NEXT: br label [[DO_BODY:%.*]] +// CHECK: do.body: +// CHECK-NEXT: br label [[DO_COND:%.*]] +// CHECK: do.cond: +// CHECK-NEXT: br i1 true, label [[DO_BODY]], label [[DO_END:%.*]] +// CHECK: do.end: +// CHECK-NEXT: ret void +// +void d1() { + do { + } while (1); +} + +// CHECK: Function Attrs: noinline nounwind optnone +// CHECK-LABEL: @_Z2d2v( +// CHECK-NEXT: entry: +// CHECK-NEXT: br label [[DO_BODY:%.*]] +// CHECK: do.body: +// CHECK-NEXT: br label [[DO_COND:%.*]] +// CHECK: do.cond: +// CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* @a, align 4 +// CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* @b, align 4 +// CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]] +// CHECK-NEXT: br i1 [[CMP]], label [[DO_BODY]], label [[DO_END:%.*]] +// CHECK: do.end: +// CHECK-NEXT: ret void +// +void d2() { + do { + } while (a == b); +} + +// CHECK: Function Attrs: noinline nounwind optnone +// CHECK-LABEL: @_Z1Dv( +// CHECK-NEXT: entry: +// CHECK-NEXT: br label [[DO_BODY:%.*]] +// CHECK: do.body: +// CHECK-NEXT: br label [[DO_COND:%.*]] +// CHECK: do.cond: +// CHECK-NEXT: br i1 true, label [[DO_BODY]], label [[DO_END:%.*]] +// CHECK: do.end: +// CHECK-NEXT: br label [[DO_BODY1:%.*]] +// CHECK: do.body1: +// CHECK-NEXT: br label [[DO_COND2:%.*]] +// CHECK: do.cond2: +// CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* @a, align 4 +// CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* @b, align 4 +// CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]] +// CHECK-NEXT: br i1 [[CMP]], label [[DO_BODY1]], label [[DO_END3:%.*]] +// CHECK: do.end3: +// CHECK-NEXT: ret void +// +void D() { + do { + } while (1); + do { + } while (a == b); +} diff --git a/clang/test/CodeGen/attr-mustprogress.c b/clang/test/CodeGen/attr-mustprogress-1.c similarity index 47% rename from clang/test/CodeGen/attr-mustprogress.c rename to clang/test/CodeGen/attr-mustprogress-1.c index 1f83cd44b308..2ff068b8b90a 100644 --- a/clang/test/CodeGen/attr-mustprogress.c +++ b/clang/test/CodeGen/attr-mustprogress-1.c @@ -1,35 +1,31 @@ -// RUN: %clang_cc1 -std=c99 -triple=x86_64-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck --check-prefix=CHECK --check-prefix=C99 %s -// RUN: %clang_cc1 -std=c11 -triple=x86_64-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck --check-prefix=CHECK --check-prefix=C11 %s -// RUN: %clang_cc1 -std=c18 -triple=x86_64-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck --check-prefix=CHECK --check-prefix=C11 %s -// RUN: %clang_cc1 -std=c2x -triple=x86_64-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck --check-prefix=CHECK --check-prefix=C11 %s -// -// RUN: %clang_cc1 -std=c11 -ffinite-loops -triple=x86_64-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck --check-prefix=CHECK --check-prefix=FINITE %s -// RUN: %clang_cc1 -std=c11 -fno-finite-loops -triple=x86_64-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck --check-prefix=CHECK --check-prefix=C99 %s +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --check-attributes +// RUN: %clang_cc1 -triple=x86_64-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -std=c11 -triple=x86_64-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -std=c18 -triple=x86_64-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -std=c2x -triple=x86_64-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck %s int a = 0; int b = 0; -// CHECK: datalayout -// -// CHECK-NOT: mustprogress +// CHECK: Function Attrs: noinline nounwind optnone // CHECK-LABEL: @f0( // CHECK-NEXT: entry: -// CHECK-NEXT: br label %for.cond +// CHECK-NEXT: br label [[FOR_COND:%.*]] // CHECK: for.cond: -// CHECK-NOT: br {{.*}}!llvm.loop +// CHECK-NOT: br label [[FOR_COND]], !llvm.loop !{{.*}} // void f0() { for (; ;) ; } -// CHECK-NOT: mustprogress +// CHECK: Function Attrs: noinline nounwind optnone // CHECK-LABEL: @f1( // CHECK-NEXT: entry: -// CHECK-NEXT: br label %for.cond +// CHECK-NEXT: br label [[FOR_COND:%.*]] // CHECK: for.cond: -// CHECK-NEXT: br i1 true, label %for.body, label %for.end +// CHECK-NEXT: br i1 true, label [[FOR_BODY:%.*]], label [[FOR_END:%.*]] // CHECK: for.body: -// CHECK-NOT: br {{.*}}, !llvm.loop +// CHECK-NEXT: br label [[FOR_COND]] // CHECK: for.end: // CHECK-NEXT: ret void // @@ -38,19 +34,17 @@ void f1() { } } -// CHECK-NOT: mustprogress +// CHECK: Function Attrs: noinline nounwind optnone // CHECK-LABEL: @f2( // CHECK-NEXT: entry: -// CHECK-NEXT: br label %for.cond +// CHECK-NEXT: br label [[FOR_COND:%.*]] // CHECK: for.cond: // CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* @a, align 4 // CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* @b, align 4 // CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]] -// CHECK-NEXT: br i1 [[CMP]], label %for.body, label %for.end +// CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY:%.*]], label [[FOR_END:%.*]] // CHECK: for.body: -// C99-NOT: br {{.*}} !llvm.loop -// C11: br label %for.cond, !llvm.loop [[LOOP1:!.*]] -// FINITE: br label %for.cond, !llvm.loop [[LOOP1:!.*]] +// CHECK-NEXT: br label [[FOR_COND]], [[LOOP2:!llvm.loop !.*]] // CHECK: for.end: // CHECK-NEXT: ret void // @@ -59,25 +53,23 @@ void f2() { } } -// CHECK-NOT: mustprogress +// CHECK: Function Attrs: noinline nounwind optnone // CHECK-LABEL: @F( // CHECK-NEXT: entry: -// CHECK-NEXT: br label %for.cond +// CHECK-NEXT: br label [[FOR_COND:%.*]] // CHECK: for.cond: -// CHECK-NEXT: br i1 true, label %for.body, label %for.end +// CHECK-NEXT: br i1 true, label [[FOR_BODY:%.*]], label [[FOR_END:%.*]] // CHECK: for.body: -// CHECK-NOT: br {{.*}}, !llvm.loop +// CHECK-NEXT: br label [[FOR_COND]] // CHECK: for.end: -// CHECK-NEXT: br label %for.cond1 +// CHECK-NEXT: br label [[FOR_COND1:%.*]] // CHECK: for.cond1: // CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* @a, align 4 // CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* @b, align 4 // CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]] -// CHECK-NEXT: br i1 [[CMP]], label %for.body2, label %for.end3 +// CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY2:%.*]], label [[FOR_END3:%.*]] // CHECK: for.body2: -// C99-NOT: br {{.*}}, !llvm.loop -// C11: br label %for.cond1, !llvm.loop [[LOOP2:!.*]] -// FINITE: br label %for.cond1, !llvm.loop [[LOOP2:!.*]] +// CHECK-NEXT: br label [[FOR_COND1]], [[LOOP4:!llvm.loop !.*]] // CHECK: for.end3: // CHECK-NEXT: ret void // @@ -88,31 +80,29 @@ void F() { } } -// CHECK-NOT: mustprogress +// CHECK: Function Attrs: noinline nounwind optnone // CHECK-LABEL: @w1( // CHECK-NEXT: entry: -// CHECK-NEXT: br label %while.body +// CHECK-NEXT: br label [[WHILE_BODY:%.*]] // CHECK: while.body: -// CHECK-NOT: br {{.*}}, !llvm.loop +// CHECK-NEXT: br label [[WHILE_BODY]] // void w1() { while (1) { } } -// CHECK-NOT: mustprogress +// CHECK: Function Attrs: noinline nounwind optnone // CHECK-LABEL: @w2( // CHECK-NEXT: entry: -// CHECK-NEXT: br label %while.cond +// CHECK-NEXT: br label [[WHILE_COND:%.*]] // CHECK: while.cond: // CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* @a, align 4 // CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* @b, align 4 // CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]] -// CHECK-NEXT: br i1 [[CMP]], label %while.body, label %while.end +// CHECK-NEXT: br i1 [[CMP]], label [[WHILE_BODY:%.*]], label [[WHILE_END:%.*]] // CHECK: while.body: -// C99-NOT: br {{.*}}, !llvm.loop -// C11: br label %while.cond, !llvm.loop [[LOOP3:!.*]] -// FINITE: br label %while.cond, !llvm.loop [[LOOP3:!.*]] +// CHECK-NEXT: br label [[WHILE_COND]], [[LOOP5:!llvm.loop !.*]] // CHECK: while.end: // CHECK-NEXT: ret void // @@ -121,7 +111,7 @@ void w2() { } } -// CHECK-NOT: mustprogress +// CHECK: Function Attrs: noinline nounwind optnone // CHECK-LABEL: @W( // CHECK-NEXT: entry: // CHECK-NEXT: br label [[WHILE_COND:%.*]] @@ -129,15 +119,13 @@ void w2() { // CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* @a, align 4 // CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* @b, align 4 // CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]] -// CHECK-NEXT: br i1 [[CMP]], label %while.body, label %while.end +// CHECK-NEXT: br i1 [[CMP]], label [[WHILE_BODY:%.*]], label [[WHILE_END:%.*]] // CHECK: while.body: -// C99-NOT: br {{.*}} !llvm.loop -// C11: br label %while.cond, !llvm.loop [[LOOP4:!.*]] -// FINITE: br label %while.cond, !llvm.loop [[LOOP4:!.*]] +// CHECK-NEXT: br label [[WHILE_COND]], [[LOOP6:!llvm.loop !.*]] // CHECK: while.end: -// CHECK-NEXT: br label %while.body2 +// CHECK-NEXT: br label [[WHILE_BODY2:%.*]] // CHECK: while.body2: -// CHECK-NOT: br {{.*}} !llvm.loop +// CHECK-NEXT: br label [[WHILE_BODY2]] // void W() { while (a == b) { @@ -146,14 +134,14 @@ void W() { } } -// CHECK-NOT: mustprogress +// CHECK: Function Attrs: noinline nounwind optnone // CHECK-LABEL: @d1( // CHECK-NEXT: entry: -// CHECK-NEXT: br label %do.body +// CHECK-NEXT: br label [[DO_BODY:%.*]] // CHECK: do.body: -// CHECK-NEXT: br label %do.cond +// CHECK-NEXT: br label [[DO_COND:%.*]] // CHECK: do.cond: -// CHECK-NOT: br {{.*}}, !llvm.loop +// CHECK-NEXT: br i1 true, label [[DO_BODY]], label [[DO_END:%.*]] // CHECK: do.end: // CHECK-NEXT: ret void // @@ -162,19 +150,17 @@ void d1() { } while (1); } -// CHECK-NOT: mustprogress +// CHECK: Function Attrs: noinline nounwind optnone // CHECK-LABEL: @d2( // CHECK-NEXT: entry: -// CHECK-NEXT: br label %do.body +// CHECK-NEXT: br label [[DO_BODY:%.*]] // CHECK: do.body: -// CHECK-NEXT: br label %do.cond +// CHECK-NEXT: br label [[DO_COND:%.*]] // CHECK: do.cond: // CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* @a, align 4 // CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* @b, align 4 // CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]] -// C99-NOT: br {{.*}}, !llvm.loop -// C11: br i1 [[CMP]], label %do.body, label %do.end, !llvm.loop [[LOOP5:!.*]] -// FINITE: br i1 [[CMP]], label %do.body, label %do.end, !llvm.loop [[LOOP5:!.*]] +// CHECK-NEXT: br i1 [[CMP]], label [[DO_BODY]], label [[DO_END:%.*]], [[LOOP7:!llvm.loop !.*]] // CHECK: do.end: // CHECK-NEXT: ret void // @@ -183,25 +169,23 @@ void d2() { } while (a == b); } -// CHECK-NOT: mustprogress +// CHECK: Function Attrs: noinline nounwind optnone // CHECK-LABEL: @D( // CHECK-NEXT: entry: -// CHECK-NEXT: br label %do.body +// CHECK-NEXT: br label [[DO_BODY:%.*]] // CHECK: do.body: -// CHECK-NEXT: br label %do.cond +// CHECK-NEXT: br label [[DO_COND:%.*]] // CHECK: do.cond: -// CHECK-NOT: br label {{.*}}, !llvm.loop +// CHECK-NEXT: br i1 true, label [[DO_BODY]], label [[DO_END:%.*]] // CHECK: do.end: -// CHECK-NEXT: br label %do.body1 +// CHECK-NEXT: br label [[DO_BODY1:%.*]] // CHECK: do.body1: -// CHECK-NEXT: br label %do.cond2 +// CHECK-NEXT: br label [[DO_COND2:%.*]] // CHECK: do.cond2: // CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* @a, align 4 // CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* @b, align 4 // CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]] -// C99-NOT: br {{.*}}, !llvm.loop -// C11: br i1 [[CMP]], label %do.body1, label %do.end3, !llvm.loop [[LOOP6:!.*]] -// FINITE: br i1 [[CMP]], label %do.body1, label %do.end3, !llvm.loop [[LOOP6:!.*]] +// CHECK-NEXT: br i1 [[CMP]], label [[DO_BODY1]], label [[DO_END3:%.*]], [[LOOP8:!llvm.loop !.*]] // CHECK: do.end3: // CHECK-NEXT: ret void // @@ -211,11 +195,3 @@ void D() { do { } while (a == b); } - -// C11: [[LOOP1]] = distinct !{[[LOOP1]], [[MP:!.*]]} -// C11: [[MP]] = !{!"llvm.loop.mustprogress"} -// C11: [[LOOP2]] = distinct !{[[LOOP2]], [[MP]]} -// C11: [[LOOP3]] = distinct !{[[LOOP3]], [[MP]]} -// C11: [[LOOP4]] = distinct !{[[LOOP4]], [[MP]]} -// C11: [[LOOP5]] = distinct !{[[LOOP5]], [[MP]]} -// C11: [[LOOP6]] = distinct !{[[LOOP6]], [[MP]]} diff --git a/clang/test/CodeGenCXX/attr-mustprogress.cpp b/clang/test/CodeGen/attr-mustprogress-1.cpp similarity index 43% rename from clang/test/CodeGenCXX/attr-mustprogress.cpp rename to clang/test/CodeGen/attr-mustprogress-1.cpp index 48ac7ad938ba..945d74663c6d 100644 --- a/clang/test/CodeGenCXX/attr-mustprogress.cpp +++ b/clang/test/CodeGen/attr-mustprogress-1.cpp @@ -1,42 +1,30 @@ -// RUN: %clang_cc1 -std=c++98 -triple=x86_64-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck --check-prefix=CHECK --check-prefix=CXX98 %s -// RUN: %clang_cc1 -std=c++11 -triple=x86_64-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck --check-prefix=CHECK --check-prefix=CXX11 %s -// RUN: %clang_cc1 -std=c++14 -triple=x86_64-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck --check-prefix=CHECK --check-prefix=CXX11 %s -// RUN: %clang_cc1 -std=c++17 -triple=x86_64-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck --check-prefix=CHECK --check-prefix=CXX11 %s -// RUN: %clang_cc1 -std=c++20 -triple=x86_64-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck --check-prefix=CHECK --check-prefix=CXX11 %s - -// Make sure -ffinite-loops overrides -std=c++98 for loops. -// RUN: %clang_cc1 -std=c++98 -ffinite-loops -triple=x86_64-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck --check-prefix=CHECK --check-prefix=FINITE %s - -// Make sure -fno-finite-loops overrides -std=c++11 -// RUN: %clang_cc1 -std=c++11 -fno-finite-loops -triple=x86_64-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck --check-prefix=CHECK --check-prefix=CXX98 %s +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --check-attributes +// RUN: %clang_cc1 -std=c++11 -triple=x86_64-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -std=c++14 -triple=x86_64-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -std=c++17 -triple=x86_64-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -std=c++20 -triple=x86_64-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck %s int a = 0; int b = 0; -// CHECK: datalayout - -// CXX98-NOT: mustprogress -// CXX11-NOT: mustprogress -// FINITE-NOT: mustprogress +// CHECK: Function Attrs: noinline nounwind optnone // CHECK-LABEL: @_Z2f0v( // CHECK-NEXT: entry: -// CHECK-NEXT: br label %for.cond +// CHECK-NEXT: br label [[FOR_COND:%.*]] // CHECK: for.cond: -// CHECK-NOT: br {{.*}} llvm.loop +// CHECK-NOT: br label [[FOR_COND]], !llvm.loop !{{.*}} void f0() { for (; ;) ; } -// CXX98-NOT: mustprogress -// CXX11-NOT: mustprogress -// FINITE-NOT: mustprogress +// CHECK: Function Attrs: noinline nounwind optnone // CHECK-LABEL: @_Z2f1v( // CHECK-NEXT: entry: -// CHECK-NEXT: br label %for.cond +// CHECK-NEXT: br label [[FOR_COND:%.*]] // CHECK: for.cond: -// CHECK-NEXT: br i1 true, label %for.body, label %for.end +// CHECK-NEXT: br i1 true, label [[FOR_BODY:%.*]], label [[FOR_END:%.*]] // CHECK: for.body: -// CHECK-NOT: br {{.*}}, !llvm.loop +// CHECK-NEXT: br label [[FOR_COND]] // CHECK: for.end: // CHECK-NEXT: ret void // @@ -45,21 +33,17 @@ void f1() { ; } -// CXX98-NOT: mustprogress -// CXX11: mustprogress -// FINITE-NOT: mustprogress +// CHECK: Function Attrs: noinline nounwind optnone mustprogress // CHECK-LABEL: @_Z2f2v( // CHECK-NEXT: entry: -// CHECK-NEXT: br label %for.cond +// CHECK-NEXT: br label [[FOR_COND:%.*]] // CHECK: for.cond: // CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* @a, align 4 // CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* @b, align 4 // CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]] -// CHECK-NEXT: br i1 [[CMP]], label %for.body, label %for.end +// CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY:%.*]], label [[FOR_END:%.*]] // CHECK: for.body: -// CXX98-NOT: br {{.*}}, !llvm.loop -// CXX11: br label %for.cond, !llvm.loop [[LOOP1:!.*]] -// FINITE-NEXT: br label %for.cond, !llvm.loop [[LOOP1:!.*]] +// CHECK-NEXT: br label [[FOR_COND]], [[LOOP2:!llvm.loop !.*]] // CHECK: for.end: // CHECK-NEXT: ret void // @@ -68,27 +52,23 @@ void f2() { ; } -// CXX98-NOT: mustprogress -// CXX11-NOT: mustprogress -// FINITE-NOT: mustprogress +// CHECK: Function Attrs: noinline nounwind optnone // CHECK-LABEL: @_Z1Fv( // CHECK-NEXT: entry: -// CHECK-NEXT: br label %for.cond +// CHECK-NEXT: br label [[FOR_COND:%.*]] // CHECK: for.cond: -// CHECK-NEXT: br i1 true, label %for.body, label %for.end +// CHECK-NEXT: br i1 true, label [[FOR_BODY:%.*]], label [[FOR_END:%.*]] // CHECK: for.body: -// CHECK-NOT: br {{.*}}, !llvm.loop +// CHECK-NEXT: br label [[FOR_COND]] // CHECK: for.end: -// CHECK-NEXT: br label %for.cond1 +// CHECK-NEXT: br label [[FOR_COND1:%.*]] // CHECK: for.cond1: // CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* @a, align 4 // CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* @b, align 4 // CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]] -// CHECK-NEXT: br i1 [[CMP]], label %for.body2, label %for.end3 +// CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY2:%.*]], label [[FOR_END3:%.*]] // CHECK: for.body2: -// CXX98-NOT: br {{.*}}, !llvm.loop -// CXX11-NEXT: br label %for.cond1, !llvm.loop [[LOOP2:!.*]] -// FINITE-NEXT: br label %for.cond1, !llvm.loop [[LOOP2:!.*]] +// CHECK-NEXT: br label [[FOR_COND1]], [[LOOP4:!llvm.loop !.*]] // CHECK: for.end3: // CHECK-NEXT: ret void // @@ -99,27 +79,23 @@ void F() { ; } -// CXX98-NOT: mustprogress -// CXX11-NOT: mustprogress -// FINITE-NOT: mustprogress +// CHECK: Function Attrs: noinline nounwind optnone // CHECK-LABEL: @_Z2F2v( // CHECK-NEXT: entry: -// CHECK-NEXT: br label %for.cond +// CHECK-NEXT: br label [[FOR_COND:%.*]] // CHECK: for.cond: // CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* @a, align 4 // CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* @b, align 4 // CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]] -// CHECK-NEXT: br i1 [[CMP]], label %for.body, label %for.end +// CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY:%.*]], label [[FOR_END:%.*]] // CHECK: for.body: -// CXX98_NOT: br {{.*}} !llvm.loop -// CXX11-NEXT: br label %for.cond, !llvm.loop [[LOOP3:!.*]] -// FINITE-NEXT: br label %for.cond, !llvm.loop [[LOOP3:!.*]] +// CHECK-NEXT: br label [[FOR_COND]], [[LOOP5:!llvm.loop !.*]] // CHECK: for.end: -// CHECK-NEXT: br label %for.cond1 +// CHECK-NEXT: br label [[FOR_COND1:%.*]] // CHECK: for.cond1: -// CHECK-NEXT: br i1 true, label %for.body2, label %for.end3 +// CHECK-NEXT: br i1 true, label [[FOR_BODY2:%.*]], label [[FOR_END3:%.*]] // CHECK: for.body2: -// CHECK-NOT: br {{.*}}, !llvm.loop +// CHECK-NEXT: br label [[FOR_COND1]] // CHECK: for.end3: // CHECK-NEXT: ret void // @@ -130,35 +106,29 @@ void F2() { ; } -// CXX98-NOT: mustprogress -// CXX11-NOT: mustprogress -// FINITE-NOT: mustprogress +// CHECK: Function Attrs: noinline nounwind optnone // CHECK-LABEL: @_Z2w1v( // CHECK-NEXT: entry: -// CHECK-NEXT: br label %while.body +// CHECK-NEXT: br label [[WHILE_BODY:%.*]] // CHECK: while.body: -// CHECK-NOT: br {{.*}}, !llvm.loop +// CHECK-NEXT: br label [[WHILE_BODY]] // void w1() { while (1) ; } -// CXX98-NOT: mustprogress -// CXX11: mustprogress -// FINITE-NOT: mustprogress +// CHECK: Function Attrs: noinline nounwind optnone mustprogress // CHECK-LABEL: @_Z2w2v( // CHECK-NEXT: entry: -// CHECK-NEXT: br label %while.cond +// CHECK-NEXT: br label [[WHILE_COND:%.*]] // CHECK: while.cond: // CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* @a, align 4 // CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* @b, align 4 // CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]] -// CHECK-NEXT: br i1 [[CMP]], label %while.body, label %while.end +// CHECK-NEXT: br i1 [[CMP]], label [[WHILE_BODY:%.*]], label [[WHILE_END:%.*]] // CHECK: while.body: -// CXX98-NOT: br {{.*}}, !llvm.loop -// CXX11-NEXT: br label %while.cond, !llvm.loop [[LOOP4:!.*]] -// FINITE-NEXT: br label %while.cond, !llvm.loop [[LOOP4:!.*]] +// CHECK-NEXT: br label [[WHILE_COND]], [[LOOP6:!llvm.loop !.*]] // CHECK: while.end: // CHECK-NEXT: ret void // @@ -167,25 +137,21 @@ void w2() { ; } -// CXX98-NOT: mustprogress -// CXX11-NOT: mustprogress -// FINITE-NOT: mustprogress +// CHECK: Function Attrs: noinline nounwind optnone // CHECK-LABEL: @_Z1Wv( // CHECK-NEXT: entry: -// CHECK-NEXT: br label %while.cond +// CHECK-NEXT: br label [[WHILE_COND:%.*]] // CHECK: while.cond: // CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* @a, align 4 // CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* @b, align 4 // CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]] -// CHECK-NEXT: br i1 [[CMP]], label %while.body, label %while.end +// CHECK-NEXT: br i1 [[CMP]], label [[WHILE_BODY:%.*]], label [[WHILE_END:%.*]] // CHECK: while.body: -// CXX98-NOT: br {{.*}}, !llvm.loop -// CXX11-NEXT: br label %while.cond, !llvm.loop [[LOOP5:!.*]] -// FINITE-NEXT: br label %while.cond, !llvm.loop [[LOOP5:!.*]] +// CHECK-NEXT: br label [[WHILE_COND]], [[LOOP7:!llvm.loop !.*]] // CHECK: while.end: -// CHECK-NEXT: br label %while.body2 +// CHECK-NEXT: br label [[WHILE_BODY2:%.*]] // CHECK: while.body2: -// CHECK-NOT: br {{.*}}, !llvm.loop +// CHECK-NEXT: br label [[WHILE_BODY2]] // void W() { while (a == b) @@ -194,14 +160,12 @@ void W() { ; } -// CXX98-NOT: mustprogress -// CXX11-NOT: mustprogress -// FINITE-NOT: mustprogress +// CHECK: Function Attrs: noinline nounwind optnone // CHECK-LABEL: @_Z2W2v( // CHECK-NEXT: entry: -// CHECK-NEXT: br label %while.body +// CHECK-NEXT: br label [[WHILE_BODY:%.*]] // CHECK: while.body: -// CHECK-NOT: br {{.*}}, !llvm.loop +// CHECK-NEXT: br label [[WHILE_BODY]] // void W2() { while (1) @@ -210,16 +174,14 @@ void W2() { ; } -// CXX98-NOT: mustprogress -// CXX11-NOT: mustprogress -// FINITE-NOT: mustprogress +// CHECK: Function Attrs: noinline nounwind optnone // CHECK-LABEL: @_Z2d1v( // CHECK-NEXT: entry: -// CHECK-NEXT: br label %do.body +// CHECK-NEXT: br label [[DO_BODY:%.*]] // CHECK: do.body: -// CHECK-NEXT: br label %do.cond +// CHECK-NEXT: br label [[DO_COND:%.*]] // CHECK: do.cond: -// CHECK-NOT: br {{.*}}, !llvm.loop +// CHECK-NEXT: br i1 true, label [[DO_BODY]], label [[DO_END:%.*]] // CHECK: do.end: // CHECK-NEXT: ret void // @@ -229,21 +191,17 @@ void d1() { while (1); } -// CXX98-NOT: mustprogress -// CXX11: mustprogress -// FINITE-NOT: mustprogress +// CHECK: Function Attrs: noinline nounwind optnone mustprogress // CHECK-LABEL: @_Z2d2v( // CHECK-NEXT: entry: -// CHECK-NEXT: br label %do.body +// CHECK-NEXT: br label [[DO_BODY:%.*]] // CHECK: do.body: -// CHECK-NEXT: br label %do.cond +// CHECK-NEXT: br label [[DO_COND:%.*]] // CHECK: do.cond: // CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* @a, align 4 // CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* @b, align 4 // CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]] -// CXX98-NOT: br {{.*}}, !llvm.loop -// CXX11-NEXT: br i1 [[CMP]], label %do.body, label %do.end, !llvm.loop [[LOOP6:!.*]] -// FINITE-NEXT: br i1 [[CMP]], label %do.body, label %do.end, !llvm.loop [[LOOP6:!.*]] +// CHECK-NEXT: br i1 [[CMP]], label [[DO_BODY]], label [[DO_END:%.*]], [[LOOP8:!llvm.loop !.*]] // CHECK: do.end: // CHECK-NEXT: ret void // @@ -253,27 +211,23 @@ void d2() { while (a == b); } -// CXX98-NOT: mustprogress -// CXX11-NOT: mustprogress -// FINITE-NOT: mustprogress +// CHECK: Function Attrs: noinline nounwind optnone // CHECK-LABEL: @_Z1Dv( // CHECK-NEXT: entry: -// CHECK-NEXT: br label %do.body +// CHECK-NEXT: br label [[DO_BODY:%.*]] // CHECK: do.body: -// CHECK-NEXT: br label %do.cond +// CHECK-NEXT: br label [[DO_COND:%.*]] // CHECK: do.cond: -// CHECK-NOT: br {{.*}}, !llvm.loop +// CHECK-NEXT: br i1 true, label [[DO_BODY]], label [[DO_END:%.*]] // CHECK: do.end: -// CHECK-NEXT: br label %do.body1 +// CHECK-NEXT: br label [[DO_BODY1:%.*]] // CHECK: do.body1: -// CHECK-NEXT: br label %do.cond2 +// CHECK-NEXT: br label [[DO_COND2:%.*]] // CHECK: do.cond2: // CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* @a, align 4 // CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* @b, align 4 // CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]] -// CXX98-NOT: br {{.*}}, !llvm.loop -// CXX11-NEXT: br i1 [[CMP]], label %do.body1, label %do.end3, !llvm.loop [[LOOP7:!.*]] -// FINITE-NEXT: br i1 [[CMP]], label %do.body1, label %do.end3, !llvm.loop [[LOOP7:!.*]] +// CHECK-NEXT: br i1 [[CMP]], label [[DO_BODY1]], label [[DO_END3:%.*]], [[LOOP9:!llvm.loop !.*]] // CHECK: do.end3: // CHECK-NEXT: ret void // @@ -286,27 +240,23 @@ void D() { while (a == b); } -// CXX98-NOT: mustprogress -// CXX11-NOT: mustprogress -// FINITE-NOT: mustprogress +// CHECK: Function Attrs: noinline nounwind optnone // CHECK-LABEL: @_Z2D2v( // CHECK-NEXT: entry: -// CHECK-NEXT: br label %do.body +// CHECK-NEXT: br label [[DO_BODY:%.*]] // CHECK: do.body: -// CHECK-NEXT: br label %do.cond +// CHECK-NEXT: br label [[DO_COND:%.*]] // CHECK: do.cond: // CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* @a, align 4 // CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* @b, align 4 // CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]] -// CXX98-NOT: br {{.*}}, !llvm.loop -// CXX11-NEXT: br i1 [[CMP]], label %do.body, label %do.end, !llvm.loop [[LOOP8:!.*]] -// FINITE-NEXT: br i1 [[CMP]], label %do.body, label %do.end, !llvm.loop [[LOOP8:!.*]] +// CHECK-NEXT: br i1 [[CMP]], label [[DO_BODY]], label [[DO_END:%.*]], [[LOOP10:!llvm.loop !.*]] // CHECK: do.end: -// CHECK-NEXT: br label %do.body1 +// CHECK-NEXT: br label [[DO_BODY1:%.*]] // CHECK: do.body1: -// CHECK-NEXT: br label %do.cond2 +// CHECK-NEXT: br label [[DO_COND2:%.*]] // CHECK: do.cond2: -// CHECK-NOT: br {{.*}}, !llvm.loop +// CHECK-NEXT: br i1 true, label [[DO_BODY1]], label [[DO_END3:%.*]] // CHECK: do.end3: // CHECK-NEXT: ret void // @@ -319,12 +269,3 @@ void D2() { while (1); } -// CXX11: [[LOOP1]] = distinct !{[[LOOP1]], [[MP:!.*]]} -// CXX11: [[MP]] = !{!"llvm.loop.mustprogress"} -// CXX11: [[LOOP2]] = distinct !{[[LOOP2]], [[MP]]} -// CXX11: [[LOOP3]] = distinct !{[[LOOP3]], [[MP]]} -// CXX11: [[LOOP4]] = distinct !{[[LOOP4]], [[MP]]} -// CXX11: [[LOOP5]] = distinct !{[[LOOP5]], [[MP]]} -// CXX11: [[LOOP6]] = distinct !{[[LOOP6]], [[MP]]} -// CXX11: [[LOOP7]] = distinct !{[[LOOP7]], [[MP]]} -// CXX11: [[LOOP8]] = distinct !{[[LOOP8]], [[MP]]} diff --git a/clang/test/CodeGen/builtins-bpf-preserve-field-info-4.c b/clang/test/CodeGen/builtins-bpf-preserve-field-info-4.c index b167b776e385..e07c680bb370 100644 --- a/clang/test/CodeGen/builtins-bpf-preserve-field-info-4.c +++ b/clang/test/CodeGen/builtins-bpf-preserve-field-info-4.c @@ -4,11 +4,10 @@ #define _(x, y) (__builtin_preserve_enum_value((x), (y))) enum AA { - VAL0 = 0, VAL1 = 2, VAL2 = 0xffffffff80000000UL, }; -typedef enum { VAL00, VAL10 = -2, VAL11 = 0xffff8000, } __BB; +typedef enum { VAL10 = -2, VAL11 = 0xffff8000, } __BB; unsigned unit1() { return _(*(enum AA *)VAL1, 0) + _(*(__BB *)VAL10, 1); @@ -18,16 +17,10 @@ unsigned unit2() { return _(*(enum AA *)VAL2, 0) + _(*(__BB *)VAL11, 1); } -unsigned unit3() { - return _(*(enum AA *)VAL0, 0) + _(*(__BB *)VAL00, 1); -} - // CHECK: @0 = private unnamed_addr constant [7 x i8] c"VAL1:2\00", align 1 // CHECK: @1 = private unnamed_addr constant [9 x i8] c"VAL10:-2\00", align 1 // CHECK: @2 = private unnamed_addr constant [17 x i8] c"VAL2:-2147483648\00", align 1 // CHECK: @3 = private unnamed_addr constant [17 x i8] c"VAL11:4294934528\00", align 1 -// CHECK: @4 = private unnamed_addr constant [7 x i8] c"VAL0:0\00", align 1 -// CHECK: @5 = private unnamed_addr constant [8 x i8] c"VAL00:0\00", align 1 // CHECK: call i64 @llvm.bpf.preserve.enum.value(i32 0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @0, i32 0, i32 0), i64 0), !dbg !{{[0-9]+}}, !llvm.preserve.access.index ![[ENUM_AA:[0-9]+]] // CHECK: call i64 @llvm.bpf.preserve.enum.value(i32 1, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @1, i32 0, i32 0), i64 1), !dbg !{{[0-9]+}}, !llvm.preserve.access.index ![[TYPEDEF_ENUM:[0-9]+]] @@ -35,8 +28,5 @@ unsigned unit3() { // CHECK: call i64 @llvm.bpf.preserve.enum.value(i32 2, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @2, i32 0, i32 0), i64 0), !dbg !{{[0-9]+}}, !llvm.preserve.access.index ![[ENUM_AA]] // CHECK: call i64 @llvm.bpf.preserve.enum.value(i32 3, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @3, i32 0, i32 0), i64 1), !dbg !{{[0-9]+}}, !llvm.preserve.access.index ![[TYPEDEF_ENUM]] -// CHECK: call i64 @llvm.bpf.preserve.enum.value(i32 4, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @4, i32 0, i32 0), i64 0), !dbg !{{[0-9]+}}, !llvm.preserve.access.index ![[ENUM_AA]] -// CHECK: call i64 @llvm.bpf.preserve.enum.value(i32 5, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @5, i32 0, i32 0), i64 1), !dbg !{{[0-9]+}}, !llvm.preserve.access.index ![[TYPEDEF_ENUM]] - // CHECK: ![[ENUM_AA]] = !DICompositeType(tag: DW_TAG_enumeration_type, name: "AA" // CHECK: ![[TYPEDEF_ENUM]] = !DIDerivedType(tag: DW_TAG_typedef, name: "__BB" diff --git a/clang/test/CodeGen/builtins-ppc-fpconstrained.c b/clang/test/CodeGen/builtins-ppc-fpconstrained.c index 909210996064..880c0c339ef3 100644 --- a/clang/test/CodeGen/builtins-ppc-fpconstrained.c +++ b/clang/test/CodeGen/builtins-ppc-fpconstrained.c @@ -11,9 +11,6 @@ // RUN: -fallow-half-arguments-and-returns -S -ffp-exception-behavior=strict \ // RUN: -o - %s | FileCheck --check-prefix=CHECK-ASM \ // RUN: --check-prefix=FIXME-CHECK %s -// RUN: %clang_cc1 -triple powerpcspe -S -ffp-exception-behavior=strict \ -// RUN: -target-feature +spe -fexperimental-strict-floating-point -emit-llvm \ -// RUN: %s -o - | FileCheck --check-prefix=CHECK-CONSTRAINED %s typedef __attribute__((vector_size(4 * sizeof(float)))) float vec_float; typedef __attribute__((vector_size(2 * sizeof(double)))) double vec_double; diff --git a/clang/test/CodeGen/complex-builtins.c b/clang/test/CodeGen/complex-builtins.c index 6fea8a9f028c..96c0e7117016 100644 --- a/clang/test/CodeGen/complex-builtins.c +++ b/clang/test/CodeGen/complex-builtins.c @@ -133,7 +133,7 @@ void foo(float f) { // NO__ERRNO: declare { x86_fp80, x86_fp80 } @cprojl({ x86_fp80, x86_fp80 }* byval({ x86_fp80, x86_fp80 }) align 16) [[NOT_READNONE]] // HAS_ERRNO: declare { double, double } @cproj(double, double) [[READNONE:#[0-9]+]] // HAS_ERRNO: declare <2 x float> @cprojf(<2 x float>) [[READNONE]] -// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @cprojl({ x86_fp80, x86_fp80 }* byval({ x86_fp80, x86_fp80 }) align 16) [[WILLRETURN_NOT_READNONE:#[0-9]+]] +// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @cprojl({ x86_fp80, x86_fp80 }* byval({ x86_fp80, x86_fp80 }) align 16) [[NOT_READNONE]] __builtin_cpow(f,f); __builtin_cpowf(f,f); __builtin_cpowl(f,f); @@ -202,4 +202,3 @@ void foo(float f) { // HAS_ERRNO: attributes [[NOT_READNONE]] = { nounwind {{.*}} } // HAS_ERRNO: attributes [[READNONE]] = { {{.*}}readnone{{.*}} } -// HAS_ERRNO: attributes [[WILLRETURN_NOT_READNONE]] = { nounwind willreturn {{.*}} } diff --git a/clang/test/CodeGen/complex-libcalls.c b/clang/test/CodeGen/complex-libcalls.c index 44d6849c0a71..9bd419a83821 100644 --- a/clang/test/CodeGen/complex-libcalls.c +++ b/clang/test/CodeGen/complex-libcalls.c @@ -133,7 +133,7 @@ void foo(float f) { // NO__ERRNO: declare { x86_fp80, x86_fp80 } @cprojl({ x86_fp80, x86_fp80 }* byval({ x86_fp80, x86_fp80 }) align 16) [[NOT_READNONE]] // HAS_ERRNO: declare { double, double } @cproj(double, double) [[READNONE:#[0-9]+]] // HAS_ERRNO: declare <2 x float> @cprojf(<2 x float>) [[READNONE]] -// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @cprojl({ x86_fp80, x86_fp80 }* byval({ x86_fp80, x86_fp80 }) align 16) [[WILLRETURN_NOT_READNONE:#[0-9]+]] +// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @cprojl({ x86_fp80, x86_fp80 }* byval({ x86_fp80, x86_fp80 }) align 16) [[NOT_READNONE]] cpow(f,f); cpowf(f,f); cpowl(f,f); @@ -202,4 +202,3 @@ void foo(float f) { // HAS_ERRNO: attributes [[NOT_READNONE]] = { nounwind {{.*}} } // HAS_ERRNO: attributes [[READNONE]] = { {{.*}}readnone{{.*}} } -// HAS_ERRNO: attributes [[WILLRETURN_NOT_READNONE]] = { nounwind willreturn {{.*}} } diff --git a/clang/test/CodeGen/enable_if.c b/clang/test/CodeGen/enable_if.c index 327a201cdeba..14550b9e2db9 100644 --- a/clang/test/CodeGen/enable_if.c +++ b/clang/test/CodeGen/enable_if.c @@ -31,22 +31,22 @@ void bar(int m) __attribute__((overloadable, enable_if(m > 0, ""))); void bar(int m) __attribute__((overloadable, enable_if(1, ""))); // CHECK-LABEL: define{{.*}} void @test2 void test2() { - // CHECK: store void (i32)* @_Z3barUa9enable_ifILi1EEi + // CHECK: store void (i32)* @_Z3barUa9enable_ifIXLi1EEEi void (*p)(int) = bar; - // CHECK: store void (i32)* @_Z3barUa9enable_ifILi1EEi + // CHECK: store void (i32)* @_Z3barUa9enable_ifIXLi1EEEi void (*p2)(int) = &bar; - // CHECK: store void (i32)* @_Z3barUa9enable_ifILi1EEi + // CHECK: store void (i32)* @_Z3barUa9enable_ifIXLi1EEEi p = bar; - // CHECK: store void (i32)* @_Z3barUa9enable_ifILi1EEi + // CHECK: store void (i32)* @_Z3barUa9enable_ifIXLi1EEEi p = &bar; - // CHECK: store i8* bitcast (void (i32)* @_Z3barUa9enable_ifILi1EEi to i8*) + // CHECK: store i8* bitcast (void (i32)* @_Z3barUa9enable_ifIXLi1EEEi to i8*) void *vp1 = (void*)&bar; - // CHECK: store i8* bitcast (void (i32)* @_Z3barUa9enable_ifILi1EEi to i8*) + // CHECK: store i8* bitcast (void (i32)* @_Z3barUa9enable_ifIXLi1EEEi to i8*) void *vp2 = (void*)bar; - // CHECK: store i8* bitcast (void (i32)* @_Z3barUa9enable_ifILi1EEi to i8*) + // CHECK: store i8* bitcast (void (i32)* @_Z3barUa9enable_ifIXLi1EEEi to i8*) vp1 = (void*)&bar; - // CHECK: store i8* bitcast (void (i32)* @_Z3barUa9enable_ifILi1EEi to i8*) + // CHECK: store i8* bitcast (void (i32)* @_Z3barUa9enable_ifIXLi1EEEi to i8*) vp1 = (void*)bar; } @@ -54,13 +54,13 @@ void baz(int m) __attribute__((overloadable, enable_if(1, ""))); void baz(int m) __attribute__((overloadable)); // CHECK-LABEL: define{{.*}} void @test3 void test3() { - // CHECK: store void (i32)* @_Z3bazUa9enable_ifILi1EEi + // CHECK: store void (i32)* @_Z3bazUa9enable_ifIXLi1EEEi void (*p)(int) = baz; - // CHECK: store void (i32)* @_Z3bazUa9enable_ifILi1EEi + // CHECK: store void (i32)* @_Z3bazUa9enable_ifIXLi1EEEi void (*p2)(int) = &baz; - // CHECK: store void (i32)* @_Z3bazUa9enable_ifILi1EEi + // CHECK: store void (i32)* @_Z3bazUa9enable_ifIXLi1EEEi p = baz; - // CHECK: store void (i32)* @_Z3bazUa9enable_ifILi1EEi + // CHECK: store void (i32)* @_Z3bazUa9enable_ifIXLi1EEEi p = &baz; } @@ -71,13 +71,13 @@ void qux(int m) __attribute__((overloadable, enable_if(1, ""), void qux(int m) __attribute__((overloadable, enable_if(1, ""))); // CHECK-LABEL: define{{.*}} void @test4 void test4() { - // CHECK: store void (i32)* @_Z3quxUa9enable_ifILi1ELi1EEi + // CHECK: store void (i32)* @_Z3quxUa9enable_ifIXLi1EEXLi1EEEi void (*p)(int) = qux; - // CHECK: store void (i32)* @_Z3quxUa9enable_ifILi1ELi1EEi + // CHECK: store void (i32)* @_Z3quxUa9enable_ifIXLi1EEXLi1EEEi void (*p2)(int) = &qux; - // CHECK: store void (i32)* @_Z3quxUa9enable_ifILi1ELi1EEi + // CHECK: store void (i32)* @_Z3quxUa9enable_ifIXLi1EEXLi1EEEi p = qux; - // CHECK: store void (i32)* @_Z3quxUa9enable_ifILi1ELi1EEi + // CHECK: store void (i32)* @_Z3quxUa9enable_ifIXLi1EEXLi1EEEi p = &qux; } @@ -90,6 +90,6 @@ void test5() { int foo(char *i __attribute__((pass_object_size(0)))) __attribute__((enable_if(1, ""), overloadable)); - // CHECK: call i32 @_Z3fooUa9enable_ifILi1EEPcU17pass_object_size0 + // CHECK: call i32 @_Z3fooUa9enable_ifIXLi1EEEPcU17pass_object_size0 foo((void*)0); } diff --git a/clang/test/CodeGen/function-attributes.c b/clang/test/CodeGen/function-attributes.c index f14f24801006..ffb86a6cd272 100644 --- a/clang/test/CodeGen/function-attributes.c +++ b/clang/test/CodeGen/function-attributes.c @@ -115,5 +115,5 @@ void f20(void) { // CHECK: attributes [[SR]] = { nounwind optsize{{.*}} "stackrealign"{{.*}} } // CHECK: attributes [[RT]] = { nounwind optsize returns_twice{{.*}} } // CHECK: attributes [[NR]] = { noreturn optsize } -// CHECK: attributes [[NUW_RN]] = { nounwind optsize readnone willreturn } +// CHECK: attributes [[NUW_RN]] = { nounwind optsize readnone } // CHECK: attributes [[RT_CALL]] = { optsize returns_twice } diff --git a/clang/test/CodeGen/math-builtins.c b/clang/test/CodeGen/math-builtins.c index 7f595e3b0b67..ac2a7595e1c9 100644 --- a/clang/test/CodeGen/math-builtins.c +++ b/clang/test/CodeGen/math-builtins.c @@ -2,7 +2,6 @@ // RUN: %clang_cc1 -triple x86_64-unknown-unknown -w -S -o - -emit-llvm -fmath-errno %s | FileCheck %s -check-prefix=HAS_ERRNO // RUN: %clang_cc1 -triple x86_64-unknown-unknown-gnu -w -S -o - -emit-llvm -fmath-errno %s | FileCheck %s --check-prefix=HAS_ERRNO_GNU // RUN: %clang_cc1 -triple x86_64-unknown-unknown-android -w -S -o - -emit-llvm -fmath-errno %s | FileCheck %s --check-prefix=HAS_ERRNO_ANDROID -// RUN: %clang_cc1 -triple x86_64-unknown-unknown-ohos -w -S -o - -emit-llvm -fmath-errno %s | FileCheck %s --check-prefix=HAS_ERRNO_ANDROID // RUN: %clang_cc1 -triple x86_64-unknown-windows-msvc -w -S -o - -emit-llvm -fmath-errno %s | FileCheck %s --check-prefix=HAS_ERRNO_WIN // Test attributes and codegen of math builtins. diff --git a/clang/test/CodeGen/matrix-type-builtins.c b/clang/test/CodeGen/matrix-type-builtins.c index ec0be85b7151..67f5c7819687 100644 --- a/clang/test/CodeGen/matrix-type-builtins.c +++ b/clang/test/CodeGen/matrix-type-builtins.c @@ -1,5 +1,4 @@ -// RUN: %clang_cc1 -fenable-matrix -triple x86_64-apple-darwin %s -emit-llvm -disable-llvm-passes -o - | FileCheck --check-prefixes=COMMON,CHECK64 %s -// RUN: %clang_cc1 -fenable-matrix -triple i386-apple-darwin %s -emit-llvm -disable-llvm-passes -o - | FileCheck --check-prefixes=COMMON,CHECK32 %s +// RUN: %clang_cc1 -fenable-matrix -triple x86_64-apple-darwin %s -emit-llvm -disable-llvm-passes -o - | FileCheck %s // Also check we do not crash when running some middle-end passes. Most // importantly this includes the IR verifier, to ensure we emit valid IR. @@ -16,33 +15,30 @@ typedef unsigned ux1x6_t __attribute__((matrix_type(1, 6))); typedef unsigned ux6x1_t __attribute__((matrix_type(6, 1))); void transpose_double_5x5(dx5x5_t *a) { - // COMMON-LABEL: define{{.*}} void @transpose_double_5x5( - // CHECK32: [[A:%.*]] = load <25 x double>, <25 x double>* {{.*}}, align 4 - // CHECK64: [[A:%.*]] = load <25 x double>, <25 x double>* {{.*}}, align 8 - // COMMON-NEXT: [[TRANS:%.*]] = call <25 x double> @llvm.matrix.transpose.v25f64(<25 x double> [[A]], i32 5, i32 5) - // COMMON-NEXT: [[AT_ADDR:%.*]] = bitcast [25 x double]* %a_t to <25 x double>* - // CHECK32-NEXT: store <25 x double> [[TRANS]], <25 x double>* [[AT_ADDR]], align 4 - // CHECK64-NEXT: store <25 x double> [[TRANS]], <25 x double>* [[AT_ADDR]], align 8 - + // CHECK-LABEL: define{{.*}} void @transpose_double_5x5( + // CHECK: [[A:%.*]] = load <25 x double>, <25 x double>* {{.*}}, align 8 + // CHECK-NEXT: [[TRANS:%.*]] = call <25 x double> @llvm.matrix.transpose.v25f64(<25 x double> [[A]], i32 5, i32 5) + // CHECK-NEXT: [[AT_ADDR:%.*]] = bitcast [25 x double]* %a_t to <25 x double>* + // CHECK-NEXT: store <25 x double> [[TRANS]], <25 x double>* [[AT_ADDR]], align 8 dx5x5_t a_t = __builtin_matrix_transpose(*a); } void transpose_float_3x2(fx3x2_t *a) { - // COMMON-LABEL: define{{.*}} void @transpose_float_3x2( - // COMMON: [[A:%.*]] = load <6 x float>, <6 x float>* {{.*}}, align 4 - // COMMON-NEXT: [[TRANS:%.*]] = call <6 x float> @llvm.matrix.transpose.v6f32(<6 x float> [[A]], i32 3, i32 2) - // COMMON-NEXT: [[AT_ADDR:%.*]] = bitcast [6 x float]* %a_t to <6 x float>* - // COMMON-NEXT: store <6 x float> [[TRANS]], <6 x float>* [[AT_ADDR]], align 4 + // CHECK-LABEL: define{{.*}} void @transpose_float_3x2( + // CHECK: [[A:%.*]] = load <6 x float>, <6 x float>* {{.*}}, align 4 + // CHECK-NEXT: [[TRANS:%.*]] = call <6 x float> @llvm.matrix.transpose.v6f32(<6 x float> [[A]], i32 3, i32 2) + // CHECK-NEXT: [[AT_ADDR:%.*]] = bitcast [6 x float]* %a_t to <6 x float>* + // CHECK-NEXT: store <6 x float> [[TRANS]], <6 x float>* [[AT_ADDR]], align 4 fx2x3_t a_t = __builtin_matrix_transpose(*a); } void transpose_int_20x4(ix20x4_t *a) { - // COMMON-LABEL: define{{.*}} void @transpose_int_20x4( - // COMMON: [[A:%.*]] = load <80 x i32>, <80 x i32>* {{.*}}, align 4 - // COMMON-NEXT: [[TRANS:%.*]] = call <80 x i32> @llvm.matrix.transpose.v80i32(<80 x i32> [[A]], i32 20, i32 4) - // COMMON-NEXT: [[AT_ADDR:%.*]] = bitcast [80 x i32]* %a_t to <80 x i32>* - // COMMON-NEXT: store <80 x i32> [[TRANS]], <80 x i32>* [[AT_ADDR]], align 4 + // CHECK-LABEL: define{{.*}} void @transpose_int_20x4( + // CHECK: [[A:%.*]] = load <80 x i32>, <80 x i32>* {{.*}}, align 4 + // CHECK-NEXT: [[TRANS:%.*]] = call <80 x i32> @llvm.matrix.transpose.v80i32(<80 x i32> [[A]], i32 20, i32 4) + // CHECK-NEXT: [[AT_ADDR:%.*]] = bitcast [80 x i32]* %a_t to <80 x i32>* + // CHECK-NEXT: store <80 x i32> [[TRANS]], <80 x i32>* [[AT_ADDR]], align 4 ix4x20_t a_t = __builtin_matrix_transpose(*a); } @@ -53,28 +49,26 @@ struct Foo { }; void transpose_struct_member(struct Foo *F) { - // COMMON-LABEL: define{{.*}} void @transpose_struct_member( - // COMMON: [[M:%.*]] = load <6 x i32>, <6 x i32>* {{.*}}, align 4 - // COMMON-NEXT: [[M_T:%.*]] = call <6 x i32> @llvm.matrix.transpose.v6i32(<6 x i32> [[M]], i32 1, i32 6) - // CHECK32-NEXT: [[F_ADDR:%.*]] = load %struct.Foo*, %struct.Foo** %F.addr, align 4 - // CHECK64-NEXT: [[F_ADDR:%.*]] = load %struct.Foo*, %struct.Foo** %F.addr, align 8 - // COMMON-NEXT: [[OUT_PTR:%.*]] = getelementptr inbounds %struct.Foo, %struct.Foo* [[F_ADDR]], i32 0, i32 1 - // COMMON-NEXT: [[OUT_PTR_C:%.*]] = bitcast [6 x i32]* [[OUT_PTR]] to <6 x i32>* - // COMMON-NEXT: store <6 x i32> [[M_T]], <6 x i32>* [[OUT_PTR_C]], align 4 + // CHECK-LABEL: define{{.*}} void @transpose_struct_member( + // CHECK: [[M:%.*]] = load <6 x i32>, <6 x i32>* {{.*}}, align 4 + // CHECK-NEXT: [[M_T:%.*]] = call <6 x i32> @llvm.matrix.transpose.v6i32(<6 x i32> [[M]], i32 1, i32 6) + // CHECK-NEXT: [[F_ADDR:%.*]] = load %struct.Foo*, %struct.Foo** %F.addr, align 8 + // CHECK-NEXT: [[OUT_PTR:%.*]] = getelementptr inbounds %struct.Foo, %struct.Foo* [[F_ADDR]], i32 0, i32 1 + // CHECK-NEXT: [[OUT_PTR_C:%.*]] = bitcast [6 x i32]* [[OUT_PTR]] to <6 x i32>* + // CHECK-NEXT: store <6 x i32> [[M_T]], <6 x i32>* [[OUT_PTR_C]], align 4 F->out = __builtin_matrix_transpose(F->in); } void transpose_transpose_struct_member(struct Foo *F) { - // COMMON-LABEL: define{{.*}} void @transpose_transpose_struct_member( - // COMMON: [[M:%.*]] = load <6 x i32>, <6 x i32>* {{.*}}, align 4 - // COMMON-NEXT: [[M_T:%.*]] = call <6 x i32> @llvm.matrix.transpose.v6i32(<6 x i32> [[M]], i32 1, i32 6) - // COMMON-NEXT: [[M_T2:%.*]] = call <6 x i32> @llvm.matrix.transpose.v6i32(<6 x i32> [[M_T]], i32 6, i32 1) - // CHECK32-NEXT: [[F_ADDR:%.*]] = load %struct.Foo*, %struct.Foo** %F.addr, align 4 - // CHECK64-NEXT: [[F_ADDR:%.*]] = load %struct.Foo*, %struct.Foo** %F.addr, align 8 - // COMMON-NEXT: [[IN_PTR:%.*]] = getelementptr inbounds %struct.Foo, %struct.Foo* [[F_ADDR]], i32 0, i32 0 - // COMMON-NEXT: [[IN_PTR_C:%.*]] = bitcast [6 x i32]* [[IN_PTR]] to <6 x i32>* - // COMMON-NEXT: store <6 x i32> [[M_T2]], <6 x i32>* [[IN_PTR_C]], align 4 + // CHECK-LABEL: define{{.*}} void @transpose_transpose_struct_member( + // CHECK: [[M:%.*]] = load <6 x i32>, <6 x i32>* {{.*}}, align 4 + // CHECK-NEXT: [[M_T:%.*]] = call <6 x i32> @llvm.matrix.transpose.v6i32(<6 x i32> [[M]], i32 1, i32 6) + // CHECK-NEXT: [[M_T2:%.*]] = call <6 x i32> @llvm.matrix.transpose.v6i32(<6 x i32> [[M_T]], i32 6, i32 1) + // CHECK-NEXT: [[F_ADDR:%.*]] = load %struct.Foo*, %struct.Foo** %F.addr, align 8 + // CHECK-NEXT: [[IN_PTR:%.*]] = getelementptr inbounds %struct.Foo, %struct.Foo* [[F_ADDR]], i32 0, i32 0 + // CHECK-NEXT: [[IN_PTR_C:%.*]] = bitcast [6 x i32]* [[IN_PTR]] to <6 x i32>* + // CHECK-NEXT: store <6 x i32> [[M_T2]], <6 x i32>* [[IN_PTR_C]], align 4 F->in = __builtin_matrix_transpose(__builtin_matrix_transpose(F->in)); } @@ -82,16 +76,13 @@ void transpose_transpose_struct_member(struct Foo *F) { dx5x5_t get_matrix(); void transpose_rvalue() { - // COMMON-LABEL: define{{.*}} void @transpose_rvalue() - // COMMON-NEXT: entry: - // CHECK32-NEXT: [[M_T_ADDR:%.*]] = alloca [25 x double], align 4 - // CHECK64-NEXT: [[M_T_ADDR:%.*]] = alloca [25 x double], align 8 - // CHECK32-NEXT: [[CALL:%.*]] = call <25 x double> bitcast (<25 x double> (...)* @get_matrix to <25 x double> ()*)() - // CHECK64-NEXT: [[CALL:%.*]] = call <25 x double> (...) @get_matrix() - // COMMON-NEXT: [[M_T:%.*]] = call <25 x double> @llvm.matrix.transpose.v25f64(<25 x double> [[CALL]], i32 5, i32 5) - // COMMON-NEXT: [[M_T_ADDR_C:%.*]] = bitcast [25 x double]* [[M_T_ADDR]] to <25 x double>* - // CHECK32-NEXT: store <25 x double> [[M_T]], <25 x double>* [[M_T_ADDR_C]], align 4 - // CHECK64-NEXT: store <25 x double> [[M_T]], <25 x double>* [[M_T_ADDR_C]], align 8 + // CHECK-LABEL: define{{.*}} void @transpose_rvalue() + // CHECK-NEXT: entry: + // CHECK-NEXT: [[M_T_ADDR:%.*]] = alloca [25 x double], align 8 + // CHECK-NEXT: [[CALL:%.*]] = call <25 x double> (...) @get_matrix() + // CHECK-NEXT: [[M_T:%.*]] = call <25 x double> @llvm.matrix.transpose.v25f64(<25 x double> [[CALL]], i32 5, i32 5) + // CHECK-NEXT: [[M_T_ADDR_C:%.*]] = bitcast [25 x double]* [[M_T_ADDR]] to <25 x double>* + // CHECK-NEXT: store <25 x double> [[M_T]], <25 x double>* [[M_T_ADDR_C]], align 8 dx5x5_t m_t = __builtin_matrix_transpose(get_matrix()); } @@ -99,215 +90,162 @@ void transpose_rvalue() { const dx5x5_t global_matrix; void transpose_global() { - // COMMON-LABEL: define{{.*}} void @transpose_global() - // COMMON-NEXT: entry: - // CHECK32-NEXT: [[M_T_ADDR:%.*]] = alloca [25 x double], align 4 - // CHECK32-NEXT: [[GLOBAL_MATRIX:%.*]] = load <25 x double>, <25 x double>* bitcast ([25 x double]* @global_matrix to <25 x double>*), align 4 - // CHECK64-NEXT: [[M_T_ADDR:%.*]] = alloca [25 x double], align 8 - // CHECK64-NEXT: [[GLOBAL_MATRIX:%.*]] = load <25 x double>, <25 x double>* bitcast ([25 x double]* @global_matrix to <25 x double>*), align 8 - // COMMON-NEXT: [[M_T:%.*]] = call <25 x double> @llvm.matrix.transpose.v25f64(<25 x double> [[GLOBAL_MATRIX]], i32 5, i32 5) - // COMMON-NEXT: [[M_T_ADDR_C:%.*]] = bitcast [25 x double]* [[M_T_ADDR]] to <25 x double>* - // CHECK32-NEXT: store <25 x double> [[M_T]], <25 x double>* [[M_T_ADDR_C]], align 4 - // CHECK64-NEXT: store <25 x double> [[M_T]], <25 x double>* [[M_T_ADDR_C]], align 8 + // CHECK-LABEL: define{{.*}} void @transpose_global() + // CHECK-NEXT: entry: + // CHECK-NEXT: [[M_T_ADDR:%.*]] = alloca [25 x double], align 8 + // CHECK-NEXT: [[GLOBAL_MATRIX:%.*]] = load <25 x double>, <25 x double>* bitcast ([25 x double]* @global_matrix to <25 x double>*), align 8 + // CHECK-NEXT: [[M_T:%.*]] = call <25 x double> @llvm.matrix.transpose.v25f64(<25 x double> [[GLOBAL_MATRIX]], i32 5, i32 5) + // CHECK-NEXT: [[M_T_ADDR_C:%.*]] = bitcast [25 x double]* [[M_T_ADDR]] to <25 x double>* + // CHECK-NEXT: store <25 x double> [[M_T]], <25 x double>* [[M_T_ADDR_C]], align 8 dx5x5_t m_t = __builtin_matrix_transpose(global_matrix); } void column_major_load_with_const_stride_double(double *Ptr) { - // COMMON-LABEL: define{{.*}} void @column_major_load_with_const_stride_double(double* %Ptr) - // CHECK32: [[PTR:%.*]] = load double*, double** %Ptr.addr, align 4 - // CHECK32-NEXT: call <25 x double> @llvm.matrix.column.major.load.v25f64.i32(double* align 4 [[PTR]], i32 5, i1 false, i32 5, i32 5) - // CHECK64: [[PTR:%.*]] = load double*, double** %Ptr.addr, align 8 - // CHECK64-NEXT: call <25 x double> @llvm.matrix.column.major.load.v25f64.i64(double* align 8 [[PTR]], i64 5, i1 false, i32 5, i32 5) + // CHECK-LABEL: define{{.*}} void @column_major_load_with_const_stride_double(double* %Ptr) + // CHECK: [[PTR:%.*]] = load double*, double** %Ptr.addr, align 8 + // CHECK-NEXT: call <25 x double> @llvm.matrix.column.major.load.v25f64(double* align 8 [[PTR]], i64 5, i1 false, i32 5, i32 5) dx5x5_t m_a1 = __builtin_matrix_column_major_load(Ptr, 5, 5, 5); } void column_major_load_with_const_stride2_double(double *Ptr) { - // COMMON-LABEL: define{{.*}} void @column_major_load_with_const_stride2_double(double* %Ptr) - // CHECK32: [[PTR:%.*]] = load double*, double** %Ptr.addr, align 4 - // CHECK32-NEXT: call <25 x double> @llvm.matrix.column.major.load.v25f64.i32(double* align 4 [[PTR]], i32 15, i1 false, i32 5, i32 5) - // CHECK64: [[PTR:%.*]] = load double*, double** %Ptr.addr, align 8 - // CHECK64-NEXT: call <25 x double> @llvm.matrix.column.major.load.v25f64.i64(double* align 8 [[PTR]], i64 15, i1 false, i32 5, i32 5) + // CHECK-LABEL: define{{.*}} void @column_major_load_with_const_stride2_double(double* %Ptr) + // CHECK: [[PTR:%.*]] = load double*, double** %Ptr.addr, align 8 + // CHECK-NEXT: call <25 x double> @llvm.matrix.column.major.load.v25f64(double* align 8 [[PTR]], i64 15, i1 false, i32 5, i32 5) dx5x5_t m_a2 = __builtin_matrix_column_major_load(Ptr, 5, 5, 2 * 3 + 9); } void column_major_load_with_variable_stride_ull_float(float *Ptr, unsigned long long S) { - // COMMON-LABEL: define{{.*}} void @column_major_load_with_variable_stride_ull_float(float* %Ptr, i64 %S) - // CHECK32: [[S:%.*]] = load i64, i64* %S.addr, align 8 - // CHECK32-NEXT: [[STRIDE_TRUNC:%.*]] = trunc i64 [[S]] to i32 - // CHECK32-NEXT: [[PTR:%.*]] = load float*, float** %Ptr.addr, align 4 - // CHECK32-NEXT: call <6 x float> @llvm.matrix.column.major.load.v6f32.i32(float* align 4 [[PTR]], i32 [[STRIDE_TRUNC]], i1 false, i32 2, i32 3) - - // CHECK64: [[S:%.*]] = load i64, i64* %S.addr, align 8 - // CHECK64-NEXT: [[PTR:%.*]] = load float*, float** %Ptr.addr, align 8 - // CHECK64-NEXT: call <6 x float> @llvm.matrix.column.major.load.v6f32.i64(float* align 4 [[PTR]], i64 [[S]], i1 false, i32 2, i32 3) + // CHECK-LABEL: define{{.*}} void @column_major_load_with_variable_stride_ull_float(float* %Ptr, i64 %S) + // CHECK: [[S:%.*]] = load i64, i64* %S.addr, align 8 + // CHECK-NEXT: [[PTR:%.*]] = load float*, float** %Ptr.addr, align 8 + // CHECK-NEXT: call <6 x float> @llvm.matrix.column.major.load.v6f32(float* align 4 [[PTR]], i64 [[S]], i1 false, i32 2, i32 3) fx2x3_t m_b = __builtin_matrix_column_major_load(Ptr, 2, 3, S); } void column_major_load_with_stride_math_int(int *Ptr, int S) { - // COMMON-LABEL: define{{.*}} void @column_major_load_with_stride_math_int(i32* %Ptr, i32 %S) - // COMMON: [[S:%.*]] = load i32, i32* %S.addr, align 4 - // COMMON-NEXT: [[STRIDE:%.*]] = add nsw i32 [[S]], 32 - // CHECK32-NEXT: [[PTR:%.*]] = load i32*, i32** %Ptr.addr, align 4 - // CHECK32-NEXT: call <80 x i32> @llvm.matrix.column.major.load.v80i32.i32(i32* align 4 [[PTR]], i32 [[STRIDE]], i1 false, i32 4, i32 20) - // - // CHECK64-NEXT: [[STRIDE_EXT:%.*]] = sext i32 [[STRIDE]] to i64 - // CHECK64-NEXT: [[PTR:%.*]] = load i32*, i32** %Ptr.addr, align 8 - // CHECK64-NEXT: call <80 x i32> @llvm.matrix.column.major.load.v80i32.i64(i32* align 4 [[PTR]], i64 [[STRIDE_EXT]], i1 false, i32 4, i32 20) + // CHECK-LABEL: define{{.*}} void @column_major_load_with_stride_math_int(i32* %Ptr, i32 %S) + // CHECK: [[S:%.*]] = load i32, i32* %S.addr, align 4 + // CHECK-NEXT: [[STRIDE:%.*]] = add nsw i32 [[S]], 32 + // CHECK-NEXT: [[STRIDE_EXT:%.*]] = sext i32 [[STRIDE]] to i64 + // CHECK-NEXT: [[PTR:%.*]] = load i32*, i32** %Ptr.addr, align 8 + // CHECK-NEXT: call <80 x i32> @llvm.matrix.column.major.load.v80i32(i32* align 4 [[PTR]], i64 [[STRIDE_EXT]], i1 false, i32 4, i32 20) ix4x20_t m_c = __builtin_matrix_column_major_load(Ptr, 4, 20, S + 32); } void column_major_load_with_stride_math_s_int(int *Ptr, short S) { - // COMMON-LABEL: define{{.*}} void @column_major_load_with_stride_math_s_int(i32* %Ptr, i16 signext %S) - // COMMON: [[S:%.*]] = load i16, i16* %S.addr, align 2 - // COMMON-NEXT: [[S_EXT:%.*]] = sext i16 [[S]] to i32 - // COMMON-NEXT: [[STRIDE:%.*]] = add nsw i32 [[S_EXT]], 32 - // CHECK32-NEXT: [[PTR:%.*]] = load i32*, i32** %Ptr.addr, align 4 - // CHECK32-NEXT: %matrix = call <80 x i32> @llvm.matrix.column.major.load.v80i32.i32(i32* align 4 [[PTR]], i32 [[STRIDE]], i1 false, i32 4, i32 20) - // - // CHECK64-NEXT: [[STRIDE_EXT:%.*]] = sext i32 [[STRIDE]] to i64 - // CHECK64-NEXT: [[PTR:%.*]] = load i32*, i32** %Ptr.addr, align 8 - // CHECK64-NEXT: %matrix = call <80 x i32> @llvm.matrix.column.major.load.v80i32.i64(i32* align 4 [[PTR]], i64 [[STRIDE_EXT]], i1 false, i32 4, i32 20) + // CHECK-LABEL: define{{.*}} void @column_major_load_with_stride_math_s_int(i32* %Ptr, i16 signext %S) + // CHECK: [[S:%.*]] = load i16, i16* %S.addr, align 2 + // CHECK-NEXT: [[S_EXT:%.*]] = sext i16 [[S]] to i32 + // CHECK-NEXT: [[STRIDE:%.*]] = add nsw i32 [[S_EXT]], 32 + // CHECK-NEXT: [[STRIDE_EXT:%.*]] = sext i32 [[STRIDE]] to i64 + // CHECK-NEXT: [[PTR:%.*]] = load i32*, i32** %Ptr.addr, align 8 + // CHECK-NEXT: %matrix = call <80 x i32> @llvm.matrix.column.major.load.v80i32(i32* align 4 [[PTR]], i64 [[STRIDE_EXT]], i1 false, i32 4, i32 20) ix4x20_t m_c = __builtin_matrix_column_major_load(Ptr, 4, 20, S + 32); } void column_major_load_array1(double Ptr[25]) { - // COMMON-LABEL: define{{.*}} void @column_major_load_array1(double* %Ptr) - // CHECK32: [[ADDR:%.*]] = load double*, double** %Ptr.addr, align 4 - // CHECK32-NEXT: call <25 x double> @llvm.matrix.column.major.load.v25f64.i32(double* align 4 [[ADDR]], i32 5, i1 false, i32 5, i32 5) - - // CHECK64: [[ADDR:%.*]] = load double*, double** %Ptr.addr, align 8 - // CHECK64-NEXT: call <25 x double> @llvm.matrix.column.major.load.v25f64.i64(double* align 8 [[ADDR]], i64 5, i1 false, i32 5, i32 5) + // CHECK-LABEL: define{{.*}} void @column_major_load_array1(double* %Ptr) + // CHECK: [[ADDR:%.*]] = load double*, double** %Ptr.addr, align 8 + // CHECK-NEXT: call <25 x double> @llvm.matrix.column.major.load.v25f64(double* align 8 [[ADDR]], i64 5, i1 false, i32 5, i32 5) dx5x5_t m = __builtin_matrix_column_major_load(Ptr, 5, 5, 5); } void column_major_load_array2() { - // COMMON-LABEL: define{{.*}} void @column_major_load_array2() #0 { - // COMMON-NEXT: entry: - // CHECK32-NEXT: [[PTR:%.*]] = alloca [25 x double], align 8 - // CHECK32: [[ARRAY_DEC:%.*]] = getelementptr inbounds [25 x double], [25 x double]* [[PTR]], i32 0, i32 0 - // CHECK32-NEXT: call <25 x double> @llvm.matrix.column.major.load.v25f64.i32(double* align 8 [[ARRAY_DEC]], i32 5, i1 false, i32 5, i32 5) - - // CHECK64-NEXT: [[PTR:%.*]] = alloca [25 x double], align 16 - // CHECK64: [[ARRAY_DEC:%.*]] = getelementptr inbounds [25 x double], [25 x double]* [[PTR]], i64 0, i64 0 - // CHECK64-NEXT: call <25 x double> @llvm.matrix.column.major.load.v25f64.i64(double* align 16 [[ARRAY_DEC]], i64 5, i1 false, i32 5, i32 5) + // CHECK-LABEL: define{{.*}} void @column_major_load_array2() #0 { + // CHECK-NEXT: entry: + // CHECK-NEXT: [[PTR:%.*]] = alloca [25 x double], align 16 + // CHECK: [[ARRAY_DEC:%.*]] = getelementptr inbounds [25 x double], [25 x double]* [[PTR]], i64 0, i64 0 + // CHECK-NEXT: call <25 x double> @llvm.matrix.column.major.load.v25f64(double* align 16 [[ARRAY_DEC]], i64 5, i1 false, i32 5, i32 5) double Ptr[25]; dx5x5_t m = __builtin_matrix_column_major_load(Ptr, 5, 5, 5); } void column_major_load_const(const double *Ptr) { - // COMMON-LABEL: define{{.*}} void @column_major_load_const(double* %Ptr) - // CHECK32: [[PTR:%.*]] = load double*, double** %Ptr.addr, align 4 - // CHECK32-NEXT: call <25 x double> @llvm.matrix.column.major.load.v25f64.i32(double* align 4 [[PTR]], i32 5, i1 false, i32 5, i32 5) - // - // CHECK64: [[PTR:%.*]] = load double*, double** %Ptr.addr, align 8 - // CHECK64-NEXT: call <25 x double> @llvm.matrix.column.major.load.v25f64.i64(double* align 8 [[PTR]], i64 5, i1 false, i32 5, i32 5) + // CHECK-LABEL: define{{.*}} void @column_major_load_const(double* %Ptr) + // CHECK: [[PTR:%.*]] = load double*, double** %Ptr.addr, align 8 + // CHECK-NEXT: call <25 x double> @llvm.matrix.column.major.load.v25f64(double* align 8 [[PTR]], i64 5, i1 false, i32 5, i32 5) dx5x5_t m_a1 = __builtin_matrix_column_major_load(Ptr, 5, 5, 5); } void column_major_load_volatile(volatile double *Ptr) { - // COMMON-LABEL: define{{.*}} void @column_major_load_volatile(double* %Ptr) - // CHECK32: [[PTR:%.*]] = load double*, double** %Ptr.addr, align 4 - // CHECK32-NEXT: call <25 x double> @llvm.matrix.column.major.load.v25f64.i32(double* align 4 [[PTR]], i32 5, i1 true, i32 5, i32 5) - // - // CHECK64: [[PTR:%.*]] = load double*, double** %Ptr.addr, align 8 - // CHECK64-NEXT: call <25 x double> @llvm.matrix.column.major.load.v25f64.i64(double* align 8 [[PTR]], i64 5, i1 true, i32 5, i32 5) + // CHECK-LABEL: define{{.*}} void @column_major_load_volatile(double* %Ptr) + // CHECK: [[PTR:%.*]] = load double*, double** %Ptr.addr, align 8 + // CHECK-NEXT: call <25 x double> @llvm.matrix.column.major.load.v25f64(double* align 8 [[PTR]], i64 5, i1 true, i32 5, i32 5) dx5x5_t m_a1 = __builtin_matrix_column_major_load(Ptr, 5, 5, 5); } void column_major_store_with_const_stride_double(double *Ptr) { - // COMMON-LABEL: define{{.*}} void @column_major_store_with_const_stride_double(double* %Ptr) - // CHECK32: [[M:%.*]] = load <25 x double>, <25 x double>* {{.*}}, align 4 - // CHECK32-NEXT: [[PTR:%.*]] = load double*, double** %Ptr.addr, align 4 - // CHECK32-NEXT: call void @llvm.matrix.column.major.store.v25f64.i32(<25 x double> [[M]], double* align 4 [[PTR]], i32 5, i1 false, i32 5, i32 5) - // - // CHECK64: [[M:%.*]] = load <25 x double>, <25 x double>* {{.*}}, align 8 - // CHECK64-NEXT: [[PTR:%.*]] = load double*, double** %Ptr.addr, align 8 - // CHECK64-NEXT: call void @llvm.matrix.column.major.store.v25f64.i64(<25 x double> [[M]], double* align 8 [[PTR]], i64 5, i1 false, i32 5, i32 5) + // CHECK-LABEL: define{{.*}} void @column_major_store_with_const_stride_double(double* %Ptr) + // CHECK: [[M:%.*]] = load <25 x double>, <25 x double>* {{.*}}, align 8 + // CHECK-NEXT: [[PTR:%.*]] = load double*, double** %Ptr.addr, align 8 + // CHECK-NEXT: call void @llvm.matrix.column.major.store.v25f64(<25 x double> [[M]], double* align 8 [[PTR]], i64 5, i1 false, i32 5, i32 5) dx5x5_t m; __builtin_matrix_column_major_store(m, Ptr, 5); } void column_major_store_with_const_stride2_double(double *Ptr) { - // COMMON-LABEL: define{{.*}} void @column_major_store_with_const_stride2_double(double* %Ptr) - // CHECK32: [[M:%.*]] = load <25 x double>, <25 x double>* {{.*}}, align 4 - // CHECK32-NEXT: [[PTR:%.*]] = load double*, double** %Ptr.addr, align 4 - // CHECK32-NEXT: call void @llvm.matrix.column.major.store.v25f64.i32(<25 x double> [[M]], double* align 4 [[PTR]], i32 15, i1 false, i32 5, i32 5) - // - // CHECK64: [[M:%.*]] = load <25 x double>, <25 x double>* {{.*}}, align 8 - // CHECK64-NEXT: [[PTR:%.*]] = load double*, double** %Ptr.addr, align 8 - // CHECK64-NEXT: call void @llvm.matrix.column.major.store.v25f64.i64(<25 x double> [[M]], double* align 8 [[PTR]], i64 15, i1 false, i32 5, i32 5) + // CHECK-LABEL: define{{.*}} void @column_major_store_with_const_stride2_double(double* %Ptr) + // CHECK: [[M:%.*]] = load <25 x double>, <25 x double>* {{.*}}, align 8 + // CHECK-NEXT: [[PTR:%.*]] = load double*, double** %Ptr.addr, align 8 + // CHECK-NEXT: call void @llvm.matrix.column.major.store.v25f64(<25 x double> [[M]], double* align 8 [[PTR]], i64 15, i1 false, i32 5, i32 5) // dx5x5_t m; __builtin_matrix_column_major_store(m, Ptr, 2 * 3 + 9); } void column_major_store_with_stride_math_int(int *Ptr, int S) { - // COMMON-LABEL: define{{.*}} void @column_major_store_with_stride_math_int(i32* %Ptr, i32 %S) - // COMMON: [[M:%.*]] = load <80 x i32>, <80 x i32>* {{.*}}, align 4 - // CHECK32-NEXT: [[PTR:%.*]] = load i32*, i32** %Ptr.addr, align 4 - // CHECK64-NEXT: [[PTR:%.*]] = load i32*, i32** %Ptr.addr, align 8 - // COMMON-NEXT: [[S:%.*]] = load i32, i32* %S.addr, align 4 - // COMMON-NEXT: [[ADD:%.*]] = add nsw i32 [[S]], 32 - // CHECK32-NEXT: call void @llvm.matrix.column.major.store.v80i32.i32(<80 x i32> [[M]], i32* align 4 [[PTR]], i32 [[ADD]], i1 false, i32 4, i32 20) - // - // CHECK64-NEXT: [[IDX:%.*]] = sext i32 [[ADD]] to i64 - // CHECK64-NEXT: call void @llvm.matrix.column.major.store.v80i32.i64(<80 x i32> [[M]], i32* align 4 [[PTR]], i64 [[IDX]], i1 false, i32 4, i32 20) + // CHECK-LABEL: define{{.*}} void @column_major_store_with_stride_math_int(i32* %Ptr, i32 %S) + // CHECK: [[M:%.*]] = load <80 x i32>, <80 x i32>* {{.*}}, align 4 + // CHECK-NEXT: [[PTR:%.*]] = load i32*, i32** %Ptr.addr, align 8 + // CHECK-NEXT: [[S:%.*]] = load i32, i32* %S.addr, align 4 + // CHECK-NEXT: [[ADD:%.*]] = add nsw i32 [[S]], 32 + // CHECK-NEXT: [[IDX:%.*]] = sext i32 [[ADD]] to i64 + // CHECK-NEXT: call void @llvm.matrix.column.major.store.v80i32(<80 x i32> [[M]], i32* align 4 [[PTR]], i64 [[IDX]], i1 false, i32 4, i32 20) ix4x20_t m; __builtin_matrix_column_major_store(m, Ptr, S + 32); } void column_major_store_with_stride_math_s_int(int *Ptr, short S) { - // COMMON-LABEL: define{{.*}} void @column_major_store_with_stride_math_s_int(i32* %Ptr, i16 signext %S) - // COMMON: [[M:%.*]] = load <80 x i32>, <80 x i32>* {{.*}}, align 4 - // CHECK32-NEXT: [[PTR:%.*]] = load i32*, i32** %Ptr.addr, align 4 - // CHECK64-NEXT: [[PTR:%.*]] = load i32*, i32** %Ptr.addr, align 8 - // COMMON-NEXT: [[S:%.*]] = load i16, i16* %S.addr, align 2 - // COMMON-NEXT: [[EXT:%.*]] = sext i16 [[S]] to i32 - // COMMON-NEXT: [[ADD:%.*]] = add nsw i32 [[EXT]], 2 - // CHECK32-NEXT: call void @llvm.matrix.column.major.store.v80i32.i32(<80 x i32> [[M]], i32* align 4 [[PTR]], i32 [[ADD]], i1 false, i32 4, i32 20) - // - // CHECK64-NEXT: [[IDX:%.*]] = sext i32 [[ADD]] to i64 - // CHECK64-NEXT: call void @llvm.matrix.column.major.store.v80i32.i64(<80 x i32> [[M]], i32* align 4 [[PTR]], i64 [[IDX]], i1 false, i32 4, i32 20) + // CHECK-LABEL: define{{.*}} void @column_major_store_with_stride_math_s_int(i32* %Ptr, i16 signext %S) + // CHECK: [[M:%.*]] = load <80 x i32>, <80 x i32>* {{.*}}, align 4 + // CHECK-NEXT: [[PTR:%.*]] = load i32*, i32** %Ptr.addr, align 8 + // CHECK-NEXT: [[S:%.*]] = load i16, i16* %S.addr, align 2 + // CHECK-NEXT: [[EXT:%.*]] = sext i16 [[S]] to i32 + // CHECK-NEXT: [[ADD:%.*]] = add nsw i32 [[EXT]], 2 + // CHECK-NEXT: [[IDX:%.*]] = sext i32 [[ADD]] to i64 + // CHECK-NEXT: call void @llvm.matrix.column.major.store.v80i32(<80 x i32> [[M]], i32* align 4 [[PTR]], i64 [[IDX]], i1 false, i32 4, i32 20) ix4x20_t m; __builtin_matrix_column_major_store(m, Ptr, S + 2); } void column_major_store_array1(double Ptr[25]) { - // COMMON-LABEL: define{{.*}} void @column_major_store_array1(double* %Ptr) - // CHECK32: [[M:%.*]] = load <25 x double>, <25 x double>* {{.*}}, align 4 - // CHECK32-NEXT: [[PTR:%.*]] = load double*, double** %Ptr.addr, align 4 - // CHECK32-NEXT: call void @llvm.matrix.column.major.store.v25f64.i32(<25 x double> [[M]], double* align 4 [[PTR]], i32 5, i1 false, i32 5, i32 5) - // - // CHECK64: [[M:%.*]] = load <25 x double>, <25 x double>* {{.*}}, align 8 - // CHECK64-NEXT: [[PTR:%.*]] = load double*, double** %Ptr.addr, align 8 - // CHECK64-NEXT: call void @llvm.matrix.column.major.store.v25f64.i64(<25 x double> [[M]], double* align 8 [[PTR]], i64 5, i1 false, i32 5, i32 5) + // CHECK-LABEL: define{{.*}} void @column_major_store_array1(double* %Ptr) + // CHECK: [[M:%.*]] = load <25 x double>, <25 x double>* {{.*}}, align 8 + // CHECK-NEXT: [[PTR:%.*]] = load double*, double** %Ptr.addr, align 8 + // CHECK-NEXT: call void @llvm.matrix.column.major.store.v25f64(<25 x double> [[M]], double* align 8 [[PTR]], i64 5, i1 false, i32 5, i32 5) dx5x5_t m; __builtin_matrix_column_major_store(m, Ptr, 5); } void column_major_store_array2() { - // COMMON-LABEL: define{{.*}} void @column_major_store_array2() - // CHECK32: [[M:%.*]] = load <25 x double>, <25 x double>* {{.*}}, align 4 - // CHECK32-NEXT: [[PTR:%.*]] = getelementptr inbounds [25 x double], [25 x double]* %Ptr, i32 0, i32 0 - // CHECK32-NEXT: call void @llvm.matrix.column.major.store.v25f64.i32(<25 x double> [[M]], double* align 8 [[PTR]], i32 5, i1 false, i32 5, i32 5) - // - // CHECK64: [[M:%.*]] = load <25 x double>, <25 x double>* {{.*}}, align 8 - // CHECK64-NEXT: [[PTR:%.*]] = getelementptr inbounds [25 x double], [25 x double]* %Ptr, i64 0, i64 0 - // CHECK64-NEXT: call void @llvm.matrix.column.major.store.v25f64.i64(<25 x double> [[M]], double* align 16 [[PTR]], i64 5, i1 false, i32 5, i32 5) + // CHECK-LABEL: define{{.*}} void @column_major_store_array2() + // CHECK: [[M:%.*]] = load <25 x double>, <25 x double>* {{.*}}, align 8 + // CHECK-NEXT: [[PTR:%.*]] = getelementptr inbounds [25 x double], [25 x double]* %Ptr, i64 0, i64 0 + // CHECK-NEXT: call void @llvm.matrix.column.major.store.v25f64(<25 x double> [[M]], double* align 16 [[PTR]], i64 5, i1 false, i32 5, i32 5) double Ptr[25]; dx5x5_t m; @@ -315,14 +253,10 @@ void column_major_store_array2() { } void column_major_store_volatile(volatile double *Ptr) { - // COMMON-LABEL: define{{.*}} void @column_major_store_volatile(double* %Ptr) #0 { - // CHECK32: [[M:%.*]] = load <25 x double>, <25 x double>* {{.*}}, align 4 - // CHECK32-NEXT: [[PTR:%.*]] = load double*, double** %Ptr.addr, align 4 - // CHECK32-NEXT: call void @llvm.matrix.column.major.store.v25f64.i32(<25 x double> [[M]], double* align 4 [[PTR]], i32 5, i1 true, i32 5, i32 5) - // - // CHECK64: [[M:%.*]] = load <25 x double>, <25 x double>* {{.*}}, align 8 - // CHECK64-NEXT: [[PTR:%.*]] = load double*, double** %Ptr.addr, align 8 - // CHECK64-NEXT: call void @llvm.matrix.column.major.store.v25f64.i64(<25 x double> [[M]], double* align 8 [[PTR]], i64 5, i1 true, i32 5, i32 5) + // CHECK-LABEL: define{{.*}} void @column_major_store_volatile(double* %Ptr) #0 { + // CHECK: [[M:%.*]] = load <25 x double>, <25 x double>* {{.*}}, align 8 + // CHECK-NEXT: [[PTR:%.*]] = load double*, double** %Ptr.addr, align 8 + // CHECK-NEXT: call void @llvm.matrix.column.major.store.v25f64(<25 x double> [[M]], double* align 8 [[PTR]], i64 5, i1 true, i32 5, i32 5) dx5x5_t m; __builtin_matrix_column_major_store(m, Ptr, 5); diff --git a/clang/test/CodeGen/merge-functions.c b/clang/test/CodeGen/merge-functions.c deleted file mode 100644 index 7e382853cc7c..000000000000 --- a/clang/test/CodeGen/merge-functions.c +++ /dev/null @@ -1,22 +0,0 @@ -// Check that code gen really activates function merging. In this case -// just check a trivial functions merging case. - -// RUN: %clang_cc1 -emit-llvm %s -fmerge-functions -o - | FileCheck %s - -void foo1() {} -void foo2() {} - -int main() { - - // If merge functions pass is enabled, - // then second and first calls will refer to foo1 - - // CHECK: call void @{{[^\(]*}}foo1{{[^\(]*}}() - foo1(); - - // CHECK: call void @{{[^\(]*}}foo1{{[^\(]*}}() - foo2(); - - return 0; -} - diff --git a/clang/test/CodeGen/ppc-xmmintrin.c b/clang/test/CodeGen/ppc-xmmintrin.c index 32a5e5a7cdaf..e9466b32257f 100644 --- a/clang/test/CodeGen/ppc-xmmintrin.c +++ b/clang/test/CodeGen/ppc-xmmintrin.c @@ -3,12 +3,8 @@ // RUN: %clang -S -emit-llvm -target powerpc64-unknown-linux-gnu -mcpu=pwr8 -ffreestanding -DNO_WARN_X86_INTRINSICS %s \ // RUN: -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | llvm-cxxfilt -n | FileCheck %s --check-prefixes=CHECK,CHECK-BE -// RUN: %clang -x c++ -fsyntax-only -target powerpc64-unknown-linux-gnu -mcpu=pwr8 -ffreestanding -DNO_WARN_X86_INTRINSICS %s \ -// RUN: -fno-discard-value-names -mllvm -disable-llvm-optzns // RUN: %clang -S -emit-llvm -target powerpc64le-unknown-linux-gnu -mcpu=pwr8 -ffreestanding -DNO_WARN_X86_INTRINSICS %s \ // RUN: -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | llvm-cxxfilt -n | FileCheck %s --check-prefixes=CHECK,CHECK-LE -// RUN: %clang -x c++ -fsyntax-only -target powerpc64le-unknown-linux-gnu -mcpu=pwr8 -ffreestanding -DNO_WARN_X86_INTRINSICS %s \ -// RUN: -fno-discard-value-names -mllvm -disable-llvm-optzns #include @@ -1430,7 +1426,7 @@ test_mul() { void __attribute__((noinline)) test_prefetch() { - _mm_prefetch(ms, _MM_HINT_NTA); + _mm_prefetch(ms, i); } // CHECK-LABEL: @test_prefetch diff --git a/clang/test/CodeGen/profile-filter.c b/clang/test/CodeGen/profile-filter.c index dc5a31e872a1..5415ff96cb14 100644 --- a/clang/test/CodeGen/profile-filter.c +++ b/clang/test/CodeGen/profile-filter.c @@ -28,11 +28,11 @@ unsigned i; // EXCLUDE: noprofile // EXCLUDE: @test1 unsigned test1() { - // CHECK: %pgocount = load i64, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_test1, i64 0, i64 0) - // FUNC: %pgocount = load i64, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_test1, i64 0, i64 0) - // FILE: %pgocount = load i64, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_test1, i64 0, i64 0) - // SECTION-NOT: %pgocount = load i64, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_test1, i64 0, i64 0) - // EXCLUDE-NOT: %pgocount = load i64, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_test1, i64 0, i64 0) + // CHECK: %pgocount = load i64, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_test1, i64 0, i64 0), align 8 + // FUNC: %pgocount = load i64, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_test1, i64 0, i64 0), align 8 + // FILE: %pgocount = load i64, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_test1, i64 0, i64 0), align 8 + // SECTION-NOT: %pgocount = load i64, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_test1, i64 0, i64 0), align 8 + // EXCLUDE-NOT: %pgocount = load i64, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_test1, i64 0, i64 0), align 8 return i + 1; } @@ -47,10 +47,10 @@ unsigned test1() { // EXCLUDE-NOT: noprofile // EXCLUDE: @test2 unsigned test2() { - // CHECK: %pgocount = load i64, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_test2, i64 0, i64 0) - // FUNC-NOT: %pgocount = load i64, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_test2, i64 0, i64 0) - // FILE: %pgocount = load i64, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_test2, i64 0, i64 0) - // SECTION: %pgocount = load i64, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_test2, i64 0, i64 0) - // EXCLUDE: %pgocount = load i64, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_test2, i64 0, i64 0) + // CHECK: %pgocount = load i64, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_test2, i64 0, i64 0), align 8 + // FUNC-NOT: %pgocount = load i64, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_test2, i64 0, i64 0), align 8 + // FILE: %pgocount = load i64, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_test2, i64 0, i64 0), align 8 + // SECTION: %pgocount = load i64, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_test2, i64 0, i64 0), align 8 + // EXCLUDE: %pgocount = load i64, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_test2, i64 0, i64 0), align 8 return i - 1; } diff --git a/clang/test/CodeGen/pseudo-probe-emit.c b/clang/test/CodeGen/pseudo-probe-emit.c index fccc8f04844d..059673b6992e 100644 --- a/clang/test/CodeGen/pseudo-probe-emit.c +++ b/clang/test/CodeGen/pseudo-probe-emit.c @@ -6,12 +6,12 @@ void bar(); void go(); void foo(int x) { - // CHECK: call void @llvm.pseudoprobe(i64 [[#GUID:]], i64 1, i32 0, i64 -1) + // CHECK: call void @llvm.pseudoprobe(i64 [[#GUID:]], i64 1, i32 0) if (x == 0) - // CHECK: call void @llvm.pseudoprobe(i64 [[#GUID]], i64 2, i32 0, i64 -1) + // CHECK: call void @llvm.pseudoprobe(i64 [[#GUID]], i64 2, i32 0) bar(); else - // CHECK: call void @llvm.pseudoprobe(i64 [[#GUID]], i64 3, i32 0, i64 -1) + // CHECK: call void @llvm.pseudoprobe(i64 [[#GUID]], i64 3, i32 0) go(); - // CHECK: call void @llvm.pseudoprobe(i64 [[#GUID]], i64 4, i32 0, i64 -1) + // CHECK: call void @llvm.pseudoprobe(i64 [[#GUID]], i64 4, i32 0) } diff --git a/clang/test/CodeGenCUDA/unnamed-types.cu b/clang/test/CodeGenCUDA/unnamed-types.cu index f598117d969d..59bfa6d7a18f 100644 --- a/clang/test/CodeGenCUDA/unnamed-types.cu +++ b/clang/test/CodeGenCUDA/unnamed-types.cu @@ -1,17 +1,12 @@ // RUN: %clang_cc1 -std=c++11 -x hip -triple x86_64-linux-gnu -aux-triple amdgcn-amd-amdhsa -emit-llvm %s -o - | FileCheck %s --check-prefix=HOST -// RUN: %clang_cc1 -std=c++11 -x hip -triple x86_64-pc-windows-msvc -aux-triple amdgcn-amd-amdhsa -emit-llvm %s -o - | FileCheck %s --check-prefix=MSVC // RUN: %clang_cc1 -std=c++11 -x hip -triple amdgcn-amd-amdhsa -fcuda-is-device -emit-llvm %s -o - | FileCheck %s --check-prefix=DEVICE #include "Inputs/cuda.h" // HOST: @0 = private unnamed_addr constant [43 x i8] c"_Z2k0IZZ2f1PfENKUlS0_E_clES0_EUlfE_EvS0_T_\00", align 1 -// HOST: @1 = private unnamed_addr constant [60 x i8] c"_Z2k1IZ2f1PfEUlfE_Z2f1S0_EUlffE_Z2f1S0_EUlfE0_EvS0_T_T0_T1_\00", align 1 -// Check that, on MSVC, the same device kernel mangling name is generated. -// MSVC: @0 = private unnamed_addr constant [43 x i8] c"_Z2k0IZZ2f1PfENKUlS0_E_clES0_EUlfE_EvS0_T_\00", align 1 -// MSVC: @1 = private unnamed_addr constant [60 x i8] c"_Z2k1IZ2f1PfEUlfE_Z2f1S0_EUlffE_Z2f1S0_EUlfE0_EvS0_T_T0_T1_\00", align 1 __device__ float d0(float x) { - return [](float x) { return x + 1.f; }(x); + return [](float x) { return x + 2.f; }(x); } __device__ float d1(float x) { @@ -19,21 +14,11 @@ __device__ float d1(float x) { } // DEVICE: amdgpu_kernel void @_Z2k0IZZ2f1PfENKUlS0_E_clES0_EUlfE_EvS0_T_( -// DEVICE: define internal float @_ZZZ2f1PfENKUlS_E_clES_ENKUlfE_clEf( template __global__ void k0(float *p, F f) { p[0] = f(p[0]) + d0(p[1]) + d1(p[2]); } -// DEVICE: amdgpu_kernel void @_Z2k1IZ2f1PfEUlfE_Z2f1S0_EUlffE_Z2f1S0_EUlfE0_EvS0_T_T0_T1_( -// DEVICE: define internal float @_ZZ2f1PfENKUlfE_clEf( -// DEVICE: define internal float @_ZZ2f1PfENKUlffE_clEff( -// DEVICE: define internal float @_ZZ2f1PfENKUlfE0_clEf( -template -__global__ void k1(float *p, F0 f0, F1 f1, F2 f2) { - p[0] = f0(p[0]) + f1(p[1], p[2]) + f2(p[3]); -} - void f0(float *p) { [](float *p) { *p = 1.f; @@ -44,17 +29,11 @@ void f0(float *p) { // linkages are still required to keep the original `internal` linkage. // HOST: define internal void @_ZZ2f1PfENKUlS_E_clES_( +// DEVICE: define internal float @_ZZZ2f1PfENKUlS_E_clES_ENKUlfE_clEf( void f1(float *p) { [](float *p) { - k0<<<1,1>>>(p, [] __device__ (float x) { return x + 3.f; }); + k0<<<1,1>>>(p, [] __device__ (float x) { return x + 1.f; }); }(p); - k1<<<1,1>>>(p, - [] __device__ (float x) { return x + 4.f; }, - [] __device__ (float x, float y) { return x * y; }, - [] __device__ (float x) { return x + 5.f; }); } // HOST: @__hip_register_globals // HOST: __hipRegisterFunction{{.*}}@_Z17__device_stub__k0IZZ2f1PfENKUlS0_E_clES0_EUlfE_EvS0_T_{{.*}}@0 -// HOST: __hipRegisterFunction{{.*}}@_Z17__device_stub__k1IZ2f1PfEUlfE_Z2f1S0_EUlffE_Z2f1S0_EUlfE0_EvS0_T_T0_T1_{{.*}}@1 -// MSVC: __hipRegisterFunction{{.*}}@"??$k0@V@?0???R1?0??f1@@YAXPEAM@Z@QEBA@0@Z@@@YAXPEAMV@?0???R0?0??f1@@YAX0@Z@QEBA@0@Z@@Z{{.*}}@0 -// MSVC: __hipRegisterFunction{{.*}}@"??$k1@V@?0??f1@@YAXPEAM@Z@V@?0??2@YAX0@Z@V@?0??2@YAX0@Z@@@YAXPEAMV@?0??f1@@YAX0@Z@V@?0??1@YAX0@Z@V@?0??1@YAX0@Z@@Z{{.*}}@1 diff --git a/clang/test/CodeGenCXX/2009-05-04-PureConstNounwind.cpp b/clang/test/CodeGenCXX/2009-05-04-PureConstNounwind.cpp index e1d539608fcc..25400a552e5d 100644 --- a/clang/test/CodeGenCXX/2009-05-04-PureConstNounwind.cpp +++ b/clang/test/CodeGenCXX/2009-05-04-PureConstNounwind.cpp @@ -15,8 +15,8 @@ int f(void) { // CHECK: declare i32 @_Z1tv() [[TF2:#[0-9]+]] // CHECK: attributes [[TF]] = { {{.*}} } -// CHECK: attributes [[NUW_RN]] = { nounwind readnone willreturn{{.*}} } -// CHECK: attributes [[NUW_RO]] = { nounwind readonly willreturn{{.*}} } +// CHECK: attributes [[NUW_RN]] = { nounwind readnone{{.*}} } +// CHECK: attributes [[NUW_RO]] = { nounwind readonly{{.*}} } // CHECK: attributes [[TF2]] = { {{.*}} } -// CHECK: attributes [[NUW_RN_CALL]] = { nounwind readnone willreturn } -// CHECK: attributes [[NUW_RO_CALL]] = { nounwind readonly willreturn } +// CHECK: attributes [[NUW_RN_CALL]] = { nounwind readnone } +// CHECK: attributes [[NUW_RO_CALL]] = { nounwind readonly } diff --git a/clang/test/CodeGenCXX/builtin-is-constant-evaluated.cpp b/clang/test/CodeGenCXX/builtin-is-constant-evaluated.cpp index d30fefe55b4f..967c83496ab9 100644 --- a/clang/test/CodeGenCXX/builtin-is-constant-evaluated.cpp +++ b/clang/test/CodeGenCXX/builtin-is-constant-evaluated.cpp @@ -4,7 +4,6 @@ // RUN: FileCheck -check-prefix=CHECK-DYN -input-file=%t.ll %s // RUN: FileCheck -check-prefix=CHECK-ARR -input-file=%t.ll %s // RUN: FileCheck -check-prefix=CHECK-FOLD -input-file=%t.ll %s -// RUN: FileCheck -check-prefix=CHECK-DTOR -input-file=%t.ll %s using size_t = decltype(sizeof(int)); @@ -132,94 +131,3 @@ void test_ref_to_static_var() { // CHECK-FOLD: store i32* @_ZZ22test_ref_to_static_varvE10i_constant, i32** %r, int &r = __builtin_is_constant_evaluated() ? i_constant : i_non_constant; } - -int not_constexpr; - -// __builtin_is_constant_evaluated() should never evaluate to true during -// destruction if it would not have done so during construction. -// -// FIXME: The standard doesn't say that it should ever return true when -// evaluating a destructor call, even for a constexpr variable. That seems -// obviously wrong. -struct DestructorBCE { - int n; - constexpr DestructorBCE(int n) : n(n) {} - constexpr ~DestructorBCE() { - if (!__builtin_is_constant_evaluated()) - not_constexpr = 1; - } -}; - -// CHECK-DTOR-NOT: @_ZN13DestructorBCED{{.*}}@global_dtor_bce_1 -DestructorBCE global_dtor_bce_1(101); - -// CHECK-DTOR: load i32, i32* @not_constexpr -// CHECK-DTOR: call {{.*}} @_ZN13DestructorBCEC1Ei({{.*}} @global_dtor_bce_2, i32 -// CHECK-DTOR: atexit{{.*}} @_ZN13DestructorBCED{{.*}} @global_dtor_bce_2 -// CHECK-DTOR: } -DestructorBCE global_dtor_bce_2(not_constexpr); - -// CHECK-DTOR-NOT: @_ZN13DestructorBCED{{.*}}@global_dtor_bce_3 -constexpr DestructorBCE global_dtor_bce_3(103); - -// CHECK-DTOR-LABEL: define {{.*}} @_Z15test_dtor_bce_1v( -void test_dtor_bce_1() { - // Variable is neither constant initialized (because it has automatic storage - // duration) nor usable in constant expressions, so BCE should not return - // true during destruction. It would be OK if we replaced the constructor - // call with a direct store, but we should emit the destructor call. - - // CHECK-DTOR: call {{.*}} @_ZN13DestructorBCEC1Ei({{.*}}, i32 201) - DestructorBCE local(201); - // CHECK-DTOR: call {{.*}} @_ZN13DestructorBCED - // CHECK-DTOR: } -} - -// CHECK-DTOR-LABEL: define {{.*}} @_Z15test_dtor_bce_2v( -void test_dtor_bce_2() { - // Non-constant init => BCE is false in destructor. - - // CHECK-DTOR: call {{.*}} @_ZN13DestructorBCEC1Ei({{.*}} - DestructorBCE local(not_constexpr); - // CHECK-DTOR: call {{.*}} @_ZN13DestructorBCED - // CHECK-DTOR: } -} - -// CHECK-DTOR-LABEL: define {{.*}} @_Z15test_dtor_bce_3v( -void test_dtor_bce_3() { - // Should never call dtor for a constexpr variable. - - // CHECK-DTOR-NOT: call {{.*}} @_ZN13DestructorBCEC1Ei( - constexpr DestructorBCE local(203); - // CHECK-DTOR-NOT: @_ZN13DestructorBCED - // CHECK-DTOR: } -} - -// CHECK-DTOR-LABEL: define {{.*}} @_Z22test_dtor_bce_static_1v( -void test_dtor_bce_static_1() { - // Variable is constant initialized, so BCE returns true during constant - // destruction. - - // CHECK: store i32 301 - // CHECK-DTOR-NOT: @_ZN13DestructorBCEC1Ei({{.*}} - static DestructorBCE local(301); - // CHECK-DTOR-NOT: @_ZN13DestructorBCED - // CHECK-DTOR: } -} - -// CHECK-DTOR-LABEL: define {{.*}} @_Z22test_dtor_bce_static_2v( -void test_dtor_bce_static_2() { - // CHECK-DTOR: call {{.*}} @_ZN13DestructorBCEC1Ei({{.*}} - static DestructorBCE local(not_constexpr); - // CHECK-DTOR: call {{.*}}atexit{{.*}} @_ZN13DestructorBCED - // CHECK-DTOR: } -} - -// CHECK-DTOR-LABEL: define {{.*}} @_Z22test_dtor_bce_static_3v( -void test_dtor_bce_static_3() { - // CHECK: store i32 303 - // CHECK-DTOR-NOT: @_ZN13DestructorBCEC1Ei({{.*}} - static constexpr DestructorBCE local(303); - // CHECK-DTOR-NOT: @_ZN13DestructorBCED - // CHECK-DTOR: } -} diff --git a/clang/test/CodeGenCXX/clang-abi-compat.cpp b/clang/test/CodeGenCXX/clang-abi-compat.cpp index 80311aa320fe..46e7ed812cbc 100644 --- a/clang/test/CodeGenCXX/clang-abi-compat.cpp +++ b/clang/test/CodeGenCXX/clang-abi-compat.cpp @@ -1,23 +1,12 @@ -// RUN: %clang_cc1 -std=c++98 -triple x86_64-linux-gnu -fenable-matrix -fclang-abi-compat=3.0 %s -emit-llvm -o - -Wno-c++11-extensions \ -// RUN: | FileCheck --check-prefixes=CHECK,PRE39,PRE5,PRE12 %s -// RUN: %clang_cc1 -std=c++17 -triple x86_64-linux-gnu -fenable-matrix -fclang-abi-compat=3.0 %s -emit-llvm -o - \ -// RUN: | FileCheck --check-prefixes=CHECK,PRE39,PRE5,PRE12 %s -// RUN: %clang_cc1 -std=c++17 -triple x86_64-linux-gnu -fenable-matrix -fclang-abi-compat=3.8 %s -emit-llvm -o - \ -// RUN: | FileCheck --check-prefixes=CHECK,PRE39,PRE5,PRE12 %s -// RUN: %clang_cc1 -std=c++17 -triple x86_64-linux-gnu -fenable-matrix -fclang-abi-compat=3.9 %s -emit-llvm -o - \ -// RUN: | FileCheck --check-prefixes=CHECK,V39,PRE5,PRE12 %s -// RUN: %clang_cc1 -std=c++17 -triple x86_64-linux-gnu -fenable-matrix -fclang-abi-compat=4.0 %s -emit-llvm -o - \ -// RUN: | FileCheck --check-prefixes=CHECK,V39,PRE5,PRE12 %s -// RUN: %clang_cc1 -std=c++17 -triple x86_64-linux-gnu -fenable-matrix -fclang-abi-compat=5 %s -emit-llvm -o - \ -// RUN: | FileCheck --check-prefixes=CHECK,V39,V5,PRE12,PRE12-CXX17 %s -// RUN: %clang_cc1 -std=c++17 -triple x86_64-linux-gnu -fenable-matrix -fclang-abi-compat=11 %s -emit-llvm -o - \ -// RUN: | FileCheck --check-prefixes=CHECK,V39,V5,PRE12,PRE12-CXX17 %s -// RUN: %clang_cc1 -std=c++20 -triple x86_64-linux-gnu -fenable-matrix -fclang-abi-compat=11 %s -emit-llvm -o - \ -// RUN: | FileCheck --check-prefixes=CHECK,V39,V5,PRE12,PRE12-CXX17,PRE12-CXX20 %s -// RUN: %clang_cc1 -std=c++98 -triple x86_64-linux-gnu -fenable-matrix -fclang-abi-compat=latest %s -emit-llvm -o - -Wno-c++11-extensions \ -// RUN: | FileCheck --check-prefixes=CHECK,V39,V5,V12 %s -// RUN: %clang_cc1 -std=c++20 -triple x86_64-linux-gnu -fenable-matrix -fclang-abi-compat=latest %s -emit-llvm -o - \ -// RUN: | FileCheck --check-prefixes=CHECK,V39,V5,V12,V12-CXX17,V12-CXX20 %s +// RUN: %clang_cc1 -std=c++98 -triple x86_64-linux-gnu -fclang-abi-compat=3.0 %s -emit-llvm -o - | FileCheck --check-prefixes=CHECK,PRE39,PRE5,PRE12 %s +// RUN: %clang_cc1 -std=c++17 -triple x86_64-linux-gnu -fclang-abi-compat=3.0 %s -emit-llvm -o - | FileCheck --check-prefixes=CHECK,PRE39,PRE5,PRE12 %s +// RUN: %clang_cc1 -std=c++17 -triple x86_64-linux-gnu -fclang-abi-compat=3.8 %s -emit-llvm -o - | FileCheck --check-prefixes=CHECK,PRE39,PRE5,PRE12 %s +// RUN: %clang_cc1 -std=c++17 -triple x86_64-linux-gnu -fclang-abi-compat=3.9 %s -emit-llvm -o - | FileCheck --check-prefixes=CHECK,V39,PRE5,PRE12 %s +// RUN: %clang_cc1 -std=c++17 -triple x86_64-linux-gnu -fclang-abi-compat=4.0 %s -emit-llvm -o - | FileCheck --check-prefixes=CHECK,V39,PRE5,PRE12 %s +// RUN: %clang_cc1 -std=c++17 -triple x86_64-linux-gnu -fclang-abi-compat=5 %s -emit-llvm -o - | FileCheck --check-prefixes=CHECK,V39,V5,PRE12,PRE12-CXX17 %s +// RUN: %clang_cc1 -std=c++17 -triple x86_64-linux-gnu -fclang-abi-compat=11 %s -emit-llvm -o - | FileCheck --check-prefixes=CHECK,V39,V5,PRE12,PRE12-CXX17 %s +// RUN: %clang_cc1 -std=c++98 -triple x86_64-linux-gnu -fclang-abi-compat=latest %s -emit-llvm -o - | FileCheck --check-prefixes=CHECK,V39,V5,V12 %s +// RUN: %clang_cc1 -std=c++20 -triple x86_64-linux-gnu -fclang-abi-compat=latest %s -emit-llvm -o - | FileCheck --check-prefixes=CHECK,V39,V5,V12,V12-CXX17 %s typedef __attribute__((vector_size(8))) long long v1xi64; void clang39(v1xi64) {} @@ -66,73 +55,3 @@ template void clang12_b(); // CHECK: @_Z9clang12_cIXadL_Z3arrEEEvv template void clang12_c() {} template void clang12_c<&arr>(); - - -/// Tests for changes in clang12: -namespace expr_primary { -struct A { - template struct Int {}; - template struct Ref {}; -}; - -/// Check various DeclRefExpr manglings - -// PRE12: @_ZN12expr_primary5test1INS_1AEEEvNT_3IntIXLi1EEEE -// V12: @_ZN12expr_primary5test1INS_1AEEEvNT_3IntILi1EEE -template void test1(typename T::template Int<1> a) {} -template void test1(typename A::template Int<1> a); - -enum Enum { EnumVal = 4 }; -int Global; - -// PRE12: @_ZN12expr_primary5test2INS_1AEEEvNT_3IntIXLNS_4EnumE4EEEE -// V12: @_ZN12expr_primary5test2INS_1AEEEvNT_3IntILNS_4EnumE4EEE -template void test2(typename T::template Int a) {} -template void test2(typename A::template Int<4> a); - -// CHECK: @_ZN12expr_primary5test3ILi3EEEvNS_1A3IntIXT_EEE -template void test3(typename A::template Int a) {} -template void test3<3>(A::Int<3> a); - -#if __cplusplus >= 202002L -// CHECK-CXX20: @_ZN12expr_primary5test4INS_1AEEEvNT_3RefIL_ZNS_6GlobalEEEE -template void test4(typename T::template Ref<(Global)> a) {} -template void test4(typename A::template Ref a); - -struct B { - struct X { - constexpr X(double) {} - constexpr X(int&) {} - }; - template struct Y {}; -}; - -// PRE12-CXX20: _ZN12expr_primary5test5INS_1BEEEvNT_1YIXLd3ff0000000000000EEEE -// V12-CXX20: _ZN12expr_primary5test5INS_1BEEEvNT_1YILd3ff0000000000000EEE -template void test5(typename T::template Y<1.0>) { } -template void test5(typename B::Y<1.0>); - -// PRE12-CXX20: @_ZN12expr_primary5test6INS_1BEEENT_1YIL_ZZNS_5test6EiE1bEEEi -// V12-CXX20: @_ZN12expr_primary5test6INS_1BEEENT_1YIXfp_EEEi -template auto test6(int b) -> typename T::template Y { return {}; } -template auto test6(int b) -> B::Y; -#endif - -/// Verify non-dependent type-traits within a dependent template arg. - -// PRE12: @_ZN12expr_primary5test7INS_1AEEEvNT_3IntIXLm1EEEE -// V12: @_ZN12expr_primary5test7INS_1AEEEvNT_3IntILm1EEE -template void test7(typename T::template Int a) {} -template void test7(A::Int<1>); - -// PRE12: @_ZN12expr_primary5test8ILi2EEEvu11matrix_typeIXLi1EEXT_EiE -// V12: @_ZN12expr_primary5test8ILi2EEEvu11matrix_typeILi1EXT_EiE -template using matrix1xN = int __attribute__((matrix_type(1, N))); -template void test8(matrix1xN a) {} -template void test8<2>(matrix1xN<2> a); - -// PRE12: @_ZN12expr_primary5test9EUa9enable_ifIXLi1EEEv -// V12: @_ZN12expr_primary5test9EUa9enable_ifILi1EEv -void test9(void) __attribute__((enable_if(1, ""))) {} - -} diff --git a/clang/test/CodeGenCXX/debug-info-gline-tables-only-codeview.cpp b/clang/test/CodeGenCXX/debug-info-gline-tables-only-codeview.cpp index 409b62da62c1..27ac682c10f5 100644 --- a/clang/test/CodeGenCXX/debug-info-gline-tables-only-codeview.cpp +++ b/clang/test/CodeGenCXX/debug-info-gline-tables-only-codeview.cpp @@ -25,6 +25,6 @@ void test() { // CHECK: ![[C]] = !DICompositeType(tag: DW_TAG_structure_type, name: "C", // CHECK-SAME: flags: DIFlagFwdDecl // CHECK-NOT: identifier - // CHECK: ![[MTYPE]] = !DISubroutineType({{.*}}types: !{{.*}}) + // CHECK: ![[MTYPE]] = !DISubroutineType(types: !{{.*}}) c.m(); } diff --git a/clang/test/CodeGenCXX/enable_if.cpp b/clang/test/CodeGenCXX/enable_if.cpp index 70386b87fcee..4e7707aaeed9 100644 --- a/clang/test/CodeGenCXX/enable_if.cpp +++ b/clang/test/CodeGenCXX/enable_if.cpp @@ -5,7 +5,7 @@ int test5(int); template T test5(T) __attribute__((enable_if(1, "better than non-template"))); -// CHECK: @_Z5test5IiEUa9enable_ifILi1EET_S0_ +// CHECK: @_Z5test5IiEUa9enable_ifIXLi1EEET_S0_ int (*Ptr)(int) = &test5; // Test itanium mangling for attribute enable_if diff --git a/clang/test/CodeGenCXX/mangle-abi-tag.cpp b/clang/test/CodeGenCXX/mangle-abi-tag.cpp index 9e26604a2c44..5d84096d24cd 100644 --- a/clang/test/CodeGenCXX/mangle-abi-tag.cpp +++ b/clang/test/CodeGenCXX/mangle-abi-tag.cpp @@ -225,7 +225,7 @@ namespace pr30440 { template void g(F); template auto h(A ...a)->decltype (g (0, g < a > (a) ...)) { } -// CHECK-DAG: define {{.*}} @_ZN7pr304401hIJEEEDTcl1gLi0Espcl1gIXfp_EEfp_EEEDpT_( +// CHECK-DAG: define {{.*}} @_ZN7pr304401hIJEEEDTcl1gLi0Espcl1gIL_ZZNS_1hEDpT_E1aEEfp_EEES2_( void pr30440_test () { h(); diff --git a/clang/test/CodeGenCXX/mangle-alignof.cpp b/clang/test/CodeGenCXX/mangle-alignof.cpp deleted file mode 100644 index 0a65c7e87a2d..000000000000 --- a/clang/test/CodeGenCXX/mangle-alignof.cpp +++ /dev/null @@ -1,25 +0,0 @@ -// RUN: %clang_cc1 -std=c++11 -Wno-gnu-alignof-expression -emit-llvm %s -o - -triple=%itanium_abi_triple | FileCheck %s --check-prefix=CHECK-NEW -// RUN: %clang_cc1 -std=c++11 -Wno-gnu-alignof-expression -emit-llvm %s -o - -triple=%itanium_abi_triple -fclang-abi-compat=11 | FileCheck %s --check-prefix=CHECK-OLD - -// Verify the difference in mangling for alignof and __alignof__ in a new ABI -// compat mode. - -template void f1(decltype(alignof(T))) {} -template void f1(__SIZE_TYPE__); -// CHECK-OLD: void @_Z2f1IiEvDTatT_E -// CHECK-NEW: void @_Z2f1IiEvDTatT_E - -template void f2(decltype(__alignof__(T))) {} -template void f2(__SIZE_TYPE__); -// CHECK-OLD: void @_Z2f2IiEvDTatT_E -// CHECK-NEW: void @_Z2f2IiEvDTu11__alignof__T_E - -template void f3(decltype(alignof(T(0)))) {} -template void f3(__SIZE_TYPE__); -// CHECK-OLD: void @_Z2f3IiEvDTazcvT_Li0EE -// CHECK-NEW: void @_Z2f3IiEvDTazcvT_Li0EE - -template void f4(decltype(__alignof__(T(0)))) {} -template void f4(__SIZE_TYPE__); -// CHECK-OLD: void @_Z2f4IiEvDTazcvT_Li0EE -// CHECK-NEW: void @_Z2f4IiEvDTu11__alignof__XcvT_Li0EEEE diff --git a/clang/test/CodeGenCXX/mangle-concept.cpp b/clang/test/CodeGenCXX/mangle-concept.cpp index e60e6348a5f6..b0fcd586727e 100644 --- a/clang/test/CodeGenCXX/mangle-concept.cpp +++ b/clang/test/CodeGenCXX/mangle-concept.cpp @@ -6,11 +6,11 @@ template struct S {}; template concept C = true; template S> f0() { return S>{}; } template S> f0<>(); -// CHECK: @_ZN5test12f0IiEENS_1SIL_ZNS_1CIT_EEEEEv( +// CHECK: @_ZN5test12f0IiEENS_1SIXL_ZNS_1CIT_EEEEEEv( } template struct S {}; template concept C = true; template S> f0() { return S>{}; } template S> f0<>(); -// CHECK: @_Z2f0IiE1SIL_Z1CIT_EEEv( +// CHECK: @_Z2f0IiE1SIXL_Z1CIT_EEEEv( diff --git a/clang/test/CodeGenCXX/mangle-template.cpp b/clang/test/CodeGenCXX/mangle-template.cpp index 9b80a6d64695..40688de7e12e 100644 --- a/clang/test/CodeGenCXX/mangle-template.cpp +++ b/clang/test/CodeGenCXX/mangle-template.cpp @@ -270,7 +270,7 @@ namespace test17 { // Note: there is no J...E here, because we can't form a pack argument, and // the 5u and 6u are mangled with the original type 'j' (unsigned int) not // with the resolved type 'i' (signed int). - // CHECK: define {{.*}} @_ZN6test171hILi4EJLi1ELi2ELi3EEEEvNS_1XIXspT0_ELj5EXT_ELj6EEE + // CHECK: define {{.*}} @_ZN6test171hILi4EJLi1ELi2ELi3EEEEvNS_1XIXspT0_EXLj5EEXT_EXLj6EEEE template void h(X) {} void i() { h<4, 1, 2, 3>({}); } @@ -323,7 +323,7 @@ namespace partially_dependent_template_args { // callee is unresolved, the rest mangle the converted argument Lj0E // because the callee is resolved. void h() { - // CHECK: @_ZN33partially_dependent_template_args5test22g1INS0_1XEEEvDTcl1fILi0EEcvT__EEE + // CHECK: @_ZN33partially_dependent_template_args5test22g1INS0_1XEEEvDTcl1fIXLi0EEEcvT__EEE g1({}); // CHECK: @_ZN33partially_dependent_template_args5test22g2IiEEvDTplclL_ZNS0_1fILj0EEEiNS0_1XEEilEEcvT__EE g2({}); diff --git a/clang/test/CodeGenCXX/mangle.cpp b/clang/test/CodeGenCXX/mangle.cpp index 6cec33e3758e..f8ea9960a5c5 100644 --- a/clang/test/CodeGenCXX/mangle.cpp +++ b/clang/test/CodeGenCXX/mangle.cpp @@ -1123,7 +1123,7 @@ namespace test56 { namespace test57 { struct X { template int f(); } x; template void f(decltype(x.f<0>() + N)) {} - // CHECK-LABEL: @_ZN6test571fILi0EEEvDTplcldtL_ZNS_1xEE1fILi0EEET_E + // CHECK-LABEL: @_ZN6test571fILi0EEEvDTplcldtL_ZNS_1xEE1fIXLi0EEEET_E template void f<0>(int); } diff --git a/clang/test/CodeGenCXX/matrix-type-builtins.cpp b/clang/test/CodeGenCXX/matrix-type-builtins.cpp index d95774feb7c7..6cae343d2c24 100644 --- a/clang/test/CodeGenCXX/matrix-type-builtins.cpp +++ b/clang/test/CodeGenCXX/matrix-type-builtins.cpp @@ -94,7 +94,7 @@ void test_column_major_load_with_stride_template_double(double *Ptr) { // CHECK-LABEL: define linkonce_odr <40 x double> @_Z29column_major_load_with_strideIdLj10ELj4ELj15EEu11matrix_typeIXT0_EXT1_ET_EPS0_(double* %Ptr) // CHECK: [[PTR:%.*]] = load double*, double** %Ptr.addr, align 8 - // CHECK-NEXT: call <40 x double> @llvm.matrix.column.major.load.v40f64.i64(double* align 8 [[PTR]], i64 15, i1 false, i32 10, i32 4) + // CHECK-NEXT: call <40 x double> @llvm.matrix.column.major.load.v40f64(double* align 8 [[PTR]], i64 15, i1 false, i32 10, i32 4) matrix_t M1 = column_major_load_with_stride(Ptr); } @@ -106,7 +106,7 @@ void test_column_major_load_with_stride_template_int(int *Ptr) { // CHECK-LABEL: define linkonce_odr <6 x i32> @_Z29column_major_load_with_strideIiLj3ELj2ELj12EEu11matrix_typeIXT0_EXT1_ET_EPS0_(i32* %Ptr) // CHECK: [[PTR:%.*]] = load i32*, i32** %Ptr.addr, align 8 - // CHECK-NEXT: call <6 x i32> @llvm.matrix.column.major.load.v6i32.i64(i32* align 4 [[PTR]], i64 12, i1 false, i32 3, i32 2) + // CHECK-NEXT: call <6 x i32> @llvm.matrix.column.major.load.v6i32(i32* align 4 [[PTR]], i64 12, i1 false, i32 3, i32 2) matrix_t M1 = column_major_load_with_stride(Ptr); } @@ -124,7 +124,7 @@ void test_column_major_load_stride_wrapper(int *Ptr, UnsignedWrapper &W) { // CHECK-NEXT: [[STRIDE:%.*]] = call i32 @_ZN15UnsignedWrappercvjEv(%struct.UnsignedWrapper* {{[^,]*}} [[W]]) // CHECK-NEXT: [[STRIDE_EXT:%.*]] = zext i32 [[STRIDE]] to i64 // CHECK-NEXT: [[PTR:%.*]] = load i32*, i32** %Ptr.addr, align 8 - // CHECK-NEXT: call <4 x i32> @llvm.matrix.column.major.load.v4i32.i64(i32* align 4 [[PTR]], i64 [[STRIDE_EXT]], i1 false, i32 2, i32 2) + // CHECK-NEXT: call <4 x i32> @llvm.matrix.column.major.load.v4i32(i32* align 4 [[PTR]], i64 [[STRIDE_EXT]], i1 false, i32 2, i32 2) matrix_t M1 = __builtin_matrix_column_major_load(Ptr, 2, 2, W); } @@ -133,7 +133,7 @@ constexpr int constexpr3() { return 3; } void test_column_major_load_constexpr_num_rows(int *Ptr) { // CHECK-LABEL: define{{.*}} void @_Z41test_column_major_load_constexpr_num_rowsPi(i32* %Ptr) // CHECK: [[PTR:%.*]] = load i32*, i32** %Ptr.addr, align 8 - // CHECK-NEXT: call <6 x i32> @llvm.matrix.column.major.load.v6i32.i64(i32* align 4 [[PTR]], i64 3, i1 false, i32 3, i32 2) + // CHECK-NEXT: call <6 x i32> @llvm.matrix.column.major.load.v6i32(i32* align 4 [[PTR]], i64 3, i1 false, i32 3, i32 2) matrix_t M1 = __builtin_matrix_column_major_load(Ptr, constexpr3(), 2, 3); } @@ -143,7 +143,7 @@ constexpr int constexpr1() { return 1; } void test_column_major_load_constexpr_num_columns(int *Ptr) { // CHECK-LABEL: define{{.*}} void @_Z44test_column_major_load_constexpr_num_columnsPi(i32* %Ptr) // CHECK: [[PTR:%.*]] = load i32*, i32** %Ptr.addr, align 8 - // CHECK-NEXT: call <2 x i32> @llvm.matrix.column.major.load.v2i32.i64(i32* align 4 [[PTR]], i64 3, i1 false, i32 2, i32 1) + // CHECK-NEXT: call <2 x i32> @llvm.matrix.column.major.load.v2i32(i32* align 4 [[PTR]], i64 3, i1 false, i32 2, i32 1) matrix_t M1 = __builtin_matrix_column_major_load(Ptr, 2, constexpr1(), 3); } @@ -153,7 +153,7 @@ constexpr int constexpr_plus1() { return N + 1; } void test_column_major_load_constexpr_num_columns_temp(int *Ptr) { // CHECK-LABEL: define{{.*}} void @_Z49test_column_major_load_constexpr_num_columns_tempPi(i32* %Ptr) // CHECK: [[PTR:%.*]] = load i32*, i32** %Ptr.addr, align 8 - // CHECK-NEXT: call <10 x i32> @llvm.matrix.column.major.load.v10i32.i64(i32* align 4 [[PTR]], i64 3, i1 false, i32 2, i32 5) + // CHECK-NEXT: call <10 x i32> @llvm.matrix.column.major.load.v10i32(i32* align 4 [[PTR]], i64 3, i1 false, i32 2, i32 5) matrix_t M1 = __builtin_matrix_column_major_load(Ptr, 2, constexpr_plus1<4>(), 3); } @@ -162,7 +162,7 @@ void test_column_major_load_constexpr_stride_constexpr(int *Ptr) { // CHECK: [[STRIDE:%.*]] = call i32 @_Z10constexpr3v() // CHECK-NEXT: [[STRIDE_EXT:%.*]] = sext i32 [[STRIDE]] to i64 // CHECK-NEXT: [[PTR:%.*]] = load i32*, i32** %Ptr.addr, align 8 - // CHECK-NEXT: call <4 x i32> @llvm.matrix.column.major.load.v4i32.i64(i32* align 4 [[PTR]], i64 [[STRIDE_EXT]], i1 false, i32 2, i32 2) + // CHECK-NEXT: call <4 x i32> @llvm.matrix.column.major.load.v4i32(i32* align 4 [[PTR]], i64 [[STRIDE_EXT]], i1 false, i32 2, i32 2) matrix_t M1 = __builtin_matrix_column_major_load(Ptr, 2, 2, constexpr3()); } @@ -200,7 +200,7 @@ void test_column_major_store_with_stride_template_double(double *Ptr) { // CHECK-LABEL: define linkonce_odr void @_Z30column_major_store_with_strideIdLj10ELj4ELj15EEvRu11matrix_typeIXT0_EXT1_ET_EPS0_([40 x double]* nonnull align 8 dereferenceable(320) %m, double* %Ptr) // CHECK: [[M:%.*]] = load <40 x double>, <40 x double>* {{.*}}, align 8 // CHECK-NEXT: [[PTR:%.*]] = load double*, double** %Ptr.addr, align 8 - // CHECK-NEXT: call void @llvm.matrix.column.major.store.v40f64.i64(<40 x double> [[M]], double* align 8 [[PTR]], i64 15, i1 false, i32 10, i32 4) + // CHECK-NEXT: call void @llvm.matrix.column.major.store.v40f64(<40 x double> [[M]], double* align 8 [[PTR]], i64 15, i1 false, i32 10, i32 4) matrix_t M1; column_major_store_with_stride(M1, Ptr); @@ -214,7 +214,7 @@ void test_column_major_store_with_stride_template_int(int *Ptr) { // CHECK-LABEL: define linkonce_odr void @_Z30column_major_store_with_strideIiLj3ELj2ELj3EEvRu11matrix_typeIXT0_EXT1_ET_EPS0_([6 x i32]* nonnull align 4 dereferenceable(24) %m, i32* %Ptr) // CHECK: [[M:%.*]] = load <6 x i32>, <6 x i32>* {{.*}}, align 4 // CHECK-NEXT: [[PTR:%.*]] = load i32*, i32** %Ptr.addr, align 8 - // CHECK-NEXT: call void @llvm.matrix.column.major.store.v6i32.i64(<6 x i32> [[M]], i32* align 4 [[PTR]], i64 3, i1 false, i32 3, i32 2) + // CHECK-NEXT: call void @llvm.matrix.column.major.store.v6i32(<6 x i32> [[M]], i32* align 4 [[PTR]], i64 3, i1 false, i32 3, i32 2) matrix_t M1; column_major_store_with_stride(M1, Ptr); @@ -227,7 +227,7 @@ void test_column_major_store_stride_wrapper(int *Ptr, UnsignedWrapper &W) { // CHECK-NEXT: [[W:%.*]] = load %struct.UnsignedWrapper*, %struct.UnsignedWrapper** %W.addr, align 8 // CHECK-NEXT: [[IDX:%.*]] = call i32 @_ZN15UnsignedWrappercvjEv(%struct.UnsignedWrapper* {{[^,]*}} [[W]]) // CHECK-NEXT: [[IDX_EXT:%.*]] = zext i32 [[IDX]] to i64 - // CHECK-NEXT: call void @llvm.matrix.column.major.store.v4i32.i64(<4 x i32> [[M]], i32* align 4 [[PTR]], i64 [[IDX_EXT]], i1 false, i32 2, i32 2) + // CHECK-NEXT: call void @llvm.matrix.column.major.store.v4i32(<4 x i32> [[M]], i32* align 4 [[PTR]], i64 [[IDX_EXT]], i1 false, i32 2, i32 2) matrix_t M1; __builtin_matrix_column_major_store(M1, Ptr, W); @@ -239,7 +239,7 @@ void test_column_major_store_constexpr_stride_constexpr(int *Ptr) { // CHECK-NEXT: [[PTR:%.*]] = load i32*, i32** %Ptr.addr, align 8 // CHECK-NEXT: [[IDX:%.*]] = call i32 @_Z10constexpr3v() // CHECK-NEXT: [[IDX_EXT:%.*]] = sext i32 [[IDX]] to i64 - // CHECK-NEXT: call void @llvm.matrix.column.major.store.v4i32.i64(<4 x i32> [[M]], i32* align 4 [[PTR]], i64 [[IDX_EXT]], i1 false, i32 2, i32 2) + // CHECK-NEXT: call void @llvm.matrix.column.major.store.v4i32(<4 x i32> [[M]], i32* align 4 [[PTR]], i64 [[IDX_EXT]], i1 false, i32 2, i32 2) matrix_t M; __builtin_matrix_column_major_store(M, Ptr, constexpr3()); diff --git a/clang/test/CodeGenCXX/matrix-type.cpp b/clang/test/CodeGenCXX/matrix-type.cpp index 9e715e10ce1c..9bde12e13b86 100644 --- a/clang/test/CodeGenCXX/matrix-type.cpp +++ b/clang/test/CodeGenCXX/matrix-type.cpp @@ -215,14 +215,14 @@ void test_template_deduction() { // CHECK-NEXT: %m4 = alloca [144 x float], align 4 // CHECK-NEXT: %v = alloca %struct.selector.3, align 1 // CHECK-NEXT: %undef.agg.tmp4 = alloca %struct.selector.3, align 1 - // CHECK-NEXT: call void @_Z10use_matrixIiLm12EE8selectorILi3EERu11matrix_typeILm10EXT0_ET_E([120 x i32]* nonnull align 4 dereferenceable(480) %m0) + // CHECK-NEXT: call void @_Z10use_matrixIiLm12EE8selectorILi3EERu11matrix_typeIXLm10EEXT0_ET_E([120 x i32]* nonnull align 4 dereferenceable(480) %m0) // CHECK-NEXT: call void @_Z10use_matrixIiE8selectorILi2EERu11matrix_typeILm10ELm10ET_E([100 x i32]* nonnull align 4 dereferenceable(400) %m1) - // CHECK-NEXT: call void @_Z10use_matrixIiLm12EE8selectorILi1EERu11matrix_typeIXT0_ELm10ET_E([120 x i32]* nonnull align 4 dereferenceable(480) %m2) + // CHECK-NEXT: call void @_Z10use_matrixIiLm12EE8selectorILi1EERu11matrix_typeIXT0_EXLm10EET_E([120 x i32]* nonnull align 4 dereferenceable(480) %m2) // CHECK-NEXT: call void @_Z10use_matrixIiLm12ELm12EE8selectorILi0EERu11matrix_typeIXT0_EXT1_ET_E([144 x i32]* nonnull align 4 dereferenceable(576) %m3) // CHECK-NEXT: call void @_Z10use_matrixILm12ELm12EE8selectorILi4EERu11matrix_typeIXT_EXT0_EfE([144 x float]* nonnull align 4 dereferenceable(576) %m4) // CHECK-NEXT: ret void - // CHECK-LABEL: define linkonce_odr void @_Z10use_matrixIiLm12EE8selectorILi3EERu11matrix_typeILm10EXT0_ET_E([120 x i32]* nonnull align 4 dereferenceable(480) %m) + // CHECK-LABEL: define linkonce_odr void @_Z10use_matrixIiLm12EE8selectorILi3EERu11matrix_typeIXLm10EEXT0_ET_E([120 x i32]* nonnull align 4 dereferenceable(480) %m) // CHECK-NEXT: entry: // CHECK-NEXT: %m.addr = alloca [120 x i32]*, align 8 // CHECK-NEXT: store [120 x i32]* %m, [120 x i32]** %m.addr, align 8 @@ -236,7 +236,7 @@ void test_template_deduction() { // CHECK-NEXT: call void @llvm.trap() // CHECK-NEXT: unreachable - // CHECK-LABEL: define linkonce_odr void @_Z10use_matrixIiLm12EE8selectorILi1EERu11matrix_typeIXT0_ELm10ET_E([120 x i32]* nonnull align 4 dereferenceable(480) %m) + // CHECK-LABEL: define linkonce_odr void @_Z10use_matrixIiLm12EE8selectorILi1EERu11matrix_typeIXT0_EXLm10EET_E([120 x i32]* nonnull align 4 dereferenceable(480) %m) // CHECK-NEXT: entry: // CHECK-NEXT: %m.addr = alloca [120 x i32]*, align 8 // CHECK-NEXT: store [120 x i32]* %m, [120 x i32]** %m.addr, align 8 @@ -277,10 +277,10 @@ void test_auto_t() { // CHECK-LABEL: define{{.*}} void @_Z11test_auto_tv() // CHECK-NEXT: entry: // CHECK-NEXT: %m = alloca [130 x i32], align 4 - // CHECK-NEXT: call void @_Z3fooILm13EEvRu11matrix_typeIXT_ELm10EiE([130 x i32]* nonnull align 4 dereferenceable(520) %m) + // CHECK-NEXT: call void @_Z3fooILm13EEvRu11matrix_typeIXT_EXLm10EEiE([130 x i32]* nonnull align 4 dereferenceable(520) %m) // CHECK-NEXT: ret void - // CHECK-LABEL: define linkonce_odr void @_Z3fooILm13EEvRu11matrix_typeIXT_ELm10EiE([130 x i32]* nonnull align 4 dereferenceable(520) %m) + // CHECK-LABEL: define linkonce_odr void @_Z3fooILm13EEvRu11matrix_typeIXT_EXLm10EEiE([130 x i32]* nonnull align 4 dereferenceable(520) %m) // CHECK-NEXT: entry: // CHECK-NEXT: %m.addr = alloca [130 x i32]*, align 8 // CHECK-NEXT: store [130 x i32]* %m, [130 x i32]** %m.addr, align 8 @@ -326,7 +326,7 @@ void test_use_matrix_2() { // CHECK-NEXT: store <40 x float> %call, <40 x float>* %0, align 4 // CHECK-NEXT: call void @_Z12use_matrix_2ILm2ELm12EE8selectorILi0EERu11matrix_typeIXplT_Li2EEXdvT0_Li2EEiERu11matrix_typeIXT_EXT0_EfE([24 x i32]* nonnull align 4 dereferenceable(96) %m1, [24 x float]* nonnull align 4 dereferenceable(96) %m2) // CHECK-NEXT: call void @_Z12use_matrix_2ILm5ELm8EE8selectorILi1EERu11matrix_typeIXplT_T0_EXT0_EiERu11matrix_typeIXT_EXmiT0_T_EfE([104 x i32]* nonnull align 4 dereferenceable(416) %m3, [15 x float]* nonnull align 4 dereferenceable(60) %m4) - // CHECK-NEXT: %call2 = call <20 x float> @_Z12use_matrix_2ILm5EEu11matrix_typeIXplT_T_EXmiT_Li3EEfERu11matrix_typeIXT_ELm10EiE([50 x i32]* nonnull align 4 dereferenceable(200) %m5) + // CHECK-NEXT: %call2 = call <20 x float> @_Z12use_matrix_2ILm5EEu11matrix_typeIXplT_T_EXmiT_Li3EEfERu11matrix_typeIXT_EXLm10EEiE([50 x i32]* nonnull align 4 dereferenceable(200) %m5) // CHECK-NEXT: %1 = bitcast [20 x float]* %r4 to <20 x float>* // CHECK-NEXT: store <20 x float> %call2, <20 x float>* %1, align 4 // CHECK-NEXT: call void @_Z12use_matrix_3ILm6EE8selectorILi2EERu11matrix_typeIXmiT_Li2EEXT_EiE([24 x i32]* nonnull align 4 dereferenceable(96) %m1) @@ -357,7 +357,7 @@ void test_use_matrix_2() { // CHECK-NEXT: call void @llvm.trap() // CHECK-NEXT: unreachable - // CHECK-LABEL: define linkonce_odr <20 x float> @_Z12use_matrix_2ILm5EEu11matrix_typeIXplT_T_EXmiT_Li3EEfERu11matrix_typeIXT_ELm10EiE([50 x i32]* nonnull align 4 dereferenceable(200) %m1) + // CHECK-LABEL: define linkonce_odr <20 x float> @_Z12use_matrix_2ILm5EEu11matrix_typeIXplT_T_EXmiT_Li3EEfERu11matrix_typeIXT_EXLm10EEiE([50 x i32]* nonnull align 4 dereferenceable(200) %m1) // CHECK-NEXT: entry: // CHECK-NEXT: %m1.addr = alloca [50 x i32]*, align 8 // CHECK-NEXT: store [50 x i32]* %m1, [50 x i32]** %m1.addr, align 8 diff --git a/clang/test/CodeGenCXX/microsoft-uuidof-mangling.cpp b/clang/test/CodeGenCXX/microsoft-uuidof-mangling.cpp index 5c02b1eb014c..ec26be292acc 100644 --- a/clang/test/CodeGenCXX/microsoft-uuidof-mangling.cpp +++ b/clang/test/CodeGenCXX/microsoft-uuidof-mangling.cpp @@ -1,5 +1,4 @@ -// RUN: %clang_cc1 -emit-llvm %s -o - -triple x86_64-unknown-unknown -fms-extensions | FileCheck %s --check-prefixes=CHECK,CHECK-V12 -// RUN: %clang_cc1 -emit-llvm %s -o - -triple x86_64-unknown-unknown -fms-extensions -fclang-abi-compat=11 | FileCheck %s --check-prefixes=CHECK,CHECK-V11 +// RUN: %clang_cc1 -emit-llvm %s -o - -triple x86_64-unknown-unknown -fms-extensions | FileCheck %s // rdar://17784718 typedef struct _GUID @@ -25,16 +24,11 @@ struct __declspec(uuid("EAFA1952-66F8-438B-8FBA-AF1BBAE42191")) TestStruct struct __declspec(uuid("EAFA1952-66F8-438B-8FBA-AF1BBAE42191")) OtherStruct {}; -template void test_uuidofType(decltype(__uuidof(T)) arg) {} +template void test_uuidofType(void *arg[sizeof(__uuidof(T))] = 0) {} -template void test_uuidofExpr(decltype(__uuidof(T::member)) arg) {} +template void test_uuidofExpr(void *arg[sizeof(__uuidof(typename T::member))] = 0) {} -struct HasMember { - TestStruct member; -}; - -// Ensure that mangling an "expr-primary" argument is handled properly. -template void test_uuidofExpr2(decltype(T{}, __uuidof(HasMember::member)) arg) {} +struct HasMember { typedef TestStruct member; }; template struct UUIDTestTwo { UUIDTestTwo(); }; @@ -45,27 +39,19 @@ int main(int argc, const char * argv[]) // type had better not mention TestStruct or OtherStruct! UUIDTestTwo<__uuidof(TestStruct)> uuidof_test2; UUIDTestTwo<__uuidof(OtherStruct)> uuidof_test3; - test_uuidofType(GUID{}); - test_uuidofExpr(GUID{}); - test_uuidofExpr2(GUID{}); + test_uuidofType(); + test_uuidofExpr(); return 0; } // CHECK: define{{.*}} i32 @main -// CHECK: call void @_ZN8UUIDTestI10TestStructL_Z42_GUID_eafa1952_66f8_438b_8fba_af1bbae42191EEC1Ev( -// CHECK: call void @_ZN11UUIDTestTwoIL_Z42_GUID_eafa1952_66f8_438b_8fba_af1bbae42191EEC1Ev( -// CHECK: call void @_ZN11UUIDTestTwoIL_Z42_GUID_eafa1952_66f8_438b_8fba_af1bbae42191EEC1Ev( -// CHECK-V11: call void @_Z15test_uuidofTypeI10TestStructEvDTu8__uuidoftT_E( -// CHECK-V12: call void @_Z15test_uuidofTypeI10TestStructEvDTu8__uuidofT_EE( -// CHECK-V11: call void @_Z15test_uuidofExprI9HasMemberEvDTu8__uuidofzsrT_6memberE( -// CHECK-V12: call void @_Z15test_uuidofExprI9HasMemberEvDTu8__uuidofXsrT_6memberEEE( -// CHECK-V11: call void @_Z16test_uuidofExpr2I10TestStructEvDTcmtlT_Eu8__uuidofzL_ZN9HasMember6memberEEE( -// CHECK-V12: call void @_Z16test_uuidofExpr2I10TestStructEvDTcmtlT_Eu8__uuidofL_ZN9HasMember6memberEEEE( +// CHECK: call void @_ZN8UUIDTestI10TestStructL_Z42_GUID_eafa1952_66f8_438b_8fba_af1bbae42191EEC1Ev +// CHECK: call void @_ZN11UUIDTestTwoIL_Z42_GUID_eafa1952_66f8_438b_8fba_af1bbae42191EEC1Ev +// CHECK: call void @_ZN11UUIDTestTwoIL_Z42_GUID_eafa1952_66f8_438b_8fba_af1bbae42191EEC1Ev +// CHECK: call void @_Z15test_uuidofTypeI10TestStructEvPPv(i8** null) +// CHECK: call void @_Z15test_uuidofExprI9HasMemberEvPPv(i8** null) + // CHECK: define linkonce_odr void @_ZN8UUIDTestI10TestStructL_Z42_GUID_eafa1952_66f8_438b_8fba_af1bbae42191EEC1Ev -// CHECK-V11: define linkonce_odr void @_Z15test_uuidofTypeI10TestStructEvDTu8__uuidoftT_E( -// CHECK-V12: define linkonce_odr void @_Z15test_uuidofTypeI10TestStructEvDTu8__uuidofT_EE( -// CHECK-V11: define linkonce_odr void @_Z15test_uuidofExprI9HasMemberEvDTu8__uuidofzsrT_6memberE( -// CHECK-V12: define linkonce_odr void @_Z15test_uuidofExprI9HasMemberEvDTu8__uuidofXsrT_6memberEEE( -// CHECK-V11: define linkonce_odr void @_Z16test_uuidofExpr2I10TestStructEvDTcmtlT_Eu8__uuidofzL_ZN9HasMember6memberEEE( -// CHECK-V12: define linkonce_odr void @_Z16test_uuidofExpr2I10TestStructEvDTcmtlT_Eu8__uuidofL_ZN9HasMember6memberEEEE( +// CHECK: define linkonce_odr void @_Z15test_uuidofTypeI10TestStructEvPPv +// CHECK: define linkonce_odr void @_Z15test_uuidofExprI9HasMemberEvPPv // CHECK: define linkonce_odr void @_ZN8UUIDTestI10TestStructL_Z42_GUID_eafa1952_66f8_438b_8fba_af1bbae42191EEC2Ev diff --git a/clang/test/CodeGenCXX/trivial_abi.cpp b/clang/test/CodeGenCXX/trivial_abi.cpp index a4222c100311..ac41f5cac086 100644 --- a/clang/test/CodeGenCXX/trivial_abi.cpp +++ b/clang/test/CodeGenCXX/trivial_abi.cpp @@ -262,21 +262,3 @@ void calleeExceptionLarge(Large, Large); void testExceptionLarge() { calleeExceptionLarge(Large(), Large()); } - -// PR42961 - -// CHECK: define{{.*}} @"_ZN3$_08__invokeEv"() -// CHECK: %[[RETVAL:.*]] = alloca %[[STRUCT_SMALL]], align 8 -// CHECK: %[[COERCE:.*]] = alloca %[[STRUCT_SMALL]], align 8 -// CHECK: %[[CALL:.*]] = call{{.*}} @"_ZNK3$_0clEv" -// CHECK: %[[COERCEDIVE:.*]] = getelementptr{{.*}} %[[COERCE]] -// CHECK: %[[COERCEVALIP:.*]] = inttoptr{{.*}} %[[CALL]] -// CHECK: %[[RETVALP:.*]] = bitcast %[[STRUCT_SMALL]]* %[[RETVAL]] -// CHECK: %[[COERCEP:.*]] = bitcast %[[STRUCT_SMALL]]* %[[COERCE]] -// CHECK: call {{.*}}memcpy{{.*}} %[[RETVALP]]{{.*}} %[[COERCEP]] -// CHECK: %[[COERCEDIVE1:.*]] = getelementptr{{.*}} %[[RETVAL]] -// CHECK: %[[TMP:.*]] = load{{.*}} %[[COERCEDIVE1]] -// CHECK: %[[COERCEVALPI:.*]] = ptrtoint{{.*}} %[[TMP]] -// CHECK: ret{{.*}} %[[COERCEVALPI]] - -Small (*fp)() = []() -> Small { return Small(); }; diff --git a/clang/test/CodeGenObjC/matrix-type-builtins.m b/clang/test/CodeGenObjC/matrix-type-builtins.m index 0d517dd4964a..f0faaace4442 100644 --- a/clang/test/CodeGenObjC/matrix-type-builtins.m +++ b/clang/test/CodeGenObjC/matrix-type-builtins.m @@ -56,7 +56,7 @@ void test_column_major_load(PtrValue *Ptr, IntValue *Stride) { // CHECK: [[STRIDE:%.*]] = call i32 bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i32 (i8*, i8*)*) // CHECK-NEXT: [[STRIDE_EXT:%.*]] = sext i32 [[STRIDE]] to i64 // CHECK: [[PTR:%.*]] = call i32* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i32* (i8*, i8*)*) - // CHECK-NEXT: call <12 x i32> @llvm.matrix.column.major.load.v12i32.i64(i32* align 4 [[PTR]], i64 [[STRIDE_EXT]], i1 false, i32 3, i32 4) + // CHECK-NEXT: call <12 x i32> @llvm.matrix.column.major.load.v12i32(i32* align 4 [[PTR]], i64 [[STRIDE_EXT]], i1 false, i32 3, i32 4) u3x4 m = __builtin_matrix_column_major_load(Ptr.value, 3, 4, Stride.value); } @@ -67,7 +67,7 @@ void test_column_major_store(UnsignedMatrixValue *M, PtrValue *Ptr, IntValue *St // CHECK: [[PTR:%.*]] = call i32* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i32* (i8*, i8*)*) // CHECK: [[IDX:%.*]] = call i32 bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i32 (i8*, i8*)*) // CHECK-NEXT: [[IDX_EXT:%.*]] = sext i32 [[IDX]] to i64 - // CHECK-NEXT: call void @llvm.matrix.column.major.store.v12i32.i64(<12 x i32> [[M]], i32* align 4 [[PTR]], i64 [[IDX_EXT]], i1 false, i32 3, i32 4) + // CHECK-NEXT: call void @llvm.matrix.column.major.store.v12i32(<12 x i32> [[M]], i32* align 4 [[PTR]], i64 [[IDX_EXT]], i1 false, i32 3, i32 4) __builtin_matrix_column_major_store(M.value, Ptr.value, Stride.value); } diff --git a/clang/test/CodeGenOpenCL/sampler.cl b/clang/test/CodeGenOpenCL/sampler.cl index 5ad8d0dbbf37..e6bda49f51c8 100644 --- a/clang/test/CodeGenOpenCL/sampler.cl +++ b/clang/test/CodeGenOpenCL/sampler.cl @@ -39,7 +39,7 @@ kernel void foo(sampler_t smp_par) { // Case 2b sampler_t smp = CLK_ADDRESS_CLAMP_TO_EDGE | CLK_NORMALIZED_COORDS_TRUE | CLK_FILTER_NEAREST; // CHECK: [[smp_ptr:%[A-Za-z0-9_\.]+]] = alloca %opencl.sampler_t addrspace(2)* - // CHECK: [[SAMP:%[0-9]+]] = call spir_func %opencl.sampler_t addrspace(2)* @__translate_sampler_initializer(i32 19) + // CHECK: [[SAMP:%[0-9]+]] = call %opencl.sampler_t addrspace(2)* @__translate_sampler_initializer(i32 19) // CHECK: store %opencl.sampler_t addrspace(2)* [[SAMP]], %opencl.sampler_t addrspace(2)** [[smp_ptr]] // Case 1b @@ -56,12 +56,12 @@ kernel void foo(sampler_t smp_par) { // Case 1a/2a fnc4smp(glb_smp); - // CHECK: [[SAMP:%[0-9]+]] = call spir_func %opencl.sampler_t addrspace(2)* @__translate_sampler_initializer(i32 35) + // CHECK: [[SAMP:%[0-9]+]] = call %opencl.sampler_t addrspace(2)* @__translate_sampler_initializer(i32 35) // CHECK: call spir_func void [[FUNCNAME]](%opencl.sampler_t addrspace(2)* [[SAMP]]) // Case 1a/2c fnc4smp(glb_smp_const); - // CHECK: [[SAMP:%[0-9]+]] = call spir_func %opencl.sampler_t addrspace(2)* @__translate_sampler_initializer(i32 35) + // CHECK: [[SAMP:%[0-9]+]] = call %opencl.sampler_t addrspace(2)* @__translate_sampler_initializer(i32 35) // CHECK: call spir_func void [[FUNCNAME]](%opencl.sampler_t addrspace(2)* [[SAMP]]) // Case 1c @@ -70,12 +70,12 @@ kernel void foo(sampler_t smp_par) { // CHECK: call spir_func void [[FUNCNAME]](%opencl.sampler_t addrspace(2)* [[SAMP]]) fnc4smp(5); - // CHECK: [[SAMP:%[0-9]+]] = call spir_func %opencl.sampler_t addrspace(2)* @__translate_sampler_initializer(i32 5) + // CHECK: [[SAMP:%[0-9]+]] = call %opencl.sampler_t addrspace(2)* @__translate_sampler_initializer(i32 5) // CHECK: call spir_func void [[FUNCNAME]](%opencl.sampler_t addrspace(2)* [[SAMP]]) const sampler_t const_smp = CLK_ADDRESS_CLAMP_TO_EDGE | CLK_NORMALIZED_COORDS_TRUE | CLK_FILTER_LINEAR; fnc4smp(const_smp); - // CHECK: [[CONST_SAMP:%[0-9]+]] = call spir_func %opencl.sampler_t addrspace(2)* @__translate_sampler_initializer(i32 35) + // CHECK: [[CONST_SAMP:%[0-9]+]] = call %opencl.sampler_t addrspace(2)* @__translate_sampler_initializer(i32 35) // CHECK: store %opencl.sampler_t addrspace(2)* [[CONST_SAMP]], %opencl.sampler_t addrspace(2)** [[CONST_SMP_PTR:%[a-zA-Z0-9]+]] fnc4smp(const_smp); // CHECK: [[SAMP:%[0-9]+]] = load %opencl.sampler_t addrspace(2)*, %opencl.sampler_t addrspace(2)** [[CONST_SMP_PTR]] @@ -83,7 +83,7 @@ kernel void foo(sampler_t smp_par) { constant sampler_t constant_smp = CLK_ADDRESS_CLAMP_TO_EDGE | CLK_NORMALIZED_COORDS_TRUE | CLK_FILTER_LINEAR; fnc4smp(constant_smp); - // CHECK: [[SAMP:%[0-9]+]] = call spir_func %opencl.sampler_t addrspace(2)* @__translate_sampler_initializer(i32 35) + // CHECK: [[SAMP:%[0-9]+]] = call %opencl.sampler_t addrspace(2)* @__translate_sampler_initializer(i32 35) // CHECK: call spir_func void [[FUNCNAME]](%opencl.sampler_t addrspace(2)* [[SAMP]]) // TODO: enable sampler initialization with non-constant integer. diff --git a/clang/test/Driver/Inputs/ohos_native_tree/llvm/bin/.keep b/clang/test/Driver/Inputs/ohos_native_tree/llvm/bin/.keep deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clang/test/Driver/Inputs/ohos_native_tree/llvm/include/c++/v1/.keep b/clang/test/Driver/Inputs/ohos_native_tree/llvm/include/c++/v1/.keep deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/arm-liteos-ohos/c++/a7_hard_neon-vfpv4/libc++.so b/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/arm-liteos-ohos/c++/a7_hard_neon-vfpv4/libc++.so deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/arm-liteos-ohos/c++/a7_soft/libc++.so b/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/arm-liteos-ohos/c++/a7_soft/libc++.so deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/arm-liteos-ohos/c++/a7_softfp_neon-vfpv4/libc++.so b/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/arm-liteos-ohos/c++/a7_softfp_neon-vfpv4/libc++.so deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/.keep b/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/.keep deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_hard_neon-vfpv4/.keep b/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_hard_neon-vfpv4/.keep deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_hard_neon-vfpv4/clang_rt.crtbegin.o b/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_hard_neon-vfpv4/clang_rt.crtbegin.o deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_hard_neon-vfpv4/clang_rt.crtend.o b/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_hard_neon-vfpv4/clang_rt.crtend.o deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_hard_neon-vfpv4/libclang_rt.builtins.a b/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_hard_neon-vfpv4/libclang_rt.builtins.a deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_soft/.keep b/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_soft/.keep deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_soft/clang_rt.crtbegin.o b/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_soft/clang_rt.crtbegin.o deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_soft/clang_rt.crtend.o b/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_soft/clang_rt.crtend.o deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_soft/libclang_rt.builtins.a b/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_soft/libclang_rt.builtins.a deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_softfp_neon-vfpv4/.keep b/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_softfp_neon-vfpv4/.keep deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_softfp_neon-vfpv4/clang_rt.crtbegin.o b/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_softfp_neon-vfpv4/clang_rt.crtbegin.o deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_softfp_neon-vfpv4/clang_rt.crtend.o b/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_softfp_neon-vfpv4/clang_rt.crtend.o deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_softfp_neon-vfpv4/libclang_rt.builtins.a b/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_softfp_neon-vfpv4/libclang_rt.builtins.a deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/clang_rt.crtbegin.o b/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/clang_rt.crtbegin.o deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/clang_rt.crtend.o b/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/clang_rt.crtend.o deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/libclang_rt.builtins.a b/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/libclang_rt.builtins.a deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clang/test/Driver/Inputs/ohos_native_tree/sysroot/usr/include/.keep b/clang/test/Driver/Inputs/ohos_native_tree/sysroot/usr/include/.keep deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clang/test/Driver/Inputs/ohos_native_tree/sysroot/usr/include/arm-liteos-ohos/.keep b/clang/test/Driver/Inputs/ohos_native_tree/sysroot/usr/include/arm-liteos-ohos/.keep deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clang/test/Driver/Inputs/ohos_native_tree/sysroot/usr/lib/.keep b/clang/test/Driver/Inputs/ohos_native_tree/sysroot/usr/lib/.keep deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clang/test/Driver/Inputs/ohos_native_tree/sysroot/usr/lib/arm-liteos-ohos/.keep b/clang/test/Driver/Inputs/ohos_native_tree/sysroot/usr/lib/arm-liteos-ohos/.keep deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clang/test/Driver/Inputs/ohos_native_tree/sysroot/usr/lib/arm-liteos-ohos/a7_hard_neon-vfpv4/.keep b/clang/test/Driver/Inputs/ohos_native_tree/sysroot/usr/lib/arm-liteos-ohos/a7_hard_neon-vfpv4/.keep deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clang/test/Driver/Inputs/ohos_native_tree/sysroot/usr/lib/arm-liteos-ohos/a7_soft/.keep b/clang/test/Driver/Inputs/ohos_native_tree/sysroot/usr/lib/arm-liteos-ohos/a7_soft/.keep deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clang/test/Driver/Inputs/ohos_native_tree/sysroot/usr/lib/arm-liteos-ohos/a7_softfp_neon-vfpv4/.keep b/clang/test/Driver/Inputs/ohos_native_tree/sysroot/usr/lib/arm-liteos-ohos/a7_softfp_neon-vfpv4/.keep deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clang/test/Driver/Xlinker-args.c b/clang/test/Driver/Xlinker-args.c index cb045a1d40ac..a44957cd8aef 100644 --- a/clang/test/Driver/Xlinker-args.c +++ b/clang/test/Driver/Xlinker-args.c @@ -17,7 +17,7 @@ // LINUX: "--no-demangle" "-e" "_start" "one" "two" "three" "four" "-z" "five" "-r" {{.*}} "-T" "a.lds" // Check that we forward '-Xlinker' and '-Wl,' on Windows. -// RUN: %clang -target i686-pc-win32 -fuse-ld=link -### \ +// RUN: %clang -target i686-pc-win32 -### \ // RUN: -Xlinker one -Wl,two %s 2>&1 | \ // RUN: FileCheck -check-prefix=WIN %s // WIN: link.exe diff --git a/clang/test/Driver/as-fno-integrated-as.c b/clang/test/Driver/as-fno-integrated-as.c deleted file mode 100644 index 866cc421e522..000000000000 --- a/clang/test/Driver/as-fno-integrated-as.c +++ /dev/null @@ -1,3 +0,0 @@ -// Make sure that for BareMetal toolchain, we able to -// disable the use of integrated assembler. -// RUN: %clang -Werror --target="arm-none-eabi" -fno-integrated-as -c %s diff --git a/clang/test/Driver/cl-inputs.c b/clang/test/Driver/cl-inputs.c index 8eb44517ee16..59455a0aa5e5 100644 --- a/clang/test/Driver/cl-inputs.c +++ b/clang/test/Driver/cl-inputs.c @@ -50,16 +50,16 @@ // RUN: %clang_cl -### /Tc - 2>&1 | FileCheck -check-prefix=STDINTc %s // STDINTc: "-x" "c" -// RUN: env LIB=%S/Inputs/cl-libs %clang_cl -fuse-ld=link -### -- %s cl-test.lib 2>&1 | FileCheck -check-prefix=LIBINPUT %s +// RUN: env LIB=%S/Inputs/cl-libs %clang_cl -### -- %s cl-test.lib 2>&1 | FileCheck -check-prefix=LIBINPUT %s // LIBINPUT: link.exe" // LIBINPUT: "cl-test.lib" -// RUN: env LIB=%S/Inputs/cl-libs %clang_cl -fuse-ld=link -### -- %s cl-test2.lib 2>&1 | FileCheck -check-prefix=LIBINPUT2 %s +// RUN: env LIB=%S/Inputs/cl-libs %clang_cl -### -- %s cl-test2.lib 2>&1 | FileCheck -check-prefix=LIBINPUT2 %s // LIBINPUT2: error: no such file or directory: 'cl-test2.lib' // LIBINPUT2: link.exe" // LIBINPUT2-NOT: "cl-test2.lib" -// RUN: %clang_cl -fuse-ld=link -### -- %s /nonexisting.lib 2>&1 | FileCheck -check-prefix=LIBINPUT3 %s +// RUN: %clang_cl -### -- %s /nonexisting.lib 2>&1 | FileCheck -check-prefix=LIBINPUT3 %s // LIBINPUT3: error: no such file or directory: '/nonexisting.lib' // LIBINPUT3: link.exe" // LIBINPUT3-NOT: "/nonexisting.lib" diff --git a/clang/test/Driver/cl-link-at-file.c b/clang/test/Driver/cl-link-at-file.c index 4e665f89b74e..50ae07fadf5b 100644 --- a/clang/test/Driver/cl-link-at-file.c +++ b/clang/test/Driver/cl-link-at-file.c @@ -7,7 +7,7 @@ // RUN: echo /link bar.lib baz.lib > %t.args // RUN: touch %t.obj -// RUN: %clang_cl -fuse-ld=link -### @%t.args -- %t.obj 2>&1 | FileCheck %s -check-prefix=ARGS +// RUN: %clang_cl -### @%t.args -- %t.obj 2>&1 | FileCheck %s -check-prefix=ARGS // If the "/link" option captures all remaining args beyond its response file, // it will also capture "--" and our input argument. In this case, Clang will // be clueless and will emit "argument unused" warnings. If PR17239 is properly diff --git a/clang/test/Driver/cl-link.c b/clang/test/Driver/cl-link.c index e2f5397e9133..142725fed8eb 100644 --- a/clang/test/Driver/cl-link.c +++ b/clang/test/Driver/cl-link.c @@ -2,14 +2,14 @@ // be interpreted as a command-line option, e.g. on Mac where %s is commonly // under /Users. -// RUN: %clang_cl /Tc%s -fuse-ld=link -### /link foo bar baz 2>&1 | FileCheck --check-prefix=LINK %s -// RUN: %clang_cl /Tc%s -fuse-ld=link -### /linkfoo bar baz 2>&1 | FileCheck --check-prefix=LINK %s +// RUN: %clang_cl /Tc%s -### /link foo bar baz 2>&1 | FileCheck --check-prefix=LINK %s +// RUN: %clang_cl /Tc%s -### /linkfoo bar baz 2>&1 | FileCheck --check-prefix=LINK %s // LINK: link.exe // LINK: "foo" // LINK: "bar" // LINK: "baz" -// RUN: %clang_cl -m32 -arch:IA32 --target=i386-pc-win32 /Tc%s -fuse-ld=link -### -fsanitize=address 2>&1 | FileCheck --check-prefix=ASAN %s +// RUN: %clang_cl -m32 -arch:IA32 --target=i386-pc-win32 /Tc%s -### -fsanitize=address 2>&1 | FileCheck --check-prefix=ASAN %s // ASAN: link.exe // ASAN: "-debug" // ASAN: "-incremental:no" @@ -19,7 +19,7 @@ // ASAN: "-wholearchive:{{.*}}clang_rt.asan_cxx-i386.lib" // ASAN: "{{.*}}cl-link{{.*}}.obj" -// RUN: %clang_cl -m32 -arch:IA32 --target=i386-pc-win32 /MD /Tc%s -fuse-ld=link -### -fsanitize=address 2>&1 | FileCheck --check-prefix=ASAN-MD %s +// RUN: %clang_cl -m32 -arch:IA32 --target=i386-pc-win32 /MD /Tc%s -### -fsanitize=address 2>&1 | FileCheck --check-prefix=ASAN-MD %s // ASAN-MD: link.exe // ASAN-MD: "-debug" // ASAN-MD: "-incremental:no" @@ -29,13 +29,13 @@ // ASAN-MD: "-wholearchive:{{.*}}clang_rt.asan_dynamic_runtime_thunk-i386.lib" // ASAN-MD: "{{.*}}cl-link{{.*}}.obj" -// RUN: %clang_cl /LD -fuse-ld=link -### /Tc%s 2>&1 | FileCheck --check-prefix=DLL %s -// RUN: %clang_cl /LDd -fuse-ld=link -### /Tc%s 2>&1 | FileCheck --check-prefix=DLL %s +// RUN: %clang_cl /LD -### /Tc%s 2>&1 | FileCheck --check-prefix=DLL %s +// RUN: %clang_cl /LDd -### /Tc%s 2>&1 | FileCheck --check-prefix=DLL %s // DLL: link.exe // "-dll" -// RUN: %clang_cl -m32 -arch:IA32 --target=i386-pc-win32 /LD /Tc%s -fuse-ld=link -### -fsanitize=address 2>&1 | FileCheck --check-prefix=ASAN-DLL %s -// RUN: %clang_cl -m32 -arch:IA32 --target=i386-pc-win32 /LDd /Tc%s -fuse-ld=link -### -fsanitize=address 2>&1 | FileCheck --check-prefix=ASAN-DLL %s +// RUN: %clang_cl -m32 -arch:IA32 --target=i386-pc-win32 /LD /Tc%s -### -fsanitize=address 2>&1 | FileCheck --check-prefix=ASAN-DLL %s +// RUN: %clang_cl -m32 -arch:IA32 --target=i386-pc-win32 /LDd /Tc%s -### -fsanitize=address 2>&1 | FileCheck --check-prefix=ASAN-DLL %s // ASAN-DLL: link.exe // ASAN-DLL: "-dll" // ASAN-DLL: "-debug" @@ -43,13 +43,13 @@ // ASAN-DLL: "{{.*}}clang_rt.asan_dll_thunk-i386.lib" // ASAN-DLL: "{{.*}}cl-link{{.*}}.obj" -// RUN: %clang_cl /Zi /Tc%s -fuse-ld=link -### 2>&1 | FileCheck --check-prefix=DEBUG %s +// RUN: %clang_cl /Zi /Tc%s -### 2>&1 | FileCheck --check-prefix=DEBUG %s // DEBUG: link.exe // DEBUG: "-debug" // PR27234 -// RUN: %clang_cl /Tc%s nonexistent.obj -fuse-ld=link -### /link /libpath:somepath 2>&1 | FileCheck --check-prefix=NONEXISTENT %s -// RUN: %clang_cl /Tc%s nonexistent.lib -fuse-ld=link -### /link /libpath:somepath 2>&1 | FileCheck --check-prefix=NONEXISTENT %s +// RUN: %clang_cl /Tc%s nonexistent.obj -### /link /libpath:somepath 2>&1 | FileCheck --check-prefix=NONEXISTENT %s +// RUN: %clang_cl /Tc%s nonexistent.lib -### /link /libpath:somepath 2>&1 | FileCheck --check-prefix=NONEXISTENT %s // NONEXISTENT-NOT: no such file // NONEXISTENT: link.exe // NONEXISTENT: "/libpath:somepath" diff --git a/clang/test/Driver/fenable-merge-functions.cpp b/clang/test/Driver/fenable-merge-functions.cpp deleted file mode 100644 index f45cdd3b09e9..000000000000 --- a/clang/test/Driver/fenable-merge-functions.cpp +++ /dev/null @@ -1,28 +0,0 @@ -// First. Check that option is passed into clangcc1 -// RUN: %clang -fenable-merge-functions -### %s 2>&1 | FileCheck %s -check-prefix=CHECK_CC1 -// CHECK_CC1: "-cc1" {{.*}} "-fmerge-functions" - -// Second. Check that code gen really activates function merging. In this case -// just check a trivial functions merging case. -// One may say, that this is an superfluous check, -// for it is covered by clang/test/CodeGen/merge-functions.c -// But it is worth keeping, because it also checks whole driver + clang interaction chain. - -// RUN: %clang -emit-llvm %s -fenable-merge-functions -c -S -o - | FileCheck %s - -void foo1() {} -void foo2() {} - -int main() { - - // If merge functions pass is enabled, - // then second and first calls will refer to foo1 - - // CHECK: call void @{{[^\(]*}}foo1{{[^\(]*}}() - foo1(); - - // CHECK: call void @{{[^\(]*}}foo1{{[^\(]*}}() - foo2(); - - return 0; -} diff --git a/clang/test/Driver/linux-ld.c b/clang/test/Driver/linux-ld.c index 24d3c78643f8..0b788ffcb852 100644 --- a/clang/test/Driver/linux-ld.c +++ b/clang/test/Driver/linux-ld.c @@ -1089,6 +1089,20 @@ // CHECK-ANDROID-HASH-STYLE-M: "{{.*}}ld{{(.exe)?}}" // CHECK-ANDROID-HASH-STYLE-M: "--hash-style=gnu" +// Check that we pass --no-rosegment for pre-29 Android versions and do not for +// 29+. +// RUN: %clang %s -### -o %t.o 2>&1 \ +// RUN: --target=armv7-linux-android28 \ +// RUN: | FileCheck --check-prefix=CHECK-ANDROID-ROSEGMENT-28 %s +// CHECK-ANDROID-ROSEGMENT-28: "{{.*}}ld{{(.exe)?}}" +// CHECK-ANDROID-ROSEGMENT-28: "--no-rosegment" +// +// RUN: %clang %s -### -o %t.o 2>&1 \ +// RUN: --target=armv7-linux-android29 \ +// RUN: | FileCheck --check-prefix=CHECK-ANDROID-ROSEGMENT-29 %s +// CHECK-ANDROID-ROSEGMENT-29: "{{.*}}ld{{(.exe)?}}" +// CHECK-ANDROID-ROSEGMENT-29-NOT: "--no-rosegment" + // RUN: %clang %s -### -o %t.o 2>&1 \ // RUN: --target=armv7-linux-android21 \ // RUN: | FileCheck --check-prefix=CHECK-ANDROID-NOEXECSTACK %s diff --git a/clang/test/Driver/mips-as.c b/clang/test/Driver/mips-as.c index f075567119e3..cd4808d14ec7 100644 --- a/clang/test/Driver/mips-as.c +++ b/clang/test/Driver/mips-as.c @@ -196,7 +196,7 @@ // RUN: %clang -target mips-linux-gnu -mno-mips16 -mips16 -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-16 %s -// MIPS-16: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "32" "-mno-shared" "-call_nonpic" "-EB" "-mfpxx" "-mips16" +// MIPS-16: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "32" "-mno-shared" "-call_nonpic" "-EB" "-mips16" // // RUN: %clang -target mips-linux-gnu -mips16 -mno-mips16 -### \ // RUN: -no-integrated-as -c %s 2>&1 \ @@ -207,7 +207,7 @@ // RUN: %clang -target mips-linux-gnu -mno-micromips -mmicromips -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-MICRO %s -// MIPS-MICRO: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "32" "-mno-shared" "-call_nonpic" "-EB" "-mfpxx" "-mmicromips" +// MIPS-MICRO: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "32" "-mno-shared" "-call_nonpic" "-EB" "-mmicromips" // // RUN: %clang -target mips-linux-gnu -mmicromips -mno-micromips -### \ // RUN: -no-integrated-as -c %s 2>&1 \ @@ -218,7 +218,7 @@ // RUN: %clang -target mips-linux-gnu -mno-dsp -mdsp -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-DSP %s -// MIPS-DSP: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "32" "-mno-shared" "-call_nonpic" "-EB" "-mfpxx" "-mdsp" +// MIPS-DSP: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "32" "-mno-shared" "-call_nonpic" "-EB" "-mdsp" // // RUN: %clang -target mips-linux-gnu -mdsp -mno-dsp -### \ // RUN: -no-integrated-as -c %s 2>&1 \ @@ -229,7 +229,7 @@ // RUN: %clang -target mips-linux-gnu -mno-dspr2 -mdspr2 -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-DSPR2 %s -// MIPS-DSPR2: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "32" "-mno-shared" "-call_nonpic" "-EB" "-mfpxx" "-mdspr2" +// MIPS-DSPR2: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "32" "-mno-shared" "-call_nonpic" "-EB" "-mdspr2" // // RUN: %clang -target mips-linux-gnu -mdspr2 -mno-dspr2 -### \ // RUN: -no-integrated-as -c %s 2>&1 \ @@ -266,7 +266,7 @@ // RUN: %clang -target mips-linux-gnu -mno-msa -mmsa -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-MSA %s -// MIPS-MSA: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "32" "-mno-shared" "-call_nonpic" "-EB" "-mfpxx" "-mmsa" +// MIPS-MSA: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "32" "-mno-shared" "-call_nonpic" "-EB" "-mmsa" // // RUN: %clang -target mips-linux-gnu -mmsa -mno-msa -### \ // RUN: -no-integrated-as -c %s 2>&1 \ diff --git a/clang/test/Driver/mips-integrated-as.s b/clang/test/Driver/mips-integrated-as.s index e248ba7f77e9..46ce5b6871f4 100644 --- a/clang/test/Driver/mips-integrated-as.s +++ b/clang/test/Driver/mips-integrated-as.s @@ -160,8 +160,8 @@ // RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s 2>&1 | \ // RUN: FileCheck -check-prefix=FPXX-DEFAULT %s // FPXX-DEFAULT: -cc1as -// FPXX-DEFAULT: "-target-feature" "+fpxx" -// FPXX-DEFAULT: "-target-feature" "+nooddspreg" +// FPXX-DEFAULT-NOT: "-target-feature" "+fpxx" +// FPXX-DEFAULT-NOT: "-target-feature" "+nooddspreg" // RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -mfp32 2>&1 | \ // RUN: FileCheck -check-prefix=FP32 %s @@ -182,7 +182,7 @@ // RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s 2>&1 | \ // RUN: FileCheck -check-prefix=ODDSPREG-DEFAULT %s // ODDSPREG-DEFAULT: -cc1as -// ODDSPREG-DEFAULT: "-target-feature" "+nooddspreg" +// ODDSPREG-DEFAULT-NOT: "-target-feature" "{{[+-]}}nooddspreg" // RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -modd-spreg 2>&1 | \ // RUN: FileCheck -check-prefix=ODDSPREG-ON %s diff --git a/clang/test/Driver/msvc-link.c b/clang/test/Driver/msvc-link.c index 1ee17fc63c32..13dccd21bfd8 100644 --- a/clang/test/Driver/msvc-link.c +++ b/clang/test/Driver/msvc-link.c @@ -1,4 +1,4 @@ -// RUN: %clang -target i686-pc-windows-msvc -fuse-ld=link -### %s 2>&1 | FileCheck --check-prefix=BASIC %s +// RUN: %clang -target i686-pc-windows-msvc -### %s 2>&1 | FileCheck --check-prefix=BASIC %s // BASIC: link.exe" // BASIC: "-out:a.exe" // BASIC: "-defaultlib:libcmt" @@ -6,7 +6,7 @@ // BASIC: "-nologo" // BASIC-NOT: "-Brepro" -// RUN: %clang -target i686-pc-windows-msvc -shared -o a.dll -fuse-ld=link -### %s 2>&1 | FileCheck --check-prefix=DLL %s +// RUN: %clang -target i686-pc-windows-msvc -shared -o a.dll -### %s 2>&1 | FileCheck --check-prefix=DLL %s // DLL: link.exe" // DLL: "-out:a.dll" // DLL: "-defaultlib:libcmt" @@ -19,13 +19,13 @@ // LIBPATH: "-libpath:/usr/lib" // LIBPATH: "-nologo" -// RUN: %clang_cl /Brepro -fuse-ld=link -### -- %s 2>&1 | FileCheck --check-prefix=REPRO %s +// RUN: %clang_cl /Brepro -### -- %s 2>&1 | FileCheck --check-prefix=REPRO %s // REPRO: link.exe" // REPRO: "-out:msvc-link.exe" // REPRO: "-nologo" // REPRO: "-Brepro" -// RUN: %clang_cl /Brepro- -fuse-ld=link -### -- %s 2>&1 | FileCheck --check-prefix=NOREPRO %s +// RUN: %clang_cl /Brepro- -### -- %s 2>&1 | FileCheck --check-prefix=NOREPRO %s // NOREPRO: link.exe" // NOREPRO: "-out:msvc-link.exe" // NOREPRO: "-nologo" diff --git a/clang/test/Driver/ohos.c b/clang/test/Driver/ohos.c deleted file mode 100644 index 8883dc69382a..000000000000 --- a/clang/test/Driver/ohos.c +++ /dev/null @@ -1,249 +0,0 @@ -// RUN: %clang %s -### -no-canonical-prefixes --target=arm-liteos \ -// RUN: -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \ -// RUN: --sysroot=%S/Inputs/ohos_native_tree/sysroot -fuse-ld=lld -march=armv7-a 2>&1 \ -// RUN: | FileCheck -check-prefixes=CHECK,CHECK-ARM %s -// RUN: %clang %s -### -no-canonical-prefixes --target=arm-liteos \ -// RUN: -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \ -// RUN: --sysroot=%S/Inputs/ohos_native_tree/sysroot -fuse-ld=lld -march=armv7-a -mcpu=cortex-a7 -mfloat-abi=soft 2>&1 \ -// RUN: | FileCheck -check-prefixes=CHECK,CHECK-ARM-A7-SOFT %s -// CHECK: {{.*}}clang{{.*}}" "-cc1" -// CHECK-NOT: "--mrelax-relocations" -// CHECK-NOT: "-munwind-tables" -// CHECK: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" -// CHECK: "-isysroot" "[[SYSROOT:[^"]+]]" -// CHECK: "-internal-externc-isystem" "[[SYSROOT]]{{/|\\\\}}include" -// CHECK-NOT: "-fsanitize=safe-stack" -// CHECK-NOT: "-stack-protector" "2" -// CHECK-NOT: "-fno-common" -// CHECK: {{.*}}ld.lld{{.*}}" "--sysroot=[[SYSROOT]]" -// CHECK-NOT: "--sysroot=[[SYSROOT]]" -// CHECK: "-pie" -// CHECK: "-z" "noexecstack" -// CHECK-NOT: "--build-id" -// CHECK: "--hash-style=gnu" -// CHECK: "--hash-style=both" -// CHECK: "-dynamic-linker" "/lib/ld-musl-arm.so.1" -// CHECK: Scrt1.o -// CHECK: crti.o -// CHECK: clang_rt.crtbegin.o -// CHECK-ARM: "-L[[SYSROOT]]/usr/lib/arm-liteos-ohos/" -// CHECK-ARM-A7-SOFT: "-L[[SYSROOT]]/usr/lib/arm-liteos-ohos/a7_soft" -// CHECK-ARM: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}libclang_rt.builtins.a" -// CHECK-ARM-A7-SOFT: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos/a7_soft{{/|\\\\}}libclang_rt.builtins.a" -// CHECK: "-lc" -// CHECK: clang_rt.crtend.o -// CHECK: crtn.o - -// RUN: %clang %s -### --target=arm-liteos -rtlib=libgcc -fuse-ld=lld 2>&1 \ -// RUN: | FileCheck %s -check-prefix=CHECK-RTLIB -// CHECK-RTLIB: error: invalid runtime library name in argument '-rtlib=libgcc' - -// RUN: %clang %s -### --target=arm-liteos -static -fuse-ld=lld 2>&1 \ -// RUN: | FileCheck %s -check-prefix=CHECK-STATIC -// CHECK-STATIC: "-Bstatic" -// CHECK-STATIC-NOT: "-Bdynamic" -// CHECK-STATIC: "-l:libunwind.a" -// CHECK-STATIC: "-lc" - -// RUN: %clang %s -### --target=arm-liteos -shared -fuse-ld=lld 2>&1 \ -// RUN: | FileCheck %s -check-prefix=CHECK-SHARED -// CHECK-SHARED-NOT: "-pie" -// CHECK-SHARED: "-shared" -// CHECK-SHARED: "-lc" -// CHECK-SHARED: "-l:libunwind.a" - -// RUN: %clang %s -### --target=arm-linux-ohos -fuse-ld=lld 2>&1 \ -// RUN: | FileCheck %s -check-prefix=CHECK-RUNTIME -// RUN: %clang %s -### --target=aarch64-linux-ohos -fuse-ld=lld 2>&1 \ -// RUN: | FileCheck %s -check-prefix=CHECK-RUNTIME -// RUN: %clang %s -### --target=mipsel-linux-ohos -fuse-ld=lld 2>&1 \ -// RUN: | FileCheck %s -check-prefix=CHECK-RUNTIME -// RUN: %clang %s -### --target=x86_64-linux-ohos -fuse-ld=lld 2>&1 \ -// RUN: | FileCheck %s -check-prefix=CHECK-RUNTIME -// CHECK-RUNTIME: "{{.*}}/libclang_rt.builtins.a" -// CHECK-RUNTIME: "-l:libunwind.a" -// CHECK-LIBM: "-lm" - -// RUN: %clang %s -### --target=arm-liteos -r -fuse-ld=lld 2>&1 \ -// RUN: | FileCheck %s -check-prefix=CHECK-RELOCATABLE -// CHECK-RELOCATABLE-NOT: "-pie" -// CHECK-RELOCATABLE-NOT: "--build-id" -// CHECK-RELOCATABLE: "-r" - -// RUN: %clang %s -### --target=arm-liteos -nodefaultlibs -fuse-ld=lld 2>&1 \ -// RUN: -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \ -// RUN: | FileCheck %s -check-prefix=CHECK-NODEFAULTLIBS -// CHECK-NODEFAULTLIBS: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" -// CHECK-NODEFAULTLIBS-NOT: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}libclang_rt.builtins.a" -// CHECK-NODEFAULTLIBS-NOT: "-lc" - -// RUN: %clang %s -### --target=arm-liteos -nostdlib -fuse-ld=lld 2>&1 \ -// RUN: -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \ -// RUN: | FileCheck %s -check-prefix=CHECK-NOSTDLIB -// CHECK-NOSTDLIB: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" -// CHECK-NOSTDLIB-NOT: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}libclang_rt.builtins.a" -// CHECK-NOSTDLIB-NOT: "-lc" - -// RUN: %clang %s -### --target=arm-liteos -nolibc -fuse-ld=lld 2>&1 \ -// RUN: -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \ -// RUN: | FileCheck %s -check-prefix=CHECK-NOLIBC -// CHECK-NOLIBC: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" -// CHECK-NOLIBC: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}libclang_rt.builtins.a" -// CHECK-NOLIBC-NOT: "-lc" - -// RUN: %clang %s -### --target=arm-liteos \ -// RUN: -fsanitize=safe-stack 2>&1 \ -// RUN: -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \ -// RUN: -fuse-ld=lld \ -// RUN: | FileCheck %s -check-prefix=CHECK-SAFESTACK -// CHECK-SAFESTACK: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" -// CHECK-SAFESTACK: "-fsanitize=safe-stack" -// CHECK-SAFESTACK: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}libclang_rt.safestack.a" -// CHECK-SAFESTACK: "__safestack_init" - -// RUN: %clang %s -### --target=arm-liteos \ -// RUN: -fsanitize=address 2>&1 \ -// RUN: -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \ -// RUN: -fuse-ld=lld \ -// RUN: | FileCheck %s -check-prefix=CHECK-ASAN-ARM -// CHECK-ASAN-ARM: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" -// CHECK-ASAN-ARM: "-fsanitize=address" -// CHECK-ASAN-ARM: "-fsanitize-address-use-after-scope" -// CHECK-ASAN-ARM: "-dynamic-linker" "/lib/ld-musl-arm.so.1" -// CHECK-ASAN-ARM: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}libclang_rt.asan.a" -// CHECK-ASAN-ARM-NOT: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}libclang_rt.asan-preinit.a" - -// RUN: %clang %s -### --target=arm-liteos \ -// RUN: -fsanitize=address -fPIC -shared 2>&1 \ -// RUN: -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \ -// RUN: -shared-libsan \ -// RUN: -fuse-ld=lld \ -// RUN: | FileCheck %s -check-prefix=CHECK-ASAN-SHARED -// CHECK-ASAN-SHARED: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" -// CHECK-ASAN-SHARED: "-fsanitize=address" -// CHECK-ASAN-SHARED: "-fsanitize-address-use-after-scope" -// CHECK-ASAN-SHARED: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}libclang_rt.asan.so" -// CHECK-ASAN-SHARED-NOT: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}libclang_rt.asan-preinit.a" - -// RUN: %clang %s -### --target=arm-liteos \ -// RUN: -fsanitize=fuzzer 2>&1 \ -// RUN: -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \ -// RUN: -fuse-ld=lld \ -// RUN: | FileCheck %s -check-prefix=CHECK-FUZZER-ARM -// CHECK-FUZZER-ARM: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" -// CHECK-FUZZER-ARM: "-fsanitize=fuzzer,fuzzer-no-link" -// CHECK-FUZZER-ARM: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}libclang_rt.fuzzer.a" - -// RUN: %clang %s -### --target=arm-liteos \ -// RUN: -fsanitize=scudo 2>&1 \ -// RUN: -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \ -// RUN: -fuse-ld=lld \ -// RUN: | FileCheck %s -check-prefix=CHECK-SCUDO-ARM -// CHECK-SCUDO-ARM: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" -// CHECK-SCUDO-ARM: "-fsanitize=scudo" -// CHECK-SCUDO-ARM: "-pie" -// CHECK-SCUDO-ARM: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}libclang_rt.scudo.a" - -// RUN: %clang %s -### --target=arm-liteos \ -// RUN: -fsanitize=scudo -fPIC -shared 2>&1 \ -// RUN: -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \ -// RUN: -shared-libsan \ -// RUN: -fuse-ld=lld \ -// RUN: | FileCheck %s -check-prefix=CHECK-SCUDO-SHARED -// CHECK-SCUDO-SHARED: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" -// CHECK-SCUDO-SHARED: "-fsanitize=scudo" -// CHECK-SCUDO-SHARED: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}libclang_rt.scudo.so" - -// RUN: %clang %s -### --target=arm-liteos \ -// RUN: -fxray-instrument -fxray-modes=xray-basic \ -// RUN: -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \ -// RUN: -fuse-ld=lld 2>&1 \ -// RUN: | FileCheck %s -check-prefix=CHECK-XRAY-ARM -// CHECK-XRAY-ARM: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" -// CHECK-XRAY-ARM: "-fxray-instrument" -// CHECK-XRAY-ARM: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}libclang_rt.xray.a" -// CHECK-XRAY-ARM: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}libclang_rt.xray-basic.a" - -// RUN: %clang %s -### --target=arm-liteos \ -// RUN: -O3 -flto -mcpu=cortex-a53 2>&1 \ -// RUN: -fuse-ld=lld \ -// RUN: | FileCheck %s -check-prefix=CHECK-LTO -// CHECK-LTO: "-plugin-opt=mcpu=cortex-a53" -// CHECK-LTO: "-plugin-opt=O3" - -// RUN: %clang %s -### --target=arm-liteos \ -// RUN: -flto=thin -flto-jobs=8 -mcpu=cortex-a7 2>&1 \ -// RUN: -fuse-ld=lld \ -// RUN: | FileCheck %s -check-prefix=CHECK-THINLTO -// CHECK-THINLTO: "-plugin-opt=mcpu=cortex-a7" -// CHECK-THINLTO: "-plugin-opt=thinlto" -// CHECK-THINLTO: "-plugin-opt=jobs=8" - -// RUN: %clang %s -### --target=arm-liteos \ -// RUN: -ccc-install-dir %S/Inputs/ohos_native_tree/llvm/bin \ -// RUN: -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \ -// RUN: --sysroot=%S/Inputs/ohos_native_tree/sysroot \ -// RUN: -march=armv7-a -mfloat-abi=soft 2>&1\ -// RUN: | FileCheck %s -check-prefixes=CHECK-MULTILIB,CHECK-MULTILIB-SF,CHECK-MULTILIB-ARM -// RUN: %clang %s -### --target=arm-liteos \ -// RUN: -ccc-install-dir %S/Inputs/ohos_native_tree/llvm/bin \ -// RUN: -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \ -// RUN: --sysroot=%S/Inputs/ohos_native_tree/sysroot \ -// RUN: -march=armv7-a -mcpu=cortex-a7 -mfloat-abi=soft 2>&1\ -// RUN: | FileCheck %s -check-prefixes=CHECK-MULTILIB,CHECK-MULTILIB-SF,CHECK-MULTILIB-ARM-A7-SOFT -// RUN: %clang %s -### --target=arm-liteos \ -// RUN: -ccc-install-dir %S/Inputs/ohos_native_tree/llvm/bin \ -// RUN: -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \ -// RUN: --sysroot=%S/Inputs/ohos_native_tree/sysroot \ -// RUN: -march=armv7-a -mcpu=cortex-a7 -mfloat-abi=softfp -mfpu=neon-vfpv4 2>&1\ -// RUN: | FileCheck %s -check-prefixes=CHECK-MULTILIB,CHECK-MULTILIB-SF,CHECK-MULTILIB-ARM-A7-SOFTFP -// RUN: %clang %s -### --target=arm-liteos \ -// RUN: -ccc-install-dir %S/Inputs/ohos_native_tree/llvm/bin \ -// RUN: -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \ -// RUN: --sysroot=%S/Inputs/ohos_native_tree/sysroot \ -// RUN: -march=armv7-a -mcpu=cortex-a7 -mfloat-abi=hard -mfpu=neon-vfpv4 2>&1\ -// RUN: | FileCheck %s -check-prefixes=CHECK-MULTILIB,CHECK-MULTILIB-HF,CHECK-MULTILIB-ARM-A7-HARD -// CHECK-MULTILIB: {{.*}}clang{{.*}}" "-cc1" -// CHECK-MULTILIB: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" -// CHECK-MULTILIB: "-isysroot" "[[SYSROOT:[^"]+]]" -// CHECK-MULTILIB: {{.*}}ld.lld{{.*}}" "--sysroot=[[SYSROOT]]" -// CHECK-MULTILIB-SF: "-dynamic-linker" "/lib/ld-musl-arm.so.1" -// CHECK-MULTILIB-HF: "-dynamic-linker" "/lib/ld-musl-armhf.so.1" - -// CHECK-MULTILIB-ARM: "-L[[SYSROOT]]/usr/lib/arm-liteos-ohos/" - -// CHECK-MULTILIB-ARM-A7-SOFT: "-L[[SYSROOT]]/usr/lib/arm-liteos-ohos/a7_soft" - -// CHECK-MULTILIB-ARM-A7-SOFTFP: "-L[[SYSROOT]]/usr/lib/arm-liteos-ohos/a7_softfp_neon-vfpv4" - -// CHECK-MULTILIB-ARM-A7-HARD: "-L[[SYSROOT]]/usr/lib/arm-liteos-ohos/a7_hard_neon-vfpv4" - -// CHECK-MULTILIB-ARM: "[[RESOURCE_DIR]]/lib/arm-liteos-ohos/libclang_rt.builtins.a" -// CHECK-MULTILIB-ARM-A7-SOFT: "[[RESOURCE_DIR]]/lib/arm-liteos-ohos/a7_soft/libclang_rt.builtins.a" -// CHECK-MULTILIB-ARM-A7-SOFTFP: "[[RESOURCE_DIR]]/lib/arm-liteos-ohos/a7_softfp_neon-vfpv4/libclang_rt.builtins.a" -// CHECK-MULTILIB-ARM-A7-HARD: "[[RESOURCE_DIR]]/lib/arm-liteos-ohos/a7_hard_neon-vfpv4/libclang_rt.builtins.a" - -// RUN: %clang %s -### -no-canonical-prefixes --target=arm-linux-ohos -fprofile-instr-generate -v \ -// RUN: -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \ -// RUN: --sysroot=%S/Inputs/ohos_native_tree/sysroot -fuse-ld=lld -march=armv7-a 2>&1 \ -// RUN: | FileCheck -check-prefixes=CHECK-PROFILE-RTLIB %s - -// CHECK-PROFILE-RTLIB: -u__llvm_profile_runtime -// CHECK-PROFILE-RTLIB: libclang_rt.profile - -// RUN: %clang %s -### -o %t.o 2>&1 \ -// RUN: --target=armv7-linux-ohos \ -// RUN: | FileCheck --check-prefix=CHECK-OHOS-WARN-SHARED-TEXTREL %s - -// CHECK-OHOS-WARN-SHARED-TEXTREL: "{{.*}}ld{{(.exe)?}}" -// CHECK-OHOS-WARN-SHARED-TEXTREL: "--warn-shared-textrel" - -// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ -// RUN: --target=arm64-linux-ohos -pthread \ -// RUN: --gcc-toolchain="" \ -// RUN: --sysroot=%S/Inputs/ohos_native_tree/sysroot \ -// RUN: -shared \ -// RUN: | FileCheck --check-prefix=CHECK-OHOS-PTHREAD %s - -// CHECK-OHOS-PTHREAD-NOT: -lpthread - diff --git a/clang/test/Driver/ohos.cpp b/clang/test/Driver/ohos.cpp deleted file mode 100644 index d0fe244c6e78..000000000000 --- a/clang/test/Driver/ohos.cpp +++ /dev/null @@ -1,123 +0,0 @@ -// RUN: %clangxx %s -### -no-canonical-prefixes --target=arm-liteos -march=armv7-a \ -// RUN: -ccc-install-dir %S/Inputs/ohos_native_tree/llvm/bin \ -// RUN: -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \ -// RUN: --sysroot=%S/Inputs/ohos_native_tree/sysroot -fuse-ld=lld 2>&1 | FileCheck %s -// CHECK: {{.*}}clang{{.*}}" "-cc1" -// CHECK: "-triple" "armv7-unknown-liteos-ohos" -// CHECK-NOT: "-fuse-init-array" -// CHECK: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" -// CHECK: "-isysroot" "[[SYSROOT:[^"]+]]" -// CHECK: "-internal-isystem" "{{.*[/\\]}}include{{/|\\\\}}c++{{/|\\\\}}v1" -// CHECK: "-internal-externc-isystem" "[[SYSROOT]]{{/|\\\\}}include" -// CHECK: {{.*}}ld.lld{{.*}}" "--sysroot=[[SYSROOT]]" -// CHECK: "-pie" -// CHECK: "-z" "noexecstack" -// CHECK-NOT: "--build-id" -// CHECK: "-dynamic-linker" "/lib/ld-musl-arm.so.1" -// CHECK: Scrt1.o -// CHECK: crti.o -// CHECK: clang_rt.crtbegin.o -// CHECK: "-L{{.*[/\\]}}lib/arm-liteos-ohos/c++/" -// CHECK-NOT: "--push-state" -// CHECK-NOT: "--as-needed" -// CHECK: "-lc++" -// CHECK: "-lm" -// CHECK-NOT: "--pop-state" -// CHECK: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}libclang_rt.builtins.a" -// CHECK: "-lc" -// CHECK: clang_rt.crtend.o -// CHECK: crtn.o - -// RUN: %clangxx %s -### --target=arm-unknown-liteos -stdlib=libstdc++ \ -// RUN: -fuse-ld=lld 2>&1 \ -// RUN: | FileCheck %s -check-prefix=CHECK-STDLIB -// CHECK-STDLIB: error: invalid library name in argument '-stdlib=libstdc++' - -// RUN: %clangxx %s -### --target=arm-unknown-liteos -static-libstdc++ \ -// RUN: -fuse-ld=lld 2>&1 \ -// RUN: | FileCheck %s -check-prefix=CHECK-STATIC -// CHECK-STATIC-NOT: "--push-state" -// CHECK-STATIC-NOT: "--as-needed" -// CHECK-STATIC: "-Bstatic" -// CHECK-STATIC: "-lc++" -// CHECK-STATIC: "-Bdynamic" -// CHECK-STATIC: "-lm" -// CHECK-STATIC-NOT: "--pop-state" -// CHECK-STATIC: "-lc" - -// RUN: %clangxx %s -### --target=arm-unknown-liteos -static \ -// RUN: -fuse-ld=lld 2>&1 \ -// RUN: | FileCheck %s -check-prefix=CHECK-STATIC1 -// CHECK-STATIC1-NOT: "-fuse-init-array" -// CHECK-STATIC1: "-Bstatic" -// CHECK-STATIC1: "-lc++" -// CHECK-STATIC1: "-lc++abi" -// CHECK-STATIC1: "-lunwind" -// CHECK-STATIC1: "-lm" -// CHECK-STATIC1: "-lc" - -// RUN: %clangxx %s -### --target=arm-unknown-liteos -march=armv7-a -mfloat-abi=soft -static -fPIE -fPIC -fpic -pie \ -// RUN: --sysroot=%S/Inputs/ohos_native_tree/sysroot -fuse-ld=lld 2>&1 \ -// RUN: | FileCheck %s -check-prefix=CHECK-STATIC2 -// CHECK-STATIC2: "-isysroot" "[[SYSROOT:[^"]+]]" -// CHECK-STATIC2: {{.*}}ld.lld{{.*}}" "--sysroot=[[SYSROOT]]" -// CHECK-STATIC2: "-Bstatic" -// CHECK-STATIC2: "-lc++" -// CHECK-STATIC2: "-lc++abi" -// CHECK-STATIC2: "-lunwind" -// CHECK-STATIC2: "-lm" -// CHECK-STATIC2: "-lc" - -// RUN: %clangxx %s -### --target=arm-liteos -nostdlib++ -fuse-ld=lld 2>&1 \ -// RUN: | FileCheck %s -check-prefix=CHECK-NOSTDLIBXX -// CHECK-NOSTDLIBXX-NOT: "-lc++" -// CHECK-NOSTDLIBXX: "-lm" -// CHECK-NOSTDLIBXX: "-lc" - -// RUN: %clangxx %s -### --target=arm-liteos \ -// RUN: -ccc-install-dir %S/Inputs/ohos_native_tree/llvm/bin \ -// RUN: -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \ -// RUN: --sysroot=%S/Inputs/ohos_native_tree/sysroot \ -// RUN: -march=armv7-a -mfloat-abi=soft 2>&1\ -// RUN: | FileCheck %s -check-prefixes=CHECK-MULTILIB,CHECK-MULTILIB-SF,CHECK-MULTILIB-ARM -// RUN: %clangxx %s -### --target=arm-liteos \ -// RUN: -ccc-install-dir %S/Inputs/ohos_native_tree/llvm/bin \ -// RUN: -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \ -// RUN: --sysroot=%S/Inputs/ohos_native_tree/sysroot \ -// RUN: -march=armv7-a -mcpu=cortex-a7 -mfloat-abi=soft 2>&1\ -// RUN: | FileCheck %s -check-prefixes=CHECK-MULTILIB,CHECK-MULTILIB-SF,CHECK-MULTILIB-ARM-A7-SOFT -// RUN: %clangxx %s -### --target=arm-liteos \ -// RUN: -ccc-install-dir %S/Inputs/ohos_native_tree/llvm/bin \ -// RUN: -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \ -// RUN: --sysroot=%S/Inputs/ohos_native_tree/sysroot \ -// RUN: -march=armv7-a -mcpu=cortex-a7 -mfloat-abi=softfp -mfpu=neon-vfpv4 2>&1\ -// RUN: | FileCheck %s -check-prefixes=CHECK-MULTILIB,CHECK-MULTILIB-SF,CHECK-MULTILIB-ARM-A7-SOFTFP -// RUN: %clangxx %s -### --target=arm-liteos \ -// RUN: -ccc-install-dir %S/Inputs/ohos_native_tree/llvm/bin \ -// RUN: -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \ -// RUN: --sysroot=%S/Inputs/ohos_native_tree/sysroot \ -// RUN: -march=armv7-a -mcpu=cortex-a7 -mfloat-abi=hard -mfpu=neon-vfpv4 2>&1\ -// RUN: | FileCheck %s -check-prefixes=CHECK-MULTILIB,CHECK-MULTILIB-HF,CHECK-MULTILIB-ARM-A7-HARD -// CHECK-MULTILIB: {{.*}}clang{{.*}}" "-cc1" -// CHECK-MULTILIB: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" -// CHECK-MULTILIB: "-isysroot" "[[SYSROOT:[^"]+]]" -// CHECK-MULTILIB: {{.*}}ld.lld{{.*}}" "--sysroot=[[SYSROOT]]" -// CHECK-MULTILIB-SF: "-dynamic-linker" "/lib/ld-musl-arm.so.1" -// CHECK-MULTILIB-HF: "-dynamic-linker" "/lib/ld-musl-armhf.so.1" - -// CHECK-MULTILIB-ARM: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}c++/" -// CHECK-MULTILIB-ARM: "-L[[SYSROOT]]/usr/lib/arm-liteos-ohos/" - -// CHECK-MULTILIB-ARM-A7-SOFT: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}c++/a7_soft" -// CHECK-MULTILIB-ARM-A7-SOFT: "-L[[SYSROOT]]/usr/lib/arm-liteos-ohos/a7_soft" - -// CHECK-MULTILIB-ARM-A7-SOFTFP: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}c++{{/|\\\\}}a7_softfp_neon-vfpv4" -// CHECK-MULTILIB-ARM-A7-SOFTFP: "-L[[SYSROOT]]/usr/lib/arm-liteos-ohos/a7_softfp_neon-vfpv4" - -// CHECK-MULTILIB-ARM-A7-HARD: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}c++{{/|\\\\}}a7_hard_neon-vfpv4" -// CHECK-MULTILIB-ARM-A7-HARD: "-L[[SYSROOT]]/usr/lib/arm-liteos-ohos/a7_hard_neon-vfpv4" - -// CHECK-MULTILIB-ARM: "[[RESOURCE_DIR]]/lib/arm-liteos-ohos/libclang_rt.builtins.a" -// CHECK-MULTILIB-ARM-A7-SOFT: "[[RESOURCE_DIR]]/lib/arm-liteos-ohos/a7_soft/libclang_rt.builtins.a" -// CHECK-MULTILIB-ARM-A7-SOFTFP: "[[RESOURCE_DIR]]/lib/arm-liteos-ohos/a7_softfp_neon-vfpv4/libclang_rt.builtins.a" -// CHECK-MULTILIB-ARM-A7-HARD: "[[RESOURCE_DIR]]/lib/arm-liteos-ohos/a7_hard_neon-vfpv4/libclang_rt.builtins.a" diff --git a/clang/test/Driver/openbsd.cpp b/clang/test/Driver/openbsd.cpp index 23c365d28e7e..9293148680c8 100644 --- a/clang/test/Driver/openbsd.cpp +++ b/clang/test/Driver/openbsd.cpp @@ -6,7 +6,7 @@ // RUN: | FileCheck --check-prefix=CHECK-CXX %s // RUN: %clangxx %s -### -o %t.o -target arm-unknown-openbsd 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-CXX %s -// CHECK-CXX: "-lc++" "-lc++abi" "-lpthread" "-lm" +// CHECK-CXX: "-lc++" "-lc++abi" "-lm" // RUN: %clangxx %s -### -pg -o %t.o -target amd64-pc-openbsd 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-PG-CXX %s @@ -16,4 +16,4 @@ // RUN: | FileCheck --check-prefix=CHECK-PG-CXX %s // RUN: %clangxx %s -### -pg -o %t.o -target arm-unknown-openbsd 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-PG-CXX %s -// CHECK-PG-CXX: "-lc++_p" "-lc++abi_p" "-lpthread_p" "-lm_p" +// CHECK-PG-CXX: "-lc++_p" "-lc++abi_p" "-lm_p" diff --git a/clang/test/Driver/ppc-f128-support-check.c b/clang/test/Driver/ppc-f128-support-check.c index 24748905612f..2e4b7a7ae09c 100644 --- a/clang/test/Driver/ppc-f128-support-check.c +++ b/clang/test/Driver/ppc-f128-support-check.c @@ -1,7 +1,7 @@ // RUN: not %clang -target powerpc64le-unknown-linux-gnu -fsyntax-only \ -// RUN: -mcpu=pwr9 -mfloat128 %s 2>&1 | FileCheck %s --check-prefix=HASF128 +// RUN: -mcpu=pwr9 %s 2>&1 | FileCheck %s --check-prefix=HASF128 // RUN: not %clang -target powerpc64le-unknown-linux-gnu -fsyntax-only \ -// RUN: -mcpu=power9 -mfloat128 %s 2>&1 | FileCheck %s --check-prefix=HASF128 +// RUN: -mcpu=power9 %s 2>&1 | FileCheck %s --check-prefix=HASF128 // RUN: not %clang -target powerpc64le-unknown-linux-gnu -fsyntax-only \ // RUN: -mcpu=pwr8 -mfloat128 %s 2>&1 | FileCheck %s --check-prefix=NOF128 diff --git a/clang/test/Driver/pseudo-probe-lto.c b/clang/test/Driver/pseudo-probe-lto.c deleted file mode 100644 index e319b8c0098b..000000000000 --- a/clang/test/Driver/pseudo-probe-lto.c +++ /dev/null @@ -1,10 +0,0 @@ -// RUN: touch %t.o -// RUN: %clang -### %t.o -target x86_64-unknown-linux -flto -fpseudo-probe-for-profiling 2>&1 | FileCheck %s --check-prefix=PROBE -// RUN: %clang -### %t.o -target x86_64-unknown-linux -flto=thin -fpseudo-probe-for-profiling 2>&1 | FileCheck %s --check-prefix=PROBE -// RUN: %clang -### %t.o -target x86_64-unknown-linux -flto -fno-pseudo-probe-for-profiling -fpseudo-probe-for-profiling 2>&1 | FileCheck %s --check-prefix=PROBE -// RUN: %clang -### %t.o -target x86_64-unknown-linux -flto 2>&1 | FileCheck %s --check-prefix=NOPROBE -// RUN: %clang -### %t.o -target x86_64-unknown-linux -flto -fno-pseudo-probe-for-profiling 2>&1 | FileCheck %s --check-prefix=NOPROBE -// RUN: %clang -### %t.o -target x86_64-unknown-linux -flto -fpseudo-probe-for-profiling -fno-pseudo-probe-for-profiling 2>&1 | FileCheck %s --check-prefix=NOPROBE - -// PROBE: -plugin-opt=pseudo-probe-for-profiling -// NOPROBE-NOT: -plugin-opt=pseudo-probe-for-profiling diff --git a/clang/test/Driver/riscv-arch.c b/clang/test/Driver/riscv-arch.c index cf148ca885d0..3762a4aef1b3 100644 --- a/clang/test/Driver/riscv-arch.c +++ b/clang/test/Driver/riscv-arch.c @@ -384,7 +384,7 @@ // RV32-EXPERIMENTAL-V-BADVERS: error: invalid arch name 'rv32iv0p1' // RV32-EXPERIMENTAL-V-BADVERS: unsupported version number 0.1 for experimental extension -// RUN: %clang -target riscv32-unknown-elf -march=rv32iv0p10 -menable-experimental-extensions -### %s -c 2>&1 | \ +// RUN: %clang -target riscv32-unknown-elf -march=rv32iv1p0 -menable-experimental-extensions -### %s -c 2>&1 | \ // RUN: FileCheck -check-prefix=RV32-EXPERIMENTAL-V-GOODVERS %s // RV32-EXPERIMENTAL-V-GOODVERS: "-target-feature" "+experimental-v" @@ -412,7 +412,7 @@ // RV32-EXPERIMENTAL-ZVAMO-BADVERS: error: invalid arch name 'rv32izvamo0p1' // RV32-EXPERIMENTAL-ZVAMO-BADVERS: unsupported version number 0.1 for experimental extension -// RUN: %clang -target riscv32-unknown-elf -march=rv32izvamo0p10 -menable-experimental-extensions -### %s -c 2>&1 | \ +// RUN: %clang -target riscv32-unknown-elf -march=rv32izvamo1p0 -menable-experimental-extensions -### %s -c 2>&1 | \ // RUN: FileCheck -check-prefix=RV32-EXPERIMENTAL-ZVAMO-GOODVERS %s // RV32-EXPERIMENTAL-ZVAMO-GOODVERS: "-target-feature" "+experimental-zvamo" @@ -431,6 +431,6 @@ // RV32-EXPERIMENTAL-ZVLSSEG-BADVERS: error: invalid arch name 'rv32izvlsseg0p1' // RV32-EXPERIMENTAL-ZVLSSEG-BADVERS: unsupported version number 0.1 for experimental extension -// RUN: %clang -target riscv32-unknown-elf -march=rv32izvlsseg0p10 -menable-experimental-extensions -### %s -c 2>&1 | \ +// RUN: %clang -target riscv32-unknown-elf -march=rv32izvlsseg1p0 -menable-experimental-extensions -### %s -c 2>&1 | \ // RUN: FileCheck -check-prefix=RV32-EXPERIMENTAL-ZVLSSEG-GOODVERS %s // RV32-EXPERIMENTAL-ZVLSSEG-GOODVERS: "-target-feature" "+experimental-zvlsseg" diff --git a/clang/test/Driver/sanitizer-ld.c b/clang/test/Driver/sanitizer-ld.c index 2e92acc61756..9a300256d08e 100644 --- a/clang/test/Driver/sanitizer-ld.c +++ b/clang/test/Driver/sanitizer-ld.c @@ -527,14 +527,6 @@ // CHECK-CFI-LINUX: "{{.*}}ld{{(.exe)?}}" // CHECK-CFI-LINUX-NOT: libclang_rt. -// [OHOS]CFI by itself does not link runtime libraries. -// RUN: %clang -fsanitize=cfi %s -### -o %t.o 2>&1 \ -// RUN: -target arm-linux-ohos -fuse-ld=lld -rtlib=platform \ -// RUN: --sysroot=%S/Inputs/ohos_native_tree/sysroot \ -// RUN: | FileCheck --check-prefix=CHECK-CFI-LINUX %s -// CHECK-CFI-LINUX: "{{.*}}ld{{(.exe)?}}" -// CHECK-CFI-LINUX-NOT: libclang_rt. - // CFI with diagnostics links the UBSan runtime. // RUN: %clang -fsanitize=cfi -fno-sanitize-trap=cfi -fsanitize-recover=cfi \ // RUN: %s -### -o %t.o 2>&1\ diff --git a/clang/test/Frontend/fixed_point_unary.c b/clang/test/Frontend/fixed_point_unary.c index 849e38a94bc4..6ce760daba11 100644 --- a/clang/test/Frontend/fixed_point_unary.c +++ b/clang/test/Frontend/fixed_point_unary.c @@ -90,7 +90,7 @@ void inc_usa() { // SIGNED-LABEL: @inc_uf( // SIGNED-NEXT: entry: // SIGNED-NEXT: [[TMP0:%.*]] = load i16, i16* @uf, align 2 -// SIGNED-NEXT: [[TMP1:%.*]] = add i16 [[TMP0]], undef +// SIGNED-NEXT: [[TMP1:%.*]] = add i16 [[TMP0]], poison // SIGNED-NEXT: store i16 [[TMP1]], i16* @uf, align 2 // SIGNED-NEXT: ret void // @@ -271,7 +271,7 @@ void dec_usa() { // SIGNED-LABEL: @dec_uf( // SIGNED-NEXT: entry: // SIGNED-NEXT: [[TMP0:%.*]] = load i16, i16* @uf, align 2 -// SIGNED-NEXT: [[TMP1:%.*]] = sub i16 [[TMP0]], undef +// SIGNED-NEXT: [[TMP1:%.*]] = sub i16 [[TMP0]], poison // SIGNED-NEXT: store i16 [[TMP1]], i16* @uf, align 2 // SIGNED-NEXT: ret void // diff --git a/clang/test/Lexer/cxx-features.cpp b/clang/test/Lexer/cxx-features.cpp index 2f46f354ee83..f57faed4ed90 100644 --- a/clang/test/Lexer/cxx-features.cpp +++ b/clang/test/Lexer/cxx-features.cpp @@ -181,8 +181,7 @@ #error "wrong value for __cpp_structured_bindings" #endif -#if check(nontype_template_args, 0, 0, 0, 201411, 201411, 201411) -// FIXME: 201911 in C++20 +#if check(nontype_template_args, 0, 0, 0, 201411, 201911, 201911) #error "wrong value for __cpp_nontype_template_args" #endif diff --git a/clang/test/OpenMP/critical_codegen.cpp b/clang/test/OpenMP/critical_codegen.cpp index d84f2b2af22b..46fad63b3bd8 100644 --- a/clang/test/OpenMP/critical_codegen.cpp +++ b/clang/test/OpenMP/critical_codegen.cpp @@ -68,31 +68,6 @@ int main() { return a; } -// ALL-LABEL: lambda_critical -// TERM_DEBUG-LABEL: lambda_critical -void lambda_critical(int a, int b) { - auto l = [=]() { -#pragma omp critical - { - // ALL: call void @__kmpc_critical( - int c = a + b; - } - }; - - l(); - - auto l1 = [=]() { -#pragma omp parallel -#pragma omp critical - { - // ALL: call void @__kmpc_critical( - int c = a + b; - } - }; - - l1(); -} - struct S { int a; }; diff --git a/clang/test/OpenMP/linking.c b/clang/test/OpenMP/linking.c index 1c4439626470..802553c1be75 100644 --- a/clang/test/OpenMP/linking.c +++ b/clang/test/OpenMP/linking.c @@ -81,7 +81,7 @@ // CHECK-LD-OVERRIDE-64: "-lgomp" "-lrt" // CHECK-LD-OVERRIDE-64: "-lpthread" "-lc" // -// RUN: %clang -no-canonical-prefixes -fuse-ld=link %s -### -o %t.o 2>&1 \ +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ // RUN: -fopenmp=libomp -target x86_64-msvc-win32 -rtlib=platform \ // RUN: | FileCheck --check-prefix=CHECK-MSVC-LINK-64 %s // CHECK-MSVC-LINK-64: link.exe @@ -95,7 +95,7 @@ // SIMD-ONLY11-NOT: libomp // SIMD-ONLY11-NOT: libgomp // -// RUN: %clang -no-canonical-prefixes %s -fuse-ld=link -### -o %t.o 2>&1 \ +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ // RUN: -fopenmp=libiomp5 -target x86_64-msvc-win32 -rtlib=platform \ // RUN: | FileCheck --check-prefix=CHECK-MSVC-ILINK-64 %s diff --git a/clang/test/OpenMP/master_codegen.cpp b/clang/test/OpenMP/master_codegen.cpp index 353284ea8541..8554ad8e7dec 100644 --- a/clang/test/OpenMP/master_codegen.cpp +++ b/clang/test/OpenMP/master_codegen.cpp @@ -55,41 +55,6 @@ int main() { return a; } -// ALL-LABEL: lambda_master -// TERM_DEBUG-LABEL: lambda_master -void lambda_master(int a, int b) { - auto l = [=]() { -#pragma omp master - { - // ALL: call i32 @__kmpc_master( - int c = a + b; - } - }; - - l(); - - auto l1 = [=]() { -#pragma omp parallel -#pragma omp master - { - // ALL: call i32 @__kmpc_master( - int c = a + b; - } - }; - - l1(); - - auto l2 = [=]() { -#pragma omp parallel master - { - // ALL: call i32 @__kmpc_master( - int c = a + b; - } - }; - - l2(); -} - // ALL-LABEL: parallel_master // TERM_DEBUG-LABEL: parallel_master void parallel_master() { diff --git a/clang/test/OpenMP/nvptx_allocate_messages.cpp b/clang/test/OpenMP/nvptx_allocate_messages.cpp index 9a61da73eb39..a4d78b6ab588 100644 --- a/clang/test/OpenMP/nvptx_allocate_messages.cpp +++ b/clang/test/OpenMP/nvptx_allocate_messages.cpp @@ -81,7 +81,8 @@ int main () { #endif // DEVICE && !REQUIRES #pragma omp allocate(b) #if defined(DEVICE) && !defined(REQUIRES) -// expected-note@+2 2{{called by 'main'}} +// expected-note@+3 {{in instantiation of function template specialization 'foo' requested here}} +// expected-note@+2 {{called by 'main'}} #endif // DEVICE && !REQUIRES return (foo() + bar()); } diff --git a/clang/test/OpenMP/nvptx_target_exceptions_messages.cpp b/clang/test/OpenMP/nvptx_target_exceptions_messages.cpp index 87ea00a90822..c71615d2521f 100644 --- a/clang/test/OpenMP/nvptx_target_exceptions_messages.cpp +++ b/clang/test/OpenMP/nvptx_target_exceptions_messages.cpp @@ -52,7 +52,6 @@ int maini1() { #pragma omp target map(tofrom \ : a, b) { - // expected-note@+1 {{called by 'maini1'}} S s(a); static long aaa = 23; a = foo() + bar() + b + c + d + aa + aaa + FA(); // expected-note{{called by 'maini1'}} diff --git a/clang/test/OpenMP/nvptx_unsupported_type_messages.cpp b/clang/test/OpenMP/nvptx_unsupported_type_messages.cpp index a319c78f73c5..814a4756c01b 100644 --- a/clang/test/OpenMP/nvptx_unsupported_type_messages.cpp +++ b/clang/test/OpenMP/nvptx_unsupported_type_messages.cpp @@ -39,12 +39,10 @@ struct T1 { }; #ifndef _ARCH_PPC -// expected-error@+2 {{'boo' requires 128 bit size '__float128' type support, but device 'nvptx64-unknown-unknown' does not support it}} -// expected-note@+1 2{{'boo' defined here}} +// expected-note@+1 {{'boo' defined here}} void boo(__float128 A) { return; } #else -// expected-error@+2 {{'boo' requires 128 bit size 'long double' type support, but device 'nvptx64-unknown-unknown' does not support it}} -// expected-note@+1 2{{'boo' defined here}} +// expected-note@+1 {{'boo' defined here}} void boo(long double A) { return; } #endif #pragma omp declare target @@ -53,11 +51,10 @@ T f = a; void foo(T a = T()) { a = a + f; // expected-note {{called by 'foo'}} #ifndef _ARCH_PPC -// expected-error@+5 {{'boo' requires 128 bit size '__float128' type support, but device 'nvptx64-unknown-unknown' does not support it}} +// expected-error@+4 {{'boo' requires 128 bit size '__float128' type support, but device 'nvptx64-unknown-unknown' does not support it}} #else -// expected-error@+3 {{'boo' requires 128 bit size 'long double' type support, but device 'nvptx64-unknown-unknown' does not support it}} +// expected-error@+2 {{'boo' requires 128 bit size 'long double' type support, but device 'nvptx64-unknown-unknown' does not support it}} #endif -// expected-note@+1 {{called by 'foo'}} boo(0); return; } @@ -80,147 +77,21 @@ T1 bar1() { void baz1() { T1 t = bar1(); } - -inline void dead_inline_declare_target() { - long double *a, b = 0; - a = &b; -} -static void dead_static_declare_target() { - long double *a, b = 0; - a = &b; -} -template -void dead_template_declare_target() { - long double *a, b = 0; - a = &b; -} - -// expected-note@+2 {{'ld_return1a' defined here}} -// expected-error@+1 {{'ld_return1a' requires 128 bit size 'long double' type support, but device 'nvptx64-unknown-unknown' does not support it}} -long double ld_return1a() { return 0; } -// expected-note@+2 {{'ld_arg1a' defined here}} -// expected-error@+1 {{'ld_arg1a' requires 128 bit size 'long double' type support, but device 'nvptx64-unknown-unknown' does not support it}} -void ld_arg1a(long double ld) {} - -typedef long double ld_ty; -// expected-note@+2 {{'ld_return1b' defined here}} -// expected-error@+1 {{'ld_return1b' requires 128 bit size 'ld_ty' (aka 'long double') type support, but device 'nvptx64-unknown-unknown' does not support it}} -ld_ty ld_return1b() { return 0; } -// expected-note@+2 {{'ld_arg1b' defined here}} -// expected-error@+1 {{'ld_arg1b' requires 128 bit size 'ld_ty' (aka 'long double') type support, but device 'nvptx64-unknown-unknown' does not support it}} -void ld_arg1b(ld_ty ld) {} - -static long double ld_return1c() { return 0; } -static void ld_arg1c(long double ld) {} - -inline long double ld_return1d() { return 0; } -inline void ld_arg1d(long double ld) {} - -// expected-note@+1 {{'ld_return1e' defined here}} -static long double ld_return1e() { return 0; } -// expected-note@+1 {{'ld_arg1e' defined here}} -static void ld_arg1e(long double ld) {} - -// expected-note@+1 {{'ld_return1f' defined here}} -inline long double ld_return1f() { return 0; } -// expected-note@+1 {{'ld_arg1f' defined here}} -inline void ld_arg1f(long double ld) {} - -inline void ld_use1() { - long double ld = 0; - ld += 1; -} -static void ld_use2() { - long double ld = 0; - ld += 1; -} - -inline void ld_use3() { -// expected-note@+1 {{'ld' defined here}} - long double ld = 0; -// expected-error@+1 {{'ld' requires 128 bit size 'long double' type support, but device 'nvptx64-unknown-unknown' does not support it}} - ld += 1; -} -static void ld_use4() { -// expected-note@+1 {{'ld' defined here}} - long double ld = 0; -// expected-error@+1 {{'ld' requires 128 bit size 'long double' type support, but device 'nvptx64-unknown-unknown' does not support it}} - ld += 1; -} - -void external() { -// expected-error@+1 {{'ld_return1e' requires 128 bit size 'long double' type support, but device 'nvptx64-unknown-unknown' does not support it}} - void *p1 = reinterpret_cast(&ld_return1e); -// expected-error@+1 {{'ld_arg1e' requires 128 bit size 'long double' type support, but device 'nvptx64-unknown-unknown' does not support it}} - void *p2 = reinterpret_cast(&ld_arg1e); -// expected-error@+1 {{'ld_return1f' requires 128 bit size 'long double' type support, but device 'nvptx64-unknown-unknown' does not support it}} - void *p3 = reinterpret_cast(&ld_return1f); -// expected-error@+1 {{'ld_arg1f' requires 128 bit size 'long double' type support, but device 'nvptx64-unknown-unknown' does not support it}} - void *p4 = reinterpret_cast(&ld_arg1f); -// TODO: The error message "called by" is not great. -// expected-note@+1 {{called by 'external'}} - void *p5 = reinterpret_cast(&ld_use3); -// expected-note@+1 {{called by 'external'}} - void *p6 = reinterpret_cast(&ld_use4); -} - -#ifndef _ARCH_PPC -// expected-note@+2 {{'ld_return2a' defined here}} -// expected-error@+1 {{'ld_return2a' requires 128 bit size '__float128' type support, but device 'nvptx64-unknown-unknown' does not support it}} -__float128 ld_return2a() { return 0; } -// expected-note@+2 {{'ld_arg2a' defined here}} -// expected-error@+1 {{'ld_arg2a' requires 128 bit size '__float128' type support, but device 'nvptx64-unknown-unknown' does not support it}} -void ld_arg2a(__float128 ld) {} - -typedef __float128 fp128_ty; -// expected-note@+2 {{'ld_return2b' defined here}} -// expected-error@+1 {{'ld_return2b' requires 128 bit size 'fp128_ty' (aka '__float128') type support, but device 'nvptx64-unknown-unknown' does not support it}} -fp128_ty ld_return2b() { return 0; } -// expected-note@+2 {{'ld_arg2b' defined here}} -// expected-error@+1 {{'ld_arg2b' requires 128 bit size 'fp128_ty' (aka '__float128') type support, but device 'nvptx64-unknown-unknown' does not support it}} -void ld_arg2b(fp128_ty ld) {} -#endif - #pragma omp end declare target -// TODO: There should not be an error here, dead_inline is never emitted. -// expected-note@+1 {{'f' defined here}} -inline long double dead_inline(long double f) { -#pragma omp target map(f) - // expected-error@+1 {{'f' requires 128 bit size 'long double' type support, but device 'nvptx64-unknown-unknown' does not support it}} - f = 1; - return f; -} - -// TODO: There should not be an error here, dead_static is never emitted. -// expected-note@+1 {{'f' defined here}} -static long double dead_static(long double f) { -#pragma omp target map(f) - // expected-error@+1 {{'f' requires 128 bit size 'long double' type support, but device 'nvptx64-unknown-unknown' does not support it}} - f = 1; - return f; -} - -template -long double dead_template(long double f) { -#pragma omp target map(f) - f = 1; - return f; -} - #ifndef _ARCH_PPC -// expected-note@+1 {{'f' defined here}} -__float128 foo2(__float128 f) { +// expected-note@+1 3{{'f' defined here}} +__float128 foo1(__float128 f) { #pragma omp target map(f) - // expected-error@+1 {{'f' requires 128 bit size '__float128' type support, but device 'nvptx64-unknown-unknown' does not support it}} + // expected-error@+1 3{{'f' requires 128 bit size '__float128' type support, but device 'nvptx64-unknown-unknown' does not support it}} f = 1; return f; } #else -// expected-note@+1 {{'f' defined here}} -long double foo3(long double f) { +// expected-note@+1 3{{'f' defined here}} +long double foo1(long double f) { #pragma omp target map(f) - // expected-error@+1 {{'f' requires 128 bit size 'long double' type support, but device 'nvptx64-unknown-unknown' does not support it}} + // expected-error@+1 3{{'f' requires 128 bit size 'long double' type support, but device 'nvptx64-unknown-unknown' does not support it}} f = 1; return f; } diff --git a/clang/test/OpenMP/target_attribute_convergent.cpp b/clang/test/OpenMP/target_attribute_convergent.cpp deleted file mode 100644 index 932214e987c8..000000000000 --- a/clang/test/OpenMP/target_attribute_convergent.cpp +++ /dev/null @@ -1,13 +0,0 @@ -// RUN: %clang_cc1 -debug-info-kind=limited -verify -fopenmp -x c++ -triple nvptx64-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm %s -fopenmp-is-device -o - | FileCheck %s -// RUN: %clang_cc1 -debug-info-kind=limited -verify -fopenmp -x c++ -triple nvptx-unknown-unknown -fopenmp-targets=nvptx-nvidia-cuda -emit-llvm %s -fopenmp-is-device -o - | FileCheck %s -// expected-no-diagnostics - -#pragma omp declare target - -void foo() {} - -#pragma omp end declare target - -// CHECK: Function Attrs: {{.*}}convergent{{.*}} -// CHECK: define hidden void @_Z3foov() [[ATTRIBUTE_NUMBER:#[0-9]+]] -// CHECK: attributes [[ATTRIBUTE_NUMBER]] = { {{.*}}convergent{{.*}} } diff --git a/clang/test/OpenMP/target_teams_distribute_parallel_for_codegen.cpp b/clang/test/OpenMP/target_teams_distribute_parallel_for_codegen.cpp index c0f53239aa13..0229ace911f8 100644 --- a/clang/test/OpenMP/target_teams_distribute_parallel_for_codegen.cpp +++ b/clang/test/OpenMP/target_teams_distribute_parallel_for_codegen.cpp @@ -39,7 +39,7 @@ #ifdef CK1 -// HCK_NO_TGT-NOT: @__kmpc_push_target_tripcount_mapper +// HCK_NO_TGT-NOT: @__kmpc_push_target_tripcount // HCK1: define{{.*}} i32 @{{.+}}target_teams_fun{{.*}}( int target_teams_fun(int *g){ @@ -60,7 +60,7 @@ int target_teams_fun(int *g){ // HCK1: [[N_PAR:%.+]] = load{{.+}}, {{.+}} [[N_CAST]], // HCK1: [[TE_PAR:%.+]] = load{{.+}}, {{.+}} [[TE_CAST]], // HCK1: [[TH_PAR:%.+]] = load{{.+}}, {{.+}} [[TH_CAST]], - // HCK1: call void @__kmpc_push_target_tripcount_mapper(%struct.ident_t* @{{.+}}, i64 -1, i64 %{{.+}}) + // HCK1: call void @__kmpc_push_target_tripcount(%struct.ident_t* @{{.+}}, i64 -1, i64 %{{.+}}) // HCK1: call i32 @__tgt_target_teams_mapper(%struct.ident_t* @{{.+}}, i64 -1, i8* @{{[^,]+}}, i32 4, i8** %{{[^,]+}}, i8** %{{[^,]+}}, // HCK1: call void @[[OFFL1:.+]](i{{32|64}} [[N_PAR]], {{.+}}, i{{32|64}} [[TE_PAR]], i{{32|64}} [[TH_PAR]]) diff --git a/clang/test/OpenMP/target_teams_distribute_parallel_for_if_codegen.cpp b/clang/test/OpenMP/target_teams_distribute_parallel_for_if_codegen.cpp index efe7df819fb6..6650e0557511 100644 --- a/clang/test/OpenMP/target_teams_distribute_parallel_for_if_codegen.cpp +++ b/clang/test/OpenMP/target_teams_distribute_parallel_for_if_codegen.cpp @@ -49,10 +49,10 @@ int Arg; // CHECK-LABEL: define {{.*}}void @{{.+}}gtid_test void gtid_test() { -// CHECK: call void @__kmpc_push_target_tripcount_mapper(%struct.ident_t* @{{.+}}, i64 -1, i64 100) +// CHECK: call void @__kmpc_push_target_tripcount(%struct.ident_t* @{{.+}}, i64 -1, i64 100) // CHECK: call i{{[0-9]+}} @__tgt_target_teams_mapper(%struct.ident_t* @{{.+}}, // CHECK: call void [[OFFLOADING_FUN_0:@.+]]( -// CHECK: call void @__kmpc_push_target_tripcount_mapper(%struct.ident_t* @{{.+}}, i64 -1, i64 100) +// CHECK: call void @__kmpc_push_target_tripcount(%struct.ident_t* @{{.+}}, i64 -1, i64 100) // CHECK: call i{{[0-9]+}} @__tgt_target_teams_mapper(%struct.ident_t* @{{.+}}, // CHECK: call void [[OFFLOADING_FUN_1:@.+]]( #pragma omp target teams distribute parallel for @@ -107,12 +107,12 @@ int tmain(T Arg) { // CHECK-LABEL: define {{.*}}i{{[0-9]+}} @main() int main() { -// CHECK: call void @__kmpc_push_target_tripcount_mapper(%struct.ident_t* @{{.+}}, i64 -1, i64 100) +// CHECK: call void @__kmpc_push_target_tripcount(%struct.ident_t* @{{.+}}, i64 -1, i64 100) // CHECK: call i{{[0-9]+}} @__tgt_target_teams_mapper(%struct.ident_t* @{{.+}}, // CHECK: call void [[OFFLOADING_FUN_0:@.+]]( -// CHECK-NOT: call void @__kmpc_push_target_tripcount_mapper(%struct.ident_t* @{{.+}}, i64 -1, i64 100) +// CHECK-NOT: call void @__kmpc_push_target_tripcount(%struct.ident_t* @{{.+}}, i64 -1, i64 100) // CHECK: call void [[OFFLOADING_FUN_1:@.+]]( -// CHECK: call void @__kmpc_push_target_tripcount_mapper(%struct.ident_t* @{{.+}}, i64 -1, i64 100) +// CHECK: call void @__kmpc_push_target_tripcount(%struct.ident_t* @{{.+}}, i64 -1, i64 100) // CHECK: call i{{[0-9]+}} @__tgt_target_teams_mapper(%struct.ident_t* @{{.+}}, // CHECK: call void [[OFFLOADING_FUN_2:@.+]]( // CHECK: = call {{.*}}i{{.+}} @{{.+}}tmain diff --git a/clang/test/OpenMP/target_teams_distribute_parallel_for_order_codegen.cpp b/clang/test/OpenMP/target_teams_distribute_parallel_for_order_codegen.cpp index b99ba9d38a43..b2ab37f22ec3 100644 --- a/clang/test/OpenMP/target_teams_distribute_parallel_for_order_codegen.cpp +++ b/clang/test/OpenMP/target_teams_distribute_parallel_for_order_codegen.cpp @@ -14,7 +14,7 @@ // CHECK-LABEL: define {{.*}}void @{{.+}}gtid_test void gtid_test() { -// CHECK: call void @__kmpc_push_target_tripcount_mapper(%struct.ident_t* @{{.+}}, i64 -1, i64 100) +// CHECK: call void @__kmpc_push_target_tripcount(%struct.ident_t* @{{.+}}, i64 -1, i64 100) // CHECK: %0 = call i32 @__tgt_target_teams_mapper(%struct.ident_t* @{{.+}}, i64 -1, i8* @{{.+}}, i32 0, i8** null, i8** null, i64* null, i64* null, i8** null, i8** null, i32 0, i32 0) // CHECK: call void [[TARGET_OUTLINE:@.+]]() // CHECK: ret void diff --git a/clang/test/OpenMP/target_teams_distribute_parallel_for_simd_codegen.cpp b/clang/test/OpenMP/target_teams_distribute_parallel_for_simd_codegen.cpp index 39ccb87462c0..e6049145702b 100644 --- a/clang/test/OpenMP/target_teams_distribute_parallel_for_simd_codegen.cpp +++ b/clang/test/OpenMP/target_teams_distribute_parallel_for_simd_codegen.cpp @@ -60,7 +60,7 @@ int target_teams_fun(int *g){ // HCK1: [[N_PAR:%.+]] = load{{.+}}, {{.+}} [[N_CAST]], // HCK1: [[TE_PAR:%.+]] = load{{.+}}, {{.+}} [[TE_CAST]], // HCK1: [[TH_PAR:%.+]] = load{{.+}}, {{.+}} [[TH_CAST]], -// HCK1: call void @__kmpc_push_target_tripcount_mapper(%struct.ident_t* @{{.+}}, i64 -1, i64 %{{.+}}) +// HCK1: call void @__kmpc_push_target_tripcount(%struct.ident_t* @{{.+}}, i64 -1, i64 %{{.+}}) // HCK1: call i32 @__tgt_target_teams_mapper(%struct.ident_t* @{{.+}}, i64 -1, i8* @{{[^,]+}}, i32 5, i8** %{{[^,]+}}, i8** %{{[^,]+}}, // HCK1: call void @[[OFFL1:.+]](i{{32|64}} [[I_PAR]], i{{32|64}} [[N_PAR]], {{.+}}, i{{32|64}} [[TE_PAR]], i{{32|64}} [[TH_PAR]]) diff --git a/clang/test/OpenMP/target_teams_distribute_parallel_for_simd_if_codegen.cpp b/clang/test/OpenMP/target_teams_distribute_parallel_for_simd_if_codegen.cpp index 19dc15b94f64..8b0eaba07f1c 100644 --- a/clang/test/OpenMP/target_teams_distribute_parallel_for_simd_if_codegen.cpp +++ b/clang/test/OpenMP/target_teams_distribute_parallel_for_simd_if_codegen.cpp @@ -43,10 +43,10 @@ int Arg; // CHECK-LABEL: define {{.*}}void @{{.+}}gtid_test void gtid_test() { -// CHECK: call void @__kmpc_push_target_tripcount_mapper(%struct.ident_t* @{{.+}}, i64 -1, i64 100) +// CHECK: call void @__kmpc_push_target_tripcount(%struct.ident_t* @{{.+}}, i64 -1, i64 100) // CHECK: call i{{[0-9]+}} @__tgt_target_teams_mapper(%struct.ident_t* @{{.+}}, // CHECK: call void [[OFFLOADING_FUN_0:@.+]]( -// CHECK: call void @__kmpc_push_target_tripcount_mapper(%struct.ident_t* @{{.+}}, i64 -1, i64 100) +// CHECK: call void @__kmpc_push_target_tripcount(%struct.ident_t* @{{.+}}, i64 -1, i64 100) // CHECK: call i{{[0-9]+}} @__tgt_target_teams_mapper(%struct.ident_t* @{{.+}}, // CHECK: call void [[OFFLOADING_FUN_1:@.+]]( #ifdef OMP5 @@ -110,12 +110,12 @@ int tmain(T Arg) { // CHECK-LABEL: define {{.*}}i{{[0-9]+}} @main() int main() { -// CHECK: call void @__kmpc_push_target_tripcount_mapper(%struct.ident_t* @{{.+}}, i64 -1, i64 100) +// CHECK: call void @__kmpc_push_target_tripcount(%struct.ident_t* @{{.+}}, i64 -1, i64 100) // CHECK: call i{{[0-9]+}} @__tgt_target_teams_mapper(%struct.ident_t* @{{.+}}, // CHECK: call void [[OFFLOADING_FUN_0:@.+]]( -// CHECK-NOT: call void @__kmpc_push_target_tripcount_mapper(%struct.ident_t* @{{.+}}, i64 -1, i64 100) +// CHECK-NOT: call void @__kmpc_push_target_tripcount(%struct.ident_t* @{{.+}}, i64 -1, i64 100) // CHECK: call void [[OFFLOADING_FUN_1:@.+]]( -// CHECK: call void @__kmpc_push_target_tripcount_mapper(%struct.ident_t* @{{.+}}, i64 -1, i64 100) +// CHECK: call void @__kmpc_push_target_tripcount(%struct.ident_t* @{{.+}}, i64 -1, i64 100) // CHECK: call i{{[0-9]+}} @__tgt_target_teams_mapper(%struct.ident_t* @{{.+}}, // CHECK: call void [[OFFLOADING_FUN_2:@.+]]( // CHECK: = call {{.*}}i{{.+}} @{{.+}}tmain diff --git a/clang/test/OpenMP/teams_distribute_codegen.cpp b/clang/test/OpenMP/teams_distribute_codegen.cpp index aab5cced4c70..5bbb100e669e 100644 --- a/clang/test/OpenMP/teams_distribute_codegen.cpp +++ b/clang/test/OpenMP/teams_distribute_codegen.cpp @@ -33,7 +33,7 @@ int teams_argument_global(int n) { // CK1: [[TE_PAR:%.+]] = load{{.+}}, {{.+}} [[TE_CAST]], // CK1: [[TH_PAR:%.+]] = load{{.+}}, {{.+}} [[TH_CAST]], - // CK1: call void @__kmpc_push_target_tripcount_mapper(%struct.ident_t* @{{.+}}, i64 -1, i64 %{{.+}}) + // CK1: call void @__kmpc_push_target_tripcount(%struct.ident_t* @{{.+}}, i64 -1, i64 %{{.+}}) // CK1: call i32 @__tgt_target_teams_mapper(%struct.ident_t* @{{.+}}, i64 -1, i8* @{{[^,]+}}, i32 4, i8** %{{[^,]+}}, i8** %{{[^,]+}}, i{{64|32}}* {{.+}}@{{[^,]+}}, i32 0, i32 0), i64* {{.+}}@{{[^,]+}}, i32 0, i32 0), i8** null, i8** null, i32 {{.+}}, i32 {{.+}}) // CK1: call void @[[OFFL1:.+]](i{{32|64}} [[TE_PAR]], i{{32|64}} [[TH_PAR]], diff --git a/clang/test/OpenMP/teams_distribute_parallel_for_codegen.cpp b/clang/test/OpenMP/teams_distribute_parallel_for_codegen.cpp index 8fa73e76009b..b63e5aeddb7a 100644 --- a/clang/test/OpenMP/teams_distribute_parallel_for_codegen.cpp +++ b/clang/test/OpenMP/teams_distribute_parallel_for_codegen.cpp @@ -32,7 +32,7 @@ int teams_argument_global(int n){ // CK1: [[TH_CAST:%.+]] = alloca i{{32|64}}, // CK1: [[TE_PAR:%.+]] = load{{.+}}, {{.+}} [[TE_CAST]], // CK1: [[TH_PAR:%.+]] = load{{.+}}, {{.+}} [[TH_CAST]], - // CK1: call void @__kmpc_push_target_tripcount_mapper(%struct.ident_t* @{{.+}}, i64 -1, i64 %{{.+}}) + // CK1: call void @__kmpc_push_target_tripcount(%struct.ident_t* @{{.+}}, i64 -1, i64 %{{.+}}) // CK1: call i32 @__tgt_target_teams_mapper(%struct.ident_t* @{{.+}}, i64 -1, i8* @{{[^,]+}}, i32 4, i8** %{{[^,]+}}, i8** %{{[^,]+}}, i{{64|32}}* {{.+}}@{{[^,]+}}, i32 0, i32 0), i64* {{.+}}@{{[^,]+}}, i32 0, i32 0), i8** null, i8** null, i32 {{.+}}, i32 {{.+}}) // CK1: call void @[[OFFL1:.+]](i{{32|64}} [[TE_PAR]], i{{32|64}} [[TH_PAR]], diff --git a/clang/test/OpenMP/teams_distribute_parallel_for_simd_codegen.cpp b/clang/test/OpenMP/teams_distribute_parallel_for_simd_codegen.cpp index 9b3855c61759..3d479c4cd29d 100644 --- a/clang/test/OpenMP/teams_distribute_parallel_for_simd_codegen.cpp +++ b/clang/test/OpenMP/teams_distribute_parallel_for_simd_codegen.cpp @@ -33,7 +33,7 @@ int teams_argument_global(int n){ // CK1: [[TE_PAR:%.+]] = load{{.+}}, {{.+}} [[TE_CAST]], // CK1: [[TH_PAR:%.+]] = load{{.+}}, {{.+}} [[TH_CAST]], - // CK1: call void @__kmpc_push_target_tripcount_mapper(%struct.ident_t* @{{.+}}, i64 -1, i64 %{{.+}}) + // CK1: call void @__kmpc_push_target_tripcount(%struct.ident_t* @{{.+}}, i64 -1, i64 %{{.+}}) // CK1: call i32 @__tgt_target_teams_mapper(%struct.ident_t* @{{.+}}, i64 -1, i8* @{{[^,]+}}, i32 4, i8** %{{[^,]+}}, i8** %{{[^,]+}}, i{{64|32}}* {{.+}}@{{[^,]+}}, i32 0, i32 0), i64* {{.+}}@{{[^,]+}}, i32 0, i32 0), i8** null // CK1: call void @[[OFFL1:.+]](i{{32|64}} [[TE_PAR]], i{{32|64}} [[TH_PAR]], diff --git a/clang/test/OpenMP/teams_distribute_simd_codegen.cpp b/clang/test/OpenMP/teams_distribute_simd_codegen.cpp index 6e5d06b0c568..fd1214d22ce9 100644 --- a/clang/test/OpenMP/teams_distribute_simd_codegen.cpp +++ b/clang/test/OpenMP/teams_distribute_simd_codegen.cpp @@ -35,7 +35,7 @@ int teams_argument_global(int n) { // CK1: [[TE_PAR:%.+]] = load{{.+}}, {{.+}} [[TE_CAST]], // CK1: [[TH_PAR:%.+]] = load{{.+}}, {{.+}} [[TH_CAST]], - // CK1: call void @__kmpc_push_target_tripcount_mapper(%struct.ident_t* @{{.+}}, i64 -1, i64 %{{.+}}) + // CK1: call void @__kmpc_push_target_tripcount(%struct.ident_t* @{{.+}}, i64 -1, i64 %{{.+}}) // CK1: call i32 @__tgt_target_teams_mapper(%struct.ident_t* @{{.+}}, i64 -1, i8* @{{[^,]+}}, i32 5, i8** %{{[^,]+}}, i8** %{{[^,]+}}, i{{64|32}}* {{.+}}@{{[^,]+}}, i32 0, i32 0), i64* {{.+}}@{{[^,]+}}, i32 0, i32 0), i8** null, i8** null, i32 {{.+}}, i32 1) // CK1: call void @[[OFFL1:.+]](i{{32|64}} [[TE_PAR]], i{{32|64}} [[TH_PAR]], diff --git a/clang/test/Preprocessor/macro_fn_comma_swallow2.c b/clang/test/Preprocessor/macro_fn_comma_swallow2.c index 93ab2b83664a..4e4960ca7f18 100644 --- a/clang/test/Preprocessor/macro_fn_comma_swallow2.c +++ b/clang/test/Preprocessor/macro_fn_comma_swallow2.c @@ -1,11 +1,16 @@ // Test the __VA_ARGS__ comma swallowing extensions of various compiler dialects. // RUN: %clang_cc1 -E %s | FileCheck -check-prefix=GCC -strict-whitespace %s +// RUN: %clang_cc1 -E -std=c90 %s | FileCheck -check-prefix=C99 -strict-whitespace %s // RUN: %clang_cc1 -E -std=c99 %s | FileCheck -check-prefix=C99 -strict-whitespace %s // RUN: %clang_cc1 -E -std=c11 %s | FileCheck -check-prefix=C99 -strict-whitespace %s // RUN: %clang_cc1 -E -x c++ %s | FileCheck -check-prefix=GCC -strict-whitespace %s +// RUN: %clang_cc1 -E -x c++ -std=c++03 %s | FileCheck -check-prefix=C99 -strict-whitespace %s +// RUN: %clang_cc1 -E -x c++ -std=c++11 %s | FileCheck -check-prefix=C99 -strict-whitespace %s // RUN: %clang_cc1 -E -std=gnu99 %s | FileCheck -check-prefix=GCC -strict-whitespace %s // RUN: %clang_cc1 -E -fms-compatibility %s | FileCheck -check-prefix=MS -strict-whitespace %s +// RUN: %clang_cc1 -E -x c++ -fms-compatibility %s | FileCheck -check-prefix=MS -strict-whitespace %s +// RUN: %clang_cc1 -E -x c++ -std=c++11 -fms-compatibility %s | FileCheck -check-prefix=MS -strict-whitespace %s // RUN: %clang_cc1 -E -DNAMED %s | FileCheck -check-prefix=GCC -strict-whitespace %s // RUN: %clang_cc1 -E -std=c99 -DNAMED %s | FileCheck -check-prefix=C99 -strict-whitespace %s diff --git a/clang/test/Preprocessor/macro_vaopt_check.cpp b/clang/test/Preprocessor/macro_vaopt_check.cpp index c5c0ac518bc0..fb52e9946af3 100644 --- a/clang/test/Preprocessor/macro_vaopt_check.cpp +++ b/clang/test/Preprocessor/macro_vaopt_check.cpp @@ -1,6 +1,4 @@ -// RUN: %clang_cc1 %s -Eonly -verify -Wno-all -pedantic -std=c++20 -// RUN: %clang_cc1 %s -Eonly -verify -Wno-all -pedantic -std=c++11 -// RUN: %clang_cc1 -x c %s -Eonly -verify -Wno-all -pedantic -std=c99 +// RUN: %clang_cc1 %s -Eonly -verify -Wno-all -pedantic -std=c++2a //expected-error@+1{{missing '('}} #define V1(...) __VA_OPT__ @@ -64,11 +62,3 @@ #define V1(...) __VA_OPT__ ((()) #undef V1 -// __VA_OPT__ can't appear anywhere else. -#if __VA_OPT__ // expected-warning {{__VA_OPT__ can only appear in the expansion of a variadic macro}} -#endif - -#ifdef __VA_OPT__ // expected-warning {{__VA_OPT__ can only appear in the expansion of a variadic macro}} -#endif - -#define BAD __VA_OPT__ // expected-warning {{__VA_OPT__ can only appear in the expansion of a variadic macro}} diff --git a/clang/test/Preprocessor/macro_vaopt_expand.cpp b/clang/test/Preprocessor/macro_vaopt_expand.cpp index 5eb0facb83f7..7ec4f6128cfa 100644 --- a/clang/test/Preprocessor/macro_vaopt_expand.cpp +++ b/clang/test/Preprocessor/macro_vaopt_expand.cpp @@ -1,6 +1,4 @@ -// RUN: %clang_cc1 -E %s -pedantic -std=c++20 | FileCheck -strict-whitespace %s -// RUN: %clang_cc1 -E %s -pedantic -std=c++11 | FileCheck -strict-whitespace %s -// RUN: %clang_cc1 -E -x c %s -pedantic -std=c99 | FileCheck -strict-whitespace %s +// RUN: %clang_cc1 -E %s -pedantic -std=c++2a | FileCheck -strict-whitespace %s #define LPAREN ( #define RPAREN ) diff --git a/clang/test/Preprocessor/ohos.c b/clang/test/Preprocessor/ohos.c deleted file mode 100644 index 80af0fe6651d..000000000000 --- a/clang/test/Preprocessor/ohos.c +++ /dev/null @@ -1,17 +0,0 @@ -// RUN: %clang_cc1 -x c++ -E -dM -ffreestanding -triple=arm-linux-ohos < /dev/null | FileCheck %s -match-full-lines -check-prefix=ARM-OHOS-CXX -// RUN: %clang_cc1 -x c++ -E -dM -ffreestanding -triple=aarch64-linux-ohos < /dev/null | FileCheck %s -match-full-lines -check-prefix=ARM64-OHOS-CXX -// RUN: %clang_cc1 -x c++ -E -dM -ffreestanding -triple=riscv64-linux-ohos < /dev/null | FileCheck %s -match-full-lines -check-prefix=RISCV64-OHOS-CXX -// RUN: %clang_cc1 -x c++ -E -dM -ffreestanding -triple=mipsel-linux-ohos < /dev/null | FileCheck %s -match-full-lines -check-prefix=MIPSEL-OHOS-CXX -// RUN: %clang_cc1 -x c++ -E -dM -ffreestanding -triple=x86_64-linux-ohos < /dev/null | FileCheck %s -match-full-lines -check-prefix=X86_64-OHOS-CXX -// RUN: %clang_cc1 -E -dM -ffreestanding -triple=arm-linux-ohos < /dev/null | FileCheck %s -check-prefix=OHOS-DEFS - -// ARM-HOS-CXX: #define __STDCPP_DEFAULT_NEW_ALIGNMENT__ 8U -// ARM-OHOS-CXX: #define __STDCPP_DEFAULT_NEW_ALIGNMENT__ 8U -// ARM64-HOS-CXX: #define __STDCPP_DEFAULT_NEW_ALIGNMENT__ 16UL -// ARM64-OHOS-CXX: #define __STDCPP_DEFAULT_NEW_ALIGNMENT__ 16UL -// RISCV64-OHOS-CXX: #define __STDCPP_DEFAULT_NEW_ALIGNMENT__ 16UL -// MIPSEL-OHOS-CXX: #define __STDCPP_DEFAULT_NEW_ALIGNMENT__ 8U -// X86_64-OHOS-CXX: #define __STDCPP_DEFAULT_NEW_ALIGNMENT__ 16UL -// OHOS-DEFS: __OHOS_FAMILY__ -// OHOS-DEFS: __OHOS__ -// OHOS-DEFS-NOT: __OHOS__ diff --git a/clang/test/Preprocessor/riscv-target-features.c b/clang/test/Preprocessor/riscv-target-features.c index 88826bbd60b8..006395505246 100644 --- a/clang/test/Preprocessor/riscv-target-features.c +++ b/clang/test/Preprocessor/riscv-target-features.c @@ -110,23 +110,23 @@ // CHECK-DOUBLE-NOT: __riscv_float_abi_single // RUN: %clang -target riscv32-unknown-linux-gnu -menable-experimental-extensions \ -// RUN: -march=rv32iv0p10 -x c -E -dM %s \ +// RUN: -march=rv32iv1p0 -x c -E -dM %s \ // RUN: -o - | FileCheck --check-prefix=CHECK-V-EXT %s // RUN: %clang -target riscv64-unknown-linux-gnu -menable-experimental-extensions \ -// RUN: -march=rv64iv0p10 -x c -E -dM %s \ +// RUN: -march=rv64iv1p0 -x c -E -dM %s \ // RUN: -o - | FileCheck --check-prefix=CHECK-V-EXT %s -// RUN: %clang -target riscv32-unknown-linux-gnu -menable-experimental-extensions -march=rv32izvamo0p10 -x c -E -dM %s \ +// RUN: %clang -target riscv32-unknown-linux-gnu -menable-experimental-extensions -march=rv32izvamo1p0 -x c -E -dM %s \ // RUN: -o - | FileCheck --check-prefix=CHECK-V-EXT %s -// RUN: %clang -target riscv64-unknown-linux-gnu -menable-experimental-extensions -march=rv32izvamo0p10 -x c -E -dM %s \ +// RUN: %clang -target riscv64-unknown-linux-gnu -menable-experimental-extensions -march=rv32izvamo1p0 -x c -E -dM %s \ // RUN: -o - | FileCheck --check-prefix=CHECK-V-EXT %s -// RUN: %clang -target riscv32-unknown-linux-gnu -menable-experimental-extensions -march=rv32izvlsseg0p10 -x c -E -dM %s \ +// RUN: %clang -target riscv32-unknown-linux-gnu -menable-experimental-extensions -march=rv32izvlsseg1p0 -x c -E -dM %s \ // RUN: -o - | FileCheck --check-prefix=CHECK-V-EXT %s -// RUN: %clang -target riscv64-unknown-linux-gnu -menable-experimental-extensions -march=rv32izvlsseg0p10 -x c -E -dM %s \ +// RUN: %clang -target riscv64-unknown-linux-gnu -menable-experimental-extensions -march=rv32izvlsseg1p0 -x c -E -dM %s \ // RUN: -o - | FileCheck --check-prefix=CHECK-V-EXT %s -// CHECK-V-EXT: __riscv_v 10000 +// CHECK-V-EXT: __riscv_v 1000000 // CHECK-V-EXT: __riscv_vector 1 -// CHECK-V-EXT: __riscv_zvamo 10000 -// CHECK-V-EXT: __riscv_zvlsseg 10000 +// CHECK-V-EXT: __riscv_zvamo 1000000 +// CHECK-V-EXT: __riscv_zvlsseg 1000000 // RUN: %clang -target riscv32-unknown-linux-gnu -menable-experimental-extensions -march=rv32izba0p93 -x c -E -dM %s \ // RUN: -o - | FileCheck --check-prefix=CHECK-ZBA-EXT %s diff --git a/clang/test/Sema/libbuiltins-ctype-powerpc64.c b/clang/test/Sema/libbuiltins-ctype-powerpc64.c index ba0efb205944..bfd79acb0ab0 100644 --- a/clang/test/Sema/libbuiltins-ctype-powerpc64.c +++ b/clang/test/Sema/libbuiltins-ctype-powerpc64.c @@ -62,4 +62,4 @@ void test(int x) { // CHECK: declare signext i32 @toupper(i32 signext) [[NUW_RO:#[0-9]+]] // CHECK: attributes [[NUW_RO]] = { nounwind readonly{{.*}} } -// CHECK: attributes [[NUW_RO_CALL]] = { nounwind readonly willreturn } +// CHECK: attributes [[NUW_RO_CALL]] = { nounwind readonly } diff --git a/clang/test/Sema/libbuiltins-ctype-x86_64.c b/clang/test/Sema/libbuiltins-ctype-x86_64.c index b8a2c7e81584..4934e6f16752 100644 --- a/clang/test/Sema/libbuiltins-ctype-x86_64.c +++ b/clang/test/Sema/libbuiltins-ctype-x86_64.c @@ -62,4 +62,4 @@ void test(int x) { // CHECK: declare i32 @toupper(i32) [[NUW_RO:#[0-9]+]] // CHECK: attributes [[NUW_RO]] = { nounwind readonly{{.*}} } -// CHECK: attributes [[NUW_RO_CALL]] = { nounwind readonly willreturn } +// CHECK: attributes [[NUW_RO_CALL]] = { nounwind readonly } diff --git a/clang/test/Sema/static-assert.c b/clang/test/Sema/static-assert.c index 9105f2366985..f08e557fc8ea 100644 --- a/clang/test/Sema/static-assert.c +++ b/clang/test/Sema/static-assert.c @@ -1,5 +1,4 @@ // RUN: %clang_cc1 -std=c11 -fsyntax-only -verify %s -// RUN: %clang_cc1 -fms-compatibility -DMS -fsyntax-only -verify %s // RUN: %clang_cc1 -std=c99 -pedantic -fsyntax-only -verify=expected,ext %s // RUN: %clang_cc1 -xc++ -std=c++11 -pedantic -fsyntax-only -verify=expected,ext,cxx %s @@ -12,17 +11,10 @@ _Static_assert(1, "1 is nonzero"); // ext-warning {{'_Static_assert' is a C11 ex _Static_assert(0, "0 is nonzero"); // expected-error {{static_assert failed "0 is nonzero"}} \ // ext-warning {{'_Static_assert' is a C11 extension}} -#ifdef MS -static_assert(1, "1 is nonzero"); -#endif - void foo(void) { _Static_assert(1, "1 is nonzero"); // ext-warning {{'_Static_assert' is a C11 extension}} _Static_assert(0, "0 is nonzero"); // expected-error {{static_assert failed "0 is nonzero"}} \ // ext-warning {{'_Static_assert' is a C11 extension}} -#ifdef MS - static_assert(1, "1 is nonzero"); -#endif } _Static_assert(1, invalid); // expected-error {{expected string literal for diagnostic message in static_assert}} \ @@ -33,9 +25,6 @@ struct A { _Static_assert(1, "1 is nonzero"); // ext-warning {{'_Static_assert' is a C11 extension}} _Static_assert(0, "0 is nonzero"); // expected-error {{static_assert failed "0 is nonzero"}} \ // ext-warning {{'_Static_assert' is a C11 extension}} -#ifdef MS - static_assert(1, "1 is nonzero"); -#endif }; #ifdef __cplusplus diff --git a/clang/test/SemaCXX/constant-expression-cxx2a.cpp b/clang/test/SemaCXX/constant-expression-cxx2a.cpp index 86020a09db44..4adadc9988ab 100644 --- a/clang/test/SemaCXX/constant-expression-cxx2a.cpp +++ b/clang/test/SemaCXX/constant-expression-cxx2a.cpp @@ -1437,13 +1437,3 @@ constexpr bool destroy_at_test() { return true; } static_assert(destroy_at_test()); - -namespace PR48582 { - struct S { - void *p = this; - constexpr S() {} - constexpr S(const S&) {} - }; - constexpr bool b = [a = S(), b = S()] { return a.p == b.p; }(); - static_assert(!b); -} diff --git a/clang/test/SemaCXX/cxx2a-constexpr-dynalloc.cpp b/clang/test/SemaCXX/cxx2a-constexpr-dynalloc.cpp index 097ca00640e9..3647526ff0af 100644 --- a/clang/test/SemaCXX/cxx2a-constexpr-dynalloc.cpp +++ b/clang/test/SemaCXX/cxx2a-constexpr-dynalloc.cpp @@ -176,37 +176,3 @@ constexpr bool construct_after_lifetime_2() { return true; } static_assert(construct_after_lifetime_2()); // expected-error {{}} expected-note {{in call}} - -namespace PR48606 { - struct A { mutable int n = 0; }; - - constexpr bool f() { - A a; - A *p = &a; - p->~A(); - std::construct_at(p); - return true; - } - static_assert(f()); - - constexpr bool g() { - A *p = new A; - p->~A(); - std::construct_at(p); - delete p; - return true; - } - static_assert(g()); - - constexpr bool h() { - std::allocator alloc; - A *p = alloc.allocate(1); - std::construct_at(p); - p->~A(); - std::construct_at(p); - p->~A(); - alloc.deallocate(p); - return true; - } - static_assert(h()); -} diff --git a/clang/test/SemaCXX/cxx2a-three-way-comparison.cpp b/clang/test/SemaCXX/cxx2a-three-way-comparison.cpp index b94225274fff..353360e052bb 100644 --- a/clang/test/SemaCXX/cxx2a-three-way-comparison.cpp +++ b/clang/test/SemaCXX/cxx2a-three-way-comparison.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++2a -verify %s -Wzero-as-null-pointer-constant +// RUN: %clang_cc1 -std=c++2a -verify %s // Keep this test before any declarations of operator<=>. namespace PR44786 { @@ -40,21 +40,3 @@ namespace PR47893 { int &f(...); int &r = f(A(), A()); } - -namespace PR44325 { - struct cmp_cat {}; - bool operator<(cmp_cat, void*); - bool operator>(cmp_cat, int cmp_cat::*); - - struct X {}; - cmp_cat operator<=>(X, X); - - bool b1 = X() < X(); // no warning - bool b2 = X() > X(); // no warning - - // FIXME: It's not clear whether warning here is useful, but we can't really - // tell that this is a comparison category in general. This is probably OK, - // as comparisons against zero are only really intended for use in the - // implicit rewrite rules, not for explicit use by programs. - bool c = cmp_cat() < 0; // expected-warning {{zero as null pointer constant}} -} diff --git a/clang/tools/scan-view/CMakeLists.txt b/clang/tools/scan-view/CMakeLists.txt index eccc6b83195b..dd3d33439299 100644 --- a/clang/tools/scan-view/CMakeLists.txt +++ b/clang/tools/scan-view/CMakeLists.txt @@ -5,7 +5,6 @@ set(BinFiles set(ShareFiles ScanView.py - Reporter.py startfile.py bugcatcher.ico) diff --git a/clang/tools/scan-view/share/Reporter.py b/clang/tools/scan-view/share/Reporter.py deleted file mode 100644 index 31a14fb0cf74..000000000000 --- a/clang/tools/scan-view/share/Reporter.py +++ /dev/null @@ -1,183 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -"""Methods for reporting bugs.""" - -import subprocess, sys, os - -__all__ = ['ReportFailure', 'BugReport', 'getReporters'] - -# - -class ReportFailure(Exception): - """Generic exception for failures in bug reporting.""" - def __init__(self, value): - self.value = value - -# Collect information about a bug. - -class BugReport(object): - def __init__(self, title, description, files): - self.title = title - self.description = description - self.files = files - -# Reporter interfaces. - -import os - -import email, mimetypes, smtplib -from email import encoders -from email.message import Message -from email.mime.base import MIMEBase -from email.mime.multipart import MIMEMultipart -from email.mime.text import MIMEText - -#===------------------------------------------------------------------------===# -# ReporterParameter -#===------------------------------------------------------------------------===# - -class ReporterParameter(object): - def __init__(self, n): - self.name = n - def getName(self): - return self.name - def getValue(self,r,bugtype,getConfigOption): - return getConfigOption(r.getName(),self.getName()) - def saveConfigValue(self): - return True - -class TextParameter (ReporterParameter): - def getHTML(self,r,bugtype,getConfigOption): - return """\ - -%s: - -"""%(self.getName(),r.getName(),self.getName(),self.getValue(r,bugtype,getConfigOption)) - -class SelectionParameter (ReporterParameter): - def __init__(self, n, values): - ReporterParameter.__init__(self,n) - self.values = values - - def getHTML(self,r,bugtype,getConfigOption): - default = self.getValue(r,bugtype,getConfigOption) - return """\ - -%s:"""%(self.getName(),r.getName(),self.getName(),'\n'.join(["""\ -"""%(o[0], - o[0] == default and ' selected="selected"' or '', - o[1]) for o in self.values])) - -#===------------------------------------------------------------------------===# -# Reporters -#===------------------------------------------------------------------------===# - -class EmailReporter(object): - def getName(self): - return 'Email' - - def getParameters(self): - return [TextParameter(x) for x in ['To', 'From', 'SMTP Server', 'SMTP Port']] - - # Lifted from python email module examples. - def attachFile(self, outer, path): - # Guess the content type based on the file's extension. Encoding - # will be ignored, although we should check for simple things like - # gzip'd or compressed files. - ctype, encoding = mimetypes.guess_type(path) - if ctype is None or encoding is not None: - # No guess could be made, or the file is encoded (compressed), so - # use a generic bag-of-bits type. - ctype = 'application/octet-stream' - maintype, subtype = ctype.split('/', 1) - if maintype == 'text': - fp = open(path) - # Note: we should handle calculating the charset - msg = MIMEText(fp.read(), _subtype=subtype) - fp.close() - else: - fp = open(path, 'rb') - msg = MIMEBase(maintype, subtype) - msg.set_payload(fp.read()) - fp.close() - # Encode the payload using Base64 - encoders.encode_base64(msg) - # Set the filename parameter - msg.add_header('Content-Disposition', 'attachment', filename=os.path.basename(path)) - outer.attach(msg) - - def fileReport(self, report, parameters): - mainMsg = """\ -BUG REPORT ---- -Title: %s -Description: %s -"""%(report.title, report.description) - - if not parameters.get('To'): - raise ReportFailure('No "To" address specified.') - if not parameters.get('From'): - raise ReportFailure('No "From" address specified.') - - msg = MIMEMultipart() - msg['Subject'] = 'BUG REPORT: %s'%(report.title) - # FIXME: Get config parameters - msg['To'] = parameters.get('To') - msg['From'] = parameters.get('From') - msg.preamble = mainMsg - - msg.attach(MIMEText(mainMsg, _subtype='text/plain')) - for file in report.files: - self.attachFile(msg, file) - - try: - s = smtplib.SMTP(host=parameters.get('SMTP Server'), - port=parameters.get('SMTP Port')) - s.sendmail(msg['From'], msg['To'], msg.as_string()) - s.close() - except: - raise ReportFailure('Unable to send message via SMTP.') - - return "Message sent!" - -class BugzillaReporter(object): - def getName(self): - return 'Bugzilla' - - def getParameters(self): - return [TextParameter(x) for x in ['URL','Product']] - - def fileReport(self, report, parameters): - raise NotImplementedError - - -class RadarClassificationParameter(SelectionParameter): - def __init__(self): - SelectionParameter.__init__(self,"Classification", - [['1', 'Security'], ['2', 'Crash/Hang/Data Loss'], - ['3', 'Performance'], ['4', 'UI/Usability'], - ['6', 'Serious Bug'], ['7', 'Other']]) - - def saveConfigValue(self): - return False - - def getValue(self,r,bugtype,getConfigOption): - if bugtype.find("leak") != -1: - return '3' - elif bugtype.find("dereference") != -1: - return '2' - elif bugtype.find("missing ivar release") != -1: - return '3' - else: - return '7' - -### - -def getReporters(): - reporters = [] - reporters.append(EmailReporter()) - return reporters - diff --git a/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp b/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp index 06c2bbc29e5c..92bf244b0e4a 100644 --- a/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp +++ b/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp @@ -474,42 +474,6 @@ TEST(Matcher, CapturesThis) { EXPECT_TRUE(notMatches("void f() { int z = 3; [&z](){}; }", HasCaptureThis)); } -TEST(Matcher, MatchesMethodsOnLambda) { - StringRef Code = R"cpp( -struct A { - ~A() {} -}; -void foo() -{ - A a; - auto l = [a] { }; - auto lCopy = l; - auto lPtrDecay = +[] { }; - (void)lPtrDecay; -} -)cpp"; - - EXPECT_TRUE(matches( - Code, cxxConstructorDecl( - hasBody(compoundStmt()), - hasAncestor(lambdaExpr(hasAncestor(varDecl(hasName("l"))))), - isCopyConstructor()))); - EXPECT_TRUE(matches( - Code, cxxConstructorDecl( - hasBody(compoundStmt()), - hasAncestor(lambdaExpr(hasAncestor(varDecl(hasName("l"))))), - isMoveConstructor()))); - EXPECT_TRUE(matches( - Code, cxxDestructorDecl( - hasBody(compoundStmt()), - hasAncestor(lambdaExpr(hasAncestor(varDecl(hasName("l")))))))); - EXPECT_TRUE(matches( - Code, cxxConversionDecl(hasBody(compoundStmt(has(returnStmt( - hasReturnValue(implicitCastExpr()))))), - hasAncestor(lambdaExpr(hasAncestor( - varDecl(hasName("lPtrDecay")))))))); -} - TEST(Matcher, isClassMessage) { EXPECT_TRUE(matchesObjC( "@interface NSString +(NSString *) stringWithFormat; @end " @@ -2519,78 +2483,6 @@ template<> bool timesTwo(bool){ EXPECT_TRUE(matches(Code, traverse(TK_AsIs, M))); EXPECT_TRUE(matches(Code, traverse(TK_IgnoreUnlessSpelledInSource, M))); } - - Code = R"cpp( -struct B { - B(int); -}; - -B func1() { return 42; } - )cpp"; - { - auto M = expr(ignoringImplicit(integerLiteral(equals(42)).bind("intLit"))); - EXPECT_TRUE(matchAndVerifyResultTrue( - Code, traverse(TK_AsIs, M), - std::make_unique>("intLit", 1))); - EXPECT_TRUE(matchAndVerifyResultTrue( - Code, traverse(TK_IgnoreUnlessSpelledInSource, M), - std::make_unique>("intLit", 1))); - } - { - auto M = expr(unless(integerLiteral(equals(24)))).bind("intLit"); - EXPECT_TRUE(matchAndVerifyResultTrue( - Code, traverse(TK_AsIs, M), - std::make_unique>("intLit", 7))); - EXPECT_TRUE(matchAndVerifyResultTrue( - Code, traverse(TK_IgnoreUnlessSpelledInSource, M), - std::make_unique>("intLit", 1))); - } - { - auto M = - expr(anyOf(integerLiteral(equals(42)).bind("intLit"), unless(expr()))); - EXPECT_TRUE(matchAndVerifyResultTrue( - Code, traverse(TK_AsIs, M), - std::make_unique>("intLit", 1))); - EXPECT_TRUE(matchAndVerifyResultTrue( - Code, traverse(TK_IgnoreUnlessSpelledInSource, M), - std::make_unique>("intLit", 1))); - } - { - auto M = expr(allOf(integerLiteral(equals(42)).bind("intLit"), expr())); - EXPECT_TRUE(matchAndVerifyResultTrue( - Code, traverse(TK_AsIs, M), - std::make_unique>("intLit", 1))); - EXPECT_TRUE(matchAndVerifyResultTrue( - Code, traverse(TK_IgnoreUnlessSpelledInSource, M), - std::make_unique>("intLit", 1))); - } - { - auto M = expr(integerLiteral(equals(42)).bind("intLit"), expr()); - EXPECT_TRUE(matchAndVerifyResultTrue( - Code, traverse(TK_AsIs, M), - std::make_unique>("intLit", 1))); - EXPECT_TRUE(matchAndVerifyResultTrue( - Code, traverse(TK_IgnoreUnlessSpelledInSource, M), - std::make_unique>("intLit", 1))); - } - { - auto M = expr(optionally(integerLiteral(equals(42)).bind("intLit"))); - EXPECT_TRUE(matchAndVerifyResultTrue( - Code, traverse(TK_AsIs, M), - std::make_unique>("intLit", 1))); - EXPECT_TRUE(matchAndVerifyResultTrue( - Code, traverse(TK_IgnoreUnlessSpelledInSource, M), - std::make_unique>("intLit", 1))); - } - { - auto M = expr().bind("allExprs"); - EXPECT_TRUE(matchAndVerifyResultTrue( - Code, traverse(TK_AsIs, M), - std::make_unique>("allExprs", 7))); - EXPECT_TRUE(matchAndVerifyResultTrue( - Code, traverse(TK_IgnoreUnlessSpelledInSource, M), - std::make_unique>("allExprs", 1))); - } } TEST(Traversal, traverseNoImplicit) { @@ -2892,36 +2784,6 @@ struct CtorInitsNonTrivial : NonTrivial EXPECT_FALSE(matches(Code, traverse(TK_IgnoreUnlessSpelledInSource, M))); } - Code = R"cpp( - struct Range { - int* begin() const; - int* end() const; - }; - Range getRange(int); - - void rangeFor() - { - for (auto i : getRange(42)) - { - } - } - )cpp"; - { - auto M = integerLiteral(equals(42)); - EXPECT_TRUE(matches(Code, traverse(TK_AsIs, M))); - EXPECT_TRUE(matches(Code, traverse(TK_IgnoreUnlessSpelledInSource, M))); - } - { - auto M = callExpr(hasDescendant(integerLiteral(equals(42)))); - EXPECT_TRUE(matches(Code, traverse(TK_AsIs, M))); - EXPECT_TRUE(matches(Code, traverse(TK_IgnoreUnlessSpelledInSource, M))); - } - { - auto M = compoundStmt(hasDescendant(integerLiteral(equals(42)))); - EXPECT_TRUE(matches(Code, traverse(TK_AsIs, M))); - EXPECT_TRUE(matches(Code, traverse(TK_IgnoreUnlessSpelledInSource, M))); - } - Code = R"cpp( void rangeFor() { @@ -2993,40 +2855,6 @@ struct CtorInitsNonTrivial : NonTrivial matchesConditionally(Code, traverse(TK_IgnoreUnlessSpelledInSource, M), true, {"-std=c++20"})); } - - Code = R"cpp( - struct Range { - int* begin() const; - int* end() const; - }; - Range getRange(int); - - int getNum(int); - - void rangeFor() - { - for (auto j = getNum(42); auto i : getRange(j)) - { - } - } - )cpp"; - { - auto M = integerLiteral(equals(42)); - EXPECT_TRUE( - matchesConditionally(Code, traverse(TK_AsIs, M), true, {"-std=c++20"})); - EXPECT_TRUE( - matchesConditionally(Code, traverse(TK_IgnoreUnlessSpelledInSource, M), - true, {"-std=c++20"})); - } - { - auto M = compoundStmt(hasDescendant(integerLiteral(equals(42)))); - EXPECT_TRUE( - matchesConditionally(Code, traverse(TK_AsIs, M), true, {"-std=c++20"})); - EXPECT_TRUE( - matchesConditionally(Code, traverse(TK_IgnoreUnlessSpelledInSource, M), - true, {"-std=c++20"})); - } - Code = R"cpp( void hasDefaultArg(int i, int j = 0) { @@ -3292,12 +3120,6 @@ void func14() { float i = 42.0; } -void func15() { - int count = 0; - auto l = [&] { ++count; }; - (void)l; -} - )cpp"; EXPECT_TRUE( @@ -3482,15 +3304,6 @@ void func15() { functionDecl(hasName("func14"), hasDescendant(floatLiteral()))), langCxx20OrLater())); - EXPECT_TRUE(matches( - Code, - traverse(TK_IgnoreUnlessSpelledInSource, - compoundStmt( - hasDescendant(varDecl(hasName("count")).bind("countVar")), - hasDescendant( - declRefExpr(to(varDecl(equalsBoundNode("countVar"))))))), - langCxx20OrLater())); - Code = R"cpp( void foo() { int explicit_captured = 0; @@ -4040,78 +3853,6 @@ void binop() } } -TEST(IgnoringImpCasts, PathologicalLambda) { - - // Test that deeply nested lambdas are not a performance penalty - StringRef Code = R"cpp( -void f() { - [] { - [] { - [] { - [] { - [] { - [] { - [] { - [] { - [] { - [] { - [] { - [] { - [] { - [] { - [] { - [] { - [] { - [] { - [] { - [] { - [] { - [] { - [] { - [] { - [] { - [] { - [] { - [] { - [] { - int i = 42; - (void)i; - }(); - }(); - }(); - }(); - }(); - }(); - }(); - }(); - }(); - }(); - }(); - }(); - }(); - }(); - }(); - }(); - }(); - }(); - }(); - }(); - }(); - }(); - }(); - }(); - }(); - }(); - }(); - }(); - }(); -} - )cpp"; - - EXPECT_TRUE(matches(Code, integerLiteral(equals(42)))); - EXPECT_TRUE(matches(Code, functionDecl(hasDescendant(integerLiteral(equals(42)))))); -} - TEST(IgnoringImpCasts, MatchesImpCasts) { // This test checks that ignoringImpCasts matches when implicit casts are // present and its inner matcher alone does not match. diff --git a/clang/unittests/CMakeLists.txt b/clang/unittests/CMakeLists.txt index bcb84f1d3d7c..bb635dfff991 100644 --- a/clang/unittests/CMakeLists.txt +++ b/clang/unittests/CMakeLists.txt @@ -39,9 +39,7 @@ add_subdirectory(CodeGen) if(NOT WIN32 AND CLANG_TOOL_LIBCLANG_BUILD) add_subdirectory(libclang) endif() -if (NOT APPLE) - add_subdirectory(DirectoryWatcher) -endif() +add_subdirectory(DirectoryWatcher) add_subdirectory(Rename) add_subdirectory(Index) add_subdirectory(Serialization) diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index 45278fdb69e6..855cf0242fe9 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -10248,21 +10248,6 @@ TEST_F(FormatTest, SplitEmptyClass) { "{\n" "};", Style); - - verifyFormat("#include \"stdint.h\"\n" - "namespace rep {}", - Style); - verifyFormat("#include \n" - "namespace rep {}", - Style); - verifyFormat("#include \n" - "namespace rep {}", - "#include \n" - "namespace rep {\n" - "\n" - "\n" - "}", - Style); } TEST_F(FormatTest, SplitEmptyStruct) { @@ -12368,17 +12353,6 @@ TEST_F(FormatTest, ConfigurableSpacesInParentheses) { verifyFormat("size_t idx = (a->*foo)(a - 1);", Spaces); verifyFormat("size_t idx = (a->foo)(a - 1);", Spaces); verifyFormat("size_t idx = (*foo)(a - 1);", Spaces); - verifyFormat("size_t idx = (*(foo))(a - 1);", Spaces); - Spaces.ColumnLimit = 80; - Spaces.IndentWidth = 4; - Spaces.AlignAfterOpenBracket = FormatStyle::BAS_AlwaysBreak; - verifyFormat("void foo( ) {\n" - " size_t foo = (*(function))(\n" - " Foooo, Barrrrr, Foooo, Barrrr, FoooooooooLooooong, " - "BarrrrrrrrrrrrLong,\n" - " FoooooooooLooooong);\n" - "}", - Spaces); Spaces.SpaceAfterCStyleCast = false; verifyFormat("size_t idx = (size_t)(ptr - ((char *)file));", Spaces); verifyFormat("size_t idx = (size_t)a;", Spaces); @@ -12386,15 +12360,6 @@ TEST_F(FormatTest, ConfigurableSpacesInParentheses) { verifyFormat("size_t idx = (a->*foo)(a - 1);", Spaces); verifyFormat("size_t idx = (a->foo)(a - 1);", Spaces); verifyFormat("size_t idx = (*foo)(a - 1);", Spaces); - verifyFormat("size_t idx = (*(foo))(a - 1);", Spaces); - - verifyFormat("void foo( ) {\n" - " size_t foo = (*(function))(\n" - " Foooo, Barrrrr, Foooo, Barrrr, FoooooooooLooooong, " - "BarrrrrrrrrrrrLong,\n" - " FoooooooooLooooong);\n" - "}", - Spaces); } TEST_F(FormatTest, ConfigurableSpacesInSquareBrackets) { @@ -14741,7 +14706,6 @@ TEST_F(FormatTest, WhitesmithsBraceBreaking) { WhitesmithsBraceStyle); */ - WhitesmithsBraceStyle.NamespaceIndentation = FormatStyle::NI_None; verifyFormat("namespace a\n" " {\n" "class A\n" @@ -14766,89 +14730,6 @@ TEST_F(FormatTest, WhitesmithsBraceBreaking) { " } // namespace a", WhitesmithsBraceStyle); - verifyFormat("namespace a\n" - " {\n" - "namespace b\n" - " {\n" - "class A\n" - " {\n" - " void f()\n" - " {\n" - " if (true)\n" - " {\n" - " a();\n" - " b();\n" - " }\n" - " }\n" - " void g()\n" - " {\n" - " return;\n" - " }\n" - " };\n" - "struct B\n" - " {\n" - " int x;\n" - " };\n" - " } // namespace b\n" - " } // namespace a", - WhitesmithsBraceStyle); - - WhitesmithsBraceStyle.NamespaceIndentation = FormatStyle::NI_Inner; - verifyFormat("namespace a\n" - " {\n" - "namespace b\n" - " {\n" - " class A\n" - " {\n" - " void f()\n" - " {\n" - " if (true)\n" - " {\n" - " a();\n" - " b();\n" - " }\n" - " }\n" - " void g()\n" - " {\n" - " return;\n" - " }\n" - " };\n" - " struct B\n" - " {\n" - " int x;\n" - " };\n" - " } // namespace b\n" - " } // namespace a", - WhitesmithsBraceStyle); - - WhitesmithsBraceStyle.NamespaceIndentation = FormatStyle::NI_All; - verifyFormat("namespace a\n" - " {\n" - " namespace b\n" - " {\n" - " class A\n" - " {\n" - " void f()\n" - " {\n" - " if (true)\n" - " {\n" - " a();\n" - " b();\n" - " }\n" - " }\n" - " void g()\n" - " {\n" - " return;\n" - " }\n" - " };\n" - " struct B\n" - " {\n" - " int x;\n" - " };\n" - " } // namespace b\n" - " } // namespace a", - WhitesmithsBraceStyle); - verifyFormat("void f()\n" " {\n" " if (true)\n" @@ -14883,7 +14764,7 @@ TEST_F(FormatTest, WhitesmithsBraceBreaking) { " }\n", WhitesmithsBraceStyle); - WhitesmithsBraceStyle.IndentCaseLabels = true; + WhitesmithsBraceStyle.IndentCaseBlocks = true; verifyFormat("void switchTest1(int a)\n" " {\n" " switch (a)\n" @@ -14891,7 +14772,7 @@ TEST_F(FormatTest, WhitesmithsBraceBreaking) { " case 2:\n" " {\n" " }\n" - " break;\n" + " break;\n" " }\n" " }\n", WhitesmithsBraceStyle); @@ -14901,7 +14782,7 @@ TEST_F(FormatTest, WhitesmithsBraceBreaking) { " switch (a)\n" " {\n" " case 0:\n" - " break;\n" + " break;\n" " case 1:\n" " {\n" " break;\n" @@ -14909,9 +14790,9 @@ TEST_F(FormatTest, WhitesmithsBraceBreaking) { " case 2:\n" " {\n" " }\n" - " break;\n" + " break;\n" " default:\n" - " break;\n" + " break;\n" " }\n" " }\n", WhitesmithsBraceStyle); @@ -14924,17 +14805,17 @@ TEST_F(FormatTest, WhitesmithsBraceBreaking) { " {\n" " foo(x);\n" " }\n" - " break;\n" + " break;\n" " default:\n" " {\n" " foo(1);\n" " }\n" - " break;\n" + " break;\n" " }\n" " }\n", WhitesmithsBraceStyle); - WhitesmithsBraceStyle.IndentCaseLabels = false; + WhitesmithsBraceStyle.IndentCaseBlocks = false; verifyFormat("void switchTest4(int a)\n" " {\n" diff --git a/clang/unittests/Sema/CodeCompleteTest.cpp b/clang/unittests/Sema/CodeCompleteTest.cpp index dae0793658c5..d8b303d77bb9 100644 --- a/clang/unittests/Sema/CodeCompleteTest.cpp +++ b/clang/unittests/Sema/CodeCompleteTest.cpp @@ -488,7 +488,6 @@ TEST(PreferredTypeTest, NoCrashOnInvalidTypes) { auto y = new decltype(&1)(^); // GNU decimal type extension is not supported in clang. auto z = new _Decimal128(^); - void foo() { (void)(foo)(^); } )cpp"; EXPECT_THAT(collectPreferredTypes(Code), Each("NULL TYPE")); } diff --git a/clang/www/cxx_status.html b/clang/www/cxx_status.html index fc3340ec9d96..685f32dbe0d3 100755 --- a/clang/www/cxx_status.html +++ b/clang/www/cxx_status.html @@ -1005,7 +1005,7 @@ ISO C++ 2020 Draft International Standard. Class types as non-type template parameters P0732R2 - Partial + Clang 12 P1907R1 diff --git a/compiler-rt/CMakeLists.txt b/compiler-rt/CMakeLists.txt index 174d29333379..b44ad2c2118e 100644 --- a/compiler-rt/CMakeLists.txt +++ b/compiler-rt/CMakeLists.txt @@ -120,14 +120,7 @@ if ("${COMPILER_RT_DEFAULT_TARGET_TRIPLE}" MATCHES ".*android.*") string(REGEX MATCH "-target(=| +)[^ ]+android[a-z]*([0-9]+)" ANDROID_API_LEVEL "${CMAKE_C_FLAGS}") set(ANDROID_API_LEVEL ${CMAKE_MATCH_2}) endif() - -# We define OHOS for ohos targets for now -if (OHOS) - set(OHOS_FAMILY 1) -endif() - pythonize_bool(ANDROID) -pythonize_bool(OHOS_FAMILY) set(COMPILER_RT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) set(COMPILER_RT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) @@ -138,7 +131,7 @@ pythonize_bool(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR) # and target a UNIX-like system or Windows. # We can run tests on Android even when we are cross-compiling. if(("${CMAKE_HOST_SYSTEM}" STREQUAL "${CMAKE_SYSTEM}" AND (UNIX OR WIN32)) OR ANDROID - OR COMPILER_RT_EMULATOR OR OHOS) + OR COMPILER_RT_EMULATOR) option(COMPILER_RT_CAN_EXECUTE_TESTS "Can we execute instrumented tests" ON) else() option(COMPILER_RT_CAN_EXECUTE_TESTS "Can we execute instrumented tests" OFF) @@ -242,7 +235,7 @@ option(SANITIZER_USE_STATIC_CXX_ABI "Use static libc++abi." ${DEFAULT_SANITIZER_USE_STATIC_CXX_ABI}) set(DEFAULT_COMPILER_RT_USE_BUILTINS_LIBRARY OFF) -if (FUCHSIA OR OHOS) +if (FUCHSIA) set(DEFAULT_COMPILER_RT_USE_BUILTINS_LIBRARY ON) endif() @@ -429,9 +422,7 @@ append_list_if(MINGW -fms-extensions SANITIZER_COMMON_CFLAGS) # Set common link flags. append_list_if(COMPILER_RT_HAS_NODEFAULTLIBS_FLAG -nodefaultlibs SANITIZER_COMMON_LINK_FLAGS) -if (NOT __MIPS) - append_list_if(COMPILER_RT_HAS_Z_TEXT -Wl,-z,text SANITIZER_COMMON_LINK_FLAGS) -endif() +append_list_if(COMPILER_RT_HAS_Z_TEXT -Wl,-z,text SANITIZER_COMMON_LINK_FLAGS) if (COMPILER_RT_USE_BUILTINS_LIBRARY) string(REPLACE "-Wl,-z,defs" "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}") @@ -450,10 +441,6 @@ if("${CMAKE_SYSTEM_NAME}" STREQUAL "Fuchsia") list(APPEND SANITIZER_COMMON_LINK_LIBS zircon) endif() -if (OHOS) - list(APPEND SANITIZER_COMMON_LINK_LIBS unwind) -endif() - # TODO: COMPILER_RT_COMMON_CFLAGS and COMPILER_RT_COMMON_LINK_FLAGS are # intended for use in non-sanitizer runtimes such as libFuzzer, profile or XRay, # move these higher to include common flags, then derive SANITIZER_COMMON_CFLAGS diff --git a/compiler-rt/cmake/Modules/AddCompilerRT.cmake b/compiler-rt/cmake/Modules/AddCompilerRT.cmake index 3fb062f78f70..361538a58e47 100644 --- a/compiler-rt/cmake/Modules/AddCompilerRT.cmake +++ b/compiler-rt/cmake/Modules/AddCompilerRT.cmake @@ -239,9 +239,9 @@ function(add_compiler_rt_runtime name type) NOT name STREQUAL "clang_rt.builtins") get_compiler_rt_target(${arch} target) find_compiler_rt_library(builtins ${target} builtins_${libname}) - #if(builtins_${libname} STREQUAL "NOTFOUND") - # message(FATAL_ERROR "Cannot find builtins library for the target architecture") - #endif() + if(builtins_${libname} STREQUAL "NOTFOUND") + message(FATAL_ERROR "Cannot find builtins library for the target architecture") + endif() endif() set(sources_${libname} ${LIB_SOURCES}) format_object_libs(sources_${libname} ${arch} ${LIB_OBJECT_LIBS}) diff --git a/compiler-rt/cmake/Modules/CompilerRTUtils.cmake b/compiler-rt/cmake/Modules/CompilerRTUtils.cmake index 77c5ae1c4b6d..f61d487e93a0 100644 --- a/compiler-rt/cmake/Modules/CompilerRTUtils.cmake +++ b/compiler-rt/cmake/Modules/CompilerRTUtils.cmake @@ -179,7 +179,7 @@ macro(detect_target_arch) elseif(__MIPS64) # must be checked before __MIPS add_default_target_arch(mips64) elseif(__MIPS) - add_default_target_arch(mipsel) + add_default_target_arch(mips) elseif(__PPC64) # must be checked before __PPC add_default_target_arch(powerpc64) elseif(__PPC64LE) @@ -378,11 +378,7 @@ endfunction() function(get_compiler_rt_install_dir arch install_dir) if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE) get_compiler_rt_target(${arch} target) - if(OHOS) - set(${install_dir} ${COMPILER_RT_INSTALL_PATH}/lib/${target}/${LLVM_TARGET_MULTILIB_SUFFIX} PARENT_SCOPE) - else() - set(${install_dir} ${COMPILER_RT_INSTALL_PATH}/lib/${target} PARENT_SCOPE) - endif() + set(${install_dir} ${COMPILER_RT_INSTALL_PATH}/lib/${target} PARENT_SCOPE) else() set(${install_dir} ${COMPILER_RT_LIBRARY_INSTALL_DIR} PARENT_SCOPE) endif() @@ -391,11 +387,7 @@ endfunction() function(get_compiler_rt_output_dir arch output_dir) if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE) get_compiler_rt_target(${arch} target) - if(OHOS) - set(${output_dir} ${COMPILER_RT_OUTPUT_DIR}/lib/${target}/${LLVM_TARGET_MULTILIB_SUFFIX} PARENT_SCOPE) - else() - set(${output_dir} ${COMPILER_RT_OUTPUT_DIR}/lib/${target} PARENT_SCOPE) - endif() + set(${output_dir} ${COMPILER_RT_OUTPUT_DIR}/lib/${target} PARENT_SCOPE) else() set(${output_dir} ${COMPILER_RT_LIBRARY_OUTPUT_DIR} PARENT_SCOPE) endif() diff --git a/compiler-rt/cmake/base-config-ix.cmake b/compiler-rt/cmake/base-config-ix.cmake index 61e7e0084ba3..1edab43e7c0d 100644 --- a/compiler-rt/cmake/base-config-ix.cmake +++ b/compiler-rt/cmake/base-config-ix.cmake @@ -165,9 +165,6 @@ macro(test_targets) # Examine compiler output to determine target architecture. detect_target_arch() set(COMPILER_RT_OS_SUFFIX "-android") - elseif(OHOS) - detect_target_arch() - set(COMPILER_RT_OS_SUFFIX "") elseif(NOT APPLE) # Supported archs for Apple platforms are generated later if(COMPILER_RT_DEFAULT_TARGET_ONLY) add_default_target_arch(${COMPILER_RT_DEFAULT_TARGET_ARCH}) diff --git a/compiler-rt/cmake/config-ix.cmake b/compiler-rt/cmake/config-ix.cmake index 62552fdac247..f81b8384cbd5 100644 --- a/compiler-rt/cmake/config-ix.cmake +++ b/compiler-rt/cmake/config-ix.cmake @@ -50,8 +50,6 @@ if (COMPILER_RT_HAS_NODEFAULTLIBS_FLAG) shell32 user32 kernel32 mingw32 ${MINGW_RUNTIME} moldname mingwex msvcrt) list(APPEND CMAKE_REQUIRED_LIBRARIES ${MINGW_LIBRARIES}) - elseif (OHOS) - list(APPEND CMAKE_REQUIRED_LIBRARIES unwind) endif() endif () @@ -130,13 +128,9 @@ check_include_files("sys/auxv.h" COMPILER_RT_HAS_AUXV) # Libraries. check_library_exists(dl dlopen "" COMPILER_RT_HAS_LIBDL) -if (NOT OHOS) - check_library_exists(rt shm_open "" COMPILER_RT_HAS_LIBRT) -endif() +check_library_exists(rt shm_open "" COMPILER_RT_HAS_LIBRT) check_library_exists(m pow "" COMPILER_RT_HAS_LIBM) -if (NOT OHOS) - check_library_exists(pthread pthread_create "" COMPILER_RT_HAS_LIBPTHREAD) -endif() +check_library_exists(pthread pthread_create "" COMPILER_RT_HAS_LIBPTHREAD) check_library_exists(execinfo backtrace "" COMPILER_RT_HAS_LIBEXECINFO) # Look for terminfo library, used in unittests that depend on LLVMSupport. @@ -165,11 +159,8 @@ check_library_exists(stdc++ __cxa_throw "" COMPILER_RT_HAS_LIBSTDCXX) check_linker_flag("-Wl,-z,text" COMPILER_RT_HAS_Z_TEXT) check_linker_flag("-fuse-ld=lld" COMPILER_RT_HAS_FUSE_LD_LLD_FLAG) -if (NOT OHOS) - # lld fails to link when this option is passed - set(VERS_COMPAT_OPTION "-Wl,-z,gnu-version-script-compat") - check_linker_flag("${VERS_COMPAT_OPTION}" COMPILER_RT_HAS_GNU_VERSION_SCRIPT_COMPAT) -endif() +set(VERS_COMPAT_OPTION "-Wl,-z,gnu-version-script-compat") +check_linker_flag("${VERS_COMPAT_OPTION}" COMPILER_RT_HAS_GNU_VERSION_SCRIPT_COMPAT) set(DUMMY_VERS ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/dummy.vers) file(WRITE ${DUMMY_VERS} "{};") @@ -308,7 +299,7 @@ set(ALL_SANITIZER_COMMON_SUPPORTED_ARCH ${X86} ${X86_64} ${PPC64} ${RISCV64} ${ARM32} ${ARM64} ${MIPS32} ${MIPS64} ${S390X} ${SPARC} ${SPARCV9}) set(ALL_ASAN_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64} ${RISCV64} ${MIPS32} ${MIPS64} ${PPC64} ${S390X} ${SPARC} ${SPARCV9}) -set(ALL_CRT_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64} ${MIPS32} ${RISCV32} ${RISCV64} ${VE}) +set(ALL_CRT_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64} ${RISCV32} ${RISCV64} ${VE}) set(ALL_DFSAN_SUPPORTED_ARCH ${X86_64} ${MIPS64} ${ARM64}) if(ANDROID) @@ -321,9 +312,9 @@ if(OS_NAME MATCHES "Linux") set(ALL_FUZZER_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM64} ${S390X}) elseif (OS_NAME MATCHES "Windows") set(ALL_FUZZER_SUPPORTED_ARCH ${X86} ${X86_64}) -elseif(OS_NAME MATCHES "Android" OR OS_NAME MATCHES "OHOS") +elseif(OS_NAME MATCHES "Android") set(ALL_FUZZER_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64}) -else () +else() set(ALL_FUZZER_SUPPORTED_ARCH ${X86_64} ${ARM64}) endif() @@ -655,7 +646,7 @@ set(COMPILER_RT_SANITIZERS_TO_BUILD all CACHE STRING list_replace(COMPILER_RT_SANITIZERS_TO_BUILD all "${ALL_SANITIZERS}") if (SANITIZER_COMMON_SUPPORTED_ARCH AND NOT LLVM_USE_SANITIZER AND - (OS_NAME MATCHES "Android|Darwin|Linux|FreeBSD|NetBSD|Fuchsia|SunOS|OHOS" OR + (OS_NAME MATCHES "Android|Darwin|Linux|FreeBSD|NetBSD|Fuchsia|SunOS" OR (OS_NAME MATCHES "Windows" AND NOT CYGWIN AND (NOT MINGW OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")))) set(COMPILER_RT_HAS_SANITIZER_COMMON TRUE) @@ -675,17 +666,17 @@ else() set(COMPILER_RT_HAS_ASAN FALSE) endif() -if (OS_NAME MATCHES "Linux|FreeBSD|Windows|NetBSD|SunOS|OHOS") +if (OS_NAME MATCHES "Linux|FreeBSD|Windows|NetBSD|SunOS") set(COMPILER_RT_ASAN_HAS_STATIC_RUNTIME TRUE) -else () +else() set(COMPILER_RT_ASAN_HAS_STATIC_RUNTIME FALSE) endif() # TODO: Add builtins support. -if (CRT_SUPPORTED_ARCH AND OS_NAME MATCHES "Linux|OHOS" AND NOT LLVM_USE_SANITIZER) +if (CRT_SUPPORTED_ARCH AND OS_NAME MATCHES "Linux" AND NOT LLVM_USE_SANITIZER) set(COMPILER_RT_HAS_CRT TRUE) -else () +else() set(COMPILER_RT_HAS_CRT FALSE) endif() @@ -711,7 +702,7 @@ else() endif() if (COMPILER_RT_HAS_SANITIZER_COMMON AND HWASAN_SUPPORTED_ARCH AND - OS_NAME MATCHES "Linux|Android|OHOS") + OS_NAME MATCHES "Linux|Android") set(COMPILER_RT_HAS_HWASAN TRUE) else() set(COMPILER_RT_HAS_HWASAN FALSE) @@ -725,28 +716,28 @@ else() endif() if (PROFILE_SUPPORTED_ARCH AND NOT LLVM_USE_SANITIZER AND - OS_NAME MATCHES "Darwin|Linux|FreeBSD|Windows|Android|Fuchsia|SunOS|NetBSD|OHOS") + OS_NAME MATCHES "Darwin|Linux|FreeBSD|Windows|Android|Fuchsia|SunOS|NetBSD|AIX") set(COMPILER_RT_HAS_PROFILE TRUE) else() set(COMPILER_RT_HAS_PROFILE FALSE) endif() if (COMPILER_RT_HAS_SANITIZER_COMMON AND TSAN_SUPPORTED_ARCH AND - OS_NAME MATCHES "Darwin|Linux|FreeBSD|Android|NetBSD|OHOS") + OS_NAME MATCHES "Darwin|Linux|FreeBSD|Android|NetBSD") set(COMPILER_RT_HAS_TSAN TRUE) else() set(COMPILER_RT_HAS_TSAN FALSE) endif() if (COMPILER_RT_HAS_SANITIZER_COMMON AND UBSAN_SUPPORTED_ARCH AND - OS_NAME MATCHES "Darwin|Linux|FreeBSD|NetBSD|Windows|Android|Fuchsia|SunOS|OHOS") + OS_NAME MATCHES "Darwin|Linux|FreeBSD|NetBSD|Windows|Android|Fuchsia|SunOS") set(COMPILER_RT_HAS_UBSAN TRUE) else() set(COMPILER_RT_HAS_UBSAN FALSE) endif() if (COMPILER_RT_HAS_SANITIZER_COMMON AND UBSAN_SUPPORTED_ARCH AND - OS_NAME MATCHES "Linux|FreeBSD|NetBSD|Android|Darwin|OHOS") + OS_NAME MATCHES "Linux|FreeBSD|NetBSD|Android|Darwin") set(COMPILER_RT_HAS_UBSAN_MINIMAL TRUE) else() set(COMPILER_RT_HAS_UBSAN_MINIMAL FALSE) @@ -774,7 +765,7 @@ else() endif() if (COMPILER_RT_HAS_SANITIZER_COMMON AND SCUDO_SUPPORTED_ARCH AND - OS_NAME MATCHES "Linux|Android|Fuchsia|OHOS") + OS_NAME MATCHES "Linux|Android|Fuchsia") set(COMPILER_RT_HAS_SCUDO TRUE) else() set(COMPILER_RT_HAS_SCUDO FALSE) @@ -788,14 +779,14 @@ else() endif() if (COMPILER_RT_HAS_SANITIZER_COMMON AND FUZZER_SUPPORTED_ARCH AND - OS_NAME MATCHES "Android|Darwin|Linux|NetBSD|FreeBSD|Fuchsia|Windows|OHOS") + OS_NAME MATCHES "Android|Darwin|Linux|NetBSD|FreeBSD|Fuchsia|Windows") set(COMPILER_RT_HAS_FUZZER TRUE) else() set(COMPILER_RT_HAS_FUZZER FALSE) endif() if (COMPILER_RT_HAS_SANITIZER_COMMON AND SHADOWCALLSTACK_SUPPORTED_ARCH AND - OS_NAME MATCHES "Linux|Android|OHOS") + OS_NAME MATCHES "Linux|Android") set(COMPILER_RT_HAS_SHADOWCALLSTACK TRUE) else() set(COMPILER_RT_HAS_SHADOWCALLSTACK FALSE) diff --git a/compiler-rt/lib/asan/asan_allocator.h b/compiler-rt/lib/asan/asan_allocator.h index a56e1ea43c22..2963e979b55c 100644 --- a/compiler-rt/lib/asan/asan_allocator.h +++ b/compiler-rt/lib/asan/asan_allocator.h @@ -128,7 +128,7 @@ typedef DefaultSizeClassMap SizeClassMap; const uptr kAllocatorSpace = ~(uptr)0; const uptr kAllocatorSize = 0x20000000000ULL; // 2T. typedef DefaultSizeClassMap SizeClassMap; -#elif defined(__aarch64__) && (SANITIZER_ANDROID || SANITIZER_OHOS) +# elif defined(__aarch64__) && SANITIZER_ANDROID // Android needs to support 39, 42 and 48 bit VMA. const uptr kAllocatorSpace = ~(uptr)0; const uptr kAllocatorSize = 0x2000000000ULL; // 128G. diff --git a/compiler-rt/lib/asan/asan_fake_stack.cpp b/compiler-rt/lib/asan/asan_fake_stack.cpp index 959a61b09d60..295e6debc96c 100644 --- a/compiler-rt/lib/asan/asan_fake_stack.cpp +++ b/compiler-rt/lib/asan/asan_fake_stack.cpp @@ -170,7 +170,7 @@ void FakeStack::ForEachFakeFrame(RangeIteratorCallback callback, void *arg) { } } -#if (SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_OHOS) || SANITIZER_FUCHSIA +#if (SANITIZER_LINUX && !SANITIZER_ANDROID) || SANITIZER_FUCHSIA static THREADLOCAL FakeStack *fake_stack_tls; FakeStack *GetTLSFakeStack() { diff --git a/compiler-rt/lib/asan/asan_internal.h b/compiler-rt/lib/asan/asan_internal.h index 100754da08e4..cfb54927c6cf 100644 --- a/compiler-rt/lib/asan/asan_internal.h +++ b/compiler-rt/lib/asan/asan_internal.h @@ -35,7 +35,7 @@ // If set, values like allocator chunk size, as well as defaults for some flags // will be changed towards less memory overhead. #ifndef ASAN_LOW_MEMORY -#if SANITIZER_IOS || SANITIZER_ANDROID || SANITIZER_RTEMS || SANITIZER_OHOS +# if SANITIZER_IOS || SANITIZER_ANDROID || SANITIZER_RTEMS # define ASAN_LOW_MEMORY 1 # else # define ASAN_LOW_MEMORY 0 diff --git a/compiler-rt/lib/asan/asan_linux.cpp b/compiler-rt/lib/asan/asan_linux.cpp index 09dc9a798387..4bcbe5d02e33 100644 --- a/compiler-rt/lib/asan/asan_linux.cpp +++ b/compiler-rt/lib/asan/asan_linux.cpp @@ -45,8 +45,7 @@ #include #endif -#if SANITIZER_ANDROID || SANITIZER_FREEBSD || SANITIZER_SOLARIS || \ - SANITIZER_OHOS +#if SANITIZER_ANDROID || SANITIZER_FREEBSD || SANITIZER_SOLARIS #include extern "C" void* _DYNAMIC; #elif SANITIZER_NETBSD @@ -122,7 +121,7 @@ void FlushUnneededASanShadowMemory(uptr p, uptr size) { ReleaseMemoryPagesToOS(MemToShadow(p), MemToShadow(p + size)); } -#if SANITIZER_ANDROID || SANITIZER_OHOS +#if SANITIZER_ANDROID // FIXME: should we do anything for Android? void AsanCheckDynamicRTPrereqs() {} void AsanCheckIncompatibleRT() {} @@ -215,7 +214,7 @@ void AsanCheckIncompatibleRT() { } #endif // SANITIZER_ANDROID -#if !SANITIZER_ANDROID && !SANITIZER_OHOS +#if !SANITIZER_ANDROID void ReadContextStack(void *context, uptr *stack, uptr *ssize) { ucontext_t *ucp = (ucontext_t*)context; *stack = (uptr)ucp->uc_stack.ss_sp; diff --git a/compiler-rt/lib/asan/asan_malloc_linux.cpp b/compiler-rt/lib/asan/asan_malloc_linux.cpp index ca45b86e1aa1..9c3f0a5338ee 100644 --- a/compiler-rt/lib/asan/asan_malloc_linux.cpp +++ b/compiler-rt/lib/asan/asan_malloc_linux.cpp @@ -243,7 +243,7 @@ INTERCEPTOR(void, malloc_stats, void) { __asan_print_accumulated_stats(); } -#if SANITIZER_BIONIC +#if SANITIZER_ANDROID // Format of __libc_malloc_dispatch has changed in Android L. // While we are moving towards a solution that does not depend on bionic // internals, here is something to support both K* and L releases. @@ -295,7 +295,7 @@ void ReplaceSystemMalloc() { } } // namespace __asan -#else // SANITIZER_BIONIC +#else // SANITIZER_ANDROID namespace __asan { void ReplaceSystemMalloc() { diff --git a/compiler-rt/lib/asan/tests/asan_test.cpp b/compiler-rt/lib/asan/tests/asan_test.cpp index 25f5b5a44416..c0b79bba48ff 100644 --- a/compiler-rt/lib/asan/tests/asan_test.cpp +++ b/compiler-rt/lib/asan/tests/asan_test.cpp @@ -1322,9 +1322,7 @@ TEST(AddressSanitizer, LongDoubleNegativeTest) { memcpy(Ident(&c), Ident(&b), sizeof(long double)); } -#if !defined(_WIN32) && !defined(__OHOS__) -// On OHOS/Musl sched_param is not int. -// See __interceptor_pthread_getschedparam +#if !defined(_WIN32) TEST(AddressSanitizer, pthread_getschedparam) { int policy; struct sched_param param; diff --git a/compiler-rt/lib/builtins/CMakeLists.txt b/compiler-rt/lib/builtins/CMakeLists.txt index 6088cce8f8dd..b511a9a987b3 100644 --- a/compiler-rt/lib/builtins/CMakeLists.txt +++ b/compiler-rt/lib/builtins/CMakeLists.txt @@ -515,12 +515,6 @@ set(aarch64_SOURCES set(OA_HELPERS_DIR "${CMAKE_CURRENT_BINARY_DIR}/outline_atomic_helpers.dir") file(MAKE_DIRECTORY "${OA_HELPERS_DIR}") -if(CMAKE_HOST_UNIX) - set(COMPILER_RT_LINK_OR_COPY create_symlink) -else() - set(COMPILER_RT_LINK_OR_COPY copy) -endif() - foreach(pat cas swp ldadd ldclr ldeor ldset) foreach(size 1 2 4 8 16) foreach(model 1 2 3 4) @@ -528,7 +522,7 @@ foreach(pat cas swp ldadd ldclr ldeor ldset) set(helper_asm "${OA_HELPERS_DIR}/outline_atomic_${pat}${size}_${model}.S") add_custom_command( OUTPUT ${helper_asm} - COMMAND ${CMAKE_COMMAND} -E ${COMPILER_RT_LINK_OR_COPY} "${CMAKE_CURRENT_SOURCE_DIR}/aarch64/lse.S" "${helper_asm}" + COMMAND ${CMAKE_COMMAND} -E create_symlink "${CMAKE_CURRENT_SOURCE_DIR}/aarch64/lse.S" "${helper_asm}" ) set_source_files_properties("${helper_asm}" PROPERTIES @@ -693,7 +687,6 @@ else () foreach (arch ${BUILTIN_SUPPORTED_ARCH}) if (CAN_TARGET_${arch}) - set(BUILTIN_CFLAGS_${arch} ${BUILTIN_CFLAGS}) # For ARM archs, exclude any VFP builtins if VFP is not supported if (${arch} MATCHES "^(arm|armhf|armv7|armv7s|armv7k|armv7m|armv7em)$") string(REPLACE ";" " " _TARGET_${arch}_CFLAGS "${TARGET_${arch}_CFLAGS}") @@ -718,13 +711,13 @@ else () # Needed for clear_cache on debug mode, due to r7's usage in inline asm. # Release mode already sets it via -O2/3, Debug mode doesn't. if (${arch} STREQUAL "armhf") - list(APPEND BUILTIN_CFLAGS_${arch} -fomit-frame-pointer -DCOMPILER_RT_ARMHF_TARGET) + list(APPEND BUILTIN_CFLAGS -fomit-frame-pointer -DCOMPILER_RT_ARMHF_TARGET) endif() # For RISCV32, we must force enable int128 for compiling long # double routines. if("${arch}" STREQUAL "riscv32") - list(APPEND BUILTIN_CFLAGS_${arch} -fforce-enable-int128) + list(APPEND BUILTIN_CFLAGS -fforce-enable-int128) endif() add_compiler_rt_runtime(clang_rt.builtins @@ -732,7 +725,7 @@ else () ARCHS ${arch} SOURCES ${${arch}_SOURCES} DEFS ${BUILTIN_DEFS} - CFLAGS ${BUILTIN_CFLAGS_${arch}} + CFLAGS ${BUILTIN_CFLAGS} PARENT_TARGET builtins) endif () endforeach () diff --git a/compiler-rt/lib/builtins/divtf3.c b/compiler-rt/lib/builtins/divtf3.c index 809c5a4f4adb..5bcc9a8e4aa1 100644 --- a/compiler-rt/lib/builtins/divtf3.c +++ b/compiler-rt/lib/builtins/divtf3.c @@ -16,7 +16,7 @@ #if defined(CRT_HAS_128BIT) && defined(CRT_LDBL_128BIT) -#define NUMBER_OF_HALF_ITERATIONS 5 +#define NUMBER_OF_HALF_ITERATIONS 4 #define NUMBER_OF_FULL_ITERATIONS 1 #include "fp_div_impl.inc" diff --git a/compiler-rt/lib/builtins/emutls.c b/compiler-rt/lib/builtins/emutls.c index e90225e8ac29..98cabd917d6c 100644 --- a/compiler-rt/lib/builtins/emutls.c +++ b/compiler-rt/lib/builtins/emutls.c @@ -12,7 +12,7 @@ #include "int_lib.h" -#if defined(__BIONIC__) || defined(__OHOS__) +#ifdef __BIONIC__ // There are 4 pthread key cleanup rounds on Bionic. Delay emutls deallocation // to round 2. We need to delay deallocation because: // - Android versions older than M lack __cxa_thread_atexit_impl, so apps @@ -382,7 +382,7 @@ void *__emutls_get_address(__emutls_control *control) { return array->data[index]; } -#if defined(__BIONIC__) || defined(__OHOS__) +#ifdef __BIONIC__ // Called by Bionic on dlclose to delete the emutls pthread key. __attribute__((visibility("hidden"))) void __emutls_unregister_key(void) { if (emutls_key_created) { diff --git a/compiler-rt/lib/builtins/fp_div_impl.inc b/compiler-rt/lib/builtins/fp_div_impl.inc index b49a6fd2bd73..29bcd1920edf 100644 --- a/compiler-rt/lib/builtins/fp_div_impl.inc +++ b/compiler-rt/lib/builtins/fp_div_impl.inc @@ -325,7 +325,7 @@ static __inline fp_t __divXf3__(fp_t a, fp_t b) { #define RECIPROCAL_PRECISION REP_C(10) #elif defined(DOUBLE_PRECISION) && NUMBER_OF_HALF_ITERATIONS == 3 && NUMBER_OF_FULL_ITERATIONS == 1 #define RECIPROCAL_PRECISION REP_C(220) -#elif defined(QUAD_PRECISION) && NUMBER_OF_HALF_ITERATIONS == 5 && NUMBER_OF_FULL_ITERATIONS == 1 +#elif defined(QUAD_PRECISION) && NUMBER_OF_HALF_ITERATIONS == 4 && NUMBER_OF_FULL_ITERATIONS == 1 #define RECIPROCAL_PRECISION REP_C(13922) #else #error Invalid number of iterations diff --git a/compiler-rt/lib/builtins/int_util.h b/compiler-rt/lib/builtins/int_util.h index c95c728598fb..c372c2edc637 100644 --- a/compiler-rt/lib/builtins/int_util.h +++ b/compiler-rt/lib/builtins/int_util.h @@ -40,10 +40,6 @@ NORETURN void __compilerrt_abort_impl(const char *file, int line, #define REPEAT_4_TIMES(code_to_repeat) \ REPEAT_3_TIMES(code_to_repeat) \ code_to_repeat -#define REPEAT_5_TIMES(code_to_repeat) \ - REPEAT_4_TIMES(code_to_repeat) \ - code_to_repeat - #define REPEAT_N_TIMES_(N, code_to_repeat) REPEAT_##N##_TIMES(code_to_repeat) #define REPEAT_N_TIMES(N, code_to_repeat) REPEAT_N_TIMES_(N, code_to_repeat) diff --git a/compiler-rt/lib/cfi/CMakeLists.txt b/compiler-rt/lib/cfi/CMakeLists.txt index 1cc0b3cb6087..9a641d33ac48 100644 --- a/compiler-rt/lib/cfi/CMakeLists.txt +++ b/compiler-rt/lib/cfi/CMakeLists.txt @@ -1,6 +1,6 @@ add_compiler_rt_component(cfi) -if(OS_NAME MATCHES "Linux" OR OS_NAME MATCHES "FreeBSD" OR OS_NAME MATCHES "NetBSD" OR OS_NAME MATCHES "OHOS") +if(OS_NAME MATCHES "Linux" OR OS_NAME MATCHES "FreeBSD" OR OS_NAME MATCHES "NetBSD") set(CFI_SOURCES cfi.cpp ) diff --git a/compiler-rt/lib/fuzzer/FuzzerInterceptors.cpp b/compiler-rt/lib/fuzzer/FuzzerInterceptors.cpp index cb2d1e5843f9..b87798603fda 100644 --- a/compiler-rt/lib/fuzzer/FuzzerInterceptors.cpp +++ b/compiler-rt/lib/fuzzer/FuzzerInterceptors.cpp @@ -25,7 +25,6 @@ } #include -#include #include #include // for dlsym() diff --git a/compiler-rt/lib/hwasan/hwasan.cpp b/compiler-rt/lib/hwasan/hwasan.cpp index 5d301bb90ae4..c5322110cb66 100644 --- a/compiler-rt/lib/hwasan/hwasan.cpp +++ b/compiler-rt/lib/hwasan/hwasan.cpp @@ -76,7 +76,7 @@ static void InitializeFlags() { cf.intercept_tls_get_addr = true; cf.exitcode = 99; // 8 shadow pages ~512kB, small enough to cover common stack sizes. - cf.clear_shadow_mmap_threshold = 4096 * ((SANITIZER_ANDROID) ? 2 : 8); + cf.clear_shadow_mmap_threshold = 4096 * (SANITIZER_ANDROID ? 2 : 8); // Sigtrap is used in error reporting. cf.handle_sigtrap = kHandleSignalExclusive; diff --git a/compiler-rt/lib/hwasan/hwasan_dynamic_shadow.cpp b/compiler-rt/lib/hwasan/hwasan_dynamic_shadow.cpp index d99ff482eed1..12730b29bae3 100644 --- a/compiler-rt/lib/hwasan/hwasan_dynamic_shadow.cpp +++ b/compiler-rt/lib/hwasan/hwasan_dynamic_shadow.cpp @@ -24,7 +24,7 @@ // The code in this file needs to run in an unrelocated binary. It should not // access any external symbol, including its own non-hidden globals. -#if SANITIZER_ANDROID || SANITIZER_OHOS +#if SANITIZER_ANDROID extern "C" { INTERFACE_ATTRIBUTE void __hwasan_shadow(); diff --git a/compiler-rt/lib/interception/interception.h b/compiler-rt/lib/interception/interception.h index 9536a3d52ce4..cb0b5284ed26 100644 --- a/compiler-rt/lib/interception/interception.h +++ b/compiler-rt/lib/interception/interception.h @@ -16,8 +16,8 @@ #include "sanitizer_common/sanitizer_internal_defs.h" -#if !SANITIZER_LINUX && !SANITIZER_FREEBSD && !SANITIZER_MAC && \ - !SANITIZER_NETBSD && !SANITIZER_WINDOWS && !SANITIZER_OHOS && \ +#if !SANITIZER_LINUX && !SANITIZER_FREEBSD && !SANITIZER_MAC && \ + !SANITIZER_NETBSD && !SANITIZER_WINDOWS && \ !SANITIZER_FUCHSIA && !SANITIZER_RTEMS && !SANITIZER_SOLARIS # error "Interception doesn't work on this operating system." #endif diff --git a/compiler-rt/lib/interception/interception_type_test.cpp b/compiler-rt/lib/interception/interception_type_test.cpp index 37f54a79b165..a611604a700c 100644 --- a/compiler-rt/lib/interception/interception_type_test.cpp +++ b/compiler-rt/lib/interception/interception_type_test.cpp @@ -31,8 +31,8 @@ COMPILER_CHECK(sizeof(::OFF64_T) == sizeof(off64_t)); // The following are the cases when pread (and friends) is used instead of // pread64. In those cases we need OFF_T to match off_t. We don't care about the // rest (they depend on _FILE_OFFSET_BITS setting when building an application). -#if SANITIZER_ANDROID || !defined _FILE_OFFSET_BITS || \ - _FILE_OFFSET_BITS != 64 || SANITIZER_OHOS +# if SANITIZER_ANDROID || !defined _FILE_OFFSET_BITS || \ + _FILE_OFFSET_BITS != 64 COMPILER_CHECK(sizeof(::OFF_T) == sizeof(off_t)); # endif diff --git a/compiler-rt/lib/lsan/lsan_common.h b/compiler-rt/lib/lsan/lsan_common.h index bc4ad44eb748..b0ae6f020b63 100644 --- a/compiler-rt/lib/lsan/lsan_common.h +++ b/compiler-rt/lib/lsan/lsan_common.h @@ -31,8 +31,7 @@ // the new architecture inside the sanitizer library. // Exclude leak-detection on arm32 for Android because `__aeabi_read_tp` // is missing. This caused a link error. -#if SANITIZER_OHOS || \ -(SANITIZER_ANDROID && (__ANDROID_API__ < 28 || defined(__arm__))) +#if SANITIZER_ANDROID && (__ANDROID_API__ < 28 || defined(__arm__)) #define CAN_SANITIZE_LEAKS 0 #elif (SANITIZER_LINUX || SANITIZER_MAC) && (SANITIZER_WORDSIZE == 64) && \ (defined(__x86_64__) || defined(__mips64) || defined(__aarch64__) || \ diff --git a/compiler-rt/lib/msan/tests/msan_test.cpp b/compiler-rt/lib/msan/tests/msan_test.cpp index 5dc9090f36c0..7378b237a711 100644 --- a/compiler-rt/lib/msan/tests/msan_test.cpp +++ b/compiler-rt/lib/msan/tests/msan_test.cpp @@ -3707,9 +3707,7 @@ TEST(MemorySanitizer, getgrent_r) { EXPECT_NOT_POISONED(grp.gr_gid); EXPECT_NOT_POISONED(grpres); } -#endif -#ifdef __GLIBC__ TEST(MemorySanitizer, fgetgrent_r) { FILE *fp = fopen("/etc/group", "r"); struct group grp; diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_allocator.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_allocator.cpp index b5b14b921824..3157b35ffaf8 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_allocator.cpp +++ b/compiler-rt/lib/sanitizer_common/sanitizer_allocator.cpp @@ -26,7 +26,7 @@ const char *SecondaryAllocatorName = "LargeMmapAllocator"; // ThreadSanitizer for Go uses libc malloc/free. #if defined(SANITIZER_USE_MALLOC) -#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_OHOS +# if SANITIZER_LINUX && !SANITIZER_ANDROID extern "C" void *__libc_malloc(uptr size); # if !SANITIZER_GO extern "C" void *__libc_memalign(uptr alignment, uptr size); diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc index 37d5dfbc8d89..d4b9ea5f7f06 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc @@ -2180,13 +2180,11 @@ INTERCEPTOR(int, clock_gettime, u32 clk_id, void *tp) { } namespace __sanitizer { extern "C" { -#if !SANITIZER_OHOS int real_clock_gettime(u32 clk_id, void *tp) { if (COMMON_INTERCEPTOR_NOTHING_IS_INITIALIZED) return internal_clock_gettime(clk_id, tp); return REAL(clock_gettime)(clk_id, tp); } -#endif } // extern "C" } // namespace __sanitizer INTERCEPTOR(int, clock_settime, u32 clk_id, const void *tp) { @@ -2453,7 +2451,7 @@ INTERCEPTOR(int, wait3, int *status, int options, void *rusage) { } return res; } -#if SANITIZER_ANDROID || SANITIZER_OHOS +#if SANITIZER_ANDROID INTERCEPTOR(int, __wait4, int pid, int *status, int options, void *rusage) { void *ctx; COMMON_INTERCEPTOR_ENTER(ctx, __wait4, pid, status, options, rusage); @@ -3752,7 +3750,7 @@ INTERCEPTOR(char *, strerror, int errnum) { // static storage. #if ((_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && !_GNU_SOURCE) || \ SANITIZER_MAC || SANITIZER_ANDROID || SANITIZER_NETBSD || \ - SANITIZER_FREEBSD || SANITIZER_OHOS + SANITIZER_FREEBSD // POSIX version. Spec is not clear on whether buf is NULL-terminated. // At least on OSX, buf contents are valid even when the call fails. INTERCEPTOR(int, strerror_r, int errnum, char *buf, SIZE_T buflen) { diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc index a546a45293a9..7f181258eab5 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc @@ -98,7 +98,7 @@ static void ioctl_table_fill() { _(SIOCSIFNETMASK, READ, struct_ifreq_sz); #endif -#if (SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_OHOS) +#if (SANITIZER_LINUX && !SANITIZER_ANDROID) _(SIOCGETSGCNT, WRITE, struct_sioc_sg_req_sz); _(SIOCGETVIFCNT, WRITE, struct_sioc_vif_req_sz); #endif @@ -370,6 +370,15 @@ static void ioctl_table_fill() { #if SANITIZER_GLIBC // _(SIOCDEVPLIP, WRITE, struct_ifreq_sz); // the same as EQL_ENSLAVE + _(CYGETDEFTHRESH, WRITE, sizeof(int)); + _(CYGETDEFTIMEOUT, WRITE, sizeof(int)); + _(CYGETMON, WRITE, struct_cyclades_monitor_sz); + _(CYGETTHRESH, WRITE, sizeof(int)); + _(CYGETTIMEOUT, WRITE, sizeof(int)); + _(CYSETDEFTHRESH, NONE, 0); + _(CYSETDEFTIMEOUT, NONE, 0); + _(CYSETTHRESH, NONE, 0); + _(CYSETTIMEOUT, NONE, 0); _(EQL_EMANCIPATE, WRITE, struct_ifreq_sz); _(EQL_ENSLAVE, WRITE, struct_ifreq_sz); _(EQL_GETMASTRCFG, WRITE, struct_ifreq_sz); diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common_syscalls.inc b/compiler-rt/lib/sanitizer_common/sanitizer_common_syscalls.inc index e5f7af4d107a..1b89d6e17684 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_common_syscalls.inc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_common_syscalls.inc @@ -2294,7 +2294,7 @@ PRE_SYSCALL(ni_syscall)() {} POST_SYSCALL(ni_syscall)(long res) {} PRE_SYSCALL(ptrace)(long request, long pid, long addr, long data) { -#if !SANITIZER_ANDROID && !SANITIZER_OHOS && \ +#if !SANITIZER_ANDROID && \ (defined(__i386) || defined(__x86_64) || defined(__mips64) || \ defined(__powerpc64__) || defined(__aarch64__) || defined(__s390__) || \ SANITIZER_RISCV64) @@ -2316,7 +2316,7 @@ PRE_SYSCALL(ptrace)(long request, long pid, long addr, long data) { } POST_SYSCALL(ptrace)(long res, long request, long pid, long addr, long data) { -#if !SANITIZER_ANDROID && !SANITIZER_OHOS && \ +#if !SANITIZER_ANDROID && \ (defined(__i386) || defined(__x86_64) || defined(__mips64) || \ defined(__powerpc64__) || defined(__aarch64__) || defined(__s390__) || \ SANITIZER_RISCV64) diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_errno.h b/compiler-rt/lib/sanitizer_common/sanitizer_errno.h index efcc9820bd59..94f16b6e8735 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_errno.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_errno.h @@ -23,7 +23,8 @@ #if SANITIZER_FREEBSD || SANITIZER_MAC # define __errno_location __error -#elif SANITIZER_ANDROID || SANITIZER_NETBSD || SANITIZER_RTEMS +#elif SANITIZER_ANDROID || SANITIZER_NETBSD || \ + SANITIZER_RTEMS # define __errno_location __errno #elif SANITIZER_SOLARIS # define __errno_location ___errno diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_flags.inc b/compiler-rt/lib/sanitizer_common/sanitizer_flags.inc index 32827da14f1b..cfb5822645f1 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_flags.inc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_flags.inc @@ -60,8 +60,7 @@ COMMON_FLAG( "Mention name of executable when reporting error and " "append executable name to logs (as in \"log_path.exe_name.pid\").") COMMON_FLAG( - bool, log_to_syslog, - (bool)SANITIZER_ANDROID || (bool)SANITIZER_MAC || (bool)SANITIZER_OHOS, + bool, log_to_syslog, (bool)SANITIZER_ANDROID || (bool)SANITIZER_MAC, "Write all sanitizer output to syslog in addition to other means of " "logging.") COMMON_FLAG( @@ -231,15 +230,13 @@ COMMON_FLAG(bool, intercept_stat, true, COMMON_FLAG(bool, intercept_send, true, "If set, uses custom wrappers for send* functions " "to find more errors.") -COMMON_FLAG(bool, decorate_proc_maps, - (bool)SANITIZER_ANDROID || (bool)SANITIZER_OHOS, +COMMON_FLAG(bool, decorate_proc_maps, (bool)SANITIZER_ANDROID, "If set, decorate sanitizer mappings in /proc/self/maps with " "user-readable names") COMMON_FLAG(int, exitcode, 1, "Override the program exit status if the tool " "found an error") COMMON_FLAG( - bool, abort_on_error, - (bool)SANITIZER_ANDROID || (bool)SANITIZER_MAC || (bool)SANITIZER_OHOS, + bool, abort_on_error, (bool)SANITIZER_ANDROID || (bool)SANITIZER_MAC, "If set, the tool calls abort() instead of _exit() after printing the " "error report.") COMMON_FLAG(bool, suppress_equal_pcs, true, diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h b/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h index bd2f8b9ed06f..d8f0540037d2 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h @@ -104,7 +104,7 @@ // // FIXME: do we have anything like this on Mac? #ifndef SANITIZER_CAN_USE_PREINIT_ARRAY -#if ((SANITIZER_LINUX && !SANITIZER_OHOS) || SANITIZER_FUCHSIA || SANITIZER_NETBSD) && !defined(PIC) +#if (SANITIZER_LINUX || SANITIZER_FUCHSIA || SANITIZER_NETBSD) && !defined(PIC) #define SANITIZER_CAN_USE_PREINIT_ARRAY 1 // Before Solaris 11.4, .preinit_array is fully supported only with GNU ld. // FIXME: Check for those conditions. @@ -168,8 +168,8 @@ typedef long pid_t; typedef int pid_t; #endif -#if SANITIZER_FREEBSD || SANITIZER_NETBSD || SANITIZER_MAC || \ - SANITIZER_OHOS || \ +#if SANITIZER_FREEBSD || SANITIZER_NETBSD || \ + SANITIZER_MAC || \ (SANITIZER_SOLARIS && (defined(_LP64) || _FILE_OFFSET_BITS == 64)) || \ (SANITIZER_LINUX && defined(__x86_64__)) typedef u64 OFF_T; diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp index 1f75c5813362..379f6d9e294b 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp +++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp @@ -34,7 +34,7 @@ // format. Struct kernel_stat is defined as 'struct stat' in asm/stat.h. To // access stat from asm/stat.h, without conflicting with definition in // sys/stat.h, we use this trick. -#if defined(__mips64) || defined(__riscv) +#if defined(__mips64) #include #include #define stat kernel_stat @@ -49,6 +49,7 @@ #include #undef stat #endif + #include #include #include @@ -73,7 +74,7 @@ #include #endif -#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_OHOS +#if SANITIZER_LINUX && !SANITIZER_ANDROID #include #endif @@ -488,7 +489,7 @@ int TgKill(pid_t pid, tid_t tid, int sig) { } #endif -#if !SANITIZER_SOLARIS && !SANITIZER_NETBSD && !SANITIZER_OHOS +#if !SANITIZER_SOLARIS && !SANITIZER_NETBSD u64 NanoTime() { #if SANITIZER_FREEBSD timeval tv; @@ -500,19 +501,10 @@ u64 NanoTime() { return (u64)tv.tv_sec * 1000*1000*1000 + tv.tv_usec * 1000; } -#elif SANITIZER_OHOS -u64 NanoTime() { - struct timespec ts; - clock_gettime(CLOCK_REALTIME, &ts); - return (u64)ts.tv_sec * 1000 * 1000 * 1000 + ts.tv_nsec; -} -#endif // !SANITIZER_SOLARIS && !SANITIZER_NETBSD - -#if !SANITIZER_SOLARIS && !SANITIZER_NETBSD && !SANITIZER_OHOS uptr internal_clock_gettime(__sanitizer_clockid_t clk_id, void *tp) { return internal_syscall(SYSCALL(clock_gettime), clk_id, tp); } -#endif +#endif // !SANITIZER_SOLARIS && !SANITIZER_NETBSD // Like getenv, but reads env directly from /proc (on Linux) or parses the // 'environ' array (on some others) and does not use libc. This function @@ -830,7 +822,7 @@ int internal_sigaction_norestorer(int signum, const void *act, void *oldact) { // rt_sigaction, so we need to do the same (we'll need to reimplement the // restorers; for x86_64 the restorer address can be obtained from // oldact->sa_restorer upon a call to sigaction(xxx, NULL, oldact). -#if (!SANITIZER_ANDROID && !SANITIZER_OHOS) || !SANITIZER_MIPS32 +#if !SANITIZER_ANDROID || !SANITIZER_MIPS32 k_act.sa_restorer = u_act->sa_restorer; #endif } @@ -846,7 +838,7 @@ int internal_sigaction_norestorer(int signum, const void *act, void *oldact) { internal_memcpy(&u_oldact->sa_mask, &k_oldact.sa_mask, sizeof(__sanitizer_kernel_sigset_t)); u_oldact->sa_flags = k_oldact.sa_flags; -#if (!SANITIZER_ANDROID && !SANITIZER_OHOS) || !SANITIZER_MIPS32 +#if !SANITIZER_ANDROID || !SANITIZER_MIPS32 u_oldact->sa_restorer = k_oldact.sa_restorer; #endif } @@ -1012,7 +1004,7 @@ static uptr GetKernelAreaSize() { if ((segment.end >= 3 * gbyte) && segment.IsWritable()) return 0; } -#if !SANITIZER_ANDROID && !SANITIZER_OHOS +#if !SANITIZER_ANDROID // Even if nothing is mapped, top Gb may still be accessible // if we are running on 64-bit kernel. // Uname may report misleading results if personality type @@ -1773,7 +1765,7 @@ void *internal_start_thread(void *(*func)(void *arg), void *arg) { // Start the thread with signals blocked, otherwise it can steal user signals. __sanitizer_sigset_t set, old; internal_sigfillset(&set); -#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_OHOS +#if SANITIZER_LINUX && !SANITIZER_ANDROID // Glibc uses SIGSETXID signal during setuid call. If this signal is blocked // on any thread, setuid call hangs (see test/tsan/setuid.c). internal_sigdelset(&set, 33); @@ -1803,7 +1795,7 @@ struct __sanitizer_esr_context { static bool Aarch64GetESR(ucontext_t *ucontext, u64 *esr) { static const u32 kEsrMagic = 0x45535201; - u8 *aux = (u8 *)ucontext->uc_mcontext.__reserved; + u8 *aux = ucontext->uc_mcontext.__reserved; while (true) { _aarch64_ctx *ctx = (_aarch64_ctx *)aux; if (ctx->size == 0) break; diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_linux.h b/compiler-rt/lib/sanitizer_common/sanitizer_linux.h index 66a510bec909..24902d1b6bce 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_linux.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux.h @@ -116,7 +116,7 @@ inline void ReleaseMemoryPagesToOSAndZeroFill(uptr beg, uptr end) { ReleaseMemoryPagesToOS(beg, end); } -#if SANITIZER_ANDROID || SANITIZER_OHOS +#if SANITIZER_ANDROID #if defined(__aarch64__) # define __get_tls() \ @@ -134,9 +134,6 @@ inline void ReleaseMemoryPagesToOSAndZeroFill(uptr beg, uptr end) { "rdhwr %0,$29\n" \ ".set pop\n" : "=r"(__v)); \ __v; }) -#elif defined(__riscv) -# define __get_tls() \ - ({ void** __v; __asm__("mv %0, tp" : "=r"(__v)); __v; }) #elif defined(__i386__) # define __get_tls() \ ({ void** __v; __asm__("movl %%gs:0, %0" : "=r"(__v)); __v; }) diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp index fe9d80e0e465..f20b9001c2c2 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp +++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp @@ -75,7 +75,7 @@ struct __sanitizer::linux_dirent { #endif #endif -#if !SANITIZER_ANDROID && !SANITIZER_OHOS +#if !SANITIZER_ANDROID #include #include #endif @@ -803,7 +803,7 @@ void LogMessageOnPrintf(const char *str) { #endif // SANITIZER_LINUX -#if SANITIZER_LINUX && !SANITIZER_GO && !SANITIZER_OHOS +#if SANITIZER_LINUX && !SANITIZER_GO // glibc crashes when using clock_gettime from a preinit_array function as the // vDSO function pointers haven't been initialized yet. __progname is // initialized after the vDSO function pointers, so if it exists, is not null @@ -839,11 +839,7 @@ u64 MonotonicNanoTime() { // Non-Linux & Go always use the syscall. u64 MonotonicNanoTime() { timespec ts; -#if SANITIZER_OHOS - clock_gettime(CLOCK_MONOTONIC, &ts); -#else internal_clock_gettime(CLOCK_MONOTONIC, &ts); -#endif return (u64)ts.tv_sec * (1000ULL * 1000 * 1000) + ts.tv_nsec; } #endif // SANITIZER_LINUX && !SANITIZER_GO diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform.h b/compiler-rt/lib/sanitizer_common/sanitizer_platform.h index 8f5f59b34366..96c01bad870d 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_platform.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform.h @@ -13,9 +13,9 @@ #define SANITIZER_PLATFORM_H #if !defined(__linux__) && !defined(__FreeBSD__) && !defined(__NetBSD__) && \ - !defined(__APPLE__) && !defined(_WIN32) && !defined(__OHOS_FAMILY__) && \ - !defined(__Fuchsia__) && !defined(__rtems__) && \ - !(defined(__sun__) && defined(__svr4__)) + !defined(__APPLE__) && !defined(_WIN32) && \ + !defined(__Fuchsia__) && !defined(__rtems__) && \ + !(defined(__sun__) && defined(__svr4__)) # error "This operating system is not supported" #endif @@ -105,12 +105,6 @@ # define SANITIZER_ANDROID 0 #endif -#if defined(__OHOS__) -#define SANITIZER_OHOS 1 -#else -#define SANITIZER_OHOS 0 -#endif - #if defined(__Fuchsia__) # define SANITIZER_FUCHSIA 1 #else @@ -244,8 +238,7 @@ // For such platforms build this code with -DSANITIZER_CAN_USE_ALLOCATOR64=0 or // change the definition of SANITIZER_CAN_USE_ALLOCATOR64 here. #ifndef SANITIZER_CAN_USE_ALLOCATOR64 -#if ((SANITIZER_ANDROID || SANITIZER_OHOS) && defined(__aarch64__)) || \ - SANITIZER_FUCHSIA +# if (SANITIZER_ANDROID && defined(__aarch64__)) || SANITIZER_FUCHSIA # define SANITIZER_CAN_USE_ALLOCATOR64 1 # elif defined(__mips64) || defined(__aarch64__) # define SANITIZER_CAN_USE_ALLOCATOR64 0 diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h b/compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h index f53e9b9f27e8..7f7b38d4215b 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h @@ -58,12 +58,6 @@ #define SI_ANDROID 0 #endif -#if SANITIZER_OHOS -#define SI_OHOS 1 -#else -#define SI_OHOS 0 -#endif - #if SANITIZER_FREEBSD #define SI_FREEBSD 1 #else @@ -232,7 +226,7 @@ (SI_FREEBSD || SI_NETBSD || SI_MAC || SI_LINUX_NOT_ANDROID || SI_SOLARIS) #define SANITIZER_INTERCEPT_GETPWENT \ (SI_FREEBSD || SI_NETBSD || SI_MAC || SI_LINUX_NOT_ANDROID || SI_SOLARIS) -#define SANITIZER_INTERCEPT_FGETGRENT_R (SI_GLIBC || SI_SOLARIS) +#define SANITIZER_INTERCEPT_FGETGRENT_R (SI_FREEBSD || SI_GLIBC || SI_SOLARIS) #define SANITIZER_INTERCEPT_FGETPWENT SI_LINUX_NOT_ANDROID || SI_SOLARIS #define SANITIZER_INTERCEPT_GETPWENT_R \ (SI_FREEBSD || SI_NETBSD || SI_GLIBC || SI_SOLARIS) @@ -277,7 +271,7 @@ #define SANITIZER_INTERCEPT_SYSINFO SI_LINUX #define SANITIZER_INTERCEPT_READDIR SI_POSIX #define SANITIZER_INTERCEPT_READDIR64 SI_LINUX_NOT_ANDROID || SI_SOLARIS32 -#if SI_LINUX_NOT_ANDROID && !SI_OHOS && \ +#if SI_LINUX_NOT_ANDROID && \ (defined(__i386) || defined(__x86_64) || defined(__mips64) || \ defined(__powerpc64__) || defined(__aarch64__) || defined(__arm__) || \ defined(__s390__) || SANITIZER_RISCV64) @@ -347,9 +341,8 @@ #define SANITIZER_INTERCEPT_ETHER_HOST \ (SI_FREEBSD || SI_MAC || SI_LINUX_NOT_ANDROID) #define SANITIZER_INTERCEPT_ETHER_R (SI_FREEBSD || SI_LINUX_NOT_ANDROID) -#define SANITIZER_INTERCEPT_SHMCTL \ - (((SI_FREEBSD || SI_LINUX_NOT_ANDROID) && !SI_OHOS && \ - SANITIZER_WORDSIZE == 64) || \ +#define SANITIZER_INTERCEPT_SHMCTL \ + (((SI_FREEBSD || SI_LINUX_NOT_ANDROID) && SANITIZER_WORDSIZE == 64) || \ SI_NETBSD || SI_SOLARIS) // NOLINT #define SANITIZER_INTERCEPT_RANDOM_R SI_GLIBC #define SANITIZER_INTERCEPT_PTHREAD_ATTR_GET SI_POSIX @@ -413,7 +406,7 @@ (SI_FREEBSD || SI_NETBSD || SI_GLIBC || SI_SOLARIS) #define SANITIZER_INTERCEPT_TLS_GET_ADDR \ - (SI_FREEBSD || SI_NETBSD || (SI_LINUX_NOT_ANDROID && !SI_OHOS) || SI_SOLARIS) + (SI_FREEBSD || SI_NETBSD || SI_LINUX_NOT_ANDROID || SI_SOLARIS) #define SANITIZER_INTERCEPT_LISTXATTR SI_LINUX #define SANITIZER_INTERCEPT_GETXATTR SI_LINUX @@ -471,7 +464,7 @@ #define SANITIZER_INTERCEPT_EVENTFD_READ_WRITE SI_LINUX #define SANITIZER_INTERCEPT_STAT \ - (SI_FREEBSD || SI_MAC || SI_ANDROID || SI_NETBSD || SI_SOLARIS || SI_OHOS) + (SI_FREEBSD || SI_MAC || SI_ANDROID || SI_NETBSD || SI_SOLARIS) #define SANITIZER_INTERCEPT_LSTAT (SI_NETBSD || SI_FREEBSD) #define SANITIZER_INTERCEPT___XSTAT (!SANITIZER_INTERCEPT_STAT && SI_POSIX) #define SANITIZER_INTERCEPT___XSTAT64 SI_LINUX_NOT_ANDROID @@ -501,7 +494,7 @@ #define SANITIZER_INTERCEPT_WCSCAT SI_POSIX #define SANITIZER_INTERCEPT_WCSDUP SI_POSIX #define SANITIZER_INTERCEPT_SIGNAL_AND_SIGACTION (!SI_WINDOWS && SI_NOT_FUCHSIA) -#define SANITIZER_INTERCEPT_BSD_SIGNAL (SI_ANDROID || SI_OHOS) +#define SANITIZER_INTERCEPT_BSD_SIGNAL SI_ANDROID #define SANITIZER_INTERCEPT_ACCT (SI_NETBSD || SI_FREEBSD) #define SANITIZER_INTERCEPT_USER_FROM_UID SI_NETBSD @@ -512,7 +505,7 @@ #define SANITIZER_INTERCEPT_FACCESSAT (SI_NETBSD || SI_FREEBSD) #define SANITIZER_INTERCEPT_GETGROUPLIST SI_NETBSD #define SANITIZER_INTERCEPT_STRLCPY \ - (SI_NETBSD || SI_FREEBSD || SI_MAC || SI_ANDROID || SI_OHOS) + (SI_NETBSD || SI_FREEBSD || SI_MAC || SI_ANDROID) #define SANITIZER_INTERCEPT_NAME_TO_HANDLE_AT SI_LINUX_NOT_ANDROID #define SANITIZER_INTERCEPT_OPEN_BY_HANDLE_AT SI_LINUX_NOT_ANDROID diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_linux.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_linux.cpp index 470f6ebf8d38..c51327e1269e 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_linux.cpp +++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_linux.cpp @@ -59,7 +59,7 @@ using namespace __sanitizer; namespace __sanitizer { #if !SANITIZER_ANDROID -unsigned struct_statfs64_sz = sizeof(struct statfs64); + unsigned struct_statfs64_sz = sizeof(struct statfs64); #endif } // namespace __sanitizer @@ -81,7 +81,7 @@ CHECK_SIZE_AND_OFFSET(io_event, obj); CHECK_SIZE_AND_OFFSET(io_event, res); CHECK_SIZE_AND_OFFSET(io_event, res2); -#if !SANITIZER_ANDROID && !SANITIZER_OHOS +#if !SANITIZER_ANDROID COMPILER_CHECK(sizeof(struct __sanitizer_perf_event_attr) <= sizeof(struct perf_event_attr)); CHECK_SIZE_AND_OFFSET(perf_event_attr, type); @@ -90,7 +90,7 @@ CHECK_SIZE_AND_OFFSET(perf_event_attr, size); COMPILER_CHECK(iocb_cmd_pread == IOCB_CMD_PREAD); COMPILER_CHECK(iocb_cmd_pwrite == IOCB_CMD_PWRITE); -#if !SANITIZER_ANDROID && !SANITIZER_OHOS +#if !SANITIZER_ANDROID COMPILER_CHECK(iocb_cmd_preadv == IOCB_CMD_PREADV); COMPILER_CHECK(iocb_cmd_pwritev == IOCB_CMD_PWRITEV); #endif diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp index a31947c08016..12dd39e674ac 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp +++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp @@ -69,9 +69,7 @@ #include #include #include -#if !SANITIZER_OHOS #include -#endif #include #include #include @@ -93,16 +91,8 @@ #if SANITIZER_LINUX # include # include - -#if SANITIZER_OHOS -// Do not include asm/sigcontext.h on behalf of asm/ptrace.h -// to avoid multiple definiton errors. -#define __ASM_SIGCONTEXT_H 1 -#endif - #if defined(__mips64) || defined(__aarch64__) || defined(__arm__) || \ SANITIZER_RISCV64 - # include # ifdef __arm__ typedef struct user_fpregs elf_fpregset_t; @@ -141,14 +131,6 @@ typedef struct user_fpregs elf_fpregset_t; #if SANITIZER_ANDROID #include -#elif SANITIZER_OHOS -#include -#include -#include -#include -#include -#include -#include #else #include #include @@ -161,6 +143,7 @@ typedef struct user_fpregs elf_fpregset_t; # include #endif #include +#include #include #include #include @@ -269,7 +252,7 @@ namespace __sanitizer { unsigned struct_rlimit64_sz = sizeof(struct rlimit64); unsigned struct_statvfs64_sz = sizeof(struct statvfs64); unsigned struct_crypt_data_sz = sizeof(struct crypt_data); -#endif // SANITIZER_LINUX && !SANITIZER_ANDROID +#endif // SANITIZER_LINUX && !SANITIZER_ANDROID #if SANITIZER_LINUX && !SANITIZER_ANDROID unsigned struct_timex_sz = sizeof(struct timex); @@ -287,6 +270,7 @@ namespace __sanitizer { int e_tabsz = (int)E_TABSZ; #endif + #if SANITIZER_LINUX && !SANITIZER_ANDROID unsigned struct_shminfo_sz = sizeof(struct shminfo); unsigned struct_shm_info_sz = sizeof(struct shm_info); @@ -475,6 +459,7 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr); #if SANITIZER_GLIBC unsigned struct_ax25_parms_struct_sz = sizeof(struct ax25_parms_struct); + unsigned struct_cyclades_monitor_sz = sizeof(struct cyclades_monitor); #if EV_VERSION > (0x010000) unsigned struct_input_keymap_entry_sz = sizeof(struct input_keymap_entry); #else @@ -500,7 +485,7 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr); unsigned struct_ppp_stats_sz = sizeof(struct ppp_stats); #endif // SANITIZER_GLIBC -#if !SANITIZER_ANDROID && !SANITIZER_MAC && !SANITIZER_OHOS +#if !SANITIZER_ANDROID && !SANITIZER_MAC unsigned struct_sioc_sg_req_sz = sizeof(struct sioc_sg_req); unsigned struct_sioc_vif_req_sz = sizeof(struct sioc_vif_req); #endif @@ -553,7 +538,7 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr); unsigned IOCTL_TIOCSPGRP = TIOCSPGRP; unsigned IOCTL_TIOCSTI = TIOCSTI; unsigned IOCTL_TIOCSWINSZ = TIOCSWINSZ; -#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_OHOS +#if SANITIZER_LINUX && !SANITIZER_ANDROID unsigned IOCTL_SIOCGETSGCNT = SIOCGETSGCNT; unsigned IOCTL_SIOCGETVIFCNT = SIOCGETVIFCNT; #endif @@ -837,7 +822,16 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr); unsigned IOCTL_VT_WAITACTIVE = VT_WAITACTIVE; #endif // SANITIZER_LINUX -#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_OHOS +#if SANITIZER_LINUX && !SANITIZER_ANDROID + unsigned IOCTL_CYGETDEFTHRESH = CYGETDEFTHRESH; + unsigned IOCTL_CYGETDEFTIMEOUT = CYGETDEFTIMEOUT; + unsigned IOCTL_CYGETMON = CYGETMON; + unsigned IOCTL_CYGETTHRESH = CYGETTHRESH; + unsigned IOCTL_CYGETTIMEOUT = CYGETTIMEOUT; + unsigned IOCTL_CYSETDEFTHRESH = CYSETDEFTHRESH; + unsigned IOCTL_CYSETDEFTIMEOUT = CYSETDEFTIMEOUT; + unsigned IOCTL_CYSETTHRESH = CYSETTHRESH; + unsigned IOCTL_CYSETTIMEOUT = CYSETTIMEOUT; unsigned IOCTL_EQL_EMANCIPATE = EQL_EMANCIPATE; unsigned IOCTL_EQL_ENSLAVE = EQL_ENSLAVE; unsigned IOCTL_EQL_GETMASTRCFG = EQL_GETMASTRCFG; @@ -921,7 +915,7 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr); unsigned IOCTL_TIOCSSERIAL = TIOCSSERIAL; #endif // SANITIZER_LINUX && !SANITIZER_ANDROID -#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_OHOS +#if SANITIZER_LINUX && !SANITIZER_ANDROID unsigned IOCTL_GIO_SCRNMAP = GIO_SCRNMAP; unsigned IOCTL_KDDISABIO = KDDISABIO; unsigned IOCTL_KDENABIO = KDENABIO; @@ -1089,8 +1083,7 @@ CHECK_STRUCT_SIZE_AND_OFFSET(sigaction, sa_mask); // didn't exist. CHECK_STRUCT_SIZE_AND_OFFSET(sigaction, sa_flags); #endif -#if SANITIZER_LINUX && (!SANITIZER_ANDROID || !SANITIZER_MIPS32) && \ - !SANITIZER_OHOS +#if SANITIZER_LINUX && (!SANITIZER_ANDROID || !SANITIZER_MIPS32) CHECK_STRUCT_SIZE_AND_OFFSET(sigaction, sa_restorer); #endif @@ -1184,7 +1177,7 @@ CHECK_TYPE_SIZE(clock_t); CHECK_TYPE_SIZE(clockid_t); #endif -#if !SANITIZER_ANDROID && !SANITIZER_OHOS +#if !SANITIZER_ANDROID CHECK_TYPE_SIZE(ifaddrs); CHECK_SIZE_AND_OFFSET(ifaddrs, ifa_next); CHECK_SIZE_AND_OFFSET(ifaddrs, ifa_name); diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h index ec77df6148ad..836b178c131b 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h @@ -187,17 +187,15 @@ struct __sanitizer_struct_mallinfo { }; #endif -#if SANITIZER_LINUX && !SANITIZER_ANDROID -extern unsigned struct_ustat_sz; -extern unsigned struct_rlimit64_sz; -extern unsigned struct_statvfs64_sz; -#endif - #if SANITIZER_LINUX && !SANITIZER_ANDROID struct __sanitizer_struct_mallinfo { int v[10]; }; +extern unsigned struct_ustat_sz; +extern unsigned struct_rlimit64_sz; +extern unsigned struct_statvfs64_sz; + struct __sanitizer_ipc_perm { int __key; int uid; @@ -369,7 +367,7 @@ struct __sanitizer_group { char **gr_mem; }; -#if SANITIZER_OHOS || (defined(__x86_64__) && !defined(_LP64)) +#if defined(__x86_64__) && !defined(_LP64) typedef long long __sanitizer_time_t; #else typedef long __sanitizer_time_t; @@ -477,7 +475,7 @@ struct __sanitizer_dirent { unsigned short d_reclen; // more fields that we don't care about }; -#elif SANITIZER_ANDROID || defined(__x86_64__) || SANITIZER_OHOS +#elif SANITIZER_ANDROID || defined(__x86_64__) struct __sanitizer_dirent { unsigned long long d_ino; unsigned long long d_off; @@ -593,7 +591,7 @@ struct __sanitizer_sigaction { }; __sanitizer_sigset_t sa_mask; }; -#elif (SANITIZER_ANDROID || SANITIZER_OHOS) && (SANITIZER_WORDSIZE == 32) +#elif SANITIZER_ANDROID && (SANITIZER_WORDSIZE == 32) struct __sanitizer_sigaction { union { __sanitizer_sigactionhandler_ptr sigaction; @@ -603,7 +601,7 @@ struct __sanitizer_sigaction { uptr sa_flags; void (*sa_restorer)(); }; -#else // !SANITIZER_ANDROID +#else // !SANITIZER_ANDROID struct __sanitizer_sigaction { #if defined(__mips__) && !SANITIZER_FREEBSD unsigned int sa_flags; @@ -781,7 +779,7 @@ struct __sanitizer_wordexp_t { uptr we_offs; }; -#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_OHOS +#if SANITIZER_LINUX && !SANITIZER_ANDROID struct __sanitizer_FILE { int _flags; char *_IO_read_ptr; @@ -805,7 +803,7 @@ typedef void __sanitizer_FILE; # define SANITIZER_HAS_STRUCT_FILE 0 #endif -#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_OHOS && \ +#if SANITIZER_LINUX && !SANITIZER_ANDROID && \ (defined(__i386) || defined(__x86_64) || defined(__mips64) || \ defined(__powerpc64__) || defined(__aarch64__) || defined(__arm__) || \ defined(__s390__) || SANITIZER_RISCV64) @@ -983,8 +981,9 @@ extern unsigned struct_synth_info_sz; extern unsigned struct_vt_mode_sz; #endif // SANITIZER_LINUX -#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_OHOS +#if SANITIZER_LINUX && !SANITIZER_ANDROID extern unsigned struct_ax25_parms_struct_sz; +extern unsigned struct_cyclades_monitor_sz; extern unsigned struct_input_keymap_entry_sz; extern unsigned struct_ipx_config_data_sz; extern unsigned struct_kbdiacrs_sz; @@ -1004,12 +1003,12 @@ extern unsigned struct_unimapinit_sz; extern const unsigned long __sanitizer_bufsiz; -#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_OHOS +#if SANITIZER_LINUX && !SANITIZER_ANDROID extern unsigned struct_audio_buf_info_sz; extern unsigned struct_ppp_stats_sz; #endif // (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID -#if !SANITIZER_ANDROID && !SANITIZER_MAC && !SANITIZER_OHOS +#if !SANITIZER_ANDROID && !SANITIZER_MAC extern unsigned struct_sioc_sg_req_sz; extern unsigned struct_sioc_vif_req_sz; #endif @@ -1064,7 +1063,7 @@ extern unsigned IOCTL_TIOCSETD; extern unsigned IOCTL_TIOCSPGRP; extern unsigned IOCTL_TIOCSTI; extern unsigned IOCTL_TIOCSWINSZ; -#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_OHOS +#if SANITIZER_LINUX && !SANITIZER_ANDROID extern unsigned IOCTL_SIOCGETSGCNT; extern unsigned IOCTL_SIOCGETVIFCNT; #endif @@ -1328,7 +1327,7 @@ extern unsigned IOCTL_VT_SETMODE; extern unsigned IOCTL_VT_WAITACTIVE; #endif // SANITIZER_LINUX -#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_OHOS +#if SANITIZER_LINUX && !SANITIZER_ANDROID extern unsigned IOCTL_CYGETDEFTHRESH; extern unsigned IOCTL_CYGETDEFTIMEOUT; extern unsigned IOCTL_CYGETMON; diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_posix.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_posix.cpp index 01860a9c1704..2e080098283f 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_posix.cpp +++ b/compiler-rt/lib/sanitizer_common/sanitizer_posix.cpp @@ -341,7 +341,7 @@ bool ShouldMockFailureToOpen(const char *path) { internal_strncmp(path, "/proc/", 6) == 0; } -#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_GO && !SANITIZER_OHOS +#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_GO int GetNamedMappingFd(const char *name, uptr size, int *flags) { if (!common_flags()->decorate_proc_maps || !name) return -1; @@ -373,7 +373,7 @@ int GetNamedMappingFd(const char *name, uptr size, int *flags) { } #endif -#if SANITIZER_ANDROID || SANITIZER_OHOS +#if SANITIZER_ANDROID #define PR_SET_VMA 0x53564d41 #define PR_SET_VMA_ANON_NAME 0 void DecorateMapping(uptr addr, uptr size, const char *name) { diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp index a5e3b4d76e2d..d29438cf9dbd 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp +++ b/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp @@ -165,27 +165,21 @@ bool SupportsColoredOutput(fd_t fd) { #if !SANITIZER_GO // TODO(glider): different tools may require different altstack size. -static uptr GetAltStackSize() { - // Note: since GLIBC_2.31, SIGSTKSZ may be a function call, so this may be - // more costly that you think. However GetAltStackSize is only call 2-3 times - // per thread so don't cache the evaluation. - return SIGSTKSZ * 4; -} +static const uptr kAltStackSize = SIGSTKSZ * 4; // SIGSTKSZ is not enough. void SetAlternateSignalStack() { stack_t altstack, oldstack; CHECK_EQ(0, sigaltstack(nullptr, &oldstack)); // If the alternate stack is already in place, do nothing. // Android always sets an alternate stack, but it's too small for us. - if (!SANITIZER_ANDROID && !(oldstack.ss_flags & SS_DISABLE)) - return; + if (!SANITIZER_ANDROID && !(oldstack.ss_flags & SS_DISABLE)) return; // TODO(glider): the mapped stack should have the MAP_STACK flag in the // future. It is not required by man 2 sigaltstack now (they're using // malloc()). - void *base = MmapOrDie(GetAltStackSize(), __func__); + void* base = MmapOrDie(kAltStackSize, __func__); altstack.ss_sp = (char*) base; altstack.ss_flags = 0; - altstack.ss_size = GetAltStackSize(); + altstack.ss_size = kAltStackSize; CHECK_EQ(0, sigaltstack(&altstack, nullptr)); } @@ -193,7 +187,7 @@ void UnsetAlternateSignalStack() { stack_t altstack, oldstack; altstack.ss_sp = nullptr; altstack.ss_flags = SS_DISABLE; - altstack.ss_size = GetAltStackSize(); // Some sane value required on Darwin. + altstack.ss_size = kAltStackSize; // Some sane value required on Darwin. CHECK_EQ(0, sigaltstack(&altstack, &oldstack)); UnmapOrDie(oldstack.ss_sp, oldstack.ss_size); } diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_stackdepot.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_stackdepot.cpp index 38af2748c9ba..44a95214e38b 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_stackdepot.cpp +++ b/compiler-rt/lib/sanitizer_common/sanitizer_stackdepot.cpp @@ -26,8 +26,7 @@ struct StackDepotNode { u32 tag; uptr stack[1]; // [size] - static const u32 kTabSizeLog = - (SANITIZER_ANDROID || SANITIZER_OHOS) ? 16 : 20; + static const u32 kTabSizeLog = SANITIZER_ANDROID ? 16 : 20; // Lower kTabSizeLog bits are equal for all items in one bucket. // We use these bits to store the per-stack use counter. static const u32 kUseCountBits = kTabSizeLog; diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_stackdepot.h b/compiler-rt/lib/sanitizer_common/sanitizer_stackdepot.h index 3e6c0b9d4691..0e26c1fc37c4 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_stackdepot.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_stackdepot.h @@ -31,8 +31,7 @@ struct StackDepotHandle { void inc_use_count_unsafe(); }; -const int kStackDepotMaxUseCount = - 1U << ((SANITIZER_ANDROID || SANITIZER_OHOS) ? 16 : 20); +const int kStackDepotMaxUseCount = 1U << (SANITIZER_ANDROID ? 16 : 20); StackDepotStats *StackDepotGetStats(); u32 StackDepotPut(StackTrace stack); diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp index 649078ba4e14..53cfddcfbe0b 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp +++ b/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp @@ -33,15 +33,10 @@ #include // for NT_PRSTATUS #if (defined(__aarch64__) || SANITIZER_RISCV64) && !SANITIZER_ANDROID // GLIBC 2.20+ sys/user does not include asm/ptrace.h -#if SANITIZER_OHOS -// Do not include asm/sigcontext.h on behalf of asm/ptrace.h -// to avoid multiple definiton errors. -#define __ASM_SIGCONTEXT_H 1 -#endif # include #endif #include // for user_regs_struct -#if (SANITIZER_ANDROID || SANITIZER_OHOS) && SANITIZER_MIPS +#if SANITIZER_ANDROID && SANITIZER_MIPS # include // for mips SP register in sys/user.h #endif #include // for signal-related stuff @@ -509,11 +504,6 @@ typedef pt_regs regs_struct; typedef struct user regs_struct; # if SANITIZER_ANDROID # define REG_SP regs[EF_R29] -// FIXME: For some reason, EF_R29 is not defined in asm/reg.h under -// #if _MIPS_SIM == _MIPS_SIM_ABI32 condition, so use MIPS32_EF_R29 as a -// temporary solution. -# elif SANITIZER_OHOS -# define REG_SP regs[MIPS32_EF_R29] # else # define REG_SP regs[EF_REG29] # endif diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_report.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_report.cpp index ff72a823b960..c99a6ceaa562 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_report.cpp +++ b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_report.cpp @@ -89,7 +89,7 @@ void ReportErrorSummary(const char *error_type, const StackTrace *stack, } void ReportMmapWriteExec(int prot) { -#if SANITIZER_POSIX && (!SANITIZER_GO && !SANITIZER_ANDROID) && !SANITIZER_OHOS +#if SANITIZER_POSIX && (!SANITIZER_GO && !SANITIZER_ANDROID) if ((prot & (PROT_WRITE | PROT_EXEC)) != (PROT_WRITE | PROT_EXEC)) return; diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_unwind_linux_libcdep.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_unwind_linux_libcdep.cpp index 18178cd69eb5..b2628dcc4dc1 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_unwind_linux_libcdep.cpp +++ b/compiler-rt/lib/sanitizer_common/sanitizer_unwind_linux_libcdep.cpp @@ -16,7 +16,7 @@ #include "sanitizer_common.h" #include "sanitizer_stacktrace.h" -#if SANITIZER_ANDROID || SANITIZER_OHOS +#if SANITIZER_ANDROID #include // for dlopen() #endif diff --git a/compiler-rt/lib/scudo/scudo_flags.inc b/compiler-rt/lib/scudo/scudo_flags.inc index ce4d641b811a..c124738c1f3a 100644 --- a/compiler-rt/lib/scudo/scudo_flags.inc +++ b/compiler-rt/lib/scudo/scudo_flags.inc @@ -39,7 +39,7 @@ SCUDO_FLAG(int, QuarantineChunksUpToSize, -1, // Disable the deallocation type check by default on Android, it causes too many // issues with third party libraries. SCUDO_FLAG(bool, DeallocationTypeMismatch, !SANITIZER_ANDROID, - "Report errors on malloc/delete, new/free, new/delete[], etc.") + "Report errors on malloc/delete, new/free, new/delete[], etc.") SCUDO_FLAG(bool, DeleteSizeMismatch, true, "Report errors on mismatch between size of new and delete.") diff --git a/compiler-rt/lib/scudo/scudo_platform.h b/compiler-rt/lib/scudo/scudo_platform.h index c2414ec60237..07d4b70fc8e9 100644 --- a/compiler-rt/lib/scudo/scudo_platform.h +++ b/compiler-rt/lib/scudo/scudo_platform.h @@ -24,10 +24,10 @@ #ifndef SCUDO_TSD_EXCLUSIVE // SCUDO_TSD_EXCLUSIVE wasn't defined, use a default TSD model for the platform. -#if SANITIZER_ANDROID || SANITIZER_FUCHSIA +# if SANITIZER_ANDROID || SANITIZER_FUCHSIA // Android and Fuchsia use a pool of TSDs shared between threads. # define SCUDO_TSD_EXCLUSIVE 0 -#elif SANITIZER_LINUX && !SANITIZER_ANDROID +# elif SANITIZER_LINUX && !SANITIZER_ANDROID // Non-Android Linux use an exclusive TSD per thread. # define SCUDO_TSD_EXCLUSIVE 1 # else @@ -42,7 +42,7 @@ // Maximum number of TSDs that can be created for the Shared model. #ifndef SCUDO_SHARED_TSD_POOL_SIZE -#if SANITIZER_ANDROID +# if SANITIZER_ANDROID # define SCUDO_SHARED_TSD_POOL_SIZE 2U # else # define SCUDO_SHARED_TSD_POOL_SIZE 32U @@ -67,7 +67,7 @@ namespace __scudo { #if SANITIZER_CAN_USE_ALLOCATOR64 -#if defined(__aarch64__) && SANITIZER_ANDROID +# if defined(__aarch64__) && SANITIZER_ANDROID const uptr AllocatorSize = 0x4000000000ULL; // 256G. # elif defined(__aarch64__) const uptr AllocatorSize = 0x10000000000ULL; // 1T. diff --git a/compiler-rt/lib/ubsan/ubsan_signals_standalone.cpp b/compiler-rt/lib/ubsan/ubsan_signals_standalone.cpp index 002e87038cfb..2c91db8ca397 100644 --- a/compiler-rt/lib/ubsan/ubsan_signals_standalone.cpp +++ b/compiler-rt/lib/ubsan/ubsan_signals_standalone.cpp @@ -26,7 +26,7 @@ // debuggerd handler, but before the ART handler. // * Interceptors don't work at all when ubsan runtime is loaded late, ex. when // it is part of an APK that does not use wrap.sh method. -#if SANITIZER_FUCHSIA || SANITIZER_ANDROID || SANITIZER_OHOS +#if SANITIZER_FUCHSIA || SANITIZER_ANDROID namespace __ubsan { void InitializeDeadlySignals() {} diff --git a/compiler-rt/test/asan/CMakeLists.txt b/compiler-rt/test/asan/CMakeLists.txt index c8b2152b373c..855fac4f039f 100644 --- a/compiler-rt/test/asan/CMakeLists.txt +++ b/compiler-rt/test/asan/CMakeLists.txt @@ -132,7 +132,7 @@ if(COMPILER_RT_INCLUDE_TESTS) ${CMAKE_CURRENT_BINARY_DIR}/Unit/dynamic/lit.site.cfg.py) endif() # FIXME: support unit test in the android test runner - if (NOT ANDROID AND NOT OHOS_FAMILY) + if (NOT ANDROID) list(APPEND ASAN_TEST_DEPS AsanUnitTests) list(APPEND ASAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/Unit) if(COMPILER_RT_ASAN_HAS_STATIC_RUNTIME) diff --git a/compiler-rt/test/asan/TestCases/Linux/lit.local.cfg.py b/compiler-rt/test/asan/TestCases/Linux/lit.local.cfg.py index c2352c676cc5..57271b8078a4 100644 --- a/compiler-rt/test/asan/TestCases/Linux/lit.local.cfg.py +++ b/compiler-rt/test/asan/TestCases/Linux/lit.local.cfg.py @@ -5,5 +5,5 @@ def getRoot(config): root = getRoot(config) -if root.host_os not in ['Linux', 'OHOS']: +if root.host_os not in ['Linux']: config.unsupported = True diff --git a/compiler-rt/test/asan/TestCases/Linux/odr_c_test.c b/compiler-rt/test/asan/TestCases/Linux/odr_c_test.c index f5f234028867..9929b4a67af3 100644 --- a/compiler-rt/test/asan/TestCases/Linux/odr_c_test.c +++ b/compiler-rt/test/asan/TestCases/Linux/odr_c_test.c @@ -17,7 +17,7 @@ __attribute__((aligned(8))) int x; __attribute__((aligned(1))) char y; // The gold linker puts ZZZ at the start of bss (where it is aligned) // unless we have a large alternative like Displace: -__attribute__((aligned(8))) char Displace[105]; +__attribute__((aligned(1))) char Displace[105]; __attribute__((aligned(1))) char ZZZ[100]; #elif defined(FILE2) int ZZZ = 1; diff --git a/compiler-rt/test/asan/TestCases/Linux/shmctl.cpp b/compiler-rt/test/asan/TestCases/Linux/shmctl.cpp index 8fed52092be8..e1752bc894c0 100644 --- a/compiler-rt/test/asan/TestCases/Linux/shmctl.cpp +++ b/compiler-rt/test/asan/TestCases/Linux/shmctl.cpp @@ -1,5 +1,5 @@ // FIXME: https://code.google.com/p/address-sanitizer/issues/detail?id=316 -// XFAIL: android && !ohos_family +// XFAIL: android // // RUN: %clangxx_asan -O1 %s -o %t && %run %t 2>&1 // Regression test for @@ -22,6 +22,6 @@ int main() { struct shm_info shmInfo; res = shmctl(0, SHM_INFO, (struct shmid_ds *)&shmInfo); assert(res > -1); - + return 0; } diff --git a/compiler-rt/test/asan/lit.cfg.py b/compiler-rt/test/asan/lit.cfg.py index 8be427f7ba1a..4f56c886e92e 100644 --- a/compiler-rt/test/asan/lit.cfg.py +++ b/compiler-rt/test/asan/lit.cfg.py @@ -247,7 +247,7 @@ else: config.substitutions.append(('%pie', '-pie')) # Only run the tests on supported OSs. -if config.host_os not in ['OHOS', 'Linux', 'Darwin', 'FreeBSD', 'SunOS', 'Windows', 'NetBSD']: +if config.host_os not in ['Linux', 'Darwin', 'FreeBSD', 'SunOS', 'Windows', 'NetBSD']: config.unsupported = True if not config.parallelism_group: diff --git a/compiler-rt/test/builtins/Unit/divtf3_test.c b/compiler-rt/test/builtins/Unit/divtf3_test.c index f8b1f20e59d2..927d0b826f8f 100644 --- a/compiler-rt/test/builtins/Unit/divtf3_test.c +++ b/compiler-rt/test/builtins/Unit/divtf3_test.c @@ -185,11 +185,6 @@ int main() UINT64_C(0))) return 1; - if (test__divtf3(-1L, - -0.999999999999999999999999999999999904L, - UINT64_C(0x1), - UINT64_C(0x3fff000000000000))) - return 1; #else printf("skipped\n"); diff --git a/compiler-rt/test/lit.common.cfg.py b/compiler-rt/test/lit.common.cfg.py index c28b2cea07ac..30cfdbee13e2 100644 --- a/compiler-rt/test/lit.common.cfg.py +++ b/compiler-rt/test/lit.common.cfg.py @@ -12,9 +12,6 @@ import json import lit.formats import lit.util -def is_ohos_family_mobile(): - return config.ohos_family and config.target_arch != 'x86_64' - # Choose between lit's internal shell pipeline runner and a real shell. If # LIT_USE_INTERNAL_SHELL is in the environment, we use that as an override. use_lit_shell = os.environ.get("LIT_USE_INTERNAL_SHELL") @@ -120,10 +117,10 @@ if config.host_os == 'NetBSD': config.netbsd_nomprotect_prefix = ('sh ' + os.path.join(nb_commands_dir, 'run_nomprotect.sh')) - config.substitutions.append(('%run_nomprotect', - config.netbsd_nomprotect_prefix)) + config.substitutions.append( ('%run_nomprotect', + config.netbsd_nomprotect_prefix) ) else: - config.substitutions.append(('%run_nomprotect', '%run')) + config.substitutions.append( ('%run_nomprotect', '%run') ) # Copied from libcxx's config.py def get_lit_conf(name, default=None): @@ -139,26 +136,13 @@ emulator = get_lit_conf('emulator', None) # Allow tests to be executed on a simulator or remotely. if emulator: - config.substitutions.append(('%run', emulator)) - config.substitutions.append(('%env ', "env ")) + config.substitutions.append( ('%run', emulator) ) + config.substitutions.append( ('%env ', "env ") ) # TODO: Implement `%device_rm` to perform removal of files in the emulator. # For now just make it a no-op. lit_config.warning('%device_rm is not implemented') - config.substitutions.append(('%device_rm', 'echo ')) - config.compile_wrapper = "" -elif is_ohos_family_mobile(): - config.available_features.add('ohos_family') - # FIXME: some tests for hos also need this now, - # probably this shouldn't be added for ohos - config.available_features.add('android') - compile_wrapper = os.path.join(config.compiler_rt_src_root, "test", "sanitizer_common", "ohos_family_commands", "ohos_compile.py") + " " - config.compile_wrapper = compile_wrapper - config.substitutions.append( ('%run', "") ) - config.substitutions.append( ('%env ', "env ") ) - # TODO: Implement `%device_rm` to perform removal of files on a device. For - # now just make it a no-op. - lit_config.warning('%device_rm is not implemented') config.substitutions.append( ('%device_rm', 'echo ') ) + config.compile_wrapper = "" elif config.host_os == 'Darwin' and config.apple_platform != "osx": # Darwin tests can be targetting macOS, a device or a simulator. All devices # are declared as "ios", even for iOS derivatives (tvOS, watchOS). Similarly, @@ -219,20 +203,20 @@ elif config.android: config.available_features.add('android') compile_wrapper = os.path.join(config.compiler_rt_src_root, "test", "sanitizer_common", "android_commands", "android_compile.py") + " " config.compile_wrapper = compile_wrapper - config.substitutions.append(('%run', "")) - config.substitutions.append(('%env ', "env ")) + config.substitutions.append( ('%run', "") ) + config.substitutions.append( ('%env ', "env ") ) else: - config.substitutions.append(('%run', "")) - config.substitutions.append(('%env ', "env ")) + config.substitutions.append( ('%run', "") ) + config.substitutions.append( ('%env ', "env ") ) # When running locally %device_rm is a no-op. - config.substitutions.append(('%device_rm', 'echo ')) + config.substitutions.append( ('%device_rm', 'echo ') ) config.compile_wrapper = "" # Define CHECK-%os to check for OS-dependent output. -config.substitutions.append(('CHECK-%os', ("CHECK-" + config.host_os))) +config.substitutions.append( ('CHECK-%os', ("CHECK-" + config.host_os))) # Define %arch to check for architecture-dependent output. -config.substitutions.append(('%arch', (config.host_arch))) +config.substitutions.append( ('%arch', (config.host_arch))) if config.host_os == 'Windows': # FIXME: This isn't quite right. Specifically, it will succeed if the program @@ -243,7 +227,7 @@ if config.host_os == 'Windows': else: config.expect_crash = "not --crash " -config.substitutions.append(("%expect_crash ", config.expect_crash)) +config.substitutions.append( ("%expect_crash ", config.expect_crash) ) target_arch = getattr(config, 'target_arch', None) if target_arch: @@ -345,12 +329,12 @@ if config.host_os == 'Darwin': for vers in min_macos_deployment_target_substitutions: flag = config.apple_platform_min_deployment_target_flag major, minor = get_macos_aligned_version(vers) - config.substitutions.append(('%%min_macos_deployment_target=%s.%s' % vers, '{}={}.{}'.format(flag, major, minor))) + config.substitutions.append( ('%%min_macos_deployment_target=%s.%s' % vers, '{}={}.{}'.format(flag, major, minor)) ) else: for vers in min_macos_deployment_target_substitutions: - config.substitutions.append(('%%min_macos_deployment_target=%s.%s' % vers, '')) + config.substitutions.append( ('%%min_macos_deployment_target=%s.%s' % vers, '') ) -if config.android or is_ohos_family_mobile(): +if config.android: env = os.environ.copy() if config.android_serial: env['ANDROID_SERIAL'] = config.android_serial @@ -361,25 +345,21 @@ if config.android or is_ohos_family_mobile(): # These are needed for tests to upload/download temp files, such as # suppression-files, to device. config.substitutions.append( ('%device_rundir', "/data/local/tmp/Output") ) - if not config.host_os == 'OHOS': - config.substitutions.append( ('%push_to_device', "%s -s '%s' push " % (adb, env['ANDROID_SERIAL']) ) ) - config.substitutions.append( ('%pull_from_device', "%s -s '%s' pull " % (adb, env['ANDROID_SERIAL']) ) ) - config.substitutions.append( ('%adb_shell ', "%s -s '%s' shell " % (adb, env['ANDROID_SERIAL']) ) ) - config.substitutions.append( ('%device_rm', "%s -s '%s' shell 'rm ' " % (adb, env['ANDROID_SERIAL']) ) ) + config.substitutions.append( ('%push_to_device', "%s -s '%s' push " % (adb, env['ANDROID_SERIAL']) ) ) + config.substitutions.append( ('%pull_from_device', "%s -s '%s' pull " % (adb, env['ANDROID_SERIAL']) ) ) + config.substitutions.append( ('%adb_shell ', "%s -s '%s' shell " % (adb, env['ANDROID_SERIAL']) ) ) + config.substitutions.append( ('%device_rm', "%s -s '%s' shell 'rm ' " % (adb, env['ANDROID_SERIAL']) ) ) try: - android_api_level_str = subprocess.check_output( - [adb, "shell", "getprop", "ro.build.version.sdk"], env=env).rstrip() - android_api_codename = subprocess.check_output( - [adb, "shell", "getprop", "ro.build.version.codename"], env=env).rstrip().decode("utf-8") + android_api_level_str = subprocess.check_output([adb, "shell", "getprop", "ro.build.version.sdk"], env=env).rstrip() + android_api_codename = subprocess.check_output([adb, "shell", "getprop", "ro.build.version.codename"], env=env).rstrip().decode("utf-8") except (subprocess.CalledProcessError, OSError): lit_config.fatal("Failed to read ro.build.version.sdk (using '%s' as adb)" % adb) try: android_api_level = int(android_api_level_str) except ValueError: lit_config.fatal("Failed to read ro.build.version.sdk (using '%s' as adb): got '%s'" % (adb, android_api_level_str)) - if config.android_api_level: - android_api_level = min(android_api_level, int(config.android_api_level)) + android_api_level = min(android_api_level, int(config.android_api_level)) for required in [26, 28, 30]: if android_api_level >= required: config.available_features.add('android-%s' % required) @@ -527,7 +507,7 @@ for postfix in ["2", "1", ""]: elif config.host_os in ('FreeBSD', 'NetBSD', 'OpenBSD'): config.substitutions.append( ("%ld_flags_rpath_exe" + postfix, "-Wl,-z,origin -Wl,-rpath,\$ORIGIN -L%T -l%xdynamiclib_namespec" + postfix) ) config.substitutions.append( ("%ld_flags_rpath_so" + postfix, '') ) - elif config.host_os in ['Linux', 'OHOS']: + elif config.host_os == 'Linux': config.substitutions.append( ("%ld_flags_rpath_exe" + postfix, "-Wl,-rpath,\$ORIGIN -L%T -l%xdynamiclib_namespec" + postfix) ) config.substitutions.append( ("%ld_flags_rpath_so" + postfix, '') ) elif config.host_os == 'SunOS': @@ -566,7 +546,7 @@ if config.host_os == 'Darwin': lit_config.warning('log command found but cannot queried') else: lit_config.warning('log command not found. Some tests will be skipped.') -elif config.android or is_ohos_family_mobile(): +elif config.android: config.default_sanitizer_opts += ['abort_on_error=0'] # Allow tests to use REQUIRES=stable-runtime. For use when you cannot use XFAIL diff --git a/compiler-rt/test/lit.common.configured.in b/compiler-rt/test/lit.common.configured.in index 957226a91888..5653bcd90caa 100644 --- a/compiler-rt/test/lit.common.configured.in +++ b/compiler-rt/test/lit.common.configured.in @@ -40,7 +40,6 @@ set_default("use_thinlto", False) set_default("use_lto", config.use_thinlto) set_default("use_newpm", False) set_default("android", @ANDROID_PYBOOL@) -set_default("ohos_family", @OHOS_FAMILY_PYBOOL@) set_default("android_api_level", "@ANDROID_API_LEVEL@") set_default("android_serial", "@ANDROID_SERIAL_FOR_TESTING@") set_default("android_files_to_push", []) diff --git a/compiler-rt/test/sanitizer_common/ohos_family_commands/ohos_common.py b/compiler-rt/test/sanitizer_common/ohos_family_commands/ohos_common.py deleted file mode 100755 index e38f7a485189..000000000000 --- a/compiler-rt/test/sanitizer_common/ohos_family_commands/ohos_common.py +++ /dev/null @@ -1,45 +0,0 @@ -import os, subprocess, tempfile - -OHOS_TMPDIR = '/data/local/tmp/Output' -ADB = os.environ.get('ADB', 'adb') - -verbose = False -if os.environ.get('OHOS_RUN_VERBOSE') == '1': - verbose = True - -def host_to_device_path(path): - rel = os.path.relpath(path, "/") - dev = os.path.join(OHOS_TMPDIR, rel) - return dev - -def adb(args, attempts = 1): - if verbose: - print args - tmpname = tempfile.mktemp() - out = open(tmpname, 'w') - ret = 255 - while attempts > 0 and ret != 0: - attempts -= 1 - ret = subprocess.call([ADB] + args, stdout=out, stderr=subprocess.STDOUT) - if attempts != 0: - ret = 5 - if ret != 0: - print "adb command failed", args - print tmpname - out.close() - out = open(tmpname, 'r') - print out.read() - out.close() - os.unlink(tmpname) - return ret - -def pull_from_device(path): - tmp = tempfile.mktemp() - adb(['pull', path, tmp], 5) - text = open(tmp, 'r').read() - os.unlink(tmp) - return text - -def push_to_device(path): - dst_path = host_to_device_path(path) - adb(['push', path, dst_path], 5) diff --git a/compiler-rt/test/sanitizer_common/ohos_family_commands/ohos_compile.py b/compiler-rt/test/sanitizer_common/ohos_family_commands/ohos_compile.py deleted file mode 100755 index bc5cd811ebb2..000000000000 --- a/compiler-rt/test/sanitizer_common/ohos_family_commands/ohos_compile.py +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/python - -import os, sys, subprocess -from ohos_common import * - - -here = os.path.abspath(os.path.dirname(sys.argv[0])) -ohos_run = os.path.join(here, 'ohos_run.py') - -output = None -output_type = 'executable' - -args = sys.argv[1:] -append_args = [] -check_trgt = False -while args: - arg = args.pop(0) - if arg == '-shared': - output_type = 'shared' - elif arg == '-c': - output_type = 'object' - elif arg == '-o': - output = args.pop(0) - elif arg == '-target': - check_trgt = True - elif check_trgt or arg.startswith('--target='): - check_trgt = False - if arg.endswith('-linux-ohos'): - arg = arg.split('=')[-1] - dyld = 'unknown_ohos_dyld' - # FIXME: Handle -mfloat-abi=hard for arm - # TODO: Support x86_64 - if arg.startswith('arm'): - dyld = 'ld-musl-arm.so.1' - elif arg.startswith('aarch64'): - dyld = 'ld-musl-aarch64.so.1' - append_args += ['-Wl,--dynamic-linker=' + os.path.join(OHOS_TMPDIR, dyld)] - -if output == None: - print "No output file name!" - sys.exit(1) - -ret = subprocess.call(sys.argv[1:] + append_args) -if ret != 0: - sys.exit(ret) - -if output_type in ['executable', 'shared']: - push_to_device(output) - -if output_type == 'executable': - os.rename(output, output + '.real') - os.symlink(ohos_run, output) diff --git a/compiler-rt/test/sanitizer_common/ohos_family_commands/ohos_run.py b/compiler-rt/test/sanitizer_common/ohos_family_commands/ohos_run.py deleted file mode 100755 index b5605e615dc3..000000000000 --- a/compiler-rt/test/sanitizer_common/ohos_family_commands/ohos_run.py +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/python - -import os, signal, sys, subprocess -import re -from ohos_common import * - -device_binary = host_to_device_path(sys.argv[0]) - -def build_env(): - args = [] - # HOS linker ignores RPATH. Set LD_LIBRARY_PATH to Output dir. - args.append('LD_LIBRARY_PATH=%s' % (OHOS_TMPDIR,)) - for (key, value) in os.environ.items(): - if key in ['ASAN_ACTIVATION_OPTIONS', 'SCUDO_OPTIONS'] or key.endswith('SAN_OPTIONS'): - args.append('%s="%s"' % (key, value)) - return ' '.join(args) - -device_env = build_env() -device_args = ' '.join(sys.argv[1:]) # FIXME: escape? -device_stdout = device_binary + '.stdout' -device_stderr = device_binary + '.stderr' -device_exitcode = device_binary + '.exitcode' -device_linker = '' - -ret = adb(['shell', 'cd %s && %s %s %s %s >%s 2>%s ; echo $? >%s' % - (OHOS_TMPDIR, device_env, device_linker, device_binary, device_args, - device_stdout, device_stderr, device_exitcode)]) -if ret != 0: - sys.exit(ret) - -sys.stdout.write(pull_from_device(device_stdout)) -sys.stderr.write(pull_from_device(device_stderr)) -retcode = int(pull_from_device(device_exitcode)) -# If the device process died with a signal, do abort(). -# Not exactly the same, but good enough to fool "not --crash". -if retcode > 128: - os.kill(os.getpid(), signal.SIGABRT) -sys.exit(retcode) diff --git a/data/llvm_build.png b/data/llvm_build.png deleted file mode 100644 index a7f0bdb0c100cf88771a169dc06772109799650d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 34465 zcmeFZc|2QP`!DS7*nRRaulNi+@$PoZsn)p199?m_wu}E?hb)Aw@NJnt!eI5Ovadfj~PB3pTD?Q+SX1R3*P><^ z(%8q3ADhQgR|Cy%LH_yN)=z_2X9vSB?^sZ$EqC0=(IIQIx8BPXc!Te5wk*3K(Z68)qw}wNx3$c5ofG9gdXbTx?zG zux*|BFY;1}mKm>8B7E*d--y*J@U0>=ge^;t!Cfbf68G0qF(z}T5Y6rF%5+Ifaw`aE z#1rDv0et@>Yc}b2oQrN!_(*=2clp4;fNzZ`;ZA`;U*T7rxNpMqYjX7Z=k=34{}u}n zZmhLRhK(Cyjfgq(XW0H;jZ>%@J<+0yhD0Af9J&|Xi45%sE5H9ajG4fleI=TI3Pp3^ z%{MtetXVfI9{k0`1Rm%!zWvDhmafkg*N+K@H9j~GiywJvj3TX2zkk06C@JO)P*Jo7 zPDNGhrpHWG96~J<)9-Do;+kt?a5M%}#lh=vl!>Y7Jl^iupR&W9#D!a&K>PpNzCI+6 z{ZlB)OQQ4Z>L!ZHooAv(1_Mn$sCoZS(N}u}B<9RtAJPF?hOYxPL-8_t;LOA4Jw-nt zH1G)xt-tENE@mlu*lM*76|d?%pm})w&vw_z=iI-KnLZd;`TjYR2ry+AQ#i)tAq?ml zdl$GN=2Q9~h^xMZhw-p6y^m};!^Bjc4)?&6?xIOJ8Y`jY9of}`)G8& zPL(4D4_MDd9>DilIaBeLw%Y=nW3UFm{Tyzbw*RX(5>-VN{we#jM>&y4^Z)c0!WaQb zUic;)0%xJEm0t=j5e2s}4P57X^WXgK>J*t${rP{=?1qh(sZaQ3j32ST5{MWe#c zGldGPo&5qQYQ6?kjF@Vn;r^SV3dw;sPtu$Z)&Eq}rg4Ax|L6nqqaS(A#(9h0INbcmA7W@#^Ldw?P=P( zi}1L8DrR5*V2^arz98{5g>HPXVa%XM9MCmi*O-?&KHbg@myc&0f6qoqC2QF;e`SUf zeF`d%&be4q6b9WNs36Fh4zh)sSvLs{w7G!{K>y`!OG``WAf-@;|5803Qs#&d!WmuZ zNh}nM2HpkEBO%^zHYNtzt2HR4KHauLw8Z&xy^n_|loXK{PycBN5u%as&Jm)-iWeF7oSyUEc`={b#aT) z&&(4l_}Z*d>O*pl-A0&WVlrRv^PAR~G}i~`_Gyj>77%Nnt66G$M?#e-sf&QD@r?#F z{eN3xuTNg(QI%;)9K7GpNZYhz#gnb{{;}f^E(}U z_>)H@A^=nX1}f9jp-BLg{y!M~Ke+K!y2g_S%w*-ScJ@#8>Ld7ys?FD$%>U|m;Ol|( zepQ65I+M z{^Ut+dwaX)YhcJC#t(H7?lTMw*ndIdKhkfN-#0DX+Y3v9G%uI{mU-T`v4iXXX!-7@ zhXa+Vf8On63|#-<=!4Z#OW^!sOz$6T`!EHuZUF4PTnK;+9^la*Tw#EW>wg3X?yF{h zOhDXMJ;|h!B4x;Vc!Skn06e+;ACM8OA|`zJ$Oqf^{~$|wnOq#d=@4*5^px>GgLLk8 z^oH1+Mu#|w4p{18L!x$xe0qrwhn)c7 zZbsiAwgvef9y9cgT61$xzF%{FkNA~dl8eLTTKVOEAOro=u;y-BCu$4m9@whcuk=_0 zhrg{C={o>oIQm^;s^0haq&l?+Q;M9EQ8}9%yTkhYSs|2SSP=gC&!f{WfSHN>%d8HY zz*`nkP!nsA%n;X7&+iK{^F!B!S&p{h+ zwCjRcjXI?Juu&8rB*MT&gF8|PMd`y_i-q1lb&+7z>NzH?VZYV**vSK{+8)swBc zC#xw?UQP$W6*POG^hEJ>m(F)ilgOaF$%$n37&~I5cu)4Pi1QxCLBlCto?o6glS@=2 z%rF;v1CX@_8j((Y$ib_3f8PoG$7e|d9Qqx=8XsR{!VfA`SRP|~e{?iiNViL;#}}$u z97(0DdVpk?wV=|E)40k=9;m&A(?t_>N?TLO{xuV^~r=n{eU`%duM9}=tN&~5dCEW)Xb1SrCMHZ9R#n@%(cN-u-k zE$9$G;5b#=hVj$N==93+{3=hycVht%jzpH3&q*0KY3kZER}BlV*U(65Yppz`B|*;! z{*u(P3^X~-R|WqeFD1wBZNA$d|IPHl?9GhT`8__SE%WEs0B;a;<|vbjM}a8rfv5#i zny0GoJzcu~3eksK&)Hbp_i?yMs&YLX!zprkD;k-YjN*}|`Fd-R9+q*vPI_@l16Ps0 zzvN!7C1B1q3G&YtUJF&`RbUj4fy_f>t;bjNaqWt0gs4w5AC4T4GjHEESn@{}&luif zVTMUZ1QzryYrsRaFQj#Zl0dUl*wGqu`5M9vm|!RZ#kgj1QE}xK&)&TbkmVA}HQFZc zM8#we?}M*hz$pLUqRduktPiBUfoqs8*mh$0MQONFR4KI7NL*?CnYyME(gt0)XZIqn z5LwuU;^RjBJa!5xz-ufuE7clo!P{GIqfoLSQaMJGs-mbhqPokpxebFVD%*T>g!o!- zwcdaPRVMK1n`LiGy)&o17&X>OujGogg+|cUuyh?o`*u?cT1&<7lfYnJPy4~S)9nj1 zDYvZmPrB3(Ju!d{fA9nt6dxE|m@Tu2sVyHyhOMk$Rg$2;@w^z%BN*C-2VU1P-Nuu% z_bx8g{>p~*CH+Teq%Y{rBa2a9lOf#d&9HVa%3!>5*K+c1LDxNEQ<G3~4{ zK%_36@rkuautyJZxX4!`Q&I)+Nmrl}mvn1XTlY)AzG`Gy<=V#Yfp5q$N3{A*%}vn;KYL;pBuU!CJss6 zwlQCAQ&Thvd~!{P`Y#ojq2$1Y$QTn*HM8Yj8p|5JZvjaPrRcX zSs=|HA8XF;QdWx!$wGuu^P9vH*g3{t{TourK^=b}mC$gAdmrWt%_>k6zoiKqBpo7H zyQ;^wC8$7WaH!gl>i#hY%1!7$+ z+JEt1@R>OycgT4U;j@6W;t>%M0UR?KT^1f)$x4y1$B)NOOSg+>ZAJ%=?g%_dY39gU7JRzj}S6u=`oiC^Y z!vN5(S{~N7ckJ$tgvRbec$E-Z4KgyKuNFgOGDl8`#BJgfxOBKnE$-GkVR2%&g#q7F z&a3b69SW+#ojKB_YpE*$p2f|=mC?3w!U`snaVZ-Nu0HU%C#8F?Di|DK9&ZypgSbIT z*jYfo0A*)8wbUfeu`bd;+fD%^GTx!viX$ImB6qd4b!AOkIlg#v33I`YD~>ef zl;ReJ2Tu1!u@fh;Tl0}h;%17v$@Sc8SuG>!Rop3~J5p1KNxFaGm@!$tgKH@+v9LgH zV|Hsux?V|BW!ua<>=1^^8=Xt*N8hdBZk=`o9IJ$ZwZDa@viTIZTS|BOnnO9b*5=Mp zrluhNgaHVi4-C<7uh-(;xj*Woa#jOw!-z}lnGD+fCq$4 zsA&@g0?c{fxUCV(@ddXBvRHlYwcW_{5CT_`q2@q#Wa3*J4foCVtHH%5boFDkKv`ek z?R*a@YDZ-1XK(`gzQ0;w*dBCMcwsj22NJjEz~*_G(&MY^q}+O+t^>pYBVYvEN=m%!8X48Dp^fkl}WWt;R0V;v) zu!*X|L%Q%6ILP(XcNNvLW`V_RP4gnz4d|TGh=$>Zc=iU+tEIbDY-X|DiB8t8-IWHo z=ZM7bBX6F0d<5ca4`Af1$n+iN$&U4c+QRU;GmOaSwwt6qJ@KD9Vi>@()t(I^7euJ> z`~kzyfSGr=H3FE>8km+bpbfjevO=*VCW8a6!4uIbk+5`bD`?!zA09l1`ohj^2tRG? zeZI_p%1R^|exB7lVFuqcd_~^{phR;)l}ba01n$8}^4_!V$>a-}Syq`6zwRv!(itjI za2a@b0-c>X8`>b$De>@q1Joh6N!FvKI)Ra;(*a6>a7nU&z&KN7N~x*>2L6X9y)Lt5 zP1{_Atv86w#7E%QkGk*v)Zbe_K~*}!G*}0-ZGed@u#{gLrI9^#xz0!{4TBet7t6>X zql>?C)JP_p_k_lQ!X~lHJFbU&Cs3 zxt{ImG(50t?dz*x|@%O;z<6t`SD8io69kK@H4{5$o> z!alDZ^6^8Gi$_3gkqc-B(fp=Y@Fb|8HdM0ARc{fnA|k!X{<4P4LZhp?%AvKQ>R<}A z(!Tgfi}EUtG8BoNK7(WNsC}y*G-*1uuV*9F98L zjp6F1E?awi)*2aRb@F&$TIx9L&;Hct=5H8g4 z$&|=ACD|0ygopAz%JESEh)XcvWZfzIsih%~u28Iqtd#vRt3!MQQssS2*`zD;_pk~( zJ|n!FQ9;y8lkDT@DVIqo(t3QI^~+}>1)HwQEA`1zO0OEEe(_V0h|bUr)bgZ`Da@fTnYwX<5V=23jqF~rwDF|hCIV0+z7J>zBk!;Kv3>Yn(9*TGH> zB)#E^xCwgzPBnuhyn;-MMK3aZV)G(9FGSq5&9+QAV+OB_Sw@N{`?mxaAg2KO_1o{V z57kGe$T38j^$b1rp^HW4JvG{Fa>@0Q31I46_LFhE?)_olOfZ^V^X*&FjMW%%T2Cx1 z?8?Dj-Tp>Ihlx_@qLVDhXK5*}BY5#y{i2Xuop|R-4y^E4^$-kKaMyj!(D+%SSnOR| zZIV2-r?0NV$hD?%Ho%OQ_%5o8|6EVaPdNu*s>H;UBbI&W9c240u)XZ)*OZd7S}BWk zNMG%IFk`JbTc!cciB73+>wP+!TlLXOA#gQipVp=M3YfJ!io9T`t!K{n(@+)=D{bkuhwoYS@EjH$=?Opqjvh3Yy*($93gPCdVOJ3e3RBnTI*VSm?>Hg^|7H1Cvn2e~B4&rvKk1{b%^SpDh4T5uzl zzjdxRjMS9r^yQrtSL}4%^(S{IoJ`tR=7TN!ZTToI)JMG@FOl#L{E)8Y3oVT?$@akU z&C8qxLZCOVqK9=DPcM#>PjPf@J8NrRFT2sHv>Iue!igqpCTca;idr;YK<#zj40@4J z8ynOfqYYp7>-`YmQ1!JfT4@sDub^O?7P1e#$uhVg6~$@&!34TUN%FNE|8HwN&ZgsQ` zs3TAiX4lE`Huut>%tr>TEs@rU|WByY5beAuFp?ab0Z(6`OI{lyWM&l10LR* zZ}_?KFz*#3%jCzNPH&V%+%0waSKjAo{kmajC_v&u;qeY!{tgt~N^f3x-DYhp=?p_c2I%gWT( z-095W5Z?RF6PxUBLwR^wXHixUSE{Wyz)bNAofvCZ?L^EF6X(Z$jj`*xR@sxfAl&}V zZMD=Bq$5%p12Yk$)@_d>QQ&#*C0P4#%uZZ6Qb6@B)(wq?O0yr&hWZ;iwg(ne*owjP z3$9Dqswv_tDjI_?xA=5gW$~Go5Z|pd1=ow?KItqc!$YQ*T8cK?c>vZP6j!CyTEMp` zct%-%- zNK%F{Q-#i6;)&W~v<8btv3-(lJl1GEK2u2+qS)xykBWlSAYMD+W{EBQJ^SoprNhBlLZ^lWsOMVEIQ zetvJ>VT{I&D|4|t3{WYoeL}Rnh;JkM;CccOtUc>yIXm)Uc}__Gg|bJsl9@fh%Hd^I zj{z2#LZVPyjMw8+=+5ZGk7@ghI=bwXiSXO4`>{X4rIY+K8vW2@I6IEVLJWl4+2O*3 z7pA+HQLr5RVZ%wEM8N>b1LEX7pVm;nC`JnoDjyy-^QzpjEQD$sk_{c7tqXaKs=MFB zjyl4KA-ER5+z3wt6d^MtmW@hO`o1$GpU^}bh1yS@+QSc{Gt>$X-DW(ez>!P&aGEM?G;38cca>|=S)gAE0SjumhrGbW(2 zF7RN(S3_qC2gD|%jY+%X=H^u$C7loZJY4%S5jIPe3bB>bS9LN7(#;Y32 zyh-{5RK^9Kga|IMVHPa;cP@Z>q(u@iQ%d|bm0)aB*5YZs$51!s#mLdjAinzkxM8A~y7Z?Oq=0dj4TxB1g8hXgldv~o?mcCw z;l;kiAWHicBi*!M`A+w;u{x|<1I|Ns!>ri#>1i z;TH&vSHDzcEd+6Bu-2NlyT)%wE>bcakdf=pK-L}-9d+h%*{MG>vz^CNRzmZ5BMFo1 zN2Lcke)`{*Me4h2t121I&fIl(u(vG#FuVJ9~trH7!l@+|o*4L}ut-k0L}}+m2uw z1?!5a4F3y!mezkBD_*sXur;%8-V2kj(EUw7g^=USp&^5?)QC{aX=G{nudtAofhVT# z>l{!eDLZ9^>p4>^po0}eAID_zdaVJiUlM(Jb91wgy5Ms=%$~Wt41%PpFz5K%)B8KK z%#g_;r2VkIR!k~Jsm&Bz=(9c;zYa^aE90Rzu4NGQ%KDbpdg#aR6iuOGSq&$~CL85B z=UXT(9;zj(jDSt|y`>Cph-L$!FP|z)RP9^ww9vEI>?>FvAz_FjBCVw4 z2$BBU-JW=I7I1SLXn%{q-(}Z}+j$oeRt?h2AQR=U%tD};@_snuZ+BDg>0yRixFs+N zLacm|VTE0aEJvbpvv^dv>;=oXC$}0)7#1#jyEF`R=Ch50yPJDwX&H`J@Z=Ti?#S}r z2gs$%ljEhx1Vh5Mjy(z69a$mK{tJv#cfUfNUu~e|sqU2-fVhflLQ8~4fq5+g>QL%` zudIO{dBwMiK1tTgkwr-E(k%Py=iI}a#4)HJxdmTPJP1f% zC60qf6`|V3xFfCn>SNr7hxTd+C-a9k9x?&*w~!=LXsJb&qrq5eE5ExO_V;HpLvM`Y z?s41UdqEX$McRD+HKJ}ShbqZ&q=Q`N+gBlRM{oLC?%XIsN0Dks+5YH zcLrY3rJxwBYB{+^9#8UNK?%#gNy*-2bY6fZ)bm$C`y}kp@tiY)$#m!A4u%cxU*z<> zsIr4a!mUpRx}0-8`%`Vv@dS?skma~hNj>@$xgBwY?iNuDtjSbo@py&=5!k6NII05E z`{TfxG7E0Ex20M$JI77@Ve~In*!yRL;=?IrrpoKnUuP6wozUg0^2dT}$XjBxHR>h( z?WbV_a+~n9-bp`cG()3kwRJPkeazg;aPnbNSZ16Dv^7DRQ@sASZ!k8+3+C2&3Y)Q+ zBpiIIoE2u((b8qQLwrXVOrdija~KElDY1NHWogP_YeVyeQstSEW1UK4Rt=ex^``c= zYN!eUQo}6a^$&hpz^WfNa_m>9G@Afsd(Z&0-MRnS^Z??r76x?)6kcvy>f4&hq3zx~ zjDH`r-Pwj6MAY1LnIUa##1=LV(dL0^*rm$J?cqDis0-UZNc`%yRn}zVBFdETEs{rQ zASBw(b}lk6*tKv*8oXq(SX$-3fP@+{Y`_B`>;Qi(cIBlH3O{RyhOTiDFQ*P%hDuz~ z2U|#o^bx@J6$8Sr@7s!mAj`K zL~4uMeZ_i8ZEWaUHZv#;#O`lO54J31GHBPly|5(T!4a9czAffI@s2v{!5N!92L$C=$pZN_Ez!UybJUBi zl>$gkG>KGH!GRjLkx>f9Qfq^&sqV@Ow@=Y9a z;C#|`_fk)D%bpF~ulq=@S0{)Fu6PV$j8}NTCjH^1ySJ8Jm|Dh4B(+7_G{7_QLEkF- z+YijT24TksbmAax*cBu(yj(nZaR-#bk;YY7(i5iN_(`Y6rC-noLTpf=dm&T9t3-nW zE?7^O^>0&(qKS&9xbl$Q3r}n<-7%>0CHqO4cF%q@49n{z&uz)iBP(=%dt*@%`?0@7 z9$QmdhJZ2U*Y%_{kFUvc*`> zOBeJ6Q+9-pXjm_o4KEAJL{g-0DhK}(sb<#G*ilwJrf-3|(Qbq@)b=SUzx!zH<}2PO zQ)dneZZByJj+7`~9u_<~3wbq_n>Q{hwSdNjuUduQhU_68QI5
    a@q@LIokbhw)h zmee8cWnr#IAQS6`R1aus&0)8)CR96GEx^Tv+389hc0wYpY<-yQ(9LbSCAl5&c?t)C zG%phAwydkJ3$4+skJwkQJ=#Ab#f1EYU^@tA ztCpDcQ@C&qOZubtL*pWV6fQCzkN3fee>jyNZvC7={#0LzNjcae_pJS>s4z=eS{sZn zsS2@d0jFY;NxzWhWTWkwVg31$)IqvUn0xE@M&5o!PCKu7f(dDN=?S4gX547|yE!8V zlWOc~uBS`J6M2o%Vd09RF7(p3^!J6#X4Vs7R{K5_)gSaVT>Da|%NoJ-M^d1$EkG~! z!}nXgkl0P)TFG5lJc(_T0N(5ni&vrT413F;n-^yb=Brm#tpYh?Q_Kg0zeoSyzn7#Kes$|lt zVoFBiG@95~D;ja&KH_gl*4m!^RWm)z2m87D{d@9Eb3US?GQ$n^bvo;X>Lx;7e7)hK0klvn}032$5a_346*j7iY|FI7>@-kec$ zSms6A&y|ushoA=N`?q00U~y-3m97vG2lV#FZ~x}TfO!Mr>T=WL?5*7{m!Z*-{QYpH zGvPD66X6r2ey^dTKxGQaqHpQ$UTe}y*3yh2MJsFN!d_UdpA{J&a5pOg)81maY;KOM z1x*M4E)4YvpxfJE*KHk_n(QZEXSN#$n2Wp5J8V<1e<>)aw35rM^K@f^!+-=4D8O)P z%YurZ%r4y}PK|%-eic!?yDopT5N52l_mz0s-w+plYq9UqR2Ys8PAP_WS}d&Sd4)g& zjL9Y@jiaM#T^4~GUw4j2t2u64)xvf@DHaMFl`ecGu33;$K?&2v%Jz=W%l{SlEY0b7 zJ@`cZIJyrPP4F8^xk&)EgA>-w-7DD?iz6#+&^K6_xxQwL%_NOaPlK%y9(w`S!f$T^ zmJM+1lo6>t(Pfq6D#t0QQJQ1oGn|f;_>##R2j!}JIpXYW(BScbHt@ve#>aQr#@F=3$mxu2I39kvPkdu!>a# zss-dGcO`pE#2nQ+iRUgN_Ns9gMFlgDc%IGlv_vASlPDIG!y)PMW1iNORKt&B{7e@~HaC?CO*to?6N153=IZFZG0QJ`tHWG(a z8&#qzTl?gdshgHgP0uKbBLoK@1!+oYNg*9PSz#=R%&cByln{1`#R!S!-m^Ir{mZo| zgfJIWF8%t2w-%NHd%A31wtbFD_&sgag#kH>PB>Y+Ch;@^RSGn>xj1G}rLsNXy2y_S z0y&^iQieujJet=hq$g5zkz}?VU3!XNM2c{B{`bdS5Bu5dV3YyAi~%7;Tdqpj<5sg2 zM^$@-J=!9nerda8=RQKrb|kQSHFy*zvZOqmMbTLtt)kJ^$G9+_Wy@HO1_eFiqATqb z@76-LAhL?RrtGIkBUL+h6u6F$%vJf|%%dLf*~|gA`cHsqBM(yyfu%3*FOvU+8xn;- zy>l_%elN}6{@Ggt{XPhmLrFF_M@wKGLLJ=&Ot0Qg>h7;D;p6eByGjXji7pt{c_mzn zEv7X4l=r?0Rl;6NeHiiO z4*FqQqST0+UPtkfp9n_N08J705GNlCL+>J=?48(nzbnbwU{r zIwk9I>E*ajTN?uoo5`DLPS&;jtZR8%KruGC;Y+USH!BW{Ecb$79I!q>4IME`!`pGQ z-dc&xp~k2x=hS|@50Q(4yffT%CCt-Z!92~Jh~L|~K(^O)yVjI4DpTmie8G|Z{f@rc zOpj(Pd}OnN`4sU2Yt*nwkctVyf8*8YSbI~!c$EW5Qaq^Aj zy5AD(R|tr^9LYE1X16*^O%jXgBxz2=N^v~dTWObSDXi!-iuWRy%5XfT(p-W|QnL|R zeS!>%3UQ3hm>W9nj>^ci+gW)|Y71&A@80PSiFwxI4f0Mzss^H7+?|LNvAndR0+IUm zK(IGEGi3e~3Jh6%wbluDj-RO-N7@G_y)3FLnVtP$`EX)>$fEO|`4z)eR-A`)3QIJI z(Bx$M@kc~8Sxb+RpcPc?dDrCqTk~0E<&X{ap>#u{Cp_i;>qV&QY?C2X!=c&O)nKLZ z>fYdBd)@B8RuJAlTNHdd!^Y*ey>%k}&fcIr!E!;m{vf}gkhjb7?_-(mWF$hauHE|<(kO9GcG( zdVb)MFNK<;F@N?0%_fCW^e6G9#Euk6c~wa<4%-GhTF<0=YUj|=3}qHsldzq%?9KC# zS0ZEY?F#Bvi-FMzUtY?;I2gjKBY1-1pG_tAo^gZ-Ho|>=e@VUrNi>TTD!8Fr03vlb zUz-0Z4~;R5!)-6bcKY|dk`?1D=p|MV0ybcZnLamhrll5XiP4>LYr)D1&)Cqya2}>m z7D`L>ui(P&dRnJe8do-|N6j99)7_3PqKb+4_#>&322}%V->D@4-HL0f(k5RwdG`Al zjU91pUA;+5G%pCYFV>>)mz^nwm^XiA!DKn5FHEeDUO*BaJyB{7{94`zN7V|y$}cZr zRHMM`lvTF8BR!`6&eyvZ_nujIhxo!nEgjo0x$l5W!J{CYWc(QOTS`1G;=nT9(=X@% zc)7Y8WtXy|hMMXl=s!y4b@n{9hayyhM!b-vjU1U1BlSGZas0HSG)CTA2V2uE9r2D$ z+!IE0)(>W$#>KENDEeY)K7uPWLaFoFA1x z_9P2m5MDDYt&UT0q|O(j)C%%M{JdOcS3GDT@~3vQdU-xsUmqL588W!MwoeTe=N?!+ z%5^x`=31cMRr;-Y#p;L%+dXw3o8V0`z0&GR|)trAv>Fj~Og! z*p(D1l%P7E+khPD=V@B-ZB5Ip>1Q$}56!o&j51MgtM=vVz?LGH%e*3r>NAAnkv-P1 z+l+zuY1wIl7mD_?LRhxLv?`!DCylOJNq2R?W3Xl6_=)VVG?rd4?#n6Z%3XO-!OArAUS%J&S{$YT+dDIE`;QZN7J|?1@z&GJxM` z@Gb>%bc@X6%Y|6HO4mFr2TBWa$bxc>3roj$%8f3*9T2y63&`}x%7ZKo&EDw};sWfh zAFgLS;eA z4ds_jTe}ir7JNLF)X+~7?kM_odYpxFGhswdKRJ`jQ8>8^7G`qSZ*V6a{_Av1-P`$k z3$|JCnPmS~y+rewik9a=uI9~BO!|EQwitny_BUeoOEUz+M6A)1tDu-fDI@sI)w^10KLyR`${D!l zTY;uysP|I?68PLvlg=lQiR^sF;{i?r8(A7N5)sJZ(JpkYc68e|Vjs70e?@I)`_GI8Pq5%5Zw58w4dZ zM%^r?#G16W_XMA7TB|jorRSMqP)3qwOZbNAHYI!VBQayyoHJ-TtWruT?5uFBG>4(3 zgKF}M)rf?J!14mR0p55yyVY$l)L=&$!aPzupKV)ydF-Yks6Chl{So_xEmg!H#R!hD zsVdGN5VN)D0iBg*Z}IIQRV;`^-L+OL1!>Z4Pj!UnIW}%?e2=QK8OUA&Q>=T*c?I@`|sAe`SCEY}3jcg-9=tzPTWTRStP1KwA?_IEDZnml_@=o#K@-!&<< z`Mv9fWW!@(9+mrGM@OCpkKEO3S~s^|e(XCl6=N{=L@JW!4&c zF@MQqSOb6NTzfDZWbg7+!K|Juiv+713zWvNVEJ5tv4-Py>TWWgoV)BH)z~D^!^_y1|=L=%8)+3L) zZVO$-KtH%AKViMR=lNXlYc5*7X~1z+E`B(g^2G3TF;Xq%nHtvzFPf7ee0+K$;viP* z&C=&jGbBSR&7+lNYPVZ;3YbiptvYyf<=J8~@nJ8+x$(U5PK)wadY(@%{k6yLgo+QJ z)Y_d75v@>G>o zu-Tg9L*n@4j!)XBsJ$KOzpzGOEB(un@2*9m1$aOAwDZ(7+gz|XsgArIl|qB9{u-DK z?|8!|-q_XM_uKa!;`7>M7;w>b)zj5Nr!;D3ryxE&^ah^qZ}+9Bt-uXhYKHoe&wZV; zF1CA32Re@{#A5h$xnREfN$WMo^Y6f) z@kz?744Ov`-3=tFe->S#yt*B2yZ8H{p^i2@6t3~h0j|MG$Ox32M=rz8m9_98EXTU=gZit>*dV_s4DM&_xb?HA^+FC;+x@hZ{n9WvkRf6D^3wC9 z9A>^6#sYDXKIHyl31)HpNy}CCs>UwKYlx1kPkmVlSM-1G?`zi_xapURiJv@~_zr>S zn#5mNWz5#7Rv8MuJo__dtC|j|k&Pgj$QK2LX_k8_pAX@^HR-C|198ota-5DzRm^aP z1-Wkk@njgp{;~4p1zsa*Q=rd66gx@f!YAD~CU%S+jIk-BgyKf`Y)b03+g+B5ii)V9 zMW4Y@Z)-kBYO+`8Z}p{*0nV(*^SK91#8qOr?jxX+Zi!6=wRE}Imjb(A_3vqD{?cMST^?X|MSe?}g=4*O+vg*sFa zi2t0#R*+iEGo%PSy+z-Clv8CWQUx=0g*Jfb+N25*2!!(ubHS_s&IPczCz=zyjt*>M zc_tLWrmAGaG143ImGpaipfa$j`4(7fOjP0*o2Xb-bnK4t=l$NK#ir1zuGgnC*GK#I z$;8TW2gj?^t%*qIAUNpPFV=uHrvOm7IsbJF4`(Xb_4;Sd)w$kct4h7j4$5R);9cPZ ze^~H#*Sze{iOonWdk2L$7*J6ubaT!;g8VB)&=o@u@*`HMFeFy9lxr+reOS}*u4#2~ z{M?$V=(yvp9p>Zi4t4xx*0ZD@_Qi|7IM^?8rM)re0W&uM8y zn!38Z_DH+j;<|}F=TMx{6t~XpGu)-1#F!!ckeikLXzEI!Hnm^BMo102oYS_g9IW$T zv11%FqD5li-Wh2b@4!d~2ma{fcW!ySoo3h8KUWZ*w?h6D^^|*)Ozz&8{rUWT2?LT{ z>3)lolN6s~cZF!+>f?=f`X+BRcFvxpgoCSMrT6CYtP+f-^wa&OH8TCgc(cn-x|3(` z<#&DZU~E1a&`i%eZ#}BL)e%jLjMy%dr>fX2OP+B=e=}$n?D^Ie=YCb@Y=q6HN2q6M z17EaG>*B+hq?J7(s*RFg$cApeaZQ1Hk-M>SXSgy}- zk9qhTeM&ewW)^!@Qi@VS5^04=UAfRwd=DY=4#JV{^zrm4x2?v`MtY3)?2qKtj^p+g zT1#?AjYQPEgGB@rFWP|)Y{H4pIUjMx)rp=zRw*q^{XI^>S6BE>h4ylP6FG=y~+7Osn8o$tC`llcwxHfM4)NxbmDhcaF%8dp_ou7tvG1>#lRhPAY7DieKza zar3&z?GYaH!Z(Rmg1D{+uU_n9Bwg^Gb&O=G<8W3)pABY}vwpJQHW>5kd{6yX+u!M4 zd7ka}e=Bo(6!X4h(KKb+FhTG?!9S)$A|u^@#y6eYv-X%GDfQG2Z?u zy;QlrQ|3(dOT)29o0U#!t}WDsn+6$w3p`h-+P%jH>v_7K&kQ4Kc8=z4_|_NvjoC}Q zK^*vY)pi^m|5-NS;)ymbCN_IM(>I*PD|x45sVe99-bAyTDyk`dm3aC**ggY(e}kvF zQjvOgxou_SVj4E)`+NHDQ>bwt+u!ix3!I%a6J9Hw){|@BWe$qzXXP)hjl3LlQ&W2; zb!zoz0C&)^)=>@lZ;${3kZg6JH8Oe_Qn1Vmf+mIN!uD zFxHxR)y2#&;K!Ikp{*n}FKGRRH5i8RKS*o(EcF`{ z7DT^aF0O`^@gI8Mza7`|)jW|?xj2XZc@LrsP}I-V=1iztMIW7m zk;wADjS0EYfFJwJ*qlv&&fAqFt$WXgLm>5LNV9y+KtkDQet76DJnC#IEUG<9NCESU z#MytT+h;d+SmB5n+%Pk}!fWFyLZ+)f3jROZ`|7tU+OOXY2r3QI9U>_qo9;#>M3C;1 z24S-SNkO_nQo6fCT4_Wiwsd!FHr;s!^?Ba!d9U}Jf8d<^2WFUS_RKx2?$27YX06@; z>nZiFi-{CUgU-3J7?72*`)!E{WU5K7STY7!gu9Chp5u>te!&ZU;Z?Q)(z(hR1`TNypmQ^RRFK0AoCf==eyxL=GVzlpEf6(wR0%*Zl5>A7VSH&Z1gu+s!5_70&8FAf0y!N})#Fo! zu>*;!7%=c1x0bNSou!>jfz@6g#^|7})|lnim`7Y%4qcZ63R#>WaE3i9C6B)Eb@MWg zi#!(D?XKhFQzL%9slQzf@Gr!_LT70$LUcG9zr`*93X?lTfJU9E=iHPD^Iv$v`?zv;V$h*gn1AM|rMpmprI^BWqmj?aEr^;!){9LFl&y+*AnG^gcP*_WF$Z(knVU|Cfpe zJFh4WhU66wNS$KWwZ_-jy&^$>(G8!Dox*kM6Gs}0cQ9DV!G~60*IbX{mA?UCT5Lx<)SZSK{~PodcP^?>0z1!&G|T7Gzic)G;0@ zgiUUqNBL?~eNmb@h1G6<$*RKBJxj#sTdkGr4OlAXc+nF5!ZK_HSJUzfXLpEJAaO3| z#WOG>WtPBJdJ^=e{{!>s5cy}hH-2WL`#sdmQ(6yuMB)7Uxh>M6PX?VJf~i`864Esj z+a$R`Zz)lSYuU67!mZiy@rD^%C`&zE59Zqz?Qf5{shT$=XD1}^-Loxu2FLm(&+3pA z<09+#?Qc))&(1fIKnq1LkDL$L(V|}Q<(Z+whj<>65Nr@F?-nFO*RBqViqaZ+82dq{ zgj=S_PBj^t=L5(`(HBpS43c}*h=ooyXeo&{7FPsAJ!?czZq2~?WeKh?l4!!_QASv1 zVkh+`eb?Dg{IJ^{F5;CE+5+wBapcJ$wg<3h;Es=(<309S&&iYqU74if89=LX-l}wT zS=6(L8kwIH39~-+ue&bu#iWWqJ6sWEK?9cXU%oI1&H0uX6Apu5;iEBy7!g%`#+vp> zhBgl5|H4WPz(zC&CN~N+qAcuvgmI)aSs}8>W}pB7HY%Ks#5xGIVqo zbMY0>`M}&%4@Dr+Z3qj){Cc`x`TLJRGtq7xH`LGJxS1+F!(W?)EA|(f z*PIx0U=Q8glP~7QBwz|D-z|&}UhUc4=f#fZRWAPqX}t3Mvk2eL01L=T~%BkxKa}w4EhVnNAAV+#KUZ=d^6p;%(ybxfXIr?Zj;zTPM-0r5GY-kkO#; z%-oG9{rEoj+C<0sszjP68*tonY zk)ol?dbyd&gpJhaW2Q9s;CpmVI*3ir4es26{qX*Vx!%{Ll>X+>W+70H;1O%dx~tQR zBRM!tID-J3YKh5j6Kpui{HexgO~#=X!-fk3?}i6t_1TqxUo}7XX*Fn$n)0zxSo`_d zuUeKZXVkM|@v)~!2-6IP#^)bvUK#RZLw+91NQ3zz?7mc|OB;mCj>f6RKv!3^{ZyIA zF#G+DCOI<}$BAt_-7xBT9c+eV=1@6@!&ncHQ9x4`v|WuVfk$T|2h6suUURZ3#~I1& z+tozECFBJ!2Z#G!uT(I)+&{WxB3vbZE?1ZEz(J2V&+?}r<{eL+LdP_k0JL?{+Qun{ zhBq83@gYn8YX)ECj!|&)D*etIq)$Dn`dC=`&sut?Btll(i;#Dxk)|G5qa4SA_T4kA z1S`zn`^ibPlp*;M80m(!WKYo|Yjk}}FW*z=9kw7Lc8zI`d>ph-g|B{1_Q*~c70Bew7Q`;OsHgW164r+|hziYC7(jG;yeQ_94+ERmeIuvF4!^qf>MuEmhvL z{4n9NzaZgLBFy+|z}H0nt3;T&T3DOLn#Cj;f$jHqOv-i7IVSa4+&7?35DaW5-N$9{ ztVx?Y!elj-BgD(pGWc5OD&$27<3i9lMBe9y##eMdoIo>(T_7!%vvDC{-eJp0iXJ!oWo}zVWWq4yyyvFkkMrL zDqFEPs#}Alr1NLaqeG>oA*U90A5XFse_h&wZ+5;~OK(_VJ+?%Nhlx9t1^|G4USS9& z;}WTE+-l=3t#;{y=et)uuq`|C$vOH7?GIlT+nq(gOUTLB58SoL=M?g#DOD&tCq>g{ z_&_M>Mq6BZeGHN!9p;iETxE8jpU-mZ-#E8Q2dTRu#f z6e~Awjno87x9oBuGz@Z!r&}8N*y3xG3r^a+WK(gwS4|)rw2iCw;!RwKGe(@?)fX&- zKD;yb8F#E2cQRfV{G4xRek#u8;Wqa7BgUkfM#Z!7=$<-%QGRWjc{~tDvf3C3tqYV> zqP)&|xV!5eI35(mN(9w6mnXjnzP5DGRxIH_ar-6BYLh*Ee?lKH6pbQ{#PrXX&c8%T zNt>`pKH!4W5Oobt;mD}`0Apu0ZRe+Z`QrMH58oT(kRI>3FcZAn@+luIRkB z0{{>P9^Qm})zM!5*Pox^nT68aULYR_+DFy@O!mqMjW1h1E%Q&f=Cx5m;Y=ZV(-ip2 z)tBx#fZJJbL-U5jRdGH|NbIi8m8ljloD-lNFwB2)Vv+;^PHj+-7l~V1Hf;09oeuj$ z-UHtvKYInmyCj0V`M}oy3JmzJqy{LYpdl%;_Z1MV5H=}wwL9MvIGg{mNs0o#_Q#)^1r~Z)H@%lV({Abo3m+g=?Gc4Lu3o9Co)5LQ5eQ zv4FFarD5l$XH&|YArc5S?E>nuvv%YxYO#bL2!m5GpL+5?uKGc?mvySC?H$ky16e$1 zzwGsLL!S>ds!LszmmmmgM!R9tsGvk;9J3J(#neI@+NE=#I08Z??;f$d??tA*fw@;? zW|C7WKAe}E=H7=NQdwEEYb!dPO@2X|9%ZkKa4N?dJlSU)+hYn|92M9;bl0hAok~>( zP~^X37{_=>;>j+Zazu=~&w6syvB93O6|J4-9ymjRY|nr~eAXkFtuAuh^zEq)6_X% zd4lBE5&7xu^%TOpq!Z8a&jcTZLOfl(wAFqyEYR0XMh9F-oCU2faRDr6zz=hI~0nU%yb@Zg>tiEj{ zJs52tpnL(lZIa%#!3CDOHUx{6gkR=5T~-7kipUotN3yWulaYI~NUvOU!`4yXOr-he z9zs>t9@vmah6>hA+k)9+uO18Dm-|cG;qXIGY9MvH3n<`KB1M~p`sg0g#kD=Vg^aXx z=!+3Ug`_c67>_)^xXKZzcLRFqV=6xWM2uOATS1|Wpoe zy=ciQj|%sNbhE>yN)}aqktkoS;x%*1xEWhYHSAJjt#@ z0@BX2{;KI`;v5oJN2u7!&5ujR7Sn<1d&Fd${A@Th%B(?b=?&p_8|^|AvQf28N4D@E z2e^7;sp&+uOy~qMziq;A6QKmFDO3hO!W%}&!w4jU?wp__Kjt3UdsLeV44{WqbSSTA z0L&Aq=8h~GNOdl0wIhmF+kRP&^%d>0stj`}Gbdb2+!mTYkWcJj%)IZTYA4-MIDkczf!@F-0_^?}j{^?)Xq(JI}39GF5s4TCI7ZRI}s2zq-FG#S;c!TpT#Eut5 zyl|XZr40*TrGmcY`PN73oo)7sIO8>n-fWj=5uO*Y3SRa0ytq|9vkPJt7_^2dpg4o< zmo1DRn-LpDg(`@L1u1iQ=vUvyvFz7ZzzOMzueI2 z>B!9NzsU#I9Z=^x;bnP;W|H-qhREOzW3P)%#s{>nl!}Jek`T`lgFKVFEf7O8)j|Vt zVw!YE{~#W7zFWwhQ!SGLRZa}l(Qe&cMoiaF%+IGgGnK%D?7jk#`R2S}V2Ll=1eUmK zcnQjvvTW*)zr}q+uAYhV4FIU={tZ4zOFP*OUs$CO#r>-gcRTDWKO=P?|E6u$dF+3< zvOyN#HX23YxOXRcS^Ssm9C~`&jY-pIb>ZLpcIUnUNHBBu{H`d{Z$kr|ZNW}4>+n_# za9S__yU+8Fjk1tn(+-RSaPRMMDDayNY)xP>Yx^Mx`oreGe;dgY|4#1jfh-K8|1xvQ zdAO2ym_u7U&ob+E;oa_CNMbD2zzKjVARi+V?ubA1u&A5h04CacAl$RKNDJion^U3# zx;aq!8yu`;E%SqXvY5=tAN*F>;jpfE!go*Z#nieB;2MV`!aX~Ko!^h6NJw8?(U!<0i8Cd1a8JWu={74M6m#3z8jF`17W#*Sdue|bd3*0 zFWvdU-BGa`p>$og5aTxnp;yIF;L~2ZyWg4?Ly;DNe4|MOmk7W=fZ#ELbFZb?>1$vkzE0n;!M)>8(ud5 zat2;BEG&Tj*q84!M!+>a4_}WX0kUe>F02O&{n*z%uUp%j3LjeH@by+?r$S(4KR3w1T;2xqsVNt4Unmf7!ly8*TEWpQ` zCHxoE{`J@|6SVG&|2gOHUzd(l>IV5g{~R(7I#Ezj8Qa?0j%DHw`wlyM{^8yA&_6<) zMZSJ{GgA^QD;>)4z*j5q?qWw$O^1Cl^QUhqk$>}fSeL(X@uwFM8a!S6OIqM8@H#L{ zbv%!-Pk^!jDn@IOj0OU}8_RnK^07>&_&bM>=Uc_IAH9>DL4W7>X9MBm{AZGXj}rqG z%YWYuZ}tmVQGkI3Zx$T}Rw-1wTM~fK4-VYmE#+5dvw!T-UlAm_1OU&xM%p^RuyE(p z)D(b)0EH8%v+%49`LY}t!#+iq_|KgoyuTffHDkz;aF---^r!`hL;uy1KbuC}yU^Bu zj19>hpv>-{D}cQ{=6j~=?JL{b#Ne+0YjjV-#|zl~?R|IwwSfP?-r?~6LyA+`s?QSus~ z30bHFGI-e7*n5%QS0(_r0h(P${Sm`I7uvWW0;(p{Wmzh~r1N1&_Lg^4)vE*u1^7|J z|6Nf37^na3c>x|rJpBVlZ!po>*}q=o~Hn;ir;`j;K|nSuRJ~(;svT z#qC#!C&Y=L>dDH~4YS+RwvxYwN@-f5CR1i78c`JHXT2V_W6`XP`X?7)yJO+7m<-#uLV>FTs~39kR|i&A`B3!2+juA1ZE;_ zTkA2EnJj$Ej*jJ1vYp*}!=L<%neJTp_H|r8YK0{(p8FaljVnXRv1($w6{Th7)o6C9 zkVnwSR8W4VZqQpfwBP$#(viqa2qiJBzF|$)2eDdGWb+Rs?x1j$sr<8K`FT0_uwXZ+7! zMky0jvJKhsbJmn!zSDjfQiUZap#A8vpFufh zz0m$~vx;2q>kl?PBnIZ?k-cPPZ7%8&MkH+!>iRUcp5cqX8Yb*JR9FiN*kdfkRFWco zs@_K|)1c>A62G4HEz}dc;U0hY<*2eQvcJ$ma9fsqmf4JDy5n#<1brnFOD~QVj^!cZ zf7we<9ic*?p|rYys8?rlDc%3~y5AOhMO#Y)&4f;Q_o z{33+;p%AG!PT#Qo`#G+pSNG6XzTYnFBmI*%U_-~I6yHS}ClgRoP(aSx%$Zu?s_9+BYC|Q5O%QSo|HaNDHxZo#|Kx_^H3YXa@p+!qr|`q7HcGZ^!e@>citrvb-ROFt3D#&RxgrDy&nO!;eJ) zb`6?-7H~(hvjsv(&8<&4WF@g~&JxQm1`=$gRu!J@;cX;vcJ#|Hk61l~S9~Fo8cesc2 z2ArSv$oC7*&`1*S8nHeUF8+{1pY9g{Oo0p^6s}2Why_> zsj^^$Th|YgPDAMQ_gaxU+1dDH%kRK0ufcrNlo__@noU`^Szm#~MFbmUJ(*Fb4w#qhua~p-IEi*e z3v_#=_mSJCe~#xcgCHoHV<^G{W{LVfOy~`Ctq$B)g%i1k#aBBj*{S2<`Iu2rVlw|eFuHOqVPLEK%9*|2km8YXV zo=bP#=HC-0w=4OEG2J^tg4Gf!cI&VZ!IQzBExo40NiDs>!b?_)+tfsxTo&PVao>x_ zRytwsh_Fs;&0-3BX~bt7b3bP@Yi@Vp9EIHO2OG*P=KSez6Dd?V+j`8kcpNnY7Y0YLi?~4KOt0`3#2|A zbh=Zg2k|_V)OM#6rD{2GRF(J9bUQQm_&k#AdSv7gx=U61@FDJ9_9MqUQ?Er+6p(-z zjPRJ7#RW18Z4tp7k`MOH3}(tD3@ufguY?iRF`B8E<|9p%m2?vFSZK=#p`dM{9yJ~%k$fA4w8 zcC(O|?d=VahXN#oZtil}w-K2H?g0sUTK->0Jl|dIy9gPh;*NZm0#ZW*#dbpxW)BwN z_UEgsc?FU{9dyyOvl;G6_UFdeH=dPjPeT#ojCK3(b$&frN`*k!U$EkIecm_hy1AY@ zYdA9}fM0O$tAu$&?X91K`j-}iuW`J`8QytAJj%&$6S5D_z6fjZkB!t+c@Z>`zclI5 zen8tf7hixZSyUF>Cv|3ad&61Rca2UfDmsn((nnLYaZdJ9q?Jg?_0&|gq;#IRiMmsu zH7Mcp8zjr)U&kz>yTOQKp2|umf}Y?*7bll1my2dr-Y1cLNwUtJBYp4JLtR^1*g(%q zM3aT{MS~dOqr) z8ov;#tOk;MS&c7`J2@`Tb0>6t#hs-vInv>Ah~${W+>9|k9No%jKs1NP2-mR`RTcN=nflq=a@dqO{--Z?fK7XW7O zYBKKHXH1KFZPY|m#4jB`vs6>&M!tzeLyApddsW&9{}#huFVF`uQnrz+v?0OYV}2P3 zJLr2N{1)}>6OB!}$CJ`P=%H@Va(GC78{d$ZU7Cszvmu#{D zWVwj&Yvep^1Z_oNEUyF-J__#^RJtLkvg}A9xmL@2_-q4+DF^7%2ywAhe9q(dLF+H_ zrdNO1xNPhpo`l)K8#&m84}#pEOa3T9Mkne<(ogX2;NeIS#;NN)mteL&2TdNMaCE5q zzQMNUDG;Imwx=1H@WvmZr738A7=Yoz_7UImS2xlYr!5vxJ-Ox4t>F}B(bvnz0%;TBwl#-Hk7xbu74Btd z?rk$HaLNchwJ)$iARqc1#KR~ zDB3GA~H(Zz{nTcOf23FKGRDf^-!MG`2S8^>k*R*qmk`SMVYEF(4m@xyqv z6R0F1{>zy+X-uBT9| z5TF-8jM*astYm1zK;c_kIZ}l6uO65Pj`axb2-A&Vx;KYJ3ihj7k%@fXXJzxd*&pxK zik?fLs#k{ttv;5$o2HASD#A+Naws>?$y(Ee(ig@CzX*FKz(TMJ>0WA&t$e}qOLdi0 zQRL$Rf5RA@h(w%>L9n|pKwx`;iWv6MOrHNo%(C-s)nlnbQclRDJfxN9yn^=cy$sDR(d{Mq*Fd zc6om@(W9V*Gc$hC9nVaSR@0ChU(pbOGk^rH~t=A9Vu#{74jNRs$qvPSucn1U99=fp#bj~b1{pQ=8V%h!*m z5&C2}vBvi(0VtH&2n|%tTY^_^5Hekm%z=fRGp!588THv5A@@5Rt@BTqq+sx6xR7{9YI;Lgd}Ma zv(6yqe$g?#)`h3c7v3@F$C_Nox&|QI>wcVqUN~+_QN#cLPqM#E95x!uSi#f?4 zA%ZY*DtIP-VnR9!gj2F7@wQ&mq#>V&IjN-a6B7a{z$kM)v?GpZ`uGg|CE9yR*jW9K za_+|lr%#96KI^#%JA4yAD1h^1elwfxzE6$sWt00|O#P;OmZYn!J>r>ZlaK?1)a{C- zZT1rN_Bs}MzyVKxVe^&NX*2|Q!!#W*ri^#J4{E!)GB{Jt#cmqzt`S}Z${)fmI;^z> zTlb$ebg0a}Q5w@b=qhLE2xvHRhFFU!Mo9&lvG~}1i*lETEz;+^#Vm@C7^SvkYy>}G z&k%0&s1o+#iO*i9Wd+kesbFFc_be-0e%ug~6g75%3z{|SePnXy1A1ryiIRiA7Y@^rOIhmQ0+v;zF+%1MWX_VsPl?VjA8m7a?u;M! zrh#t~>)bvZ7NmHwfATzH9F&>-2xKGPx0SYhc=V`qlQ!N4=OkF^1>bWOd1uYM6UwEw z43+iete%S$EG#(?Hb}AFFnNvic8d|e7#))TfvInpRcv_{p5R(#EBP~h`GXlfTWgDk z7VyTHYs8NFI?}$Pt;w(SJ$3ob8DU=foEP$QQvH5E)xM7CN9+Bj-pB22nKoaa6=e^X zu3DHDKU77bfmdK=d^X?66i;^k(1`W2$?C(CQ&0W#7oV>8LsZlQ#=BPFaskg}HsMl_ z$De-I4O|Vhc#C?GF1Bzy$1Mz$W9IM*G~~w7xoi}16>M4 z_hAK#rzAeZMjid*z+wuoN9{#vo)WXXUSlWWH~FS zQJ!&JoWc(4?aF6af?rtV`cX7kV>FcJL9sBdR5^9$L?sjzvSlwUev6(S)qy#(T+tM( z+TLhoW`j1N6g2hHagK`Cr6i#bmgE5Q1Y$~Xx+-KWN54Y<$f6n;R@`)Ch}w z7mo_^FA7l)b{5ZGI#W7ZYVN>_$>KNG^e}0pV6~q)K4*Qa(5+b_7&a&Lt4AykFZAFY z1*%#Xv$+2NOz!xz4dW^NZW(<;kVgxiL)PT`M&@Ce-FDl7ay!7M3SFswgw~>uvmVGK zRSIOq;#xKZ6K+0=IcvljnC<2bChBbe^_I``E`AVXhaMX`-vx3bz{>X#9+MJ!@h*tv z$Fl#LnnlsQjL^P1RSxWEg_+&fs7BOkG|Vbj4;AZAy}r1UpJeqW;aQ(u^2_#}t=`#y zWGLv#LAA@D*X1Ctb1XThw&3dr-rs!S`fMT&U>t81g16;7E+X4AkGNqsk|J+mAnzDfe*TgFX#kv(YMts@j`pgmq7E~V(Jg<(?>Pci=XoH6J9o3U5)1_p>2WYx?{)nh>bWAn&~nD zi&F(gK41$)8;p%wk&Pl`Zjzg<*&#{2(M4siy%nO!`~c=*j>g_5)c11KyNr9zSjm*B zE!c1@rBG*Hl!z8g%-0`{T$Y5l=+GZwR$xvye5FfYf2D}g_)7*~MjivGKS`Z{uz*+# zSbodTn>FNx8?L(Qs1G6V0V z;<(bliBhT3Ci$O5XOB^1aY#=aQD4Xpu{SO-0FWtl5rp6*-Sz&&ytD#}QqYvc=_q7T zBPD@2L3)zWI+)L}%PQ7CTerN?m361(;>Q1vo$9&w?d? zjT)9h_KSpWK5CCu?Hw*tjinLDx9q!ZS_gy;JsUpOODqcWqN05uNWxZ{J;^UpnhQi{ zl27-FP}KO6zwCieolyeNn+Nbsb5YNO0wOmRUd|&E09I-6*zUh0ju)y*qgaTDAI{U>NxFJEIuS!l) z7|R<(fsd6eo|-_B+6NRh(qla&+w<{;Ce^%i*t%A+Ipg{2?B^)2d9TS!@_BD40vaf# zl2#^rGpP<%R$9Kl#&7P96>m8u`Am-ZmyQ72-c4wp4$4I4r0cxfS2kZ zXlQL838`qXU+J-?o7;Ot_1U>+9&ujw-htNk_G(rYuY2wXkGgBYDeo1NgC%Ib#&y@l zu4EzAOVxq1`2?{Z$T8Dats`bSrL=oB>GUb1iSQ|WKv6D{gq`S$u(5j_{Aj(U1P7VJVNyH38Ja}{p;Gn7@Id|=>={zauj zLx*mWtlNgA4Uh6t4JRecr4iP_)l!3NQtlm*P-~@7M{L{(CSXi0wXjQ*w#*{g^=`T< z<;TZ>D;rl|Fr_IaEL&L8=E(&tZx>L04nICaSQAO4St)=QyE)NrmfXWJh{{fUCYiJzZWaFvk}VN{UfFdbKdxo zH*dln-FeN6b4jQ|4)YS*ZBpOOAS~KFo z^?D_L1)$sC{b%eUGKfvQaWAwW7ZVyUg90X?bhoBcD5p2e0-{WVF+Y zQ`+p=U#}b#atfy95sklwe|MVCTdkZqziDe}z6SWDqoA5T2fuQGmOP7%H)vK&k6bd~ ze^UQGmMAnji!(ugb^r_?x`(X2z6R##qH@2T`IAV4e)#-~}CSBH%ly&MbT{AGDV*^2hBw6W?+*-b#O~irg zcNx(EJs}$ExmNjp?l`b^Z@w;jf}_7NS-Q4@^|;u*`5JrX7VFZy^Wc3oHr*?+DAt^% z3F%}V&$v0gTR~y3w7i38$K~;P6d&q0m6{4&#+B1%M@h3s4&c`WYpQTpKHDG4DUstG z-5%WirI2Os%Vj=G+Z_+xTT7cSS1c`;4qRg;HXiQ>1}YI<{G5DoWth=z=2sVQT7}hx zyhP(1qhBr;kH;G1HhAQacmhUeRBYQW=RCOb@ZDCIhxz{bG{l3ej=D*>LS#;HkosrN z_l@%zF1myR|6#Qxw?tkj2caX^+b@E|7wwt?)@$iMki^8yuYL`(#JzBQ0q4Cw^MqdR zUe2a>fP8>nK@C$apWfSzZk9h2a`)<+T3a(uU?p|XspdKoYwPw4Y#P=AKG~;DtIgKG zD0d~pF>&!;jn{d56MP-Vlt9&Wvm(1~Ke}`By-vTn4L|qRgWx_l$C8E9h5fnpG~z=3 z>J(O;XiwSo{upk>3Yy7AHIlP|u?qSIf@++AYHArpHg;Mhy zI=m?!otT^q*5}WCQ$B8DZ_lA!s$Tz+lbiwruRwn!Rosp)5x5en6`x{g=u0 z{CT2gk++@+7u}MCh`Lqwy9-B#G+l%B66)02Y%U?v(M?%M8T)H|#G3iG9Q%vW*O6Er zrzS0}_-#F|zY;LNXXaDbcE`re(|0Er%b4K#V5~a289pfnU1z{HJ5Nra_5Cz-DIK7U z1gt6D0ic0&iyy+Gbw{@Zua3Cmk@axFb=;$QDHT1f$Sy>mrh#V2B$U4Bx;bZJ$j_Ct zhFYlYhA4Ja>6i8B7cmI_WjSB=Ib6SU!nov@Y@?o;v@}KS=gQH!$P;t!v}-D^)@CXU zA{HMiM*^MW+_PgF;rMa*7#@-jb?@Zl^Axk|>Hf@25;8JJUrG`SfFfT{^Ba0+r{}|R zFF4*k1CyX5(_6f@>*!-tlgg{QM=zDC zxD8+AmbdcZqx=xS1fAVn0KF2Tqk-HGet!N9D@vgIkH^?c>nyB@*a`dHp66@pI9>9E z1gEKHfo@LUwM4tL`{z$3WnIeIm$kstaoB|dJ-6?MY1W@U!oc1LAjZHf zhTOM~-)|!jGR31?Q0A{bmSD1Xj*cUUXTa?=f48-sX;8|4BqSs>%Z@@Kp8L9RngIm5 z8oFq0aCLAPLf`{eec#^OD-X~F$%6x^*D%YD1lm9WW>x)9@93!DfA^lx&)+o;_L);H z9?jA&g*IUtf_VOOjRme9wUhhlb^TpO?S*NqDM2bweW7}BWp(uoW)2ge)B$fdRu+{}KsJp-^oL`Va&XtNCEd z4i!x07Z7NuvNbhbfn_C8r>3L;i98Ma7gn__s(A`Y&&%%L5}*Bf2SbgFqj zZhmf~l9Q9ykMUacX#bs;0KZdh)6gG*)~O%2swLN3m~L#Rr>EaP+h11LW%%D7;5u;< zYy32uI5HG?s!O42;$K#^9Cp+>CQtvKMv>AmrS~P_^^4hmM0&&X|03xC7yiop|KGc# e!2i?KxT4m^X;zt!_MEyS#B&)X=`u+}-~R;#Q#``} diff --git a/data/one_time_setup.png b/data/one_time_setup.png deleted file mode 100644 index 5d7573173460eedb09eef86edbf8562c687c40f4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 21555 zcmeFZcUV(d*EY_KgU+CWkAf&w1q4EG(!oZToD45HK_kkCPT3J@Xm5<~v^yFeSiPX1qml-=j^@LUT3eh?sYF->glMRr(>a`p`kgi zp?=?hhUN?d4b3lnzn`XlQX+xhqQ3p+byoxUJM{?q-R1@L{HnK#k+-3nowuKrr!9@W ztDB3hke9Wmt*xtEjxW#P;F4vJhCW;`hH(n4G|Va6rD2g&U{5&MVPFHj;|VYtTSJEu=r_!oLGy0 zw!f5~AliE6m#;%UdHFJb$iMdUjD|+=Ok~8rPr3CKe*1YQs{fyzWDcchKvmV9-{i++dYh&x&HG@G#Yt9{f!srUWDerj8CNs(mj*0|NtjM<(k1x9->7&3^sbaz9U( z`Xi`1k$>{ODg1R@Z=fbGQzG!|S}@m%dRebAkMv6}=0l1e&iZvKhrPVPeZ0XlH2z6S ziwR2Yb>C)!;kSww^El%HE?GtoEj!Xa|CJ``SAXX3(**Zt&CvgtG7ZfePb2F6Y25Xb ztAx$=?fPW@ z|A!4^sjm8z3d8_bnwYQ{%ce0B>#{SP-H=%mMbP^*zfrlq{!Mq^3H+~mb*TgK z-*&wL%@zOZ2S}@O>UMc}&AwAIQPs zR>*(`4nICmHZ`n8L*&VKI&8%0nnl+{=O}oKhJgGuX}4B(f&q1S7^-T0lcu9eWJJe1 z54OXNHqQO59wBWOU z8yVxzKL4?u8PH^82)p)|*v&Ojnxbn%K5%vJ8G7qQ>eFY&_)}rPe>WvlD}T2}|Jz=e zw?0EZr2xc$6hn{9sGFEa#IFxqB-6BG+GeYpjpXLcX_&*mOY8y`&c{K2`qWN9Lv=IF z>t~)dW@Fa{c{YWgL{SC%by_c&|GVD&r?mvz^xW&&nyYmkv!XG&gI`}JVj#8tTXtjF zf=vH$N66bN)-&{v;4-mX8dQZDlzGyzLVyd1w+gld&;7UM|7Swx4rcbFS+Ekl;t(2Y z8GiTr*B#DGnAz`lt(X7H_IB=`2b&s<@wruz2Tjs2TmWJdJ*{N&XwLj$#g7fq{l!1s z^8Ulh7vJ9y{r%Ug)cKxzL+5D@d3pcF|MlED@%-K3cgOyR)}Gw$4S=NzRDP*!OFP`7 z%`;WU*!M=ZnTxwOA2JWFE`$E9{}k8pLpE2fT$xAT9H2MS5i{4_Pg_-?R0ENGYqx2p zOmD3qdsl?r;y+8|d6raGZW8imW50V#lW3|IfH9!M&&>?f$K9=4eOy(0XZOj>G@a9} zw2{%#DEa98dlN09QddFqQmAJ7j$&s1EL zU?^o%JwyQV>(k4HMl0c-o}L|2KF@Jmo6pd>_iq%oJ}i1_sV|lWCg{A^ktM*POMmw7 z&c+fJ|Gem^JFa3#$tkJ#zWdVKIDA7G~R86jzTn!AZrgb}R z05GD-U54Ia&U}#Jx%ANT%`xSeKj{mD`Qgz0fUVo1+T4k+JC@koT(wwsi0L5(e~g0V zmI+QfK963^K0SaM?>U?Bk0LTO1=2)NeRT7?tZe9b9NZm1*Lu$fogcOy{bw;yuJBRI z(A3$&ysVE~pOg7kkYEC5&>C+E>sKA1aaZEwm@)fvwQO@ucPW|;zKkDnv5e8w(RVjh zo;N4%uXDO^boyNtKqk#q7;c)d(;g~TILXFvPJ(NIL$_fDD*i1}i`tOYskz)Mkggm6{sy2#>Qmf%!um#*x~v=S6B9DX4yR~1_SOIrF~`ORs)9j|&{(V5ynuels2h5I zgr&R$kcCCcXDU`n8WfrsXOuBUMTZvZL}EO>x|a#1}ses#_i2e z?vkd9I;{*z23q>4Y@H8~5039auj)emK(2Az`Jj@-@`6d?ZdgKisRv|r4PR~nCLQmE z5(7NdMx9_V)7qW6mzmyB0;e12d7ucK7`urcFs+4<6WPhzQ-!el-Nyx!no3xV-zk1e zP&1h%?c`~AYESv_RZvZE(Gv&GbM^{AoEg}VM{4BhzOFp9I{uj@77aANKry~=4vJ!; zt;9fcQFaY^+n+W{mruf0>XCj4_bXlaGh;-yjri4scAFXc+2sJrhZSzyqAt_0LU!NcX$<=n$l z*%PxR+2dNo%I{b?zaL6*Xe-jVS+n)&ni@W{HAe~;oTy%CF(E;#rMfKLi3^+RtcZ>t z^zF>8!f8(`jooTbQP>|a>v`|sGNh2=BBN;8=iFsp-Iykb^S57n zo0>E~0q#@3>gBRN-dif4b|zG0d248WoC}wb*gGPHBgZ@0bF5y`5@&5Y<|rxF?vYY- z_a288h%%4X6-swLk2SB7xc1%Kocf^Isj#h}EA2KBEg$VRSUn21pESUm0igX#lh44`9+4|6Fyd*%9QYYqrM03)x3X z>dU<7J-U}M<9p_smq96umYVR?rL|R*X-|(uPo4laF>|$*ADxKH6VJz)L7B3e9p&$Zhf(lIpP;!*(?cF4J1$T^U|L~t-VID>;mt1(%Y*V>VuOA*D7!1vK9lPXD$kI&%`~POj_97)MTv&a(^{_eVrkp24$j z_PuOrkhh5}*(S3}=bh(=K@F|c2aN)3{16oK!-2-rN$@8SL)jV<<14CP2J8(w+>k^h z$X`v%klU|($?d2x;LhFN4ye0EEGRS1-!Zbfvh>i3*xcQ(nf1cDHg7SfXId~l-IMo` z*PIMu`{2;Wl=i1TLv`LRY((aia%+XNvJ;hG?>*cfDD2@xY!OBrj&fY(KU4z^G_8F` zpY9gd*KfATS9pPZB4qbs5F_Iy2cvO2%Pt!2J}wXz=%ALTGk+vK$M(&tHKcjRVtM?> zvr(D$wjCCq-;89g{p)g!$fHWGCkaaH777YS6Gr-y@kQs&w^#v%x*gn$HJnO$HiehV zD-6qu9UEbJdLhF^Vw<&XB>*}QMJO;-qp*Orsu*^oGpvVq&2%VzG7I;uV|a|!TB>#b zG8q`mTzh$iU#|Y0jxqd^c0(I}Bn%CelI9?8mE5QMcOW4+)S0T#frs^lRvmDcQB93VgIF`akm0vpo=g4X zi(!*B39-5Au!?FVP0BJ{yz!2i#}r+|LXt!V(RZkbqbg(CIce8A_Zs|Acm|7RwguF-#4NC)bdB1E8DfQr0vD4K>P+>8i+m>PX z&B*$hv-WEaL4v$0t z*~xV*f)7L&t}dh}<`!}Bv#|+MWVwJ-RRfz8xuZTCnGc`u2e1Lo@xn-afr6!@Eoj1W z-+D&nvpc4%PsoOPk6WaNH zf0i8e!oGpoh138OPvvvCHISwCGFL~X##__X3x8L(_tki+ld?hEI@D65rX{T9-s(V8 zXO+j5?pB#4HBLMTp<*zGiam+9zGEj;@q-LHdm)LLM58tdbX#^+woq}tXl<{lKWf^sQDx zVHp4v>A7hO7jIk|($Ti)083>dR8Li~YM;l^@`SEyZN=>tpO>{#aYYqr$`%3{(WB6% zCIPMGA*an`{flXKxU19%d-2AmYlFoQHSFinxO0K;_g`yDFjNpIq=EFHXWF8C{JF`{ zukert%%hMz&3vSpCJU{L)M2P&;)MRzyO3fhLjJFCb6qAZAFmYnqaziRv~2G(MYA6n z-LM4vA40~1%?xWUw|9)PFw||D2Fu1E>i6SnKzX)&M>S=U%i zU{HW>#Y&!=tKwWH+uR|ukWz*N232+R$3Y%?`m)s7Jv}JEE)X25EM&!U`}iTiB1__I zX5v^0CTK=NU0~VB0E6O#2V++6W_J1m z=SOx6+KY^-erQpJ53VM7d@OX=w_v<~d0AC6b)1)%A`|3d-{j=Rxtc81uD(3K-`^A2 zsnFmz?(9~QR*`4ReN`Yuj5VCyYq|IAmTSpQU6O8R#<&nJUV}wT9PHUuB;rizR;a78 z9!wZ4?-JTt`3$!wcU2U}gl!pX;3`XPOO%7GCX^an#bLwMJC8;-!)q$6t{RWdPcPfg zA5{q9#2P}{I}3(uD(o#nyY(P{&dN-#1bZ8s0Vld_#7_Y7lI7Hfh6ck)uieI^o_gl2 zmDD_&L0xTCw=Nt-y0cqo;8wWg9hvNAp_6~0rE%VzSi!9KIQ zKyPcU<(^lt(|D1wcp1zt*sE*6L@wsy0J%WR6eiLCkJ?EjNFt=Vj^(90bD7)9=9ejFN*UKum_;~Jmq%G|N_54i#JG6P_I6y_do1_p zBwEOm!clBIqN;S=Qi^x-N{jN^i`>!zMLHweLbgYQwjRxY@n&0gy6LFBbvz$i<8hpl za(KleRXz<7Ut!D99jw%5Sr+zKuXNw z#hz0fUYY|Zc7l%`cBdT|GO}JiR`Qp|2Z|x(_NQI*oC3Kj#;|@9Sl2nsCo|ArjfJAf zpnd0UBo?~X=nawHcK)areKw**@&{B)U;HjJg60X)y_!7jI5T3{gWGUZfs=ocDH6Zw$gGJPEL`5$SBg*Yl~_Rx`Pqr%(xS-vCPZ-(wr zvwN=@FL%l1Is8E1Er+P!D~5>9R1Phn>Ms?6e*Gx5tDtq($y{~JtXE%`i4R8L_ z4?Iaab~ityI`+SLM0k|sd;{RDulVt0IUrTL!Ec38m$Vt!W3z9`H1?a_&tkrz*P_7( zf;ug7hQPb-p64M71#hK(QK|{_ZBQR$c5sl;j0zXSl8|rwh;xpa+=-J2p2HYrC6Y zv+|XDqN|gpOQkL-Pm*Wpr*Y8{_rhVf>I+hdW@FQWaj$u>`ywi)sdA!%8RRl-L!gDG0E$0A6;f%rMq7KUHpeCAZb#qki!UU?I-NLdij?97m0shlLotH0ODhj%3bT^PE9Eeo0- z;})sNBbd;R0q#hB`SVh6KzjdSQ+njH4ZRGg<35Ke%3G%;65DieX;lAJ!2%$yk_sZq z?!llL*{z4@^!s;*p`n$B)fk=7oM_X5jXm`&aeP?MIAWBJ$=3-$V$XLr^(E-z$AF=N z{3~cMp+kecbr$9GsC`)7s_Hs6S>7Q@<`WmBNYEj0L}e8-U6A-1w<*`=doTL=k|eb) z3>r!8T?MwIl`G!hk|E${l=LpLSd|h}bXNsV+W}W?j%Bfh3_CtJBin9>W9?=nQfm$gA6 zK+fPJ2xBntp$jV5UTS|T>RHKtf)qS*uZJVcWwcDH7ikER^#r1-K)Nvuk0`75a3+BA ziU0_OG1uj1`GN+A5_N4&hpn{MBop=PiVh|@o$B$$nhj_(lgPLD5g|+En&9v|$6SH& z=SfLg`}s+IyN4wQecpRSBsSG_VD*lPDIA^ZujcFh#cwC9w&~u^C`qfd?PK9)uw{eA zI;&7(#+qq+9WM#wq^w_RnB+&ERP*omr4Ip!I>YCVwnbEyM>m&1r2fj*uvnAg(fv}^ zPhe?1mw33J{bH748nkriX;u`?SMFHWl)Qyci#?1&UxK`m-M$kYm# z*C(0}gFs}N96!3CcBbr^&T!ElGR#e(^b3oR-WlM5a$?VsmI-<<^4j&SL={-YbhcK3wfaX;qz3DTCOqL!l0J*7;W4V*FRA zvU064V|lN_zuHvPRG!=^Au;N^)!mVT5aG0tFb#iJv-^3+nc0mqB_l6de5k8GH%z3n z_@4ec zZQxS;`gfg%Iwz(pY9OKr8}T~b&JBURwP7KgWBaFfUnWu-oSanKUA8`dI-ezm=dHWR zf3td%@iCr5dDdh=CJx!$m`Pnjii~PySg+pEYL6o1S`pG?k zQs>307Aj6EDL*Ol9VfL*!M%KYbWoPz2tT|%?rUqO(WR2^sWpC04-*tLe=qO7@0<)w zHT&(>$3*@WEg&EJBjQQBvs> z*QZ@6eN`1Ka#lWVxCXsMs-W#XH}J>AdqUD22Y&i&Ym#>dfJ51e5TAgsA%QX-ojTeJ zY#sA@zqtR!&&0}3d&gAb(!HPfs39VQT>yC*6e4PHqyx#&-2EuUf*kiRX-~x%DD^o= z%I%66l*|EgA#`#JWuI=iFGkn7&{FyWP~w5dnq}jWnyh_!lVHCPSwcPUdeBV|Etu*Z zNb}1?p+G_xcTKq_Jm<2lu*L`Z@P2p-pGu(`h<(nhW5jQiPZ{6W>nW>MS<2{E`fOZlT?aaMH!79IRuLVF@H|2xF zvnuqbjlz7jNkL#o`Rw~QvhU9XQr+d_-qi(rwpNekr_V3(!@Dxg*2LlP<$1VPr~|4> z_hP=; zAZjn?X#jiMbG$)F3Q&$ll8m!^P=R)W6z4}M*#(Mv^!Ght76$z%{8 z;|#s6f1a5XC78)nyJE!LXZruv{OF9xiG>eBZxhh2thKWajL+fK1Ob;UXCH z?(I!X?l?VG%2w@dIz>!8%>H$HuWfGwr@|7)8(;}chii5zUr&1Ls&>y7eNcRYm zP(nrhPrUSu8#U)9G(PySsqSXj^ZE(=uFq??Sy4}WvP@L#8I`8a*tH4(A@i~p0FwZj z-z1QfZmE$+?@uW5r-DDb1opB&)IEC`-|EH0O;PY{-jHdH@DThoRH>`M#h-5wHBy*Z z#_f2p@fN}@q>1Q#oO+6R?!ls{w2owEooE!c;~-8!X`DG!DQkd|L>g}?u#Q#=jmA9t zyVp+5#qR_to{$D?Yd#t?VT714u-5GT!`tkQs6n?zqzoHI*&!Y8?Kl9+?d=co)FOw) z)~DRfE$;SzE*qSz$PwBURB<+@A55s^R>9%+>2-r|OvFE1yPfbrCEuEP_rWaXVi`X!)r;Gn^HNfuEXQB4_vNFkD_v!Og6jw&} zR1U&uZ-M+?2sD^gX!4muTtY=w9tS=Fb?F4kO5FC4^QDoQplf=12`$ z_E2cw$AmztG!i#k(ghm~s>ZWYiZ7ivg_citmdEa!?~oG+%v(5|O1C&(#)u-r(FMR7%c^!lJq~WR~AAOWX%u z*l^KgQe>j$)iMg?ylVW$T+oMgiBuzE@wpZsn+5^*ZB=52M?H{W9Of{5J=I~Vr-~Cb zdu9Y;;JRVmp)N;|tCYM76}3#0N1QTkG7GsX7DJd{Z(m8cv)_05?pZ!)4wU@9b6G< zdw5udKd8k5Ymf#&FU`ALh2KBaBgnT|1ZJIDM{KeX0RUNkm0bKt7ve~&+o8=Zoo~dJ z3Qem(n$f({E=~%ciO#!{#-j!e^Bhd)nL{Ile&4vEoVE47&d{n6tA{X?CU*&c=XX9y zPGO=tc%5bEcoN!^AKdhs51CLL5kuJAa&3^2+uh!;rMhS2_V(Qf>?&K}Drth<%f+eR zW{{eeinc9I>1;&|H*CGD5Ar)07wKvq*T&fy->gB1u?~?t<*lRrDV<}ZLdiQ+__U*_ zn7MPUp>V!fYRkr~uTs%ke2ulMqJQv*qv_aTb?P1MI@fZmTI=y{m4a6>?mhLHF&`D`DjWsdZG1Tz zLRZJnZhabzcx>ak z${6eUssbUFHagVRP>4%e2+jDX@6E`=-gp@QMJvK%f4M<_~E-LkQv z#uqq!YGf}FEabIPvDIGJhL4yR?oj!WO_|a=p%e-~EV)SKYdTI_7#a!XA_Nu+@tfqk zv`m+i!}F#6WZwP{4SaWJ-+6YQxxe>7eR9^ zABY|TsZ+6&amW=vnIs*)#`$IP9Aaq)Ybx`daTjadb8qS%H6N`OtXOSspj7l;zz!a% zN;jfi5olmnl})IU5<5+!vjCivmLnVj4f8?3s+o7}z4`yD1fX}EUB=xO6{?!Pla-a2 zB^aJElx{(Pd%9-nXG;zy0w5sNEv9I%%{3n)IZCsIor^~BUxj^OiiydciXs!`{V%Mq zkd}ruEPTOTkTk;eZ^q_PYv;WwYXg7(uGo6Jv8Oa|Z2vMSl>!dzzpY9diF`mY<1+E} z#b<{MPzl1{zHz%R^1mag?Ek^}Ji%P4zF$Ct#aDJ{4O^OtFqLBZH$L{Go_|()(HFVm z|LJRzm^uuB_vGM)fE~@RER@9j|GeWjhIi44PW%UlH#xsL?mI!-(?8ztDek8lUHGS5 z*KZu#bEi+OuCHVC_};P8Jz+}dAkENQ@l(@2f8+3eV}#q2zS3F|R(!Fu>ae$>(NgqN z;&q;+$Y`-KHLd9SvqhJGV)muZ{NJQ|^7>CpMo?4+=jl7wsEqa#?rq63AYT2121Dgu zSM&XZu}|m>KX3hJ_@5S_XiT=Szwt+cF#$&hHB`uYhMx9Kq~onLmbf;Lh*EDVlJ++a zzkt31+qu)!tmap?KgqME`ks*{bp-#W9E%`?zAG+uEdN=$fPx!UdJi8^x#0nyr|wXv zk~GK}dXTMryw`I=L;sV?2tWVx5v1m%zpFts*DSfFQ%O0umUK#;Ciu2ZPx9&l3VH?x2=(D&E$DS{kYOv4i*`CGQ*ruH z^H2otzG4k#e`iarE6L5}8h>K`%M-VM7t^@jEcma=_McT&8k5CxPcRqSN`odXeXh{B zzT(#K4hkv?B(D|AB|1@6=>O{THySetmE`{ElX{*e%@?O1O9qZ|{Kus+82TxIjd4Lj z!X+0Mmtr|a8tLfeS`7WP$&K}2znJ`hs4;Mf)@0Bb594pWNk4?pOr`z1R3+`@|Lia* zIKwF1Oos&ZBgWH&o>C;5o65=q1HE^O3*kAQvTE?{vsFW}HVdAfPQ%1ARnSn3SrTe( zJ`u-N0bwUV28$8!4kkuFF#8`T%SJ=ZbfU~1;WEimYWnfQckT#^A7 zTx%O0^qpE-4*`5@JvG1QN~C7xJ{P+S2>Adov5$5FR)bfi&1#6ZyU}6Bf2ir>avg|P z-&)gHHpN`=PcA@3i(%+z*PXVR=1(86;NdbJ#b5APGvTTw(GvE}waH<<@$$kAbn}}S zmG6ZKM#Zf93iV)B#fs(lgRzBAR(MU`9;4^Y z1iWZlSW)5%(h)Aa`&Va$7@P>~CfQ_F9rSFcZLX%TAdBya=u5eS1V5IoK4X&xRuKD# zVWUWPLiaEo3}0r)SLM**>$LynPfT`M9{RmNs6(OAE+hDoZS%0UZYKLYI&%j;$mOqd zr;<7p1gY(O{#khmy%8i|a%Be2g^A5?u@-W5q2_rC49bT!12%Q@lTo*vO`8SvdH666 zx^bnsS{rW z!K3;QW=^BIQ-o73lxzo_FqiiLS;JL(V-l&Y>(Z2^DknN~HClPzI=w_zU}BJw|0}zP z0!adx%59JEdlk8FZ5od!kKt()-SHz^!NU#Uafa#USYuDSPxAu}snq#ijVxn}L3{d( zwEcMK$8{u!zh}YW?a~ziS6`7JXSLN&vmT2Bi~)s*62VWmQUGS7#e$wJ$&`&_tFh8vRg#|nraWVkj11U5Bqnuz zG2-xnuO5iYk>7EE@p2&a@JmBI(r5lzy3i;>as~A-6(}FD0gk4W71t^o?0>0z3ze(U z`_vLSn4eId-wkuZj^`CmCPFSmWF4>YjAkB;I`Pq^v4s0n^q2Jcn&S-=4>&FLoo+%k z`b5VeW}MUv5eWOd-*Nf*5>Uav>e5bR_Acv76ODUPli4^_P`2un{!SVhw^{6AH|QzBrT%; z^`&;a(}n^fruA$W8AFITqRRw=a{%7em_Mm^<(4ELqPoAmCc{Dmz^^Bh8ngIT@xZ!&q5e`FbWsN8@@lB4 z!1bK=wTrolcloJ#P>k1&Vm0)^`f=`j)2Y=W4T9V9QPWfU5h;KBp+<)iR$t(T!gxrs zrUht+TfYz4E@GoOPkBHoU%l^9jm?A@!hCni#(_rfx3}B$JeD72p-)m)gRjg%Ku-QK zH-7C==x>!}3&#dP6o8H_b#9laY3P$0PuEbmFNWqn#K{dWv?ddoep6oZ@Z-kz>Gh34 zR%}KX?ymYpuw)(S@KH9|7xPAYAGr8^1QiO9whR#6OgC|{eahUtzXL5UFJIH2)9t=4 zjmD%X7~;hCV!4%1Z(^brnqD&rAa{V#P^csaa%ptw_`pqN`sh*UnXkI{#4W7}?(gH* zYy?O#6`AM~^0%jVg+~L$tLP_mEd!l6oJ~|=#*JHj^~!bo6lObVk=zPJFPY%QuEX{m+aztPOcZYN5dYsrinOFXVckZWLZbQGG7|m_%GA4z!V|XGvCUBMC%{Nm!jzmeC zZ|bfb9;tD&=$1NKYA&S~sA5IC^C!lnSrMHh#bM#MCKN`bOh*IfhewBvsAT#&oIKQG z!dx0=TglNNRh?N`S$Ph%X}Z}uHkmv(Sdn3GcN5bfFIuH3URK$;2w59XaG^$fX$%v> z<=bn+-EYg98>G14)a23FZV~&|qy3$u!}iKjZo?6IQHh48#a$lU28zwAq-wqiVN30f z;?_N%K%OUM)C6rl8Zt^9pTtoRLn&;#M;}(;HYWjb-Rt&R`?%(mkcE}VEcmigYu(;M zVU4t^`Ci|Ufb_|%(_*U_#CEC3dNRzWD8v5j-eXk1%mR65Tmom^uD(};-))esmf9Oz zXUoLz62>O~im!08NcTT(u@17gSeY+89CMze?Dp<*D-{RJ^jJ*rUv;!DP!0@r?s2U<0Imub#Y4Dl!P7))#bo>ce|bbNio*> zDBT6Gf4c(l5s;gPm_w6UDa&l>zK5bRThcJreZZoTV_=9*_4yX2_2wtE8ZdLjvQeM= zt0r&0JF?Lgjxq2`If?$4F@5(}tx=4voAxYw5Bx1XWTaht|6r^|4Cuml7Y50XS|pmU zs%j=w#)1%>)MV4j@$Jof{{D+qI`*z~Qd+Kz9T|!=n|Ce!GmxW;I;zSaGtsNDeZJZg zDL!hs@oa7J`K6~D_O4;YyHygN=B5OAHA@iSh&~;|cnL}^6A+X(u3wWWACrO7dWr!V z7-g`=nE%drhR1OXR7k04<%lh5A-2-cT(UX&zW|AqhA|+63$%bvm&S|5mL+>3rp0SU z2xbA{tS;Wl`ol_k21BWN&l*x2UB<8--5tIj*wLqg1T%XI`aWwPC%e?B{Z{Yo)x6wG z9S~b3RL1P18eyv3(rjqaty|W!Y$~PL`dFf4*G@|QZ4aYl({a!+O!7+5;J~=QvVnUg z>KRudU;8Fw7u!8kofe*0_F+S;>$415AokQ{@_SOq4-3EM~a^_M*=#k-Z`Y~l170Yw}blC7&AFzH) zc#UeIA>47>W8}3b@*_@C=TdNeiM&A-vA1-PsTD75C|}M7A%&lgOgM|0eLBDFsnV8` zcEjhDg&W^u1xHAu&GGSaWr$Mzz`A1zzpSnOb&fitL@vjV%3k&RC>Hp`edqV-R8s6o z>BA@G;|2Se{1()1iA?uZl2L_&`Th>CzmD-8GZ5DzA0@$FnTcJ^D=DF{e?cgYedu0p z?}zE>X>@b7Zw{XUqYBjp3qo+YiJ{s(c%@mlDVCU#UP!3uFn(E3Sg6j{ILQ&8gpx+k zkv3-}iQ#2IlL@Bj+S%nx+ek9gDr}qNPi;R(>()wwByrt8V|F3*pP-;YHS=A3Xg=<)JR3O%-n5s9EGjq zM27DT@jAr{|5YTyIQt5Fqz9XQZ!Dv2zULaUyK2FwtPDozxFPj*9p&_z&d&KiRS10L zD%U`={Rm2pfs>oP+yH>*QlML#`>PvdPXay%YOYZy|I(2^(BCpRz^prPl$q*le_hg| zLBH?*cy4Yk@w6C=PNZ4Bxgr#dV4NwSBeg`KnMa=Fitd6GHHlCLDma?2kIoAgbQuF3 z6y}~4ex+x0F+#CnO4g+MA#`-hi9w1bhR5k%poY2rMtuXIJI0Rhy|AG1knsD;f>q7F z*To-?@94%2l~+_@xxGp0cx;`>v1Oy+_z1D3rdr`a?b2y&DHuYoIAWi)cuxbNnHCR? zc@CIZ;SEli5eB#U93MRRQn%#0pr&srO*`BXX;9b_8x?(xa)ax9gmrNJA2x%JboM(3 z)e>e5rzJ*=@m)O9D4BS`9c?vbUZ^dIXoi~9NsQHs6ll6T>9e*gT-N7aX5L{jNLDX9 z3owGIHiy3*C>-SkIPnJTFMsKD@{f62FcbC8m$rRBK|5N9+*mzVJpy2)OXY88QlQPu zUl@k0sTfqK``rJk2EW%uDY%3EOI zF?JgH9RrnwZY}^`h1zmb3#-2_#W&af^2*!oUmxBfy-7M|x}|^4nwDre;8;P#0)Y=q zmkz8PahF4LKKT5iCHz4r@;R3VEt8TzvHIF*WnSrA_0xkr<4@g_pSN!ujoG&M>Lo0% zC!Fm#%*!4uEe|Oy*0J_Y9nwGc5_Sx6Oz#-=%uR(MZ#p6^q(LK4bZ-!vGYp@YkCsVt zKXk3+TTOLz!0e_q;DVbaRd5`!PX-Y{bXmq`ttSO2b}J`IV3e(Vl5X@`05PA zHf!zJ!GBVo4Z1rgL|{-fR`w-!aaRrLLrRwV(|`(-@FjL1wbFDQw6dV?)8m(1_DM{@ zG&(fwd9Y6%YDD8+*Mc(tr}Mof&4SI zjK8+rv6yw$%4pKd$SbDa&*L$QE}7f0er`C}K=<&-sEiG+ENgDA?^<&WRajo%Zpzq&KED%xs!dMGbD3ATHrx1Z%K$TfTLA*^Xi!m|UF!=~0(jV)@dmR#P&zv_}8 zB-k&+1T?fPl+o8}rfN$qc=o&+G7Y*s^-4M=r%XZKrGOpCRIJrlVXBEkn52|nZL3|G z+NCWFwo^8&UN69SdAo7EaU6E7I`a5-IJmzRimx_Vyt`@UHE)`|Ejpx5ABaQT>mS%xjK%}%y zOehF9kr`Z)t-3TAM6Hs7j&}eroTZ!5bDAxYTdg$7xI{WM%JxFN;nk6YR@#Y(#FZgT zusrZE24=n<`;Mr4a7pk8(kVpx%xdJ=qdOtiN1kLOV~lLo(O26?BArR_V4$@Z4dBI_~9-^Do+>6PBp15wiv~!wM^~HATQ-TVFsJy2jBCmM;Nrw!$ZaAf@B^OxS zU23yOSHQJM*OEiWg2~#kQ+pCq3%!YLd{{^8|CCp&ZHe1!l#|M(a2c(&5)i z=qngm)T2G_v|rdySm3BkTe2~bJvWyw%zA!c*>))yX+S>^*#SUU`*hbCw*o%h2=n@; z$?g*4FC4XIWf1EW4E;UV3KUfSLt~ce=4mF-4P6y&;dvhAg!!WCEbMjIul{3u+O}QBaX;kG~e$B$}wczEL%Cq!)-ZfCX=3`y$2(N@Y!$Y za-7cG_sDxAL>N>LE6U}Tg=tm+&tqp2n$SENIkU6Y<8^*+#B4JGBGiX?{orM(jY~T_ za84~Akd1lk@Ja_)QrLzVTpwV}3Q=rOw^}UasB(%-t3*>LX9Fd&F2So3kBbF_vW&LO zbby9t>q{H`>PN_&k0Ko$zC@_64aJn8+}J4*zz#~KK=+gvJw7>JXxn5*O}g;=ADQe@ zi?prn=h=CBz!IN{nAXjx%IC&8shY10(9)$v zYsHvTD6syNdYGhsuA$y*!@mBkg&uj`Y|Fl8aL(?_;%hPz;Z>{rpYs+pa`0>|_6u`s zK+@4?vytFzD}lt~oP!VW!)?@Ew^uUsBqkR}Ng(2;W@eUyOX2@%=S+i|x}rFqf!1{j zYO9q+rwUX@KuSW`WOOVw2nbXxTf(N0Ab}W`gb+{yW-w(WsbX0}uvHd;1P}}$OM-(? z5h4{NlmrqG6Uvq#0RjY)J|<%8w@#aT23Ywy`nYZ_MgaCL|7@a3Ix1 z!_a2>G|Ccd&;?%UD;*k24i8qJY?h8OvVijjihwUGt5eUSM?^Y~{NLf|)WlXOzCmC5ZgP|`% zyZ!s+%d&N6h-NQIGnFwU6y?3qF~{<4>v@a_Y)^A8;hZbjNGZPRuZ+R+&YIN`5?7xa z#gp2>wFx~pAzkz9Lfv>0A-=%N5-1|UEEQdiR;&%A%WX3lY(XD9rFIyOSWT8l7LmQguNltO4{r<3pFib9z-fF+ z1>!l~&B|-$zTOS^(*+Z}vJ$P%8BAcgjm?=)H5}VxCFn33J3N8&^9Ckq1}Ste>UkP1L7& z&=CBul9_i+Ldb4s(h#?{1hMHEDJx+fC%n+}lf~Mpxkd*FgYuC1o}QkM*lhOHx4xC1 zRxXQs@o_H~-IE<>l0qPdN9hwynXT|r;jCMh(+|e;9URjLC4HU?vuMph5By>%n4VuM zdhqi5j-MK;nSnlKh*#j2Z(Yi%NUNLL=C{fDse#+Q&ZjsTMWBE4 zYp`2hNGhAT7dUuv;ZSO?)ShNqE|yo@(6ELM?~oL2P@D28f`;U;cj`SMuoEX|1-Fg&(@f| z6$2H)+!R)Od%F)sXY@v-jiI3)1&G8189*7sD>U2JczY`SPum^BG6V3taG^xPn< zr-IyQAy(pXxMCX*GuIMtSK4?F6Jo5lxVkuM*|#wRA)*S(k&pAp;#ZtNj=%JeSBg`Grfv|EZW+RrN#dgbY(l33&3%, struct __private_nat>; + _LIBCPP_INLINE_VISIBILITY - __bit_iterator(const __bit_iterator<_Cp, false>& __it) _NOEXCEPT + __bit_iterator(const __type_for_copy_to_const& __it) _NOEXCEPT : __seg_(__it.__seg_), __ctz_(__it.__ctz_) {} - // When _IsConst=false, we have a user-provided copy constructor, - // so we must also provide a copy assignment operator because - // the implicit generation of a defaulted one is deprecated. - // When _IsConst=true, the assignment operators are - // implicitly generated and trivial. + // The non-const __bit_iterator has historically had a non-trivial + // copy constructor (as a quirk of its construction). We need to maintain + // this for ABI purposes. + using __type_for_abi_non_trivial_copy_ctor = + _If; + _LIBCPP_INLINE_VISIBILITY - __bit_iterator& operator=(const _If<_IsConst, struct __private_nat, __bit_iterator>& __it) { - __seg_ = __it.__seg_; - __ctz_ = __it.__ctz_; - return *this; - } + __bit_iterator(__type_for_abi_non_trivial_copy_ctor const& __it) _NOEXCEPT + : __seg_(__it.__seg_), __ctz_(__it.__ctz_) {} + + // Always declare the copy assignment operator since the implicit declaration + // is deprecated. + _LIBCPP_INLINE_VISIBILITY + __bit_iterator& operator=(__bit_iterator const&) = default; _LIBCPP_INLINE_VISIBILITY reference operator*() const _NOEXCEPT {return reference(__seg_, __storage_type(1) << __ctz_);} diff --git a/libcxx/include/__config b/libcxx/include/__config index 384d59700132..a3838c89e8e1 100644 --- a/libcxx/include/__config +++ b/libcxx/include/__config @@ -1132,7 +1132,6 @@ extern "C" _LIBCPP_FUNC_VIS void __sanitizer_annotate_contiguous_container( defined(__CloudABI__) || \ defined(__sun__) || \ defined(__MVS__) || \ - defined(__OHOS_FAMILY__) || \ (defined(__MINGW32__) && __has_include()) # define _LIBCPP_HAS_THREAD_API_PTHREAD # elif defined(__Fuchsia__) @@ -1227,7 +1226,7 @@ extern "C" _LIBCPP_FUNC_VIS void __sanitizer_annotate_contiguous_container( # endif #endif -#if defined(__BIONIC__) || defined(__CloudABI__) || defined(__OHOS_FAMILY__) || \ +#if defined(__BIONIC__) || defined(__CloudABI__) || defined(__NuttX__) || \ defined(__Fuchsia__) || defined(__wasi__) || defined(_LIBCPP_HAS_MUSL_LIBC) || \ defined(__MVS__) || defined(__OpenBSD__) #define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE diff --git a/libcxx/include/__locale b/libcxx/include/__locale index 9d6a901898e2..a2da7d78049f 100644 --- a/libcxx/include/__locale +++ b/libcxx/include/__locale @@ -21,33 +21,30 @@ #include #if defined(_LIBCPP_MSVCRT_LIKE) # include -# include <__support/win32/locale_win32.h> +# include #elif defined(__NuttX__) -# include <__support/nuttx/xlocale.h> +# include #elif defined(_AIX) || defined(__MVS__) -# include <__support/ibm/xlocale.h> +# include #elif defined(__ANDROID__) -# include <__support/android/locale_bionic.h> +# include #elif defined(__sun__) # include -# include <__support/solaris/xlocale.h> +# include #elif defined(_NEWLIB_VERSION) -# include <__support/newlib/xlocale.h> +# include #elif defined(__OpenBSD__) -# include <__support/openbsd/xlocale.h> +# include #elif (defined(__APPLE__) || defined(__FreeBSD__) \ || defined(__EMSCRIPTEN__) || defined(__IBMCPP__)) # include #elif defined(__Fuchsia__) -# include <__support/fuchsia/xlocale.h> +# include #elif defined(__wasi__) // WASI libc uses musl's locales support. -# include <__support/musl/xlocale.h> -#elif defined(__LITEOS__) || defined(__OHOS__) -// LiteOS libc uses musl's locales support. -# include <__support/musl/xlocale.h> +# include #elif defined(_LIBCPP_HAS_MUSL_LIBC) -# include <__support/musl/xlocale.h> +# include #endif #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) diff --git a/libcxx/include/__threading_support b/libcxx/include/__threading_support index de572f3ff84d..473c9c3bbe49 100644 --- a/libcxx/include/__threading_support +++ b/libcxx/include/__threading_support @@ -17,7 +17,7 @@ #include #ifdef __MVS__ -# include <__support/ibm/nanosleep.h> +# include #endif #ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER diff --git a/libcxx/include/atomic b/libcxx/include/atomic index 57d01ad2791a..0fc799a24319 100644 --- a/libcxx/include/atomic +++ b/libcxx/include/atomic @@ -2791,13 +2791,10 @@ typedef conditional<_LIBCPP_CONTENTION_LOCK_FREE, __cxx_contention_t, char>::typ typedef conditional<_LIBCPP_CONTENTION_LOCK_FREE, __cxx_contention_t, unsigned char>::type __libcpp_unsigned_lock_free; #else // No signed/unsigned lock-free types -#define _LIBCPP_NO_LOCK_FREE_TYPES #endif -#if !defined(_LIBCPP_NO_LOCK_FREE_TYPES) typedef atomic<__libcpp_signed_lock_free> atomic_signed_lock_free; typedef atomic<__libcpp_unsigned_lock_free> atomic_unsigned_lock_free; -#endif #define ATOMIC_FLAG_INIT {false} #define ATOMIC_VAR_INIT(__v) {__v} diff --git a/libcxx/include/bit b/libcxx/include/bit index f8c37c3d6bbf..fe360179c5ca 100644 --- a/libcxx/include/bit +++ b/libcxx/include/bit @@ -62,7 +62,7 @@ namespace std { #include <__debug> #if defined(__IBMCPP__) -#include "__support/ibm/support.h" +#include "support/ibm/support.h" #endif #if defined(_LIBCPP_COMPILER_MSVC) #include diff --git a/libcxx/include/fstream b/libcxx/include/fstream index 7b1bbfe16c01..d7d6b46c32d9 100644 --- a/libcxx/include/fstream +++ b/libcxx/include/fstream @@ -244,7 +244,7 @@ public: return open(__p.c_str(), __mode); } #endif - _LIBCPP_INLINE_VISIBILITY + inline _LIBCPP_INLINE_VISIBILITY basic_filebuf* __open(int __fd, ios_base::openmode __mode); #endif basic_filebuf* close(); @@ -574,7 +574,7 @@ basic_filebuf<_CharT, _Traits>::open(const char* __s, ios_base::openmode __mode) } template -inline +inline _LIBCPP_INLINE_VISIBILITY basic_filebuf<_CharT, _Traits>* basic_filebuf<_CharT, _Traits>::__open(int __fd, ios_base::openmode __mode) { basic_filebuf<_CharT, _Traits>* __rt = nullptr; @@ -1326,7 +1326,6 @@ basic_ifstream<_CharT, _Traits>::open(const string& __s, ios_base::openmode __mo } template -inline void basic_ifstream<_CharT, _Traits>::__open(int __fd, ios_base::openmode __mode) { if (__sb_.__open(__fd, __mode | ios_base::in)) @@ -1540,7 +1539,6 @@ basic_ofstream<_CharT, _Traits>::open(const string& __s, ios_base::openmode __mo } template -inline void basic_ofstream<_CharT, _Traits>::__open(int __fd, ios_base::openmode __mode) { if (__sb_.__open(__fd, __mode | ios_base::out)) diff --git a/libcxx/include/limits b/libcxx/include/limits index 8f97cd10a8b1..6d5d1e1aca75 100644 --- a/libcxx/include/limits +++ b/libcxx/include/limits @@ -105,11 +105,11 @@ template<> class numeric_limits; #include #if defined(_LIBCPP_COMPILER_MSVC) -#include "__support/win32/limits_msvc_win32.h" +#include "support/win32/limits_msvc_win32.h" #endif // _LIBCPP_MSVCRT #if defined(__IBMCPP__) -#include "__support/ibm/limits.h" +#include "support/ibm/limits.h" #endif // __IBMCPP__ #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) diff --git a/libcxx/include/memory b/libcxx/include/memory index 62235cf72b35..a00916c8c03f 100644 --- a/libcxx/include/memory +++ b/libcxx/include/memory @@ -99,14 +99,14 @@ struct allocator_traits }; template <> -class allocator // removed in C++20 +class allocator // deprecated in C++17, removed in C++20 { public: - typedef void* pointer; // deprecated in C++17 - typedef const void* const_pointer; // deprecated in C++17 - typedef void value_type; // deprecated in C++17 + typedef void* pointer; + typedef const void* const_pointer; + typedef void value_type; - template struct rebind {typedef allocator<_Up> other;}; // deprecated in C++17 + template struct rebind {typedef allocator<_Up> other;}; }; template @@ -786,59 +786,34 @@ to_address(const _Pointer& __p) _NOEXCEPT template class allocator; -#if _LIBCPP_STD_VER <= 17 +#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS) template <> -class _LIBCPP_TEMPLATE_VIS allocator +class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 allocator { public: - _LIBCPP_DEPRECATED_IN_CXX17 typedef void* pointer; - _LIBCPP_DEPRECATED_IN_CXX17 typedef const void* const_pointer; - _LIBCPP_DEPRECATED_IN_CXX17 typedef void value_type; + typedef void* pointer; + typedef const void* const_pointer; + typedef void value_type; - template struct _LIBCPP_DEPRECATED_IN_CXX17 rebind {typedef allocator<_Up> other;}; + template struct rebind {typedef allocator<_Up> other;}; }; template <> -class _LIBCPP_TEMPLATE_VIS allocator +class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 allocator { public: - _LIBCPP_DEPRECATED_IN_CXX17 typedef const void* pointer; - _LIBCPP_DEPRECATED_IN_CXX17 typedef const void* const_pointer; - _LIBCPP_DEPRECATED_IN_CXX17 typedef const void value_type; + typedef const void* pointer; + typedef const void* const_pointer; + typedef const void value_type; - template struct _LIBCPP_DEPRECATED_IN_CXX17 rebind {typedef allocator<_Up> other;}; + template struct rebind {typedef allocator<_Up> other;}; }; #endif -// This class provides a non-trivial default constructor to the class that derives from it -// if the condition is satisfied. -// -// The second template parameter exists to allow giving a unique type to __non_trivial_if, -// which makes it possible to avoid breaking the ABI when making this a base class of an -// existing class. Without that, imagine we have classes D1 and D2, both of which used to -// have no base classes, but which now derive from __non_trivial_if. The layout of a class -// that inherits from both D1 and D2 will change because the two __non_trivial_if base -// classes are not allowed to share the same address. -// -// By making those __non_trivial_if base classes unique, we work around this problem and -// it is safe to start deriving from __non_trivial_if in existing classes. -template -struct __non_trivial_if { }; - -template -struct __non_trivial_if { - _LIBCPP_INLINE_VISIBILITY - _LIBCPP_CONSTEXPR __non_trivial_if() _NOEXCEPT { } -}; - // allocator -// -// Note: For ABI compatibility between C++20 and previous standards, we make -// allocator trivial in C++20. template class _LIBCPP_TEMPLATE_VIS allocator - : private __non_trivial_if::value, allocator<_Tp> > { public: typedef size_t size_type; @@ -848,7 +823,7 @@ public: typedef true_type is_always_equal; _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 - allocator() _NOEXCEPT _LIBCPP_DEFAULT + allocator() _NOEXCEPT { } template _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 @@ -920,7 +895,6 @@ public: template class _LIBCPP_TEMPLATE_VIS allocator - : private __non_trivial_if::value, allocator > { public: typedef size_t size_type; @@ -930,7 +904,7 @@ public: typedef true_type is_always_equal; _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 - allocator() _NOEXCEPT _LIBCPP_DEFAULT + allocator() _NOEXCEPT { } template _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 @@ -2673,7 +2647,7 @@ private: _Alloc *__alloc = reinterpret_cast<_Alloc*>(__first); return __alloc; } - _LIBCPP_NO_CFI _Tp* __get_elem() _NOEXCEPT { + _Tp* __get_elem() _NOEXCEPT { _CompressedPair *__as_pair = reinterpret_cast<_CompressedPair*>(__blob_); typename _CompressedPair::_Base2* __second = _CompressedPair::__get_second_base(__as_pair); _Tp *__elem = reinterpret_cast<_Tp*>(__second); @@ -2771,6 +2745,7 @@ public: typename enable_if < !is_lvalue_reference<_Dp>::value && + !is_array<_Yp>::value && is_convertible::pointer, element_type*>::value, __nat >::type = __nat()); @@ -2779,6 +2754,7 @@ public: typename enable_if < is_lvalue_reference<_Dp>::value && + !is_array<_Yp>::value && is_convertible::pointer, element_type*>::value, __nat >::type = __nat()); @@ -2819,6 +2795,7 @@ public: template typename enable_if < + !is_array<_Yp>::value && is_convertible::pointer, element_type*>::value, shared_ptr& >::type @@ -3180,6 +3157,7 @@ shared_ptr<_Tp>::shared_ptr(unique_ptr<_Yp, _Dp>&& __r, typename enable_if < !is_lvalue_reference<_Dp>::value && + !is_array<_Yp>::value && is_convertible::pointer, element_type*>::value, __nat >::type) @@ -3192,7 +3170,7 @@ shared_ptr<_Tp>::shared_ptr(unique_ptr<_Yp, _Dp>&& __r, #endif { typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT; - typedef __shared_ptr_pointer::pointer, _Dp, _AllocT > _CntrlBlk; + typedef __shared_ptr_pointer<_Yp*, _Dp, _AllocT > _CntrlBlk; __cntrl_ = new _CntrlBlk(__r.get(), __r.get_deleter(), _AllocT()); __enable_weak_this(__r.get(), __r.get()); } @@ -3205,6 +3183,7 @@ shared_ptr<_Tp>::shared_ptr(unique_ptr<_Yp, _Dp>&& __r, typename enable_if < is_lvalue_reference<_Dp>::value && + !is_array<_Yp>::value && is_convertible::pointer, element_type*>::value, __nat >::type) @@ -3217,7 +3196,7 @@ shared_ptr<_Tp>::shared_ptr(unique_ptr<_Yp, _Dp>&& __r, #endif { typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT; - typedef __shared_ptr_pointer::pointer, + typedef __shared_ptr_pointer<_Yp*, reference_wrapper::type>, _AllocT > _CntrlBlk; __cntrl_ = new _CntrlBlk(__r.get(), _VSTD::ref(__r.get_deleter()), _AllocT()); @@ -3301,6 +3280,7 @@ template inline typename enable_if < + !is_array<_Yp>::value && is_convertible::pointer, typename shared_ptr<_Tp>::element_type*>::value, shared_ptr<_Tp>& diff --git a/libcxx/include/__support/android/locale_bionic.h b/libcxx/include/support/android/locale_bionic.h similarity index 90% rename from libcxx/include/__support/android/locale_bionic.h rename to libcxx/include/support/android/locale_bionic.h index 8c6d4bd0dc32..f05a6a0522ca 100644 --- a/libcxx/include/__support/android/locale_bionic.h +++ b/libcxx/include/support/android/locale_bionic.h @@ -1,5 +1,5 @@ // -*- C++ -*- -//===-----------------------------------------------------------------------===// +//===------------------- support/android/locale_bionic.h ------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -28,13 +28,13 @@ extern "C" { #include #include #if __ANDROID_API__ < 21 -#include <__support/xlocale/__posix_l_fallback.h> +#include #endif // In NDK versions later than 16, locale-aware functions are provided by // legacy_stdlib_inlines.h #if __NDK_MAJOR__ <= 16 #if __ANDROID_API__ < 21 -#include <__support/xlocale/__strtonum_fallback.h> +#include #elif __ANDROID_API__ < 26 #if defined(__cplusplus) diff --git a/libcxx/include/__support/fuchsia/xlocale.h b/libcxx/include/support/fuchsia/xlocale.h similarity index 74% rename from libcxx/include/__support/fuchsia/xlocale.h rename to libcxx/include/support/fuchsia/xlocale.h index e8def81480ea..b86ce9efbd11 100644 --- a/libcxx/include/__support/fuchsia/xlocale.h +++ b/libcxx/include/support/fuchsia/xlocale.h @@ -1,5 +1,5 @@ // -*- C++ -*- -//===-----------------------------------------------------------------------===// +//===------------------- support/fuchsia/xlocale.h ------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -14,8 +14,8 @@ #include #include -#include <__support/xlocale/__posix_l_fallback.h> -#include <__support/xlocale/__strtonum_fallback.h> +#include +#include #endif // defined(__Fuchsia__) diff --git a/libcxx/include/__support/ibm/limits.h b/libcxx/include/support/ibm/limits.h similarity index 97% rename from libcxx/include/__support/ibm/limits.h rename to libcxx/include/support/ibm/limits.h index 45f1f1e3684c..d1c59f066a87 100644 --- a/libcxx/include/__support/ibm/limits.h +++ b/libcxx/include/support/ibm/limits.h @@ -1,5 +1,5 @@ // -*- C++ -*- -//===-----------------------------------------------------------------------===// +//===--------------------- support/ibm/limits.h ---------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/libcxx/include/__support/ibm/locale_mgmt_aix.h b/libcxx/include/support/ibm/locale_mgmt_aix.h similarity index 96% rename from libcxx/include/__support/ibm/locale_mgmt_aix.h rename to libcxx/include/support/ibm/locale_mgmt_aix.h index 4f658c3eee30..e452dc32529d 100644 --- a/libcxx/include/__support/ibm/locale_mgmt_aix.h +++ b/libcxx/include/support/ibm/locale_mgmt_aix.h @@ -1,5 +1,5 @@ // -*- C++ -*- -//===-----------------------------------------------------------------------===// +//===------------------- support/ibm/locale_mgmt_aix.h --------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/libcxx/include/__support/ibm/nanosleep.h b/libcxx/include/support/ibm/nanosleep.h similarity index 100% rename from libcxx/include/__support/ibm/nanosleep.h rename to libcxx/include/support/ibm/nanosleep.h diff --git a/libcxx/include/__support/ibm/support.h b/libcxx/include/support/ibm/support.h similarity index 95% rename from libcxx/include/__support/ibm/support.h rename to libcxx/include/support/ibm/support.h index a7751b017666..0569cbe7460d 100644 --- a/libcxx/include/__support/ibm/support.h +++ b/libcxx/include/support/ibm/support.h @@ -1,5 +1,5 @@ // -*- C++ -*- -//===-----------------------------------------------------------------------===// +//===----------------------- support/ibm/support.h ----------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/libcxx/include/__support/ibm/xlocale.h b/libcxx/include/support/ibm/xlocale.h similarity index 97% rename from libcxx/include/__support/ibm/xlocale.h rename to libcxx/include/support/ibm/xlocale.h index ad07a255fc95..fde137cde260 100644 --- a/libcxx/include/__support/ibm/xlocale.h +++ b/libcxx/include/support/ibm/xlocale.h @@ -1,5 +1,5 @@ // -*- C++ -*- -//===-----------------------------------------------------------------------===// +//===--------------------- support/ibm/xlocale.h -------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -9,8 +9,7 @@ #ifndef _LIBCPP_SUPPORT_IBM_XLOCALE_H #define _LIBCPP_SUPPORT_IBM_XLOCALE_H - -#include <__support/ibm/locale_mgmt_aix.h> +#include #include "cstdlib" @@ -219,7 +218,7 @@ size_t strftime_l(char *__s, size_t __size, const char *__fmt, #elif defined(__MVS__) #include // POSIX routines -#include <__support/xlocale/__posix_l_fallback.h> +#include #endif // defined(__MVS__) // The following are not POSIX routines. These are quick-and-dirty hacks diff --git a/libcxx/include/__support/musl/xlocale.h b/libcxx/include/support/musl/xlocale.h similarity index 95% rename from libcxx/include/__support/musl/xlocale.h rename to libcxx/include/support/musl/xlocale.h index 2508a8e8e0ca..722d13fa1d66 100644 --- a/libcxx/include/__support/musl/xlocale.h +++ b/libcxx/include/support/musl/xlocale.h @@ -1,5 +1,5 @@ // -*- C++ -*- -//===-----------------------------------------------------------------------===// +//===------------------- support/musl/xlocale.h ------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/libcxx/include/__support/newlib/xlocale.h b/libcxx/include/support/newlib/xlocale.h similarity index 82% rename from libcxx/include/__support/newlib/xlocale.h rename to libcxx/include/support/newlib/xlocale.h index b75f9263a4c4..25fa798b6d02 100644 --- a/libcxx/include/__support/newlib/xlocale.h +++ b/libcxx/include/support/newlib/xlocale.h @@ -17,9 +17,9 @@ #include #if !defined(__NEWLIB__) || __NEWLIB__ < 2 || \ __NEWLIB__ == 2 && __NEWLIB_MINOR__ < 5 -#include <__support/xlocale/__nop_locale_mgmt.h> -#include <__support/xlocale/__posix_l_fallback.h> -#include <__support/xlocale/__strtonum_fallback.h> +#include +#include +#include #endif #endif // _NEWLIB_VERSION diff --git a/libcxx/include/__support/nuttx/xlocale.h b/libcxx/include/support/nuttx/xlocale.h similarity index 70% rename from libcxx/include/__support/nuttx/xlocale.h rename to libcxx/include/support/nuttx/xlocale.h index be738e3b64e4..b70d62005046 100644 --- a/libcxx/include/__support/nuttx/xlocale.h +++ b/libcxx/include/support/nuttx/xlocale.h @@ -1,5 +1,5 @@ // -*- C++ -*- -//===-----------------------------------------------------------------------===// +//===-------------------- support/nuttx/xlocale.h -------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -11,8 +11,8 @@ #define _LIBCPP_SUPPORT_NUTTX_XLOCALE_H #if defined(__NuttX__) -#include <__support/xlocale/__posix_l_fallback.h> -#include <__support/xlocale/__strtonum_fallback.h> +#include +#include #endif // __NuttX__ #endif diff --git a/libcxx/include/__support/openbsd/xlocale.h b/libcxx/include/support/openbsd/xlocale.h similarity index 78% rename from libcxx/include/__support/openbsd/xlocale.h rename to libcxx/include/support/openbsd/xlocale.h index 1136fa327fac..fbfaedd127c6 100644 --- a/libcxx/include/__support/openbsd/xlocale.h +++ b/libcxx/include/support/openbsd/xlocale.h @@ -1,5 +1,5 @@ // -*- C++ -*- -//===-----------------------------------------------------------------------===// +//===-------------------- support/openbsd/xlocale.h -----------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -14,6 +14,6 @@ #include #include #include -#include <__support/xlocale/__strtonum_fallback.h> +#include #endif diff --git a/libcxx/include/__support/solaris/floatingpoint.h b/libcxx/include/support/solaris/floatingpoint.h similarity index 100% rename from libcxx/include/__support/solaris/floatingpoint.h rename to libcxx/include/support/solaris/floatingpoint.h diff --git a/libcxx/include/__support/solaris/wchar.h b/libcxx/include/support/solaris/wchar.h similarity index 100% rename from libcxx/include/__support/solaris/wchar.h rename to libcxx/include/support/solaris/wchar.h diff --git a/libcxx/include/__support/solaris/xlocale.h b/libcxx/include/support/solaris/xlocale.h similarity index 100% rename from libcxx/include/__support/solaris/xlocale.h rename to libcxx/include/support/solaris/xlocale.h diff --git a/libcxx/include/__support/win32/limits_msvc_win32.h b/libcxx/include/support/win32/limits_msvc_win32.h similarity index 96% rename from libcxx/include/__support/win32/limits_msvc_win32.h rename to libcxx/include/support/win32/limits_msvc_win32.h index 758d24647b1b..7bb835559a3b 100644 --- a/libcxx/include/__support/win32/limits_msvc_win32.h +++ b/libcxx/include/support/win32/limits_msvc_win32.h @@ -1,5 +1,5 @@ // -*- C++ -*- -//===-----------------------------------------------------------------------===// +//===------------------ support/win32/limits_msvc_win32.h -----------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/libcxx/include/__support/win32/locale_win32.h b/libcxx/include/support/win32/locale_win32.h similarity index 99% rename from libcxx/include/__support/win32/locale_win32.h rename to libcxx/include/support/win32/locale_win32.h index d32a7a8ad304..897c36be70c6 100644 --- a/libcxx/include/__support/win32/locale_win32.h +++ b/libcxx/include/support/win32/locale_win32.h @@ -1,5 +1,5 @@ // -*- C++ -*- -//===-----------------------------------------------------------------------===// +//===--------------------- support/win32/locale_win32.h -------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/libcxx/include/__support/xlocale/__nop_locale_mgmt.h b/libcxx/include/support/xlocale/__nop_locale_mgmt.h similarity index 94% rename from libcxx/include/__support/xlocale/__nop_locale_mgmt.h rename to libcxx/include/support/xlocale/__nop_locale_mgmt.h index 57b18842ff45..f33d3894c3a9 100644 --- a/libcxx/include/__support/xlocale/__nop_locale_mgmt.h +++ b/libcxx/include/support/xlocale/__nop_locale_mgmt.h @@ -1,5 +1,5 @@ // -*- C++ -*- -//===-----------------------------------------------------------------------===// +//===------------ support/xlocale/__nop_locale_mgmt.h -----------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/libcxx/include/__support/xlocale/__posix_l_fallback.h b/libcxx/include/support/xlocale/__posix_l_fallback.h similarity index 98% rename from libcxx/include/__support/xlocale/__posix_l_fallback.h rename to libcxx/include/support/xlocale/__posix_l_fallback.h index 00d69d19e8c8..f3df6c46fbab 100644 --- a/libcxx/include/__support/xlocale/__posix_l_fallback.h +++ b/libcxx/include/support/xlocale/__posix_l_fallback.h @@ -1,5 +1,5 @@ // -*- C++ -*- -//===-----------------------------------------------------------------------===// +//===--------------- support/xlocale/__posix_l_fallback.h -----------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/libcxx/include/__support/xlocale/__strtonum_fallback.h b/libcxx/include/support/xlocale/__strtonum_fallback.h similarity index 96% rename from libcxx/include/__support/xlocale/__strtonum_fallback.h rename to libcxx/include/support/xlocale/__strtonum_fallback.h index 1172a5d57236..df38598056a6 100644 --- a/libcxx/include/__support/xlocale/__strtonum_fallback.h +++ b/libcxx/include/support/xlocale/__strtonum_fallback.h @@ -1,5 +1,5 @@ // -*- C++ -*- -//===-----------------------------------------------------------------------===// +//===-------------- support/xlocale/__strtonum_fallback.h -----------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/libcxx/include/version b/libcxx/include/version index c021db8bddd7..813bc1ab9e6a 100644 --- a/libcxx/include/version +++ b/libcxx/include/version @@ -184,7 +184,7 @@ __cpp_lib_void_t 201411L # define __cpp_lib_quoted_string_io 201304L # define __cpp_lib_result_of_sfinae 201210L # define __cpp_lib_robust_nonmodifying_seq_ops 201304L -# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_timed_mutex) +# if !defined(_LIBCPP_HAS_NO_THREADS) # define __cpp_lib_shared_timed_mutex 201402L # endif # define __cpp_lib_string_udls 201304L @@ -213,9 +213,7 @@ __cpp_lib_void_t 201411L # define __cpp_lib_clamp 201603L # define __cpp_lib_enable_shared_from_this 201603L // # define __cpp_lib_execution 201603L -# if !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_filesystem) -# define __cpp_lib_filesystem 201703L -# endif +# define __cpp_lib_filesystem 201703L # define __cpp_lib_gcd_lcm 201606L // # define __cpp_lib_hardware_interference_size 201703L # if defined(_LIBCPP_HAS_UNIQUE_OBJECT_REPRESENTATIONS) @@ -243,7 +241,7 @@ __cpp_lib_void_t 201411L # define __cpp_lib_raw_memory_algorithms 201606L # define __cpp_lib_sample 201603L # define __cpp_lib_scoped_lock 201703L -# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_mutex) +# if !defined(_LIBCPP_HAS_NO_THREADS) # define __cpp_lib_shared_mutex 201505L # endif # define __cpp_lib_shared_ptr_arrays 201611L @@ -281,10 +279,10 @@ __cpp_lib_void_t 201411L # if !defined(_LIBCPP_HAS_NO_THREADS) // # define __cpp_lib_atomic_value_initialization 201911L # endif -# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_atomic_wait) +# if !defined(_LIBCPP_HAS_NO_THREADS) # define __cpp_lib_atomic_wait 201907L # endif -# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_barrier) +# if !defined(_LIBCPP_HAS_NO_THREADS) # define __cpp_lib_barrier 201907L # endif // # define __cpp_lib_bind_front 201907L @@ -328,7 +326,7 @@ __cpp_lib_void_t 201411L # if !defined(_LIBCPP_HAS_NO_THREADS) // # define __cpp_lib_jthread 201911L # endif -# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_latch) +# if !defined(_LIBCPP_HAS_NO_THREADS) # define __cpp_lib_latch 201907L # endif # define __cpp_lib_list_remove_return_type 201806L @@ -338,7 +336,7 @@ __cpp_lib_void_t 201411L // # define __cpp_lib_polymorphic_allocator 201902L // # define __cpp_lib_ranges 201811L # define __cpp_lib_remove_cvref 201711L -# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_semaphore) +# if !defined(_LIBCPP_HAS_NO_THREADS) # define __cpp_lib_semaphore 201907L # endif # define __cpp_lib_shift 201806L diff --git a/libcxx/src/CMakeLists.txt b/libcxx/src/CMakeLists.txt index f80c8e062526..c482068fa99a 100644 --- a/libcxx/src/CMakeLists.txt +++ b/libcxx/src/CMakeLists.txt @@ -107,7 +107,7 @@ endif() if (LIBCXX_CONFIGURE_IDE) file(GLOB_RECURSE LIBCXX_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/../include/*) if(WIN32) - file( GLOB LIBCXX_WIN32_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/../include/__support/win32/*.h) + file( GLOB LIBCXX_WIN32_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/../include/support/win32/*.h) list(APPEND LIBCXX_HEADERS ${LIBCXX_WIN32_HEADERS}) endif() # Force them all into the headers dir on MSVC, otherwise they end up at @@ -178,14 +178,11 @@ if (LIBCXX_ENABLE_SHARED) add_library(cxx_shared SHARED ${exclude_from_all} ${LIBCXX_SOURCES} ${LIBCXX_HEADERS}) target_link_libraries(cxx_shared PUBLIC cxx-headers PRIVATE ${LIBCXX_LIBRARIES}) - if (NOT DEFINED LIBCXX_OUTPUT_NAME) - set (LIBCXX_OUTPUT_NAME "c++") - endif() set_target_properties(cxx_shared PROPERTIES COMPILE_FLAGS "${LIBCXX_COMPILE_FLAGS}" LINK_FLAGS "${LIBCXX_LINK_FLAGS}" - OUTPUT_NAME "${LIBCXX_OUTPUT_NAME}" + OUTPUT_NAME "c++" VERSION "${LIBCXX_ABI_VERSION}.0" SOVERSION "${LIBCXX_ABI_VERSION}" DEFINE_SYMBOL "" @@ -257,14 +254,11 @@ if (LIBCXX_ENABLE_STATIC) target_link_libraries(cxx_static PUBLIC cxx-headers PRIVATE ${LIBCXX_LIBRARIES}) set(CMAKE_STATIC_LIBRARY_PREFIX "lib") - if (NOT DEFINED LIBCXX_OUTPUT_STATIC_NAME) - set (LIBCXX_OUTPUT_STATIC_NAME "c++") - endif() set_target_properties(cxx_static PROPERTIES COMPILE_FLAGS "${LIBCXX_COMPILE_FLAGS}" LINK_FLAGS "${LIBCXX_LINK_FLAGS}" - OUTPUT_NAME "${LIBCXX_OUTPUT_STATIC_NAME}" + OUTPUT_NAME "c++" ) cxx_add_common_build_flags(cxx_static) cxx_set_common_defines(cxx_static) diff --git a/libcxx/src/atomic.cpp b/libcxx/src/atomic.cpp index 9ae1fb5199bf..6b73ed771cd1 100644 --- a/libcxx/src/atomic.cpp +++ b/libcxx/src/atomic.cpp @@ -19,12 +19,6 @@ #include #include -// libc++ uses SYS_futex as a universal syscall name. However, on 32 bit architectures -// with a 64 bit time_t, we need to specify SYS_futex_time64. -#if !defined(SYS_futex) && defined(SYS_futex_time64) -# define SYS_futex SYS_futex_time64 -#endif - #else // <- Add other operating systems here // Baseline needs no new headers diff --git a/libcxx/src/include/config_elast.h b/libcxx/src/include/config_elast.h index 91b4de27f768..3113f9fb5cd1 100644 --- a/libcxx/src/include/config_elast.h +++ b/libcxx/src/include/config_elast.h @@ -29,8 +29,6 @@ // No _LIBCPP_ELAST needed on Fuchsia #elif defined(__wasi__) // No _LIBCPP_ELAST needed on WASI -#elif defined(__OHOS_FAMILY__) -// No _LIBCPP_ELAST needed on LiteOS #elif defined(__linux__) || defined(_LIBCPP_HAS_MUSL_LIBC) #define _LIBCPP_ELAST 4095 #elif defined(__APPLE__) diff --git a/libcxx/src/locale.cpp b/libcxx/src/locale.cpp index a0209d0ce8cf..f109389f68f3 100644 --- a/libcxx/src/locale.cpp +++ b/libcxx/src/locale.cpp @@ -29,7 +29,7 @@ #include "cwctype" #include "__sso_allocator" #if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__) -#include "__support/win32/locale_win32.h" +#include "support/win32/locale_win32.h" #elif !defined(__BIONIC__) && !defined(__NuttX__) #include #endif diff --git a/libcxx/src/support/solaris/xlocale.cpp b/libcxx/src/support/solaris/xlocale.cpp index d25adcd21d30..d68a39f4dfe5 100644 --- a/libcxx/src/support/solaris/xlocale.cpp +++ b/libcxx/src/support/solaris/xlocale.cpp @@ -8,7 +8,7 @@ #ifdef __sun__ -#include "__support/solaris/xlocale.h" +#include "support/solaris/xlocale.h" #include #include #include diff --git a/libcxx/src/support/win32/locale_win32.cpp b/libcxx/src/support/win32/locale_win32.cpp index e7c6005fc1a3..b7062db352ad 100644 --- a/libcxx/src/support/win32/locale_win32.cpp +++ b/libcxx/src/support/win32/locale_win32.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -//===----------------------------------------------------------------------===// +//===-------------------- support/win32/locale_win32.cpp ------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/libcxx/src/support/win32/support.cpp b/libcxx/src/support/win32/support.cpp index 52453f547926..d156e02e3e84 100644 --- a/libcxx/src/support/win32/support.cpp +++ b/libcxx/src/support/win32/support.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -//===----------------------------------------------------------------------===// +//===----------------------- support/win32/support.h ----------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/libcxx/src/support/win32/thread_win32.cpp b/libcxx/src/support/win32/thread_win32.cpp index 35c4c871457d..83e7e9f6ce5b 100644 --- a/libcxx/src/support/win32/thread_win32.cpp +++ b/libcxx/src/support/win32/thread_win32.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -//===----------------------------------------------------------------------===// +//===-------------------- support/win32/thread_win32.cpp ------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/libcxx/test/libcxx/debug/extern-templates.sh.cpp b/libcxx/test/libcxx/debug/extern-templates.sh.cpp index 0e19895ba8f0..d5039d4f3029 100644 --- a/libcxx/test/libcxx/debug/extern-templates.sh.cpp +++ b/libcxx/test/libcxx/debug/extern-templates.sh.cpp @@ -15,7 +15,7 @@ // UNSUPPORTED: libcpp-has-no-localization // RUN: %{cxx} %{flags} %{compile_flags} %s %{link_flags} -fPIC -DTU1 -D_LIBCPP_DEBUG=1 -fvisibility=hidden -shared -o %t.lib -// RUN: cd %T && %{cxx} %{flags} %{compile_flags} %s ./%basename_t.tmp.lib %{link_flags} -fPIC -DTU2 -D_LIBCPP_DEBUG=1 -fvisibility=hidden -o %t.exe +// RUN: %{cxx} %{flags} %{compile_flags} %s %t.lib %{link_flags} -fPIC -DTU2 -D_LIBCPP_DEBUG=1 -fvisibility=hidden -o %t.exe // RUN: %{exec} %t.exe #include diff --git a/libcxx/test/libcxx/depr/depr.default.allocator/allocator_types.cxx2a.pass.cpp b/libcxx/test/libcxx/depr/depr.default.allocator/allocator_types.cxx2a.pass.cpp index a6134b04a8f5..bfff214127ba 100644 --- a/libcxx/test/libcxx/depr/depr.default.allocator/allocator_types.cxx2a.pass.cpp +++ b/libcxx/test/libcxx/depr/depr.default.allocator/allocator_types.cxx2a.pass.cpp @@ -33,19 +33,18 @@ #include #include -template -void test() { - static_assert((std::is_same::size_type, std::size_t>::value), ""); - static_assert((std::is_same::difference_type, std::ptrdiff_t>::value), ""); - static_assert((std::is_same::pointer, T*>::value), ""); - static_assert((std::is_same::const_pointer, const T*>::value), ""); - static_assert((std::is_same::reference, T&>::value), ""); - static_assert((std::is_same::const_reference, const T&>::value), ""); - static_assert((std::is_same::template rebind::other, +#include "test_macros.h" + +int main(int, char**) +{ + static_assert((std::is_same::size_type, std::size_t>::value), ""); + static_assert((std::is_same::difference_type, std::ptrdiff_t>::value), ""); + static_assert((std::is_same::pointer, char*>::value), ""); + static_assert((std::is_same::const_pointer, const char*>::value), ""); + static_assert((std::is_same::reference, char&>::value), ""); + static_assert((std::is_same::const_reference, const char&>::value), ""); + static_assert((std::is_same::rebind::other, std::allocator >::value), ""); -} -int main(int, char**) { - test(); return 0; } diff --git a/libcxx/test/std/utilities/memory/default.allocator/allocator_types.void.compile.pass.cpp b/libcxx/test/libcxx/depr/depr.default.allocator/allocator_void.cxx2a.pass.cpp similarity index 51% rename from libcxx/test/std/utilities/memory/default.allocator/allocator_types.void.compile.pass.cpp rename to libcxx/test/libcxx/depr/depr.default.allocator/allocator_void.cxx2a.pass.cpp index d7b4a1b1bdf4..d03f90b506d5 100644 --- a/libcxx/test/std/utilities/memory/default.allocator/allocator_types.void.compile.pass.cpp +++ b/libcxx/test/libcxx/depr/depr.default.allocator/allocator_void.cxx2a.pass.cpp @@ -6,11 +6,10 @@ // //===----------------------------------------------------------------------===// -// Check that the nested types of std::allocator are provided. -// After C++17, those are not provided in the primary template and the -// explicit specialization doesn't exist anymore, so this test is moot. +// -// REQUIRES: c++03 || c++11 || c++14 || c++17 +// Check that the following member types of allocator are provided +// regardless of the Standard when we request them from libc++. // template <> // class allocator @@ -23,13 +22,24 @@ // template struct rebind {typedef allocator<_Up> other;}; // }; +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS #include #include -static_assert((std::is_same::pointer, void*>::value), ""); -static_assert((std::is_same::const_pointer, const void*>::value), ""); -static_assert((std::is_same::value_type, void>::value), ""); -static_assert((std::is_same::rebind::other, - std::allocator >::value), ""); +#include "test_macros.h" + +int main(int, char**) +{ + static_assert((std::is_same::pointer, void*>::value), ""); + static_assert((std::is_same::const_pointer, const void*>::value), ""); + static_assert((std::is_same::value_type, void>::value), ""); + static_assert((std::is_same::rebind::other, + std::allocator >::value), ""); + std::allocator a; + std::allocator a2 = a; + a2 = a; + + return 0; +} diff --git a/libcxx/test/libcxx/gdb/gdb_pretty_printer_test.py b/libcxx/test/libcxx/gdb/gdb_pretty_printer_test.py index 4621e6388343..af473c48ea9a 100644 --- a/libcxx/test/libcxx/gdb/gdb_pretty_printer_test.py +++ b/libcxx/test/libcxx/gdb/gdb_pretty_printer_test.py @@ -37,23 +37,6 @@ class CheckResult(gdb.Command): compare_frame = gdb.newest_frame().older() testcase_frame = compare_frame.older() test_loc = testcase_frame.find_sal() - - expectation_val = compare_frame.read_var("expectation") - check_literal = expectation_val.string(encoding="utf-8") - - # Heuristic to determine if libc++ itself has debug - # info. If it doesn't, then anything normally homed there - # won't be found, and the printer will error. We don't - # want to fail the test in this case--the printer itself - # is probably fine, or at least we can't tell. - if check_literal.startswith("std::shared_ptr"): - shared_ptr = compare_frame.read_var("value") - if not "__shared_owners_" in shared_ptr.type.fields(): - print("IGNORED (no debug info in libc++): " + - test_loc.symtab.filename + ":" + - str(test_loc.line)) - return - # Use interactive commands in the correct context to get the pretty # printed version @@ -62,10 +45,11 @@ class CheckResult(gdb.Command): # Ignore the convenience variable name and newline value = value_str[value_str.find("= ") + 2:-1] gdb.newest_frame().select() + expectation_val = compare_frame.read_var("expectation") check_literal = expectation_val.string(encoding="utf-8") if "PrettyPrintToRegex" in compare_frame.name(): - test_fails = not re.search(check_literal, value) + test_fails = not re.match(check_literal, value) else: test_fails = value != check_literal diff --git a/libcxx/test/libcxx/gdb/gdb_pretty_printer_test.sh.cpp b/libcxx/test/libcxx/gdb/gdb_pretty_printer_test.sh.cpp index 2d8e9620089a..fed6a1618483 100644 --- a/libcxx/test/libcxx/gdb/gdb_pretty_printer_test.sh.cpp +++ b/libcxx/test/libcxx/gdb/gdb_pretty_printer_test.sh.cpp @@ -427,9 +427,9 @@ void multiset_test() { void vector_test() { std::vector test0 = {true, false}; - ComparePrettyPrintToRegex(test0, + ComparePrettyPrintToChars(test0, "std::vector of " - "length 2, capacity (32|64) = {1, 0}"); + "length 2, capacity 64 = {1, 0}"); for (int i = 0; i < 31; ++i) { test0.push_back(true); test0.push_back(false); @@ -444,9 +444,9 @@ void vector_test() { ComparePrettyPrintToRegex( test0, "std::vector of length 65, " - "capacity (96|128) = {1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, " - "0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, " - "0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1}"); + "capacity 128 = {1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, " + "1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, " + "1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1}"); std::vector test1; ComparePrettyPrintToChars(test1, "std::vector of length 0, capacity 0"); @@ -489,9 +489,8 @@ void map_iterator_test() { auto not_found = one_two_three.find(7); MarkAsLive(not_found); - // Because the end_node is not easily detected, just be sure it doesn't crash. - CompareExpressionPrettyPrintToRegex( - "not_found", R"(std::__map_iterator ( = {\[0x[a-f0-9]+\] = .*}|))"); + CompareExpressionPrettyPrintToRegex("not_found", + R"(std::__map_iterator = {\[0x[a-f0-9]+\] = end\(\)})"); } void unordered_set_test() { @@ -608,27 +607,25 @@ void shared_ptr_test() { // due to which there is one more count for the pointer. Hence, all the // following tests are testing with expected count plus 1. std::shared_ptr test0 = std::make_shared(5); - // The python regular expression matcher treats newlines as significant, so - // these regular expressions should be on one line. ComparePrettyPrintToRegex( test0, - R"(std::shared_ptr count [2\?], weak [0\?]( \(libc\+\+ missing debug info\))? containing = {__ptr_ = 0x[a-f0-9]+})"); + R"(std::shared_ptr count 2, weak 0 containing = {__ptr_ = 0x[a-f0-9]+})"); std::shared_ptr test1(test0); ComparePrettyPrintToRegex( test1, - R"(std::shared_ptr count [3\?], weak [0\?]( \(libc\+\+ missing debug info\))? containing = {__ptr_ = 0x[a-f0-9]+})"); + R"(std::shared_ptr count 3, weak 0 containing = {__ptr_ = 0x[a-f0-9]+})"); { std::weak_ptr test2 = test1; ComparePrettyPrintToRegex( test0, - R"(std::shared_ptr count [3\?], weak [1\?]( \(libc\+\+ missing debug info\))? containing = {__ptr_ = 0x[a-f0-9]+})"); + R"(std::shared_ptr count 3, weak 1 containing = {__ptr_ = 0x[a-f0-9]+})"); } ComparePrettyPrintToRegex( test0, - R"(std::shared_ptr count [3\?], weak [0\?]( \(libc\+\+ missing debug info\))? containing = {__ptr_ = 0x[a-f0-9]+})"); + R"(std::shared_ptr count 3, weak 0 containing = {__ptr_ = 0x[a-f0-9]+})"); std::shared_ptr test3; ComparePrettyPrintToChars(test3, "std::shared_ptr is nullptr"); diff --git a/libcxx/test/libcxx/memory/allocator_void.trivial.compile.pass.cpp b/libcxx/test/libcxx/memory/allocator_void.trivial.compile.pass.cpp deleted file mode 100644 index f9d67c065de8..000000000000 --- a/libcxx/test/libcxx/memory/allocator_void.trivial.compile.pass.cpp +++ /dev/null @@ -1,34 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// Make sure that std::allocator is trivial. This was the case before C++20 -// with the std::allocator explicit specialization, and this test makes sure -// that we maintain that property across all standards. -// -// This is important since triviality has implications on how the type is passed -// as a function argument in the ABI. - -#include -#include - -typedef std::allocator A1; -typedef std::allocator A2; -struct A3 : std::allocator { }; -struct A4 : std::allocator { }; - -static_assert(std::is_trivially_default_constructible::value, ""); -static_assert(std::is_trivial::value, ""); - -static_assert(std::is_trivially_default_constructible::value, ""); -static_assert(std::is_trivial::value, ""); - -static_assert(std::is_trivially_default_constructible::value, ""); -static_assert(std::is_trivial::value, ""); - -static_assert(std::is_trivially_default_constructible::value, ""); -static_assert(std::is_trivial::value, ""); diff --git a/libcxx/test/libcxx/memory/trivial_abi/unique_ptr_ret.pass.cpp b/libcxx/test/libcxx/memory/trivial_abi/unique_ptr_ret.pass.cpp index 5cda71371fa6..73fe18becc3a 100644 --- a/libcxx/test/libcxx/memory/trivial_abi/unique_ptr_ret.pass.cpp +++ b/libcxx/test/libcxx/memory/trivial_abi/unique_ptr_ret.pass.cpp @@ -46,11 +46,7 @@ int main(int, char**) { // // With trivial_abi, local_addr is the address of a local variable in // make_val, and hence different from &ret. -#if !defined(__i386__) - // On X86, structs are never returned in registers. - // Thus, unique_ptr will be passed indirectly even if it is trivial. assert((void*)&ret != local_addr); -#endif return 0; } diff --git a/libcxx/test/libcxx/memory/trivial_abi/weak_ptr_ret.pass.cpp b/libcxx/test/libcxx/memory/trivial_abi/weak_ptr_ret.pass.cpp index 9b4e95e249e2..e69c94506f2a 100644 --- a/libcxx/test/libcxx/memory/trivial_abi/weak_ptr_ret.pass.cpp +++ b/libcxx/test/libcxx/memory/trivial_abi/weak_ptr_ret.pass.cpp @@ -49,10 +49,9 @@ int main(int, char**) { // // With trivial_abi, local_addr is the address of a local variable in // make_val, and hence different from &ret. -#if !defined(__i386__) && !defined(__arm__) - // On X86, structs are never returned in registers. +#ifndef __arm__ // On ARM32, structs larger than 4 bytes cannot be returned in registers. - // Thus, weak_ptr will be passed indirectly even if it is trivial. + // Thus, weak_ptr will be passed indrectly even if it is trivial. assert((void*)&ret != local_addr); #endif return 0; diff --git a/libcxx/test/std/experimental/language.support/support.coroutines/end.to.end/expected.pass.cpp b/libcxx/test/std/experimental/language.support/support.coroutines/end.to.end/expected.pass.cpp index 5b307508abeb..2bd297660c4e 100644 --- a/libcxx/test/std/experimental/language.support/support.coroutines/end.to.end/expected.pass.cpp +++ b/libcxx/test/std/experimental/language.support/support.coroutines/end.to.end/expected.pass.cpp @@ -35,7 +35,7 @@ struct expected { struct promise_type { std::shared_ptr data; - expected get_return_object() { data = std::make_shared(); return {data}; } + std::shared_ptr get_return_object() { data = std::make_shared(); return data; } suspend_never initial_suspend() { return {}; } suspend_never final_suspend() noexcept { return {}; } void return_value(T v) { data->val = v; data->error = {}; } diff --git a/libcxx/test/std/input.output/filesystems/fs.req.macros/feature_macro.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.req.macros/feature_macro.pass.cpp new file mode 100644 index 000000000000..6b7052b2403d --- /dev/null +++ b/libcxx/test/std/input.output/filesystems/fs.req.macros/feature_macro.pass.cpp @@ -0,0 +1,30 @@ +//===----------------------------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +// + +// #define __cpp_lib_filesystem 201703L + +#include +#include "test_macros.h" + +#if TEST_STD_VER >= 17 +#ifndef __cpp_lib_filesystem +#error Filesystem feature test macro is not defined (__cpp_lib_filesystem) +#elif __cpp_lib_filesystem != 201703L +#error Filesystem feature test macro has an incorrect value (__cpp_lib_filesystem) +#endif +#else // TEST_STD_VER < 17 +#ifdef __cpp_lib_filesystem +#error Filesystem feature test macro should not be defined before C++17 +#endif +#endif + +int main(int, char**) { + return 0; +} diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/atomic.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/atomic.version.pass.cpp index c8a837115ade..b964e0c6921e 100644 --- a/libcxx/test/std/language.support/support.limits/support.limits.general/atomic.version.pass.cpp +++ b/libcxx/test/std/language.support/support.limits/support.limits.general/atomic.version.pass.cpp @@ -248,7 +248,7 @@ # endif # endif -# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_atomic_wait) +# if !defined(_LIBCPP_HAS_NO_THREADS) # ifndef __cpp_lib_atomic_wait # error "__cpp_lib_atomic_wait should be defined in c++20" # endif @@ -257,7 +257,7 @@ # endif # else # ifdef __cpp_lib_atomic_wait -# error "__cpp_lib_atomic_wait should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_atomic_wait) is not defined!" +# error "__cpp_lib_atomic_wait should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!" # endif # endif @@ -367,7 +367,7 @@ # endif # endif -# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_atomic_wait) +# if !defined(_LIBCPP_HAS_NO_THREADS) # ifndef __cpp_lib_atomic_wait # error "__cpp_lib_atomic_wait should be defined in c++2b" # endif @@ -376,7 +376,7 @@ # endif # else # ifdef __cpp_lib_atomic_wait -# error "__cpp_lib_atomic_wait should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_atomic_wait) is not defined!" +# error "__cpp_lib_atomic_wait should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!" # endif # endif diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/barrier.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/barrier.version.pass.cpp index 80f7d9ca24b4..b193095403e9 100644 --- a/libcxx/test/std/language.support/support.limits/support.limits.general/barrier.version.pass.cpp +++ b/libcxx/test/std/language.support/support.limits/support.limits.general/barrier.version.pass.cpp @@ -44,7 +44,7 @@ #elif TEST_STD_VER == 20 -# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_barrier) +# if !defined(_LIBCPP_HAS_NO_THREADS) # ifndef __cpp_lib_barrier # error "__cpp_lib_barrier should be defined in c++20" # endif @@ -53,13 +53,13 @@ # endif # else # ifdef __cpp_lib_barrier -# error "__cpp_lib_barrier should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_barrier) is not defined!" +# error "__cpp_lib_barrier should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!" # endif # endif #elif TEST_STD_VER > 20 -# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_barrier) +# if !defined(_LIBCPP_HAS_NO_THREADS) # ifndef __cpp_lib_barrier # error "__cpp_lib_barrier should be defined in c++2b" # endif @@ -68,7 +68,7 @@ # endif # else # ifdef __cpp_lib_barrier -# error "__cpp_lib_barrier should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_barrier) is not defined!" +# error "__cpp_lib_barrier should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!" # endif # endif diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/filesystem.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/filesystem.version.pass.cpp index c361569cb1d6..6e47bdf3b5fe 100644 --- a/libcxx/test/std/language.support/support.limits/support.limits.general/filesystem.version.pass.cpp +++ b/libcxx/test/std/language.support/support.limits/support.limits.general/filesystem.version.pass.cpp @@ -51,17 +51,11 @@ # error "__cpp_lib_char8_t should not be defined before c++20" # endif -# if !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_filesystem) -# ifndef __cpp_lib_filesystem -# error "__cpp_lib_filesystem should be defined in c++17" -# endif -# if __cpp_lib_filesystem != 201703L -# error "__cpp_lib_filesystem should have the value 201703L in c++17" -# endif -# else -# ifdef __cpp_lib_filesystem -# error "__cpp_lib_filesystem should not be defined when !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_filesystem) is not defined!" -# endif +# ifndef __cpp_lib_filesystem +# error "__cpp_lib_filesystem should be defined in c++17" +# endif +# if __cpp_lib_filesystem != 201703L +# error "__cpp_lib_filesystem should have the value 201703L in c++17" # endif #elif TEST_STD_VER == 20 @@ -79,17 +73,11 @@ # endif # endif -# if !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_filesystem) -# ifndef __cpp_lib_filesystem -# error "__cpp_lib_filesystem should be defined in c++20" -# endif -# if __cpp_lib_filesystem != 201703L -# error "__cpp_lib_filesystem should have the value 201703L in c++20" -# endif -# else -# ifdef __cpp_lib_filesystem -# error "__cpp_lib_filesystem should not be defined when !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_filesystem) is not defined!" -# endif +# ifndef __cpp_lib_filesystem +# error "__cpp_lib_filesystem should be defined in c++20" +# endif +# if __cpp_lib_filesystem != 201703L +# error "__cpp_lib_filesystem should have the value 201703L in c++20" # endif #elif TEST_STD_VER > 20 @@ -107,17 +95,11 @@ # endif # endif -# if !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_filesystem) -# ifndef __cpp_lib_filesystem -# error "__cpp_lib_filesystem should be defined in c++2b" -# endif -# if __cpp_lib_filesystem != 201703L -# error "__cpp_lib_filesystem should have the value 201703L in c++2b" -# endif -# else -# ifdef __cpp_lib_filesystem -# error "__cpp_lib_filesystem should not be defined when !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_filesystem) is not defined!" -# endif +# ifndef __cpp_lib_filesystem +# error "__cpp_lib_filesystem should be defined in c++2b" +# endif +# if __cpp_lib_filesystem != 201703L +# error "__cpp_lib_filesystem should have the value 201703L in c++2b" # endif #endif // TEST_STD_VER > 20 diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/latch.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/latch.version.pass.cpp index 56db3ba66b45..29e8fd617bbf 100644 --- a/libcxx/test/std/language.support/support.limits/support.limits.general/latch.version.pass.cpp +++ b/libcxx/test/std/language.support/support.limits/support.limits.general/latch.version.pass.cpp @@ -44,7 +44,7 @@ #elif TEST_STD_VER == 20 -# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_latch) +# if !defined(_LIBCPP_HAS_NO_THREADS) # ifndef __cpp_lib_latch # error "__cpp_lib_latch should be defined in c++20" # endif @@ -53,13 +53,13 @@ # endif # else # ifdef __cpp_lib_latch -# error "__cpp_lib_latch should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_latch) is not defined!" +# error "__cpp_lib_latch should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!" # endif # endif #elif TEST_STD_VER > 20 -# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_latch) +# if !defined(_LIBCPP_HAS_NO_THREADS) # ifndef __cpp_lib_latch # error "__cpp_lib_latch should be defined in c++2b" # endif @@ -68,7 +68,7 @@ # endif # else # ifdef __cpp_lib_latch -# error "__cpp_lib_latch should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_latch) is not defined!" +# error "__cpp_lib_latch should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!" # endif # endif diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/semaphore.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/semaphore.version.pass.cpp index 79e31aa06a3f..febeb6f6c615 100644 --- a/libcxx/test/std/language.support/support.limits/support.limits.general/semaphore.version.pass.cpp +++ b/libcxx/test/std/language.support/support.limits/support.limits.general/semaphore.version.pass.cpp @@ -44,7 +44,7 @@ #elif TEST_STD_VER == 20 -# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_semaphore) +# if !defined(_LIBCPP_HAS_NO_THREADS) # ifndef __cpp_lib_semaphore # error "__cpp_lib_semaphore should be defined in c++20" # endif @@ -53,13 +53,13 @@ # endif # else # ifdef __cpp_lib_semaphore -# error "__cpp_lib_semaphore should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_semaphore) is not defined!" +# error "__cpp_lib_semaphore should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!" # endif # endif #elif TEST_STD_VER > 20 -# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_semaphore) +# if !defined(_LIBCPP_HAS_NO_THREADS) # ifndef __cpp_lib_semaphore # error "__cpp_lib_semaphore should be defined in c++2b" # endif @@ -68,7 +68,7 @@ # endif # else # ifdef __cpp_lib_semaphore -# error "__cpp_lib_semaphore should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_semaphore) is not defined!" +# error "__cpp_lib_semaphore should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!" # endif # endif diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/shared_mutex.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/shared_mutex.version.pass.cpp index d26a453f83c3..953fd0a37790 100644 --- a/libcxx/test/std/language.support/support.limits/support.limits.general/shared_mutex.version.pass.cpp +++ b/libcxx/test/std/language.support/support.limits/support.limits.general/shared_mutex.version.pass.cpp @@ -41,7 +41,7 @@ # error "__cpp_lib_shared_mutex should not be defined before c++17" # endif -# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_timed_mutex) +# if !defined(_LIBCPP_HAS_NO_THREADS) # ifndef __cpp_lib_shared_timed_mutex # error "__cpp_lib_shared_timed_mutex should be defined in c++14" # endif @@ -50,13 +50,13 @@ # endif # else # ifdef __cpp_lib_shared_timed_mutex -# error "__cpp_lib_shared_timed_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_timed_mutex) is not defined!" +# error "__cpp_lib_shared_timed_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!" # endif # endif #elif TEST_STD_VER == 17 -# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_mutex) +# if !defined(_LIBCPP_HAS_NO_THREADS) # ifndef __cpp_lib_shared_mutex # error "__cpp_lib_shared_mutex should be defined in c++17" # endif @@ -65,11 +65,11 @@ # endif # else # ifdef __cpp_lib_shared_mutex -# error "__cpp_lib_shared_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_mutex) is not defined!" +# error "__cpp_lib_shared_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!" # endif # endif -# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_timed_mutex) +# if !defined(_LIBCPP_HAS_NO_THREADS) # ifndef __cpp_lib_shared_timed_mutex # error "__cpp_lib_shared_timed_mutex should be defined in c++17" # endif @@ -78,13 +78,13 @@ # endif # else # ifdef __cpp_lib_shared_timed_mutex -# error "__cpp_lib_shared_timed_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_timed_mutex) is not defined!" +# error "__cpp_lib_shared_timed_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!" # endif # endif #elif TEST_STD_VER == 20 -# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_mutex) +# if !defined(_LIBCPP_HAS_NO_THREADS) # ifndef __cpp_lib_shared_mutex # error "__cpp_lib_shared_mutex should be defined in c++20" # endif @@ -93,11 +93,11 @@ # endif # else # ifdef __cpp_lib_shared_mutex -# error "__cpp_lib_shared_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_mutex) is not defined!" +# error "__cpp_lib_shared_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!" # endif # endif -# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_timed_mutex) +# if !defined(_LIBCPP_HAS_NO_THREADS) # ifndef __cpp_lib_shared_timed_mutex # error "__cpp_lib_shared_timed_mutex should be defined in c++20" # endif @@ -106,13 +106,13 @@ # endif # else # ifdef __cpp_lib_shared_timed_mutex -# error "__cpp_lib_shared_timed_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_timed_mutex) is not defined!" +# error "__cpp_lib_shared_timed_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!" # endif # endif #elif TEST_STD_VER > 20 -# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_mutex) +# if !defined(_LIBCPP_HAS_NO_THREADS) # ifndef __cpp_lib_shared_mutex # error "__cpp_lib_shared_mutex should be defined in c++2b" # endif @@ -121,11 +121,11 @@ # endif # else # ifdef __cpp_lib_shared_mutex -# error "__cpp_lib_shared_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_mutex) is not defined!" +# error "__cpp_lib_shared_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!" # endif # endif -# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_timed_mutex) +# if !defined(_LIBCPP_HAS_NO_THREADS) # ifndef __cpp_lib_shared_timed_mutex # error "__cpp_lib_shared_timed_mutex should be defined in c++2b" # endif @@ -134,7 +134,7 @@ # endif # else # ifdef __cpp_lib_shared_timed_mutex -# error "__cpp_lib_shared_timed_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_timed_mutex) is not defined!" +# error "__cpp_lib_shared_timed_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!" # endif # endif diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.pass.cpp index 1de99be54e30..9e96e2e116e0 100644 --- a/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.pass.cpp +++ b/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.pass.cpp @@ -1133,7 +1133,7 @@ # error "__cpp_lib_shared_ptr_weak_type should not be defined before c++17" # endif -# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_timed_mutex) +# if !defined(_LIBCPP_HAS_NO_THREADS) # ifndef __cpp_lib_shared_timed_mutex # error "__cpp_lib_shared_timed_mutex should be defined in c++14" # endif @@ -1142,7 +1142,7 @@ # endif # else # ifdef __cpp_lib_shared_timed_mutex -# error "__cpp_lib_shared_timed_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_timed_mutex) is not defined!" +# error "__cpp_lib_shared_timed_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!" # endif # endif @@ -1534,17 +1534,11 @@ # endif # endif -# if !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_filesystem) -# ifndef __cpp_lib_filesystem -# error "__cpp_lib_filesystem should be defined in c++17" -# endif -# if __cpp_lib_filesystem != 201703L -# error "__cpp_lib_filesystem should have the value 201703L in c++17" -# endif -# else -# ifdef __cpp_lib_filesystem -# error "__cpp_lib_filesystem should not be defined when !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_filesystem) is not defined!" -# endif +# ifndef __cpp_lib_filesystem +# error "__cpp_lib_filesystem should be defined in c++17" +# endif +# if __cpp_lib_filesystem != 201703L +# error "__cpp_lib_filesystem should have the value 201703L in c++17" # endif # ifndef __cpp_lib_gcd_lcm @@ -1889,7 +1883,7 @@ # error "__cpp_lib_semaphore should not be defined before c++20" # endif -# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_mutex) +# if !defined(_LIBCPP_HAS_NO_THREADS) # ifndef __cpp_lib_shared_mutex # error "__cpp_lib_shared_mutex should be defined in c++17" # endif @@ -1898,7 +1892,7 @@ # endif # else # ifdef __cpp_lib_shared_mutex -# error "__cpp_lib_shared_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_mutex) is not defined!" +# error "__cpp_lib_shared_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!" # endif # endif @@ -1916,7 +1910,7 @@ # error "__cpp_lib_shared_ptr_weak_type should have the value 201606L in c++17" # endif -# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_timed_mutex) +# if !defined(_LIBCPP_HAS_NO_THREADS) # ifndef __cpp_lib_shared_timed_mutex # error "__cpp_lib_shared_timed_mutex should be defined in c++17" # endif @@ -1925,7 +1919,7 @@ # endif # else # ifdef __cpp_lib_shared_timed_mutex -# error "__cpp_lib_shared_timed_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_timed_mutex) is not defined!" +# error "__cpp_lib_shared_timed_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!" # endif # endif @@ -2229,7 +2223,7 @@ # endif # endif -# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_atomic_wait) +# if !defined(_LIBCPP_HAS_NO_THREADS) # ifndef __cpp_lib_atomic_wait # error "__cpp_lib_atomic_wait should be defined in c++20" # endif @@ -2238,11 +2232,11 @@ # endif # else # ifdef __cpp_lib_atomic_wait -# error "__cpp_lib_atomic_wait should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_atomic_wait) is not defined!" +# error "__cpp_lib_atomic_wait should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!" # endif # endif -# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_barrier) +# if !defined(_LIBCPP_HAS_NO_THREADS) # ifndef __cpp_lib_barrier # error "__cpp_lib_barrier should be defined in c++20" # endif @@ -2251,7 +2245,7 @@ # endif # else # ifdef __cpp_lib_barrier -# error "__cpp_lib_barrier should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_barrier) is not defined!" +# error "__cpp_lib_barrier should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!" # endif # endif @@ -2581,17 +2575,11 @@ # endif # endif -# if !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_filesystem) -# ifndef __cpp_lib_filesystem -# error "__cpp_lib_filesystem should be defined in c++20" -# endif -# if __cpp_lib_filesystem != 201703L -# error "__cpp_lib_filesystem should have the value 201703L in c++20" -# endif -# else -# ifdef __cpp_lib_filesystem -# error "__cpp_lib_filesystem should not be defined when !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_filesystem) is not defined!" -# endif +# ifndef __cpp_lib_filesystem +# error "__cpp_lib_filesystem should be defined in c++20" +# endif +# if __cpp_lib_filesystem != 201703L +# error "__cpp_lib_filesystem should have the value 201703L in c++20" # endif # ifndef __cpp_lib_gcd_lcm @@ -2807,7 +2795,7 @@ # endif # endif -# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_latch) +# if !defined(_LIBCPP_HAS_NO_THREADS) # ifndef __cpp_lib_latch # error "__cpp_lib_latch should be defined in c++20" # endif @@ -2816,7 +2804,7 @@ # endif # else # ifdef __cpp_lib_latch -# error "__cpp_lib_latch should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_latch) is not defined!" +# error "__cpp_lib_latch should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!" # endif # endif @@ -3031,7 +3019,7 @@ # error "__cpp_lib_scoped_lock should have the value 201703L in c++20" # endif -# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_semaphore) +# if !defined(_LIBCPP_HAS_NO_THREADS) # ifndef __cpp_lib_semaphore # error "__cpp_lib_semaphore should be defined in c++20" # endif @@ -3040,11 +3028,11 @@ # endif # else # ifdef __cpp_lib_semaphore -# error "__cpp_lib_semaphore should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_semaphore) is not defined!" +# error "__cpp_lib_semaphore should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!" # endif # endif -# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_mutex) +# if !defined(_LIBCPP_HAS_NO_THREADS) # ifndef __cpp_lib_shared_mutex # error "__cpp_lib_shared_mutex should be defined in c++20" # endif @@ -3053,7 +3041,7 @@ # endif # else # ifdef __cpp_lib_shared_mutex -# error "__cpp_lib_shared_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_mutex) is not defined!" +# error "__cpp_lib_shared_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!" # endif # endif @@ -3071,7 +3059,7 @@ # error "__cpp_lib_shared_ptr_weak_type should have the value 201606L in c++20" # endif -# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_timed_mutex) +# if !defined(_LIBCPP_HAS_NO_THREADS) # ifndef __cpp_lib_shared_timed_mutex # error "__cpp_lib_shared_timed_mutex should be defined in c++20" # endif @@ -3080,7 +3068,7 @@ # endif # else # ifdef __cpp_lib_shared_timed_mutex -# error "__cpp_lib_shared_timed_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_timed_mutex) is not defined!" +# error "__cpp_lib_shared_timed_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!" # endif # endif @@ -3441,7 +3429,7 @@ # endif # endif -# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_atomic_wait) +# if !defined(_LIBCPP_HAS_NO_THREADS) # ifndef __cpp_lib_atomic_wait # error "__cpp_lib_atomic_wait should be defined in c++2b" # endif @@ -3450,11 +3438,11 @@ # endif # else # ifdef __cpp_lib_atomic_wait -# error "__cpp_lib_atomic_wait should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_atomic_wait) is not defined!" +# error "__cpp_lib_atomic_wait should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!" # endif # endif -# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_barrier) +# if !defined(_LIBCPP_HAS_NO_THREADS) # ifndef __cpp_lib_barrier # error "__cpp_lib_barrier should be defined in c++2b" # endif @@ -3463,7 +3451,7 @@ # endif # else # ifdef __cpp_lib_barrier -# error "__cpp_lib_barrier should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_barrier) is not defined!" +# error "__cpp_lib_barrier should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!" # endif # endif @@ -3793,17 +3781,11 @@ # endif # endif -# if !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_filesystem) -# ifndef __cpp_lib_filesystem -# error "__cpp_lib_filesystem should be defined in c++2b" -# endif -# if __cpp_lib_filesystem != 201703L -# error "__cpp_lib_filesystem should have the value 201703L in c++2b" -# endif -# else -# ifdef __cpp_lib_filesystem -# error "__cpp_lib_filesystem should not be defined when !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_filesystem) is not defined!" -# endif +# ifndef __cpp_lib_filesystem +# error "__cpp_lib_filesystem should be defined in c++2b" +# endif +# if __cpp_lib_filesystem != 201703L +# error "__cpp_lib_filesystem should have the value 201703L in c++2b" # endif # ifndef __cpp_lib_gcd_lcm @@ -4022,7 +4004,7 @@ # endif # endif -# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_latch) +# if !defined(_LIBCPP_HAS_NO_THREADS) # ifndef __cpp_lib_latch # error "__cpp_lib_latch should be defined in c++2b" # endif @@ -4031,7 +4013,7 @@ # endif # else # ifdef __cpp_lib_latch -# error "__cpp_lib_latch should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_latch) is not defined!" +# error "__cpp_lib_latch should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!" # endif # endif @@ -4246,7 +4228,7 @@ # error "__cpp_lib_scoped_lock should have the value 201703L in c++2b" # endif -# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_semaphore) +# if !defined(_LIBCPP_HAS_NO_THREADS) # ifndef __cpp_lib_semaphore # error "__cpp_lib_semaphore should be defined in c++2b" # endif @@ -4255,11 +4237,11 @@ # endif # else # ifdef __cpp_lib_semaphore -# error "__cpp_lib_semaphore should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_semaphore) is not defined!" +# error "__cpp_lib_semaphore should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!" # endif # endif -# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_mutex) +# if !defined(_LIBCPP_HAS_NO_THREADS) # ifndef __cpp_lib_shared_mutex # error "__cpp_lib_shared_mutex should be defined in c++2b" # endif @@ -4268,7 +4250,7 @@ # endif # else # ifdef __cpp_lib_shared_mutex -# error "__cpp_lib_shared_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_mutex) is not defined!" +# error "__cpp_lib_shared_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!" # endif # endif @@ -4286,7 +4268,7 @@ # error "__cpp_lib_shared_ptr_weak_type should have the value 201606L in c++2b" # endif -# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_timed_mutex) +# if !defined(_LIBCPP_HAS_NO_THREADS) # ifndef __cpp_lib_shared_timed_mutex # error "__cpp_lib_shared_timed_mutex should be defined in c++2b" # endif @@ -4295,7 +4277,7 @@ # endif # else # ifdef __cpp_lib_shared_timed_mutex -# error "__cpp_lib_shared_timed_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_timed_mutex) is not defined!" +# error "__cpp_lib_shared_timed_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!" # endif # endif diff --git a/libcxx/test/std/utilities/memory/default.allocator/allocator.ctor.pass.cpp b/libcxx/test/std/utilities/memory/default.allocator/allocator.ctor.pass.cpp index 6e6ff1f2d134..28bfe41680b6 100644 --- a/libcxx/test/std/utilities/memory/default.allocator/allocator.ctor.pass.cpp +++ b/libcxx/test/std/utilities/memory/default.allocator/allocator.ctor.pass.cpp @@ -7,14 +7,15 @@ //===----------------------------------------------------------------------===// // +// UNSUPPORTED: c++03, c++11, c++14, c++17 // // template // class allocator // { // public: // All of these are constexpr after C++17 -// allocator() noexcept; -// allocator(const allocator&) noexcept; -// template allocator(const allocator&) noexcept; +// constexpr allocator() noexcept; +// constexpr allocator(const allocator&) noexcept; +// template constexpr allocator(const allocator&) noexcept; // ... // }; @@ -23,27 +24,28 @@ #include "test_macros.h" -template -TEST_CONSTEXPR_CXX20 bool test() { - typedef std::allocator A1; - typedef std::allocator A2; - A1 a1; - A1 a1_copy = a1; (void)a1_copy; - A2 a2 = a1; (void)a2; +int main(int, char**) +{ + { + typedef std::allocator AC; + typedef std::allocator AL; - return true; -} + constexpr AC a1; + constexpr AC a2{a1}; + constexpr AL a3{a2}; + (void) a3; + } + { + typedef std::allocator AC; + typedef std::allocator AL; + + constexpr AC a1; + constexpr AC a2{a1}; + constexpr AL a3{a2}; + (void) a3; + } -int main(int, char**) { - test(); - test(); - test(); -#if TEST_STD_VER > 17 - static_assert(test()); - static_assert(test()); - static_assert(test()); -#endif return 0; } diff --git a/libcxx/test/std/utilities/memory/default.allocator/allocator.dtor.pass.cpp b/libcxx/test/std/utilities/memory/default.allocator/allocator.dtor.pass.cpp index a095ca102491..7ae87dd45353 100644 --- a/libcxx/test/std/utilities/memory/default.allocator/allocator.dtor.pass.cpp +++ b/libcxx/test/std/utilities/memory/default.allocator/allocator.dtor.pass.cpp @@ -13,6 +13,7 @@ #include + template constexpr bool test() { std::allocator alloc; @@ -25,13 +26,11 @@ constexpr bool test() { int main(int, char**) { test(); - test(); #ifdef _LIBCPP_VERSION // extension test(); #endif // _LIBCPP_VERSION static_assert(test()); - static_assert(test()); #ifdef _LIBCPP_VERSION // extension static_assert(test()); #endif // _LIBCPP_VERSION diff --git a/libcxx/test/std/utilities/memory/default.allocator/allocator_pointers.pass.cpp b/libcxx/test/std/utilities/memory/default.allocator/allocator_pointers.pass.cpp index 777e5dfc44f5..27e91a650e69 100644 --- a/libcxx/test/std/utilities/memory/default.allocator/allocator_pointers.pass.cpp +++ b/libcxx/test/std/utilities/memory/default.allocator/allocator_pointers.pass.cpp @@ -11,9 +11,9 @@ #include #include -#include "test_macros.h" +// #include -// +#include "test_macros.h" // // template // struct allocator_traits diff --git a/libcxx/test/std/utilities/memory/default.allocator/allocator_types.deprecated_in_cxx17.verify.cpp b/libcxx/test/std/utilities/memory/default.allocator/allocator_types.deprecated_in_cxx17.verify.cpp index 88af53a4eeaa..f09651a81eee 100644 --- a/libcxx/test/std/utilities/memory/default.allocator/allocator_types.deprecated_in_cxx17.verify.cpp +++ b/libcxx/test/std/utilities/memory/default.allocator/allocator_types.deprecated_in_cxx17.verify.cpp @@ -30,27 +30,20 @@ // UNSUPPORTED: clang-6 #include +#include "test_macros.h" -int main(int, char**) { - { - typedef std::allocator::pointer Pointer; // expected-warning {{'pointer' is deprecated}} - typedef std::allocator::const_pointer ConstPointer; // expected-warning {{'const_pointer' is deprecated}} - typedef std::allocator::reference Reference; // expected-warning {{'reference' is deprecated}} - typedef std::allocator::const_reference ConstReference; // expected-warning {{'const_reference' is deprecated}} - typedef std::allocator::rebind::other Rebind; // expected-warning {{'rebind' is deprecated}} - } - { - typedef std::allocator::pointer Pointer; // expected-warning {{'pointer' is deprecated}} - typedef std::allocator::const_pointer ConstPointer; // expected-warning {{'const_pointer' is deprecated}} - typedef std::allocator::reference Reference; // expected-warning {{'reference' is deprecated}} - typedef std::allocator::const_reference ConstReference; // expected-warning {{'const_reference' is deprecated}} - typedef std::allocator::rebind::other Rebind; // expected-warning {{'rebind' is deprecated}} - } - { - typedef std::allocator::pointer Pointer; // expected-warning {{'pointer' is deprecated}} - typedef std::allocator::const_pointer ConstPointer; // expected-warning {{'const_pointer' is deprecated}} - // reference and const_reference are not provided by std::allocator - typedef std::allocator::rebind::other Rebind; // expected-warning {{'rebind' is deprecated}} - } +int main(int, char**) +{ + typedef std::allocator::pointer AP; // expected-warning {{'pointer' is deprecated}} + typedef std::allocator::const_pointer ACP; // expected-warning {{'const_pointer' is deprecated}} + typedef std::allocator::reference AR; // expected-warning {{'reference' is deprecated}} + typedef std::allocator::const_reference ACR; // expected-warning {{'const_reference' is deprecated}} + typedef std::allocator::rebind::other ARO; // expected-warning {{'rebind' is deprecated}} + + typedef std::allocator::pointer AP2; // expected-warning {{'pointer' is deprecated}} + typedef std::allocator::const_pointer ACP2; // expected-warning {{'const_pointer' is deprecated}} + typedef std::allocator::reference AR2; // expected-warning {{'reference' is deprecated}} + typedef std::allocator::const_reference ACR2; // expected-warning {{'const_reference' is deprecated}} + typedef std::allocator::rebind::other ARO2; // expected-warning {{'rebind' is deprecated}} return 0; } diff --git a/libcxx/test/std/utilities/memory/default.allocator/allocator_types.pass.cpp b/libcxx/test/std/utilities/memory/default.allocator/allocator_types.pass.cpp index 74adc6943594..6a034935a30d 100644 --- a/libcxx/test/std/utilities/memory/default.allocator/allocator_types.pass.cpp +++ b/libcxx/test/std/utilities/memory/default.allocator/allocator_types.pass.cpp @@ -18,49 +18,47 @@ // typedef ptrdiff_t difference_type; // typedef T value_type; // -// typedef T* pointer; // deprecated in C++17, removed in C++20 -// typedef T const* const_pointer; // deprecated in C++17, removed in C++20 -// typedef T& reference; // deprecated in C++17, removed in C++20 -// typedef T const& const_reference; // deprecated in C++17, removed in C++20 -// template< class U > struct rebind { typedef allocator other; }; // deprecated in C++17, removed in C++20 -// // typedef true_type propagate_on_container_move_assignment; // typedef true_type is_always_equal; // ... // }; -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS - #include #include #include #include "test_macros.h" -struct U; +template +TEST_CONSTEXPR_CXX20 bool test() +{ + static_assert((std::is_same::size_type, std::size_t>::value), ""); + static_assert((std::is_same::difference_type, std::ptrdiff_t>::value), ""); + static_assert((std::is_same::value_type, T>::value), ""); + static_assert((std::is_same::propagate_on_container_move_assignment, std::true_type>::value), ""); + static_assert((std::is_same::is_always_equal, std::true_type>::value), ""); -template -void test() { - typedef std::allocator Alloc; - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); + std::allocator a; + std::allocator a2 = a; + a2 = a; + std::allocator a3 = a2; + (void)a3; -#if TEST_STD_VER <= 17 - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::other, std::allocator >::value), ""); -#endif + return true; } -int main(int, char**) { - test(); -#ifdef _LIBCPP_VERSION - test(); // extension +int main(int, char**) +{ + test(); +#ifdef _LIBCPP_VERSION // extension + test(); +#endif // _LIBCPP_VERSION + +#if TEST_STD_VER > 17 + static_assert(test()); +#ifdef _LIBCPP_VERSION // extension + static_assert(test()); +#endif // _LIBCPP_VERSION #endif return 0; } diff --git a/libcxx/test/std/utilities/memory/default.allocator/allocator_types.removed_in_cxx20.verify.cpp b/libcxx/test/std/utilities/memory/default.allocator/allocator_types.removed_in_cxx20.verify.cpp index 1d91a022867d..9805accda20a 100644 --- a/libcxx/test/std/utilities/memory/default.allocator/allocator_types.removed_in_cxx20.verify.cpp +++ b/libcxx/test/std/utilities/memory/default.allocator/allocator_types.removed_in_cxx20.verify.cpp @@ -31,17 +31,16 @@ template void check() { - typedef typename std::allocator::pointer AP; // expected-error 3 {{no type named 'pointer'}} - typedef typename std::allocator::const_pointer ACP; // expected-error 3 {{no type named 'const_pointer'}} - typedef typename std::allocator::reference AR; // expected-error 3 {{no type named 'reference'}} - typedef typename std::allocator::const_reference ACR; // expected-error 3 {{no type named 'const_reference'}} - typedef typename std::allocator::template rebind::other ARO; // expected-error 3 {{no member named 'rebind'}} + typedef typename std::allocator::pointer AP; // expected-error 2 {{no type named 'pointer'}} + typedef typename std::allocator::const_pointer ACP; // expected-error 2 {{no type named 'const_pointer'}} + typedef typename std::allocator::reference AR; // expected-error 2 {{no type named 'reference'}} + typedef typename std::allocator::const_reference ACR; // expected-error 2 {{no type named 'const_reference'}} + typedef typename std::allocator::template rebind::other ARO; // expected-error 2 {{no member named 'rebind'}} } int main(int, char**) { check(); check(); - check(); return 0; } diff --git a/libcxx/test/std/utilities/memory/default.allocator/PR50299.compile.pass.cpp b/libcxx/test/std/utilities/memory/default.allocator/allocator_void.deprecated_in_cxx17.verify.cpp similarity index 45% rename from libcxx/test/std/utilities/memory/default.allocator/PR50299.compile.pass.cpp rename to libcxx/test/std/utilities/memory/default.allocator/allocator_void.deprecated_in_cxx17.verify.cpp index 245d3d9d320f..cd98e6364b7e 100644 --- a/libcxx/test/std/utilities/memory/default.allocator/PR50299.compile.pass.cpp +++ b/libcxx/test/std/utilities/memory/default.allocator/allocator_void.deprecated_in_cxx17.verify.cpp @@ -8,13 +8,17 @@ // -// Make sure we can use std::allocator in all Standard modes. While the -// explicit specialization for std::allocator was deprecated, using that -// specialization was neither deprecated nor removed (in C++20 it should simply -// start using the primary template). -// -// See https://llvm.org/PR50299. +// Check that allocator is deprecated in C++17. + +// REQUIRES: c++17 #include +#include "test_macros.h" -std::allocator a; +int main(int, char**) +{ + typedef std::allocator::pointer AP; // expected-warning {{'allocator' is deprecated}} + typedef std::allocator::const_pointer ACP; // expected-warning {{'allocator' is deprecated}} + typedef std::allocator::rebind::other ARO; // expected-warning {{'allocator' is deprecated}} + return 0; +} diff --git a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/unique_ptr_Y.pass.cpp b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/unique_ptr_Y.pass.cpp index f9e1798d8a7a..0096897ee07e 100644 --- a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/unique_ptr_Y.pass.cpp +++ b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/unique_ptr_Y.pass.cpp @@ -41,19 +41,6 @@ struct A int A::count = 0; -template -struct StatefulArrayDeleter { - int state = 0; - - StatefulArrayDeleter(int val = 0) : state(val) {} - StatefulArrayDeleter(StatefulArrayDeleter const&) { assert(false); } - - void operator()(T* ptr) { - assert(state == 42); - delete []ptr; - } -}; - int main(int, char**) { { @@ -125,82 +112,5 @@ int main(int, char**) assert(B::count == 0); assert(A::count == 0); - { - std::unique_ptr ptr(new A[8]); - A* raw_ptr = ptr.get(); - std::shared_ptr p; - p = std::move(ptr); - assert(A::count == 8); - assert(B::count == 8); - assert(p.use_count() == 1); - assert(p.get() == raw_ptr); - assert(ptr.get() == 0); - } - assert(A::count == 0); - assert(B::count == 0); - - { - std::unique_ptr ptr(new A[8]); - A* raw_ptr = ptr.get(); - std::shared_ptr p; - p = std::move(ptr); - assert(A::count == 8); - assert(p.use_count() == 1); - assert(p.get() == raw_ptr); - assert(ptr.get() == 0); - } - assert(A::count == 0); - - { - std::unique_ptr ptr(new int[8]); - std::shared_ptr p; - p = std::move(ptr); - } - -#if TEST_STD_VER > 14 - { - StatefulArrayDeleter d; - std::unique_ptr&> u(new A[4], d); - std::shared_ptr p; - p = std::move(u); - d.state = 42; - assert(A::count == 4); - } - assert(A::count == 0); - assert(B::count == 0); - - { - std::unique_ptr ptr(new A[8]); - A* raw_ptr = ptr.get(); - std::shared_ptr p; - p = std::move(ptr); - assert(A::count == 8); - assert(B::count == 8); - assert(p.use_count() == 1); - assert(p.get() == raw_ptr); - assert(ptr.get() == 0); - } - assert(A::count == 0); - assert(B::count == 0); - - { - std::unique_ptr ptr(new A[8]); - A* raw_ptr = ptr.get(); - std::shared_ptr p; - p = std::move(ptr); - assert(A::count == 8); - assert(p.use_count() == 1); - assert(p.get() == raw_ptr); - assert(ptr.get() == 0); - } - assert(A::count == 0); - - { - std::unique_ptr ptr(new int[8]); - std::shared_ptr p; - p = std::move(ptr); - } -#endif // TEST_STD_VER >= 14 - return 0; } diff --git a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp index ad88a3e8a7df..398c64ee6d74 100644 --- a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp +++ b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp @@ -10,7 +10,7 @@ // -// template shared_ptr(unique_ptr&&r); +// template explicit shared_ptr(unique_ptr&&r); #include #include @@ -69,19 +69,6 @@ struct StatefulDeleter { } }; -template -struct StatefulArrayDeleter { - int state = 0; - - StatefulArrayDeleter(int val = 0) : state(val) {} - StatefulArrayDeleter(StatefulArrayDeleter const&) { assert(false); } - - void operator()(T* ptr) { - assert(state == 42); - delete []ptr; - } -}; - int main(int, char**) { { @@ -148,76 +135,5 @@ int main(int, char**) std::shared_ptr s = std::move(u); } - assert(A::count == 0); - { - std::unique_ptr ptr(new A[8]); - A* raw_ptr = ptr.get(); - std::shared_ptr p(std::move(ptr)); - assert(A::count == 8); - assert(B::count == 8); - assert(p.use_count() == 1); - assert(p.get() == raw_ptr); - assert(ptr.get() == 0); - } - assert(A::count == 0); - assert(B::count == 0); - - { - std::unique_ptr ptr(new A[8]); - A* raw_ptr = ptr.get(); - std::shared_ptr p(std::move(ptr)); - assert(A::count == 8); - assert(p.use_count() == 1); - assert(p.get() == raw_ptr); - assert(ptr.get() == 0); - } - assert(A::count == 0); - - { - std::unique_ptr ptr(new int[8]); - std::shared_ptr p(std::move(ptr)); - } - -#if TEST_STD_VER > 14 - { - StatefulArrayDeleter d; - std::unique_ptr&> u(new A[4], d); - std::shared_ptr p(std::move(u)); - d.state = 42; - assert(A::count == 4); - } - assert(A::count == 0); - assert(B::count == 0); - - { - std::unique_ptr ptr(new A[8]); - A* raw_ptr = ptr.get(); - std::shared_ptr p(std::move(ptr)); - assert(A::count == 8); - assert(B::count == 8); - assert(p.use_count() == 1); - assert(p.get() == raw_ptr); - assert(ptr.get() == 0); - } - assert(A::count == 0); - assert(B::count == 0); - - { - std::unique_ptr ptr(new A[8]); - A* raw_ptr = ptr.get(); - std::shared_ptr p(std::move(ptr)); - assert(A::count == 8); - assert(p.use_count() == 1); - assert(p.get() == raw_ptr); - assert(ptr.get() == 0); - } - assert(A::count == 0); - - { - std::unique_ptr ptr(new int[8]); - std::shared_ptr p(std::move(ptr)); - } -#endif // TEST_STD_VER >= 14 - - return 0; + return 0; } diff --git a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/deduct.pass.cpp b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/deduct.pass.cpp index 4951ae22d406..db0958ca6de1 100644 --- a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/deduct.pass.cpp +++ b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/deduct.pass.cpp @@ -13,7 +13,7 @@ // GCC's implementation of class template deduction is still immature and runs // into issues with libc++. However GCC accepts this code when compiling // against libstdc++. -// XFAIL: gcc-5, gcc-6, gcc-7, gcc-8, gcc-9, gcc-10, gcc-11 +// XFAIL: gcc-5, gcc-6, gcc-7 // diff --git a/libcxx/utils/ci/run-buildbot b/libcxx/utils/ci/run-buildbot index d3880816779f..1fb09f3a91aa 100755 --- a/libcxx/utils/ci/run-buildbot +++ b/libcxx/utils/ci/run-buildbot @@ -168,8 +168,8 @@ generic-32bit) check-cxx-cxxabi ;; generic-gcc) - export CC=gcc-10 - export CXX=g++-10 + export CC=gcc + export CXX=g++ clean # FIXME: Re-enable experimental testing on GCC. GCC cares about the order # in which we link -lc++experimental, which causes issues. diff --git a/libcxx/utils/gdb/libcxx/printers.py b/libcxx/utils/gdb/libcxx/printers.py index 9d9a96a3e36f..0ee446f46c51 100644 --- a/libcxx/utils/gdb/libcxx/printers.py +++ b/libcxx/utils/gdb/libcxx/printers.py @@ -13,7 +13,6 @@ and when it is undefined. from __future__ import print_function -import math import re import gdb @@ -142,7 +141,7 @@ class StdTuplePrinter(object): def __next__(self): # child_iter raises StopIteration when appropriate. - field_name = next(self.child_iter) + field_name = self.child_iter.next() child = self.val["__base_"][field_name]["__value_"] self.count += 1 return ("[%d]" % self.count, child) @@ -312,21 +311,12 @@ class StdSharedPointerPrinter(object): return "%s is nullptr" % typename refcount = self.val["__cntrl_"] if refcount != 0: - try: - usecount = refcount["__shared_owners_"] + 1 - weakcount = refcount["__shared_weak_owners_"] - if usecount == 0: - state = "expired, weak %d" % weakcount - else: - state = "count %d, weak %d" % (usecount, weakcount) - except: - # Debug info for a class with virtual functions is emitted - # in the same place as its key function. That means that - # for std::shared_ptr, __shared_owners_ is emitted into - # into libcxx.[so|a] itself, rather than into the shared_ptr - # instantiation point. So if libcxx.so was built without - # debug info, these fields will be missing. - state = "count ?, weak ? (libc++ missing debug info)" + usecount = refcount["__shared_owners_"] + 1 + weakcount = refcount["__shared_weak_owners_"] + if usecount == 0: + state = "expired, weak %d" % weakcount + else: + state = "count %d, weak %d" % (usecount, weakcount) return "%s<%s> %s containing" % (typename, pointee_type, state) def __iter__(self): @@ -435,7 +425,6 @@ class StdBitsetPrinter(object): self.val = val self.n_words = int(self.val["__n_words"]) self.bits_per_word = int(self.val["__bits_per_word"]) - self.bit_count = self.val.type.template_argument(0) if self.n_words == 1: self.values = [int(self.val["__first_"])] else: @@ -446,12 +435,21 @@ class StdBitsetPrinter(object): typename = _prettify_typename(self.val.type) return "%s" % typename + def _byte_it(self, value): + index = -1 + while value: + index += 1 + will_yield = value % 2 + value /= 2 + if will_yield: + yield index + def _list_it(self): - for bit in range(self.bit_count): - word = math.floor(bit / self.bits_per_word) - word_bit = bit % self.bits_per_word - if self.values[word] & (1 << word_bit): - yield ("[%d]" % bit, 1) + for word_index in range(self.n_words): + current = self.values[word_index] + if current: + for n in self._byte_it(current): + yield ("[%d]" % (word_index * self.bits_per_word + n), 1) def __iter__(self): return self._list_it() diff --git a/libcxx/utils/generate_feature_test_macro_components.py b/libcxx/utils/generate_feature_test_macro_components.py index 342e15691eb9..00de15dae24a 100755 --- a/libcxx/utils/generate_feature_test_macro_components.py +++ b/libcxx/utils/generate_feature_test_macro_components.py @@ -111,14 +111,14 @@ feature_test_macros = [ add_version_header(x) for x in [ "name": "__cpp_lib_atomic_wait", "values": { "c++20": 201907 }, "headers": ["atomic"], - "depends": "!defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_atomic_wait)", - "internal_depends": "!defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_atomic_wait)", + "depends": "!defined(_LIBCPP_HAS_NO_THREADS)", + "internal_depends": "!defined(_LIBCPP_HAS_NO_THREADS)", }, { "name": "__cpp_lib_barrier", "values": { "c++20": 201907 }, "headers": ["barrier"], - "depends": "!defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_barrier)", - "internal_depends": "!defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_barrier)", + "depends": "!defined(_LIBCPP_HAS_NO_THREADS)", + "internal_depends": "!defined(_LIBCPP_HAS_NO_THREADS)", }, { "name": "__cpp_lib_bind_front", "values": { "c++20": 201907 }, @@ -270,8 +270,6 @@ feature_test_macros = [ add_version_header(x) for x in [ "name": "__cpp_lib_filesystem", "values": { "c++17": 201703 }, "headers": ["filesystem"], - "depends": "!defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_filesystem)", - "internal_depends": "!defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_filesystem)" }, { "name": "__cpp_lib_gcd_lcm", "values": { "c++17": 201606 }, @@ -385,8 +383,8 @@ feature_test_macros = [ add_version_header(x) for x in [ "name": "__cpp_lib_latch", "values": { "c++20": 201907 }, "headers": ["latch"], - "depends": "!defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_latch)", - "internal_depends": "!defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_latch)", + "depends": "!defined(_LIBCPP_HAS_NO_THREADS)", + "internal_depends": "!defined(_LIBCPP_HAS_NO_THREADS)", }, { "name": "__cpp_lib_launder", "values": { "c++17": 201606 }, @@ -498,14 +496,14 @@ feature_test_macros = [ add_version_header(x) for x in [ "name": "__cpp_lib_semaphore", "values": { "c++20": 201907 }, "headers": ["semaphore"], - "depends": "!defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_semaphore)", - "internal_depends": "!defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_semaphore)", + "depends": "!defined(_LIBCPP_HAS_NO_THREADS)", + "internal_depends": "!defined(_LIBCPP_HAS_NO_THREADS)", }, { "name": "__cpp_lib_shared_mutex", "values": { "c++17": 201505 }, "headers": ["shared_mutex"], - "depends": "!defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_mutex)", - "internal_depends": "!defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_mutex)", + "depends": "!defined(_LIBCPP_HAS_NO_THREADS)", + "internal_depends": "!defined(_LIBCPP_HAS_NO_THREADS)", }, { "name": "__cpp_lib_shared_ptr_arrays", "values": { "c++17": 201611 }, @@ -518,8 +516,8 @@ feature_test_macros = [ add_version_header(x) for x in [ "name": "__cpp_lib_shared_timed_mutex", "values": { "c++14": 201402 }, "headers": ["shared_mutex"], - "depends": "!defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_timed_mutex)", - "internal_depends": "!defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_timed_mutex)", + "depends": "!defined(_LIBCPP_HAS_NO_THREADS)", + "internal_depends": "!defined(_LIBCPP_HAS_NO_THREADS)", }, { "name": "__cpp_lib_shift", "values": { "c++20": 201806 }, diff --git a/libcxxabi/CMakeLists.txt b/libcxxabi/CMakeLists.txt index 981d0c583485..b803347c2a8e 100644 --- a/libcxxabi/CMakeLists.txt +++ b/libcxxabi/CMakeLists.txt @@ -28,7 +28,7 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR LIBCXXABI_STANDALONE_B project(libcxxabi CXX C) set(PACKAGE_NAME libcxxabi) - set(PACKAGE_VERSION 12.0.1) + set(PACKAGE_VERSION 11.0.0git) set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") set(PACKAGE_BUGREPORT "llvm-bugs@lists.llvm.org") @@ -179,15 +179,8 @@ set(CMAKE_MODULE_PATH ) if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE) - if(OHOS) - set(LIBCXXABI_LIBRARY_DIR - ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++/${LLVM_TARGET_MULTILIB_SUFFIX}) - set(LIBCXXABI_INSTALL_LIBRARY_DIR - lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++/${LLVM_TARGET_MULTILIB_SUFFIX}) - else() - set(LIBCXXABI_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++) - set(LIBCXXABI_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++) - endif() + set(LIBCXXABI_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++) + set(LIBCXXABI_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++) if(LIBCXX_LIBDIR_SUBDIR) string(APPEND LIBCXXABI_LIBRARY_DIR /${LIBCXXABI_LIBDIR_SUBDIR}) string(APPEND LIBCXXABI_INSTALL_LIBRARY_DIR /${LIBCXXABI_LIBDIR_SUBDIR}) @@ -471,7 +464,7 @@ if (LIBCXXABI_BAREMETAL) add_definitions(-DLIBCXXABI_BAREMETAL) endif() -if (LIBCXXABI_HAS_COMMENT_LIB_PRAGMA AND NOT OHOS) +if (LIBCXXABI_HAS_COMMENT_LIB_PRAGMA) if (LIBCXXABI_HAS_PTHREAD_LIB) add_definitions(-D_LIBCXXABI_LINK_PTHREAD_LIB) endif() diff --git a/libcxxabi/src/abort_message.cpp b/libcxxabi/src/abort_message.cpp index e2a53cc70878..ad44063facb7 100644 --- a/libcxxabi/src/abort_message.cpp +++ b/libcxxabi/src/abort_message.cpp @@ -11,7 +11,7 @@ #include #include "abort_message.h" -#if defined(__BIONIC__) && !defined(__OHOS__) +#ifdef __BIONIC__ # include # if __ANDROID_API__ >= 21 # include @@ -52,7 +52,7 @@ void abort_message(const char* format, ...) va_end(list); CRSetCrashLogMessage(buffer); -#elif defined(__BIONIC__) && !defined(__OHOS__) +#elif defined(__BIONIC__) char* buffer; va_list list; va_start(list, format); diff --git a/libcxxabi/src/demangle/ItaniumDemangle.h b/libcxxabi/src/demangle/ItaniumDemangle.h index e5fca98f9271..6bfc02d15379 100644 --- a/libcxxabi/src/demangle/ItaniumDemangle.h +++ b/libcxxabi/src/demangle/ItaniumDemangle.h @@ -96,6 +96,7 @@ X(InitListExpr) \ X(FoldExpr) \ X(ThrowExpr) \ + X(UUIDOfExpr) \ X(BoolExpr) \ X(StringLiteral) \ X(LambdaExpr) \ @@ -2034,6 +2035,21 @@ public: } }; +// MSVC __uuidof extension, generated by clang in -fms-extensions mode. +class UUIDOfExpr : public Node { + Node *Operand; +public: + UUIDOfExpr(Node *Operand_) : Node(KUUIDOfExpr), Operand(Operand_) {} + + template void match(Fn F) const { F(Operand); } + + void printLeft(OutputStream &S) const override { + S << "__uuidof("; + Operand->print(S); + S << ")"; + } +}; + class BoolExpr : public Node { bool Value; @@ -4997,43 +5013,6 @@ Node *AbstractManglingParser::parseExpr() { } } return nullptr; - case 'u': { - ++First; - Node *Name = getDerived().parseSourceName(/*NameState=*/nullptr); - if (!Name) - return nullptr; - // Special case legacy __uuidof mangling. The 't' and 'z' appear where the - // standard encoding expects a , and would be otherwise be - // interpreted as node 'short' or 'ellipsis'. However, neither - // __uuidof(short) nor __uuidof(...) can actually appear, so there is no - // actual conflict here. - if (Name->getBaseName() == "__uuidof") { - if (numLeft() < 2) - return nullptr; - if (*First == 't') { - ++First; - Node *Ty = getDerived().parseType(); - if (!Ty) - return nullptr; - return make(Name, makeNodeArray(&Ty, &Ty + 1)); - } - if (*First == 'z') { - ++First; - Node *Ex = getDerived().parseExpr(); - if (!Ex) - return nullptr; - return make(Name, makeNodeArray(&Ex, &Ex + 1)); - } - } - size_t ExprsBegin = Names.size(); - while (!consumeIf('E')) { - Node *E = getDerived().parseTemplateArg(); - if (E == nullptr) - return E; - Names.push_back(E); - } - return make(Name, popTrailingNodeArray(ExprsBegin)); - } case '1': case '2': case '3': @@ -5045,6 +5024,21 @@ Node *AbstractManglingParser::parseExpr() { case '9': return getDerived().parseUnresolvedName(); } + + if (consumeIf("u8__uuidoft")) { + Node *Ty = getDerived().parseType(); + if (!Ty) + return nullptr; + return make(Ty); + } + + if (consumeIf("u8__uuidofz")) { + Node *Ex = getDerived().parseExpr(); + if (!Ex) + return nullptr; + return make(Ex); + } + return nullptr; } diff --git a/libcxxabi/test/test_demangle.pass.cpp b/libcxxabi/test/test_demangle.pass.cpp index 512cc3928fdd..3954fdba048e 100644 --- a/libcxxabi/test/test_demangle.pass.cpp +++ b/libcxxabi/test/test_demangle.pass.cpp @@ -29776,18 +29776,8 @@ const char* cases[][2] = // Vendor extension types are substitution candidates. {"_Z1fu3fooS_", "f(foo, foo)"}, - // alignof with type and expression, and __alignof__ with the same. - {"_Z2f1IiEvDTatT_E", "void f1(decltype(alignof (int)))"}, - {"_Z2f3IiEvDTazcvT_Li0EE", "void f3(decltype(alignof ((int)(0))))"}, - {"_Z2f2IiEvDTu11__alignof__T_EE", "void f2(decltype(__alignof__(int)))"}, - {"_Z2f4IiEvDTu11__alignof__XcvT_Li0EEEE", "void f4(decltype(__alignof__((int)(0))))"}, - - // Legacy nonstandard mangling for __uuidof. - {"_Z15test_uuidofTypeI10TestStructEvDTu8__uuidoftT_E", "void test_uuidofType(decltype(__uuidof(TestStruct)))"}, - {"_Z15test_uuidofExprI9HasMemberEvDTu8__uuidofXsrT_6memberEEE", "void test_uuidofExpr(decltype(__uuidof(HasMember::member)))"}, - // Current __uuidof mangling using vendor extended expression. - {"_Z15test_uuidofTypeI10TestStructEvDTu8__uuidofT_EE", "void test_uuidofType(decltype(__uuidof(TestStruct)))"}, - {"_Z15test_uuidofExprI9HasMemberEvDTu8__uuidofXsrT_6memberEEE", "void test_uuidofExpr(decltype(__uuidof(HasMember::member)))"}, + {"_ZN3FooIXu8__uuidofzdeL_Z3sucEEEC1Ev", "Foo<__uuidof(*(suc))>::Foo()"}, + {"_ZN3FooIXu8__uuidoft13SomeUUIDClassEEC1Ev", "Foo<__uuidof(SomeUUIDClass)>::Foo()"}, // C++2a char8_t: {"_ZTSPDu", "typeinfo name for char8_t*"}, diff --git a/libunwind/CMakeLists.txt b/libunwind/CMakeLists.txt index a9320d965207..8ae32fbccf4e 100644 --- a/libunwind/CMakeLists.txt +++ b/libunwind/CMakeLists.txt @@ -24,7 +24,7 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR LIBUNWIND_STANDALONE_B project(libunwind LANGUAGES C CXX ASM) set(PACKAGE_NAME libunwind) - set(PACKAGE_VERSION 12.0.1) + set(PACKAGE_VERSION 12.0.0git) set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") set(PACKAGE_BUGREPORT "llvm-bugs@lists.llvm.org") @@ -114,15 +114,8 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}) if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE) - if(OHOS) - set(LIBUNWIND_LIBRARY_DIR - ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE}/${LLVM_TARGET_MULTILIB_SUFFIX}) - set(LIBUNWIND_INSTALL_LIBRARY_DIR - lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}/${LLVM_TARGET_MULTILIB_SUFFIX}) - else() - set(LIBUNWIND_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++) - set(LIBUNWIND_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++) - endif() + set(LIBUNWIND_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++) + set(LIBUNWIND_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++) if(LIBCXX_LIBDIR_SUBDIR) string(APPEND LIBUNWIND_LIBRARY_DIR /${LIBUNWIND_LIBDIR_SUBDIR}) string(APPEND LIBUNWIND_INSTALL_LIBRARY_DIR /${LIBUNWIND_LIBDIR_SUBDIR}) @@ -334,7 +327,7 @@ if (LIBUNWIND_HAS_COMMENT_LIB_PRAGMA) if (LIBUNWIND_HAS_DL_LIB) add_definitions(-D_LIBUNWIND_LINK_DL_LIB) endif() - if (LIBUNWIND_HAS_PTHREAD_LIB AND NOT OHOS) + if (LIBUNWIND_HAS_PTHREAD_LIB) add_definitions(-D_LIBUNWIND_LINK_PTHREAD_LIB) endif() endif() diff --git a/libunwind/include/libunwind.h b/libunwind/include/libunwind.h index ab8e3994d4e1..5bae8d02f799 100644 --- a/libunwind/include/libunwind.h +++ b/libunwind/include/libunwind.h @@ -83,18 +83,6 @@ typedef int unw_regnum_t; typedef uintptr_t unw_word_t; #if defined(__arm__) && !defined(__ARM_DWARF_EH__) typedef uint64_t unw_fpreg_t; -// OHOS_LOCAL begin -#elif defined(_LIBUNWIND_TARGET_MIPS_O32) && defined(__mips_hard_float) -# if __mips_fpr == 0 -typedef uint64_t unw_fpreg_t; -# elif __mips_fpr == 32 -typedef float unw_fpreg_t; -# elif __mips_fpr == 64 -typedef double unw_fpreg_t; -# else -# error "Unknown __mips_fpr value" -# endif -// OHOS_LOCAL end #else typedef double unw_fpreg_t; #endif diff --git a/libunwind/src/AddressSpace.hpp b/libunwind/src/AddressSpace.hpp index 33cf75c77a54..171318ff6370 100644 --- a/libunwind/src/AddressSpace.hpp +++ b/libunwind/src/AddressSpace.hpp @@ -169,17 +169,11 @@ public: memcpy(&val, (void *)addr, sizeof(val)); return val; } - // OHOS_LOCAL begin - unw_fpreg_t getDouble(pint_t addr) { - unw_fpreg_t val; -#if defined(_LIBUNWIND_TARGET_MIPS_O32) - memcpy(&val, (void *)addr, Registers_mips_o32::getFpuRegsSize()); -#else + double getDouble(pint_t addr) { + double val; memcpy(&val, (void *)addr, sizeof(val)); -#endif return val; } - // OHOS_LOCAL end v128 getVector(pint_t addr) { v128 val; memcpy(&val, (void *)addr, sizeof(val)); diff --git a/libunwind/src/DwarfInstructions.hpp b/libunwind/src/DwarfInstructions.hpp index 590c013fb4b8..c39cabe1f783 100644 --- a/libunwind/src/DwarfInstructions.hpp +++ b/libunwind/src/DwarfInstructions.hpp @@ -56,10 +56,8 @@ private: pint_t initialStackValue); static pint_t getSavedRegister(A &addressSpace, const R ®isters, pint_t cfa, const RegisterLocation &savedReg); - // OHOS_LOCAL begin - static unw_fpreg_t getSavedFloatRegister(A &addressSpace, const R ®isters, + static double getSavedFloatRegister(A &addressSpace, const R ®isters, pint_t cfa, const RegisterLocation &savedReg); - // OHOS_LOCAL end static v128 getSavedVectorRegister(A &addressSpace, const R ®isters, pint_t cfa, const RegisterLocation &savedReg); @@ -106,7 +104,7 @@ typename A::pint_t DwarfInstructions::getSavedRegister( } template -unw_fpreg_t DwarfInstructions::getSavedFloatRegister( // OHOS_LOCAL +double DwarfInstructions::getSavedFloatRegister( A &addressSpace, const R ®isters, pint_t cfa, const RegisterLocation &savedReg) { switch (savedReg.location) { diff --git a/libunwind/src/Registers.hpp b/libunwind/src/Registers.hpp index c6434e91ae50..efeaf435591e 100644 --- a/libunwind/src/Registers.hpp +++ b/libunwind/src/Registers.hpp @@ -53,8 +53,8 @@ public: uint32_t getRegister(int num) const; void setRegister(int num, uint32_t value); bool validFloatRegister(int) const { return false; } - unw_fpreg_t getFloatRegister(int num) const; // OHOS_LOCAL - void setFloatRegister(int num, unw_fpreg_t value); // OHOS_LOCAL + double getFloatRegister(int num) const; + void setFloatRegister(int num, double value); bool validVectorRegister(int) const { return false; } v128 getVectorRegister(int num) const; void setVectorRegister(int num, v128 value); @@ -230,11 +230,11 @@ inline const char *Registers_x86::getRegisterName(int regNum) { } } -inline unw_fpreg_t Registers_x86::getFloatRegister(int) const { // OHOS_LOCAL +inline double Registers_x86::getFloatRegister(int) const { _LIBUNWIND_ABORT("no x86 float registers"); } -inline void Registers_x86::setFloatRegister(int, unw_fpreg_t) { // OHOS_LOCAL +inline void Registers_x86::setFloatRegister(int, double) { _LIBUNWIND_ABORT("no x86 float registers"); } @@ -262,8 +262,8 @@ public: uint64_t getRegister(int num) const; void setRegister(int num, uint64_t value); bool validFloatRegister(int) const { return false; } - unw_fpreg_t getFloatRegister(int num) const; // OHOS_LOCAL - void setFloatRegister(int num, unw_fpreg_t value); // OHOS_LOCAL + double getFloatRegister(int num) const; + void setFloatRegister(int num, double value); bool validVectorRegister(int) const; v128 getVectorRegister(int num) const; void setVectorRegister(int num, v128 value); @@ -521,11 +521,11 @@ inline const char *Registers_x86_64::getRegisterName(int regNum) { } } -inline unw_fpreg_t Registers_x86_64::getFloatRegister(int) const { // OHOS_LOCAL +inline double Registers_x86_64::getFloatRegister(int) const { _LIBUNWIND_ABORT("no x86_64 float registers"); } -inline void Registers_x86_64::setFloatRegister(int, unw_fpreg_t) { // OHOS_LOCAL +inline void Registers_x86_64::setFloatRegister(int, double) { _LIBUNWIND_ABORT("no x86_64 float registers"); } @@ -576,8 +576,8 @@ public: uint32_t getRegister(int num) const; void setRegister(int num, uint32_t value); bool validFloatRegister(int num) const; - unw_fpreg_t getFloatRegister(int num) const; // OHOS_LOCAL - void setFloatRegister(int num, unw_fpreg_t value); // OHOS_LOCAL + double getFloatRegister(int num) const; + void setFloatRegister(int num, double value); bool validVectorRegister(int num) const; v128 getVectorRegister(int num) const; void setVectorRegister(int num, v128 value); @@ -958,16 +958,12 @@ inline bool Registers_ppc::validFloatRegister(int regNum) const { return true; } -// OHOS_LOCAL begin -inline unw_fpreg_t Registers_ppc::getFloatRegister(int regNum) const { -// OHOS_LOCAL end +inline double Registers_ppc::getFloatRegister(int regNum) const { assert(validFloatRegister(regNum)); return _floatRegisters.__fpregs[regNum - UNW_PPC_F0]; } -// OHOS_LOCAL begin -inline void Registers_ppc::setFloatRegister(int regNum, unw_fpreg_t value) { -// OHOS_LOCAL end +inline void Registers_ppc::setFloatRegister(int regNum, double value) { assert(validFloatRegister(regNum)); _floatRegisters.__fpregs[regNum - UNW_PPC_F0] = value; } @@ -1146,8 +1142,8 @@ public: uint64_t getRegister(int num) const; void setRegister(int num, uint64_t value); bool validFloatRegister(int num) const; - unw_fpreg_t getFloatRegister(int num) const; // OHOS_LOCAL - void setFloatRegister(int num, unw_fpreg_t value); // OHOS_LOCAL + double getFloatRegister(int num) const; + void setFloatRegister(int num, double value); bool validVectorRegister(int num) const; v128 getVectorRegister(int num) const; void setVectorRegister(int num, v128 value); @@ -1508,16 +1504,12 @@ inline bool Registers_ppc64::validFloatRegister(int regNum) const { return regNum >= UNW_PPC64_F0 && regNum <= UNW_PPC64_F31; } -// OHOS_LOCAL begin -inline unw_fpreg_t Registers_ppc64::getFloatRegister(int regNum) const { -// OHOS_LOCAL end +inline double Registers_ppc64::getFloatRegister(int regNum) const { assert(validFloatRegister(regNum)); return _vectorScalarRegisters[regNum - UNW_PPC64_F0].asfloat.f; } -// OHOS_LOCAL begin -inline void Registers_ppc64::setFloatRegister(int regNum, unw_fpreg_t value) { -// OHOS_LOCAL end +inline void Registers_ppc64::setFloatRegister(int regNum, double value) { assert(validFloatRegister(regNum)); _vectorScalarRegisters[regNum - UNW_PPC64_F0].asfloat.f = value; } @@ -1795,8 +1787,8 @@ public: uint64_t getRegister(int num) const; void setRegister(int num, uint64_t value); bool validFloatRegister(int num) const; - unw_fpreg_t getFloatRegister(int num) const; // OHOS_LOCAL - void setFloatRegister(int num, unw_fpreg_t value); // OHOS_LOCAL + double getFloatRegister(int num) const; + void setFloatRegister(int num, double value); bool validVectorRegister(int num) const; v128 getVectorRegister(int num) const; void setVectorRegister(int num, v128 value); @@ -2034,16 +2026,12 @@ inline bool Registers_arm64::validFloatRegister(int regNum) const { return true; } -// OHOS_LOCAL begin -inline unw_fpreg_t Registers_arm64::getFloatRegister(int regNum) const { -// OHOS_LOCAL end +inline double Registers_arm64::getFloatRegister(int regNum) const { assert(validFloatRegister(regNum)); return _vectorHalfRegisters[regNum - UNW_ARM64_D0]; } -// OHOS_LOCAL begin -inline void Registers_arm64::setFloatRegister(int regNum, unw_fpreg_t value) { -// OHOS_LOCAL end +inline void Registers_arm64::setFloatRegister(int regNum, double value) { assert(validFloatRegister(regNum)); _vectorHalfRegisters[regNum - UNW_ARM64_D0] = value; } @@ -2557,8 +2545,8 @@ public: uint32_t getRegister(int num) const; void setRegister(int num, uint32_t value); bool validFloatRegister(int num) const; - unw_fpreg_t getFloatRegister(int num) const; // OHOS_LOCAL - void setFloatRegister(int num, unw_fpreg_t value); // OHOS_LOCAL + double getFloatRegister(int num) const; + void setFloatRegister(int num, double value); bool validVectorRegister(int num) const; v128 getVectorRegister(int num) const; void setVectorRegister(int num, v128 value); @@ -2646,16 +2634,12 @@ inline bool Registers_or1k::validFloatRegister(int /* regNum */) const { return false; } -// OHOS_LOCAL begin -inline unw_fpreg_t Registers_or1k::getFloatRegister(int /* regNum */) const { -// OHOS_LOCAL end +inline double Registers_or1k::getFloatRegister(int /* regNum */) const { _LIBUNWIND_ABORT("or1k float support not implemented"); } -// OHOS_LOCAL begin inline void Registers_or1k::setFloatRegister(int /* regNum */, - unw_fpreg_t /* value */) { -// OHOS_LOCAL end + double /* value */) { _LIBUNWIND_ABORT("or1k float support not implemented"); } @@ -2747,13 +2731,6 @@ inline const char *Registers_or1k::getRegisterName(int regNum) { #endif // _LIBUNWIND_TARGET_OR1K #if defined(_LIBUNWIND_TARGET_MIPS_O32) - -// OHOS_LOCAL begin -// TODO: check the following for FPU with 32-bit registers: -// - fpxx code works properly -// - fp32 code remains working properly -// OHOS_LOCAL end - /// Registers_mips_o32 holds the register state of a thread in a 32-bit MIPS /// process. class _LIBUNWIND_HIDDEN Registers_mips_o32 { @@ -2765,8 +2742,8 @@ public: uint32_t getRegister(int num) const; void setRegister(int num, uint32_t value); bool validFloatRegister(int num) const; - unw_fpreg_t getFloatRegister(int num) const; // OHOS_LOCAL - void setFloatRegister(int num, unw_fpreg_t value); // OHOS_LOCAL + double getFloatRegister(int num) const; + void setFloatRegister(int num, double value); bool validVectorRegister(int num) const; v128 getVectorRegister(int num) const; void setVectorRegister(int num, v128 value); @@ -2774,11 +2751,6 @@ public: void jumpto(); static int lastDwarfRegNum() { return _LIBUNWIND_HIGHEST_DWARF_REGISTER_MIPS; } static int getArch() { return REGISTERS_MIPS_O32; } - // OHOS_LOCAL begin -#ifdef __mips_hard_float - static uint32_t getFpuRegsSize() { return (areFpuRegs64Bit() ? 8 : 4); } -#endif - // OHOS_LOCAL end uint32_t getSP() const { return _registers.__r[29]; } void setSP(uint32_t value) { _registers.__r[29] = value; } @@ -2791,25 +2763,16 @@ private: uint32_t __pc; uint32_t __hi; uint32_t __lo; - // OHOS_LOCAL begin -#ifdef __mips_hard_float - /// O32 with 32-bit floating point registers only uses half of this - /// space. However, using the same layout for 32-bit vs 64-bit - /// floating point registers results in a single context size for - /// O32 with hard float. - uint32_t __padding; - char __f[32 * 8]; -#endif - // OHOS_LOCAL end }; mips_o32_thread_state_t _registers; #ifdef __mips_hard_float - // OHOS_LOCAL begin - static bool areFpuRegs64Bit(); - char *getFpuRegLocation(int regNum); - const char *getFpuRegLocation(int regNum) const; - // OHOS_LOCAL end + /// O32 with 32-bit floating point registers only uses half of this + /// space. However, using the same layout for 32-bit vs 64-bit + /// floating point registers results in a single context size for + /// O32 with hard float. + uint32_t _padding; + double _floats[32]; #endif }; @@ -2839,7 +2802,10 @@ inline bool Registers_mips_o32::validRegister(int regNum) const { if (regNum == UNW_MIPS_LO) return true; #endif - // OHOS_LOCAL delete code block +#if defined(__mips_hard_float) && __mips_fpr == 32 + if (regNum >= UNW_MIPS_F0 && regNum <= UNW_MIPS_F31) + return true; +#endif // FIXME: DSP accumulator registers, MSA registers return false; } @@ -2847,7 +2813,17 @@ inline bool Registers_mips_o32::validRegister(int regNum) const { inline uint32_t Registers_mips_o32::getRegister(int regNum) const { if (regNum >= UNW_MIPS_R0 && regNum <= UNW_MIPS_R31) return _registers.__r[regNum - UNW_MIPS_R0]; - // OHOS_LOCAL delete code block +#if defined(__mips_hard_float) && __mips_fpr == 32 + if (regNum >= UNW_MIPS_F0 && regNum <= UNW_MIPS_F31) { + uint32_t *p; + + if (regNum % 2 == 0) + p = (uint32_t *)&_floats[regNum - UNW_MIPS_F0]; + else + p = (uint32_t *)&_floats[(regNum - 1) - UNW_MIPS_F0] + 1; + return *p; + } +#endif switch (regNum) { case UNW_REG_IP: @@ -2867,7 +2843,18 @@ inline void Registers_mips_o32::setRegister(int regNum, uint32_t value) { _registers.__r[regNum - UNW_MIPS_R0] = value; return; } - // OHOS_LOCAL delete code block +#if defined(__mips_hard_float) && __mips_fpr == 32 + if (regNum >= UNW_MIPS_F0 && regNum <= UNW_MIPS_F31) { + uint32_t *p; + + if (regNum % 2 == 0) + p = (uint32_t *)&_floats[regNum - UNW_MIPS_F0]; + else + p = (uint32_t *)&_floats[(regNum - 1) - UNW_MIPS_F0] + 1; + *p = value; + return; + } +#endif switch (regNum) { case UNW_REG_IP: @@ -2886,91 +2873,31 @@ inline void Registers_mips_o32::setRegister(int regNum, uint32_t value) { _LIBUNWIND_ABORT("unsupported mips_o32 register"); } -// OHOS_LOCAL begin -#ifdef __mips_hard_float -inline bool Registers_mips_o32::areFpuRegs64Bit() { -#if __mips_fpr == 32 - return false; -#elif __mips_fpr == 64 - return true; -#elif __mips_fpr == 0 - uint32_t fpuID; - asm("cfc1 %0, $0" : "=r"(fpuID)); - constexpr uint32_t MIPS_FPIR_F64 = (1 << 22); - return (fpuID & MIPS_FPIR_F64); -#else -#error "Unknown __mips_fpr value" -#endif -} - -inline const char *Registers_mips_o32::getFpuRegLocation(int regNum) const { - int offset, fpuRegNum = regNum - UNW_MIPS_F0; - if (!areFpuRegs64Bit() && fpuRegNum % 2 == 1) - offset = (fpuRegNum - 1) * 8 + 4; - else - offset = fpuRegNum * 8; - return _registers.__f + offset; -} - -inline char *Registers_mips_o32::getFpuRegLocation(int regNum) { - int offset, fpuRegNum = regNum - UNW_MIPS_F0; - if (!areFpuRegs64Bit() && fpuRegNum % 2 == 1) - offset = (fpuRegNum - 1) * 8 + 4; - else - offset = fpuRegNum * 8; - return _registers.__f + offset; -} -#endif -// OHOS_LOCAL end - inline bool Registers_mips_o32::validFloatRegister(int regNum) const { -// OHOS_LOCAL begin -#if defined(__mips_hard_float) - return (regNum >= UNW_MIPS_F0 && regNum <= UNW_MIPS_F31); +#if defined(__mips_hard_float) && __mips_fpr == 64 + if (regNum >= UNW_MIPS_F0 && regNum <= UNW_MIPS_F31) + return true; #else (void)regNum; - return false; #endif -// OHOS_LOCAL end + return false; } -// OHOS_LOCAL begin -inline unw_fpreg_t Registers_mips_o32::getFloatRegister(int regNum) const { -#if defined(__mips_hard_float) +inline double Registers_mips_o32::getFloatRegister(int regNum) const { +#if defined(__mips_hard_float) && __mips_fpr == 64 assert(validFloatRegister(regNum)); -#if __mips_fpr == 0 - const char *regLocation = getFpuRegLocation(regNum); - unw_fpreg_t regValue = 0; - memcpy(reinterpret_cast(®Value), regLocation, getFpuRegsSize()); - return regValue; -#elif __mips_fpr == 32 || __mips_fpr == 64 - const char *regLocation = getFpuRegLocation(regNum); - return *reinterpret_cast(regLocation); -#else -#error "Unknown __mips_fpr value" -#endif -// OHOS_LOCAL end + return _floats[regNum - UNW_MIPS_F0]; #else (void)regNum; _LIBUNWIND_ABORT("mips_o32 float support not implemented"); #endif } -// OHOS_LOCAL begin inline void Registers_mips_o32::setFloatRegister(int regNum, - unw_fpreg_t value) { -#if defined(__mips_hard_float) + double value) { +#if defined(__mips_hard_float) && __mips_fpr == 64 assert(validFloatRegister(regNum)); -#if __mips_fpr == 0 - char *regLocation = getFpuRegLocation(regNum); - memcpy(regLocation, reinterpret_cast(&value), getFpuRegsSize()); -#elif __mips_fpr == 32 || __mips_fpr == 64 - char *regLocation = getFpuRegLocation(regNum); - *reinterpret_cast(regLocation) = value; -#else -#error "Unknown __mips_fpr value" -#endif -// OHOS_LOCAL end + _floats[regNum - UNW_MIPS_F0] = value; #else (void)regNum; (void)value; @@ -3142,8 +3069,8 @@ public: uint64_t getRegister(int num) const; void setRegister(int num, uint64_t value); bool validFloatRegister(int num) const; - unw_fpreg_t getFloatRegister(int num) const; // OHOS_LOCAL - void setFloatRegister(int num, unw_fpreg_t value); // OHOS_LOCAL + double getFloatRegister(int num) const; + void setFloatRegister(int num, double value); bool validVectorRegister(int num) const; v128 getVectorRegister(int num) const; void setVectorRegister(int num, v128 value); @@ -3163,15 +3090,12 @@ private: uint64_t __pc; uint64_t __hi; uint64_t __lo; - // OHOS_LOCAL begin -#ifdef __mips_hard_float - double __f[32]; -#endif - // OHOS_LOCAL end }; - // OHOS_LOCAL delete code block mips_newabi_thread_state_t _registers; +#ifdef __mips_hard_float + double _floats[32]; +#endif }; inline Registers_mips_newabi::Registers_mips_newabi(const void *registers) { @@ -3254,25 +3178,21 @@ inline bool Registers_mips_newabi::validFloatRegister(int regNum) const { return false; } -// OHOS_LOCAL begin -inline unw_fpreg_t Registers_mips_newabi::getFloatRegister(int regNum) const { -// OHOS_LOCAL end +inline double Registers_mips_newabi::getFloatRegister(int regNum) const { #ifdef __mips_hard_float assert(validFloatRegister(regNum)); - return _registers.__f[regNum - UNW_MIPS_F0]; // OHOS_LOCAL + return _floats[regNum - UNW_MIPS_F0]; #else (void)regNum; _LIBUNWIND_ABORT("mips_newabi float support not implemented"); #endif } -// OHOS_LOCAL begin inline void Registers_mips_newabi::setFloatRegister(int regNum, - unw_fpreg_t value) { -// OHOS_LOCAL end + double value) { #ifdef __mips_hard_float assert(validFloatRegister(regNum)); - _registers.__f[regNum - UNW_MIPS_F0] = value; // OHOS_LOCAL + _floats[regNum - UNW_MIPS_F0] = value; #else (void)regNum; (void)value; @@ -3444,8 +3364,8 @@ public: uint32_t getRegister(int num) const; void setRegister(int num, uint32_t value); bool validFloatRegister(int num) const; - unw_fpreg_t getFloatRegister(int num) const; // OHOS_LOCAL - void setFloatRegister(int num, unw_fpreg_t value); // OHOS_LOCAL + double getFloatRegister(int num) const; + void setFloatRegister(int num, double value); bool validVectorRegister(int num) const; v128 getVectorRegister(int num) const; void setVectorRegister(int num, v128 value); @@ -3523,11 +3443,11 @@ inline void Registers_sparc::setRegister(int regNum, uint32_t value) { inline bool Registers_sparc::validFloatRegister(int) const { return false; } -inline unw_fpreg_t Registers_sparc::getFloatRegister(int) const { // OHOS_LOCAL +inline double Registers_sparc::getFloatRegister(int) const { _LIBUNWIND_ABORT("no Sparc float registers"); } -inline void Registers_sparc::setFloatRegister(int, unw_fpreg_t) { // OHOS_LOCAL +inline void Registers_sparc::setFloatRegister(int, double) { _LIBUNWIND_ABORT("no Sparc float registers"); } @@ -3628,8 +3548,8 @@ public: uint32_t getRegister(int num) const; void setRegister(int num, uint32_t value); bool validFloatRegister(int num) const; - unw_fpreg_t getFloatRegister(int num) const; // OHOS_LOCAL - void setFloatRegister(int num, unw_fpreg_t value); // OHOS_LOCAL + double getFloatRegister(int num) const; + void setFloatRegister(int num, double value); bool validVectorRegister(int num) const; v128 getVectorRegister(int num) const; void setVectorRegister(int num, v128 value); @@ -3702,16 +3622,12 @@ inline bool Registers_hexagon::validFloatRegister(int /* regNum */) const { return false; } -// OHOS_LOCAL begin -inline unw_fpreg_t Registers_hexagon::getFloatRegister(int /* regNum */) const { -// OHOS_LOCAL end +inline double Registers_hexagon::getFloatRegister(int /* regNum */) const { _LIBUNWIND_ABORT("hexagon float support not implemented"); } -// OHOS_LOCAL begin inline void Registers_hexagon::setFloatRegister(int /* regNum */, - unw_fpreg_t /* value */) { -// OHOS_LOCAL end + double /* value */) { _LIBUNWIND_ABORT("hexagon float support not implemented"); } @@ -3813,8 +3729,8 @@ public: uint64_t getRegister(int num) const; void setRegister(int num, uint64_t value); bool validFloatRegister(int num) const; - unw_fpreg_t getFloatRegister(int num) const; // OHOS_LOCAL - void setFloatRegister(int num, unw_fpreg_t value); // OHOS_LOCAL + double getFloatRegister(int num) const; + void setFloatRegister(int num, double value); bool validVectorRegister(int num) const; v128 getVectorRegister(int num) const; void setVectorRegister(int num, v128 value); @@ -4035,9 +3951,7 @@ inline bool Registers_riscv::validFloatRegister(int regNum) const { return true; } -// OHOS_LOCAL begin -inline unw_fpreg_t Registers_riscv::getFloatRegister(int regNum) const { -// OHOS_LOCAL end +inline double Registers_riscv::getFloatRegister(int regNum) const { #if defined(__riscv_flen) && __riscv_flen == 64 assert(validFloatRegister(regNum)); return _floats[regNum - UNW_RISCV_F0]; @@ -4047,9 +3961,7 @@ inline unw_fpreg_t Registers_riscv::getFloatRegister(int regNum) const { #endif } -// OHOS_LOCAL begin -inline void Registers_riscv::setFloatRegister(int regNum, unw_fpreg_t value) { -// OHOS_LOCAL end +inline void Registers_riscv::setFloatRegister(int regNum, double value) { #if defined(__riscv_flen) && __riscv_flen == 64 assert(validFloatRegister(regNum)); _floats[regNum - UNW_RISCV_F0] = value; @@ -4084,8 +3996,8 @@ public: uint64_t getRegister(int num) const; void setRegister(int num, uint64_t value); bool validFloatRegister(int num) const; - unw_fpreg_t getFloatRegister(int num) const; // OHOS_LOCAL - void setFloatRegister(int num, unw_fpreg_t value); // OHOS_LOCAL + double getFloatRegister(int num) const; + void setFloatRegister(int num, double value); bool validVectorRegister(int num) const; v128 getVectorRegister(int num) const; void setVectorRegister(int num, v128 value); @@ -4188,16 +4100,12 @@ inline bool Registers_ve::validFloatRegister(int /* regNum */) const { return false; } -// OHOS_LOCAL begin -inline unw_fpreg_t Registers_ve::getFloatRegister(int /* regNum */) const { -// OHOS_LOCAL end +inline double Registers_ve::getFloatRegister(int /* regNum */) const { _LIBUNWIND_ABORT("VE doesn't have float registers"); } -// OHOS_LOCAL begin inline void Registers_ve::setFloatRegister(int /* regNum */, - unw_fpreg_t /* value */) { -// OHOS_LOCAL end + double /* value */) { _LIBUNWIND_ABORT("VE doesn't have float registers"); } diff --git a/libunwind/src/UnwindRegistersRestore.S b/libunwind/src/UnwindRegistersRestore.S index 45280feafd5d..289afe98b0b2 100644 --- a/libunwind/src/UnwindRegistersRestore.S +++ b/libunwind/src/UnwindRegistersRestore.S @@ -865,7 +865,7 @@ DEFINE_LIBUNWIND_FUNCTION(_ZN9libunwind18Registers_mips_o326jumptoEv) .set noreorder .set nomacro #ifdef __mips_hard_float -#if __mips_fpr == 32 // OHOS_LOCAL +#if __mips_fpr != 64 ldc1 $f0, (4 * 36 + 8 * 0)($4) ldc1 $f2, (4 * 36 + 8 * 2)($4) ldc1 $f4, (4 * 36 + 8 * 4)($4) @@ -882,66 +882,7 @@ DEFINE_LIBUNWIND_FUNCTION(_ZN9libunwind18Registers_mips_o326jumptoEv) ldc1 $f26, (4 * 36 + 8 * 26)($4) ldc1 $f28, (4 * 36 + 8 * 28)($4) ldc1 $f30, (4 * 36 + 8 * 30)($4) -#elif __mips_fpr == 64 // OHOS_LOCAL - ldc1 $f0, (4 * 36 + 8 * 0)($4) - ldc1 $f1, (4 * 36 + 8 * 1)($4) - ldc1 $f2, (4 * 36 + 8 * 2)($4) - ldc1 $f3, (4 * 36 + 8 * 3)($4) - ldc1 $f4, (4 * 36 + 8 * 4)($4) - ldc1 $f5, (4 * 36 + 8 * 5)($4) - ldc1 $f6, (4 * 36 + 8 * 6)($4) - ldc1 $f7, (4 * 36 + 8 * 7)($4) - ldc1 $f8, (4 * 36 + 8 * 8)($4) - ldc1 $f9, (4 * 36 + 8 * 9)($4) - ldc1 $f10, (4 * 36 + 8 * 10)($4) - ldc1 $f11, (4 * 36 + 8 * 11)($4) - ldc1 $f12, (4 * 36 + 8 * 12)($4) - ldc1 $f13, (4 * 36 + 8 * 13)($4) - ldc1 $f14, (4 * 36 + 8 * 14)($4) - ldc1 $f15, (4 * 36 + 8 * 15)($4) - ldc1 $f16, (4 * 36 + 8 * 16)($4) - ldc1 $f17, (4 * 36 + 8 * 17)($4) - ldc1 $f18, (4 * 36 + 8 * 18)($4) - ldc1 $f19, (4 * 36 + 8 * 19)($4) - ldc1 $f20, (4 * 36 + 8 * 20)($4) - ldc1 $f21, (4 * 36 + 8 * 21)($4) - ldc1 $f22, (4 * 36 + 8 * 22)($4) - ldc1 $f23, (4 * 36 + 8 * 23)($4) - ldc1 $f24, (4 * 36 + 8 * 24)($4) - ldc1 $f25, (4 * 36 + 8 * 25)($4) - ldc1 $f26, (4 * 36 + 8 * 26)($4) - ldc1 $f27, (4 * 36 + 8 * 27)($4) - ldc1 $f28, (4 * 36 + 8 * 28)($4) - ldc1 $f29, (4 * 36 + 8 * 29)($4) - ldc1 $f30, (4 * 36 + 8 * 30)($4) - ldc1 $f31, (4 * 36 + 8 * 31)($4) -// OHOS_LOCAL begin -#elif __mips_fpr == 0 - // Check the register size in runtime - // Load the FIR control register value - cfc1 $t0, $0 - // Test F64 bit of the FIR control register - li $t1, 1 - sll $t1, $t1, 22 - and $t0, $t0, $t1 - beq $t0, $0, _fp32 - nop -_fp64: - .set fp=64 - // The order of loads here is important. Even if the F64 bit of the FIR status - // register is set, it only means that the FPU has 64-bit FPRs. But it also - // can operate in 32-bit compatibility mode. We are not able to determine if - // such mode is enable because the corresponding FR bit of the CP0 Status - // register is only available for read in the kernel mode. So, we use the - // following order of loads as a workaround. - // - If FR=0 (32-bit compat mode), double-precision operations have no - // documented behavior. Here we assume that such loads just corrupt the - // corresponding registers and do not raise an exception (which is true for - // QEMU). Since $f_{2k+1} is a higher part of $f_{2k} in FR=0 mode, we need - // to perform operation on the odd register first so it won't corrupt the - // even register value when it's treated as 64-bit. - // - If FR=1 (64-bit native mode), the order does not matter since the - // registers do not overlap. +#else ldc1 $f0, (4 * 36 + 8 * 0)($4) ldc1 $f1, (4 * 36 + 8 * 1)($4) ldc1 $f2, (4 * 36 + 8 * 2)($4) @@ -974,34 +915,8 @@ _fp64: ldc1 $f29, (4 * 36 + 8 * 29)($4) ldc1 $f30, (4 * 36 + 8 * 30)($4) ldc1 $f31, (4 * 36 + 8 * 31)($4) - .set fp=xx - j _after_float - nop -_fp32: - .set fp=32 - ldc1 $f0, (4 * 36 + 8 * 0)($4) - ldc1 $f2, (4 * 36 + 8 * 2)($4) - ldc1 $f4, (4 * 36 + 8 * 4)($4) - ldc1 $f6, (4 * 36 + 8 * 6)($4) - ldc1 $f8, (4 * 36 + 8 * 8)($4) - ldc1 $f10, (4 * 36 + 8 * 10)($4) - ldc1 $f12, (4 * 36 + 8 * 12)($4) - ldc1 $f14, (4 * 36 + 8 * 14)($4) - ldc1 $f16, (4 * 36 + 8 * 16)($4) - ldc1 $f18, (4 * 36 + 8 * 18)($4) - ldc1 $f20, (4 * 36 + 8 * 20)($4) - ldc1 $f22, (4 * 36 + 8 * 22)($4) - ldc1 $f24, (4 * 36 + 8 * 24)($4) - ldc1 $f26, (4 * 36 + 8 * 26)($4) - ldc1 $f28, (4 * 36 + 8 * 28)($4) - ldc1 $f30, (4 * 36 + 8 * 30)($4) - .set fp=xx -#else -#error "Unknown __mips_fpr value" -// OHOS_LOCAL end #endif #endif -_after_float: // OHOS_LOCAL // restore hi and lo lw $8, (4 * 33)($4) mthi $8 diff --git a/libunwind/src/UnwindRegistersSave.S b/libunwind/src/UnwindRegistersSave.S index 95a0d342f749..94fc8365455d 100644 --- a/libunwind/src/UnwindRegistersSave.S +++ b/libunwind/src/UnwindRegistersSave.S @@ -128,9 +128,46 @@ DEFINE_LIBUNWIND_FUNCTION(__unw_getcontext) .set noat .set noreorder .set nomacro -// OHOS_LOCAL move code block + sw $1, (4 * 1)($4) + sw $2, (4 * 2)($4) + sw $3, (4 * 3)($4) + sw $4, (4 * 4)($4) + sw $5, (4 * 5)($4) + sw $6, (4 * 6)($4) + sw $7, (4 * 7)($4) + sw $8, (4 * 8)($4) + sw $9, (4 * 9)($4) + sw $10, (4 * 10)($4) + sw $11, (4 * 11)($4) + sw $12, (4 * 12)($4) + sw $13, (4 * 13)($4) + sw $14, (4 * 14)($4) + sw $15, (4 * 15)($4) + sw $16, (4 * 16)($4) + sw $17, (4 * 17)($4) + sw $18, (4 * 18)($4) + sw $19, (4 * 19)($4) + sw $20, (4 * 20)($4) + sw $21, (4 * 21)($4) + sw $22, (4 * 22)($4) + sw $23, (4 * 23)($4) + sw $24, (4 * 24)($4) + sw $25, (4 * 25)($4) + sw $26, (4 * 26)($4) + sw $27, (4 * 27)($4) + sw $28, (4 * 28)($4) + sw $29, (4 * 29)($4) + sw $30, (4 * 30)($4) + sw $31, (4 * 31)($4) + # Store return address to pc + sw $31, (4 * 32)($4) + # hi and lo + mfhi $8 + sw $8, (4 * 33)($4) + mflo $8 + sw $8, (4 * 34)($4) #ifdef __mips_hard_float -#if __mips_fpr == 32 // OHOS_LOCAL +#if __mips_fpr != 64 sdc1 $f0, (4 * 36 + 8 * 0)($4) sdc1 $f2, (4 * 36 + 8 * 2)($4) sdc1 $f4, (4 * 36 + 8 * 4)($4) @@ -147,52 +184,7 @@ DEFINE_LIBUNWIND_FUNCTION(__unw_getcontext) sdc1 $f26, (4 * 36 + 8 * 26)($4) sdc1 $f28, (4 * 36 + 8 * 28)($4) sdc1 $f30, (4 * 36 + 8 * 30)($4) -#elif __mips_fpr == 64 // OHOS_LOCAL - sdc1 $f0, (4 * 36 + 8 * 0)($4) - sdc1 $f1, (4 * 36 + 8 * 1)($4) - sdc1 $f2, (4 * 36 + 8 * 2)($4) - sdc1 $f3, (4 * 36 + 8 * 3)($4) - sdc1 $f4, (4 * 36 + 8 * 4)($4) - sdc1 $f5, (4 * 36 + 8 * 5)($4) - sdc1 $f6, (4 * 36 + 8 * 6)($4) - sdc1 $f7, (4 * 36 + 8 * 7)($4) - sdc1 $f8, (4 * 36 + 8 * 8)($4) - sdc1 $f9, (4 * 36 + 8 * 9)($4) - sdc1 $f10, (4 * 36 + 8 * 10)($4) - sdc1 $f11, (4 * 36 + 8 * 11)($4) - sdc1 $f12, (4 * 36 + 8 * 12)($4) - sdc1 $f13, (4 * 36 + 8 * 13)($4) - sdc1 $f14, (4 * 36 + 8 * 14)($4) - sdc1 $f15, (4 * 36 + 8 * 15)($4) - sdc1 $f16, (4 * 36 + 8 * 16)($4) - sdc1 $f17, (4 * 36 + 8 * 17)($4) - sdc1 $f18, (4 * 36 + 8 * 18)($4) - sdc1 $f19, (4 * 36 + 8 * 19)($4) - sdc1 $f20, (4 * 36 + 8 * 20)($4) - sdc1 $f21, (4 * 36 + 8 * 21)($4) - sdc1 $f22, (4 * 36 + 8 * 22)($4) - sdc1 $f23, (4 * 36 + 8 * 23)($4) - sdc1 $f24, (4 * 36 + 8 * 24)($4) - sdc1 $f25, (4 * 36 + 8 * 25)($4) - sdc1 $f26, (4 * 36 + 8 * 26)($4) - sdc1 $f27, (4 * 36 + 8 * 27)($4) - sdc1 $f28, (4 * 36 + 8 * 28)($4) - sdc1 $f29, (4 * 36 + 8 * 29)($4) - sdc1 $f30, (4 * 36 + 8 * 30)($4) - sdc1 $f31, (4 * 36 + 8 * 31)($4) -// OHOS_LOCAL begin -#elif __mips_fpr == 0 - // Check the register size in runtime - // Load the FIR control register value - cfc1 $t0, $0 - // Test F64 bit of the FIR control register - li $t1, 1 - sll $t1, $t1, 22 - and $t0, $t0, $t1 - beq $t0, $0, _fp32 - nop -_fp64: - .set fp=64 +#else sdc1 $f0, (4 * 36 + 8 * 0)($4) sdc1 $f1, (4 * 36 + 8 * 1)($4) sdc1 $f2, (4 * 36 + 8 * 2)($4) @@ -225,74 +217,8 @@ _fp64: sdc1 $f29, (4 * 36 + 8 * 29)($4) sdc1 $f30, (4 * 36 + 8 * 30)($4) sdc1 $f31, (4 * 36 + 8 * 31)($4) - .set fp=xx - j _after_float - nop -_fp32: - .set fp=32 - sdc1 $f0, (4 * 36 + 8 * 0)($4) - sdc1 $f2, (4 * 36 + 8 * 2)($4) - sdc1 $f4, (4 * 36 + 8 * 4)($4) - sdc1 $f6, (4 * 36 + 8 * 6)($4) - sdc1 $f8, (4 * 36 + 8 * 8)($4) - sdc1 $f10, (4 * 36 + 8 * 10)($4) - sdc1 $f12, (4 * 36 + 8 * 12)($4) - sdc1 $f14, (4 * 36 + 8 * 14)($4) - sdc1 $f16, (4 * 36 + 8 * 16)($4) - sdc1 $f18, (4 * 36 + 8 * 18)($4) - sdc1 $f20, (4 * 36 + 8 * 20)($4) - sdc1 $f22, (4 * 36 + 8 * 22)($4) - sdc1 $f24, (4 * 36 + 8 * 24)($4) - sdc1 $f26, (4 * 36 + 8 * 26)($4) - sdc1 $f28, (4 * 36 + 8 * 28)($4) - sdc1 $f30, (4 * 36 + 8 * 30)($4) - .set fp=xx -#else -#error "Unknown __mips_fpr value" -// OHOS_LOCAL end #endif #endif -_after_float: // OHOS_LOCAL -// OHOS_LOCAL begin moved code block - sw $1, (4 * 1)($4) - sw $2, (4 * 2)($4) - sw $3, (4 * 3)($4) - sw $4, (4 * 4)($4) - sw $5, (4 * 5)($4) - sw $6, (4 * 6)($4) - sw $7, (4 * 7)($4) - sw $8, (4 * 8)($4) - sw $9, (4 * 9)($4) - sw $10, (4 * 10)($4) - sw $11, (4 * 11)($4) - sw $12, (4 * 12)($4) - sw $13, (4 * 13)($4) - sw $14, (4 * 14)($4) - sw $15, (4 * 15)($4) - sw $16, (4 * 16)($4) - sw $17, (4 * 17)($4) - sw $18, (4 * 18)($4) - sw $19, (4 * 19)($4) - sw $20, (4 * 20)($4) - sw $21, (4 * 21)($4) - sw $22, (4 * 22)($4) - sw $23, (4 * 23)($4) - sw $24, (4 * 24)($4) - sw $25, (4 * 25)($4) - sw $26, (4 * 26)($4) - sw $27, (4 * 27)($4) - sw $28, (4 * 28)($4) - sw $29, (4 * 29)($4) - sw $30, (4 * 30)($4) - sw $31, (4 * 31)($4) - # Store return address to pc - sw $31, (4 * 32)($4) - # hi and lo - mfhi $8 - sw $8, (4 * 33)($4) - mflo $8 - sw $8, (4 * 34)($4) -// OHOS_LOCAL end moved code block jr $31 # return UNW_ESUCCESS or $2, $0, $0 diff --git a/libunwind/src/libunwind.cpp b/libunwind/src/libunwind.cpp index 92936a3aa69c..c21461b1f480 100644 --- a/libunwind/src/libunwind.cpp +++ b/libunwind/src/libunwind.cpp @@ -144,9 +144,7 @@ _LIBUNWIND_WEAK_ALIAS(__unw_get_fpreg, unw_get_fpreg) /// Set value of specified float register at cursor position in stack frame. _LIBUNWIND_HIDDEN int __unw_set_fpreg(unw_cursor_t *cursor, unw_regnum_t regNum, unw_fpreg_t value) { -// OHOS_LOCAL begin -#if defined(_LIBUNWIND_ARM_EHABI) || (defined(__mips__) && __mips_fpr == 0) -// OHOS_LOCAL end +#if defined(_LIBUNWIND_ARM_EHABI) _LIBUNWIND_TRACE_API("__unw_set_fpreg(cursor=%p, regNum=%d, value=%llX)", static_cast(cursor), regNum, value); #else diff --git a/lld/ELF/Config.h b/lld/ELF/Config.h index 39b7ec18cc3f..c84b5f5bdfda 100644 --- a/lld/ELF/Config.h +++ b/lld/ELF/Config.h @@ -263,8 +263,6 @@ struct Configuration { uint64_t zStackSize; unsigned ltoPartitions; unsigned ltoo; - unsigned ltos; - bool mergeFunctions; unsigned optimize; StringRef thinLTOJobs; unsigned timeTraceGranularity; diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp index a41a7d1b8dc4..3b2a8ba19293 100644 --- a/lld/ELF/Driver.cpp +++ b/lld/ELF/Driver.cpp @@ -62,7 +62,6 @@ #include "llvm/Support/raw_ostream.h" #include #include -#include using namespace llvm; using namespace llvm::ELF; @@ -926,48 +925,6 @@ static void parseClangOption(StringRef opt, const Twine &msg) { error(msg + ": " + StringRef(err).trim()); } -static std::pair parseLTOOptArg(opt::InputArgList &args, - unsigned key, - StringRef defaultValue) { - auto *a = args.getLastArg(key); - llvm::StringRef value = a ? a->getValue() : defaultValue; - - unsigned optLevel = 0; - unsigned sizeLevel = 0; - - if (value.size() != 1) { - error("invalid optimization level for LTO: " + value); - return {optLevel, sizeLevel}; - } - - char c = value[0]; - - switch (c) { - - case '0': - case '1': - case '2': - case '3': - optLevel = c - '0'; - break; - - case 's': - optLevel = 2; - sizeLevel = 1; - break; - - case 'z': - optLevel = 2; - sizeLevel = 2; - break; - - default: - error("invalid optimization level for LTO: " + value); - } - - return {optLevel, sizeLevel}; -} - // Initializes Config members by the command line options. static void readConfigs(opt::InputArgList &args) { errorHandler().verbose = args.hasArg(OPT_verbose); @@ -1045,9 +1002,8 @@ static void readConfigs(opt::InputArgList &args) { config->ltoWholeProgramVisibility = args.hasFlag(OPT_lto_whole_program_visibility, OPT_no_lto_whole_program_visibility, false); + config->ltoo = args::getInteger(args, OPT_lto_O, 2); config->ltoObjPath = args.getLastArgValue(OPT_lto_obj_path_eq); - std::tie(config->ltoo, config->ltos) = parseLTOOptArg(args, OPT_lto_O, "2"); - config->mergeFunctions = args.hasArg(OPT_lto_mf); config->ltoPartitions = args::getInteger(args, OPT_lto_partitions, 1); config->ltoPseudoProbeForProfiling = args.hasArg(OPT_lto_pseudo_probe_for_profiling); diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp index 6f16fc7abc48..f40bb258b9af 100644 --- a/lld/ELF/InputSection.cpp +++ b/lld/ELF/InputSection.cpp @@ -901,10 +901,7 @@ void InputSection::relocateNonAlloc(uint8_t *buf, ArrayRef rels) { continue; } - // R_ABS/R_DTPREL and some other relocations can be used from non-SHF_ALLOC - // sections. - if (expr != R_ABS && expr != R_DTPREL && expr != R_GOTPLTREL && - expr != R_RISCV_ADD) { + if (expr != R_ABS && expr != R_DTPREL && expr != R_RISCV_ADD) { std::string msg = getLocation(offset) + ": has non-ABS relocation " + toString(type) + " against symbol '" + toString(sym) + "'"; diff --git a/lld/ELF/LTO.cpp b/lld/ELF/LTO.cpp index 9381509542ad..b3d4b7dee9f8 100644 --- a/lld/ELF/LTO.cpp +++ b/lld/ELF/LTO.cpp @@ -129,8 +129,6 @@ static lto::Config createConfig() { c.DisableVerify = config->disableVerify; c.DiagHandler = diagnosticHandler; c.OptLevel = config->ltoo; - c.SizeLevel = config->ltos; - c.MergeFunctions = config->mergeFunctions; c.CPU = getCPUStr(); c.MAttrs = getMAttrs(); c.CGOptLevel = args::getCGOptLevel(config->ltoo); diff --git a/lld/ELF/Options.td b/lld/ELF/Options.td index e6d77f21d027..65ef3e824f50 100644 --- a/lld/ELF/Options.td +++ b/lld/ELF/Options.td @@ -538,10 +538,6 @@ def lto_newpm_passes: JJ<"lto-newpm-passes=">, HelpText<"Passes to run during LTO">; def lto_O: JJ<"lto-O">, MetaVarName<"">, HelpText<"Optimization level for LTO">; -def lto_S: J<"lto-S">, MetaVarName<"">, - HelpText<"Size Optimization level for LTO, works only with -lto-O2">; -def lto_mf: F<"lto-mf">, - HelpText<"Enable Merge Functions pass for link time optimizations.">; def lto_partitions: JJ<"lto-partitions=">, HelpText<"Number of LTO codegen partitions">; def lto_cs_profile_generate: FF<"lto-cs-profile-generate">, diff --git a/lld/ELF/ScriptParser.cpp b/lld/ELF/ScriptParser.cpp index d2e9f4b90beb..b81812d11821 100644 --- a/lld/ELF/ScriptParser.cpp +++ b/lld/ELF/ScriptParser.cpp @@ -1453,7 +1453,6 @@ unsigned ScriptParser::readPhdrType() { .Case("PT_OPENBSD_RANDOMIZE", PT_OPENBSD_RANDOMIZE) .Case("PT_OPENBSD_WXNEEDED", PT_OPENBSD_WXNEEDED) .Case("PT_OPENBSD_BOOTDATA", PT_OPENBSD_BOOTDATA) - .Case("PT_OHOS_RANDOMDATA", PT_OHOS_RANDOMDATA) .Default(-1); if (ret == (unsigned)-1) { diff --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp index 70c36c63d101..9a875bd7ec3e 100644 --- a/lld/ELF/SyntheticSections.cpp +++ b/lld/ELF/SyntheticSections.cpp @@ -3110,9 +3110,7 @@ size_t VersionTableSection::getSize() const { void VersionTableSection::writeTo(uint8_t *buf) { buf += 2; for (const SymbolTableEntry &s : getPartition().dynSymTab->getSymbols()) { - // Use the original versionId for an unfetched lazy symbol (undefined weak), - // which must be VER_NDX_GLOBAL (an undefined versioned symbol is an error). - write16(buf, s.sym->isLazy() ? VER_NDX_GLOBAL : s.sym->versionId); + write16(buf, s.sym->versionId); buf += 2; } } diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index 884201c871da..f550e6a73335 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -898,8 +898,7 @@ static bool isRelroSection(const OutputSection *sec) { return s == ".data.rel.ro" || s == ".bss.rel.ro" || s == ".ctors" || s == ".dtors" || s == ".jcr" || s == ".eh_frame" || s == ".fini_array" || s == ".init_array" || - s == ".openbsd.randomdata" || s == ".preinit_array" || - s == ".ohos.randomdata"; + s == ".openbsd.randomdata" || s == ".preinit_array"; } // We compute a rank for each section. The rank indicates where the @@ -2452,9 +2451,6 @@ std::vector Writer::createPhdrs(Partition &part) { if (OutputSection *cmd = findSection(".note.gnu.property", partNo)) addHdr(PT_GNU_PROPERTY, PF_R)->add(cmd); - if (OutputSection *cmd = findSection(".ohos.randomdata", partNo)) - addHdr(PT_OHOS_RANDOMDATA, cmd->getPhdrFlags())->add(cmd); - // Create one PT_NOTE per a group of contiguous SHT_NOTE sections with the // same alignment. PhdrEntry *note = nullptr; diff --git a/lld/docs/ReleaseNotes.rst b/lld/docs/ReleaseNotes.rst index 24ed23bb2b7d..e0b17ca3e030 100644 --- a/lld/docs/ReleaseNotes.rst +++ b/lld/docs/ReleaseNotes.rst @@ -24,124 +24,28 @@ Non-comprehensive list of changes in this release ELF Improvements ---------------- -* ``--dependency-file`` has been added. (Similar to ``cc -M -MF``.) - (`D82437 `_) -* ``--error-handling-script`` has been added to allow for user-defined handlers upon +* ``--error-handling-script`` is added to allow for user-defined handlers upon missing libraries. (`D87758 `_) -* ``--exclude-libs`` can now localize defined version symbols and bitcode referenced libcall symbols. - (`D94280 `_) -* ``--gdb-index`` now works with DWARF v5 and ``--icf={safe,all}``. - (`D85579 `_) - (`D89751 `_) -* ``--gdb-index --emit-relocs`` can now be used together. - (`D94354 `_) -* ``--icf={safe,all}`` conservatively no longer fold text sections with LSDA. - Previously ICF on ``-fexceptions`` code could be unsafe. - (`D84610 `_) -* ``--icf={safe,all}`` can now fold two sections with relocations referencing aliased symbols. - (`D88830 `_) -* ``--lto-pseudo-probe-for-profiling`` has been added. - (`D95056 `_) -* ``--no-lto-whole-program-visibility`` has been added. - (`D92060 `_) -* ``--oformat-binary`` has been fixed to respect LMA. - (`D85086 `_) -* ``--reproduce`` includes ``--lto-sample-profile``, ``--just-symbols``, ``--call-graph-ordering-file``, ``--retain-symbols-file`` files. -* ``-r --gc-sections`` is now supported. - (`D84131 `_) -* A ``-u`` specified symbol will no longer change the binding to ``STB_WEAK``. - (`D88945 `_) -* ``--wrap`` support has been improved. - + If ``foo`` is not referenced, there is no longer an undefined symbol ``__wrap_foo``. - + If ``__real_foo`` is not referenced, there is no longer an undefined symbol ``foo``. -* ``SHF_LINK_ORDER`` sections can now have zero ``sh_link`` values. -* ``SHF_LINK_ORDER`` and non-``SHF_LINK_ORDER`` sections can now be mixed within an input section description. - (`D84001 `_) -* ``LOG2CEIL`` is now supported in linker scripts. - (`D84054 `_) -* ``DEFINED`` has been fixed to check whether the symbol is defined. - (`D83758 `_) -* An input section description may now have multiple ``SORT_*``. - The matched sections are ordered by radix sort with the keys being ``(SORT*, --sort-section, input order)``. - (`D91127 `_) -* Users can now provide a GNU style linker script to convert ``.ctors`` into ``.init_array``. - (`D91187 `_) -* An empty output section can now be discarded even if it is assigned to a program header. - (`D92301 `_) -* Non-``SHF_ALLOC`` sections now have larger file offsets than ``SHF_ALLOC`` sections. - (`D85867 `_) -* Some symbol versioning improvements. - + Defined ``foo@@v1`` now resolve undefined ``foo@v1`` (`D92259 `_) - + Undefined ``foo@v1`` now gets an error (`D92260 `_) -* The AArch64 port now has support for ``STO_AARCH64_VARIANT_PCS`` and ``DT_AARCH64_VARIANT_PCS``. - (`D93045 `_) -* The AArch64 port now has support for ``R_AARCH64_LD64_GOTPAGE_LO15``. -* The PowerPC64 port now detects missing R_PPC64_TLSGD/R_PPC64_TLSLD and disables TLS relaxation. - This allows linking with object files produced by very old IBM XL compilers. - (`D92959 `_) -* Many PowerPC PC-relative relocations are now supported. -* ``R_PPC_ADDR24`` and ``R_PPC64_ADDR16_HIGH`` are now supported. -* powerpcle is now supported. Tested with FreeBSD loader and freestanding. - (`D93917 `_) -* RISC-V: the first ``SHT_RISCV_ATTRIBUTES`` section is now retained. - (`D86309 `_) -* LTO pipeline now defaults to the new PM if the CMake variable ``ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER`` is on. - (`D92885 `_) Breaking changes ---------------- -* A COMMON symbol can now cause the fetch of an archive providing a ``STB_GLOBAL`` definition. - This behavior follows GNU ld newer than December 1999. - If you see ``duplicate symbol`` errors with the new behavior, check out `PR49226 `_. - (`D86142 `_) +* ... COFF Improvements ----------------- -* Error out clearly if creating a DLL with too many exported symbols. - (`D86701 `_) +* ... MinGW Improvements ------------------ -* Enabled dynamicbase by default. (`D86654 `_) +* ... -* Tolerate mismatches between COMDAT section sizes with different amount of - padding (produced by binutils) by inspecting the aux section definition. - (`D86659 `_) - -* Support setting the subsystem version via the subsystem argument. - (`D88804 `_) - -* Implemented the GNU -wrap option. - (`D89004 `_, - `D91689 `_) - -* Handle the ``--demangle`` and ``--no-demangle`` options. - (`D93950 `_) - - -Mach-O Improvements +MachO Improvements ------------------ -We've gotten the new implementation of LLD for Mach-O to the point where it is -able to link large x86_64 programs, and we'd love to get some alpha testing on -it. The new Darwin back-end can be invoked as follows: - -.. code-block:: - clang -fuse-ld=lld.darwinnew /path/to/file.c - -To reach this point, we implemented numerous features, and it's easier to list -the major features we *haven't* yet completed: - -* LTO support -* Stack unwinding for exceptions -* Support for arm64, arm, and i386 architectures - -If you stumble upon an issue and it doesn't fall into one of these categories, -please file a bug report! - +* Item 1. WebAssembly Improvements ------------------------ diff --git a/lld/test/ELF/lto/opt-level.ll b/lld/test/ELF/lto/opt-level.ll index 628e4ef7126c..6e0cc9ac98c5 100644 --- a/lld/test/ELF/lto/opt-level.ll +++ b/lld/test/ELF/lto/opt-level.ll @@ -19,14 +19,14 @@ ; RUN: FileCheck --check-prefix=INVALID1 %s ; RUN: not ld.lld -o /dev/null -e main --plugin-opt=Ofoo %t.o 2>&1 | \ ; RUN: FileCheck --check-prefix=INVALID2 %s -; INVALID2: invalid optimization level for LTO: foo +; INVALID2: --plugin-opt=Ofoo: number expected, but got 'foo' ; RUN: not ld.lld -o /dev/null -e main --lto-O-1 %t.o 2>&1 | \ ; RUN: FileCheck --check-prefix=INVALIDNEGATIVE1 %s -; INVALIDNEGATIVE1: invalid optimization level for LTO: -1 +; INVALIDNEGATIVE1: invalid optimization level for LTO: 4294967295 ; RUN: not ld.lld -o /dev/null -e main --plugin-opt=O-1 %t.o 2>&1 | \ ; RUN: FileCheck --check-prefix=INVALIDNEGATIVE2 %s -; INVALIDNEGATIVE2: invalid optimization level for LTO: -1 +; INVALIDNEGATIVE2: invalid optimization level for LTO: 4294967295 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" diff --git a/lld/test/ELF/lto/parallel.ll b/lld/test/ELF/lto/parallel.ll index d89431e8b4a1..d9cb4fed7bfa 100644 --- a/lld/test/ELF/lto/parallel.ll +++ b/lld/test/ELF/lto/parallel.ll @@ -14,7 +14,7 @@ target triple = "x86_64-unknown-linux-gnu" ; CHECK0-NOT: bar ; CHECK0: T foo ; CHECK0-NOT: bar -define void @foo() mustprogress { +define void @foo() { call void @bar() ret void } @@ -22,7 +22,7 @@ define void @foo() mustprogress { ; CHECK1-NOT: foo ; CHECK1: T bar ; CHECK1-NOT: foo -define void @bar() mustprogress { +define void @bar() { call void @foo() ret void } diff --git a/lld/test/ELF/non-abs-reloc.s b/lld/test/ELF/non-abs-reloc.s index 82f913efe4d8..72a65424ed1f 100644 --- a/lld/test/ELF/non-abs-reloc.s +++ b/lld/test/ELF/non-abs-reloc.s @@ -1,17 +1,17 @@ // REQUIRES: x86 // RUN: split-file %s %t -// RUN: llvm-mc -filetype=obj -triple=i386 %t/asm -o %t.o -// RUN: ld.lld -T %t/lds %t.o -o %t.exe 2>&1 | FileCheck %s --implicit-check-not=warning: --implicit-check-not=error: -// CHECK: warning: {{.*}}.o:(.nonalloc1+0x1): has non-ABS relocation R_386_PC32 against symbol '_start' -// CHECK-NEXT: warning: {{.*}}.o:(.nonalloc1+0x6): has non-ABS relocation R_386_PC32 against symbol '_start' +// RUN: llvm-mc -filetype=obj -triple=x86_64 %t/asm -o %t.o +// RUN: ld.lld -T %t/lds %t.o -o %t.exe 2>&1 | FileCheck %s +// CHECK: warning: {{.*}}.o:(.nonalloc1+0x1): has non-ABS relocation R_X86_64_PC32 against symbol '_start' +// CHECK-NEXT: warning: {{.*}}.o:(.nonalloc1+0x6): has non-ABS relocation R_X86_64_PC32 against symbol '_start' // RUN: llvm-objdump -D --no-show-raw-insn %t.exe | FileCheck --check-prefix=DISASM %s // DISASM: Disassembly of section .nonalloc: // DISASM-EMPTY: // DISASM-NEXT: <.nonalloc>: // DISASM-NEXT: 0: nop -// DISASM-NEXT: 1: calll 0x0 -// DISASM-NEXT: 6: calll 0x0 +// DISASM-NEXT: 1: callq 0x0 +// DISASM-NEXT: 6: callq 0x0 //--- lds SECTIONS { @@ -20,7 +20,6 @@ SECTIONS { //--- asm .globl _start _start: -.L0: nop .section .nonalloc0 @@ -31,8 +30,3 @@ _start: .long _start - . - 4 .byte 0xe8 .long _start - . - 4 - -// GCC may relocate DW_AT_GNU_call_site_value with R_386_GOTOFF. -// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98946 -.section .debug_info - .long .L0@gotoff diff --git a/lld/test/ELF/version-script-weak.s b/lld/test/ELF/version-script-weak.s index cfa2455ee2bd..7c902eb98bf4 100644 --- a/lld/test/ELF/version-script-weak.s +++ b/lld/test/ELF/version-script-weak.s @@ -24,19 +24,6 @@ # CHECK-NEXT: Section: Undefined # CHECK-NEXT: } -## The version of an unfetched lazy symbol is VER_NDX_GLOBAL. It is not affected by version scripts. -# RUN: echo "v1 { *; };" > %t2.script -# RUN: ld.lld -shared --version-script %t2.script %t.o --start-lib %t1.o --end-lib -o %t2.so -# RUN: llvm-readelf --dyn-syms %t2.so | FileCheck %s --check-prefix=CHECK2 - -# CHECK2: NOTYPE WEAK DEFAULT UND foo{{$}} - -# RUN: ld.lld -shared --soname=tshared --version-script %t2.script %t1.o -o %tshared.so -# RUN: ld.lld -shared --version-script %t2.script %t.o --start-lib %t1.o --end-lib %tshared.so -o %t3.so -# RUN: llvm-readelf --dyn-syms %t3.so | FileCheck %s --check-prefix=CHECK3 - -# CHECK3: NOTYPE WEAK DEFAULT UND foo@v1 - .text callq foo@PLT .weak foo diff --git a/lld/test/lit.cfg.py b/lld/test/lit.cfg.py index 670f41f0b631..8e31fd3977f9 100644 --- a/lld/test/lit.cfg.py +++ b/lld/test/lit.cfg.py @@ -101,13 +101,11 @@ if config.sizeof_void_p == 8: tar_executable = lit.util.which('tar', config.environment['PATH']) if tar_executable: - env = os.environ - env['LANG'] = 'C' tar_version = subprocess.Popen( [tar_executable, '--version'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, - env=env) + env={'LANG': 'C'}) sout, _ = tar_version.communicate() if 'GNU tar' in sout.decode(): config.available_features.add('gnutar') diff --git a/lld/test/wasm/lto/parallel.ll b/lld/test/wasm/lto/parallel.ll index 261cf2ef7dae..a93c3558d969 100644 --- a/lld/test/wasm/lto/parallel.ll +++ b/lld/test/wasm/lto/parallel.ll @@ -10,7 +10,7 @@ target triple = "wasm32-unknown-unknown-wasm" ; CHECK0-NOT: bar ; CHECK0: T foo ; CHECK0-NOT: bar -define void @foo() mustprogress { +define void @foo() { call void @bar() ret void } @@ -18,7 +18,7 @@ define void @foo() mustprogress { ; CHECK1-NOT: foo ; CHECK1: T bar ; CHECK1-NOT: foo -define void @bar() mustprogress { +define void @bar() { call void @foo() ret void } diff --git a/lldb/CMakeLists.txt b/lldb/CMakeLists.txt index 7448c99de72a..b5633e21c56a 100644 --- a/lldb/CMakeLists.txt +++ b/lldb/CMakeLists.txt @@ -31,21 +31,13 @@ if (WIN32) endif() if (LLDB_ENABLE_PYTHON) - if (NOT CMAKE_CROSSCOMPILING) - execute_process( - COMMAND ${Python3_EXECUTABLE} - -c "import distutils.sysconfig; print(distutils.sysconfig.get_python_lib(True, False, ''))" - OUTPUT_VARIABLE LLDB_PYTHON_DEFAULT_RELATIVE_PATH - OUTPUT_STRIP_TRAILING_WHITESPACE) - - file(TO_CMAKE_PATH ${LLDB_PYTHON_DEFAULT_RELATIVE_PATH} LLDB_PYTHON_DEFAULT_RELATIVE_PATH) - else () - if ("${LLDB_PYTHON_RELATIVE_PATH}" STREQUAL "") - message(FATAL_ERROR - "Crosscompiling LLDB with Python requires manually setting - LLDB_PYTHON_RELATIVE_PATH.") - endif () - endif () + execute_process( + COMMAND ${Python3_EXECUTABLE} + -c "import distutils.sysconfig; print(distutils.sysconfig.get_python_lib(True, False, ''))" + OUTPUT_VARIABLE LLDB_PYTHON_DEFAULT_RELATIVE_PATH + OUTPUT_STRIP_TRAILING_WHITESPACE) + + file(TO_CMAKE_PATH ${LLDB_PYTHON_DEFAULT_RELATIVE_PATH} LLDB_PYTHON_DEFAULT_RELATIVE_PATH) set(LLDB_PYTHON_RELATIVE_PATH ${LLDB_PYTHON_DEFAULT_RELATIVE_PATH} CACHE STRING "Path where Python modules are installed, relative to install prefix") endif () diff --git a/lldb/cmake/modules/FindPythonAndSwig.cmake b/lldb/cmake/modules/FindPythonAndSwig.cmake index 562d5307e8c8..3535b548c45f 100644 --- a/lldb/cmake/modules/FindPythonAndSwig.cmake +++ b/lldb/cmake/modules/FindPythonAndSwig.cmake @@ -35,17 +35,6 @@ macro(FindPython3) endif() endmacro() -#OHOS specific: copy LLVM-10 definitions if new Python3_*** are not set -if(NOT Python3_EXECUTABLE AND PYTHON_EXECUTABLE) - set(Python3_EXECUTABLE ${PYTHON_EXECUTABLE}) -endif() -if(NOT Python3_LIBRARIES AND PYTHON_LIBRARIES) - set(Python3_LIBRARIES ${PYTHON_LIBRARIES}) -endif() -if(NOT Python3_INCLUDE_DIRS AND PYTHON_INCLUDE_DIRS) - set(Python3_INCLUDE_DIRS ${PYTHON_INCLUDE_DIRS}) -endif() - if(Python3_LIBRARIES AND Python3_INCLUDE_DIRS AND Python3_EXECUTABLE AND SWIG_EXECUTABLE) set(PYTHONANDSWIG_FOUND TRUE) else() diff --git a/lldb/cmake/modules/LLDBConfig.cmake b/lldb/cmake/modules/LLDBConfig.cmake index a50f6ce7c315..2fdf1502d055 100644 --- a/lldb/cmake/modules/LLDBConfig.cmake +++ b/lldb/cmake/modules/LLDBConfig.cmake @@ -295,7 +295,7 @@ endif() # Figure out if lldb could use lldb-server. If so, then we'll # ensure we build lldb-server when an lldb target is being built. -if (CMAKE_SYSTEM_NAME MATCHES "Android|Darwin|FreeBSD|Linux|NetBSD|Windows|OHOS") +if (CMAKE_SYSTEM_NAME MATCHES "Android|Darwin|FreeBSD|Linux|NetBSD|Windows") set(LLDB_CAN_USE_LLDB_SERVER ON) else() set(LLDB_CAN_USE_LLDB_SERVER OFF) diff --git a/lldb/docs/man/lldb.rst b/lldb/docs/man/lldb.rst index b75288db380d..6dca15fa35dc 100644 --- a/lldb/docs/man/lldb.rst +++ b/lldb/docs/man/lldb.rst @@ -256,11 +256,11 @@ executable. To disambiguate between arguments passed to lldb and arguments passed to the debugged executable, arguments starting with a - must be passed after --. - lldb --arch x86_64 /path/to/program program argument -- --arch armv7 + lldb --arch x86_64 /path/to/program program argument -- --arch arvm7 For convenience, passing the executable after -- is also supported. - lldb --arch x86_64 -- /path/to/program program argument --arch armv7 + lldb --arch x86_64 -- /path/to/program program argument --arch arvm7 Passing one of the attach options causes :program:`lldb` to immediately attach to the given process. diff --git a/lldb/include/lldb/Host/HostInfo.h b/lldb/include/lldb/Host/HostInfo.h index fbb5bbf1e442..b7010d69d88e 100644 --- a/lldb/include/lldb/Host/HostInfo.h +++ b/lldb/include/lldb/Host/HostInfo.h @@ -39,9 +39,6 @@ #if defined(__ANDROID__) #include "lldb/Host/android/HostInfoAndroid.h" #define HOST_INFO_TYPE HostInfoAndroid -#elif defined(__OHOS_FAMILY__) -#include "lldb/Host/ohos/HostInfoOHOS.h" -#define HOST_INFO_TYPE HostInfoOHOS #else #include "lldb/Host/linux/HostInfoLinux.h" #define HOST_INFO_TYPE HostInfoLinux diff --git a/lldb/include/lldb/Host/MainLoop.h b/lldb/include/lldb/Host/MainLoop.h index e26b8c8cb61b..9ca5040b60a8 100644 --- a/lldb/include/lldb/Host/MainLoop.h +++ b/lldb/include/lldb/Host/MainLoop.h @@ -14,8 +14,7 @@ #include "llvm/ADT/DenseMap.h" #include -#if !HAVE_PPOLL && !HAVE_SYS_EVENT_H && !defined(__ANDROID__) && \ - !defined(__OHOS_FAMILY__) +#if !HAVE_PPOLL && !HAVE_SYS_EVENT_H && !defined(__ANDROID__) #define SIGNAL_POLLING_UNSUPPORTED 1 #endif diff --git a/lldb/include/lldb/Host/ohos/HostInfoOHOS.h b/lldb/include/lldb/Host/ohos/HostInfoOHOS.h deleted file mode 100644 index e20582820145..000000000000 --- a/lldb/include/lldb/Host/ohos/HostInfoOHOS.h +++ /dev/null @@ -1,32 +0,0 @@ -//===-- HostInfoOHOS.h ---------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef lldb_Host_ohos_HostInfoOHOS_h_ -#define lldb_Host_ohos_HostInfoOHOS_h_ - -#include "lldb/Host/linux/HostInfoLinux.h" - -namespace lldb_private { - -class HostInfoOHOS : public HostInfoLinux { - friend class HostInfoBase; - -public: - static FileSpec GetDefaultShell(); - static FileSpec ResolveLibraryPath(const std::string &path, - const ArchSpec &arch); - -protected: - static void ComputeHostArchitectureSupport(ArchSpec &arch_32, - ArchSpec &arch_64); - static bool ComputeTempFileBaseDirectory(FileSpec &file_spec); -}; - -} // end of namespace lldb_private - -#endif // #ifndef lldb_Host_ohos_HostInfoOHOS_h_ diff --git a/lldb/include/lldb/Interpreter/OptionGroupPlatform.h b/lldb/include/lldb/Interpreter/OptionGroupPlatform.h index c873cf307d1e..99945e5246fd 100644 --- a/lldb/include/lldb/Interpreter/OptionGroupPlatform.h +++ b/lldb/include/lldb/Interpreter/OptionGroupPlatform.h @@ -58,17 +58,12 @@ public: void SetSDKBuild(ConstString sdk_build) { m_sdk_build = sdk_build; } - bool GetContainer() const { return m_container; } - - void SetContainer(bool b_container) { m_container = b_container; } - bool PlatformMatches(const lldb::PlatformSP &platform_sp) const; protected: std::string m_platform_name; ConstString m_sdk_sysroot; ConstString m_sdk_build; - bool m_container; llvm::VersionTuple m_os_version; bool m_include_platform_option; }; diff --git a/lldb/include/lldb/Target/ModuleCache.h b/lldb/include/lldb/Target/ModuleCache.h index 010b367aa966..9dc0e0903196 100644 --- a/lldb/include/lldb/Target/ModuleCache.h +++ b/lldb/include/lldb/Target/ModuleCache.h @@ -67,7 +67,6 @@ private: bool *did_create_ptr); std::unordered_map m_loaded_modules; - std::recursive_mutex m_cache_mutex; }; } // namespace lldb_private diff --git a/lldb/include/lldb/Target/PathMappingList.h b/lldb/include/lldb/Target/PathMappingList.h index fc7b23bcfad3..9e1e6eb26eb9 100644 --- a/lldb/include/lldb/Target/PathMappingList.h +++ b/lldb/include/lldb/Target/PathMappingList.h @@ -72,9 +72,13 @@ public: /// \param[in] path /// The original source file path to try and remap. /// + /// \param[out] new_path + /// The newly remapped filespec that is may or may not exist. + /// /// \return - /// The remapped filespec that may or may not exist on disk. - llvm::Optional RemapPath(llvm::StringRef path) const; + /// /b true if \a path was successfully located and \a new_path + /// is filled in with a new source path, \b false otherwise. + bool RemapPath(llvm::StringRef path, std::string &new_path) const; bool RemapPath(const char *, std::string &) const = delete; bool ReverseRemapPath(const FileSpec &file, FileSpec &fixed) const; @@ -90,9 +94,14 @@ public: /// \param[in] orig_spec /// The original source file path to try and remap. /// - /// \return + /// \param[out] new_spec /// The newly remapped filespec that is guaranteed to exist. - llvm::Optional FindFile(const FileSpec &orig_spec) const; + /// + /// \return + /// /b true if \a orig_spec was successfully located and + /// \a new_spec is filled in with an existing file spec, + /// \b false otherwise. + bool FindFile(const FileSpec &orig_spec, FileSpec &new_spec) const; uint32_t FindIndexForPath(ConstString path) const; diff --git a/lldb/include/lldb/Target/Platform.h b/lldb/include/lldb/Target/Platform.h index eb1a40db5316..df46466655c3 100644 --- a/lldb/include/lldb/Target/Platform.h +++ b/lldb/include/lldb/Target/Platform.h @@ -477,10 +477,6 @@ public: void SetSDKBuild(ConstString sdk_build) { m_sdk_build = sdk_build; } - void SetContainer(bool b_container) { m_container = b_container; } - - bool GetContainer() const { return m_container; } - // Override this to return true if your platform supports Clang modules. You // may also need to override AddClangModuleCompilationOptions to pass the // right Clang flags for your platform. @@ -584,8 +580,6 @@ public: virtual Status Unlink(const FileSpec &file_spec); - virtual ConstString GetMmapSymbolName(const ArchSpec &arch); - virtual MmapArgList GetMmapArgumentList(const ArchSpec &arch, lldb::addr_t addr, lldb::addr_t length, @@ -888,7 +882,6 @@ protected: ConstString m_sdk_sysroot; // the root location of where the SDK files are all located ConstString m_sdk_build; - bool m_container; FileSpec m_working_dir; // The working directory which is used when installing // modules that have no install path set std::string m_remote_url; diff --git a/lldb/include/lldb/Target/ThreadPlanStepOverBreakpoint.h b/lldb/include/lldb/Target/ThreadPlanStepOverBreakpoint.h index 0cc17d367273..86f7798487c3 100644 --- a/lldb/include/lldb/Target/ThreadPlanStepOverBreakpoint.h +++ b/lldb/include/lldb/Target/ThreadPlanStepOverBreakpoint.h @@ -46,8 +46,6 @@ private: lldb::user_id_t m_breakpoint_site_id; bool m_auto_continue; bool m_reenabled_breakpoint_site; - bool m_stopped_at_my_breakpoint; - bool m_handling_signal; ThreadPlanStepOverBreakpoint(const ThreadPlanStepOverBreakpoint &) = delete; const ThreadPlanStepOverBreakpoint & diff --git a/lldb/include/lldb/Target/ThreadPlanStepRange.h b/lldb/include/lldb/Target/ThreadPlanStepRange.h index 36288a0d10ae..2fe885277100 100644 --- a/lldb/include/lldb/Target/ThreadPlanStepRange.h +++ b/lldb/include/lldb/Target/ThreadPlanStepRange.h @@ -44,7 +44,6 @@ protected: bool InRange(); lldb::FrameComparison CompareCurrentFrameToStartFrame(); bool InSymbol(); - bool MaybeAArch32Or64FunctionTail(); void DumpRanges(Stream *s); Disassembler *GetDisassembler(); diff --git a/lldb/packages/Python/lldbsuite/test/builders/builder.py b/lldb/packages/Python/lldbsuite/test/builders/builder.py index ab14c7445907..6c9584224f4a 100644 --- a/lldb/packages/Python/lldbsuite/test/builders/builder.py +++ b/lldb/packages/Python/lldbsuite/test/builders/builder.py @@ -63,18 +63,19 @@ class Builder: string used for the make system. """ + # If d is None or an empty mapping, just return an empty string. if not d: - d = {} - + return "" pattern = '%s="%s"' if "win32" in sys.platform else "%s='%s'" - append_vars = ["CFLAGS", "CFLAGS_EXTRAS", "LD_EXTRAS"] - for var in append_vars: - val = (d.get(var, '') + ' ' + os.getenv(var, '')).strip() - if val: - d[var] = val + + def setOrAppendVariable(k, v): + append_vars = ["CFLAGS", "CFLAGS_EXTRAS", "LD_EXTRAS"] + if k in append_vars and k in os.environ: + v = os.environ[k] + " " + v + return pattern % (k, v) cmdline = " ".join( - [pattern % (k, v) for k, v in d.items()]).strip() + [setOrAppendVariable(k, v) for k, v in list(d.items())]) return cmdline diff --git a/lldb/packages/Python/lldbsuite/test/concurrent_base.py b/lldb/packages/Python/lldbsuite/test/concurrent_base.py index bb33d05da216..6acd71ce9e46 100644 --- a/lldb/packages/Python/lldbsuite/test/concurrent_base.py +++ b/lldb/packages/Python/lldbsuite/test/concurrent_base.py @@ -76,7 +76,7 @@ class ConcurrentEventsBase(TestBase): bp = self.inferior_target.FindBreakpointByID(bpno) descriptions.append( ": file = 'main.cpp', line = %d" % - line) + self.finish_breakpoint_line) return bp def inferior_done(self): diff --git a/lldb/packages/Python/lldbsuite/test/decorators.py b/lldb/packages/Python/lldbsuite/test/decorators.py index f66cb7f1d6d0..ff445fa0b926 100644 --- a/lldb/packages/Python/lldbsuite/test/decorators.py +++ b/lldb/packages/Python/lldbsuite/test/decorators.py @@ -641,9 +641,6 @@ def skipIfPlatform(oslist): return unittest2.skipIf(lldbplatformutil.getPlatform() in oslist, "skip on %s" % (", ".join(oslist))) -def skipOnHuaweiCI(func): - return unittest2.skipIf(lldbplatformutil.isHuaweiCI(), "skip on Huawei CI")(func) - def skipUnlessPlatform(oslist): """Decorate the item to skip tests unless running on one of the listed platforms.""" diff --git a/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py b/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py index d1dfcde78c44..94b133589dcc 100644 --- a/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py +++ b/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py @@ -152,8 +152,6 @@ def getPlatform(): # It still might be an unconnected remote platform. return '' -def isHuaweiCI(): - return getPlatform() == 'linux' and os.path.exists('/.dockerenv') def platformIsDarwin(): """Returns true if the OS triple for the selected platform is any valid apple OS""" diff --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py b/lldb/packages/Python/lldbsuite/test/lldbtest.py index f3060185bc4d..958cadd3a7c8 100644 --- a/lldb/packages/Python/lldbsuite/test/lldbtest.py +++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py @@ -804,6 +804,11 @@ class Base(unittest2.TestCase): for setting, value in configuration.settings: commands.append('setting set %s %s'%(setting, value)) + # Make sure that a sanitizer LLDB's environment doesn't get passed on. + if cls.platformContext and cls.platformContext.shlib_environment_var in os.environ: + commands.append('settings set target.env-vars {}='.format( + cls.platformContext.shlib_environment_var)) + # Set environment variables for the inferior. if lldbtest_config.inferior_env: commands.append('settings set target.env-vars {}'.format( @@ -957,56 +962,6 @@ class Base(unittest2.TestCase): self.subprocesses.append(proc) return proc - def runCmd(self, cmd, msg=None, check=True, trace=False, inHistory=False): - """ - Ask the command interpreter to handle the command and then check its - return status. - """ - # Fail fast if 'cmd' is not meaningful. - if cmd is None: - raise Exception("Bad 'cmd' parameter encountered") - - trace = (True if traceAlways else trace) - - if cmd.startswith("target create "): - cmd = cmd.replace("target create ", "file ") - - running = (cmd.startswith("run") or cmd.startswith("process launch")) - - for i in range(self.maxLaunchCount if running else 1): - self.ci.HandleCommand(cmd, self.res, inHistory) - - with recording(self, trace) as sbuf: - print("runCmd:", cmd, file=sbuf) - if not check: - print("check of return status not required", file=sbuf) - if self.res.Succeeded(): - print("output:", self.res.GetOutput(), file=sbuf) - else: - print("runCmd failed!", file=sbuf) - print(self.res.GetError(), file=sbuf) - - if self.res.Succeeded(): - break - elif running: - # For process launch, wait some time before possible next try. - time.sleep(self.timeWaitNextLaunch) - with recording(self, trace) as sbuf: - print("Command '" + cmd + "' failed!", file=sbuf) - - if check: - output = "" - if self.res.GetOutput(): - output += "\nCommand output:\n" + self.res.GetOutput() - if self.res.GetError(): - output += "\nError output:\n" + self.res.GetError() - if msg: - msg += output - if cmd: - cmd += output - self.assertTrue(self.res.Succeeded(), - msg if (msg) else CMD_MSG(cmd)) - def HideStdout(self): """Hide output to stdout from the user. @@ -1796,7 +1751,7 @@ class Base(unittest2.TestCase): elif self.getPlatform() == "netbsd": # NetBSD defaults to libc++ pass - elif "clang" in self.getCompiler() and not lldb.remote_platform: + elif "clang" in self.getCompiler(): cflags += " -stdlib=libstdc++" return {'CFLAGS_EXTRAS': cflags, @@ -2171,6 +2126,56 @@ class TestBase(Base): if matched: self.runCmd('thread select %s' % matched.group(1)) + def runCmd(self, cmd, msg=None, check=True, trace=False, inHistory=False): + """ + Ask the command interpreter to handle the command and then check its + return status. + """ + # Fail fast if 'cmd' is not meaningful. + if cmd is None: + raise Exception("Bad 'cmd' parameter encountered") + + trace = (True if traceAlways else trace) + + if cmd.startswith("target create "): + cmd = cmd.replace("target create ", "file ") + + running = (cmd.startswith("run") or cmd.startswith("process launch")) + + for i in range(self.maxLaunchCount if running else 1): + self.ci.HandleCommand(cmd, self.res, inHistory) + + with recording(self, trace) as sbuf: + print("runCmd:", cmd, file=sbuf) + if not check: + print("check of return status not required", file=sbuf) + if self.res.Succeeded(): + print("output:", self.res.GetOutput(), file=sbuf) + else: + print("runCmd failed!", file=sbuf) + print(self.res.GetError(), file=sbuf) + + if self.res.Succeeded(): + break + elif running: + # For process launch, wait some time before possible next try. + time.sleep(self.timeWaitNextLaunch) + with recording(self, trace) as sbuf: + print("Command '" + cmd + "' failed!", file=sbuf) + + if check: + output = "" + if self.res.GetOutput(): + output += "\nCommand output:\n" + self.res.GetOutput() + if self.res.GetError(): + output += "\nError output:\n" + self.res.GetError() + if msg: + msg += output + if cmd: + cmd += output + self.assertTrue(self.res.Succeeded(), + msg if (msg) else CMD_MSG(cmd)) + def match( self, str, diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py index 582c3046f207..91509f609096 100644 --- a/lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py +++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py @@ -139,9 +139,7 @@ class GdbRemoteTestCaseBase(Base): if configuration.lldb_platform_url.startswith('unix-'): url_pattern = '(.+)://\[?(.+?)\]?/.*' else: - # use (.*) for host instead of (.+) because - # 'connect://:port' - is a valid way to connect to lldb-server - url_pattern = '(.+)://(.*):\d+' + url_pattern = '(.+)://(.+):\d+' scheme, host = re.match( url_pattern, configuration.lldb_platform_url).groups() if configuration.lldb_platform_name == 'remote-android' and host != 'localhost': @@ -283,8 +281,8 @@ class GdbRemoteTestCaseBase(Base): logger = self.logger - # TODO: forward port always when use adb connection - if configuration.lldb_platform_name == 'remote-android': + triple = self.dbg.GetSelectedPlatform().GetTriple() + if re.match(".*-.*-.*-android", triple): self.forward_adb_port( self.port, self.port, diff --git a/lldb/source/Commands/CommandObjectPlatform.cpp b/lldb/source/Commands/CommandObjectPlatform.cpp index 33b8528522ae..f306da3c8543 100644 --- a/lldb/source/Commands/CommandObjectPlatform.cpp +++ b/lldb/source/Commands/CommandObjectPlatform.cpp @@ -164,16 +164,11 @@ public: protected: bool DoExecute(Args &args, CommandReturnObject &result) override { - if (args.GetArgumentCount() >= 1) { + if (args.GetArgumentCount() == 1) { const char *platform_name = args.GetArgumentAtIndex(0); if (platform_name && platform_name[0]) { const bool select = true; m_platform_options.SetPlatformName(platform_name); - if (args.GetArgumentCount() == 2) { - std::string inner(args.GetArgumentAtIndex(1)); - if (inner == "inner") - m_platform_options.SetContainer(true); - } Status error; ArchSpec platform_arch; PlatformSP platform_sp(m_platform_options.CreatePlatformWithOptions( diff --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp index 17cfaa79e640..1f9987c21658 100644 --- a/lldb/source/Core/Module.cpp +++ b/lldb/source/Core/Module.cpp @@ -1595,21 +1595,13 @@ bool Module::MatchesModuleSpec(const ModuleSpec &module_ref) { bool Module::FindSourceFile(const FileSpec &orig_spec, FileSpec &new_spec) const { std::lock_guard guard(m_mutex); - if (auto remapped = m_source_mappings.FindFile(orig_spec)) { - new_spec = *remapped; - return true; - } - return false; + return m_source_mappings.FindFile(orig_spec, new_spec); } bool Module::RemapSourceFile(llvm::StringRef path, std::string &new_path) const { std::lock_guard guard(m_mutex); - if (auto remapped = m_source_mappings.RemapPath(path)) { - new_path = remapped->GetPath(); - return true; - } - return false; + return m_source_mappings.RemapPath(path, new_path); } void Module::RegisterXcodeSDK(llvm::StringRef sdk_name, llvm::StringRef sysroot) { diff --git a/lldb/source/Core/SourceManager.cpp b/lldb/source/Core/SourceManager.cpp index 61cf91963557..e79fcb48742d 100644 --- a/lldb/source/Core/SourceManager.cpp +++ b/lldb/source/Core/SourceManager.cpp @@ -441,17 +441,13 @@ void SourceManager::File::CommonInitializer(const FileSpec &file_spec, } // Try remapping if m_file_spec does not correspond to an existing file. if (!FileSystem::Instance().Exists(m_file_spec)) { - // Check target specific source remappings (i.e., the - // target.source-map setting), then fall back to the module - // specific remapping (i.e., the .dSYM remapping dictionary). - auto remapped = target->GetSourcePathMap().FindFile(m_file_spec); - if (!remapped) { - FileSpec new_spec; - if (target->GetImages().FindSourceFile(m_file_spec, new_spec)) - remapped = new_spec; - } - if (remapped) { - m_file_spec = *remapped; + FileSpec new_file_spec; + // Check target specific source remappings first, then fall back to + // modules objects can have individual path remappings that were + // detected when the debug info for a module was found. then + if (target->GetSourcePathMap().FindFile(m_file_spec, new_file_spec) || + target->GetImages().FindSourceFile(m_file_spec, new_file_spec)) { + m_file_spec = new_file_spec; m_mod_time = FileSystem::Instance().GetModificationTime(m_file_spec); } } diff --git a/lldb/source/Expression/IRInterpreter.cpp b/lldb/source/Expression/IRInterpreter.cpp index f892bb3dbd9b..b87a759aadc5 100644 --- a/lldb/source/Expression/IRInterpreter.cpp +++ b/lldb/source/Expression/IRInterpreter.cpp @@ -166,18 +166,6 @@ public: const Constant *constant = dyn_cast(value); if (constant) { - if (constant->getValueID() == Value::ConstantFPVal) { - if (auto *cfp = dyn_cast(constant)) { - if (cfp->getType()->isDoubleTy()) - scalar = cfp->getValueAPF().convertToDouble(); - else if (cfp->getType()->isFloatTy()) - scalar = cfp->getValueAPF().convertToFloat(); - else - return false; - return true; - } - return false; - } APInt value_apint; if (!ResolveConstantValue(value_apint, constant)) @@ -200,18 +188,9 @@ public: lldb::offset_t offset = 0; if (value_size <= 8) { - Type *ty = value->getType(); - if (ty->isDoubleTy()) { - scalar = value_extractor.GetDouble(&offset); - return true; - } else if (ty->isFloatTy()) { - scalar = value_extractor.GetFloat(&offset); - return true; - } else { - uint64_t u64value = value_extractor.GetMaxU64(&offset, value_size); - return AssignToMatchType(scalar, llvm::APInt(64, u64value), - value->getType()); - } + uint64_t u64value = value_extractor.GetMaxU64(&offset, value_size); + return AssignToMatchType(scalar, llvm::APInt(64, u64value), + value->getType()); } return false; @@ -225,15 +204,11 @@ public: return false; lldb_private::Scalar cast_scalar; - Type *vty = value->getType(); - if (vty->isFloatTy() || vty->isDoubleTy()) { - cast_scalar = scalar; - } else { - scalar.MakeUnsigned(); - if (!AssignToMatchType(cast_scalar, scalar.UInt128(llvm::APInt()), - value->getType())) - return false; - } + + scalar.MakeUnsigned(); + if (!AssignToMatchType(cast_scalar, scalar.UInt128(llvm::APInt()), + value->getType())) + return false; size_t value_byte_size = m_target_data.getTypeStoreSize(value->getType()); @@ -559,17 +534,16 @@ bool IRInterpreter::CanInterpret(llvm::Module &module, llvm::Function &function, } break; case Instruction::GetElementPtr: break; - case Instruction::FCmp: case Instruction::ICmp: { - CmpInst *cmp_inst = dyn_cast(&ii); + ICmpInst *icmp_inst = dyn_cast(&ii); - if (!cmp_inst) { + if (!icmp_inst) { error.SetErrorToGenericError(); error.SetErrorString(interpreter_internal_error); return false; } - switch (cmp_inst->getPredicate()) { + switch (icmp_inst->getPredicate()) { default: { LLDB_LOGF(log, "Unsupported ICmp predicate: %s", PrintValue(&ii).c_str()); @@ -578,17 +552,11 @@ bool IRInterpreter::CanInterpret(llvm::Module &module, llvm::Function &function, error.SetErrorString(unsupported_opcode_error); return false; } - case CmpInst::FCMP_OEQ: case CmpInst::ICMP_EQ: - case CmpInst::FCMP_UNE: case CmpInst::ICMP_NE: - case CmpInst::FCMP_OGT: case CmpInst::ICMP_UGT: - case CmpInst::FCMP_OGE: case CmpInst::ICMP_UGE: - case CmpInst::FCMP_OLT: case CmpInst::ICMP_ULT: - case CmpInst::FCMP_OLE: case CmpInst::ICMP_ULE: case CmpInst::ICMP_SGT: case CmpInst::ICMP_SGE: @@ -618,11 +586,6 @@ bool IRInterpreter::CanInterpret(llvm::Module &module, llvm::Function &function, case Instruction::Xor: case Instruction::ZExt: break; - case Instruction::FAdd: - case Instruction::FSub: - case Instruction::FMul: - case Instruction::FDiv: - break; } for (unsigned oi = 0, oe = ii.getNumOperands(); oi != oe; ++oi) { @@ -738,11 +701,7 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function, case Instruction::AShr: case Instruction::And: case Instruction::Or: - case Instruction::Xor: - case Instruction::FAdd: - case Instruction::FSub: - case Instruction::FMul: - case Instruction::FDiv: { + case Instruction::Xor: { const BinaryOperator *bin_op = dyn_cast(inst); if (!bin_op) { @@ -781,15 +740,12 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function, default: break; case Instruction::Add: - case Instruction::FAdd: result = L + R; break; case Instruction::Mul: - case Instruction::FMul: result = L * R; break; case Instruction::Sub: - case Instruction::FSub: result = L - R; break; case Instruction::SDiv: @@ -802,9 +758,6 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function, R.MakeUnsigned(); result = L / R; break; - case Instruction::FDiv: - result = L / R; - break; case Instruction::SRem: L.MakeSigned(); R.MakeSigned(); @@ -1067,11 +1020,10 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function, LLDB_LOGF(log, " Poffset : %s", frame.SummarizeValue(inst).c_str()); } } break; - case Instruction::FCmp: case Instruction::ICmp: { - const CmpInst *cmp_inst = cast(inst); + const ICmpInst *icmp_inst = cast(inst); - CmpInst::Predicate predicate = cmp_inst->getPredicate(); + CmpInst::Predicate predicate = icmp_inst->getPredicate(); Value *lhs = inst->getOperand(0); Value *rhs = inst->getOperand(1); @@ -1099,11 +1051,9 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function, default: return false; case CmpInst::ICMP_EQ: - case CmpInst::FCMP_OEQ: result = (L == R); break; case CmpInst::ICMP_NE: - case CmpInst::FCMP_UNE: result = (L != R); break; case CmpInst::ICMP_UGT: @@ -1116,28 +1066,16 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function, R.MakeUnsigned(); result = (L >= R); break; - case CmpInst::FCMP_OGE: - result = (L >= R); - break; - case CmpInst::FCMP_OGT: - result = (L > R); - break; case CmpInst::ICMP_ULT: L.MakeUnsigned(); R.MakeUnsigned(); result = (L < R); break; - case CmpInst::FCMP_OLT: - result = (L < R); - break; case CmpInst::ICMP_ULE: L.MakeUnsigned(); R.MakeUnsigned(); result = (L <= R); break; - case CmpInst::FCMP_OLE: - result = (L <= R); - break; case CmpInst::ICMP_SGT: L.MakeSigned(); R.MakeSigned(); diff --git a/lldb/source/Host/CMakeLists.txt b/lldb/source/Host/CMakeLists.txt index 1cf30c20a030..7456cb98bfa1 100644 --- a/lldb/source/Host/CMakeLists.txt +++ b/lldb/source/Host/CMakeLists.txt @@ -99,7 +99,7 @@ else() endif() - elseif (CMAKE_SYSTEM_NAME MATCHES "Linux|Android|OHOS") + elseif (CMAKE_SYSTEM_NAME MATCHES "Linux|Android") add_host_subdirectory(linux linux/AbstractSocket.cpp linux/Host.cpp @@ -113,11 +113,6 @@ else() android/LibcGlue.cpp ) endif() - if (CMAKE_SYSTEM_NAME MATCHES "OHOS") - add_host_subdirectory(ohos - ohos/HostInfoOHOS.cpp - ) - endif() elseif (CMAKE_SYSTEM_NAME MATCHES "FreeBSD") add_host_subdirectory(freebsd freebsd/Host.cpp diff --git a/lldb/source/Host/common/MainLoop.cpp b/lldb/source/Host/common/MainLoop.cpp index fc8b94309b09..02cabbc93550 100644 --- a/lldb/source/Host/common/MainLoop.cpp +++ b/lldb/source/Host/common/MainLoop.cpp @@ -86,7 +86,7 @@ private: int num_events = -1; #else -#if defined(__ANDROID__) +#ifdef __ANDROID__ fd_set read_fd_set; #else std::vector read_fds; @@ -140,7 +140,7 @@ void MainLoop::RunImpl::ProcessEvents() { } #else MainLoop::RunImpl::RunImpl(MainLoop &loop) : loop(loop) { -#if !defined(__ANDROID__) +#ifndef __ANDROID__ read_fds.reserve(loop.m_read_fds.size()); #endif } @@ -162,7 +162,7 @@ sigset_t MainLoop::RunImpl::get_sigmask() { return sigmask; } -#if defined(__ANDROID__) +#ifdef __ANDROID__ Status MainLoop::RunImpl::Poll() { // ppoll(2) is not supported on older all android versions. Also, older // versions android (API <= 19) implemented pselect in a non-atomic way, as a @@ -218,7 +218,7 @@ Status MainLoop::RunImpl::Poll() { #endif void MainLoop::RunImpl::ProcessEvents() { -#if defined(__ANDROID__) +#ifdef __ANDROID__ // Collect first all readable file descriptors into a separate vector and // then iterate over it to invoke callbacks. Iterating directly over // loop.m_read_fds is not possible because the callbacks can modify the diff --git a/lldb/source/Host/common/Socket.cpp b/lldb/source/Host/common/Socket.cpp index f4037da059e5..4bcf34a6b456 100644 --- a/lldb/source/Host/common/Socket.cpp +++ b/lldb/source/Host/common/Socket.cpp @@ -38,7 +38,7 @@ #include "lldb/Host/linux/AbstractSocket.h" #endif -#if defined(__ANDROID__) +#ifdef __ANDROID__ #include #include #include diff --git a/lldb/source/Host/common/TCPSocket.cpp b/lldb/source/Host/common/TCPSocket.cpp index c9f4db5fae49..ea7377edbd45 100644 --- a/lldb/source/Host/common/TCPSocket.cpp +++ b/lldb/source/Host/common/TCPSocket.cpp @@ -162,8 +162,6 @@ Status TCPSocket::Connect(llvm::StringRef name) { std::vector addresses = SocketAddress::GetAddressInfo( host_str.c_str(), nullptr, AF_UNSPEC, SOCK_STREAM, IPPROTO_TCP); - llvm::partition(addresses, - [](auto &sa) { return sa.GetFamily() == AF_INET; }); for (SocketAddress &address : addresses) { error = CreateSocket(address.GetFamily()); if (error.Fail()) diff --git a/lldb/source/Host/ohos/HostInfoOHOS.cpp b/lldb/source/Host/ohos/HostInfoOHOS.cpp deleted file mode 100644 index e47d26e3e938..000000000000 --- a/lldb/source/Host/ohos/HostInfoOHOS.cpp +++ /dev/null @@ -1,94 +0,0 @@ -//===-- HostInfoOHOS.cpp -------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#include "lldb/Host/ohos/HostInfoOHOS.h" -#include "lldb/Host/FileSystem.h" -#include "lldb/Host/linux/HostInfoLinux.h" -#include "llvm/ADT/SmallVector.h" -#include "llvm/ADT/StringRef.h" - -using namespace lldb_private; -using namespace llvm; - -void HostInfoOHOS::ComputeHostArchitectureSupport(ArchSpec &arch_32, - ArchSpec &arch_64) { - HostInfoLinux::ComputeHostArchitectureSupport(arch_32, arch_64); - - if (arch_32.IsValid()) { - arch_32.GetTriple().setEnvironment(llvm::Triple::UnknownEnvironment); - } - if (arch_64.IsValid()) { - arch_64.GetTriple().setEnvironment(llvm::Triple::UnknownEnvironment); - } -} - -FileSpec HostInfoOHOS::GetDefaultShell() { - return FileSpec("/system/bin/sh"); -} - -FileSpec HostInfoOHOS::ResolveLibraryPath(const std::string &module_path, - const ArchSpec &arch) { - static const char *const ld_library_path_separator = ":"; - static const char *const default_lib32_path[] = {"/vendor/lib", "/system/lib", - nullptr}; - static const char *const default_lib64_path[] = {"/vendor/lib64", - "/system/lib64", nullptr}; - - if (module_path.empty() || module_path[0] == '/') { - FileSpec file_spec(module_path.c_str()); - FileSystem::Instance().Resolve(file_spec); - return file_spec; - } - - SmallVector ld_paths; - - if (const char *ld_library_path = ::getenv("LD_LIBRARY_PATH")) - StringRef(ld_library_path) - .split(ld_paths, StringRef(ld_library_path_separator), -1, false); - - const char *const *default_lib_path = nullptr; - switch (arch.GetAddressByteSize()) { - case 4: - default_lib_path = default_lib32_path; - break; - case 8: - default_lib_path = default_lib64_path; - break; - default: - assert(false && "Unknown address byte size"); - return FileSpec(); - } - - for (const char *const *it = default_lib_path; *it; ++it) - ld_paths.push_back(StringRef(*it)); - - for (const StringRef &path : ld_paths) { - FileSpec file_candidate(path.str().c_str()); - FileSystem::Instance().Resolve(file_candidate); - file_candidate.AppendPathComponent(module_path.c_str()); - - if (FileSystem::Instance().Exists(file_candidate)) - return file_candidate; - } - - return FileSpec(); -} - -bool HostInfoOHOS::ComputeTempFileBaseDirectory(FileSpec &file_spec) { - bool success = HostInfoLinux::ComputeTempFileBaseDirectory(file_spec); - - // On OHOS, there is no path which is guaranteed to be writable. If the - // user has not provided a path via an environment variable, the generic - // algorithm will deduce /tmp, which is plain wrong. In that case we have an - // invalid directory, we substitute the path with /data/local/tmp, which is - // correct at least in some cases (i.e., when running as shell user). - if (!success || !FileSystem::Instance().Exists(file_spec)) - file_spec = FileSpec("/data/local/tmp"); - - return FileSystem::Instance().Exists(file_spec); -} diff --git a/lldb/source/Host/posix/DomainSocket.cpp b/lldb/source/Host/posix/DomainSocket.cpp index 97e8d4859e14..5a396906fdf6 100644 --- a/lldb/source/Host/posix/DomainSocket.cpp +++ b/lldb/source/Host/posix/DomainSocket.cpp @@ -18,7 +18,7 @@ using namespace lldb; using namespace lldb_private; -#if defined(__ANDROID__) +#ifdef __ANDROID__ // Android does not have SUN_LEN #ifndef SUN_LEN #define SUN_LEN(ptr) \ diff --git a/lldb/source/Host/posix/HostInfoPosix.cpp b/lldb/source/Host/posix/HostInfoPosix.cpp index cbfdf60a0a0a..7e110f07d7cf 100644 --- a/lldb/source/Host/posix/HostInfoPosix.cpp +++ b/lldb/source/Host/posix/HostInfoPosix.cpp @@ -86,7 +86,7 @@ llvm::Optional PosixUserIDResolver::DoGetUserName(id_t uid) { } llvm::Optional PosixUserIDResolver::DoGetGroupName(id_t gid) { -#if !defined(__ANDROID__) && !defined(__OHOS_FAMILY__) +#ifndef __ANDROID__ char group_buffer[PATH_MAX]; size_t group_buffer_size = sizeof(group_buffer); struct group group_info; diff --git a/lldb/source/Host/posix/ProcessLauncherPosixFork.cpp b/lldb/source/Host/posix/ProcessLauncherPosixFork.cpp index de622473272a..35482341d3e6 100644 --- a/lldb/source/Host/posix/ProcessLauncherPosixFork.cpp +++ b/lldb/source/Host/posix/ProcessLauncherPosixFork.cpp @@ -38,7 +38,7 @@ using namespace lldb; using namespace lldb_private; static void FixupEnvironment(Environment &env) { -#if defined(__ANDROID__) +#ifdef __ANDROID__ // If there is no PATH variable specified inside the environment then set the // path to /system/bin. It is required because the default path used by // execve() is wrong on android. diff --git a/lldb/source/Interpreter/OptionGroupPlatform.cpp b/lldb/source/Interpreter/OptionGroupPlatform.cpp index ebe3b895c78d..4242e010fa64 100644 --- a/lldb/source/Interpreter/OptionGroupPlatform.cpp +++ b/lldb/source/Interpreter/OptionGroupPlatform.cpp @@ -19,16 +19,10 @@ PlatformSP OptionGroupPlatform::CreatePlatformWithOptions( CommandInterpreter &interpreter, const ArchSpec &arch, bool make_selected, Status &error, ArchSpec &platform_arch) const { PlatformSP platform_sp; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_COMMANDS)); + if (!m_platform_name.empty()) { platform_sp = Platform::Create(ConstString(m_platform_name.c_str()), error); if (platform_sp) { - if (GetContainer()) { - if (log) { - LLDB_LOGF(log, "Platform is created inside container."); - } - platform_sp->SetContainer(true); - } if (platform_arch.IsValid() && !platform_sp->IsCompatibleArchitecture(arch, false, &platform_arch)) { error.SetErrorStringWithFormat("platform '%s' doesn't support '%s'", @@ -64,7 +58,6 @@ void OptionGroupPlatform::OptionParsingStarting( m_sdk_sysroot.Clear(); m_sdk_build.Clear(); m_os_version = llvm::VersionTuple(); - m_container = false; } static constexpr OptionDefinition g_option_table[] = { @@ -99,6 +92,7 @@ OptionGroupPlatform::SetOptionValue(uint32_t option_idx, ++option_idx; const int short_option = g_option_table[option_idx].short_option; + switch (short_option) { case 'p': m_platform_name.assign(std::string(option_arg)); @@ -140,10 +134,6 @@ bool OptionGroupPlatform::PlatformMatches( if (!m_os_version.empty() && m_os_version != platform_sp->GetOSVersion()) return false; - - if (m_container != platform_sp->GetContainer()) - return false; - return true; } return false; diff --git a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp index a1e985442f67..160faa74af23 100644 --- a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp +++ b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp @@ -23,7 +23,6 @@ #include "lldb/Target/ThreadPlanRunToAddress.h" #include "lldb/Utility/Log.h" #include "lldb/Utility/ProcessInfo.h" -#include "llvm/Support/ThreadPool.h" #include @@ -443,18 +442,14 @@ void DynamicLoaderPOSIXDYLD::RefreshModules() { if (module_sp->GetObjectFile()->GetBaseAddress().GetLoadAddress( &m_process->GetTarget()) == m_interpreter_base && module_sp != m_interpreter_module.lock()) { - if (m_interpreter_module.lock() == nullptr) { - m_interpreter_module = module_sp; - } else { - // If this is a duplicate instance of ld.so, unload it. We may end - // up with it if we load it via a different path than before - // (symlink vs real path). - // TODO: remove this once we either fix library matching or avoid - // loading the interpreter when setting the rendezvous breakpoint. - UnloadSections(module_sp); - loaded_modules.Remove(module_sp); - continue; - } + // If this is a duplicate instance of ld.so, unload it. We may end up + // with it if we load it via a different path than before (symlink + // vs real path). + // TODO: remove this once we either fix library matching or avoid + // loading the interpreter when setting the rendezvous breakpoint. + UnloadSections(module_sp); + loaded_modules.Remove(module_sp); + continue; } loaded_modules.AppendIfNeeded(module_sp); @@ -608,28 +603,23 @@ void DynamicLoaderPOSIXDYLD::LoadAllCurrentModules() { m_process->PrefetchModuleSpecs( module_names, m_process->GetTarget().GetArchitecture().GetTriple()); - llvm::ThreadPool pool(llvm::hardware_concurrency(DynamicLoaderPOSIXDYLD::DYLD_CONCURRENCY_THREADING)); for (I = m_rendezvous.begin(), E = m_rendezvous.end(); I != E; ++I) { - pool.async([&](const FileSpec &file_spec, addr_t link_addr, addr_t base_addr) { + ModuleSP module_sp = + LoadModuleAtAddress(I->file_spec, I->link_addr, I->base_addr, true); + if (module_sp.get()) { + LLDB_LOG(log, "LoadAllCurrentModules loading module: {0}", + I->file_spec.GetFilename()); + module_list.Append(module_sp); + } else { Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); - ModuleSP module_sp = - LoadModuleAtAddress(file_spec, link_addr, base_addr, true); - if (module_sp.get()) { - LLDB_LOGF(log, "LoadAllCurrentModules loading module: %s", file_spec.GetFilename().GetCString()); - module_list.Append(module_sp); - } else { - LLDB_LOGF( - log, - "DynamicLoaderPOSIXDYLD:: failed loading module %s at 0x%" PRIx64, - file_spec.GetCString(), base_addr); - } - }, I->file_spec, I->link_addr, I->base_addr); + LLDB_LOGF( + log, + "DynamicLoaderPOSIXDYLD::%s failed loading module %s at 0x%" PRIx64, + __FUNCTION__, I->file_spec.GetCString(), I->base_addr); + } } - pool.wait(); - m_process->GetTarget().ModulesDidLoad(module_list); - m_initial_modules_added = true; } addr_t DynamicLoaderPOSIXDYLD::ComputeLoadOffset() { diff --git a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h index c52e211b798d..61567801fdd0 100644 --- a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h +++ b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h @@ -88,9 +88,6 @@ protected: std::map> m_loaded_modules; - /// number of woker in ThreadPool - static constexpr int DYLD_CONCURRENCY_THREADING {3}; - /// If possible sets a breakpoint on a function called by the runtime /// linker each time a module is loaded or unloaded. bool SetRendezvousBreakpoint(); diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp index 7e0da5663b37..9be294750fa0 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp @@ -519,7 +519,7 @@ CppModuleConfiguration GetModuleConfig(lldb::LanguageType language, // Try to create a configuration from the files. If there is no valid // configuration possible with the files, this just returns an invalid // configuration. - return CppModuleConfiguration(files, target->GetArchitecture().GetTriple()); + return CppModuleConfiguration(files); } bool ClangUserExpression::PrepareForParsing( diff --git a/lldb/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.cpp b/lldb/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.cpp index 7148a7c236d6..ffab16b1682b 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.cpp @@ -10,7 +10,6 @@ #include "ClangHost.h" #include "lldb/Host/FileSystem.h" -#include "llvm/ADT/Triple.h" using namespace lldb_private; @@ -31,29 +30,7 @@ bool CppModuleConfiguration::SetOncePath::TrySet(llvm::StringRef path) { return false; } -static std::string targetSpecificIncludePath(const llvm::Triple &triple) { - if (triple.getArchName().empty() || triple.getOSAndEnvironmentName().empty()) - return ""; - return ("/usr/include/" + triple.getArchName() + "-" + - triple.getOSAndEnvironmentName()) - .str(); -} - -static bool guessIncludePath(llvm::StringRef pathToFile, - llvm::StringRef pattern, llvm::StringRef &result) { - result = llvm::StringRef(); - if (pattern.empty()) - return false; - size_t pos = pathToFile.find(pattern); - if (pos == llvm::StringRef::npos) - return false; - - result = pathToFile.substr(0, pos + pattern.size()); - return true; -} - -bool CppModuleConfiguration::analyzeFile(const FileSpec &f, - const llvm::Triple &triple) { +bool CppModuleConfiguration::analyzeFile(const FileSpec &f) { using namespace llvm::sys::path; // Convert to slashes to make following operations simpler. std::string dir_buffer = convert_to_slash(f.GetDirectory().GetStringRef()); @@ -69,12 +46,12 @@ bool CppModuleConfiguration::analyzeFile(const FileSpec &f, return m_std_inc.TrySet(posix_dir); } - llvm::StringRef inc_path; - // Target specific path contains /usr/include, so we check it first - if (guessIncludePath(posix_dir, targetSpecificIncludePath(triple), inc_path)) - return m_c_target_inc.TrySet(inc_path); - if (guessIncludePath(posix_dir, "/usr/include", inc_path)) - return m_c_inc.TrySet(inc_path); + // Check for /usr/include. On Linux this might be /usr/include/bits, so + // we should remove that '/bits' suffix to get the actual include directory. + if (posix_dir.endswith("/usr/include/bits")) + posix_dir.consume_back("/bits"); + if (posix_dir.endswith("/usr/include")) + return m_c_inc.TrySet(posix_dir); // File wasn't interesting, continue analyzing. return true; @@ -115,11 +92,11 @@ bool CppModuleConfiguration::hasValidConfig() { } CppModuleConfiguration::CppModuleConfiguration( - const FileSpecList &support_files, const llvm::Triple &triple) { + const FileSpecList &support_files) { // Analyze all files we were given to build the configuration. bool error = !llvm::all_of(support_files, std::bind(&CppModuleConfiguration::analyzeFile, - this, std::placeholders::_1, triple)); + this, std::placeholders::_1)); // If we have a valid configuration at this point, set the // include directories and module list that should be used. if (!error && hasValidConfig()) { @@ -132,8 +109,6 @@ CppModuleConfiguration::CppModuleConfiguration( // This order matches the way Clang orders these directories. m_include_dirs = {m_std_inc.Get().str(), m_resource_inc, m_c_inc.Get().str()}; - if (m_c_target_inc.Valid()) - m_include_dirs.push_back(m_c_target_inc.Get().str()); m_imported_modules = {"std"}; } } diff --git a/lldb/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.h b/lldb/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.h index 60199005b6ba..b984db43fa6d 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.h +++ b/lldb/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.h @@ -44,9 +44,6 @@ class CppModuleConfiguration { SetOncePath m_std_inc; /// If valid, the include path to the C library (e.g. /usr/include). SetOncePath m_c_inc; - /// If valid, the include path to target-specific C library files - /// (e.g. /usr/include/x86_64-linux-gnu). - SetOncePath m_c_target_inc; /// The Clang resource include path for this configuration. std::string m_resource_inc; @@ -56,12 +53,11 @@ class CppModuleConfiguration { /// Analyze a given source file to build the current configuration. /// Returns false iff there was a fatal error that makes analyzing any /// further files pointless as the configuration is now invalid. - bool analyzeFile(const FileSpec &f, const llvm::Triple &triple); + bool analyzeFile(const FileSpec &f); public: /// Creates a configuration by analyzing the given list of used source files. - explicit CppModuleConfiguration(const FileSpecList &support_files, - const llvm::Triple &triple); + explicit CppModuleConfiguration(const FileSpecList &support_files); /// Creates an empty and invalid configuration. CppModuleConfiguration() {} diff --git a/lldb/source/Plugins/Platform/CMakeLists.txt b/lldb/source/Plugins/Platform/CMakeLists.txt index c312beb80b7c..5f284e517dca 100644 --- a/lldb/source/Plugins/Platform/CMakeLists.txt +++ b/lldb/source/Plugins/Platform/CMakeLists.txt @@ -15,5 +15,3 @@ add_subdirectory(POSIX) add_subdirectory(gdb-server) add_subdirectory(Android) -add_subdirectory(HOS) -add_subdirectory(OHOS) diff --git a/lldb/source/Plugins/Platform/HOS/CMakeLists.txt b/lldb/source/Plugins/Platform/HOS/CMakeLists.txt deleted file mode 100644 index ec9e85def9f5..000000000000 --- a/lldb/source/Plugins/Platform/HOS/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -add_lldb_library(lldbPluginPlatformHOS PLUGIN HdcClient.cpp PlatformHOS.cpp - PlatformHOSRemoteGDBServer.cpp LINK_LIBS lldbCore - lldbHost lldbPluginPlatformLinux lldbPluginPlatformGDB - LINK_COMPONENTS Support) diff --git a/lldb/source/Plugins/Platform/HOS/HdcClient.cpp b/lldb/source/Plugins/Platform/HOS/HdcClient.cpp deleted file mode 100644 index 609673b19b2c..000000000000 --- a/lldb/source/Plugins/Platform/HOS/HdcClient.cpp +++ /dev/null @@ -1,808 +0,0 @@ -//===-- HdcClient.cpp -------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#include "HdcClient.h" - -#include "llvm/ADT/STLExtras.h" -#include "llvm/ADT/SmallVector.h" -#include "llvm/ADT/StringRef.h" -#include "llvm/Support/FileUtilities.h" - -#include "lldb/Host/ConnectionFileDescriptor.h" -#include "lldb/Host/FileSystem.h" -#include "lldb/Host/PosixApi.h" -#include "lldb/Utility/DataBuffer.h" -#include "lldb/Utility/DataBufferHeap.h" -#include "lldb/Utility/DataEncoder.h" -#include "lldb/Utility/DataExtractor.h" -#include "lldb/Utility/FileSpec.h" -#include "lldb/Utility/Log.h" -#include "lldb/Utility/StreamString.h" -#include "lldb/Utility/Timeout.h" - -#include - -#include -#include -#include -#include - -// On Windows, transitive dependencies pull in , which defines a -// macro that clashes with a method name. -#ifdef SendMessage -#undef SendMessage -#endif - -using namespace lldb; -using namespace lldb_private; -using namespace lldb_private::platform_hos; -using namespace std::chrono; - -namespace { - -const seconds kReadTimeout(20); -const char *kOKAY = "OKAY"; -const char *kFAIL = "FAIL"; -const char *kDATA = "DATA"; -const char *kDONE = "DONE"; - -const char *kSEND = "SEND"; -const char *kRECV = "RECV"; -const char *kSTAT = "STAT"; - -const size_t kSyncPacketLen = 8; -// Maximum size of a filesync DATA packet. -const size_t kMaxPushData = 2 * 1024; -// Default mode for pushed files. -const uint32_t kDefaultMode = 0100770; // S_IFREG | S_IRWXU | S_IRWXG - -const char *kSocketNamespaceAbstract = "localabstract"; -const char *kSocketNamespaceFileSystem = "localfilesystem"; - -Status ReadAllBytes(Connection &conn, void *buffer, size_t size) { - - Status error; - ConnectionStatus status; - char *read_buffer = static_cast(buffer); - - auto now = steady_clock::now(); - const auto deadline = now + kReadTimeout; - size_t total_read_bytes = 0; - while (total_read_bytes < size && now < deadline) { - auto read_bytes = - conn.Read(read_buffer + total_read_bytes, size - total_read_bytes, - duration_cast(deadline - now), status, &error); - if (error.Fail()) - return error; - total_read_bytes += read_bytes; - if (status != eConnectionStatusSuccess) - break; - now = steady_clock::now(); - } - if (total_read_bytes < size) - error = Status( - "Unable to read requested number of bytes. Connection status: %d.", - status); - return error; -} - -} // namespace - -Status HdcClient::CreateByDeviceID(const std::string &device_id, - HdcClient &hdc) { - DeviceIDList connect_devices; - auto error = hdc.GetDevices(connect_devices); - if (error.Fail()) - return error; - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); - if (log) { - LLDB_LOGF(log, "Hsu file(%s):%d HdcClient::%s device_id(%s)", __FILE__, - __LINE__, __FUNCTION__, device_id.c_str()); - } - std::string android_serial; - if (!device_id.empty()) - android_serial = device_id; - else if (const char *env_serial = std::getenv("ANDROID_SERIAL")) - android_serial = env_serial; - - if (android_serial.empty()) { - if (connect_devices.size() != 1) - return Status("Expected a single connected device, got instead %zu - try " - "setting 'ANDROID_SERIAL'", - connect_devices.size()); - hdc.SetDeviceID(connect_devices.front()); - } else { - auto find_it = std::find(connect_devices.begin(), connect_devices.end(), - android_serial); - if (find_it == connect_devices.end()) - return Status("Device \"%s\" not found", android_serial.c_str()); - - hdc.SetDeviceID(*find_it); - } - return error; -} - -HdcClient::HdcClient() {} - -HdcClient::HdcClient(const std::string &device_id) : m_device_id(device_id) {} - -HdcClient::~HdcClient() {} - -void HdcClient::SetDeviceID(const std::string &device_id) { - m_device_id = device_id; - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); - if (log) { - LLDB_LOGF(log, "Hsu file(%s):%d HdcClient::%s m_device_id(%s)", __FILE__, - __LINE__, __FUNCTION__, m_device_id.c_str()); - } -} - -const std::string &HdcClient::GetDeviceID() const { return m_device_id; } - -Status HdcClient::Connect() { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); - if (log) { - log->Printf("Hsu file(%s):%d HdcClient::%s new ConnectionFileDescriptor", - __FILE__, __LINE__, __FUNCTION__); - } - Status error; - m_conn.reset(new ConnectionFileDescriptor); - std::string port = "5037"; - - const char *env_port = std::getenv("HDC_SERVER_PORT"); - if ((env_port != NULL) && (atoi(env_port) > 0)) { - port = env_port; - if (log) { - log->Printf("Hsu file(%s):%d HdcClient::%s env_port(%s) port(%s)", - __FILE__, __LINE__, __FUNCTION__, env_port, port.c_str()); - } - } - - std::string uri = "connect://127.0.0.1:" + port; - if (log) { - log->Printf("Hsu file(%s):%d HdcClient::%s uri(%s)", __FILE__, __LINE__, - __FUNCTION__, uri.c_str()); - } - m_conn->Connect(uri.c_str(), &error); - - return error; -} - -Status HdcClient::GetDevices(DeviceIDList &device_list) { - device_list.clear(); - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); - if (log) { - log->Printf("Hsu file(%s):%d HdcClient::%s call", __FILE__, __LINE__, - __FUNCTION__); - } - auto error = SendMessage("host:devices"); - if (error.Fail()) - return error; - - error = ReadResponseStatus(); - if (error.Fail()) - return error; - - std::vector in_buffer; - error = ReadMessage(in_buffer); - - llvm::StringRef response(&in_buffer[0], in_buffer.size()); - llvm::SmallVector devices; - response.split(devices, "\n", -1, false); - - for (const auto &device : devices) - device_list.push_back(device.split('\t').first.str()); - - // Force disconnect since hdc closes connection after host:devices response - // is sent. - m_conn.reset(); - return error; -} - -Status HdcClient::SetPortForwarding(const uint16_t local_port, - const uint16_t remote_port) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); - if (log) { - log->Printf("Hsu file(%s):%d HdcClient::%s local_port(%d) remote_port(%d)", - __FILE__, __LINE__, __FUNCTION__, local_port, remote_port); - } - char message[48]; - snprintf(message, sizeof(message), "forward:tcp:%d;tcp:%d", local_port, - remote_port); - - if (log) { - log->Printf("Hsu file(%s):%d HdcClient::%s message(%s)", __FILE__, __LINE__, - __FUNCTION__, message); - } - const auto error = SendDeviceMessage(message); - if (error.Fail()) - return error; - - return ReadResponseStatus(); -} - -Status -HdcClient::SetPortForwarding(const uint16_t local_port, - llvm::StringRef remote_socket_name, - const UnixSocketNamespace socket_namespace) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); - if (log) { - log->Printf("Hsu file(%s):%d HdcClient::%s local_port(%d)", __FILE__, - __LINE__, __FUNCTION__, local_port); - } - char message[PATH_MAX]; - const char *sock_namespace_str = - (socket_namespace == UnixSocketNamespaceAbstract) - ? kSocketNamespaceAbstract - : kSocketNamespaceFileSystem; - snprintf(message, sizeof(message), "forward:tcp:%d;%s:%s", local_port, - sock_namespace_str, remote_socket_name.str().c_str()); - - if (log) { - log->Printf("Hsu file(%s):%d HdcClient::%s message(%s)", __FILE__, __LINE__, - __FUNCTION__, message); - } - const auto error = SendDeviceMessage(message); - if (error.Fail()) - return error; - - return ReadResponseStatus(); -} - -Status HdcClient::DeletePortForwarding(const uint16_t local_port) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); - if (log) { - log->Printf("Hsu file(%s):%d HdcClient::%s local_port(%d)", __FILE__, - __LINE__, __FUNCTION__, local_port); - } - char message[32]; - snprintf(message, sizeof(message), "killforward:tcp:%d", local_port); - - if (log) { - log->Printf("Hsu file(%s):%d HdcClient::%s message(%s)", __FILE__, __LINE__, - __FUNCTION__, message); - } - const auto error = SendDeviceMessage(message); - if (error.Fail()) - return error; - - return ReadResponseStatus(); -} - -Status HdcClient::SendMessage(const std::string &packet, const bool reconnect) { - Status error; - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); - if (log) { - log->Printf("Hsu file(%s):%d HdcClient::%s packet(%s) reconnect(%d)", - __FILE__, __LINE__, __FUNCTION__, packet.c_str(), reconnect); - } - if (!m_conn || reconnect) { - error = Connect(); - if (error.Fail()) - return error; - } - - char length_buffer[5]; - snprintf(length_buffer, sizeof(length_buffer), "%04x", - static_cast(packet.size())); - - ConnectionStatus status; - - m_conn->Write(length_buffer, 4, status, &error); - if (error.Fail()) - return error; - - m_conn->Write(packet.c_str(), packet.size(), status, &error); - return error; -} - -Status HdcClient::SendDeviceMessage(const std::string &packet) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); - if (log) { - log->Printf("Hsu file(%s):%d HdcClient::%s packet(%s) ", __FILE__, __LINE__, - __FUNCTION__, packet.c_str()); - } - std::ostringstream msg; - msg << "host-serial:" << m_device_id << ":" << packet; - if (log) { - log->Printf("Hsu file(%s):%d HdcClient::%s msg(%s) ", __FILE__, __LINE__, - __FUNCTION__, msg.str().c_str()); - } - return SendMessage(msg.str()); -} - -Status HdcClient::ReadMessage(std::vector &message) { - message.clear(); - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); - if (log) { - log->Printf("Hsu file(%s):%d HdcClient::%s call ", __FILE__, __LINE__, - __FUNCTION__); - } - char buffer[5]; - buffer[4] = 0; - - auto error = ReadAllBytes(buffer, 4); - if (error.Fail()) - return error; - - unsigned int packet_len = 0; - sscanf(buffer, "%x", &packet_len); - - message.resize(packet_len, 0); - error = ReadAllBytes(&message[0], packet_len); - if (error.Fail()) - message.clear(); - - return error; -} - -Status HdcClient::ReadMessageStream(std::vector &message, - milliseconds timeout) { - auto start = steady_clock::now(); - message.clear(); - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); - if (log) { - log->Printf("Hsu file(%s):%d HdcClient::%s call ", __FILE__, __LINE__, - __FUNCTION__); - } - Status error; - lldb::ConnectionStatus status = lldb::eConnectionStatusSuccess; - char buffer[1024]; - while (error.Success() && status == lldb::eConnectionStatusSuccess) { - auto end = steady_clock::now(); - auto elapsed = end - start; - if (elapsed >= timeout) - return Status("Timed out"); - - size_t n = m_conn->Read(buffer, sizeof(buffer), - duration_cast(timeout - elapsed), - status, &error); - if (n > 0) - message.insert(message.end(), &buffer[0], &buffer[n]); - } - return error; -} - -Status HdcClient::ReadResponseStatus() { - char response_id[5]; - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); - static const size_t packet_len = 4; - response_id[packet_len] = 0; - - auto error = ReadAllBytes(response_id, packet_len); - if (error.Fail()) - return error; - - if (log) { - log->Printf("Hsu file(%s):%d HdcClient::%s response_id(%s) ", __FILE__, - __LINE__, __FUNCTION__, response_id); - } - if (strncmp(response_id, kOKAY, packet_len) != 0) - return GetResponseError(response_id); - - return error; -} - -Status HdcClient::GetResponseError(const char *response_id) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); - if (strcmp(response_id, kFAIL) != 0) - return Status("Got unexpected response id from hdc: \"%s\"", response_id); - if (log) { - log->Printf("Hsu file(%s):%d HdcClient::%s response_id(%s) ", __FILE__, - __LINE__, __FUNCTION__, response_id); - } - std::vector error_message; - auto error = ReadMessage(error_message); - if (error.Success()) - error.SetErrorString( - std::string(&error_message[0], error_message.size()).c_str()); - - return error; -} - -Status HdcClient::SwitchDeviceTransport() { - std::ostringstream msg; - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); - msg << "host:transport:" << m_device_id; - - auto error = SendMessage(msg.str()); - if (error.Fail()) - return error; - if (log) { - log->Printf("Hsu file(%s):%d HdcClient::%s m_device_id(%s) msg(%s)", - __FILE__, __LINE__, __FUNCTION__, m_device_id.c_str(), - msg.str().c_str()); - } - return ReadResponseStatus(); -} - -Status HdcClient::StartSync() { - auto error = SwitchDeviceTransport(); - if (error.Fail()) - return Status("Failed to switch to device transport: %s", - error.AsCString()); - - error = Sync(); - if (error.Fail()) - return Status("Sync failed: %s", error.AsCString()); - - return error; -} - -Status HdcClient::Sync() { - auto error = SendMessage("sync:", false); - if (error.Fail()) - return error; - - return ReadResponseStatus(); -} - -Status HdcClient::ReadAllBytes(void *buffer, size_t size) { - return ::ReadAllBytes(*m_conn, buffer, size); -} - -Status HdcClient::internalShell(const char *command, milliseconds timeout, - std::vector &output_buf) { - output_buf.clear(); - - auto error = SwitchDeviceTransport(); - if (error.Fail()) - return Status("Failed to switch to device transport: %s", - error.AsCString()); - - StreamString hdc_command; - hdc_command.Printf("shell:%s", command); - error = SendMessage(hdc_command.GetString().str(), false); - if (error.Fail()) - return error; - - error = ReadResponseStatus(); - if (error.Fail()) - return error; - - error = ReadMessageStream(output_buf, timeout); - if (error.Fail()) - return error; - - // HDC doesn't propagate return code of shell execution - if - // output starts with /system/bin/sh: most likely command failed. - static const char *kShellPrefix = "/system/bin/sh:"; - if (output_buf.size() > strlen(kShellPrefix)) { - if (!memcmp(&output_buf[0], kShellPrefix, strlen(kShellPrefix))) - return Status("Shell command %s failed: %s", command, - std::string(output_buf.begin(), output_buf.end()).c_str()); - } - - return Status(); -} - -Status HdcClient::Shell(const char *command, milliseconds timeout, - std::string *output) { - std::vector output_buffer; - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); - if (log) { - LLDB_LOGF(log, "Hsu file(%s):%d HdcClient::%s command(%s)", __FILE__, - __LINE__, __FUNCTION__, command); - } - auto error = internalShell(command, timeout, output_buffer); - if (error.Fail()) - return error; - - if (output) - output->assign(output_buffer.begin(), output_buffer.end()); - return error; -} - -Status HdcClient::ShellToFile(const char *command, milliseconds timeout, - const FileSpec &output_file_spec) { - std::vector output_buffer; - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); - if (log) { - LLDB_LOGF(log, "Hsu file(%s):%d HdcClient::%s command(%s)", __FILE__, - __LINE__, __FUNCTION__, command); - } - auto error = internalShell(command, timeout, output_buffer); - if (error.Fail()) - return error; - - const auto output_filename = output_file_spec.GetPath(); - std::error_code EC; - llvm::raw_fd_ostream dst(output_filename, EC, llvm::sys::fs::OF_None); - if (log) { - LLDB_LOGF(log, "Hsu file(%s):%d HdcClient::%s output_filename(%s)", - __FILE__, __LINE__, __FUNCTION__, output_filename.c_str()); - } - if (EC) - return Status("Unable to open local file %s", output_filename.c_str()); - - dst.write(&output_buffer[0], output_buffer.size()); - dst.close(); - if (dst.has_error()) - return Status("Failed to write file %s", output_filename.c_str()); - return Status(); -} - -std::unique_ptr -HdcClient::GetSyncService(Status &error) { - std::unique_ptr sync_service; - error = StartSync(); - if (error.Success()) - sync_service.reset(new SyncService(std::move(m_conn))); - - return sync_service; -} - -Status HdcClient::SyncService::internalPullFile(const FileSpec &remote_file, - const FileSpec &local_file) { - const auto local_file_path = local_file.GetPath(); - llvm::FileRemover local_file_remover(local_file_path); - - std::error_code EC; - llvm::raw_fd_ostream dst(local_file_path, EC, llvm::sys::fs::OF_None); - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); - if (log) { - LLDB_LOGF(log, "Hsu file(%s):%d HdcClient::%s local_file_path(%s)", - __FILE__, __LINE__, __FUNCTION__, local_file_path.c_str()); - } - if (EC) - return Status("Unable to open local file %s", local_file_path.c_str()); - - const auto remote_file_path = remote_file.GetPath(false); - auto error = SendSyncRequest(kRECV, remote_file_path.length(), - remote_file_path.c_str()); - if (log) { - LLDB_LOGF(log, "Hsu file(%s):%d HdcClient::%s remote_file_path(%s)", - __FILE__, __LINE__, __FUNCTION__, remote_file_path.c_str()); - } - if (error.Fail()) - return error; - - std::vector chunk; - bool eof = false; - while (!eof) { - error = PullFileChunk(chunk, eof); - if (error.Fail()) - return error; - if (!eof) - dst.write(&chunk[0], chunk.size()); - } - dst.close(); - if (dst.has_error()) - return Status("Failed to write file %s", local_file_path.c_str()); - - local_file_remover.releaseFile(); - return error; -} - -Status HdcClient::SyncService::internalPushFile(const FileSpec &local_file, - const FileSpec &remote_file) { - const auto local_file_path(local_file.GetPath()); - std::ifstream src(local_file_path.c_str(), std::ios::in | std::ios::binary); - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); - if (log) { - LLDB_LOGF(log, "Hsu file(%s):%d HdcClient::%s local_file_path(%s)", - __FILE__, __LINE__, __FUNCTION__, local_file_path.c_str()); - } - if (!src.is_open()) - return Status("Unable to open local file %s", local_file_path.c_str()); - - std::stringstream file_description; - file_description << remote_file.GetPath(false).c_str() << "," << kDefaultMode; - std::string file_description_str = file_description.str(); - auto error = SendSyncRequest(kSEND, file_description_str.length(), - file_description_str.c_str()); - if (log) { - LLDB_LOGF(log, "Hsu file(%s):%d HdcClient::%s file_description_str(%s)", - __FILE__, __LINE__, __FUNCTION__, file_description_str.c_str()); - } - if (error.Fail()) - return error; - - char chunk[kMaxPushData]; - while (!src.eof() && !src.read(chunk, kMaxPushData).bad()) { - size_t chunk_size = src.gcount(); - error = SendSyncRequest(kDATA, chunk_size, chunk); - if (error.Fail()) - return Status("Failed to send file chunk: %s", error.AsCString()); - } - error = SendSyncRequest( - kDONE, - llvm::sys::toTimeT( - FileSystem::Instance().GetModificationTime(local_file)), - nullptr); - if (error.Fail()) - return error; - - std::string response_id; - uint32_t data_len; - error = ReadSyncHeader(response_id, data_len); - if (error.Fail()) - return Status("Failed to read DONE response: %s", error.AsCString()); - if (response_id == kFAIL) { - std::string error_message(data_len, 0); - error = ReadAllBytes(&error_message[0], data_len); - if (error.Fail()) - return Status("Failed to read DONE error message: %s", error.AsCString()); - return Status("Failed to push file: %s", error_message.c_str()); - } else if (response_id != kOKAY) - return Status("Got unexpected DONE response: %s", response_id.c_str()); - - // If there was an error reading the source file, finish the hdc file - // transfer first so that hdc isn't expecting any more data. - if (src.bad()) - return Status("Failed read on %s", local_file_path.c_str()); - return error; -} - -Status HdcClient::SyncService::internalStat(const FileSpec &remote_file, - uint32_t &mode, uint32_t &size, - uint32_t &mtime) { - const std::string remote_file_path(remote_file.GetPath(false)); - auto error = SendSyncRequest(kSTAT, remote_file_path.length(), - remote_file_path.c_str()); - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); - if (log) { - LLDB_LOGF(log, "Hsu file(%s):%d HdcClient::%s remote_file_path(%s)", - __FILE__, __LINE__, __FUNCTION__, remote_file_path.c_str()); - } - if (error.Fail()) - return Status("Failed to send request: %s", error.AsCString()); - - static const size_t stat_len = strlen(kSTAT); - static const size_t response_len = stat_len + (sizeof(uint32_t) * 3); - - std::vector buffer(response_len); - error = ReadAllBytes(&buffer[0], buffer.size()); - if (error.Fail()) - return Status("Failed to read response: %s", error.AsCString()); - - DataExtractor extractor(&buffer[0], buffer.size(), eByteOrderLittle, - sizeof(void *)); - offset_t offset = 0; - - const void *command = extractor.GetData(&offset, stat_len); - if (!command) - return Status("Failed to get response command"); - const char *command_str = static_cast(command); - if (strncmp(command_str, kSTAT, stat_len)) - return Status("Got invalid stat command: %s", command_str); - - mode = extractor.GetU32(&offset); - size = extractor.GetU32(&offset); - mtime = extractor.GetU32(&offset); - return Status(); -} - -Status HdcClient::SyncService::PullFile(const FileSpec &remote_file, - const FileSpec &local_file) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); - if (log) { - LLDB_LOGF(log, - "Hsu file(%s):%d HdcClient::%s remote_file(%s) local_file(%s)", - __FILE__, __LINE__, __FUNCTION__, remote_file.GetPath().c_str(), - local_file.GetPath().c_str()); - } - return executeCommand([this, &remote_file, &local_file]() { - return internalPullFile(remote_file, local_file); - }); -} - -Status HdcClient::SyncService::PushFile(const FileSpec &local_file, - const FileSpec &remote_file) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); - if (log) { - LLDB_LOGF(log, - "Hsu file(%s):%d HdcClient::%s remote_file(%s) local_file(%s)", - __FILE__, __LINE__, __FUNCTION__, remote_file.GetPath().c_str(), - local_file.GetPath().c_str()); - } - return executeCommand([this, &local_file, &remote_file]() { - return internalPushFile(local_file, remote_file); - }); -} - -Status HdcClient::SyncService::Stat(const FileSpec &remote_file, uint32_t &mode, - uint32_t &size, uint32_t &mtime) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); - if (log) { - LLDB_LOGF(log, "Hsu file(%s):%d HdcClient::%s remote_file(%s) mode(%d)", - __FILE__, __LINE__, __FUNCTION__, remote_file.GetPath().c_str(), - mode); - } - return executeCommand([this, &remote_file, &mode, &size, &mtime]() { - return internalStat(remote_file, mode, size, mtime); - }); -} - -bool HdcClient::SyncService::IsConnected() const { - return m_conn && m_conn->IsConnected(); -} - -HdcClient::SyncService::SyncService(std::unique_ptr &&conn) - : m_conn(std::move(conn)) {} - -Status -HdcClient::SyncService::executeCommand(const std::function &cmd) { - if (!m_conn) - return Status("SyncService is disconnected"); - - const auto error = cmd(); - if (error.Fail()) - m_conn.reset(); - - return error; -} - -HdcClient::SyncService::~SyncService() {} - -Status HdcClient::SyncService::SendSyncRequest(const char *request_id, - const uint32_t data_len, - const void *data) { - const DataBufferSP data_sp(new DataBufferHeap(kSyncPacketLen, 0)); - DataEncoder encoder(data_sp, eByteOrderLittle, sizeof(void *)); - auto offset = encoder.PutData(0, request_id, strlen(request_id)); - encoder.PutUnsigned(offset, 4, data_len); - - Status error; - ConnectionStatus status; - m_conn->Write(data_sp->GetBytes(), kSyncPacketLen, status, &error); - if (error.Fail()) - return error; - - if (data) - m_conn->Write(data, data_len, status, &error); - return error; -} - -Status HdcClient::SyncService::ReadSyncHeader(std::string &response_id, - uint32_t &data_len) { - char buffer[kSyncPacketLen]; - - auto error = ReadAllBytes(buffer, kSyncPacketLen); - if (error.Success()) { - response_id.assign(&buffer[0], 4); - DataExtractor extractor(&buffer[4], 4, eByteOrderLittle, sizeof(void *)); - offset_t offset = 0; - data_len = extractor.GetU32(&offset); - } - - return error; -} - -Status HdcClient::SyncService::PullFileChunk(std::vector &buffer, - bool &eof) { - buffer.clear(); - - std::string response_id; - uint32_t data_len; - auto error = ReadSyncHeader(response_id, data_len); - if (error.Fail()) - return error; - - if (response_id == kDATA) { - buffer.resize(data_len, 0); - error = ReadAllBytes(&buffer[0], data_len); - if (error.Fail()) - buffer.clear(); - } else if (response_id == kDONE) { - eof = true; - } else if (response_id == kFAIL) { - std::string error_message(data_len, 0); - error = ReadAllBytes(&error_message[0], data_len); - if (error.Fail()) - return Status("Failed to read pull error message: %s", error.AsCString()); - return Status("Failed to pull file: %s", error_message.c_str()); - } else - return Status("Pull failed with unknown response: %s", response_id.c_str()); - - return Status(); -} - -Status HdcClient::SyncService::ReadAllBytes(void *buffer, size_t size) { - return ::ReadAllBytes(*m_conn, buffer, size); -} diff --git a/lldb/source/Plugins/Platform/HOS/HdcClient.h b/lldb/source/Plugins/Platform/HOS/HdcClient.h deleted file mode 100644 index 33d4370c9d02..000000000000 --- a/lldb/source/Plugins/Platform/HOS/HdcClient.h +++ /dev/null @@ -1,138 +0,0 @@ -//===-- HdcClient.h ---------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef liblldb_HdcClient_h_ -#define liblldb_HdcClient_h_ - -#include "lldb/Utility/Status.h" -#include -#include -#include -#include -#include -#include - -namespace lldb_private { - -class FileSpec; - -namespace platform_hos { - -class HdcClient { -public: - enum UnixSocketNamespace { - UnixSocketNamespaceAbstract, - UnixSocketNamespaceFileSystem, - }; - - using DeviceIDList = std::list; - - class SyncService { - friend class HdcClient; - - public: - ~SyncService(); - - Status PullFile(const FileSpec &remote_file, const FileSpec &local_file); - - Status PushFile(const FileSpec &local_file, const FileSpec &remote_file); - - Status Stat(const FileSpec &remote_file, uint32_t &mode, uint32_t &size, - uint32_t &mtime); - - bool IsConnected() const; - - private: - explicit SyncService(std::unique_ptr &&conn); - - Status SendSyncRequest(const char *request_id, const uint32_t data_len, - const void *data); - - Status ReadSyncHeader(std::string &response_id, uint32_t &data_len); - - Status PullFileChunk(std::vector &buffer, bool &eof); - - Status ReadAllBytes(void *buffer, size_t size); - - Status internalPullFile(const FileSpec &remote_file, - const FileSpec &local_file); - - Status internalPushFile(const FileSpec &local_file, - const FileSpec &remote_file); - - Status internalStat(const FileSpec &remote_file, uint32_t &mode, - uint32_t &size, uint32_t &mtime); - - Status executeCommand(const std::function &cmd); - - std::unique_ptr m_conn; - }; - - static Status CreateByDeviceID(const std::string &device_id, HdcClient &hdc); - HdcClient(); - explicit HdcClient(const std::string &device_id); - - ~HdcClient(); - const std::string &GetDeviceID() const; - - Status GetDevices(DeviceIDList &device_list); - - Status SetPortForwarding(const uint16_t local_port, - const uint16_t remote_port); - - Status SetPortForwarding(const uint16_t local_port, - llvm::StringRef remote_socket_name, - const UnixSocketNamespace socket_namespace); - - Status DeletePortForwarding(const uint16_t local_port); - - Status Shell(const char *command, std::chrono::milliseconds timeout, - std::string *output); - - Status ShellToFile(const char *command, std::chrono::milliseconds timeout, - const FileSpec &output_file_spec); - - std::unique_ptr GetSyncService(Status &error); - - Status SwitchDeviceTransport(); - -private: - Status Connect(); - - void SetDeviceID(const std::string &device_id); - - Status SendMessage(const std::string &packet, const bool reconnect = true); - - Status SendDeviceMessage(const std::string &packet); - - Status ReadMessage(std::vector &message); - - Status ReadMessageStream(std::vector &message, - std::chrono::milliseconds timeout); - - Status GetResponseError(const char *response_id); - - Status ReadResponseStatus(); - - Status Sync(); - - Status StartSync(); - - Status internalShell(const char *command, std::chrono::milliseconds timeout, - std::vector &output_buf); - - Status ReadAllBytes(void *buffer, size_t size); - - std::string m_device_id; - std::unique_ptr m_conn; -}; - -} // namespace platform_hos -} // namespace lldb_private - -#endif // liblldb_HdcClient_h_ diff --git a/lldb/source/Plugins/Platform/HOS/PlatformHOS.cpp b/lldb/source/Plugins/Platform/HOS/PlatformHOS.cpp deleted file mode 100644 index b295cdb9d2e5..000000000000 --- a/lldb/source/Plugins/Platform/HOS/PlatformHOS.cpp +++ /dev/null @@ -1,500 +0,0 @@ -//===-- PlatformHOS.cpp -----------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#include "lldb/Core/Module.h" -#include "lldb/Core/PluginManager.h" -#include "lldb/Core/Section.h" -#include "lldb/Core/ValueObject.h" -#include "lldb/Host/HostInfo.h" -#include "lldb/Host/StringConvert.h" -#include "lldb/Utility/Log.h" -#include "lldb/Utility/Scalar.h" -#include "lldb/Utility/UriParser.h" -#include "llvm/Config/config.h" - -#include "HdcClient.h" -#include "PlatformHOS.h" -#include "PlatformHOSRemoteGDBServer.h" -#if defined __MINGW32__ -// SetEnvironmentVariableA -#include -#endif - -using namespace lldb; -using namespace lldb_private; -// using namespace lldb_private::platform_android; -using namespace lldb_private::platform_hos; -using namespace std::chrono; -static uint32_t g_initialize_count = 0; -static const unsigned int g_hos_default_cache_size = 2048; -LLDB_PLUGIN_DEFINE(PlatformHOS) - -using PrefixMap = std::pair; - -static constexpr std::array PATH_PREFIX_MAP {{ - { "/data", "/data/ohos_data" }, - { "/vendor/aosp/system/lib64/libqdMetaData.system.so", "/system/system_ext/lib64/libqdMetaData.system.so"}, - { "/vendor/aosp/system/lib64/libgralloc.system.qti.so", "/system/system_ext/lib64/libgralloc.system.qti.so"}, - { "/vendor/aosp/vendor/lib64", "/vendor/lib64" }, - { "/vendor/aosp/system/lib64", "/system/lib64" }, - { "/vendor/lib64", "/system/ohos/vendor/lib64" }, - { "/system", "/system/ohos/system" }, -}}; - -static void platform_setenv(const char *env, const char *val) { -#if HAVE_SETENV || _MSC_VER - setenv(env, val, true); -#elif defined(__MINGW32__) - SetEnvironmentVariableA(env, val); -#else -#error "setenv not found" -#endif -} - -void PlatformHOS::Initialize() { - PlatformLinux::Initialize(); - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); - if (g_initialize_count++ == 0) { -#if defined(__HOS__) - PlatformSP default_platform_sp(new PlatformHOS(true)); - default_platform_sp->SetSystemArchitecture(HostInfo::GetArchitecture()); - Platform::SetHostPlatform(default_platform_sp); - if (log) { - LLDB_LOGF(log, "Hsu file(%s)%d PlatformHOS::%s new PlatformHOS(true)", - __FILE__, __LINE__, __FUNCTION__); - } -#endif - PluginManager::RegisterPlugin( - PlatformHOS::GetPluginNameStatic(false), - PlatformHOS::GetPluginDescriptionStatic(false), - PlatformHOS::CreateInstance); - } -} - -void PlatformHOS::Terminate() { - if (g_initialize_count > 0) { - if (--g_initialize_count == 0) { - PluginManager::UnregisterPlugin(PlatformHOS::CreateInstance); - } - } - PlatformLinux::Terminate(); -} - -PlatformSP PlatformHOS::CreateInstance(bool force, const ArchSpec *arch) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); - if (log) { - const char *triple_cstr = - arch ? arch->GetTriple().getTriple().c_str() : ""; - - LLDB_LOGF(log, "PlatformHOS::%s(force=%s, triple=%s)", __FUNCTION__, - force ? "true" : "false", triple_cstr); - } - - bool create = force; - if (!create && arch && arch->IsValid()) { - const llvm::Triple &triple = arch->GetTriple(); - - switch (triple.getVendor()) { - case llvm::Triple::PC: - create = true; - break; - - default: - create = triple.isOpenHOS(); - break; - } - } - - if (create) { - if (const char *env = std::getenv("HDC_UTID")) - platform_setenv("ANDROID_SERIAL", env); - - LLDB_LOGF(log, "PlatformHOS::%s() creating remote-hos platform", - __FUNCTION__); - return PlatformSP(new PlatformHOS(false)); - } - - LLDB_LOGF(log, "PlatformHOS::%s() aborting creation of remote-hos platform", - __FUNCTION__); - - return PlatformSP(); -} - -PlatformHOS::PlatformHOS(bool is_host) - : PlatformLinux(is_host), m_sdk_version(0) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); - if (log) { - LLDB_LOGF(log, "Hsu file(%s):%d PlatformHOS::%s is_host(%d)", __FILE__, - __LINE__, __FUNCTION__, is_host); - } -} - -PlatformHOS::~PlatformHOS() {} - -ConstString PlatformHOS::GetPluginName() { - if (GetContainer()) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); - static ConstString g_remote_name("remote-hos-inner"); - LLDB_LOGF(log, "PlatformHOS::GetPluginName g_remote_name(%s)", g_remote_name.GetCString()); - return g_remote_name; - } - - return GetPluginNameStatic(IsHost()); -} - -ConstString PlatformHOS::GetPluginNameStatic(bool is_host) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); - if (log) { - LLDB_LOGF(log, "Hsu %s:%d PlatformHOS::GetPluginNameStatic is_host(%d)", - __FILE__, __LINE__, is_host); - } - if (is_host) { - static ConstString g_host_name(Platform::GetHostPlatformName()); - if (log) { - LLDB_LOGF(log, "Hsu %s:%d PlatformHOS::GetPluginNameStatic g_host_name", - __FILE__, __LINE__); - } - return g_host_name; - } else { - static ConstString g_remote_name("remote-hos"); - if (log) { - LLDB_LOGF(log, "Hsu %s:%d PlatformHOS::GetPluginNameStatic g_remote_name", - __FILE__, __LINE__); - } - return g_remote_name; - } -} - -const char *PlatformHOS::GetPluginDescriptionStatic(bool is_host) { - if (is_host) - return "Local HarmonyOS user platform plug-in."; - else - return "Remote HarmonyOS user platform plug-in."; -} -Status PlatformHOS::ConnectRemote(Args &args) { - m_device_id.clear(); - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); - if (log) { - LLDB_LOGF(log, "Hsu %s:%d PlatformHOS::ConnectRemote call", __FILE__, - __LINE__); - } - - if (IsHost()) { - return Status("can't connect to the host platform '%s', always connected", - GetPluginName().GetCString()); - } - - if (!m_remote_platform_sp) { - if (log) { - LLDB_LOGF(log, - "Hsu %s:%d PlatformHOS::ConnectRemote new " - "PlatformHOSRemoteGDBServer()", - __FILE__, __LINE__); - } - m_remote_platform_sp = PlatformSP(new PlatformHOSRemoteGDBServer()); - } - - int port; - llvm::StringRef scheme, host, path; - const char *url = args.GetArgumentAtIndex(0); - if (!url) - return Status("URL is null."); - if (!UriParser::Parse(url, scheme, host, port, path)) - return Status("Invalid URL: %s", url); - if (host != "localhost") - m_device_id = static_cast(host); - - auto error = PlatformLinux::ConnectRemote(args); - if (error.Success()) { - HdcClient hdc; - if (log) { - LLDB_LOGF(log, - "Hsu file(%s):%d PlatformHOS::ConnectRemote m_device_id(%s)", - __FILE__, __LINE__, m_device_id.c_str()); - } - error = HdcClient::CreateByDeviceID(m_device_id, hdc); - if (error.Fail()) - return error; - - m_device_id = hdc.GetDeviceID(); - if (log) { - LLDB_LOGF(log, - "Hsu file(%s):%d PlatformHOS::ConnectRemote m_device_id(%s)", - __FILE__, __LINE__, m_device_id.c_str()); - } - } - return error; -} - -Status PlatformHOS::GetFile(const FileSpec &source, - const FileSpec &destination) { - if (IsHost() || !m_remote_platform_sp) - return PlatformLinux::GetFile(source, destination); - - FileSpec source_spec(source.GetPath(false), FileSpec::Style::posix); - if (source_spec.IsRelative()) - source_spec = GetRemoteWorkingDirectory().CopyByAppendingPathComponent( - source_spec.GetCString(false)); - - if (GetContainer()) { - return GetFileFromContainer(source_spec, destination); - } - - return DoGetFile(source_spec, destination); -} - -// Precondition: source and destination represent POSIX-style -// and aboslute paths. -Status PlatformHOS::GetFileFromContainer(const FileSpec &source, - const FileSpec &destination) { - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM); - llvm::StringRef path(source.GetCString(false)); - - for (const auto& map : PATH_PREFIX_MAP) { - const auto& prefix = map.first; - const auto& new_prefix = map.second; - - if (path.startswith(prefix)) { - FileSpec new_source(new_prefix, FileSpec::Style::posix); - new_source.AppendPathComponent(path.substr(prefix.size())); - - LLDB_LOGF(log, "path '%s' inside container is converted to '%s'", - source.GetCString(false), new_source.GetCString(false)); - - Status error = DoGetFile(new_source, destination); - - if (error.Fail()) { - LLDB_LOGF(log, "failed to get file '%s': %s", - new_source.GetCString(false), error.AsCString()); - LLDB_LOGF(log, "try to get file '%s' as a fallback", - source.GetCString(false)); - error = DoGetFile(source, destination); - } - - return error; - } - } - - LLDB_LOGF(log, "try to get file '%s' inside container without conversion", - source.GetCString(false)); - - return DoGetFile(source, destination); -} - -// Precondition: source and destination represent POSIX-style -// and aboslute paths. -Status PlatformHOS::DoGetFile(const FileSpec &source, - const FileSpec &destination) { - Status error; - auto sync_service = GetSyncService(error); - if (error.Fail()) - return error; - - uint32_t mode = 0, size = 0, mtime = 0; - error = sync_service->Stat(source, mode, size, mtime); - if (error.Fail()) - return error; - - if (mode != 0) - return sync_service->PullFile(source, destination); - - const auto *source_file = source.GetCString(false); - - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); - LLDB_LOGF(log, "Got mode == 0 on '%s': try to get file via 'shell cat'", - source_file); - - if (strchr(source_file, '\'') != nullptr) - return Status("Doesn't support single-quotes in filenames"); - - // mode == 0 can signify that adbd cannot access the file due security - // constraints - try "cat ..." as a fallback. - HdcClient hdc(m_device_id); - - char cmd[PATH_MAX]; - snprintf(cmd, sizeof(cmd), "cat '%s'", source_file); - - if (log) { - LLDB_LOGF(log, "Hsu file(%s):%d PlatformHOS::%s source_file(%s)", __FILE__, - __LINE__, __FUNCTION__, source_file); - } - - return hdc.ShellToFile(cmd, minutes(1), destination); -} - -Status PlatformHOS::PutFile(const FileSpec &source, const FileSpec &destination, - uint32_t uid, uint32_t gid) { - if (IsHost() || !m_remote_platform_sp) - return PlatformLinux::PutFile(source, destination, uid, gid); - - FileSpec destination_spec(destination.GetPath(false), FileSpec::Style::posix); - if (destination_spec.IsRelative()) - destination_spec = GetRemoteWorkingDirectory().CopyByAppendingPathComponent( - destination_spec.GetCString(false)); - - // TODO: Set correct uid and gid on remote file. - Status error; - auto sync_service = GetSyncService(error); - if (error.Fail()) - return error; - return sync_service->PushFile(source, destination_spec); -} - -const char *PlatformHOS::GetCacheHostname() { return m_device_id.c_str(); } - -Status PlatformHOS::DownloadModuleSlice(const FileSpec &src_file_spec, - const uint64_t src_offset, - const uint64_t src_size, - const FileSpec &dst_file_spec) { - if (src_offset != 0) - return Status("Invalid offset - %" PRIu64, src_offset); - - return GetFile(src_file_spec, dst_file_spec); -} - -Status PlatformHOS::DisconnectRemote() { - Status error = PlatformLinux::DisconnectRemote(); - if (error.Success()) { - m_device_id.clear(); - m_sdk_version = 0; - if (m_remote_platform_sp) { - m_remote_platform_sp = nullptr; - } - } - return error; -} - -uint32_t PlatformHOS::GetDefaultMemoryCacheLineSize() { - return g_hos_default_cache_size; -} - -uint32_t PlatformHOS::GetSdkVersion() { - if (!IsConnected()) - return 0; - - if (m_sdk_version != 0) - return m_sdk_version; - - std::string version_string; - HdcClient hdc(m_device_id); - Status error = - hdc.Shell("getprop ro.build.version.sdk", seconds(5), &version_string); - version_string = llvm::StringRef(version_string).trim().str(); - - if (error.Fail() || version_string.empty()) { - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM); - LLDB_LOGF(log, "Get SDK version failed. (error: %s, output: %s)", - error.AsCString(), version_string.c_str()); - return 0; - } - - m_sdk_version = StringConvert::ToUInt32(version_string.c_str()); - return m_sdk_version; -} - -Status PlatformHOS::DownloadSymbolFile(const lldb::ModuleSP &module_sp, - const FileSpec &dst_file_spec) { - // For oat file we can try to fetch additional debug info from the device - ConstString extension = module_sp->GetFileSpec().GetFileNameExtension(); - if (extension != ".oat" && extension != ".odex") - return Status( - "Symbol file downloading only supported for oat and odex files"); - - // If we have no information about the platform file we can't execute oatdump - if (!module_sp->GetPlatformFileSpec()) - return Status("No platform file specified"); - - // Symbolizer isn't available before SDK version 23 - if (GetSdkVersion() < 23) - return Status("Symbol file generation only supported on SDK 23+"); - - // If we already have symtab then we don't have to try and generate one - if (module_sp->GetSectionList()->FindSectionByName(ConstString(".symtab")) != - nullptr) - return Status("Symtab already available in the module"); - - HdcClient hdc(m_device_id); - std::string tmpdir; - Status error; - if (m_container) { - error = hdc.Shell("mktemp --directory --tmpdir /data/ohos_data/local/tmp", - seconds(5), &tmpdir); - } else { - error = hdc.Shell("mktemp --directory --tmpdir /data/local/tmp", seconds(5), - &tmpdir); - } - if (error.Fail() || tmpdir.empty()) - return Status("Failed to generate temporary directory on the device (%s)", - error.AsCString()); - tmpdir = llvm::StringRef(tmpdir).trim().str(); - - // Create file remover for the temporary directory created on the device - std::unique_ptr> - tmpdir_remover(&tmpdir, [&hdc](std::string *s) { - StreamString command; - command.Printf("rm -rf %s", s->c_str()); - Status error = hdc.Shell(command.GetData(), seconds(5), nullptr); - - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); - if (log && error.Fail()) - LLDB_LOGF(log, "Failed to remove temp directory: %s", - error.AsCString()); - }); - - FileSpec symfile_platform_filespec(tmpdir); - symfile_platform_filespec.AppendPathComponent("symbolized.oat"); - - // Execute oatdump on the remote device to generate a file with symtab - StreamString command; - command.Printf("oatdump --symbolize=%s --output=%s", - module_sp->GetPlatformFileSpec().GetCString(false), - symfile_platform_filespec.GetCString(false)); - error = hdc.Shell(command.GetData(), minutes(1), nullptr); - if (error.Fail()) - return Status("Oatdump failed: %s", error.AsCString()); - - // Download the symbolfile from the remote device - return GetFile(symfile_platform_filespec, dst_file_spec); -} - -bool PlatformHOS::GetRemoteOSVersion() { - m_os_version = llvm::VersionTuple(GetSdkVersion()); - return !m_os_version.empty(); -} - -llvm::StringRef -PlatformHOS::GetLibdlFunctionDeclarations(lldb_private::Process *process) { - SymbolContextList matching_symbols; - std::vector dl_open_names = {"__dl_dlopen", "dlopen"}; - const char *dl_open_name = nullptr; - Target &target = process->GetTarget(); - for (auto name : dl_open_names) { - target.GetImages().FindFunctionSymbols( - ConstString(name), eFunctionNameTypeFull, matching_symbols); - if (matching_symbols.GetSize()) { - dl_open_name = name; - break; - } - } - // Older platform versions have the dl function symbols mangled - if (dl_open_name == dl_open_names[0]) - return R"( - extern "C" void* dlopen(const char*, int) asm("__dl_dlopen"); - extern "C" void* dlsym(void*, const char*) asm("__dl_dlsym"); - extern "C" int dlclose(void*) asm("__dl_dlclose"); - extern "C" char* dlerror(void) asm("__dl_dlerror"); - )"; - - return PlatformPOSIX::GetLibdlFunctionDeclarations(process); -} - -std::unique_ptr PlatformHOS::GetSyncService(Status &error) { - HdcClient hdc(m_device_id); - std::unique_ptr adb_sync_svc = hdc.GetSyncService(error); - return (error.Success()) ? std::move(adb_sync_svc) : nullptr; -} diff --git a/lldb/source/Plugins/Platform/HOS/PlatformHOS.h b/lldb/source/Plugins/Platform/HOS/PlatformHOS.h deleted file mode 100644 index 4df6d018252d..000000000000 --- a/lldb/source/Plugins/Platform/HOS/PlatformHOS.h +++ /dev/null @@ -1,86 +0,0 @@ -//===-- PlatformHOS.h -------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef liblldb_PlatformHOS_h_ -#define liblldb_PlatformHOS_h_ - -#include -#include - -//#include "Plugins/Platform/Android/PlatformAndroid.h" -#include "HdcClient.h" -#include "Plugins/Platform/Linux/PlatformLinux.h" - -namespace lldb_private { -namespace platform_hos { - -// class PlatformHOS : public platform_android::PlatformAndroid { -class PlatformHOS : public platform_linux::PlatformLinux { -public: - // PlatformHOS(bool is_host) : PlatformAndroid(is_host) {} - PlatformHOS(bool is_host); - // lldb_private::PluginInterface functions - ~PlatformHOS() override; - static void Initialize(); - - static void Terminate(); - - static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch); - - static ConstString GetPluginNameStatic(bool is_host); - - static const char *GetPluginDescriptionStatic(bool is_host); - - ConstString GetPluginName() override; - - uint32_t GetPluginVersion() override { return 1; } - - Status ConnectRemote(Args &args) override; - - Status GetFile(const FileSpec &source, const FileSpec &destination) override; - - Status PutFile(const FileSpec &source, const FileSpec &destination, - uint32_t uid = UINT32_MAX, uint32_t gid = UINT32_MAX) override; - - uint32_t GetSdkVersion(); - - bool GetRemoteOSVersion() override; - - Status DisconnectRemote() override; - - uint32_t GetDefaultMemoryCacheLineSize() override; - -protected: - const char *GetCacheHostname() override; - - Status DownloadModuleSlice(const FileSpec &src_file_spec, - const uint64_t src_offset, const uint64_t src_size, - const FileSpec &dst_file_spec) override; - - Status DownloadSymbolFile(const lldb::ModuleSP &module_sp, - const FileSpec &dst_file_spec) override; - - llvm::StringRef - GetLibdlFunctionDeclarations(lldb_private::Process *process) override; - -private: - std::unique_ptr GetSyncService(Status &error); - - Status GetFileFromContainer(const FileSpec &source, - const FileSpec &destination); - - Status DoGetFile(const FileSpec &source, const FileSpec &destination); - - std::string m_device_id; - uint32_t m_sdk_version; -}; - -} // namespace platform_hos -} // namespace lldb_private - -#endif // liblldb_PlatformHOS_h_ diff --git a/lldb/source/Plugins/Platform/HOS/PlatformHOSRemoteGDBServer.cpp b/lldb/source/Plugins/Platform/HOS/PlatformHOSRemoteGDBServer.cpp deleted file mode 100644 index 8c311a938453..000000000000 --- a/lldb/source/Plugins/Platform/HOS/PlatformHOSRemoteGDBServer.cpp +++ /dev/null @@ -1,244 +0,0 @@ -//===-- PlatformHOSRemoteGDBServer.cpp --------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#include "lldb/Host/ConnectionFileDescriptor.h" -#include "lldb/Host/common/TCPSocket.h" -#include "lldb/Utility/Log.h" -#include "lldb/Utility/Status.h" -#include "lldb/Utility/UriParser.h" - -#include "PlatformHOSRemoteGDBServer.h" - -#include - -using namespace lldb; -using namespace lldb_private; -using namespace lldb_private::platform_hos; - -static const lldb::pid_t g_remote_platform_pid = - 0; // Alias for the process id of lldb-platform - -static Status ForwardPortWithHdc( - const uint16_t local_port, const uint16_t remote_port, - llvm::StringRef remote_socket_name, - const llvm::Optional &socket_namespace, - std::string &device_id) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); - - HdcClient hdc; - auto error = HdcClient::CreateByDeviceID(device_id, hdc); - if (error.Fail()) - return error; - - device_id = hdc.GetDeviceID(); - LLDB_LOGF(log, - "Hsu file(%s):%d function(ForwardPortWithHdc) Connected to Hos " - "device \"%s\"", - __FILE__, __LINE__, device_id.c_str()); - - if (remote_port != 0) { - LLDB_LOGF(log, - "Hsu file(%s):%d function(ForwardPortWithHdc) Forwarding remote " - "TCP port %d to local TCP port %d", - __FILE__, __LINE__, remote_port, local_port); - return hdc.SetPortForwarding(local_port, remote_port); - } - - LLDB_LOGF(log, "Forwarding remote socket \"%s\" to local TCP port %d", - remote_socket_name.str().c_str(), local_port); - - if (!socket_namespace) - return Status("Invalid socket namespace"); - - return hdc.SetPortForwarding(local_port, remote_socket_name, - *socket_namespace); -} - -static Status DeleteForwardPortWithHdc(uint16_t local_port, - const std::string &device_id) { - HdcClient hdc(device_id); - return hdc.DeletePortForwarding(local_port); -} - -static Status FindUnusedPort(uint16_t &port) { - Status error; - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); - std::unique_ptr tcp_socket(new TCPSocket(true, false)); - if (error.Fail()) - return error; - - error = tcp_socket->Listen("127.0.0.1:0", 1); - if (error.Success()) - port = tcp_socket->GetLocalPortNumber(); - - if (log) { - LLDB_LOGF(log, "Hsu file(%s):%d FindUnusedPort port(%d)", __FILE__, - __LINE__, port); - } - return error; -} - -PlatformHOSRemoteGDBServer::PlatformHOSRemoteGDBServer() {} - -PlatformHOSRemoteGDBServer::~PlatformHOSRemoteGDBServer() { - for (const auto &it : m_port_forwards) - DeleteForwardPortWithHdc(it.second, m_device_id); -} - -bool PlatformHOSRemoteGDBServer::LaunchGDBServer(lldb::pid_t &pid, - std::string &connect_url) { - uint16_t remote_port = 0; - std::string socket_name; - if (!m_gdb_client.LaunchGDBServer("127.0.0.1", pid, remote_port, socket_name)) - return false; - - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); - - auto error = - MakeConnectURL(pid, remote_port, socket_name.c_str(), connect_url); - if (error.Success() && log) - LLDB_LOGF(log, "gdbserver connect URL: %s", connect_url.c_str()); - - return error.Success(); -} - -bool PlatformHOSRemoteGDBServer::KillSpawnedProcess(lldb::pid_t pid) { - DeleteForwardPort(pid); - return m_gdb_client.KillSpawnedProcess(pid); -} - -Status PlatformHOSRemoteGDBServer::ConnectRemote(Args &args) { - m_device_id.clear(); - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); - - if (args.GetArgumentCount() != 1) - return Status( - "\"platform connect\" takes a single argument: "); - - int remote_port; - llvm::StringRef scheme, host, path; - const char *url = args.GetArgumentAtIndex(0); - if (!url) - return Status("URL is null."); - if (!UriParser::Parse(url, scheme, host, remote_port, path)) - return Status("Invalid URL: %s", url); - if (host != "localhost") - m_device_id = std::string(host); - - m_socket_namespace.reset(); - if (scheme == ConnectionFileDescriptor::UNIX_CONNECT_SCHEME) - m_socket_namespace = HdcClient::UnixSocketNamespaceFileSystem; - else if (scheme == ConnectionFileDescriptor::UNIX_ABSTRACT_CONNECT_SCHEME) - m_socket_namespace = HdcClient::UnixSocketNamespaceAbstract; - - std::string connect_url; - auto error = - MakeConnectURL(g_remote_platform_pid, (remote_port < 0) ? 0 : remote_port, - path, connect_url); - if (log) { - LLDB_LOGF(log, - "Hsu file(%s):%d g_remote_platform_pid(%lu) remote_port(%d) " - "connect_url(%s)", - __FILE__, __LINE__, g_remote_platform_pid, remote_port, - connect_url.c_str()); - } - if (error.Fail()) - return error; - - args.ReplaceArgumentAtIndex(0, connect_url); - - // Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); - LLDB_LOGF(log, "Rewritten platform connect URL: %s", connect_url.c_str()); - - error = PlatformRemoteGDBServer::ConnectRemote(args); - if (error.Fail()) - DeleteForwardPort(g_remote_platform_pid); - - return error; -} - -Status PlatformHOSRemoteGDBServer::DisconnectRemote() { - DeleteForwardPort(g_remote_platform_pid); - return PlatformRemoteGDBServer::DisconnectRemote(); -} - -void PlatformHOSRemoteGDBServer::DeleteForwardPort(lldb::pid_t pid) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); - - auto it = m_port_forwards.find(pid); - if (it == m_port_forwards.end()) - return; - - const auto port = it->second; - const auto error = DeleteForwardPortWithHdc(port, m_device_id); - if (error.Fail()) { - LLDB_LOGF(log, - "Failed to delete port forwarding (pid=%" PRIu64 - ", port=%d, device=%s): %s", - pid, port, m_device_id.c_str(), error.AsCString()); - } - m_port_forwards.erase(it); -} - -Status PlatformHOSRemoteGDBServer::MakeConnectURL( - const lldb::pid_t pid, const uint16_t remote_port, - llvm::StringRef remote_socket_name, std::string &connect_url) { - static const int kAttempsNum = 5; - - Status error; - // There is a race possibility that somebody will occupy a port while we're - // in between FindUnusedPort and ForwardPortWithHdc - adding the loop to - // mitigate such problem. - for (auto i = 0; i < kAttempsNum; ++i) { - uint16_t local_port = 0; - error = FindUnusedPort(local_port); - if (error.Fail()) - return error; - - error = ForwardPortWithHdc(local_port, remote_port, remote_socket_name, - m_socket_namespace, m_device_id); - if (error.Success()) { - m_port_forwards[pid] = local_port; - std::ostringstream url_str; - url_str << "connect://127.0.0.1:" << local_port; - connect_url = url_str.str(); - break; - } - } - - return error; -} - -lldb::ProcessSP PlatformHOSRemoteGDBServer::ConnectProcess( - llvm::StringRef connect_url, llvm::StringRef plugin_name, - lldb_private::Debugger &debugger, lldb_private::Target *target, - lldb_private::Status &error) { - // We don't have the pid of the remote gdbserver when it isn't started by us - // but we still want to store the list of port forwards we set up in our port - // forward map. Generate a fake pid for these cases what won't collide with - // any other valid pid on android. - static lldb::pid_t s_remote_gdbserver_fake_pid = 0xffffffffffffffffULL; - - int remote_port; - llvm::StringRef scheme, host, path; - if (!UriParser::Parse(connect_url, scheme, host, remote_port, path)) { - error.SetErrorStringWithFormat("Invalid URL: %s", - connect_url.str().c_str()); - return nullptr; - } - - std::string new_connect_url; - error = MakeConnectURL(s_remote_gdbserver_fake_pid--, - (remote_port < 0) ? 0 : remote_port, path, - new_connect_url); - if (error.Fail()) - return nullptr; - - return PlatformRemoteGDBServer::ConnectProcess(new_connect_url, plugin_name, - debugger, target, error); -} diff --git a/lldb/source/Plugins/Platform/HOS/PlatformHOSRemoteGDBServer.h b/lldb/source/Plugins/Platform/HOS/PlatformHOSRemoteGDBServer.h deleted file mode 100644 index c30b15dd9a80..000000000000 --- a/lldb/source/Plugins/Platform/HOS/PlatformHOSRemoteGDBServer.h +++ /dev/null @@ -1,65 +0,0 @@ -//===-- PlatformHOSRemoteGDBServer.h ------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef LLDB_SOURCE_PLUGINS_PLATFORM_HOS_PLATFORMHOSREMOTEGDBSERVER_H -#define LLDB_SOURCE_PLUGINS_PLATFORM_HOS_PLATFORMHOSREMOTEGDBSERVER_H - -#include -#include - -#include "Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h" - -#include "llvm/ADT/Optional.h" - -#include "HdcClient.h" - -namespace lldb_private { -namespace platform_hos { - -class PlatformHOSRemoteGDBServer - : public platform_gdb_server::PlatformRemoteGDBServer { -public: - PlatformHOSRemoteGDBServer(); - - ~PlatformHOSRemoteGDBServer() override; - - Status ConnectRemote(Args &args) override; - - Status DisconnectRemote() override; - - lldb::ProcessSP ConnectProcess(llvm::StringRef connect_url, - llvm::StringRef plugin_name, - lldb_private::Debugger &debugger, - lldb_private::Target *target, - lldb_private::Status &error) override; - -protected: - std::string m_device_id; - std::map m_port_forwards; - llvm::Optional m_socket_namespace; - - bool LaunchGDBServer(lldb::pid_t &pid, std::string &connect_url) override; - - bool KillSpawnedProcess(lldb::pid_t pid) override; - - void DeleteForwardPort(lldb::pid_t pid); - - Status MakeConnectURL(const lldb::pid_t pid, const uint16_t remote_port, - llvm::StringRef remote_socket_name, - std::string &connect_url); - -private: - PlatformHOSRemoteGDBServer(const PlatformHOSRemoteGDBServer &) = delete; - const PlatformHOSRemoteGDBServer & - operator=(const PlatformHOSRemoteGDBServer &) = delete; -}; - -} // namespace platform_hos -} // namespace lldb_private - -#endif // LLDB_SOURCE_PLUGINS_PLATFORM_HOS_PLATFORMANDROIDREMOTEGDBSERVER_H diff --git a/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp index 9cdc9d5f434c..2cb671fd4dc3 100644 --- a/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp +++ b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp @@ -97,7 +97,7 @@ void PlatformLinux::Initialize() { PlatformPOSIX::Initialize(); if (g_initialize_count++ == 0) { -#if defined(__linux__) && !defined(__ANDROID__) && !defined(__OHOS_FAMILY__) +#if defined(__linux__) && !defined(__ANDROID__) PlatformSP default_platform_sp(new PlatformLinux(true)); default_platform_sp->SetSystemArchitecture(HostInfo::GetArchitecture()); Platform::SetHostPlatform(default_platform_sp); diff --git a/lldb/source/Plugins/Platform/OHOS/CMakeLists.txt b/lldb/source/Plugins/Platform/OHOS/CMakeLists.txt deleted file mode 100644 index cc71762efe2e..000000000000 --- a/lldb/source/Plugins/Platform/OHOS/CMakeLists.txt +++ /dev/null @@ -1,13 +0,0 @@ -add_lldb_library(lldbPluginPlatformOHOS PLUGIN - HdcClient.cpp - PlatformOHOS.cpp - PlatformOHOSRemoteGDBServer.cpp - - LINK_LIBS - lldbCore - lldbHost - lldbPluginPlatformLinux - lldbPluginPlatformGDB - LINK_COMPONENTS - Support - ) diff --git a/lldb/source/Plugins/Platform/OHOS/HdcClient.cpp b/lldb/source/Plugins/Platform/OHOS/HdcClient.cpp deleted file mode 100644 index 1f08dc55f642..000000000000 --- a/lldb/source/Plugins/Platform/OHOS/HdcClient.cpp +++ /dev/null @@ -1,405 +0,0 @@ -//===-- HdcClient.cpp -------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#include "HdcClient.h" - -#include "llvm/ADT/STLExtras.h" -#include "llvm/ADT/SmallVector.h" -#include "llvm/ADT/StringRef.h" -#include "llvm/Support/FileUtilities.h" - -#include "lldb/Host/ConnectionFileDescriptor.h" -#include "lldb/Host/FileSystem.h" -#include "lldb/Host/PosixApi.h" -#include "lldb/Utility/DataBuffer.h" -#include "lldb/Utility/DataBufferHeap.h" -#include "lldb/Utility/DataEncoder.h" -#include "lldb/Utility/DataExtractor.h" -#include "lldb/Utility/FileSpec.h" -#include "lldb/Utility/StreamString.h" -#include "lldb/Utility/Timeout.h" - -#if defined(_WIN32) -#include -#else -#include -#endif - -#include - -#include -#include -#include -#include - -// On Windows, transitive dependencies pull in , which defines a -// macro that clashes with a method name. -#ifdef SendMessage -#undef SendMessage -#endif - -using namespace lldb; -using namespace lldb_private; -using namespace lldb_private::platform_ohos; -using namespace std::chrono; - -namespace { - -const seconds kReadTimeout(20); -const char *kSocketNamespaceAbstract = "localabstract"; -const char *kSocketNamespaceFileSystem = "localfilesystem"; - -Status ReadAllBytes(Connection &conn, void *buffer, size_t size, - size_t *read_ptr, ConnectionStatus *status_ptr) { - - Status error; - ConnectionStatus status; - char *read_buffer = static_cast(buffer); - - auto now = steady_clock::now(); - const auto deadline = now + kReadTimeout; - size_t total_read_bytes = 0; - while (total_read_bytes < size && now < deadline) { - auto read_bytes = - conn.Read(read_buffer + total_read_bytes, size - total_read_bytes, - duration_cast(deadline - now), status, &error); - if (status_ptr) - *status_ptr = status; - if (error.Fail()) - return error; - total_read_bytes += read_bytes; - if (read_ptr) - *read_ptr = total_read_bytes; - if (status != eConnectionStatusSuccess) - break; - now = steady_clock::now(); - } - if (total_read_bytes < size) - error = Status( - "Unable to read requested number of bytes. Connection status: %d.", - status); - return error; -} - -} // namespace - -Status HdcClient::CreateByDeviceID(const std::string &device_id, - HdcClient &hdc) { - DeviceIDList connect_devices; - auto error = hdc.GetDevices(connect_devices); - if (error.Fail()) - return error; - - std::string hdc_utid; - if (!device_id.empty()) - hdc_utid = device_id; - else if (const char *env_hdc_utid = std::getenv("HDC_UTID")) - hdc_utid = env_hdc_utid; - - if (hdc_utid.empty()) { - if (connect_devices.size() != 1) - return Status("Expected a single connected device, got instead %zu - try " - "setting 'HDC_UTID'", - connect_devices.size()); - hdc.SetDeviceID(connect_devices.front()); - } else { - auto find_it = std::find(connect_devices.begin(), connect_devices.end(), - hdc_utid); - if (find_it == connect_devices.end()) - return Status( - "Device \"%s\" not found, check HDC_UTID environment variable", - hdc_utid.c_str()); - - hdc.SetDeviceID(*find_it); - } - return error; -} - -HdcClient::HdcClient() {} - -HdcClient::HdcClient(const std::string &device_id) : m_device_id(device_id) {} - -HdcClient::~HdcClient() {} - -void HdcClient::SetDeviceID(const std::string &device_id) { - m_device_id = device_id; -} - -const std::string &HdcClient::GetDeviceID() const { return m_device_id; } - -namespace { -typedef unsigned msg_len_t; -struct ChannelHandShake { - msg_len_t size; - char banner[12]; // must first index - union { - uint32_t channelId; - char connectKey[32]; - }; -} __attribute__((packed)); -} // namespace - -Status HdcClient::Connect() { - Status error; - ChannelHandShake handshake = {}; - if (m_device_id.size() > sizeof(handshake.connectKey)) - return Status("Device id is too long: %s", m_device_id.c_str()); - m_conn.reset(new ConnectionFileDescriptor); - std::string port = "8710"; - - const char *env_port = std::getenv("OHOS_HDC_SERVER_PORT"); - if (env_port != NULL) { - int iEnv_port = atoi(env_port); - if ((iEnv_port > 0) && (iEnv_port <= 65535)) { - port = env_port; - } - else { - return Status("invalid port specification: %s. $OHOS_HDC_SERVER_PORT must be a positive number in (0,65535]", env_port); - } - } - - std::string uri = "connect://localhost:" + port; - m_conn->Connect(uri.c_str(), &error); - ConnectionStatus status = eConnectionStatusError; - if (error.Success()) { - error = ReadAllBytes(&handshake, sizeof(handshake)); - if (error.Success()) { - memset(handshake.connectKey, 0, sizeof(handshake.connectKey)); - memcpy(handshake.connectKey, m_device_id.c_str(), m_device_id.size()); - m_conn->Write(&handshake, sizeof(handshake), status, &error); - } - } - return error; -} - -Status HdcClient::GetDevices(DeviceIDList &device_list) { - device_list.clear(); - - auto error = SendMessage("list targets"); - if (error.Fail()) - return error; - - std::vector in_buffer; - error = ReadMessage(in_buffer); - - llvm::StringRef response(&in_buffer[0], in_buffer.size()); - llvm::SmallVector devices; - response.split(devices, "\n", -1, false); - - for (const auto device : devices) - device_list.push_back(static_cast(device.split('\t').first)); - - // Force disconnect since ADB closes connection after host:devices response - // is sent. - m_conn.reset(); - return error; -} - -Status HdcClient::SetPortForwarding(const uint16_t local_port, - const uint16_t remote_port) { - char message[48]; - snprintf(message, sizeof(message), "fport tcp:%d tcp:%d", local_port, - remote_port); - - const auto error = SendMessage(message); - if (error.Fail()) - return error; - - return ReadResponseStatus("Forwardport result:OK"); -} - -Status -HdcClient::SetPortForwarding(const uint16_t local_port, - llvm::StringRef remote_socket_name, - const UnixSocketNamespace socket_namespace) { - char message[PATH_MAX]; - const char *sock_namespace_str = - (socket_namespace == UnixSocketNamespaceAbstract) - ? kSocketNamespaceAbstract - : kSocketNamespaceFileSystem; - snprintf(message, sizeof(message), "fport tcp:%d %s:%s", local_port, - sock_namespace_str, remote_socket_name.str().c_str()); - - const auto error = SendMessage(message); - if (error.Fail()) - return error; - - return ReadResponseStatus("Forwardport result:OK"); -} - -Status HdcClient::DeletePortForwarding(std::pair fwd) { - char message[32]; - snprintf(message, sizeof(message), "fport rm tcp:%d tcp:%d", fwd.first, - fwd.second); - - const auto error = SendMessage(message); - if (error.Fail()) - return error; - - return ReadResponseStatus("Remove forward ruler success"); -} - -Status HdcClient::DeletePortForwarding(const uint16_t local_port, - const std::string remote_socket_name, - const UnixSocketNamespace socket_namespace) { - const char *sock_namespace_str = - (socket_namespace == UnixSocketNamespaceAbstract) - ? kSocketNamespaceAbstract - : kSocketNamespaceFileSystem; - char message[PATH_MAX] = ""; - - snprintf(message, sizeof(message), "fport rm tcp:%d %s:%s", local_port, - sock_namespace_str, remote_socket_name.c_str()); - - const auto error = SendMessage(message); - if (error.Fail()){ - return error; - } - - return ReadResponseStatus("Remove forward ruler success"); -} - -Status HdcClient::TransferFile(const char *direction, const FileSpec &src, - const FileSpec &dst) { - llvm::SmallVector cwd; - std::error_code ec = llvm::sys::fs::current_path(cwd); - if (ec) - return Status(ec); - - std::stringstream cmd; - cmd << "file " << direction << " -cwd "; - cmd.write(cwd.data(), cwd.size()); - cmd << " " << src.GetPath() << " " << dst.GetPath(); - Status error = SendMessage(cmd.str()); - if (error.Fail()) - return error; - - return ReadResponseStatus("FileTransfer finish"); -} - -Status HdcClient::RecvFile(const FileSpec &src, const FileSpec &dst) { - return TransferFile("recv", src, dst); -} - -Status HdcClient::SendFile(const FileSpec &src, const FileSpec &dst) { - return TransferFile("send", src, dst); -} - -Status HdcClient::SendMessage(llvm::StringRef packet, const bool reconnect) { - Status error; - if (!m_conn || reconnect) { - error = Connect(); - if (error.Fail()) - return error; - } - - unsigned msg_len = packet.size() + 1; - llvm::SmallVector message(msg_len + sizeof(msg_len_t), 0); - msg_len_t len = htonl(msg_len); - memcpy(message.data(), &len, sizeof(len)); - memcpy(message.data() + sizeof(len), packet.data(), packet.size()); - - ConnectionStatus status; - m_conn->Write(message.data(), message.size(), status, &error); - if (error.Fail()) - return error; - - return error; -} - -Status HdcClient::ReadMessage(std::vector &message) { - message.clear(); - - msg_len_t packet_len; - auto error = ReadAllBytes(&packet_len, sizeof(packet_len)); - if (error.Fail()) - return error; - - packet_len = htonl(packet_len); - message.resize(packet_len, 0); - error = ReadAllBytes(&message[0], packet_len); - if (error.Fail()) - message.clear(); - - return error; -} - -Status HdcClient::ReadMessageStream(std::vector &message, - milliseconds timeout) { - auto start = steady_clock::now(); - message.clear(); - - Status error; - lldb::ConnectionStatus status = lldb::eConnectionStatusSuccess; - char buffer[1024]; - while (error.Success() && status == lldb::eConnectionStatusSuccess) { - auto end = steady_clock::now(); - auto elapsed = end - start; - if (elapsed >= timeout) - return Status("Timed out"); - - size_t n = m_conn->Read(buffer, sizeof(buffer), - duration_cast(timeout - elapsed), - status, &error); - if (n > 0) - message.insert(message.end(), &buffer[0], &buffer[n]); - } - return error; -} - -Status HdcClient::ReadResponseStatus(const char *expected) { - msg_len_t len; - ConnectionStatus conn_status; - size_t read; - - auto error = ::ReadAllBytes(*m_conn, &len, sizeof(len), &read, &conn_status); - // Special case: we expect server to close connection - if (expected == nullptr) { - if (read == 0 && conn_status == eConnectionStatusEndOfFile) - return Status(); - else if (error.Fail()) - return error; - // Something went wrong - response is not empty - // Read it and wrap to error object - } - - len = htonl(len); - llvm::SmallVector message(len + 1); - error = ReadAllBytes(message.data(), len); - if (error.Fail()) - return error; - - message[len] = 0; - if (expected == nullptr || - strncmp(message.data(), expected, strlen(expected))) - return Status("%s", message.data()); - - return error; -} - -Status HdcClient::ReadAllBytes(void *buffer, size_t size) { - return ::ReadAllBytes(*m_conn, buffer, size, nullptr, nullptr); -} - -Status HdcClient::Shell(const char *command, milliseconds timeout, - std::string *output) { - assert(command && command[0]); - std::string cmd = "shell "; - cmd += command; - Status error = SendMessage(cmd); - if (error.Fail()) - return error; - - std::vector message; - error = ReadMessageStream(message, timeout); - if (error.Fail()) - return error; - - (*output) = std::string(message.data(), message.size()); - return error; -} diff --git a/lldb/source/Plugins/Platform/OHOS/HdcClient.h b/lldb/source/Plugins/Platform/OHOS/HdcClient.h deleted file mode 100644 index 39b6569b447a..000000000000 --- a/lldb/source/Plugins/Platform/OHOS/HdcClient.h +++ /dev/null @@ -1,93 +0,0 @@ -//===-- HdcClient.h ---------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef liblldb_HdcClient_h_ -#define liblldb_HdcClient_h_ - -#include "lldb/Utility/Status.h" -#include -#include -#include -#include -#include -#include - -namespace lldb_private { - -class FileSpec; - -namespace platform_ohos { - -class HdcClient { -public: - enum UnixSocketNamespace { - UnixSocketNamespaceAbstract, - UnixSocketNamespaceFileSystem, - }; - - using DeviceIDList = std::list; - - static Status CreateByDeviceID(const std::string &device_id, HdcClient &hdc); - - HdcClient(); - explicit HdcClient(const std::string &device_id); - - ~HdcClient(); - - const std::string &GetDeviceID() const; - - Status GetDevices(DeviceIDList &device_list); - - Status SetPortForwarding(const uint16_t local_port, - const uint16_t remote_port); - - Status SetPortForwarding(const uint16_t local_port, - llvm::StringRef remote_socket_name, - const UnixSocketNamespace socket_namespace); - - Status DeletePortForwarding(std::pair fwd); - - Status DeletePortForwarding(const uint16_t local_port, const std::string remote_socket_name, - const UnixSocketNamespace socket_namespace); - - Status RecvFile(const FileSpec &src, const FileSpec &dst); - - Status SendFile(const FileSpec &src, const FileSpec &dst); - - Status Shell(const char *command, std::chrono::milliseconds timeout, - std::string *output); - -private: - Status Connect(); - - Status TransferFile(const char *direction, const FileSpec &src, - const FileSpec &dst); - - void SetDeviceID(const std::string &device_id); - - Status SendMessage(llvm::StringRef packet, const bool reconnect = true); - - Status SendDeviceMessage(const std::string &packet); - - Status ReadMessage(std::vector &message); - - Status ReadMessageStream(std::vector &message, - std::chrono::milliseconds timeout); - - Status ReadResponseStatus(const char *expected); - - Status ReadAllBytes(void *buffer, size_t size); - - std::string m_device_id; - std::unique_ptr m_conn; -}; - -} // namespace platform_ohos -} // namespace lldb_private - -#endif // liblldb_HdcClient_h_ diff --git a/lldb/source/Plugins/Platform/OHOS/PlatformOHOS.cpp b/lldb/source/Plugins/Platform/OHOS/PlatformOHOS.cpp deleted file mode 100644 index 68f22d232744..000000000000 --- a/lldb/source/Plugins/Platform/OHOS/PlatformOHOS.cpp +++ /dev/null @@ -1,300 +0,0 @@ -//===-- PlatformOHOS.cpp ----------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#include "llvm/Config/config.h" -#include "lldb/Core/Module.h" -#include "lldb/Core/PluginManager.h" -#include "lldb/Core/Section.h" -#include "lldb/Core/ValueObject.h" -#include "lldb/Host/HostInfo.h" -#include "lldb/Host/StringConvert.h" -#include "lldb/Utility/Log.h" -#include "lldb/Utility/Scalar.h" -#include "lldb/Utility/UriParser.h" - -#include "HdcClient.h" -#include "PlatformOHOS.h" -#include "PlatformOHOSRemoteGDBServer.h" -#include "lldb/Target/Target.h" - -using namespace lldb; -using namespace lldb_private; -using namespace lldb_private::platform_ohos; -using namespace std::chrono; - -static uint32_t g_initialize_count = 0; -static const unsigned int g_ohos_default_cache_size = - 2048; // Fits inside 4k adb packet. -static constexpr uint32_t INVALID_SDK_VERSION = 0xFFFFFFFF; - -LLDB_PLUGIN_DEFINE(PlatformOHOS) - -void PlatformOHOS::Initialize() { - PlatformLinux::Initialize(); - - if (g_initialize_count++ == 0) { -#if defined(__OHOS__) - PlatformSP default_platform_sp(new PlatformOHOS(true)); - default_platform_sp->SetSystemArchitecture(HostInfo::GetArchitecture()); - Platform::SetHostPlatform(default_platform_sp); -#endif - PluginManager::RegisterPlugin( - PlatformOHOS::GetPluginNameStatic(false), - PlatformOHOS::GetPluginDescriptionStatic(false), - PlatformOHOS::CreateInstance); - } -} - -void PlatformOHOS::Terminate() { - if (g_initialize_count > 0) { - if (--g_initialize_count == 0) { - PluginManager::UnregisterPlugin(PlatformOHOS::CreateInstance); - } - } - - PlatformLinux::Terminate(); -} - -PlatformSP PlatformOHOS::CreateInstance(bool force, const ArchSpec *arch) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); - if (log) { - const char *arch_name; - if (arch && arch->GetArchitectureName()) - arch_name = arch->GetArchitectureName(); - else - arch_name = ""; - - const char *triple_cstr = - arch ? arch->GetTriple().getTriple().c_str() : ""; - - log->Printf("PlatformOHOS::%s(force=%s, arch={%s,%s})", __FUNCTION__, - force ? "true" : "false", arch_name, triple_cstr); - } - - bool create = force; - if (!create && arch && arch->IsValid()) { - const llvm::Triple &triple = arch->GetTriple(); - switch (triple.getVendor()) { - case llvm::Triple::PC: - create = true; - break; - default: - break; - } - - if (create) { - switch (triple.getEnvironment()) { - case llvm::Triple::OpenHOS: - break; - default: - create = false; - break; - } - } - } - - if (create) { - if (log) - log->Printf("PlatformOHOS::%s() creating remote-ohos platform", - __FUNCTION__); - - return PlatformSP(new PlatformOHOS(false)); - } - - if (log) - log->Printf( - "PlatformOHOS::%s() aborting creation of remote-ohos platform", - __FUNCTION__); - - return PlatformSP(); -} - -PlatformOHOS::PlatformOHOS(bool is_host) - : PlatformLinux(is_host), m_sdk_version(0) {} - -PlatformOHOS::~PlatformOHOS() {} - -ConstString PlatformOHOS::GetPluginNameStatic(bool is_host) { - if (is_host) { - static ConstString g_host_name(Platform::GetHostPlatformName()); - return g_host_name; - } else { - static ConstString g_remote_name("remote-ohos"); - return g_remote_name; - } -} - -const char *PlatformOHOS::GetPluginDescriptionStatic(bool is_host) { - if (is_host) - return "Local Open HarmonyOS user platform plug-in."; - else - return "Remote Open HarmonyOS user platform plug-in."; -} - -ConstString PlatformOHOS::GetPluginName() { - return GetPluginNameStatic(IsHost()); -} - -Status PlatformOHOS::ConnectRemote(Args &args) { - m_device_id.clear(); - - if (IsHost()) { - return Status("can't connect to the host platform '%s', always connected", - GetPluginName().GetCString()); - } - - if (!m_remote_platform_sp) - m_remote_platform_sp = PlatformSP(new PlatformOHOSRemoteGDBServer()); - - int port; - llvm::StringRef scheme, host, path; - const char *url = args.GetArgumentAtIndex(0); - if (!url) - return Status("URL is null."); - if (!UriParser::Parse(url, scheme, host, port, path)) - return Status("Invalid URL: %s", url); - if (host != "localhost") - m_device_id = static_cast(host); - - auto error = PlatformLinux::ConnectRemote(args); - if (error.Success()) { - HdcClient adb; - error = HdcClient::CreateByDeviceID(m_device_id, adb); - if (error.Fail()) - return error; - - m_device_id = adb.GetDeviceID(); - } - return error; -} - -Status PlatformOHOS::GetFile(const FileSpec &source, - const FileSpec &destination) { - if (IsHost() || !m_remote_platform_sp) - return PlatformLinux::GetFile(source, destination); - - FileSpec source_spec(source.GetPath(false), FileSpec::Style::posix); - if (source_spec.IsRelative()) - source_spec = GetRemoteWorkingDirectory().CopyByAppendingPathComponent( - source_spec.GetCString(false)); - - HdcClient hdc(m_device_id); - Status error = hdc.RecvFile(source, destination); - return error; -} - -Status PlatformOHOS::PutFile(const FileSpec &source, - const FileSpec &destination, uint32_t uid, - uint32_t gid) { - if (IsHost() || !m_remote_platform_sp) - return PlatformLinux::PutFile(source, destination, uid, gid); - - FileSpec destination_spec(destination.GetPath(false), FileSpec::Style::posix); - if (destination_spec.IsRelative()) - destination_spec = GetRemoteWorkingDirectory().CopyByAppendingPathComponent( - destination_spec.GetCString(false)); - - // TODO: Set correct uid and gid on remote file. - HdcClient hdc(m_device_id); - Status error = hdc.SendFile(source, destination_spec); - return error; -} - -const char *PlatformOHOS::GetCacheHostname() { return m_device_id.c_str(); } - -Status PlatformOHOS::DownloadModuleSlice(const FileSpec &src_file_spec, - const uint64_t src_offset, - const uint64_t src_size, - const FileSpec &dst_file_spec) { - if (src_offset != 0) - return Status("Invalid offset - %" PRIu64, src_offset); - - return GetFile(src_file_spec, dst_file_spec); -} - -Status PlatformOHOS::DisconnectRemote() { - Status error = PlatformLinux::DisconnectRemote(); - if (error.Success()) { - m_device_id.clear(); - m_sdk_version = 0; - if (m_remote_platform_sp) { - m_remote_platform_sp = nullptr; - } - } - return error; -} - -uint32_t PlatformOHOS::GetDefaultMemoryCacheLineSize() { - return g_ohos_default_cache_size; -} - -uint32_t PlatformOHOS::GetSdkVersion() { - if (!IsConnected()) - return 0; - - if (m_sdk_version != 0) - return m_sdk_version; - - std::string version_string; - HdcClient hdc(m_device_id); - Status error = - hdc.Shell("param get const.ohos.apiversion", seconds(5), &version_string); - version_string = llvm::StringRef(version_string).trim().str(); - - if (error.Fail() || version_string.empty()) { - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM); - if (log) - log->Printf("Get SDK version failed. (error: %s, output: %s)", - error.AsCString(), version_string.c_str()); - m_sdk_version = INVALID_SDK_VERSION; - return 0; - } - - m_sdk_version = StringConvert::ToUInt32(version_string.c_str(), INVALID_SDK_VERSION); - if (m_sdk_version == INVALID_SDK_VERSION) { - return 0; - } - - return m_sdk_version; -} - -bool PlatformOHOS::GetRemoteOSVersion() { - m_os_version = llvm::VersionTuple(GetSdkVersion()); - return !m_os_version.empty(); -} - -llvm::StringRef -PlatformOHOS::GetLibdlFunctionDeclarations(lldb_private::Process *process) { - SymbolContextList matching_symbols; - std::vector dl_open_names = { "__dl_dlopen", "dlopen" }; - const char *dl_open_name = nullptr; - Target &target = process->GetTarget(); - for (auto name: dl_open_names) { - target.GetImages().FindFunctionSymbols(ConstString(name), - eFunctionNameTypeFull, - matching_symbols); - if (matching_symbols.GetSize()) { - dl_open_name = name; - break; - } - } - // Older platform versions have the dl function symbols mangled - if (dl_open_name == dl_open_names[0]) - return R"( - extern "C" void* dlopen(const char*, int) asm("__dl_dlopen"); - extern "C" void* dlsym(void*, const char*) asm("__dl_dlsym"); - extern "C" int dlclose(void*) asm("__dl_dlclose"); - extern "C" char* dlerror(void) asm("__dl_dlerror"); - )"; - - return PlatformPOSIX::GetLibdlFunctionDeclarations(process); -} - -ConstString PlatformOHOS::GetMmapSymbolName(const ArchSpec &arch) { - return arch.GetTriple().isArch32Bit() ? ConstString("__lldb_mmap") : PlatformLinux::GetMmapSymbolName(arch); -} diff --git a/lldb/source/Plugins/Platform/OHOS/PlatformOHOS.h b/lldb/source/Plugins/Platform/OHOS/PlatformOHOS.h deleted file mode 100644 index 886ca74ed84b..000000000000 --- a/lldb/source/Plugins/Platform/OHOS/PlatformOHOS.h +++ /dev/null @@ -1,83 +0,0 @@ -//===-- PlatformOHOS.h ------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef liblldb_PlatformOHOS_h_ -#define liblldb_PlatformOHOS_h_ - -#include -#include - -#include "Plugins/Platform/Linux/PlatformLinux.h" - -#include "HdcClient.h" - -namespace lldb_private { -namespace platform_ohos { - -class PlatformOHOS : public platform_linux::PlatformLinux { -public: - PlatformOHOS(bool is_host); - - ~PlatformOHOS() override; - - static void Initialize(); - - static void Terminate(); - - // lldb_private::PluginInterface functions - static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch); - - static ConstString GetPluginNameStatic(bool is_host); - - static const char *GetPluginDescriptionStatic(bool is_host); - - ConstString GetPluginName() override; - - uint32_t GetPluginVersion() override { return 1; } - - // lldb_private::Platform functions - - Status ConnectRemote(Args &args) override; - - Status GetFile(const FileSpec &source, const FileSpec &destination) override; - - Status PutFile(const FileSpec &source, const FileSpec &destination, - uint32_t uid = UINT32_MAX, uint32_t gid = UINT32_MAX) override; - - uint32_t GetSdkVersion(); - - bool GetRemoteOSVersion() override; - - Status DisconnectRemote() override; - - uint32_t GetDefaultMemoryCacheLineSize() override; - - ConstString GetMmapSymbolName(const ArchSpec &arch) override; - -protected: - const char *GetCacheHostname() override; - - Status DownloadModuleSlice(const FileSpec &src_file_spec, - const uint64_t src_offset, const uint64_t src_size, - const FileSpec &dst_file_spec) override; - - llvm::StringRef - GetLibdlFunctionDeclarations(lldb_private::Process *process) override; - -private: - std::string m_device_id; - uint32_t m_sdk_version; - - PlatformOHOS(const PlatformOHOS &other) = delete; - PlatformOHOS& operator=(const PlatformOHOS &other) = delete; -}; - -} // namespace platform_ohos -} // namespace lldb_private - -#endif // liblldb_PlatformOHOS_h_ diff --git a/lldb/source/Plugins/Platform/OHOS/PlatformOHOSRemoteGDBServer.cpp b/lldb/source/Plugins/Platform/OHOS/PlatformOHOSRemoteGDBServer.cpp deleted file mode 100644 index b4e9f40407c1..000000000000 --- a/lldb/source/Plugins/Platform/OHOS/PlatformOHOSRemoteGDBServer.cpp +++ /dev/null @@ -1,284 +0,0 @@ -//===-- PlatformOHOSRemoteGDBServer.cpp ----------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#include "lldb/Host/ConnectionFileDescriptor.h" -#include "lldb/Host/common/TCPSocket.h" -#include "lldb/Utility/Log.h" -#include "lldb/Utility/Status.h" -#include "lldb/Utility/UriParser.h" - -#include "PlatformOHOSRemoteGDBServer.h" - -#include - -using namespace lldb; -using namespace lldb_private; -using namespace platform_ohos; - -static const lldb::pid_t g_remote_platform_pid = - 0; // Alias for the process id of lldb-platform - -static uint16_t g_hdc_forward_port_offset = 0; - -static Status ForwardPortWithHdc( - const uint16_t local_port, const uint16_t remote_port, - llvm::StringRef remote_socket_name, - const llvm::Optional &socket_namespace, - std::string &device_id) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); - - HdcClient hdc; - auto error = HdcClient::CreateByDeviceID(device_id, hdc); - if (error.Fail()) - return error; - - device_id = hdc.GetDeviceID(); - if (log) - log->Printf("Connected to OHOS device \"%s\"", device_id.c_str()); - - if (remote_port != 0) { - if (log) - log->Printf("Forwarding remote TCP port %d to local TCP port %d", - remote_port, local_port); - return hdc.SetPortForwarding(local_port, remote_port); - } - - if (log) - log->Printf("Forwarding remote socket \"%s\" to local TCP port %d", - remote_socket_name.str().c_str(), local_port); - - if (!socket_namespace) - return Status("Invalid socket namespace"); - - return hdc.SetPortForwarding(local_port, remote_socket_name, - *socket_namespace); -} - -static Status DeleteForwardPortWithHdc(std::pair ports, - const std::string &device_id) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); - if (log) - log->Printf("Delete port forwarding %d -> %d, device=%s", ports.first, - ports.second, device_id.c_str()); - - HdcClient hdc(device_id); - return hdc.DeletePortForwarding(ports); -} - -static Status DeleteForwardPortWithHdc(std::pair remote_socket, - const llvm::Optional &socket_namespace, - const std::string &device_id) { - - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); - uint16_t local_port = remote_socket.first; - std::string remote_socket_name = remote_socket.second; - if (log) - log->Printf("Delete port forwarding %d -> %s, device=%s", local_port, - remote_socket_name.c_str(), device_id.c_str()); - if (!socket_namespace) - return Status("Invalid socket namespace"); - - HdcClient hdc(device_id); - return hdc.DeletePortForwarding(local_port, remote_socket_name, *socket_namespace); -} - -static Status FindUnusedPort(uint16_t &port) { - Status error; - - if (const char *env_port = std::getenv("HDC_FORWARD_PORT_BASE_FOR_LLDB")) { - port = std::atoi(env_port) + g_hdc_forward_port_offset; - g_hdc_forward_port_offset++; - return error; - } - - std::unique_ptr tcp_socket(new TCPSocket(true, false)); - if (error.Fail()) - return error; - - error = tcp_socket->Listen("127.0.0.1:0", 1); - if (error.Success()) - port = tcp_socket->GetLocalPortNumber(); - - return error; -} - -PlatformOHOSRemoteGDBServer::PlatformOHOSRemoteGDBServer() {} - -PlatformOHOSRemoteGDBServer::~PlatformOHOSRemoteGDBServer() { - for (const auto &it : m_port_forwards) { - DeleteForwardPortWithHdc(it.second, m_device_id); - } - for (const auto &it_socket : m_remote_socket_name) { - DeleteForwardPortWithHdc(it_socket.second, m_socket_namespace, m_device_id); - } -} - -bool PlatformOHOSRemoteGDBServer::LaunchGDBServer(lldb::pid_t &pid, - std::string &connect_url) { - uint16_t remote_port = 0; - std::string socket_name; - if (!m_gdb_client.LaunchGDBServer("127.0.0.1", pid, remote_port, socket_name)) - return false; - - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); - - auto error = - MakeConnectURL(pid, remote_port, socket_name.c_str(), connect_url); - if (error.Success() && log) - log->Printf("gdbserver connect URL: %s", connect_url.c_str()); - - return error.Success(); -} - -bool PlatformOHOSRemoteGDBServer::KillSpawnedProcess(lldb::pid_t pid) { - DeleteForwardPort(pid); - return m_gdb_client.KillSpawnedProcess(pid); -} - -Status PlatformOHOSRemoteGDBServer::ConnectRemote(Args &args) { - m_device_id.clear(); - - if (args.GetArgumentCount() != 1) - return Status( - "\"platform connect\" takes a single argument: "); - - int remote_port; - llvm::StringRef scheme, host, path; - const char *url = args.GetArgumentAtIndex(0); - if (!url) - return Status("URL is null."); - if (!UriParser::Parse(url, scheme, host, remote_port, path)) - return Status("Invalid URL: %s", url); - if (host != "localhost") - m_device_id = static_cast(host); - - m_socket_namespace.reset(); - if (scheme == ConnectionFileDescriptor::UNIX_CONNECT_SCHEME) - m_socket_namespace = HdcClient::UnixSocketNamespaceFileSystem; - else if (scheme == ConnectionFileDescriptor::UNIX_ABSTRACT_CONNECT_SCHEME) - m_socket_namespace = HdcClient::UnixSocketNamespaceAbstract; - - std::string connect_url; - auto error = - MakeConnectURL(g_remote_platform_pid, (remote_port < 0) ? 0 : remote_port, - path, connect_url); - - if (error.Fail()) - return error; - - args.ReplaceArgumentAtIndex(0, connect_url); - - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); - if (log) - log->Printf("Rewritten platform connect URL: %s", connect_url.c_str()); - - error = PlatformRemoteGDBServer::ConnectRemote(args); - if (error.Fail()) - DeleteForwardPort(g_remote_platform_pid); - - return error; -} - -Status PlatformOHOSRemoteGDBServer::DisconnectRemote() { - DeleteForwardPort(g_remote_platform_pid); - g_hdc_forward_port_offset = 0; - return PlatformRemoteGDBServer::DisconnectRemote(); -} - -void PlatformOHOSRemoteGDBServer::DeleteForwardPort(lldb::pid_t pid) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); - - auto it = m_port_forwards.find(pid); - auto it_socket = m_remote_socket_name.find(pid); - if (it != m_port_forwards.end() && it->second.second != 0) { - const auto error = DeleteForwardPortWithHdc(it->second, m_device_id); - if (error.Fail()) { - if (log) - log->Printf("Failed to delete port forwarding (pid=%" PRIu64 - ", fwd=(%d -> %d), device=%s): %s", - pid, it->second.first, it->second.second, m_device_id.c_str(), - error.AsCString()); - } - m_port_forwards.erase(it); - } - - if(it_socket != m_remote_socket_name.end()) { - const auto error_Socket = DeleteForwardPortWithHdc(it_socket->second, m_socket_namespace, m_device_id); - if (error_Socket.Fail()) { - if (log) - log->Printf("Failed to delete port forwarding (pid=%" PRIu64 - ", fwd=(%d->%s)device=%s): %s", pid, it_socket->second.first, it_socket->second.second.c_str(), m_device_id.c_str(),error_Socket.AsCString()); - } - m_remote_socket_name.erase(it_socket); - } - - return; -} - -Status PlatformOHOSRemoteGDBServer::MakeConnectURL( - const lldb::pid_t pid, const uint16_t remote_port, - llvm::StringRef remote_socket_name, std::string &connect_url) { - static const int kAttempsNum = 5; - - Status error; - // There is a race possibility that somebody will occupy a port while we're - // in between FindUnusedPort and ForwardPortWithHdc - adding the loop to - // mitigate such problem. - for (auto i = 0; i < kAttempsNum; ++i) { - uint16_t local_port = 0; - error = FindUnusedPort(local_port); - if (error.Fail()) - return error; - - error = ForwardPortWithHdc(local_port, remote_port, remote_socket_name, - m_socket_namespace, m_device_id); - if (error.Success()) { - if (remote_port != 0){ - m_port_forwards[pid] = {local_port, remote_port}; - } - else{ - m_remote_socket_name[pid] ={local_port, remote_socket_name.str()}; - } - std::ostringstream url_str; - url_str << "connect://localhost:" << local_port; - connect_url = url_str.str(); - break; - } - } - - return error; -} - -lldb::ProcessSP PlatformOHOSRemoteGDBServer::ConnectProcess( - llvm::StringRef connect_url, llvm::StringRef plugin_name, - lldb_private::Debugger &debugger, lldb_private::Target *target, - lldb_private::Status &error) { - // We don't have the pid of the remote gdbserver when it isn't started by us - // but we still want to store the list of port forwards we set up in our port - // forward map. Generate a fake pid for these cases what won't collide with - // any other valid pid on ohos. - static lldb::pid_t s_remote_gdbserver_fake_pid = 0xffffffffffffffffULL; - - int remote_port; - llvm::StringRef scheme, host, path; - if (!UriParser::Parse(connect_url, scheme, host, remote_port, path)) { - error.SetErrorStringWithFormat("Invalid URL: %s", - connect_url.str().c_str()); - return nullptr; - } - - std::string new_connect_url; - error = MakeConnectURL(s_remote_gdbserver_fake_pid--, - (remote_port < 0) ? 0 : remote_port, path, - new_connect_url); - if (error.Fail()) - return nullptr; - - return PlatformRemoteGDBServer::ConnectProcess(new_connect_url, plugin_name, - debugger, target, error); -} diff --git a/lldb/source/Plugins/Platform/OHOS/PlatformOHOSRemoteGDBServer.h b/lldb/source/Plugins/Platform/OHOS/PlatformOHOSRemoteGDBServer.h deleted file mode 100644 index 680ddc1e733c..000000000000 --- a/lldb/source/Plugins/Platform/OHOS/PlatformOHOSRemoteGDBServer.h +++ /dev/null @@ -1,65 +0,0 @@ -//===-- PlatformOHOSRemoteGDBServer.h ------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef liblldb_PlatformOHOSRemoteGDBServer_h_ -#define liblldb_PlatformOHOSRemoteGDBServer_h_ - -#include -#include - -#include "Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h" - -#include "llvm/ADT/Optional.h" - -#include "HdcClient.h" - -namespace lldb_private { -namespace platform_ohos { - -class PlatformOHOSRemoteGDBServer - : public platform_gdb_server::PlatformRemoteGDBServer { -public: - PlatformOHOSRemoteGDBServer(); - - ~PlatformOHOSRemoteGDBServer() override; - - Status ConnectRemote(Args &args) override; - - Status DisconnectRemote() override; - - lldb::ProcessSP ConnectProcess(llvm::StringRef connect_url, - llvm::StringRef plugin_name, - lldb_private::Debugger &debugger, - lldb_private::Target *target, - lldb_private::Status &error) override; - -protected: - std::string m_device_id; - std::map> m_port_forwards; - std::map> m_remote_socket_name; - llvm::Optional m_socket_namespace; - - bool LaunchGDBServer(lldb::pid_t &pid, std::string &connect_url) override; - - bool KillSpawnedProcess(lldb::pid_t pid) override; - - void DeleteForwardPort(lldb::pid_t pid); - - Status MakeConnectURL(const lldb::pid_t pid, const uint16_t remote_port, - llvm::StringRef remote_socket_name, - std::string &connect_url); - -private: - PlatformOHOSRemoteGDBServer(const PlatformOHOSRemoteGDBServer &other) = delete; - PlatformOHOSRemoteGDBServer& operator=(const PlatformOHOSRemoteGDBServer &other) = delete; -}; - -} // namespace platform_ohos -} // namespace lldb_private - -#endif // liblldb_PlatformOHOSRemoteGDBServer_h_ diff --git a/lldb/source/Plugins/Process/CMakeLists.txt b/lldb/source/Plugins/Process/CMakeLists.txt index 36800455ab82..91f20ec22ac5 100644 --- a/lldb/source/Plugins/Process/CMakeLists.txt +++ b/lldb/source/Plugins/Process/CMakeLists.txt @@ -1,4 +1,4 @@ -if (CMAKE_SYSTEM_NAME MATCHES "Linux|Android|OHOS") +if (CMAKE_SYSTEM_NAME MATCHES "Linux|Android") add_subdirectory(Linux) add_subdirectory(POSIX) elseif (CMAKE_SYSTEM_NAME MATCHES "FreeBSD") diff --git a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h index 758d08db5ade..344eae247e91 100644 --- a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h +++ b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h @@ -14,11 +14,6 @@ #include "Plugins/Process/Linux/NativeRegisterContextLinux.h" #include "Plugins/Process/Utility/RegisterInfoPOSIX_arm64.h" -#if __OHOS__ -// Do not include to avoid conflicting definitions for -// aarch64-linux-ohos target -#define __ASM_SIGCONTEXT_H 1 -#endif #include namespace lldb_private { diff --git a/lldb/source/Plugins/Process/Linux/Procfs.h b/lldb/source/Plugins/Process/Linux/Procfs.h index 3830842dae12..59dd76a2584c 100644 --- a/lldb/source/Plugins/Process/Linux/Procfs.h +++ b/lldb/source/Plugins/Process/Linux/Procfs.h @@ -11,7 +11,7 @@ #include -#if defined(__ANDROID__) +#ifdef __ANDROID__ #if defined(__arm64__) || defined(__aarch64__) typedef unsigned long elf_greg_t; typedef elf_greg_t diff --git a/lldb/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp b/lldb/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp index c59e79306a4b..0f331933f2ea 100644 --- a/lldb/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp +++ b/lldb/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp @@ -41,13 +41,11 @@ bool lldb_private::InferiorCallMmap(Process *process, addr_t &allocated_addr, if (thread == nullptr) return false; - const ArchSpec arch = process->GetTarget().GetArchitecture(); - auto mmap_name = process->GetTarget().GetPlatform()->GetMmapSymbolName(arch); const bool include_symbols = true; const bool include_inlines = false; SymbolContextList sc_list; process->GetTarget().GetImages().FindFunctions( - mmap_name, eFunctionNameTypeFull, include_symbols, + ConstString("mmap"), eFunctionNameTypeFull, include_symbols, include_inlines, sc_list); const uint32_t count = sc_list.GetSize(); if (count > 0) { @@ -91,6 +89,7 @@ bool lldb_private::InferiorCallMmap(Process *process, addr_t &allocated_addr, CompilerType void_ptr_type = type_system_or_err->GetBasicTypeFromAST(eBasicTypeVoid) .GetPointerType(); + const ArchSpec arch = process->GetTarget().GetArchitecture(); MmapArgList args = process->GetTarget().GetPlatform()->GetMmapArgumentList( arch, addr, length, prot_arg, flags, fd, offset); diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp index c13203e2b961..1ca0290eda13 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp @@ -44,15 +44,12 @@ #include "lldb/Host/android/HostInfoAndroid.h" #endif -#if defined(__OHOS_FAMILY__) -#include "lldb/Host/ohos/HostInfoOHOS.h" -#endif using namespace lldb; using namespace lldb_private::process_gdb_remote; using namespace lldb_private; -#if defined(__ANDROID__) || defined(__OHOS_FAMILY__) +#ifdef __ANDROID__ const static uint32_t g_default_packet_timeout_sec = 20; // seconds #else const static uint32_t g_default_packet_timeout_sec = 0; // not specified @@ -186,6 +183,7 @@ GDBRemoteCommunicationServerCommon::Handle_qHostInfo( StreamString response; // $cputype:16777223;cpusubtype:3;ostype:Darwin;vendor:apple;endian:little;ptrsize:8;#00 + ArchSpec host_arch(HostInfo::GetArchitecture()); const llvm::Triple &host_triple = host_arch.GetTriple(); response.PutCString("triple:"); @@ -1279,12 +1277,10 @@ void GDBRemoteCommunicationServerCommon:: } } -FileSpec GDBRemoteCommunicationServerCommon::FindModuleFile ( +FileSpec GDBRemoteCommunicationServerCommon::FindModuleFile( const std::string &module_path, const ArchSpec &arch) { #ifdef __ANDROID__ return HostInfoAndroid::ResolveLibraryPath(module_path, arch); -#elif defined(__OHOS_FAMILY__) - return HostInfoOHOS::ResolveLibraryPath(module_path, arch); #else FileSpec file_spec(module_path); FileSystem::Instance().Resolve(file_spec); @@ -1293,9 +1289,10 @@ FileSpec GDBRemoteCommunicationServerCommon::FindModuleFile ( } ModuleSpec -GDBRemoteCommunicationServerCommon::GetModuleInfo (llvm::StringRef module_path, +GDBRemoteCommunicationServerCommon::GetModuleInfo(llvm::StringRef module_path, llvm::StringRef triple) { ArchSpec arch(triple); + FileSpec req_module_path_spec(module_path); FileSystem::Instance().Resolve(req_module_path_spec); @@ -1311,5 +1308,6 @@ GDBRemoteCommunicationServerCommon::GetModuleInfo (llvm::StringRef module_path, ModuleSpec matched_module_spec; if (!module_specs.FindMatchingModuleSpec(module_spec, matched_module_spec)) return ModuleSpec(); + return matched_module_spec; } diff --git a/lldb/source/Symbol/LineEntry.cpp b/lldb/source/Symbol/LineEntry.cpp index 165ca607f4d6..a3907f4dd9c0 100644 --- a/lldb/source/Symbol/LineEntry.cpp +++ b/lldb/source/Symbol/LineEntry.cpp @@ -253,9 +253,9 @@ AddressRange LineEntry::GetSameLineContiguousAddressRange( void LineEntry::ApplyFileMappings(lldb::TargetSP target_sp) { if (target_sp) { - // Apply any file remappings to our file. - if (auto new_file_spec = - target_sp->GetSourcePathMap().FindFile(original_file)) - file = *new_file_spec; + // Apply any file remappings to our file + FileSpec new_file_spec; + if (target_sp->GetSourcePathMap().FindFile(original_file, new_file_spec)) + file = new_file_spec; } } diff --git a/lldb/source/Target/ModuleCache.cpp b/lldb/source/Target/ModuleCache.cpp index 765da16e2d07..20661a7b7a25 100644 --- a/lldb/source/Target/ModuleCache.cpp +++ b/lldb/source/Target/ModuleCache.cpp @@ -128,44 +128,16 @@ Status CreateHostSysRootModuleLink(const FileSpec &root_dir_spec, const FileSpec &platform_module_spec, const FileSpec &local_module_spec, bool delete_existing) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_MODULES)); const auto sysroot_module_path_spec = JoinPath(JoinPath(root_dir_spec, hostname), platform_module_spec.GetPath().c_str()); - if (FileSystem::Instance().Exists(sysroot_module_path_spec)) { - if (FileSystem::Instance().Exists(local_module_spec)) { - UUID sysroot_module_sp_uuid = (std::make_shared(ModuleSpec(sysroot_module_path_spec)))->GetUUID(); - UUID module_spec_uuid = (std::make_shared(ModuleSpec(local_module_spec)))->GetUUID(); - if (sysroot_module_sp_uuid.IsValid() && (sysroot_module_sp_uuid == module_spec_uuid)) { - delete_existing = false; - } - LLDB_LOGF(log, "CreateHostSysRootModuleLink delete_existing(%i)", delete_existing); - } - if (!delete_existing) return Status(); DecrementRefExistingModule(root_dir_spec, sysroot_module_path_spec); } - // sysroot_module_path_spec might still exist. - // It means that module UUID is not valid. - if (FileSystem::Instance().Exists(sysroot_module_path_spec)) { - auto module_sp = - std::make_shared(ModuleSpec(sysroot_module_path_spec)); - UUID module_uuid = module_sp->GetUUID(); - - if (!module_uuid.IsValid()) { - LLDB_LOGF(log, "Try CreateHostSysRootModuleLink but uuid is invalid %s", - module_uuid.GetAsString().c_str()); - return Status(); - } - - LLDB_LOGF(log, "CreateHostSysRootModuleLink with uuid %s", - module_uuid.GetAsString().c_str()); - } - const auto error = MakeDirectory( FileSpec(sysroot_module_path_spec.GetDirectory().AsCString())); if (error.Fail()) @@ -242,16 +214,13 @@ Status ModuleCache::Put(const FileSpec &root_dir_spec, const char *hostname, Status ModuleCache::Get(const FileSpec &root_dir_spec, const char *hostname, const ModuleSpec &module_spec, ModuleSP &cached_module_sp, bool *did_create_ptr) { - { - std::lock_guard lock(m_cache_mutex); - const auto find_it = - m_loaded_modules.find(module_spec.GetUUID().GetAsString()); - if (find_it != m_loaded_modules.end()) { - cached_module_sp = (*find_it).second.lock(); - if (cached_module_sp) - return Status(); - m_loaded_modules.erase(find_it); - } + const auto find_it = + m_loaded_modules.find(module_spec.GetUUID().GetAsString()); + if (find_it != m_loaded_modules.end()) { + cached_module_sp = (*find_it).second.lock(); + if (cached_module_sp) + return Status(); + m_loaded_modules.erase(find_it); } const auto module_spec_dir = @@ -290,7 +259,6 @@ Status ModuleCache::Get(const FileSpec &root_dir_spec, const char *hostname, if (FileSystem::Instance().Exists(symfile_spec)) cached_module_sp->SetSymbolFileFileSpec(symfile_spec); - std::lock_guard lock(m_cache_mutex); m_loaded_modules.insert( std::make_pair(module_spec.GetUUID().GetAsString(), cached_module_sp)); diff --git a/lldb/source/Target/PathMappingList.cpp b/lldb/source/Target/PathMappingList.cpp index 01ee7ef707b4..b22673f55471 100644 --- a/lldb/source/Target/PathMappingList.cpp +++ b/lldb/source/Target/PathMappingList.cpp @@ -136,7 +136,7 @@ void PathMappingList::Dump(Stream *s, int pair_index) { } } -void PathMappingList::Clear (bool notify) { +void PathMappingList::Clear(bool notify) { if (!m_pairs.empty()) ++m_mod_id; m_pairs.clear(); @@ -146,29 +146,18 @@ void PathMappingList::Clear (bool notify) { bool PathMappingList::RemapPath(ConstString path, ConstString &new_path) const { - if (llvm::Optional remapped = RemapPath(path.GetStringRef())) { - new_path.SetString(remapped->GetPath()); + std::string remapped; + if (RemapPath(path.GetStringRef(), remapped)) { + new_path.SetString(remapped); return true; } return false; } -/// Append components to path, applying style. -static void AppendPathComponents(FileSpec &path, llvm::StringRef components, - llvm::sys::path::Style style) { - auto component = llvm::sys::path::begin(components, style); - auto e = llvm::sys::path::end(components); - while (component != e && - llvm::sys::path::is_separator(*component->data(), style)) - ++component; - for (; component != e; ++component) - path.AppendPathComponent(*component); -} - -llvm::Optional -PathMappingList::RemapPath(llvm::StringRef path) const { +bool PathMappingList::RemapPath(llvm::StringRef path, + std::string &new_path) const { if (m_pairs.empty() || path.empty()) - return {}; + return false; LazyBool path_is_relative = eLazyBoolCalculate; for (const auto &it : m_pairs) { auto prefix = it.first.GetStringRef(); @@ -188,38 +177,69 @@ PathMappingList::RemapPath(llvm::StringRef path) const { continue; } FileSpec remapped(it.second.GetStringRef()); - auto orig_style = FileSpec::GuessPathStyle(prefix).getValueOr( - llvm::sys::path::Style::native); - AppendPathComponents(remapped, path, orig_style); - return remapped; + remapped.AppendPathComponent(path); + new_path = remapped.GetPath(); + return true; } - return {}; + return false; } -bool PathMappingList::ReverseRemapPath (const FileSpec &file, FileSpec &fixed) const { +bool PathMappingList::ReverseRemapPath(const FileSpec &file, FileSpec &fixed) const { std::string path = file.GetPath(); llvm::StringRef path_ref(path); for (const auto &it : m_pairs) { if (!path_ref.consume_front(it.second.GetStringRef())) continue; - auto orig_file = it.first.GetStringRef(); - auto orig_style = FileSpec::GuessPathStyle(orig_file).getValueOr( - llvm::sys::path::Style::native); - fixed.SetFile(orig_file, orig_style); - AppendPathComponents(fixed, path_ref, orig_style); + fixed.SetFile(it.first.GetStringRef(), FileSpec::Style::native); + fixed.AppendPathComponent(path_ref); return true; } return false; } +bool PathMappingList::FindFile(const FileSpec &orig_spec, + FileSpec &new_spec) const { + if (m_pairs.empty()) + return false; + + std::string orig_path = orig_spec.GetPath(); + + if (orig_path.empty()) + return false; + + bool orig_is_relative = orig_spec.IsRelative(); -llvm::Optional PathMappingList::FindFile(const FileSpec &orig_spec) const { - std::string normalized_path = FileSpec(orig_spec.GetPath()).GetPath(); - if (auto remapped = RemapPath(normalized_path)) - if (FileSystem::Instance().Exists(*remapped)) - return remapped; + for (auto entry : m_pairs) { + llvm::StringRef orig_ref(orig_path); + llvm::StringRef prefix_ref = entry.first.GetStringRef(); + if (orig_ref.size() < prefix_ref.size()) + continue; + // We consider a relative prefix or one of just "." to + // mean "only apply to relative paths". + bool prefix_is_relative = false; + + if (prefix_ref == ".") { + prefix_is_relative = true; + // Remove the "." since it will have been removed from the + // FileSpec paths already. + prefix_ref = prefix_ref.drop_front(); + } else { + FileSpec prefix_spec(prefix_ref, FileSpec::Style::native); + prefix_is_relative = prefix_spec.IsRelative(); + } + if (prefix_is_relative != orig_is_relative) + continue; - return {}; + if (orig_ref.consume_front(prefix_ref)) { + new_spec.SetFile(entry.second.GetCString(), FileSpec::Style::native); + new_spec.AppendPathComponent(orig_ref); + if (FileSystem::Instance().Exists(new_spec)) + return true; + } + } + + new_spec.Clear(); + return false; } bool PathMappingList::Replace(ConstString path, diff --git a/lldb/source/Target/Platform.cpp b/lldb/source/Target/Platform.cpp index 73b28a371369..a77ecddfbab6 100644 --- a/lldb/source/Target/Platform.cpp +++ b/lldb/source/Target/Platform.cpp @@ -389,7 +389,7 @@ Platform::Platform(bool is_host) m_max_uid_name_len(0), m_max_gid_name_len(0), m_supports_rsync(false), m_rsync_opts(), m_rsync_prefix(), m_supports_ssh(false), m_ssh_opts(), m_ignores_remote_hostname(false), m_trap_handlers(), - m_container(false), m_calculated_trap_handlers(false), + m_calculated_trap_handlers(false), m_module_cache(std::make_unique()) { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT)); LLDB_LOGF(log, "%p Platform::Platform()", static_cast(this)); @@ -404,13 +404,8 @@ Platform::~Platform() { LLDB_LOGF(log, "%p Platform::~Platform()", static_cast(this)); } -// platform select/connect 返回报文 void Platform::GetStatus(Stream &strm) { std::string s; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT)); - if (log) { - LLDB_LOGF(log, "%p file(%s):%d Platform::GetStatus() call", static_cast(this), __FILE__, __LINE__); - } strm.Printf(" Platform: %s\n", GetPluginName().GetCString()); ArchSpec arch(GetSystemArchitecture()); @@ -436,14 +431,9 @@ void Platform::GetStatus(Stream &strm) { strm.Printf(" Hostname: %s\n", GetHostname()); } else { const bool is_connected = IsConnected(); - const bool is_container = GetContainer(); - if (log) { - LLDB_LOGF(log, "%p file(%s):%d Platform::GetStatus() is_container(%d) is_connected(%d)", static_cast(this), __FILE__, __LINE__, is_container, is_connected); - } if (is_connected) strm.Printf(" Hostname: %s\n", GetHostname()); strm.Printf(" Connected: %s\n", is_connected ? "yes" : "no"); - strm.Printf(" Container: %s\n", is_container ? "yes" : "no"); } if (GetWorkingDirectory()) { @@ -1311,10 +1301,6 @@ Status Platform::Unlink(const FileSpec &path) { return error; } -ConstString Platform::GetMmapSymbolName(const ArchSpec &) { - return ConstString("mmap"); -} - MmapArgList Platform::GetMmapArgumentList(const ArchSpec &arch, addr_t addr, addr_t length, unsigned prot, unsigned flags, addr_t fd, diff --git a/lldb/source/Target/StopInfo.cpp b/lldb/source/Target/StopInfo.cpp index acb2f12a3def..7e830c6e2bed 100644 --- a/lldb/source/Target/StopInfo.cpp +++ b/lldb/source/Target/StopInfo.cpp @@ -410,6 +410,8 @@ protected: continue; } + internal_breakpoint = bp_loc_sp->GetBreakpoint().IsInternal(); + // First run the precondition, but since the precondition is per // breakpoint, only run it once per breakpoint. std::pair::iterator, bool> result = @@ -479,7 +481,7 @@ protected: loc_desc.GetData()); // We want this stop reported, so you will know we auto-continued // but only for external breakpoints: - if (!bp_loc_sp->GetBreakpoint().IsInternal()) + if (!internal_breakpoint) thread_sp->SetShouldReportStop(eVoteYes); auto_continue_says_stop = false; } @@ -502,10 +504,7 @@ protected: if (callback_says_stop && auto_continue_says_stop) m_should_stop = true; - - if (m_should_stop && !bp_loc_sp->GetBreakpoint().IsInternal()) - internal_breakpoint = false; - + // If we are going to stop for this breakpoint, then remove the // breakpoint. if (callback_says_stop && bp_loc_sp && diff --git a/lldb/source/Target/TargetList.cpp b/lldb/source/Target/TargetList.cpp index 1ea7dbad08c3..1e5856dd0b22 100644 --- a/lldb/source/Target/TargetList.cpp +++ b/lldb/source/Target/TargetList.cpp @@ -62,10 +62,6 @@ Status TargetList::CreateTarget(Debugger &debugger, const ArchSpec &specified_arch, LoadDependentFiles load_dependent_files, PlatformSP &platform_sp, TargetSP &target_sp) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); - if (log) { - LLDB_LOGF(log,"file(%s):%d TargetList::%s call", __FILE__, __LINE__, __FUNCTION__); - } auto result = TargetList::CreateTargetInternal( debugger, user_exe_path, specified_arch, load_dependent_files, platform_sp, target_sp); @@ -80,10 +76,7 @@ Status TargetList::CreateTargetInternal( llvm::StringRef triple_str, LoadDependentFiles load_dependent_files, const OptionGroupPlatform *platform_options, TargetSP &target_sp) { Status error; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); - if (log) { - LLDB_LOGF(log,"file(%s):%d TargetList::%s call", __FILE__, __LINE__, __FUNCTION__); - } + // Let's start by looking at the selected platform. PlatformSP platform_sp = debugger.GetPlatformList().GetSelectedPlatform(); diff --git a/lldb/source/Target/ThreadPlanStepInRange.cpp b/lldb/source/Target/ThreadPlanStepInRange.cpp index 84b92fdab1d1..a03bd93ac638 100644 --- a/lldb/source/Target/ThreadPlanStepInRange.cpp +++ b/lldb/source/Target/ThreadPlanStepInRange.cpp @@ -124,7 +124,7 @@ void ThreadPlanStepInRange::GetDescription(Stream *s, s->PutChar('.'); } -bool ThreadPlanStepInRange::ShouldStop (Event *event_ptr) { +bool ThreadPlanStepInRange::ShouldStop(Event *event_ptr) { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); if (log) { @@ -166,16 +166,6 @@ bool ThreadPlanStepInRange::ShouldStop (Event *event_ptr) { Thread &thread = GetThread(); if (frame_order == eFrameCompareOlder || frame_order == eFrameCompareSameParent) { - // Here we make a nasty hack to avoid double stepping on enclosing brace - // on ARM platforms. The problem is that before 'bx lr' we typically have - // some instruction modifying the stack pointer register. This confuses - // lldb and makes it think that we're already in a different frame where - // we should stop. - // TODO: Litmit this to OHOS targets - if (MaybeAArch32Or64FunctionTail()) { - SetNextBranchBreakpoint(); - return false; - } // If we're in an older frame then we should stop. // // A caveat to this is if we think the frame is older but we're actually diff --git a/lldb/source/Target/ThreadPlanStepOverBreakpoint.cpp b/lldb/source/Target/ThreadPlanStepOverBreakpoint.cpp index 59fa6f3ecb54..f188d827faae 100644 --- a/lldb/source/Target/ThreadPlanStepOverBreakpoint.cpp +++ b/lldb/source/Target/ThreadPlanStepOverBreakpoint.cpp @@ -27,9 +27,8 @@ ThreadPlanStepOverBreakpoint::ThreadPlanStepOverBreakpoint(Thread &thread) // first in the thread plan stack when stepping over // a breakpoint m_breakpoint_addr(LLDB_INVALID_ADDRESS), - m_auto_continue(false), m_reenabled_breakpoint_site(false), - m_stopped_at_my_breakpoint(false), - m_handling_signal(false) + m_auto_continue(false), m_reenabled_breakpoint_site(false) + { m_breakpoint_addr = thread.GetRegisterContext()->GetPC(); m_breakpoint_site_id = @@ -48,8 +47,6 @@ void ThreadPlanStepOverBreakpoint::GetDescription( bool ThreadPlanStepOverBreakpoint::ValidatePlan(Stream *error) { return true; } bool ThreadPlanStepOverBreakpoint::DoPlanExplainsStop(Event *event_ptr) { - m_stopped_at_my_breakpoint = false; - StopInfoSP stop_info_sp = GetPrivateStopInfo(); if (stop_info_sp) { // It's a little surprising that we stop here for a breakpoint hit. @@ -92,29 +89,16 @@ bool ThreadPlanStepOverBreakpoint::DoPlanExplainsStop(Event *event_ptr) { lldb::addr_t pc_addr = GetThread().GetRegisterContext()->GetPC(); if (pc_addr == m_breakpoint_addr) { - m_stopped_at_my_breakpoint = true; - // If we came from a signal handler, just reset the flag and try again. - m_handling_signal = false; LLDB_LOGF(log, "Got breakpoint stop reason but pc: 0x%" PRIx64 - " hasn't changed, resetting m_handling_signal." - " If we came from a signal handler, trying again.", + "hasn't changed.", pc_addr); return true; } - // Even if we are in a signal handler, handle the breakpoint as usual - SetAutoContinue(false); return false; } - case eStopReasonSignal: - if (!m_handling_signal) { - // Next stop may be a signal handler. - LLDB_LOG(log, "Preparing for signal handler handling."); - m_handling_signal = true; - } - return false; default: return false; } @@ -129,12 +113,6 @@ bool ThreadPlanStepOverBreakpoint::ShouldStop(Event *event_ptr) { bool ThreadPlanStepOverBreakpoint::StopOthers() { return true; } StateType ThreadPlanStepOverBreakpoint::GetPlanRunState() { - if (m_handling_signal) { - // Resume & wait to hit our initial breakpoint - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); - LLDB_LOG(log, "Step over breakpoint resuming through a potential signal handler."); - return eStateRunning; - } return eStateStepping; } @@ -143,19 +121,9 @@ bool ThreadPlanStepOverBreakpoint::DoWillResume(StateType resume_state, if (current_plan) { BreakpointSiteSP bp_site_sp( m_process.GetBreakpointSiteList().FindByAddress(m_breakpoint_addr)); - if (bp_site_sp) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); - if (m_handling_signal) { - // Turn the breakpoint back on and wait to hit it. - // Even if there is no userspace signal handler, we'll immediately stop - // on the breakpoint and try again. - LLDB_LOG(log, "Step over breakpoint reenabling breakpoint to try again after a potential signal handler"); - ReenableBreakpointSite(); - } else if (bp_site_sp->IsEnabled()) { - LLDB_LOG(log, "Step over breakpoint disabling breakpoint."); - m_process.DisableBreakpointSite(bp_site_sp.get()); - m_reenabled_breakpoint_site = false; - } + if (bp_site_sp && bp_site_sp->IsEnabled()) { + m_process.DisableBreakpointSite(bp_site_sp.get()); + m_reenabled_breakpoint_site = false; } } return true; @@ -175,7 +143,7 @@ bool ThreadPlanStepOverBreakpoint::MischiefManaged() { if (pc_addr == m_breakpoint_addr) { // If we are still at the PC of our breakpoint, then for some reason we - // didn't get a chance to run, or we received a signal and want to try again. + // didn't get a chance to run. return false; } else { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); @@ -207,16 +175,9 @@ void ThreadPlanStepOverBreakpoint::SetAutoContinue(bool do_it) { } bool ThreadPlanStepOverBreakpoint::ShouldAutoContinue(Event *event_ptr) { - if (m_stopped_at_my_breakpoint) { - // Do not stop again at the breakpoint we are trying to step over - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); - LLDB_LOG(log, "Stopped step over breakpoint plan on its own breakpoint, auto-continue."); - return true; - } return m_auto_continue; } bool ThreadPlanStepOverBreakpoint::IsPlanStale() { - // TODO: validate - return !m_handling_signal && GetThread().GetRegisterContext()->GetPC() != m_breakpoint_addr; + return GetThread().GetRegisterContext()->GetPC() != m_breakpoint_addr; } diff --git a/lldb/source/Target/ThreadPlanStepRange.cpp b/lldb/source/Target/ThreadPlanStepRange.cpp index 53953b5c33e6..3c42cd750dad 100644 --- a/lldb/source/Target/ThreadPlanStepRange.cpp +++ b/lldb/source/Target/ThreadPlanStepRange.cpp @@ -205,13 +205,6 @@ bool ThreadPlanStepRange::InSymbol() { return false; } -// TODO: Limit this function scope to OHOS targets -bool ThreadPlanStepRange::MaybeAArch32Or64FunctionTail() { - const llvm::Triple &triple = GetTarget().GetArchitecture().GetTriple(); - const bool isArm32or64 = triple.isAArch64() || triple.isARM(); - return isArm32or64 && InSymbol() && InRange(); -} - // FIXME: This should also handle inlining if we aren't going to do inlining in // the // main stack. diff --git a/lldb/source/Utility/ArchSpec.cpp b/lldb/source/Utility/ArchSpec.cpp index 36ebeac81262..c13e2389cfed 100644 --- a/lldb/source/Utility/ArchSpec.cpp +++ b/lldb/source/Utility/ArchSpec.cpp @@ -935,7 +935,7 @@ bool ArchSpec::IsCompatibleMatch(const ArchSpec &rhs) const { return IsEqualTo(rhs, false); } -static bool IsCompatibleEnvironment (llvm::Triple::EnvironmentType lhs, +static bool IsCompatibleEnvironment(llvm::Triple::EnvironmentType lhs, llvm::Triple::EnvironmentType rhs) { if (lhs == rhs) return true; @@ -957,8 +957,6 @@ static bool IsCompatibleEnvironment (llvm::Triple::EnvironmentType lhs, // that they are using the Android ABI. if ((lhs == llvm::Triple::Android && rhs == llvm::Triple::EABI) || (rhs == llvm::Triple::Android && lhs == llvm::Triple::EABI) || - (lhs == llvm::Triple::OpenHOS && rhs == llvm::Triple::EABI) || - (rhs == llvm::Triple::OpenHOS && lhs == llvm::Triple::EABI) || (lhs == llvm::Triple::GNUEABI && rhs == llvm::Triple::EABI) || (rhs == llvm::Triple::GNUEABI && lhs == llvm::Triple::EABI) || (lhs == llvm::Triple::GNUEABIHF && rhs == llvm::Triple::EABIHF) || diff --git a/lldb/source/Utility/TildeExpressionResolver.cpp b/lldb/source/Utility/TildeExpressionResolver.cpp index bcae7b1a006c..75d9c47e656d 100644 --- a/lldb/source/Utility/TildeExpressionResolver.cpp +++ b/lldb/source/Utility/TildeExpressionResolver.cpp @@ -39,7 +39,7 @@ bool StandardTildeExpressionResolver::ResolveExact( return !fs::real_path(Expr, Output, true); } -bool StandardTildeExpressionResolver::ResolvePartial (StringRef Expr, +bool StandardTildeExpressionResolver::ResolvePartial(StringRef Expr, StringSet<> &Output) { // We expect the tilde expression to be ONLY the expression itself, and // contain no separators. @@ -47,7 +47,7 @@ bool StandardTildeExpressionResolver::ResolvePartial (StringRef Expr, assert(Expr.empty() || Expr[0] == '~'); Output.clear(); -#if defined(_WIN32) || defined(__ANDROID__) || defined(__OHOS_FAMILY__) +#if defined(_WIN32) || defined(__ANDROID__) return false; #else if (Expr.empty()) diff --git a/lldb/test/API/api/command-return-object/Makefile b/lldb/test/API/api/command-return-object/Makefile index 680e1abfbef5..99998b20bcb0 100644 --- a/lldb/test/API/api/command-return-object/Makefile +++ b/lldb/test/API/api/command-return-object/Makefile @@ -1,4 +1,3 @@ CXX_SOURCES := main.cpp -USE_LIBCPP := 1 include Makefile.rules diff --git a/lldb/test/API/functionalities/breakpoint/thread_plan_user_breakpoint/Makefile b/lldb/test/API/functionalities/breakpoint/thread_plan_user_breakpoint/Makefile deleted file mode 100644 index 2c00681fa228..000000000000 --- a/lldb/test/API/functionalities/breakpoint/thread_plan_user_breakpoint/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -CXX_SOURCES := main.cpp - -ifneq (,$(findstring icc,$(CC))) - CXXFLAGS_EXTRAS := -debug inline-debug-info -endif - - -include Makefile.rules diff --git a/lldb/test/API/functionalities/breakpoint/thread_plan_user_breakpoint/TestThreadPlanUserBreakpoint.py b/lldb/test/API/functionalities/breakpoint/thread_plan_user_breakpoint/TestThreadPlanUserBreakpoint.py deleted file mode 100644 index c85dca24a734..000000000000 --- a/lldb/test/API/functionalities/breakpoint/thread_plan_user_breakpoint/TestThreadPlanUserBreakpoint.py +++ /dev/null @@ -1,132 +0,0 @@ -""" -Test that breakpoints (reason = breakpoint) have more priority than -plan completion (reason = step in/out/over) when reporting stop reason after step, -in particular 'step out' and 'step over', and in addition 'step in'. -Check for correct StopReason when stepping to the line with breakpoint, -which should be eStopReasonBreakpoint in general, -and eStopReasonPlanComplete when breakpoint's condition fails or it is disabled. -""" - - -import unittest2 -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - -class ThreadPlanUserBreakpointsTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - TestBase.setUp(self) - - self.build() - exe = self.getBuildArtifact("a.out") - src = lldb.SBFileSpec("main.cpp") - - # Create a target by the debugger. - self.target = self.dbg.CreateTarget(exe) - self.assertTrue(self.target, VALID_TARGET) - - # Setup three breakpoints - self.lines = [line_number('main.cpp', "breakpoint_%i" % i) for i in range(3)] - - self.breakpoints = [self.target.BreakpointCreateByLocation(src, line) for line in self.lines] - self.assertTrue( - self.breakpoints[0] and self.breakpoints[0].GetNumLocations() == 1, - VALID_BREAKPOINT) - - # Start debugging - self.process = self.target.LaunchSimple( - None, None, self.get_process_working_directory()) - self.assertIsNotNone(self.process, PROCESS_IS_VALID) - self.thread = lldbutil.get_one_thread_stopped_at_breakpoint(self.process, self.breakpoints[0]) - self.assertIsNotNone(self.thread, "Didn't stop at breakpoint 0.") - - def check_correct_stop_reason(self, breakpoint_idx, condition): - self.assertEquals(self.process.GetState(), lldb.eStateStopped) - if condition: - # All breakpoints active, stop reason is breakpoint - thread1 = lldbutil.get_one_thread_stopped_at_breakpoint(self.process, self.breakpoints[breakpoint_idx]) - self.assertEquals(self.thread, thread1, "Didn't stop at breakpoint %i." % breakpoint_idx) - else: - # Breakpoints are inactive, stop reason is plan complete - self.assertEquals(self.thread.GetStopReason(), lldb.eStopReasonPlanComplete, - "Expected stop reason to be step into/over/out for inactive breakpoint %i line." % breakpoint_idx) - - def change_breakpoints(self, action): - for i in range(1, len(self.breakpoints)): - action(self.breakpoints[i]) - - def check_thread_plan_user_breakpoint(self, condition, set_up_breakpoint_func): - # Make breakpoints active/inactive in different ways - self.change_breakpoints(lambda bp: set_up_breakpoint_func(condition, bp)) - - self.thread.StepInto() - # We should be stopped at the breakpoint_1 line with the correct stop reason - self.check_correct_stop_reason(1, condition) - - # This step-over creates a step-out from `func_1` plan - self.thread.StepOver() - # We should be stopped at the breakpoint_2 line with the correct stop reason - self.check_correct_stop_reason(2, condition) - - # Check explicit step-out - # Make sure we install the breakpoint at the right address: - # on some architectures (e.g, aarch64), step-out stops before the next source line - return_addr = self.thread.GetFrameAtIndex(1).GetPC() - step_out_breakpoint = self.target.BreakpointCreateByAddress(return_addr) - set_up_breakpoint_func(condition, step_out_breakpoint) - self.breakpoints.append(step_out_breakpoint) - - self.thread.StepOut() - # We should be stopped somewhere in the main frame with the correct stop reason - self.check_correct_stop_reason(3, condition) - - # Run the process until termination - self.process.Continue() - self.assertEquals(self.process.GetState(), lldb.eStateExited) - - def set_up_breakpoints_condition(self, condition, bp): - # Set breakpoint condition to true/false - conditionStr = 'true' if condition else 'false' - bp.SetCondition(conditionStr) - - def set_up_breakpoints_enable(self, condition, bp): - # Enable/disable breakpoint - bp.SetEnabled(condition) - - def set_up_breakpoints_callback(self, condition, bp): - # Set breakpoint callback to return True/False - bp.SetScriptCallbackBody('return %s' % condition) - - def test_thread_plan_user_breakpoint_conditional_active(self): - # Test with breakpoints 1, 2, 3 having true condition - self.check_thread_plan_user_breakpoint(condition=True, - set_up_breakpoint_func=self.set_up_breakpoints_condition) - - def test_thread_plan_user_breakpoint_conditional_inactive(self): - # Test with breakpoints 1, 2, 3 having false condition - self.check_thread_plan_user_breakpoint(condition=False, - set_up_breakpoint_func=self.set_up_breakpoints_condition) - - def test_thread_plan_user_breakpoint_unconditional_active(self): - # Test with breakpoints 1, 2, 3 enabled unconditionally - self.check_thread_plan_user_breakpoint(condition=True, - set_up_breakpoint_func=self.set_up_breakpoints_enable) - - def test_thread_plan_user_breakpoint_unconditional_inactive(self): - # Test with breakpoints 1, 2, 3 disabled unconditionally - self.check_thread_plan_user_breakpoint(condition=False, - set_up_breakpoint_func=self.set_up_breakpoints_enable) - - def test_thread_plan_user_breakpoint_callback_active(self): - # Test with breakpoints 1, 2, 3 with callback that returns 'True' - self.check_thread_plan_user_breakpoint(condition=True, - set_up_breakpoint_func=self.set_up_breakpoints_callback) - - def test_thread_plan_user_breakpoint_callback_inactive(self): - # Test with breakpoints 1, 2, 3 with callback that returns 'False' - self.check_thread_plan_user_breakpoint(condition=False, - set_up_breakpoint_func=self.set_up_breakpoints_callback) diff --git a/lldb/test/API/functionalities/breakpoint/thread_plan_user_breakpoint/main.cpp b/lldb/test/API/functionalities/breakpoint/thread_plan_user_breakpoint/main.cpp deleted file mode 100644 index cfb96add7600..000000000000 --- a/lldb/test/API/functionalities/breakpoint/thread_plan_user_breakpoint/main.cpp +++ /dev/null @@ -1,11 +0,0 @@ -int func_1() { return 1; } - -int func_2() { - func_1(); // breakpoint_1 - return 1 + func_1(); // breakpoint_2 -} - -int main(int argc, char const *argv[]) { - func_2(); // breakpoint_0 - return 0; -} diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/Makefile b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/Makefile index 4f8e551348d9..c825977b1a5d 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/Makefile +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/Makefile @@ -1,6 +1,6 @@ CXX_SOURCES := main.cpp CFLAGS_EXTRAS := -O0 -USE_LIBCPP := 1 +USE_LIBSTDCPP := 1 include Makefile.rules diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/TestDataFormatterStdMap.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/TestDataFormatterStdMap.py index 0a6dfdcee7c1..861b24b3a08b 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/TestDataFormatterStdMap.py +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/TestDataFormatterStdMap.py @@ -10,7 +10,7 @@ from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil -class StdMapDataFormatterTestCase (TestBase): +class StdMapDataFormatterTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) @@ -21,7 +21,6 @@ class StdMapDataFormatterTestCase (TestBase): self.line = line_number('main.cpp', '// Set break point at this line.') @add_test_categories(["libstdcxx"]) - @skipIfLinux # Not working on OHOS, because we use libc++ def test_with_run_command(self): """Test that that file and class static variables display correctly.""" self.build() diff --git a/lldb/test/API/functionalities/load_after_attach/Makefile b/lldb/test/API/functionalities/load_after_attach/Makefile deleted file mode 100644 index 0f3fb37bdadf..000000000000 --- a/lldb/test/API/functionalities/load_after_attach/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -CXX_SOURCES := main.cpp -USE_LIBDL := 1 - -lib_b: - $(MAKE) -f $(MAKEFILE_RULES) \ - DYLIB_ONLY=YES DYLIB_CXX_SOURCES=b.cpp DYLIB_NAME=lib_b -all: lib_b - -include Makefile.rules diff --git a/lldb/test/API/functionalities/load_after_attach/TestLoadAfterAttach.py b/lldb/test/API/functionalities/load_after_attach/TestLoadAfterAttach.py deleted file mode 100644 index 0e9b3c40ff2b..000000000000 --- a/lldb/test/API/functionalities/load_after_attach/TestLoadAfterAttach.py +++ /dev/null @@ -1,63 +0,0 @@ -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - -class TestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @skipIfRemote - def test_load_after_attach(self): - self.build() - - ctx = self.platformContext - lib_name = ctx.shlib_prefix + 'lib_b.' + ctx.shlib_extension - - exe = self.getBuildArtifact("a.out") - lib = self.getBuildArtifact(lib_name) - - # Spawn a new process. - # use realpath to workaround llvm.org/pr48376 - # Pass path to solib for dlopen to properly locate the library. - popen = self.spawnSubprocess(os.path.realpath(exe), args = [os.path.realpath(lib)]) - pid = popen.pid - - # Attach to the spawned process. - self.runCmd("process attach -p " + str(pid)) - - target = self.dbg.GetSelectedTarget() - process = target.GetProcess() - self.assertTrue(process, PROCESS_IS_VALID) - - # Continue until first breakpoint. - breakpoint1 = self.target().BreakpointCreateBySourceRegex( - "// break here", lldb.SBFileSpec("main.cpp")) - self.assertEqual(breakpoint1.GetNumResolvedLocations(), 1) - stopped_threads = lldbutil.continue_to_breakpoint(self.process(), breakpoint1) - self.assertEqual(len(stopped_threads), 1) - - # Check that image list does not contain liblib_b before dlopen. - self.match( - "image list", - patterns = [lib_name], - matching = False, - msg = lib_name + " should not have been in image list") - - # Change a variable to escape the loop - self.runCmd("expression main_thread_continue = 1") - - # Continue so that dlopen is called. - breakpoint2 = self.target().BreakpointCreateBySourceRegex( - "// break after dlopen", lldb.SBFileSpec("main.cpp")) - self.assertEqual(breakpoint2.GetNumResolvedLocations(), 1) - stopped_threads = lldbutil.continue_to_breakpoint(self.process(), breakpoint2) - self.assertEqual(len(stopped_threads), 1) - - # Check that image list contains liblib_b after dlopen. - self.match( - "image list", - patterns = [lib_name], - matching = True, - msg = lib_name + " missing in image list") - diff --git a/lldb/test/API/functionalities/load_after_attach/b.cpp b/lldb/test/API/functionalities/load_after_attach/b.cpp deleted file mode 100644 index 911447bee489..000000000000 --- a/lldb/test/API/functionalities/load_after_attach/b.cpp +++ /dev/null @@ -1 +0,0 @@ -int LLDB_DYLIB_EXPORT b_function() { return 500; } diff --git a/lldb/test/API/functionalities/load_after_attach/main.cpp b/lldb/test/API/functionalities/load_after_attach/main.cpp deleted file mode 100644 index d63bd7e2b8cd..000000000000 --- a/lldb/test/API/functionalities/load_after_attach/main.cpp +++ /dev/null @@ -1,45 +0,0 @@ -#ifdef _WIN32 -#include -#else -#include -#include -#endif - -#include -#include -#include -#include - -// We do not use the dylib.h implementation, because -// we need to pass full path to the dylib. -void* dylib_open(const char* full_path) { -#ifdef _WIN32 - return LoadLibraryA(full_path); -#else - return dlopen(full_path, RTLD_LAZY); -#endif -} - -int main(int argc, char* argv[]) { - assert(argc == 2 && "argv[1] must be the full path to lib_b library"); - const char* dylib_full_path= argv[1]; - printf("Using dylib at: %s\n", dylib_full_path); - - // Wait until debugger is attached. - int main_thread_continue = 0; - int i = 0; - int timeout = 10; - for (i = 0; i < timeout; i++) { - std::this_thread::sleep_for(std::chrono::seconds(1)); // break here - if (main_thread_continue) { - break; - } - } - assert(i != timeout && "timed out waiting for debugger"); - - // dlopen the 'liblib_b.so' shared library. - void* dylib_handle = dylib_open(dylib_full_path); - assert(dylib_handle && "dlopen failed"); - - return i; // break after dlopen -} diff --git a/lldb/test/API/functionalities/plugins/command_plugin/Makefile b/lldb/test/API/functionalities/plugins/command_plugin/Makefile index b792c8d50d98..3119c3707841 100644 --- a/lldb/test/API/functionalities/plugins/command_plugin/Makefile +++ b/lldb/test/API/functionalities/plugins/command_plugin/Makefile @@ -2,6 +2,5 @@ DYLIB_CXX_SOURCES := plugin.cpp DYLIB_NAME := plugin DYLIB_ONLY := YES MAKE_DSYM := NO -USE_LIBCPP := 1 include Makefile.rules diff --git a/lldb/test/API/lang/c/fpeval/Makefile b/lldb/test/API/lang/c/fpeval/Makefile deleted file mode 100644 index 10495940055b..000000000000 --- a/lldb/test/API/lang/c/fpeval/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -C_SOURCES := main.c - -include Makefile.rules diff --git a/lldb/test/API/lang/c/fpeval/TestFPEval.py b/lldb/test/API/lang/c/fpeval/TestFPEval.py deleted file mode 100644 index fa8a4a211994..000000000000 --- a/lldb/test/API/lang/c/fpeval/TestFPEval.py +++ /dev/null @@ -1,34 +0,0 @@ -"""Show bitfields and check that they display correctly.""" - - - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class FPEvalTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to break inside main(). - self.line = line_number('main.c', '// Set break point at this line.') - - def test_and_run_command(self): - """Test 'frame variable ...' on a variable with bitfields.""" - self.build() - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - # Break inside the main. - lldbutil.run_break_set_by_file_and_line( - self, "main.c", self.line, num_expected_locations=1, loc_exact=True) - - self.runCmd("run", RUN_SUCCEEDED) - self.expect("expr --allow-jit false -- a + b", VARIABLES_DISPLAYED_CORRECTLY, - substrs=['double', '52']) - diff --git a/lldb/test/API/lang/c/fpeval/main.c b/lldb/test/API/lang/c/fpeval/main.c deleted file mode 100644 index 1f5519401e32..000000000000 --- a/lldb/test/API/lang/c/fpeval/main.c +++ /dev/null @@ -1,10 +0,0 @@ -#include -#include -#include - -int main (int argc, char const *argv[]) -{ - double a = 42.0; - double b = 10.0; - return (long)(a + b); //// Set break point at this line. -} diff --git a/lldb/test/API/python_api/target/TestTargetAPI.py b/lldb/test/API/python_api/target/TestTargetAPI.py index 3deb775b035e..12c9d9d59aed 100644 --- a/lldb/test/API/python_api/target/TestTargetAPI.py +++ b/lldb/test/API/python_api/target/TestTargetAPI.py @@ -476,10 +476,6 @@ class TargetAPITestCase(TestBase): desc2 = get_description(symbol2) self.assertTrue(desc1 and desc2 and desc1 == desc2, "The two addresses should resolve to the same symbol") - - # LLDB_ARCH_DEFAULT is for the host arch, - # so we don't want to try to run binary built for remote device locally - @skipIfRemote def test_default_arch(self): """ Test the other two target create methods using LLDB_ARCH_DEFAULT. """ self.build() diff --git a/lldb/test/API/tools/lldb-server/TestGdbRemoteCompletion.py b/lldb/test/API/tools/lldb-server/TestGdbRemoteCompletion.py index 0e7f3cbc00a9..22af21d132da 100644 --- a/lldb/test/API/tools/lldb-server/TestGdbRemoteCompletion.py +++ b/lldb/test/API/tools/lldb-server/TestGdbRemoteCompletion.py @@ -1,5 +1,4 @@ import tempfile -import os import gdbremote_testcase from lldbsuite.test.lldbtest import * from lldbsuite.test.decorators import * @@ -12,10 +11,7 @@ class GdbRemoteCompletionTestCase(gdbremote_testcase.GdbRemoteTestCaseBase): self.debug_monitor_exe = get_lldb_server_exe() if not self.debug_monitor_exe: self.skipTest("lldb-server exe not found") - port_file = os.path.join( - lldb.remote_platform.GetWorkingDirectory(), - 'connect.sock' - ) if lldb.remote_platform else tempfile.NamedTemporaryFile().name + port_file = tempfile.NamedTemporaryFile().name commandline_args = [ "platform", "--listen", diff --git a/lldb/test/API/tools/lldb-server/memory-allocation/TestGdbRemoteMemoryAllocation.py b/lldb/test/API/tools/lldb-server/memory-allocation/TestGdbRemoteMemoryAllocation.py index 0dfa74ef010e..0644e6c2e1ec 100644 --- a/lldb/test/API/tools/lldb-server/memory-allocation/TestGdbRemoteMemoryAllocation.py +++ b/lldb/test/API/tools/lldb-server/memory-allocation/TestGdbRemoteMemoryAllocation.py @@ -73,7 +73,6 @@ class TestGdbRemoteMemoryAllocation(gdbremote_testcase.GdbRemoteTestCaseBase): True) self.expect_gdbremote_sequence() - @skipOnHuaweiCI # investigate CI test failures def test_bad_packet(self): """Make sure we get a proper error for malformed packets.""" diff --git a/lldb/test/API/tools/lldb-server/platform-process-connect/TestPlatformProcessConnect.py b/lldb/test/API/tools/lldb-server/platform-process-connect/TestPlatformProcessConnect.py index ec960c962769..74b5f2e16eeb 100644 --- a/lldb/test/API/tools/lldb-server/platform-process-connect/TestPlatformProcessConnect.py +++ b/lldb/test/API/tools/lldb-server/platform-process-connect/TestPlatformProcessConnect.py @@ -12,7 +12,7 @@ class TestPlatformProcessConnect(gdbremote_testcase.GdbRemoteTestCaseBase): @expectedFailureAll(hostoslist=["windows"], triple='.*-android') @skipIfWindows # lldb-server does not terminate correctly @skipIfDarwin # lldb-server not found correctly - @skipIfLinux + @skipIf(oslist=["linux"], archs=["arm", "aarch64"]) # Fails randomly def test_platform_process_connect(self): self.build() diff --git a/lldb/test/API/tools/lldb-server/signal-filtering/TestGdbRemote_QPassSignals.py b/lldb/test/API/tools/lldb-server/signal-filtering/TestGdbRemote_QPassSignals.py index 4c502b10ae69..8d4f464b8dee 100644 --- a/lldb/test/API/tools/lldb-server/signal-filtering/TestGdbRemote_QPassSignals.py +++ b/lldb/test/API/tools/lldb-server/signal-filtering/TestGdbRemote_QPassSignals.py @@ -61,7 +61,6 @@ class TestGdbRemote_QPassSignals(gdbremote_testcase.GdbRemoteTestCaseBase): self.expect_exit_code(len(signals_to_ignore)) @skipUnlessPlatform(["linux", "android"]) - @skipOnHuaweiCI #investigate CI timeouts def test_change_signals_at_runtime(self): self.build() self.set_inferior_startup_launch() diff --git a/lldb/test/API/tools/lldb-server/thread-name/TestGdbRemoteThreadName.py b/lldb/test/API/tools/lldb-server/thread-name/TestGdbRemoteThreadName.py index abec2ade1eec..469e5e5fedf2 100644 --- a/lldb/test/API/tools/lldb-server/thread-name/TestGdbRemoteThreadName.py +++ b/lldb/test/API/tools/lldb-server/thread-name/TestGdbRemoteThreadName.py @@ -27,7 +27,6 @@ class TestGdbRemoteThreadName(gdbremote_testcase.GdbRemoteTestCaseBase): self.assertEqual(expected_name, kv_dict.get("name")) @skipIfWindows # the test is not updated for Windows. - @skipOnHuaweiCI # investigate CI timeouts def test(self): """ Make sure lldb-server can retrieve inferior thread name""" self.build() diff --git a/lldb/test/API/tools/lldb-vscode/attach/TestVSCode_attach.py b/lldb/test/API/tools/lldb-vscode/attach/TestVSCode_attach.py index 8518efc541bd..aa7a3ae17cb0 100644 --- a/lldb/test/API/tools/lldb-vscode/attach/TestVSCode_attach.py +++ b/lldb/test/API/tools/lldb-vscode/attach/TestVSCode_attach.py @@ -44,7 +44,6 @@ class TestVSCode_attach(lldbvscode_testcase.VSCodeTestCaseBase): self.continue_to_exit() @skipIfWindows - @skipIfLinux @skipIfNetBSD # Hangs on NetBSD as well @skipIfRemote def test_by_pid(self): diff --git a/lldb/test/API/tools/lldb-vscode/runInTerminal/TestVSCode_runInTerminal.py b/lldb/test/API/tools/lldb-vscode/runInTerminal/TestVSCode_runInTerminal.py index 6bb2965a1fe9..055b5a5bed87 100644 --- a/lldb/test/API/tools/lldb-vscode/runInTerminal/TestVSCode_runInTerminal.py +++ b/lldb/test/API/tools/lldb-vscode/runInTerminal/TestVSCode_runInTerminal.py @@ -33,31 +33,20 @@ class TestVSCode_runInTerminal(lldbvscode_testcase.VSCodeTestCaseBase): with open(fifo_file, "r") as file: return file.readline() - def isTestSupported(self): - # For some strange reason, this test fails on python3.6 - if not (sys.version_info.major == 3 and sys.version_info.minor >= 7): - return False - try: - # We skip this test for debug builds because it takes too long parsing lldb's own - # debug info. Release builds are fine. - # Checking the size of the lldb-vscode binary seems to be a decent proxy for a quick - # detection. It should be far less than 1 MB in Release builds. - if os.path.getsize(os.environ["LLDBVSCODE_EXEC"]) < 1000000: - return True - except: - return False - @skipIfWindows - @skipIfLinux @skipIfRemote @skipIf(archs=no_match(['x86_64'])) def test_runInTerminal(self): - if not self.isTestSupported(): - return ''' Tests the "runInTerminal" reverse request. It makes sure that the IDE can launch the inferior with the correct environment variables and arguments. ''' + if "debug" in str(os.environ["LLDBVSCODE_EXEC"]).lower(): + # We skip this test for debug builds because it takes too long parsing lldb's own + # debug info. Release builds are fine. + # Checking this environment variable seems to be a decent proxy for a quick + # detection + return program = self.getBuildArtifact("a.out") source = 'main.c' self.build_and_launch( @@ -88,8 +77,6 @@ class TestVSCode_runInTerminal(lldbvscode_testcase.VSCodeTestCaseBase): @skipIfRemote @skipIf(archs=no_match(['x86_64'])) def test_runInTerminalInvalidTarget(self): - if not self.isTestSupported(): - return self.build_and_create_debug_adaptor() response = self.launch( "INVALIDPROGRAM", stopOnEntry=True, runInTerminal=True, args=["foobar"], env=["FOO=bar"], expectFailure=True) @@ -101,8 +88,6 @@ class TestVSCode_runInTerminal(lldbvscode_testcase.VSCodeTestCaseBase): @skipIfRemote @skipIf(archs=no_match(['x86_64'])) def test_missingArgInRunInTerminalLauncher(self): - if not self.isTestSupported(): - return proc = subprocess.run([self.lldbVSCodeExec, "--launch-target", "INVALIDPROGRAM"], capture_output=True, universal_newlines=True) self.assertTrue(proc.returncode != 0) @@ -112,8 +97,6 @@ class TestVSCode_runInTerminal(lldbvscode_testcase.VSCodeTestCaseBase): @skipIfRemote @skipIf(archs=no_match(['x86_64'])) def test_FakeAttachedRunInTerminalLauncherWithInvalidProgram(self): - if not self.isTestSupported(): - return comm_file = os.path.join(self.getBuildDir(), "comm-file") os.mkfifo(comm_file) @@ -132,8 +115,6 @@ class TestVSCode_runInTerminal(lldbvscode_testcase.VSCodeTestCaseBase): @skipIfRemote @skipIf(archs=no_match(['x86_64'])) def test_FakeAttachedRunInTerminalLauncherWithValidProgram(self): - if not self.isTestSupported(): - return comm_file = os.path.join(self.getBuildDir(), "comm-file") os.mkfifo(comm_file) @@ -151,8 +132,6 @@ class TestVSCode_runInTerminal(lldbvscode_testcase.VSCodeTestCaseBase): @skipIfRemote @skipIf(archs=no_match(['x86_64'])) def test_FakeAttachedRunInTerminalLauncherAndCheckEnvironment(self): - if not self.isTestSupported(): - return comm_file = os.path.join(self.getBuildDir(), "comm-file") os.mkfifo(comm_file) @@ -171,8 +150,6 @@ class TestVSCode_runInTerminal(lldbvscode_testcase.VSCodeTestCaseBase): @skipIfRemote @skipIf(archs=no_match(['x86_64'])) def test_NonAttachedRunInTerminalLauncher(self): - if not self.isTestSupported(): - return comm_file = os.path.join(self.getBuildDir(), "comm-file") os.mkfifo(comm_file) diff --git a/lldb/tools/driver/Driver.cpp b/lldb/tools/driver/Driver.cpp index 210a712f9741..e4a60127b65e 100644 --- a/lldb/tools/driver/Driver.cpp +++ b/lldb/tools/driver/Driver.cpp @@ -751,11 +751,11 @@ EXAMPLES: arguments passed to the debugged executable, arguments starting with a - must be passed after --. - lldb --arch x86_64 /path/to/program program argument -- --arch armv7 + lldb --arch x86_64 /path/to/program program argument -- --arch arvm7 For convenience, passing the executable after -- is also supported. - lldb --arch x86_64 -- /path/to/program program argument --arch armv7 + lldb --arch x86_64 -- /path/to/program program argument --arch arvm7 Passing one of the attach options causes lldb to immediately attach to the given process. diff --git a/lldb/tools/lldb-server/CMakeLists.txt b/lldb/tools/lldb-server/CMakeLists.txt index ae3c1069c64d..930c327cf072 100644 --- a/lldb/tools/lldb-server/CMakeLists.txt +++ b/lldb/tools/lldb-server/CMakeLists.txt @@ -5,7 +5,7 @@ set_target_properties(LLGSOptionsTableGen PROPERTIES FOLDER "lldb misc") set(LLDB_PLUGINS) -if(CMAKE_SYSTEM_NAME MATCHES "Linux|Android|OHOS") +if(CMAKE_SYSTEM_NAME MATCHES "Linux|Android") list(APPEND LLDB_PLUGINS lldbPluginProcessLinux) endif() diff --git a/lldb/tools/lldb-vscode/FifoFiles.cpp b/lldb/tools/lldb-vscode/FifoFiles.cpp index 4b14fb16f96c..b69970ec0168 100644 --- a/lldb/tools/lldb-vscode/FifoFiles.cpp +++ b/lldb/tools/lldb-vscode/FifoFiles.cpp @@ -6,9 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "FifoFiles.h" - -#if !defined(_WIN32) +#if !defined(WIN32) #include #include #include @@ -23,6 +21,8 @@ #include "lldb/lldb-defines.h" +#include "FifoFiles.h" + using namespace llvm; namespace lldb_vscode { @@ -30,13 +30,13 @@ namespace lldb_vscode { FifoFile::FifoFile(StringRef path) : m_path(path) {} FifoFile::~FifoFile() { -#if !defined(_WIN32) +#if !defined(WIN32) unlink(m_path.c_str()); #endif }; Expected> CreateFifoFile(StringRef path) { -#if defined(_WIN32) +#if defined(WIN32) return createStringError(inconvertibleErrorCode(), "Unimplemented"); #else if (int err = mkfifo(path.data(), 0600)) diff --git a/lldb/tools/lldb-vscode/FifoFiles.h b/lldb/tools/lldb-vscode/FifoFiles.h index f186f65e86c4..891b6f574601 100644 --- a/lldb/tools/lldb-vscode/FifoFiles.h +++ b/lldb/tools/lldb-vscode/FifoFiles.h @@ -9,7 +9,6 @@ #ifndef LLDB_TOOLS_LLDB_VSCODE_FIFOFILES_H #define LLDB_TOOLS_LLDB_VSCODE_FIFOFILES_H -#include "llvm/Config/llvm-config.h" // for LLVM_ON_UNIX #include "llvm/Support/Error.h" #include "JSONUtils.h" diff --git a/lldb/tools/lldb-vscode/IOStream.cpp b/lldb/tools/lldb-vscode/IOStream.cpp index cd22d906c14c..4b11b90b4c2e 100644 --- a/lldb/tools/lldb-vscode/IOStream.cpp +++ b/lldb/tools/lldb-vscode/IOStream.cpp @@ -8,7 +8,7 @@ #include "IOStream.h" -#if defined(_WIN32) +#if defined(_WIN32) #include #else #include diff --git a/lldb/tools/lldb-vscode/IOStream.h b/lldb/tools/lldb-vscode/IOStream.h index 0eb9b6fefb0d..603ae9adcc2a 100644 --- a/lldb/tools/lldb-vscode/IOStream.h +++ b/lldb/tools/lldb-vscode/IOStream.h @@ -9,8 +9,6 @@ #ifndef LLDB_TOOLS_LLDB_VSCODE_IOSTREAM_H #define LLDB_TOOLS_LLDB_VSCODE_IOSTREAM_H -#include "llvm/Config/llvm-config.h" // for LLVM_ON_UNIX - #if defined(_WIN32) // We need to #define NOMINMAX in order to skip `min()` and `max()` macro // definitions that conflict with other system headers. diff --git a/lldb/tools/lldb-vscode/RunInTerminal.cpp b/lldb/tools/lldb-vscode/RunInTerminal.cpp index 2126563d9e96..4db2806924ca 100644 --- a/lldb/tools/lldb-vscode/RunInTerminal.cpp +++ b/lldb/tools/lldb-vscode/RunInTerminal.cpp @@ -6,9 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "RunInTerminal.h" - -#if !defined(_WIN32) +#if !defined(WIN32) #include #include #include @@ -23,6 +21,8 @@ #include "lldb/lldb-defines.h" +#include "RunInTerminal.h" + using namespace llvm; namespace lldb_vscode { diff --git a/lldb/tools/lldb-vscode/VSCode.h b/lldb/tools/lldb-vscode/VSCode.h index a2e1cac8ecf9..8e7dfc078934 100644 --- a/lldb/tools/lldb-vscode/VSCode.h +++ b/lldb/tools/lldb-vscode/VSCode.h @@ -9,8 +9,6 @@ #ifndef LLDB_TOOLS_LLDB_VSCODE_VSCODE_H #define LLDB_TOOLS_LLDB_VSCODE_VSCODE_H -#include "llvm/Config/llvm-config.h" // for LLVM_ON_UNIX - #include #include #include diff --git a/lldb/tools/lldb-vscode/lldb-vscode.cpp b/lldb/tools/lldb-vscode/lldb-vscode.cpp index 9469690cd7db..c581b9b4a9a0 100644 --- a/lldb/tools/lldb-vscode/lldb-vscode.cpp +++ b/lldb/tools/lldb-vscode/lldb-vscode.cpp @@ -6,8 +6,6 @@ // //===----------------------------------------------------------------------===// -#include "VSCode.h" - #include #include #include @@ -54,6 +52,7 @@ #include "JSONUtils.h" #include "LLDBUtils.h" +#include "VSCode.h" #if defined(_WIN32) #ifndef PATH_MAX @@ -3003,8 +3002,8 @@ EXAMPLES: // emitted to the debug adaptor. void LaunchRunInTerminalTarget(llvm::opt::Arg &target_arg, llvm::StringRef comm_file, char *argv[]) { -#if defined(_WIN32) - llvm::errs() << "runInTerminal is only supported on POSIX systems\n"; +#if defined(WIN_32) + llvm::errs() << "runInTerminal is not supported on Windows\n"; exit(EXIT_FAILURE); #else RunInTerminalLauncherCommChannel comm_channel(comm_file); diff --git a/lldb/unittests/Expression/CppModuleConfigurationTest.cpp b/lldb/unittests/Expression/CppModuleConfigurationTest.cpp index daffce0d8e6d..c1d0d00dcbac 100644 --- a/lldb/unittests/Expression/CppModuleConfigurationTest.cpp +++ b/lldb/unittests/Expression/CppModuleConfigurationTest.cpp @@ -69,30 +69,12 @@ TEST_F(CppModuleConfigurationTest, Linux) { // C++ library libcpp + "/vector", libcpp + "/module.modulemap"}; - CppModuleConfiguration config(makeFiles(files), llvm::Triple()); + CppModuleConfiguration config(makeFiles(files)); EXPECT_THAT(config.GetImportedModules(), testing::ElementsAre("std")); EXPECT_THAT(config.GetIncludeDirs(), testing::ElementsAre(libcpp, ResourceInc(), usr)); } -TEST_F(CppModuleConfigurationTest, LinuxWithTargetSpecificPaths) { - // Test multiarch Linux configuration. - - std::string usr = "/usr/include"; - std::string usr_x64 = "/usr/include/x86_64-linux-gnu"; - std::string libcpp = "/usr/include/c++/v1"; - std::vector files = {// C library - usr + "/stdio.h", usr_x64 + "/endian.h", - // C++ library - libcpp + "/vector", - libcpp + "/module.modulemap"}; - CppModuleConfiguration config(makeFiles(files), - llvm::Triple("x86_64-unknown-linux-gnu")); - EXPECT_THAT(config.GetImportedModules(), testing::ElementsAre("std")); - EXPECT_THAT(config.GetIncludeDirs(), - testing::ElementsAre(libcpp, ResourceInc(), usr, usr_x64)); -} - TEST_F(CppModuleConfigurationTest, Sysroot) { // Test that having a sysroot for the whole system works fine. @@ -103,7 +85,7 @@ TEST_F(CppModuleConfigurationTest, Sysroot) { // C++ library libcpp + "/vector", libcpp + "/module.modulemap"}; - CppModuleConfiguration config(makeFiles(files), llvm::Triple()); + CppModuleConfiguration config(makeFiles(files)); EXPECT_THAT(config.GetImportedModules(), testing::ElementsAre("std")); EXPECT_THAT(config.GetIncludeDirs(), testing::ElementsAre(libcpp, ResourceInc(), usr)); @@ -119,7 +101,7 @@ TEST_F(CppModuleConfigurationTest, LinuxLocalLibCpp) { // C++ library libcpp + "/vector", libcpp + "/module.modulemap"}; - CppModuleConfiguration config(makeFiles(files), llvm::Triple()); + CppModuleConfiguration config(makeFiles(files)); EXPECT_THAT(config.GetImportedModules(), testing::ElementsAre("std")); EXPECT_THAT(config.GetIncludeDirs(), testing::ElementsAre(libcpp, ResourceInc(), usr)); @@ -137,7 +119,7 @@ TEST_F(CppModuleConfigurationTest, UnrelatedLibrary) { // C++ library libcpp + "/vector", libcpp + "/module.modulemap"}; - CppModuleConfiguration config(makeFiles(files), llvm::Triple()); + CppModuleConfiguration config(makeFiles(files)); EXPECT_THAT(config.GetImportedModules(), testing::ElementsAre("std")); EXPECT_THAT(config.GetIncludeDirs(), testing::ElementsAre(libcpp, ResourceInc(), usr)); @@ -157,7 +139,7 @@ TEST_F(CppModuleConfigurationTest, Xcode) { libcpp + "/vector", libcpp + "/module.modulemap", }; - CppModuleConfiguration config(makeFiles(files), llvm::Triple()); + CppModuleConfiguration config(makeFiles(files)); EXPECT_THAT(config.GetImportedModules(), testing::ElementsAre("std")); EXPECT_THAT(config.GetIncludeDirs(), testing::ElementsAre(libcpp, ResourceInc(), usr)); @@ -172,7 +154,7 @@ TEST_F(CppModuleConfigurationTest, LibCppV2) { // C++ library libcpp + "/vector", libcpp + "/module.modulemap"}; - CppModuleConfiguration config(makeFiles(files), llvm::Triple()); + CppModuleConfiguration config(makeFiles(files)); EXPECT_THAT(config.GetImportedModules(), testing::ElementsAre("std")); EXPECT_THAT(config.GetIncludeDirs(), testing::ElementsAre("/usr/include/c++/v2", ResourceInc(), @@ -190,7 +172,7 @@ TEST_F(CppModuleConfigurationTest, UnknownLibCppFile) { libcpp + "/non_existing_file", libcpp + "/module.modulemap", libcpp + "/vector"}; - CppModuleConfiguration config(makeFiles(files), llvm::Triple()); + CppModuleConfiguration config(makeFiles(files)); EXPECT_THAT(config.GetImportedModules(), testing::ElementsAre("std")); EXPECT_THAT(config.GetIncludeDirs(), testing::ElementsAre("/usr/include/c++/v1", ResourceInc(), @@ -204,7 +186,7 @@ TEST_F(CppModuleConfigurationTest, MissingUsrInclude) { std::vector files = {// C++ library libcpp + "/vector", libcpp + "/module.modulemap"}; - CppModuleConfiguration config(makeFiles(files), llvm::Triple()); + CppModuleConfiguration config(makeFiles(files)); EXPECT_THAT(config.GetImportedModules(), testing::ElementsAre()); EXPECT_THAT(config.GetIncludeDirs(), testing::ElementsAre()); } @@ -217,7 +199,7 @@ TEST_F(CppModuleConfigurationTest, MissingLibCpp) { // C library usr + "/stdio.h", }; - CppModuleConfiguration config(makeFiles(files), llvm::Triple()); + CppModuleConfiguration config(makeFiles(files)); EXPECT_THAT(config.GetImportedModules(), testing::ElementsAre()); EXPECT_THAT(config.GetIncludeDirs(), testing::ElementsAre()); } @@ -232,7 +214,7 @@ TEST_F(CppModuleConfigurationTest, IgnoreLibStdCpp) { // C++ library usr + "/c++/8.0.1/vector", }; - CppModuleConfiguration config(makeFiles(files), llvm::Triple()); + CppModuleConfiguration config(makeFiles(files)); EXPECT_THAT(config.GetImportedModules(), testing::ElementsAre()); EXPECT_THAT(config.GetIncludeDirs(), testing::ElementsAre()); } @@ -253,7 +235,7 @@ TEST_F(CppModuleConfigurationTest, AmbiguousCLib) { libcpp + "/vector", libcpp + "/module.modulemap", }; - CppModuleConfiguration config(makeFiles(files), llvm::Triple()); + CppModuleConfiguration config(makeFiles(files)); EXPECT_THAT(config.GetImportedModules(), testing::ElementsAre()); EXPECT_THAT(config.GetIncludeDirs(), testing::ElementsAre()); } @@ -275,7 +257,7 @@ TEST_F(CppModuleConfigurationTest, AmbiguousLibCpp) { libcpp2 + "/vector", libcpp2 + "/module.modulemap", }; - CppModuleConfiguration config(makeFiles(files), llvm::Triple()); + CppModuleConfiguration config(makeFiles(files)); EXPECT_THAT(config.GetImportedModules(), testing::ElementsAre()); EXPECT_THAT(config.GetIncludeDirs(), testing::ElementsAre()); } diff --git a/lldb/unittests/Target/CMakeLists.txt b/lldb/unittests/Target/CMakeLists.txt index d0afeb3d0047..2c3ba699b0eb 100644 --- a/lldb/unittests/Target/CMakeLists.txt +++ b/lldb/unittests/Target/CMakeLists.txt @@ -6,7 +6,6 @@ add_lldb_unittest(TargetTests PathMappingListTest.cpp RemoteAwarePlatformTest.cpp StackFrameRecognizerTest.cpp - FindFileTest.cpp LINK_LIBS lldbCore diff --git a/lldb/unittests/Target/FindFileTest.cpp b/lldb/unittests/Target/FindFileTest.cpp deleted file mode 100644 index 198c0f62cb47..000000000000 --- a/lldb/unittests/Target/FindFileTest.cpp +++ /dev/null @@ -1,97 +0,0 @@ -//===-- FindFileTest.cpp -------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#include "TestingSupport/TestUtilities.h" -#include "lldb/Host/FileSystem.h" -#include "lldb/Host/HostInfo.h" -#include "lldb/Target/PathMappingList.h" -#include "lldb/Utility/FileSpec.h" -#include "llvm/ADT/ArrayRef.h" -#include "llvm/Support/FileSystem.h" -#include "llvm/Support/FileUtilities.h" -#include "gtest/gtest.h" -#include - -using namespace llvm; -using namespace llvm::sys::fs; -using namespace lldb_private; - -namespace { -struct Matches { - FileSpec original; - llvm::StringRef remapped; - Matches(const char *o, const char *r) : original(o), remapped(r) {} - Matches(const char *o, llvm::sys::path::Style style, const char *r) - : original(o, style), remapped(r) {} -}; - -class FindFileTest : public testing::Test { -public: - void SetUp() override { - FileSystem::Initialize(); - HostInfo::Initialize(); - } - void TearDown() override { - HostInfo::Terminate(); - FileSystem::Terminate(); - } -}; -} // namespace - -static void TestFileFindings(const PathMappingList &map, - llvm::ArrayRef matches, - llvm::ArrayRef fails) { - for (const auto &fail : fails) { - SCOPED_TRACE(fail.GetCString()); - EXPECT_FALSE(map.FindFile(fail)); - } - - for (const auto &match : matches) { - SCOPED_TRACE(match.original.GetPath() + " -> " + match.remapped); - llvm::Optional remapped; - - EXPECT_TRUE(bool(remapped = map.FindFile(match.original))); - EXPECT_TRUE(FileSpec(remapped.getValue()).GetPath() == - ConstString(match.remapped).GetStringRef()); - } -} - -TEST_F(FindFileTest, FindFileTests) { - const auto *Info = testing::UnitTest::GetInstance()->current_test_info(); - llvm::SmallString<128> DirName, FileName; - int fd; - - ASSERT_NO_ERROR(createUniqueDirectory(Info->name(), DirName)); - - sys::path::append(FileName, Twine(DirName), Twine("test")); - ASSERT_NO_ERROR(openFile(FileName, fd, CD_CreateAlways, FA_Read, OF_None)); - - llvm::FileRemover dir_remover(DirName); - llvm::FileRemover file_remover(FileName); - PathMappingList map; - - map.Append(ConstString("/old"), ConstString(DirName.str()), false); - map.Append(ConstString(R"(C:\foo)"), ConstString(DirName.str()), false); - - Matches matches[] = { - {"/old", llvm::sys::path::Style::posix, DirName.c_str()}, - {"/old/test", llvm::sys::path::Style::posix, FileName.c_str()}, - {R"(C:\foo)", llvm::sys::path::Style::windows, DirName.c_str()}, - {R"(C:\foo\test)", llvm::sys::path::Style::windows, FileName.c_str()}}; - - std::vector fails{ - // path not mapped - FileSpec("/foo", llvm::sys::path::Style::posix), - FileSpec("/new", llvm::sys::path::Style::posix), - FileSpec(R"(C:\new)", llvm::sys::path::Style::windows), - // path mapped, but file not exist - FileSpec("/old/test1", llvm::sys::path::Style::posix), - FileSpec(R"(C:\foo\test2)", llvm::sys::path::Style::windows)}; - - TestFileFindings(map, matches, fails); -} diff --git a/lldb/unittests/Target/PathMappingListTest.cpp b/lldb/unittests/Target/PathMappingListTest.cpp index 90b6f1134a2b..66fd97c17f62 100644 --- a/lldb/unittests/Target/PathMappingListTest.cpp +++ b/lldb/unittests/Target/PathMappingListTest.cpp @@ -6,9 +6,9 @@ // //===----------------------------------------------------------------------===// +#include "llvm/ADT/ArrayRef.h" #include "lldb/Target/PathMappingList.h" #include "lldb/Utility/FileSpec.h" -#include "llvm/ADT/ArrayRef.h" #include "gtest/gtest.h" #include @@ -19,8 +19,6 @@ struct Matches { FileSpec original; FileSpec remapped; Matches(const char *o, const char *r) : original(o), remapped(r) {} - Matches(const char *o, llvm::sys::path::Style style, const char *r) - : original(o, style), remapped(r) {} }; } // namespace @@ -114,27 +112,3 @@ TEST(PathMappingListTest, RemapRoot) { }; TestPathMappings(map, matches, fails); } - -#ifndef _WIN32 -TEST(PathMappingListTest, CrossPlatformTests) { - PathMappingList map; - map.Append(ConstString(R"(C:\old)"), ConstString("/new"), false); - Matches matches[] = { - {R"(C:\old)", llvm::sys::path::Style::windows, "/new"}, - {R"(C:\old\)", llvm::sys::path::Style::windows, "/new"}, - {R"(C:\old\foo\.)", llvm::sys::path::Style::windows, "/new/foo"}, - {R"(C:\old\foo.c)", llvm::sys::path::Style::windows, "/new/foo.c"}, - {R"(C:\old\foo.c\.)", llvm::sys::path::Style::windows, "/new/foo.c"}, - {R"(C:\old\.\foo.c)", llvm::sys::path::Style::windows, "/new/foo.c"}, - }; - ConstString fails[] = { - ConstString("/foo"), - ConstString("/"), - ConstString("foo.c"), - ConstString("./foo.c"), - ConstString("../foo.c"), - ConstString("../bar/foo.c"), - }; - TestPathMappings(map, matches, fails); -} -#endif diff --git a/llvm-build/Makefile b/llvm-build/Makefile deleted file mode 100644 index c45575a8a990..000000000000 --- a/llvm-build/Makefile +++ /dev/null @@ -1,228 +0,0 @@ -# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. -# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without modification, -# are permitted provided that the following conditions are met: -# -# 1. Redistributions of source code must retain the above copyright notice, this list of -# conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright notice, this list -# of conditions and the following disclaimer in the documentation and/or other materials -# provided with the distribution. -# -# 3. Neither the name of the copyright holder nor the names of its contributors may be used -# to endorse or promote products derived from this software without specific prior written -# permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -ARCH = arm -ifneq ($(GCC),) -TARGET = -CROSS_COMPILE = $(GCC:%gcc=%) -CC = $(GCC) $(ARCH_CFLAGS) -MULTILIB = $(patsubst %.,%,$(shell $(CC) -print-multi-directory)) -else -TARGET = $(ARCH)-liteos-ohos -CLANG ?= clang -CROSS_COMPILE = $(CLANG:%clang=%llvm-) -CC = $(CLANG) --target=$(TARGET) $(ARCH_CFLAGS) -BUILD=x86_64-linux-gnu -MULTILIB = $(patsubst $(dir $(shell $(filter-out $(ARCH_CFLAGS),$(CC)) -print-libgcc-file-name))%,/%,$(dir $(shell $(CC) -print-libgcc-file-name))) -endif -MUSLBUILDDIR = build_$(or $(TARGET),$(ARCH))$(subst /,_,$(MULTILIB:%/=%)) -HIDE = @ -BUILD_DEBUG = false -SED_ARGS = -e '/install-libs:/s/if/and/g' - -TOPDIR = $(shell pwd)/../../../.. -MUSLDIR = $(TOPDIR)/third_party/musl -LINUXKERNELDIR = $(TOPDIR)/third_party/Linux_Kernel -OPTRTDIR = $(TOPDIR)/third_party/optimized-routines -NUTTXDIR = $(TOPDIR)/third_party/NuttX -SYSROOTDIR = $(TOPDIR)/prebuilts/lite/sysroot -LITEOSADIR = $(TOPDIR)/kernel/liteos_a -LINUXDIR = $(TOPDIR)/kernel/linux/linux-5.10 - -TARGETS = $(if $(wildcard $(LITEOSADIR)),liteos_a_user,) -TARGETS += $(if $(wildcard $(LINUXDIR)),linux_user,) - -define LINUX_TYPES_H -#ifndef _LINUX_TYPES_H -#define _LINUX_TYPES_H -#include -typedef uint32_t __u32, __le32; -#endif -endef -export LINUX_TYPES_H - -ifeq ($(ARCH),arm) -ARCH_CFLAGS = -mfloat-abi=softfp -mcpu=cortex-a7 -mfpu=neon-vfpv4 -else -ifeq ($(ARCH),aarch64) -ARCH_CFLAGS = -else -ifeq ($(ARCH),riscv64) -ARCH_CFLAGS = -else -ifeq ($(ARCH),mips) -ARCH_CFLAGS = -else -ifeq ($(ARCH),x86_64) -ARCH_CFLAGS = -else -$(warning *** warning: ARCH $(ARCH) has not been tested yet, use with cautions!) -ARCH_CFLAGS = -endif -endif -endif -endif -endif - -ifeq ($(ARCH),aarch64) -CFLAGS = -march=armv8 -O2 -Wall -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wl,-z,relro,-z,now,-z,noexecstack -else -ifeq ($(ARCH),riscv64) -CFLAGS = -march=rv64gc -O2 -Wall -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wl,-z,relro,-z,now,-z,noexecstack -else -ifeq ($(ARCH),mips) -CFLAGS = -march=mips32r2 -O2 -Wall -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wl,-z,relro,-z,now,-z,noexecstack -else -ifeq ($(ARCH),x86_64) -CFLAGS = -march=x86-64 -O2 -Wall -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wl,-z,relro,-z,now,-z,noexecstack -else -CFLAGS = -march=armv7-a -O2 -Wall -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wl,-z,relro,-z,now,-z,noexecstack -endif -endif -endif -endif - -.PHONY: $(TARGETS:%=musl_copy_for_%) -.PHONY: $(TARGETS:%=musl_patch_for_%) -.PHONY: $(TARGETS:%=musl_install_for_%) -.PHONY: $(TARGETS:%=musl_header_install_for_%) -.PHONY: $(TARGETS:%=linux_header_install_for_%) -.PHONY: $(TARGETS:%=nuttx_header_install_for_%) -.PHONY: $(TARGETS:%=optimized_routines_install_for_%) -.PHONY: all clean distclean - -all: $(TARGETS:%=musl_install_for_%) - -$(TARGETS:%=musl_copy_for_%): - $(HIDE) mkdir -p $@ - $(HIDE) cp -rfu $(MUSLDIR)/[!p]* $@ - -optimized_routines_install_for_liteos_a_user: musl_copy_for_liteos_a_user -ifneq ($(ARCH),) - $(HIDE) cp -rfp $(OPTRTDIR)/string/$(ARCH)/* $> $ $ $/dev/null && \ - make -sj install-headers - -musl_install_for_liteos_a_user: musl_patch_for_liteos_a_user - $(HIDE) cd musl_copy_for_liteos_a_user && mkdir -p $(MUSLBUILDDIR) && cd $(MUSLBUILDDIR) && \ - ../configure --prefix=$(SYSROOTDIR)/$(TARGET)/usr --target=$(TARGET) \ - --includedir=$(SYSROOTDIR)/$(TARGET)/usr/include \ - --libdir=$(SYSROOTDIR)/$(TARGET)/usr/lib/$(MULTILIB) \ - --syslibdir=$(SYSROOTDIR)/$(TARGET)/usr/lib/$(MULTILIB) \ - --build=$(BUILD) \ - $(if $(LDFLAGS),LDFLAGS="$(LDFLAGS)",) \ - CC="$(CC)" CROSS_COMPILE="$(CROSS_COMPILE)" CFLAGS="$(CFLAGS)" >/dev/null && \ - make -sj install - -musl_patch_for_linux_user: musl_copy_for_linux_user - $(HIDE) cp -rfp $(MUSLDIR)/porting/linux/user/* $/dev/null && \ - make -sj install-headers - -musl_install_for_linux_user: musl_patch_for_linux_user - $(HIDE) cd musl_copy_for_linux_user && mkdir -p $(MUSLBUILDDIR) && cd $(MUSLBUILDDIR) && \ - ../configure --prefix=$(SYSROOTDIR)/$(TARGET)/usr --target=$(TARGET) \ - --includedir=$(SYSROOTDIR)/$(TARGET)/usr/include \ - --libdir=$(SYSROOTDIR)/$(TARGET)/usr/lib/$(MULTILIB) \ - --syslibdir=$(SYSROOTDIR)/$(TARGET)/usr/lib/$(MULTILIB) \ - --build=$(BUILD) \ - CC="$(CC)" CROSS_COMPILE="$(CROSS_COMPILE)" CFLAGS="$(CFLAGS)" >/dev/null && \ - make -sj install - -clean: - $(HIDE) rm -rf musl_copy_for_* linux_header_install_for_* - -distclean: clean - $(HIDE) rm -rf $(SYSROOTDIR)/lib $(SYSROOTDIR)/usr diff --git a/llvm-build/OHOS.cmake b/llvm-build/OHOS.cmake deleted file mode 100644 index df2c08ce41ba..000000000000 --- a/llvm-build/OHOS.cmake +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright (C) 2021 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -include(Platform/Linux) - -# OHOS has soname, but binary names must end in ".so" so we cannot append -# a version number. Also we cannot portably represent symlinks on the host. -set(CMAKE_PLATFORM_NO_VERSIONED_SONAME 1) - -# OHOS reportedly ignores RPATH, and we cannot predict the install -# location anyway. -set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "") diff --git a/llvm-build/README.md b/llvm-build/README.md deleted file mode 100644 index caedd116f21c..000000000000 --- a/llvm-build/README.md +++ /dev/null @@ -1,126 +0,0 @@ -## Overview - -This readme briefly describes the functionality of our LLVM toolchain and how to build it - -1. [Build WIKI](#build_wiki) -2. [Function Introduction](#function_introduction) - - -## Build WIKI -
    - -### System Requirements for Toolchain BUild - -Ubuntu >= 16.04 -MacOS X >= 10.15.4 - -
    - -### Get Code -``` -repo init -u https://gitee.com/OpenHarmony/manifest.git -b master -m llvm-toolchain.xml -repo sync -c -repo forall -c 'git lfs pull' -``` -
    - -### Toolchain build process - -Here is an example of starting build process on Linux or MacOS: -``` -# update prebuilts, no need to run each time -./toolchain/llvm-project/llvm-build/env_prepare.sh -# build -python3 ./toolchain/llvm-project/llvm-build/build.py -``` - -1. env_prepare (one time only) -![输入图片说明](../data/one_time_setup.png) - -2. build -![输入图片说明](../data/llvm_build.png) - -
    - -### Options - -build.py options: - -``` ---skip-build # skip compile and goto package step ---skip-package # do compile without package step ---enable-assertions # enable assertion when compiling ---build-name # specify release package name ---debug # build debug version llvm toolchain ---strip # strip llvm toolchain binaries ---no-build-arm # skip triplet arm ---no-build-aarch64 # skip triplet arm64 ---no-build-x86_64 # skip triplet x86_64 ---no-lto # disable LTO optimization when build toolchain ---build-instrumented # enable instrument pgo when build toolchain ---xunit-xml-output # specify LLVM unit test XML report path ---no-build # optional, skip some targets - windows - libs - lldb-mi - lldb-server - linux - check-api -``` -
    - -### Output Layout - -When build successfully completed. following artifacts will be available in `out` directory - -`sysroot` -> sysroots for OHOS targets -`install` -> toolchain build -`*.tar.bz2` -> archived versions of toolchain and sysroots -
    - -### OHOS Archive - -1. llvm -``` -contains: -1. toolchain which provides clang compiler, lldb(-mi), clang-tidy etc. tools -2. libc++/clang_rt/asan/fuzzer libs for target device - -OHOS sync from: https://mirrors.huaweicloud.com/openharmony/compiler/clang/ -Which is the same as: out/clang-dev-${platform}-${arch}.tar.bz2 -OHOS archive to: prebuilts/clang/ohos//${platform}/llvm - -License: Apache License v2.0 with LLVM Exceptions -``` - -2. libcxx-ndk -``` -contains: provide libc++ for ndk in target device - -OHOS fetch prebuilts from: https://mirrors.huaweicloud.com/openharmony/compiler/clang/ and archive it to prebuilts/clang/ohos//${platform}/libcxx-ndk. This tar is - -License: Apache License v2.0 with LLVM Exceptions -``` - - -## Function Introduction -
    - -### Functionality - -The LLVM toolchain is built based on LLVM 12.0.1. It is used to provide capability of building ohos image. For detailed information about LLVM 12.0.1, please refer to [LLVM 12.0.1](https://lists.llvm.org/pipermail/llvm-announce/2021-July/000093.html). -
    - -### Specifically Included Triplets - -Despite all the components provided by LLVM community, we included several triplets for different types of ohos devices to our LLVM toochain, listed as below. For specification, liteos is a newly included OS name which indicate the simplified linux kernel. - -| Triplet Name | Architecture | System Kernel | System | -| ---------------------- | ------------ | ------------- | --------------- | -| arm-liteos-ohos | ARM 32bits | LiteOS | Small system | -| arm-linux-ohos | ARM 32bits | Linux | Small system | -| arm-linux-ohos | ARM 32bits | Linux | Standard system | -| aarch64-linux-ohos | ARM 64bits | Linux | Standard system | - -For detailed definition of Small System and Standard System, please refer to [System Types](https://gitee.com/openharmony/docs/blob/master/en/device-dev/Readme-EN.md). - diff --git a/llvm-build/build.py b/llvm-build/build.py deleted file mode 100755 index a747d22b7ec2..000000000000 --- a/llvm-build/build.py +++ /dev/null @@ -1,2091 +0,0 @@ -#!/usr/bin/env python3 -# Copyright (C) 2021 Huawei Device Co., Ltd. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# 2021.3.15 build for OHOS LLVM. -# Copyright (c) 2021 Huawei Device Co., Ltd. All rights reserved. - -import os -import platform -import re -import datetime -import logging -import glob -import subprocess -import shutil -import argparse -import mingw -import stat - - -class BuildConfig(): - # Defines public methods and functions and obtains script parameters. - - def __init__(self): - args = self.parse_args() - self.do_build = not args.skip_build - self.do_package = not args.skip_package - self.build_name = args.build_name - self.debug = args.debug - self.strip = args.strip - self.no_lto = args.no_lto - self.build_instrumented = args.build_instrumented - self.xunit_xml_output = args.xunit_xml_output - self.enable_assertions = args.enable_assertions - self.need_libs = self.do_build and 'libs' not in args.no_build - self.need_lldb_mi = self.do_build and 'lldb-mi' not in args.no_build - self.need_lldb_server = self.do_build and 'lldb-server' not in args.no_build - - self.no_build_arm = args.skip_build or args.no_build_arm - self.no_build_aarch64 = args.skip_build or args.no_build_aarch64 - self.no_build_riscv64 = args.skip_build or args.no_build_riscv64 - self.no_build_mipsel = args.skip_build or args.no_build_mipsel - self.no_build_x86_64 = args.skip_build or args.no_build_x86_64 - - self.discover_paths() - - self.TARGETS = 'AArch64;ARM;BPF;Mips;RISCV;X86' - self.ORIG_ENV = dict(os.environ) - self.VERSION = None # autodetected - - self.OPENHOS_SFX = '-linux-ohos' - self.LITEOS_SFX = '-liteos-ohos' - self.LLDB_PY_VERSION = '3.10' - self.CLANG_VERSION = '10.0.1' - logging.basicConfig(level=logging.INFO) - - def discover_paths(self): - # Location of llvm-build directory - self.LLVM_BUILD_DIR = os.path.abspath(os.path.dirname(__file__)) - - parent_of_llvm_build = os.path.basename(os.path.dirname(self.LLVM_BUILD_DIR)) - if parent_of_llvm_build == 'toolchain': - self.REPOROOT_DIR = os.path.abspath(os.path.join(self.LLVM_BUILD_DIR, '../..')) - else: - assert parent_of_llvm_build == 'llvm-project' - self.REPOROOT_DIR = os.path.abspath(os.path.join(self.LLVM_BUILD_DIR, '../../..')) - - self.LLVM_PROJECT_DIR = os.path.join(self.REPOROOT_DIR, 'toolchain', 'llvm-project') - self.OUT_PATH = os.path.join(self.REPOROOT_DIR, 'out') - - @staticmethod - def parse_add_argument(parser): - - parser.add_argument( - '--enable-assertions', - action='store_true', - default=False, - help='Apply assertions, some parameters are affected.') - - parser.add_argument( - '--build-name', - default='dev', - help='Release name for the package.') - - parser.add_argument( - '--debug', - action='store_true', - default=False, - help='Building Clang and LLVM Tools for Debugging (only affects stage2)') - - parser.add_argument( - '--strip', - action='store_true', - default=False, - help='Strip final LLVM binaries.') - - parser.add_argument( - '--no-build-arm', - action='store_true', - default=False, - help='Omit build os target: arm.') - - parser.add_argument( - '--no-build-aarch64', - action='store_true', - default=False, - help='Omit build os target: aarch64.') - - parser.add_argument( - '--no-build-riscv64', - action='store_true', - default=False, - help='Omit build os target: 64-bit RISC-V.') - - parser.add_argument( - '--no-build-mipsel', - action='store_true', - default=False, - help='Omit build os target: mipsel.') - - parser.add_argument( - '--no-build-x86_64', - action='store_true', - default=False, - help='Omit build os target: x86_64.') - - parser.add_argument( - '--no-lto', - action='store_true', - default=False, - help='Accelerate builds by disabling LTO (only affects llvm product)') - - parser.add_argument( - '--build-instrumented', - action='store_true', - default=False, - help='Using the PGO instrumentation to build LLVM tool') - - parser.add_argument( - '--xunit-xml-output', - default=None, - help='Output path for LLVM unit tests XML report') - - def parse_args(self): - - parser = argparse.ArgumentParser(description='Process some integers.') - - # Options to skip build or packaging, can't skip two - build_package_group = parser.add_mutually_exclusive_group() - build_package_group.add_argument( - '--skip-build', - '-sb', - action='store_true', - default=False, - help='Omit the build, perform the packaging step directly.') - - build_package_group.add_argument( - '--skip-package', - '-sp', - action='store_true', - default=False, - help='Omit the packaging, perform the packaging step directly.') - - self.parse_add_argument(parser) - - known_platforms = ('windows', 'libs', 'lldb-mi', 'lldb-server', 'linux', 'check-api') - known_platforms_str = ', '.join(known_platforms) - - class SeparatedListByCommaAction(argparse.Action): - def __call__(self, parser, namespace, vals, option_string): - for val in vals.split(','): - if val in known_platforms: - continue - else: - error = '\'{}\' invalid. Choose from {}'.format(val, known_platforms) - raise argparse.ArgumentError(self, error) - setattr(namespace, self.dest, vals.split(',')) - - parser.add_argument( - '--no-build', - action=SeparatedListByCommaAction, - default=list(), - help='Don\'t build toolchain for specified platforms. Choices: ' + known_platforms_str) - - return parser.parse_args() - - -class ClangVersion(object): - """Parse and save clang version from version file.""" - - def __init__(self, version_file): - self._parse_version_file(version_file) - - @staticmethod - def _parse(text, key): - return re.findall(r'%s\s+(\d+)' % key, text)[0] - - def _parse_version_file(self, version_file): - with open(version_file, 'r') as fp: - text = fp.read() - self.major = self._parse(text, 'CLANG_VERSION_MAJOR') - self.minor = self._parse(text, 'CLANG_VERSION_MINOR') - self.patch = self._parse(text, 'CLANG_VERSION_PATCHLEVEL') - - def long_version(self): - return '.'.join([self.major, self.minor, self.patch]) - - def short_version(self): - return '.'.join([self.major, self.minor]) - - def major_version(self): - return self.major - - -class BuildUtils(object): - - def __init__(self, build_config): - self.build_config = build_config - - self.CMAKE_BIN_DIR = os.path.abspath( - os.path.join(self.build_config.REPOROOT_DIR, 'prebuilts/cmake', self.platform_prefix(), 'bin')) - - def open_ohos_triple(self, arch): - return arch + self.build_config.OPENHOS_SFX - - def liteos_triple(self, arch): - return arch + self.build_config.LITEOS_SFX - - def set_clang_version(self, install_dir): - self.build_config.VERSION = self.get_clang_version(install_dir).long_version() - - def invoke_ninja(self, - out_path, - env, - target=None, - install=True, - build_threads=False): - - ninja_bin_path = os.path.join(self.CMAKE_BIN_DIR, 'ninja') - - ninja_list = ['-l{}'.format(build_threads)] if build_threads else [] - - ninja_target = [target] if target else [] - - self.check_call([ninja_bin_path] + ninja_list + ninja_target, cwd=out_path, env=env) - if install: - self.check_call([ninja_bin_path, 'install'], cwd=out_path, env=env) - - def invoke_cmake(self, - cmake_path, - out_path, - invoke_defines, - env): - - cmake_bin_path = os.path.join(self.CMAKE_BIN_DIR, 'cmake') - flags = ['-G', 'Ninja'] - flags += ['-DCMAKE_PREFIX_PATH=%s' % self.CMAKE_BIN_DIR] - - for key in invoke_defines: - newdef = ''.join(['-D', key, '=', invoke_defines[key]]) - flags += [newdef] - - flags += [cmake_path] - self.check_create_dir(out_path) - - self.check_call([cmake_bin_path] + flags, cwd=out_path, env=env) - - @staticmethod - def logger(): - """Returns the module level logger.""" - return logging.getLogger(__name__) - - @staticmethod - def get_clang_version(llvm_install): - version_file = os.path.join(llvm_install, 'include', 'clang', 'Basic', - 'Version.inc') - return ClangVersion(version_file) - - def check_create_dir(self, path): - if not os.path.exists(path): - """Proxy for os.makedirs with logging and dry-run support.""" - self.logger().info('makedirs %s', path) - os.makedirs(path) - - def check_rm_tree(self, tree_dir): - """Removes directory tree.""" - def chmod_and_retry(func, path, _): - if not os.access(path, os.W_OK): - os.chmod(path, stat.S_IWUSR) - return func(path) - raise IOError("rmtree on %s failed" % path) - - if os.path.exists(tree_dir): - self.logger().info('shutil rmtree %s', tree_dir) - shutil.rmtree(tree_dir, onerror=chmod_and_retry) - - def check_copy_tree(self, src_dir, dst_dir): - self.check_rm_tree(dst_dir) - """Proxy for shutil.copytree with logging and dry-run support.""" - self.logger().info('copytree %s %s', src_dir, dst_dir) - shutil.copytree(src_dir, dst_dir, symlinks=True) - - def check_copy_file(self, src_file, dst_file): - if os.path.exists(src_file): - """Proxy for shutil.copy2 with logging and dry-run support.""" - self.logger().info('copy %s %s', src_file, dst_file) - shutil.copy2(src_file, dst_file) - - def check_call(self, cmd, *args, **kwargs): - """subprocess.check_call with logging.""" - self.logger().info('check_call:%s %s', - datetime.datetime.now().strftime("%H:%M:%S"), subprocess.list2cmdline(cmd)) - - subprocess.check_call(cmd, *args, **kwargs) - - def merge_out_path(self, *args): - return os.path.abspath(os.path.join(self.build_config.OUT_PATH, *args)) - - @staticmethod - def use_platform(): - sysstr = platform.system().lower() - arch = platform.machine() - return "%s-%s" % (sysstr, arch) - - def platform_prefix(self): - prefix = self.use_platform() - if (prefix.endswith('x86_64')): - return prefix[:-3] - return prefix - - def host_is_linux(self): - return self.use_platform().startswith('linux-') - - def host_is_darwin(self): - return self.use_platform().startswith('darwin-') - - def rm_cmake_cache(self, cache_dir): - for dirpath, dirs, files in os.walk(cache_dir): - if 'CMakeCache.txt' in files: - self.logger().info('rm CMakeCache.txt on %s', cache_dir) - os.remove(os.path.join(dirpath, 'CMakeCache.txt')) - if 'CMakeFiles' in dirs: - self.logger().info('rm CMakeFiles on %s', cache_dir) - self.check_rm_tree(os.path.join(dirpath, 'CMakeFiles')) - - @staticmethod - def find_program(name): - # FIXME: Do we need Windows support here? - return os.popen('which ' + name).read().strip() - - # Base cmake options such as build type that are common across all invocations - def base_cmake_defines(self): - mac_min_version = '10.9' - defines = {} - - defines['CMAKE_BUILD_TYPE'] = 'Release' - defines['LLVM_ENABLE_ASSERTIONS'] = 'OFF' - defines['LLVM_ENABLE_TERMINFO'] = 'OFF' - defines['LLVM_ENABLE_THREADS'] = 'ON' - defines['LLVM_USE_NEWPM'] = 'ON' - defines['LLVM_ENABLE_BINDINGS'] = 'OFF' - defines['CLANG_REPOSITORY_STRING'] = 'llvm-project' - - if self.host_is_darwin(): - defines['CMAKE_OSX_DEPLOYMENT_TARGET'] = mac_min_version - defines['LLDB_INCLUDE_TESTS'] = 'OFF' - defines['LIBCXX_INCLUDE_TESTS'] = 'OFF' - - defines['COMPILER_RT_BUILD_XRAY'] = 'OFF' - return defines - - -class LlvmCore(BuildUtils): - - def __init__(self, build_config): - super(LlvmCore, self).__init__(build_config) - - def build_llvm(self, - targets, - build_dir, - install_dir, - build_name, - extra_defines=None, - extra_env=None): - - common_defines = self.base_cmake_defines() - common_defines['CMAKE_INSTALL_PREFIX'] = install_dir - common_defines['LLVM_INSTALL_UTILS'] = 'ON' - common_defines['LLVM_TARGETS_TO_BUILD'] = targets - common_defines['LLVM_BUILD_LLVM_DYLIB'] = 'ON' - - build_number = '' - if re.match(r'\d+-.\D*$', build_name): - build_number, build_name = build_name.split('-', 1) - elif re.match(r'^\d+$', build_name): - build_number = build_name - build_name = '' - elif re.match(r'^\D+$', build_name): - build_name = build_name - else: - raise Exception('Warning! Build name is invalid, because it must not contain digits. ' - 'If you want to pass digit version, please, use follow template: {NUMBER}-{SUFFIX} ' - 'or just pass number. Otherwise unit tests will fail with assertions') - - common_defines['CLANG_VENDOR'] = 'OHOS (%s) ' % build_name - common_defines['CLANG_VENDOR_BUILD_VERSION'] = build_number - common_defines.update(extra_defines) - - env = dict(self.build_config.ORIG_ENV) - if extra_env is not None: - env.update(extra_env) - - llvm_project_path = os.path.abspath(os.path.join(self.build_config.LLVM_PROJECT_DIR, 'llvm')) - - self.invoke_cmake(llvm_project_path, - build_dir, - common_defines, - env=env) - - self.invoke_ninja(out_path=build_dir, - env=env, - target=None, - install=True) - - - def llvm_compile_darwin_defines(self, llvm_defines): - if self.host_is_darwin(): - llvm_defines['LIBUNWIND_ENABLE_SHARED'] = 'OFF' - llvm_defines['LLDB_ENABLE_LIBEDIT'] = 'OFF' - llvm_defines['LLDB_NO_DEBUGSERVER'] = 'ON' - llvm_defines['LLDB_ENABLE_PYTHON'] = 'ON' - llvm_defines['COMPILER_RT_BUILD_LIBFUZZER'] = 'OFF' - llvm_defines['LLVM_BUILD_EXTERNAL_COMPILER_RT'] = 'ON' - - def llvm_compile_linux_defines(self, - llvm_defines, - debug_build=False, - no_lto=False, - build_instrumented=False): - if self.host_is_linux(): - llvm_defines['LLVM_ENABLE_LLD'] = 'ON' - llvm_defines['COMPILER_RT_BUILD_LIBFUZZER'] = 'ON' - llvm_defines['LIBCXX_ENABLE_STATIC_ABI_LIBRARY'] = 'ON' - llvm_defines['LIBCXX_ENABLE_ABI_LINKER_SCRIPT'] = 'OFF' - llvm_defines['EXECUTION_ENGINE_USE_LLVM_UNWINDER'] = '1' - llvm_defines['COMPILER_RT_USE_BUILTINS_LIBRARY'] = 'ON' - llvm_defines['LIBUNWIND_USE_COMPILER_RT'] = 'ON' - llvm_defines['LIBCXXABI_USE_COMPILER_RT'] = 'ON' - llvm_defines['LIBCXX_USE_COMPILER_RT'] = 'ON' - llvm_defines['LIBCXXABI_ENABLE_STATIC_UNWINDER'] = 'ON' - llvm_defines['LIBCXXABI_USE_LLVM_UNWINDER'] = 'YES' - llvm_defines['LIBCXXABI_STATICALLY_LINK_UNWINDER_IN_STATIC_LIBRARY'] = 'YES' - llvm_defines['LLVM_BINUTILS_INCDIR'] = '/usr/include' - - - if not build_instrumented and not no_lto and not debug_build: - llvm_defines['LLVM_ENABLE_LTO'] = 'Thin' - - @staticmethod - def llvm_compile_llvm_defines(llvm_defines, llvm_root, cflags, ldflags): - llvm_defines['LLVM_BUILD_RUNTIME'] = 'ON' - llvm_defines['LLVM_ENABLE_PROJECTS'] = \ - 'clang;lld;libunwind;libcxxabi;libcxx;compiler-rt;clang-tools-extra;openmp;lldb' - llvm_defines['LLVM_ENABLE_BINDINGS'] = 'OFF' - llvm_defines['CMAKE_C_COMPILER'] = os.path.join(llvm_root, 'bin', 'clang') - llvm_defines['CMAKE_CXX_COMPILER'] = os.path.join(llvm_root, 'bin', 'clang++') - llvm_defines['CMAKE_AR'] = os.path.join(llvm_root, 'bin', 'llvm-ar') - llvm_defines['CMAKE_RANLIB'] = os.path.join(llvm_root, 'bin', 'llvm-ranlib') - llvm_defines['LLVM_ENABLE_LIBCXX'] = 'ON' - llvm_defines['SANITIZER_ALLOW_CXXABI'] = 'OFF' - llvm_defines['LIBOMP_ENABLE_SHARED'] = 'FALSE' - llvm_defines['OPENMP_TEST_FLAGS'] = '-Wl,-ldl' - llvm_defines['CLANG_BUILD_EXAMPLES'] = 'OFF' - llvm_defines['LLDB_ENABLE_LIBEDIT'] = 'OFF' - llvm_defines['LLDB_ENABLE_PYTHON'] = 'ON' - llvm_defines['COMPILER_RT_BUILD_SANITIZERS'] = 'OFF' - llvm_defines['COMPILER_RT_BUILD_MEMPROF'] = 'OFF' - llvm_defines['CMAKE_ASM_FLAGS'] = cflags - llvm_defines['CMAKE_C_FLAGS'] = cflags - llvm_defines['CMAKE_CXX_FLAGS'] = '%s -stdlib=libc++' % cflags - llvm_defines['CMAKE_EXE_LINKER_FLAGS'] = ldflags - llvm_defines['CMAKE_SHARED_LINKER_FLAGS'] = ldflags - llvm_defines['CMAKE_MODULE_LINKER_FLAGS'] = ldflags - - def llvm_compile(self, - build_name, - out_dir, - debug_build=False, - no_lto=False, - build_instrumented=False, - xunit_xml_output=None): - - llvm_clang_install = os.path.abspath(os.path.join(self.build_config.REPOROOT_DIR, - 'prebuilts/clang/ohos', self.use_platform(), - 'clang-%s' % self.build_config.CLANG_VERSION)) - llvm_path = self.merge_out_path('llvm_make') - llvm_profdata = os.path.join(llvm_clang_install, 'bin', 'llvm-profdata') - - if self.host_is_darwin(): - ldflags = '' - else: - ldflags = '-fuse-ld=lld' - ldflags = '%s -L%s' % (ldflags, os.path.join(llvm_clang_install, 'lib')) - - llvm_extra_env = {} - llvm_extra_env['LD_LIBRARY_PATH'] = os.path.join(llvm_clang_install, 'lib') - - llvm_defines = {} - - self.llvm_compile_darwin_defines(llvm_defines) - self.llvm_compile_linux_defines(llvm_defines, debug_build, no_lto, build_instrumented) - - if self.host_is_linux(): - ldflags += ' -lunwind --rtlib=compiler-rt -stdlib=libc++' - - if xunit_xml_output: - llvm_defines['LLVM_LIT_ARGS'] = "--xunit-xml-output={} -sv".format(xunit_xml_output) - - if self.build_config.enable_assertions: - llvm_defines['LLVM_ENABLE_ASSERTIONS'] = 'ON' - - if debug_build: - llvm_defines['CMAKE_BUILD_TYPE'] = 'Debug' - - if build_instrumented: - llvm_defines['LLVM_BUILD_INSTRUMENTED'] = 'ON' - llvm_defines['LLVM_PROFDATA'] = llvm_profdata - - resource_dir = "lib/clang/10.0.1/lib/linux/libclang_rt.profile-x86_64.a" - ldflags += ' %s' % os.path.join(llvm_clang_install, resource_dir) - - cflags = '-fstack-protector-strong -fPIE' - if not self.host_is_darwin(): - ldflags += ' -Wl,-z,relro,-z,now -pie' - if self.build_config.strip: - ldflags += ' -s' - - self.llvm_compile_llvm_defines(llvm_defines, llvm_clang_install, cflags, ldflags) - - linker_path = os.path.abspath(os.path.join(self.build_config.REPOROOT_DIR, 'prebuilts', 'clang', - 'ohos', 'linux-x86_64', 'llvm', 'bin', 'ld.lld')) - llvm_defines['CMAKE_LINKER'] = linker_path - - self.build_llvm(targets=self.build_config.TARGETS, - build_dir=llvm_path, - install_dir=out_dir, - build_name=build_name, - extra_defines=llvm_defines, - extra_env=llvm_extra_env) - - def llvm_compile_windows_defines(self, - windows_defines, - cc, - cxx, - windows_sysroot): - - if self.build_config.enable_assertions: - - windows_defines['LLVM_ENABLE_ASSERTIONS'] = 'ON' - - windows_defines['LLDB_RELOCATABLE_PYTHON'] = 'OFF' - win_sysroot = self.merge_out_path( - 'clang_mingw', 'clang-%s' % self.build_config.CLANG_VERSION, 'x86_64-w64-mingw32') - windows_defines['LLDB_ENABLE_PYTHON'] = 'ON' - windows_defines['LLDB_PYTHON_HOME'] = 'python' - windows_defines['LLDB_PYTHON_RELATIVE_PATH'] = 'bin/python/lib/python%s' % (self.build_config.LLDB_PY_VERSION) - windows_defines['PYTHON_INCLUDE_DIRS'] = os.path.join(win_sysroot, - 'include', 'python%s' % self.build_config.LLDB_PY_VERSION) - windows_defines['PYTHON_LIBRARIES'] = os.path.join(win_sysroot, 'lib', 'libpython%s.dll.a' - % self.build_config.LLDB_PY_VERSION) - windows_defines['SWIG_EXECUTABLE'] = self.find_program('swig') - windows_defines['PYTHON_EXECUTABLE'] = self.find_program('python3') - - windows_defines['CMAKE_C_COMPILER'] = cc - windows_defines['CMAKE_CXX_COMPILER'] = cxx - windows_defines['CMAKE_SYSTEM_NAME'] = 'Windows' - windows_defines['CMAKE_SYSTEM_PROCESSOR'] = 'x86_64' - windows_defines['LLVM_BUILD_RUNTIME'] = 'OFF' - windows_defines['LLVM_TOOL_CLANG_TOOLS_EXTRA_BUILD'] = 'ON' - windows_defines['LLVM_TOOL_OPENMP_BUILD'] = 'OFF' - windows_defines['LLVM_INCLUDE_TESTS'] = 'OFF' - windows_defines['LLVM_ENABLE_LIBCXX'] = 'ON' - windows_defines['LLVM_ENABLE_PROJECTS'] = 'clang;clang-tools-extra;lld;lldb' - windows_defines['CLANG_BUILD_EXAMPLES'] = 'OFF' - windows_defines['CMAKE_SYSROOT'] = windows_sysroot - windows_defines['CMAKE_FIND_ROOT_PATH_MODE_INCLUDE'] = 'ONLY' - windows_defines['CMAKE_FIND_ROOT_PATH_MODE_LIBRARY'] = 'ONLY' - windows_defines['CMAKE_FIND_ROOT_PATH_MODE_PACKAGE'] = 'ONLY' - windows_defines['CMAKE_FIND_ROOT_PATH_MODE_PROGRAM'] = 'NEVER' - windows_defines['LLDB_ENABLE_LIBEDIT'] = 'OFF' - windows_defines['LLDB_RELOCATABLE_PYTHON'] = 'OFF' - - def llvm_compile_windows_flags(self, - windows_defines, - compiler_rt_path, - native_cmake_file_path, - windowstool_path, - windows64_install, - ldflags, - cflags): - - windows_defines['CROSS_TOOLCHAIN_FLAGS_NATIVE'] = ';'.join([ - '-DCMAKE_PREFIX_PATH=%s' % self.CMAKE_BIN_DIR, - '-DCOMPILER_RT_BUILD_LIBFUZZER=OFF', - '-DCMAKE_TOOLCHAIN_FILE=%s' % native_cmake_file_path, - '-DLLVM_ENABLE_LIBCXX=ON', - '-DCMAKE_BUILD_WITH_INSTALL_RPATH=TRUE', - '-DCMAKE_INSTALL_RPATH=%s' % os.path.join(windowstool_path, 'lib')] - ) - - ldflag = ['-fuse-ld=lld', - '--rtlib=compiler-rt', - '-L%s' % compiler_rt_path, - '-lunwind', '-Wl,--dynamicbase', - '-Wl,--nxcompat', - '-lucrt', - '-lucrtbase', - '-lpthread', - '-L', - os.path.join(windows64_install, 'lib'), - '-Wl,--high-entropy-va'] - ldflags.extend(ldflag) - - cflag = ['-stdlib=libc++', - '--target=x86_64-pc-windows-gnu', - '-D_LARGEFILE_SOURCE', - '-D_FILE_OFFSET_BITS=64', - '-D_WIN32_WINNT=0x0600', - '-DWINVER=0x0600', - '-D__MSVCRT_VERSION__=0x1400', - '-DMS_WIN64'] - cflags.extend(cflag) - - def llvm_compile_windows_cmake(self, - cflags, - cxxflags, - ldflags, - windows_defines): - - - zlib_path = self.merge_out_path('../', 'prebuilts', 'clang', 'host', 'windows-x86', 'toolchain-prebuilts', - 'zlib') - zlib_inc = os.path.join(zlib_path, 'include') - zlib_lib = os.path.join(zlib_path, 'lib') - - cflags.extend(['-I', zlib_inc]) - cxxflags.extend(['-I', zlib_inc]) - ldflags.extend(['-L', zlib_lib]) - - windows_defines['CMAKE_ASM_FLAGS'] = ' '.join(cflags) - windows_defines['CMAKE_C_FLAGS'] = ' '.join(cflags) - windows_defines['CMAKE_CXX_FLAGS'] = ' '.join(cxxflags) - windows_defines['CMAKE_EXE_LINKER_FLAGS'] = ' '.join(ldflags) - windows_defines['CMAKE_SHARED_LINKER_FLAGS'] = ' '.join(ldflags) - windows_defines['CMAKE_MODULE_LINKER_FLAGS'] = ' '.join(ldflags) - - - def llvm_compile_for_windows(self, - targets, - enable_assertions, - build_name): - - self.logger().info('Building llvm for windows.') - - build_dir = self.merge_out_path("windows-x86_64") - windowstool_path = self.merge_out_path('clang_mingw', 'clang-%s' % self.build_config.CLANG_VERSION) - windows64_install = self.merge_out_path('windows-x86_64-install') - windows_sysroot = os.path.join(windowstool_path, 'x86_64-w64-mingw32') - compiler_rt_path = self.merge_out_path('clang_mingw', 'clang-%s' % self.build_config.CLANG_VERSION, - 'lib', 'clang', self.build_config.CLANG_VERSION, 'lib', 'windows') - - self.check_create_dir(build_dir) - - # Write a NATIVE.cmake in windows_path that contains the compilers used - # to build native tools such as llvm-tblgen and llvm-config. This is - # used below via the CMake variable CROSS_TOOLCHAIN_FLAGS_NATIVE. - cc = os.path.join(windowstool_path, 'bin', 'clang') - cxx = os.path.join(windowstool_path, 'bin', 'clang++') - - native_cmake_file_path = os.path.join(build_dir, 'NATIVE.cmake') - native_cmake_text = ('set(CMAKE_C_COMPILER {cc})\n' - 'set(CMAKE_CXX_COMPILER {cxx})\n' - 'set(LLVM_ENABLE_PROJECTS "clang;lldb" CACHE STRING "" FORCE)\n' - 'set(LLDB_ENABLE_PYTHON "OFF" CACHE STRING "" FORCE)\n' - 'set(LLDB_DISABLE_CURSES "ON" CACHE STRING "" FORCE)\n' - 'set(LLDB_ENABLE_LIBEDIT "OFF" CACHE STRING "" FORCE)\n' - ).format(cc=cc, cxx=cxx) - - with open(native_cmake_file_path, 'w') as native_cmake_file: - native_cmake_file.write(native_cmake_text) - - # Extra cmake defines to use while building for Windows - windows_defines = {} - self.llvm_compile_windows_defines(windows_defines, cc, cxx, windows_sysroot) - - # Set CMake path, toolchain file for native compilation (to build tablegen - # etc). Also disable libfuzzer build during native compilation. - - ldflags = [] - cflags = [] - - self.llvm_compile_windows_flags(windows_defines, compiler_rt_path, native_cmake_file_path, - windowstool_path, windows64_install, ldflags, cflags) - - cxxflags = list(cflags) - - windows_extra_env = dict() - - cxxflags.append('-fuse-cxa-atexit') - cxxflags.extend(('-I', os.path.join(windows64_install, 'include', 'c++', 'v1'))) - - self.llvm_compile_windows_cmake(cflags, cxxflags, ldflags, windows_defines) - - self.build_llvm(self.build_config.TARGETS, - build_dir, - windows64_install, - build_name, - extra_defines=windows_defines, - extra_env=windows_extra_env) - - -class SysrootComposer(BuildUtils): - - def __init__(self, build_config): - super(SysrootComposer, self).__init__(build_config) - - def setup_cmake_platform(self, llvm_install): - - # OHOS.cmake already exsit on cmake prebuilts, - # but it didn't contain these two lines, so we still need OHOS.cmake. - ohos_cmake = 'OHOS.cmake' - dst_dir = self.merge_out_path( - '../prebuilts/cmake/%s/share/cmake-3.16/Modules/Platform' % self.platform_prefix()) - src_file = '%s/%s' % (self.build_config.LLVM_BUILD_DIR, ohos_cmake) - if os.path.exists(os.path.join(dst_dir, ohos_cmake)): - os.remove(os.path.join(dst_dir, ohos_cmake)) - shutil.copy2(src_file, dst_dir) - - - def build_musl(self, llvm_install, target, *extra_args): - cur_dir = os.getcwd() - os.chdir(self.build_config.LLVM_BUILD_DIR) - self.logger().info('build musl %s', self.merge_out_path('install')) - args = ['./build_musl.sh', '-t', target, - '-c', self.merge_out_path(llvm_install, 'bin'), - '-o', self.merge_out_path(), - '-T', self.build_config.REPOROOT_DIR] + list(extra_args) - self.check_call(args) - os.chdir(cur_dir) - - def install_linux_headers(self, arch, target): - dir_suffix = arch - if arch == 'x86_64': - dir_suffix = 'x86' - elif arch == 'mipsel': - dir_suffix = 'mips' - linux_kernel_dir = os.path.join('kernel_linux_patches', 'linux-5.10') - linux_kernel_path = os.path.join(self.build_config.OUT_PATH, '..', linux_kernel_dir) - ohosmusl_sysroot_dst = self.merge_out_path('sysroot', target, 'usr') - headers_tmp_dir = os.path.join(linux_kernel_path, 'prebuilts', 'usr', 'include') - self.check_copy_tree(os.path.join(headers_tmp_dir, 'linux'), - os.path.join(ohosmusl_sysroot_dst, 'include/linux')) - self.check_copy_tree(os.path.join(headers_tmp_dir, 'asm-%s' % dir_suffix,'asm'), - os.path.join(ohosmusl_sysroot_dst, 'include', 'asm')) - self.check_copy_tree(os.path.join(headers_tmp_dir, 'asm-generic'), - os.path.join(ohosmusl_sysroot_dst, 'include/asm-generic')) - - def copy_libz_to_sysroot(self, libz_path, llvm_triple): - # Install to sysroot - dest_usr = self.merge_out_path('sysroot', llvm_triple, 'usr') - dest_usr_include = os.path.join(dest_usr, 'include') - - # Copy over usr/include. - zlib_h = self.merge_out_path('../third_party/zlib', 'zlib.h') - self.check_copy_file(zlib_h, dest_usr_include) - - zconf_h = os.path.join(libz_path, 'zconf.h') - self.check_copy_file(zconf_h, dest_usr_include) - - # Copy over usr/lib. - dest_usr_lib = os.path.join(dest_usr, 'lib') - static_zlib = os.path.join(libz_path, 'libz.a') - self.check_copy_file(static_zlib, dest_usr_lib) - - -class LlvmLibs(BuildUtils): - - def __init__(self, build_config, sysroot_composer, llvm_package): - super(LlvmLibs, self).__init__(build_config) - self.sysroot_composer = sysroot_composer - self.llvm_package = llvm_package - - def build_crt_libs(self, configs, llvm_install, need_lldb_server): - for (arch, target) in configs: - self.sysroot_composer.build_musl(llvm_install, target) - if target.endswith(self.build_config.OPENHOS_SFX): - self.sysroot_composer.install_linux_headers(arch, target) - self.build_libs(need_lldb_server, - llvm_install, - target, - precompilation=True) - self.sysroot_composer.build_musl(llvm_install, target, '-l') - - def build_libs_defines(self, - llvm_triple, - defines, - cc, - cxx, - ar, - llvm_config, - ldflags, - cflags, - extra_flags): - - sysroot = self.merge_out_path('sysroot') - - defines['CMAKE_C_COMPILER'] = cc - defines['CMAKE_CXX_COMPILER'] = cxx - defines['CMAKE_AR'] = ar - defines['LLVM_CONFIG_PATH'] = llvm_config - defines['CMAKE_SYSROOT'] = sysroot - defines['CMAKE_FIND_ROOT_PATH_MODE_INCLUDE'] = 'ONLY' - defines['CMAKE_FIND_ROOT_PATH_MODE_LIBRARY'] = 'ONLY' - defines['CMAKE_FIND_ROOT_PATH_MODE_PACKAGE'] = 'ONLY' - defines['CMAKE_FIND_ROOT_PATH_MODE_PROGRAM'] = 'NEVER' - - ldflag = [ - '-fuse-ld=lld', - '-Wl,--gc-sections', - '-Wl,--build-id=sha1', - '--rtlib=compiler-rt', - '-stdlib=libc++', ] - - if not self.host_is_darwin(): - ldflag.append('-Wl,-z,relro,-z,now -pie') - if self.build_config.strip: - ldflag.append('-s') - - ldflags.extend(ldflag) - - cflag = [ - '-fstack-protector-strong', - '-fPIE', - '--target=%s' % llvm_triple, - '-ffunction-sections', - '-fdata-sections', - extra_flags, ] - - cflags.extend(cflag) - - def build_need_libs_for_windows(self): - - self.build_libs_for_windows('libcxxabi', self.build_config.enable_assertions) - self.build_libs_for_windows('libcxx', self.build_config.enable_assertions) - self.build_libs_for_windows('libunwind', self.build_config.enable_assertions) - - def build_libs(self, need_lldb_server, llvm_install, llvm_build, precompilation=False): - configs_list = [ - ('arm', self.liteos_triple('arm'), '-march=armv7-a -mfloat-abi=soft', ''), - ('arm', self.liteos_triple('arm'), '-march=armv7-a -mcpu=cortex-a7 -mfloat-abi=soft', 'a7_soft'), - ('arm', self.liteos_triple('arm'), - '-march=armv7-a -mcpu=cortex-a7 -mfloat-abi=softfp -mfpu=neon-vfpv4', 'a7_softfp_neon-vfpv4'), - ('arm', self.liteos_triple('arm'), - '-march=armv7-a -mcpu=cortex-a7 -mfloat-abi=hard -mfpu=neon-vfpv4', 'a7_hard_neon-vfpv4'), - - ('arm', self.open_ohos_triple('arm'), '-march=armv7-a -mfloat-abi=soft', ''), - ('arm', self.open_ohos_triple('arm'), '-march=armv7-a -mcpu=cortex-a7 -mfloat-abi=soft', 'a7_soft'), - ('arm', self.open_ohos_triple('arm'), - '-march=armv7-a -mcpu=cortex-a7 -mfloat-abi=softfp -mfpu=neon-vfpv4', 'a7_softfp_neon-vfpv4'), - ('arm', self.open_ohos_triple('arm'), - '-march=armv7-a -mcpu=cortex-a7 -mfloat-abi=hard -mfpu=neon-vfpv4', 'a7_hard_neon-vfpv4'), - ('aarch64', self.open_ohos_triple('aarch64'), '', ''), - ('riscv64', self.open_ohos_triple('riscv64'), '', ''), - ('mipsel', self.open_ohos_triple('mipsel'), '', ''), - ('mipsel', self.open_ohos_triple('mipsel'), '-mnan=legacy', 'nanlegacy'), - ('x86_64', self.open_ohos_triple('x86_64'), '', ''),] - - cc = os.path.join(llvm_install, 'bin', 'clang') - cxx = os.path.join(llvm_install, 'bin', 'clang++') - ar = os.path.join(llvm_install, 'bin', 'llvm-ar') - llvm_config = os.path.join(llvm_install, 'bin', 'llvm-config') - seen_arch_list = [self.liteos_triple('arm')] - - self.set_clang_version(llvm_install) - for (arch, llvm_triple, extra_flags, multilib_suffix) in configs_list: - if llvm_build != llvm_triple: - continue - - has_lldb_server = arch not in ['riscv64'] - - defines = {} - ldflags = [] - cflags = [] - self.logger().info('Build libs for %s', llvm_triple) - self.build_libs_defines(llvm_triple, defines, cc, cxx, ar, llvm_config, ldflags, cflags, extra_flags) - if arch == 'mipsel': - ldflags.append('-Wl,-z,notext') - - llvm_path = self.merge_out_path('llvm_make') - arch_list = [self.liteos_triple('arm'), self.open_ohos_triple('arm'), - self.open_ohos_triple('aarch64'), self.open_ohos_triple('riscv64'), - self.open_ohos_triple('mipsel'), self.open_ohos_triple('x86_64')] - if precompilation: - self.build_crts(llvm_install, arch, llvm_triple, cflags, ldflags, multilib_suffix, defines) - continue - self.build_libcxxabi(llvm_install, ldflags, cflags, llvm_triple, arch, multilib_suffix, defines) - self.build_libunwind(llvm_install, arch, llvm_triple, cflags, ldflags, multilib_suffix, defines) - self.build_libcxx(llvm_install, arch, llvm_triple, cflags, ldflags, multilib_suffix, defines) - self.build_libcxx(llvm_install, arch, llvm_triple, cflags, ldflags, multilib_suffix, defines, - do_build_system=False) - self.build_crts(llvm_install, arch, llvm_triple, cflags, ldflags, multilib_suffix, defines, - first_time=False) - - if llvm_triple in arch_list: - if need_lldb_server and has_lldb_server and llvm_triple not in seen_arch_list: - self.build_lldb_server(llvm_install, llvm_path, arch, llvm_triple, cflags, ldflags, - defines) - seen_arch_list.append(llvm_triple) - continue - - self.build_libomp(llvm_install, arch, llvm_triple, cflags, ldflags, multilib_suffix, defines) - self.build_libz(arch, llvm_triple, cflags, ldflags, defines) - if need_lldb_server and has_lldb_server and llvm_triple not in seen_arch_list: - self.build_lldb_server(llvm_install, llvm_path, arch, llvm_triple, cflags, ldflags, defines) - seen_arch_list.append(llvm_triple) - - def build_libcxxabi(self, - llvm_install, - ldflags, - cflags, - llvm_triple, - arch, - multilib_suffix, - defines): - - self.logger().info('Building libcxxabi for %s', arch) - - out_path = self.merge_out_path('lib', 'libcxxabi-%s' % llvm_triple) - output_intdir = self.merge_out_path(out_path, 'lib') - - libcxxabi_cflags = list(cflags) - - libcxxabi_defines = defines.copy() - libcxxabi_defines['CMAKE_EXE_LINKER_FLAGS'] = ' '.join(ldflags) - libcxxabi_defines['CMAKE_SHARED_LINKER_FLAGS'] = ' '.join(ldflags) - libcxxabi_defines['CMAKE_MODULE_LINKER_FLAGS'] = ' '.join(ldflags) - - libcxxabi_includes_str = os.path.abspath(os.path.join(self.build_config.LLVM_PROJECT_DIR, 'libcxx', 'include')) - libcxxabi_defines['LIBCXXABI_LIBCXX_INCLUDES'] = libcxxabi_includes_str - libcxxabi_defines['LIBCXXABI_ENABLE_SHARED'] = 'OFF' - libcxxabi_defines['CMAKE_C_FLAGS'] = ' '.join(libcxxabi_cflags) - libcxxabi_defines['CMAKE_CXX_FLAGS'] = ' '.join(libcxxabi_cflags) - libcxxabi_defines['CMAKE_INSTALL_PREFIX'] = llvm_install - - libcxxabi_defines['OHOS'] = '1' - libcxxabi_defines['LLVM_ENABLE_PER_TARGET_RUNTIME_DIR'] = 'ON' - libcxxabi_defines['LLVM_TARGET_MULTILIB_SUFFIX'] = multilib_suffix - libcxxabi_defines['COMPILER_RT_USE_BUILTINS_LIBRARY'] = 'ON' - libcxxabi_defines['CMAKE_SYSTEM_NAME'] = 'OHOS' - libcxxabi_defines['CMAKE_CROSSCOMPILING'] = 'True' - libcxxabi_defines['LLVM_DEFAULT_TARGET_TRIPLE'] = llvm_triple - libcxxabi_defines['LLVM_LIBRARY_OUTPUT_INTDIR'] = output_intdir - - libcxxabi_defines['CMAKE_TRY_COMPILE_TARGET_TYPE'] = 'STATIC_LIBRARY' - libcxxabi_defines['LIBCXXABI_HAS_CXA_THREAD_ATEXIT_IMPL'] = 'OFF' - - self.check_rm_tree(out_path) - cmake_libcxxabi = os.path.abspath(os.path.join(self.build_config.LLVM_PROJECT_DIR, 'libcxxabi')) - - self.invoke_cmake(cmake_libcxxabi, - out_path, - libcxxabi_defines, - env=dict(self.build_config.ORIG_ENV)) - - self.invoke_ninja(out_path=out_path, - env=dict(self.build_config.ORIG_ENV), - target=None, - install=True) - - def build_crts(self, - llvm_install, - arch, - llvm_triple, - cflags, - ldflags, - multilib_suffix, - defines, - first_time=True): - - self.logger().info('Building compiler-rt for %s', arch) - - suffix = '-' + multilib_suffix if multilib_suffix else '' - crt_path = self.merge_out_path('lib', 'clangrt-%s%s' % (llvm_triple, suffix)) - crt_install = os.path.join(llvm_install, 'lib', 'clang', self.build_config.VERSION) - - crt_extra_flags = [] - if not self.build_config.debug: - # Remove absolute paths from compiler-rt debug info emitted with -gline-tables-only - crt_extra_flags = ['-ffile-prefix-map=%s=.' % self.build_config.REPOROOT_DIR] - - crt_defines = defines.copy() - crt_defines.update(self.base_cmake_defines()) - crt_defines['CMAKE_EXE_LINKER_FLAGS'] = ' '.join(ldflags) - crt_defines['CMAKE_SHARED_LINKER_FLAGS'] = ' '.join(ldflags) - crt_defines['CMAKE_MODULE_LINKER_FLAGS'] = ' '.join(ldflags) - crt_defines['CMAKE_C_FLAGS'] = ' '.join(cflags + crt_extra_flags) - crt_defines['CMAKE_ASM_FLAGS'] = ' '.join(cflags + crt_extra_flags) - crt_defines['CMAKE_CXX_FLAGS'] = ' '.join(cflags + crt_extra_flags) - crt_defines['COMPILER_RT_TEST_COMPILER_CFLAGS'] = ' '.join(cflags) - crt_defines['OHOS'] = '1' - crt_defines['COMPILER_RT_TEST_TARGET_TRIPLE'] = llvm_triple - crt_defines['COMPILER_RT_INCLUDE_TESTS'] = 'ON' - crt_defines['CMAKE_INSTALL_PREFIX'] = crt_install - crt_defines['LLVM_TARGET_MULTILIB_SUFFIX'] = multilib_suffix - if first_time or llvm_triple == self.liteos_triple('arm'): - crt_defines['COMPILER_RT_BUILD_LIBFUZZER'] = 'OFF' - else: - crt_defines['COMPILER_RT_BUILD_LIBFUZZER'] = 'ON' - crt_defines['LLVM_ENABLE_PER_TARGET_RUNTIME_DIR'] = 'ON' - crt_defines['COMPILER_RT_USE_BUILTINS_LIBRARY'] = 'ON' - crt_defines['CMAKE_SYSTEM_NAME'] = 'OHOS' - crt_defines['CMAKE_CROSSCOMPILING'] = 'True' - crt_defines['SANITIZER_CXX_ABI'] = 'libcxxabi' - crt_defines['CMAKE_TRY_COMPILE_TARGET_TYPE'] = 'STATIC_LIBRARY' - crt_defines['COMPILER_RT_HWASAN_WITH_INTERCEPTORS'] = 'OFF' - - if not llvm_triple == self.liteos_triple('arm'): - crt_defines['COMPILER_RT_EXCLUDE_ATOMIC_BUILTIN'] = 'OFF' - if first_time: - crt_defines['COMPILER_RT_BUILD_SANITIZERS'] = 'OFF' - else: - crt_defines['COMPILER_RT_BUILD_SANITIZERS'] = 'ON' - crt_defines['COMPILER_RT_DEFAULT_TARGET_TRIPLE'] = llvm_triple - else: - crt_defines['COMPILER_RT_BUILD_SANITIZERS'] = 'OFF' - - crt_cmake_path = os.path.abspath(os.path.join(self.build_config.LLVM_PROJECT_DIR, 'compiler-rt')) - self.rm_cmake_cache(crt_path) - - self.invoke_cmake(crt_cmake_path, - crt_path, - crt_defines, - env=dict(self.build_config.ORIG_ENV)) - - self.invoke_ninja(out_path=crt_path, - env=dict(self.build_config.ORIG_ENV), - target=None, - install=True) - - def build_libunwind(self, - llvm_install, - arch, - llvm_triple, - cflags, - ldflags, - multilib_suffix, - defines): - - self.logger().info('Building libunwind for %s ', arch) - - lib_path = self.merge_out_path('lib', 'libunwind-%s' % llvm_triple) - out_dir = os.path.join(lib_path, 'lib') - - lib_cflags = list(cflags) - lib_cflags.append('-fPIC') - - lib_defines = defines.copy() - lib_defines.update(self.base_cmake_defines()) - lib_defines['CMAKE_EXE_LINKER_FLAGS'] = ' '.join(ldflags) - lib_defines['CMAKE_SHARED_LINKER_FLAGS'] = ' '.join(ldflags) - lib_defines['CMAKE_MODULE_LINKER_FLAGS'] = ' '.join(ldflags) - lib_defines['OHOS'] = '1' - lib_defines['CMAKE_ASM_FLAGS'] = ' '.join(lib_cflags) - lib_defines['CMAKE_C_FLAGS'] = ' '.join(lib_cflags) - lib_defines['CMAKE_CXX_FLAGS'] = ' '.join(lib_cflags) - lib_defines['CMAKE_INSTALL_PREFIX'] = llvm_install - lib_defines['LLVM_ENABLE_PER_TARGET_RUNTIME_DIR'] = 'ON' - lib_defines['LLVM_TARGET_MULTILIB_SUFFIX'] = multilib_suffix - lib_defines['COMPILER_RT_USE_BUILTINS_LIBRARY'] = 'ON' - lib_defines['CMAKE_SYSTEM_NAME'] = 'OHOS' - lib_defines['CMAKE_CROSSCOMPILING'] = 'True' - lib_defines['LLVM_DEFAULT_TARGET_TRIPLE'] = llvm_triple - lib_defines['LLVM_LIBRARY_OUTPUT_INTDIR'] = out_dir - lib_defines['LLVM_ENABLE_LIBCXX'] = 'ON' - lib_defines['LIBUNWIND_ENABLE_SHARED'] = 'OFF' - lib_defines['CMAKE_TRY_COMPILE_TARGET_TYPE'] = 'STATIC_LIBRARY' - lib_defines['_LIBUNWIND_USE_DLADDR'] = 'OFF' - lib_cmake_path = os.path.abspath(os.path.join(self.build_config.LLVM_PROJECT_DIR, 'libunwind')) - - self.rm_cmake_cache(lib_path) - - self.invoke_cmake(lib_cmake_path, - lib_path, - lib_defines, - env=dict(self.build_config.ORIG_ENV)) - - self.invoke_ninja(out_path=lib_path, - env=dict(self.build_config.ORIG_ENV), - target=None, - install=True) - - def build_libcxx_defines_parameters(self, - libcxx_defines, - libcxx_ldflags, - libcxx_cflags, - llvm_install, - multilib_suffix, - libcxx_path, - llvm_triple, - out_dir, - libcxx_ndk_install, - do_build_system): - - libcxx_defines['CMAKE_EXE_LINKER_FLAGS'] = ' '.join(libcxx_ldflags) - libcxx_defines['CMAKE_SHARED_LINKER_FLAGS'] = ' '.join(libcxx_ldflags) - libcxx_defines['CMAKE_MODULE_LINKER_FLAGS'] = ' '.join(libcxx_ldflags) - libcxx_defines['CMAKE_ASM_FLAGS'] = ' '.join(libcxx_cflags) - libcxx_defines['CMAKE_C_FLAGS'] = ' '.join(libcxx_cflags) - libcxx_defines['CMAKE_CXX_FLAGS'] = ' '.join(libcxx_cflags) - libcxx_defines['CMAKE_BUILD_TYPE'] = 'Release' - if do_build_system: - libcxx_defines['LIBCXX_ABI_NAMESPACE'] = '__h' - libcxx_defines['CMAKE_INSTALL_PREFIX'] = llvm_install - libcxx_defines['LIBCXX_INSTALL_HEADER_PREFIX'] = os.path.join(llvm_install, 'include', 'libcxx-ohos', '') - else: - libcxx_defines['LIBCXX_ABI_NAMESPACE'] = '__n1' - libcxx_defines['CMAKE_INSTALL_PREFIX'] = libcxx_ndk_install - libcxx_defines['LIBCXX_INSTALL_HEADER_PREFIX'] = os.path.join(libcxx_ndk_install, 'include', 'libcxx-ohos', '') - libcxx_defines['LIBCXX_OUTPUT_NAME'] = 'c++_shared' - libcxx_defines['LIBCXX_OUTPUT_STATIC_NAME'] = 'c++_static' - - libcxx_defines['LIBCXX_HEADER_DIR'] = libcxx_path - libcxx_defines['OHOS'] = '1' - libcxx_defines['LLVM_ENABLE_PER_TARGET_RUNTIME_DIR'] = 'ON' - libcxx_defines['LLVM_TARGET_MULTILIB_SUFFIX'] = multilib_suffix - libcxx_defines['COMPILER_RT_USE_BUILTINS_LIBRARY'] = 'ON' - libcxx_defines['CMAKE_SYSTEM_NAME'] = 'OHOS' - libcxx_defines['CMAKE_CROSSCOMPILING'] = 'True' - libcxx_defines['LLVM_DEFAULT_TARGET_TRIPLE'] = llvm_triple - libcxx_defines['LLVM_LIBRARY_OUTPUT_INTDIR'] = out_dir - libcxx_defines['LIBCXX_ENABLE_STATIC_ABI_LIBRARY'] = 'ON' - libcxx_defines['LIBCXX_CXX_ABI'] = 'libcxxabi' - libcxx_defines['LIBCXX_CXX_ABI_INCLUDE_PATHS'] = os.path.abspath( - os.path.join(self.build_config.LLVM_PROJECT_DIR, 'libcxxabi', 'include')) - str_cpp = 'c++' - libcxx_defines['LIBCXX_CXX_ABI_LIBRARY_PATH'] = os.path.join(llvm_install, 'lib', llvm_triple, str_cpp, multilib_suffix) - libcxx_defines['LIBCXX_USE_COMPILER_RT'] = 'ON' - libcxx_defines['LIBCXX_HAS_PTHREAD_LIB'] = 'OFF' - libcxx_defines['LIBCXX_HAS_RT_LIB'] = 'OFF' - libcxx_defines['CMAKE_TRY_COMPILE_TARGET_TYPE'] = 'STATIC_LIBRARY' - - - - def build_libcxx(self, - llvm_install, - arch, - llvm_triple, - cflags, - ldflags, - multilib_suffix, - defines, - do_build_system=True): - - self.logger().info('Building libcxx for %s', arch) - - suffix = '-' + multilib_suffix if multilib_suffix else '' - libcxx_path = self.merge_out_path('lib', 'libcxx-%s-%s%s' % ('system' if do_build_system else 'ndk', - llvm_triple, suffix)) - - out_dir = os.path.join(libcxx_path, 'lib') - libcxx_ndk_install = self.merge_out_path('libcxx-ndk') - self.check_create_dir(libcxx_ndk_install) - - libcxx_ldflags = list(ldflags) - libcxx_cflags = list(cflags) - libcxx_ldflags.append('-lunwind') - libcxx_cflags.append('-fPIC') - - libcxx_defines = defines.copy() - - self.build_libcxx_defines_parameters(libcxx_defines, - libcxx_ldflags, - libcxx_cflags, - llvm_install, - multilib_suffix, - libcxx_path, - llvm_triple, - out_dir, - libcxx_ndk_install, - do_build_system) - - libcxx_cmake_path = os.path.abspath(os.path.join(self.build_config.LLVM_PROJECT_DIR, 'libcxx')) - self.rm_cmake_cache(libcxx_path) - - self.invoke_cmake(libcxx_cmake_path, - libcxx_path, - libcxx_defines, - env=dict(self.build_config.ORIG_ENV)) - - self.invoke_ninja(out_path=libcxx_path, - env=dict(self.build_config.ORIG_ENV), - target=None, - install=True) - - def build_libomp(self, - llvm_install, - arch, - llvm_triple, - cflags, - ldflags, - multilib_suffix, - defines): - - self.logger().info('Building libomp for %s', arch) - - libomp_path = self.merge_out_path('lib', 'libomp-%s' % llvm_triple) - out_dir = os.path.join(libomp_path, 'lib') - - libomp_cflags = list(cflags) - libomp_cflags.append('-fPIC') - - libomp_defines = defines.copy() - libomp_defines.update(self.base_cmake_defines()) - libomp_defines['CMAKE_EXE_LINKER_FLAGS'] = ' '.join(ldflags) - libomp_defines['CMAKE_SHARED_LINKER_FLAGS'] = ' '.join(ldflags) - libomp_defines['CMAKE_MODULE_LINKER_FLAGS'] = ' '.join(ldflags) - - libomp_defines['OHOS'] = '1' - libomp_defines['CMAKE_ASM_FLAGS'] = ' '.join(libomp_cflags) - libomp_defines['CMAKE_C_FLAGS'] = ' '.join(libomp_cflags) - libomp_defines['CMAKE_CXX_FLAGS'] = ' '.join(libomp_cflags) - libomp_defines['OPENMP_ENABLE_LIBOMPTARGET'] = 'FALSE' - - libomp_defines['OPENMP_LIBDIR_SUFFIX'] = os.path.join(os.sep, llvm_triple, multilib_suffix) - libomp_defines['LIBOMP_ENABLE_SHARED'] = 'FALSE' - libomp_defines['CMAKE_POLICY_DEFAULT_CMP0056'] = 'NEW' - libomp_defines['CMAKE_INSTALL_PREFIX'] = llvm_install - libomp_defines['COMPILER_RT_USE_BUILTINS_LIBRARY'] = 'ON' - libomp_defines['CMAKE_SYSTEM_NAME'] = 'OHOS' - libomp_defines['CMAKE_CROSSCOMPILING'] = 'True' - libomp_defines['LLVM_LIBRARY_OUTPUT_INTDIR'] = out_dir - libomp_defines['LLVM_ENABLE_LIBCXX'] = 'ON' - libomp_defines['CMAKE_TRY_COMPILE_TARGET_TYPE'] = 'STATIC_LIBRARY' - - libomp_cmake_path = os.path.join(self.build_config.LLVM_PROJECT_DIR, 'openmp') - self.rm_cmake_cache(libomp_path) - - self.invoke_cmake(libomp_cmake_path, - libomp_path, - libomp_defines, - env=dict(self.build_config.ORIG_ENV)) - - self.invoke_ninja(out_path=libomp_path, - env=dict(self.build_config.ORIG_ENV), - target=None, - install=True) - - def build_libz(self, - arch, - llvm_triple, - cflags, - ldflags, - defines): - - self.logger().info('Building libz for %s ', arch) - - libz_path = self.merge_out_path('lib', 'libz-%s' % llvm_triple) - if llvm_triple == self.hos_triple('arm'): - ldflags.append('-lunwind') - - libz_cflags = list(cflags) - libz_cflags.append('-fPIC') - - libz_defines = defines.copy() - libz_defines.update(self.base_cmake_defines()) - libz_defines['CMAKE_EXE_LINKER_FLAGS'] = ' '.join(ldflags) - libz_defines['CMAKE_SHARED_LINKER_FLAGS'] = ' '.join(ldflags) - libz_defines['CMAKE_MODULE_LINKER_FLAGS'] = ' '.join(ldflags) - libz_defines['OHOS'] = '1' - libz_defines['CMAKE_ASM_FLAGS'] = ' '.join(libz_cflags) - libz_defines['CMAKE_C_FLAGS'] = ' '.join(libz_cflags) - libz_defines['CMAKE_CXX_FLAGS'] = ' '.join(libz_cflags) - libz_defines['CMAKE_TRY_COMPILE_TARGET_TYPE'] = 'STATIC_LIBRARY' - - libz_cmake_path = os.path.join(self.build_config.REPOROOT_DIR, 'third_party/zlib') - self.rm_cmake_cache(libz_path) - - self.invoke_cmake(libz_cmake_path, - libz_path, - libz_defines, - env=dict(self.build_config.ORIG_ENV)) - - self.invoke_ninja(out_path=libz_path, - env=dict(self.build_config.ORIG_ENV), - target=None, - install=False) - - self.sysroot_composer.copy_libz_to_sysroot(libz_path, llvm_triple) - - def build_lldb_server(self, - llvm_install, - llvm_path, - arch, - llvm_triple, - cflags, - ldflags, - defines): - - self.logger().info('Building lldb for %s', arch) - - lldb_path = self.merge_out_path('lib', 'lldb-server-%s' % llvm_triple) - crt_install = os.path.join(llvm_install, 'lib', 'clang', self.build_config.VERSION) - out_dir = os.path.join(lldb_path, 'bin') - - lldb_ldflags = list(ldflags) - lldb_cflags = list(cflags) - - lldb_ldflags.append('-lunwind') - lldb_ldflags.append('-static') - - lldb_defines = defines.copy() - lldb_defines.update(self.base_cmake_defines()) - - lldb_defines['CMAKE_EXE_LINKER_FLAGS'] = ' '.join(lldb_ldflags) - lldb_defines['CMAKE_SHARED_LINKER_FLAGS'] = ' '.join(lldb_ldflags) - lldb_defines['CMAKE_MODULE_LINKER_FLAGS'] = ' '.join(lldb_ldflags) - - lldb_defines['OHOS'] = '1' - lldb_defines['CMAKE_C_FLAGS'] = ' '.join(lldb_cflags) - lldb_defines['CMAKE_ASM_FLAGS'] = ' '.join(lldb_cflags) - lldb_defines['CMAKE_CXX_FLAGS'] = ' '.join(lldb_cflags) - lldb_defines['CMAKE_INSTALL_PREFIX'] = crt_install - lldb_defines['LLVM_ENABLE_PER_TARGET_RUNTIME_DIR'] = 'ON' - lldb_defines['COMPILER_RT_USE_BUILTINS_LIBRARY'] = 'ON' - lldb_defines['CMAKE_SYSTEM_NAME'] = 'OHOS' - lldb_defines['CMAKE_CROSSCOMPILING'] = 'True' - lldb_defines['LLVM_DEFAULT_TARGET_TRIPLE'] = llvm_triple - lldb_defines['LLVM_LIBRARY_OUTPUT_INTDIR'] = out_dir - lldb_defines['LLVM_ENABLE_LIBCXX'] = 'ON' - lldb_defines['LLVM_ENABLE_PROJECTS'] = 'clang;lldb' - lldb_defines['LLVM_TABLEGEN'] = os.path.join(llvm_install, 'bin', 'llvm-tblgen') - lldb_defines['CLANG_TABLEGEN'] = os.path.join(llvm_install, '..', llvm_path, 'bin', 'clang-tblgen') - lldb_defines['LLDB_TABLEGEN'] = os.path.join(llvm_install, '..', llvm_path, 'bin', 'lldb-tblgen') - lldb_defines['LLVM_HOST_TRIPLE'] = llvm_triple - lldb_defines['LLVM_TARGET_ARCH'] = arch - lldb_defines['LLVM_TARGETS_TO_BUILD'] = self.build_config.TARGETS - - lldb_cmake_path = os.path.join(self.build_config.LLVM_PROJECT_DIR, 'llvm') - - self.invoke_cmake(lldb_cmake_path, - lldb_path, - lldb_defines, - env=dict(self.build_config.ORIG_ENV)) - - self.invoke_ninja(out_path=lldb_path, - env=dict(self.build_config.ORIG_ENV), - target='lldb-server', - install=False) - - self.llvm_package.copy_lldb_server_to_llvm_install(lldb_path, crt_install, llvm_triple) - - @staticmethod - def build_libs_windows_cmake_defines(cmake_defines, toolchain_dir, windows_sysroot): - cmake_defines['CMAKE_C_COMPILER_WORKS'] = '1' - cmake_defines['CMAKE_CXX_COMPILER_WORKS'] = '1' - cmake_defines['CMAKE_SYSTEM_NAME'] = 'Windows' - cmake_defines['CMAKE_SYSTEM_PROCESSOR'] = 'x86_64' - cmake_defines['CMAKE_C_COMPILER'] = os.path.join(toolchain_dir, 'bin', 'clang') - cmake_defines['CMAKE_CXX_COMPILER'] = os.path.join(toolchain_dir, 'bin', 'clang++') - cmake_defines['LLVM_CONFIG_PATH'] = os.path.join(toolchain_dir, 'bin', 'llvm-config') - cmake_defines['LLVM_ENABLE_LIBCXX'] = 'ON' - cmake_defines['CMAKE_SYSROOT'] = windows_sysroot - cmake_defines['CMAKE_FIND_ROOT_PATH_MODE_INCLUDE'] = 'ONLY' - cmake_defines['CMAKE_FIND_ROOT_PATH_MODE_LIBRARY'] = 'ONLY' - cmake_defines['CMAKE_FIND_ROOT_PATH_MODE_PACKAGE'] = 'ONLY' - cmake_defines['CMAKE_FIND_ROOT_PATH_MODE_PROGRAM'] = 'NEVER' - - - def build_libs_for_windows(self, libname, enable_assertions): - - self.logger().info('Building libs for windows.') - toolchain_dir = self.merge_out_path('clang_mingw', 'clang-%s' % self.build_config.CLANG_VERSION) - install_dir = self.merge_out_path('windows-x86_64-install') - compiler_rt_path = self.merge_out_path('clang_mingw', 'clang-%s' % self.build_config.CLANG_VERSION, 'lib', 'clang', - self.build_config.CLANG_VERSION, 'lib', 'windows') - windows_sysroot = self.merge_out_path('clang_mingw', 'clang-%s' % self.build_config.CLANG_VERSION, 'x86_64-w64-mingw32') - - ldflags = ['-fuse-ld=lld', '--rtlib=compiler-rt', '-L%s' % compiler_rt_path, '-lunwind'] - cflags = ['-stdlib=libc++', '--target=x86_64-pc-windows-gnu', '-D_LARGEFILE_SOURCE', - '-D_FILE_OFFSET_BITS=64', '-D_WIN32_WINNT=0x0600', '-DWINVER=0x0600', '-D__MSVCRT_VERSION__=0x1400'] - - cmake_defines = {} - self.build_libs_windows_cmake_defines(cmake_defines, toolchain_dir, windows_sysroot) - - # Build only the static library. - cmake_defines['%s_ENABLE_SHARED' % libname.upper()] = 'OFF' - if self.build_config.enable_assertions: - cmake_defines['%s_ENABLE_ASSERTIONS' % libname.upper()] = 'ON' - - if libname == 'libcxx': - cmake_defines['LIBCXX_ENABLE_STATIC_ABI_LIBRARY'] = 'ON' - cmake_defines['LIBCXX_CXX_ABI'] = 'libcxxabi' - cmake_defines['LIBCXX_HAS_WIN32_THREAD_API'] = 'ON' - cmake_defines['LIBCXX_SUPPORTS_STD_EQ_CXX11_FLAG'] = 'TRUE' - cmake_defines['LIBCXX_CXX_ABI_INCLUDE_PATHS'] = os.path.abspath( - os.path.join(self.build_config.LLVM_PROJECT_DIR, 'libcxxabi', 'include')) - cmake_defines['LIBCXX_CXX_ABI_LIBRARY_PATH'] = os.path.join(install_dir, 'lib') - cflags.append('-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS') - - elif libname == 'libcxxabi': - cmake_defines['LIBCXXABI_LIBCXX_INCLUDES'] = os.path.abspath( - os.path.join(self.build_config.LLVM_PROJECT_DIR, 'libcxx', 'include')) - cflags.append('-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS') - cflags.append('-D_LIBCPP_HAS_THREAD_API_WIN32') - - elif libname == 'libunwind': - cmake_defines['CXX_SUPPORTS_CXX11'] = 'TRUE' - cmake_defines['CXX_SUPPORTS_CXX_STD'] = 'TRUE' - - cmake_defines['CMAKE_INSTALL_PREFIX'] = install_dir - cmake_defines['CMAKE_C_FLAGS'] = ' '.join(cflags) - cmake_defines['CMAKE_CXX_FLAGS'] = ' '.join(cflags) - cmake_defines['CMAKE_EXE_LINKER_FLAGS'] = ' '.join(ldflags) - cmake_defines['CMAKE_SHARED_LINKER_FLAGS'] = ' '.join(ldflags) - cmake_defines['CMAKE_MODULE_LINKER_FLAGS'] = ' '.join(ldflags) - - out_path = self.merge_out_path('lib', 'windows-%s' % libname) - self.check_rm_tree(out_path) - - libname_cmake_path = os.path.abspath(os.path.join(self.build_config.LLVM_PROJECT_DIR, libname)) - - self.invoke_cmake(libname_cmake_path, - out_path, - cmake_defines, - env=dict(self.build_config.ORIG_ENV)) - - self.invoke_ninja(out_path, - env=dict(self.build_config.ORIG_ENV), - install=True) - - -class LldbMi(BuildUtils): - - def __init__(self, build_config, llvm_package): - super(LldbMi, self).__init__(build_config) - self.llvm_package = llvm_package - - def build_lldb_mi(self, llvm_install): - self.logger().info('Building lldb-mi for linux.') - - llvm_path = os.path.abspath(os.path.join(self.build_config.REPOROOT_DIR, - 'prebuilts/clang/ohos', self.use_platform(), 'clang-%s' % self.build_config.CLANG_VERSION)) - lldb_mi_cmake_path = os.path.join(self.build_config.LLVM_PROJECT_DIR, '../lldb-mi') - lldb_mi_path = self.merge_out_path('lldb_mi_build') - - self.check_rm_tree(lldb_mi_path) - self.rm_cmake_cache(lldb_mi_path) - - if self.host_is_darwin(): - cflags = [] - cxxflags =[] - ldflags = ['-Wl,-rpath,%s' % '@loader_path/../lib'] - else: - cflags = [] - cxxflags =[] - ldflags = ['-fuse-ld=lld', '-Wl,-rpath,%s' % '\$ORIGIN/../lib'] - ldflags.append('-Wl,-z,relro,-z,now -pie') - if self.build_config.strip: - ldflags.append('-s') - - ldflags.append('-L%s' % os.path.join(llvm_path, 'lib')) - cxxflags.append('-std=c++14') - cxxflags.append('-fstack-protector-strong -fPIE') - cflags.append('-fstack-protector-strong -fPIE') - - lldb_mi_defines = {} - lldb_mi_defines['CMAKE_C_COMPILER'] = os.path.join(llvm_path, 'bin', 'clang') - lldb_mi_defines['CMAKE_CXX_COMPILER'] = os.path.join(llvm_path, 'bin', 'clang++') - lldb_mi_defines['CMAKE_C_FLAGS'] = ' '.join(cflags) - lldb_mi_defines['CMAKE_CXX_FLAGS'] = ' '.join(cxxflags) - lldb_mi_defines['CMAKE_EXE_LINKER_FLAGS'] = ' '.join(ldflags) - lldb_mi_defines['CMAKE_SHARED_LINKER_FLAGS'] = ' '.join(ldflags) - lldb_mi_defines['CMAKE_MODULE_LINKER_FLAGS'] = ' '.join(ldflags) - lldb_mi_defines['LLVM_DIR'] = os.path.join(llvm_install, 'lib/cmake/llvm/') - lldb_mi_defines['LLVM_ENABLE_LIBCXX'] = 'ON' - lldb_mi_defines['CMAKE_INSTALL_PREFIX'] = llvm_install - - self.invoke_cmake(lldb_mi_cmake_path, - lldb_mi_path, - lldb_mi_defines, - env=dict(self.build_config.ORIG_ENV)) - - self.invoke_ninja(lldb_mi_path, - env=dict(self.build_config.ORIG_ENV), - install=False) - - self.llvm_package.copy_lldb_mi_to_llvm_install(lldb_mi_path, llvm_install) - - @staticmethod - def ldflags_lists_define(): - ldflags_lists = ['-Wl,--dynamicbase', - '-Wl,--nxcompat', - '-lucrt', - '-lucrtbase', - '-lpthread', - '-L', ] - return ldflags_lists - - @staticmethod - def cflags_lists_define(): - cflags_lists = ['-D_LARGEFILE_SOURCE', - '-D_FILE_OFFSET_BITS=64', - '-D_WIN32_WINNT=0x0600', - '-DWINVER=0x0600', - '-D__MSVCRT_VERSION__=0x1400', - '-DMS_WIN64', ] - return cflags_lists - - # Extra cmake defines to use while building for Windows - def lldb_mi_windefines_dictionary(self, cc, cxx, windows_sysroot, cflags, cxxflags, ldflags): - lldb_mi_windefines = {} - lldb_mi_windefines['CMAKE_C_COMPILER'] = cc - lldb_mi_windefines['CMAKE_CXX_COMPILER'] = cxx - lldb_mi_windefines['CMAKE_C_COMPILER_WORKS'] = '1' - lldb_mi_windefines['CMAKE_CXX_COMPILER_WORKS'] = '1' - lldb_mi_windefines['CMAKE_SYSTEM_NAME'] = 'Windows' - lldb_mi_windefines['CMAKE_SYSTEM_PROCESSOR'] = 'x86_64' - lldb_mi_windefines['LLVM_ENABLE_LIBCXX'] = 'ON' - lldb_mi_windefines['CMAKE_SYSROOT'] = windows_sysroot - lldb_mi_windefines['LLVM_INSTALL_PREFIX'] = self.merge_out_path('windows-x86_64-install') - lldb_mi_windefines['LLVM_DIR'] = self.merge_out_path('windows-x86_64-install/lib/cmake/llvm/') - lldb_mi_windefines['CMAKE_C_FLAGS'] = ' '.join(cflags) - lldb_mi_windefines['CMAKE_CXX_FLAGS'] = ' '.join(cxxflags) - lldb_mi_windefines['CMAKE_EXE_LINKER_FLAGS'] = ' '.join(ldflags) - lldb_mi_windefines['CMAKE_SHARED_LINKER_FLAGS'] = ' '.join(ldflags) - lldb_mi_windefines['CMAKE_MODULE_LINKER_FLAGS'] = ' '.join(ldflags) - - if self.build_config.enable_assertions: - lldb_mi_windefines['LLVM_ENABLE_ASSERTIONS'] = 'ON' - - return lldb_mi_windefines - - - def build_lldb_mi_for_windows(self): - self.logger().info('Building lldb-mi for windows.') - - build_dir = self.merge_out_path('clang_mingw', 'clang-%s' % self.build_config.CLANG_VERSION) - lldb_mi_windows64_path = self.merge_out_path('windows-x86_64-lldb-mi') - lldb_mi_cmake_path = os.path.abspath(os.path.join(self.build_config.LLVM_PROJECT_DIR, '../lldb-mi')) - windows64_install = self.merge_out_path('windows-x86_64-install') - cc = os.path.join(build_dir, 'bin', 'clang') - cxx = os.path.join(build_dir, 'bin', 'clang++') - - windows_sysroot = self.merge_out_path('clang_mingw', 'clang-%s' % self.build_config.CLANG_VERSION, 'x86_64-w64-mingw32') - self.check_create_dir(lldb_mi_windows64_path) - compiler_rt_path = self.merge_out_path('clang_mingw', 'clang-%s' % self.build_config.CLANG_VERSION, - 'lib', 'clang', self.build_config.CLANG_VERSION, 'lib', 'windows') - - ldflags = ['-fuse-ld=lld', - '--rtlib=compiler-rt', - '-L%s' % compiler_rt_path, - '-lunwind', - '-L%s' % os.path.join(windows64_install, 'lib'), - ] - ldflags.extend(self.ldflags_lists_define()) - ldflags.append(os.path.join(windows64_install, 'lib')) - ldflags.append('-Wl,--high-entropy-va') - - - cflags = ['-stdlib=libc++', - '--target=x86_64-pc-windows-gnu', - ] - cflags.extend(self.cflags_lists_define()) - cflags.append('-fno-exceptions') - cflags.append('-fno-rtti') - - cxxflags = list(cflags) - cxxflags.extend(('-I', os.path.join(windows64_install, 'include', 'c++', 'v1'))) - - zlib_path = os.path.abspath( - os.path.join('../../', 'prebuilts', 'clang', 'host', 'windows-x86', 'toolchain-prebuilts', 'zlib')) - zlib_inc = os.path.join(zlib_path, 'include') - zlib_lib = os.path.join(zlib_path, 'lib') - - cflags.extend(['-I', zlib_inc]) - cxxflags.extend(['-I', zlib_inc]) - ldflags.extend(['-L', zlib_lib]) - - - lldb_mi_env = dict(self.build_config.ORIG_ENV) - lldb_mi_env['LD_LIBRARY_PATH'] = os.path.join(build_dir, 'lib') - self.rm_cmake_cache(lldb_mi_windows64_path) - - self.invoke_cmake(lldb_mi_cmake_path, - lldb_mi_windows64_path, - self.lldb_mi_windefines_dictionary(cc, cxx, windows_sysroot, cflags, cxxflags, ldflags), - env=lldb_mi_env) - - self.invoke_ninja(lldb_mi_windows64_path, - env=lldb_mi_env, - install=False) - - self.llvm_package.copy_lldb_mi_to_windows(windows64_install, lldb_mi_windows64_path) - - -class LlvmPackage(BuildUtils): - - def __init__(self, build_config): - super(LlvmPackage, self).__init__(build_config) - - def copy_lldb_server_to_llvm_install(self, lldb_path, crt_install, llvm_triple): - # Copy lldb-server - libname = 'lldb-server' - src_lib = os.path.join(lldb_path, 'bin', libname) - dst_dir = os.path.join(crt_install, 'bin', llvm_triple) - self.check_create_dir(dst_dir) - self.check_copy_file(src_lib, os.path.join(dst_dir, libname)) - - def copy_lldb_mi_to_llvm_install(self, lldb_mi_path, llvm_install): - # Copy lldb-mi - lldb_mi_dst = os.path.join(llvm_install, 'bin', 'lldb-mi') - lldb_mi_src = os.path.join(lldb_mi_path, 'src', 'lldb-mi') - - if os.path.exists(lldb_mi_dst): - os.remove(lldb_mi_dst) - self.check_copy_file(lldb_mi_src, lldb_mi_dst) - - def copy_lldb_mi_to_windows(self, windows64_install, lldb_mi_windows64_path): - # Copy lldb-mi for windows - lldb_mi_dst = os.path.join(windows64_install, 'bin', 'lldb-mi.exe') - lldb_mi_src = os.path.join(lldb_mi_windows64_path, 'src', 'lldb-mi.exe') - if os.path.exists(lldb_mi_dst): - os.remove(lldb_mi_dst) - self.check_copy_file(lldb_mi_src, lldb_mi_dst) - - def package_libcxx(self): - libcxx_ndk_install=self.merge_out_path('libcxx-ndk') - libcxx_ndk_install_include=self.merge_out_path(libcxx_ndk_install, 'include', 'libcxx-ohos', 'include', 'c++', 'v1') - hosts_list=['linux-x86_64', 'darwin-x86_64', 'windows-x86_64', 'darwin-arm64'] - - if os.path.exists(libcxx_ndk_install): - for headerfile in os.listdir(libcxx_ndk_install_include): - if not headerfile =='__config': - if os.path.isdir(os.path.join(libcxx_ndk_install_include, headerfile)): - shutil.rmtree(os.path.join(libcxx_ndk_install_include, headerfile)) - else: - os.remove(os.path.join(libcxx_ndk_install_include, headerfile)) - - #Package libcxx-ndk - for host in hosts_list: - tarball_name = 'libcxx-ndk-%s-%s' % (self.build_config.build_name, host) - package_path = '%s%s' % (self.merge_out_path(tarball_name), '.tar.bz2') - self.logger().info('Packaging %s', package_path) - args = ['tar', '-chjC', self.build_config.OUT_PATH, '-f', package_path, 'libcxx-ndk'] - self.check_call(args) - self.check_rm_tree(libcxx_ndk_install) - - @staticmethod - def merge_tree(src_dir, dst_dir): - for item in os.listdir(src_dir): - src_path = os.path.join(src_dir, item) - dst_path = os.path.join(dst_dir, item) - if os.path.isfile(src_path): - shutil.copyfile(src_path, dst_path) - else: - shutil.copytree(src_path, dst_path) - - - def install_mingw_python(self, install_dir): - py_root = self.merge_out_path('../third_party', 'mingw-w64', 'mingw-w64-python', - self.build_config.LLDB_PY_VERSION) - bin_root = os.path.join(install_dir, 'bin') - py_dll = 'libpython' + self.build_config.LLDB_PY_VERSION + '.dll' - shutil.copyfile(os.path.join(py_root, py_dll), os.path.join(bin_root, py_dll)) - self.merge_tree(os.path.join(py_root, 'lib'), - os.path.join(bin_root, 'python', 'lib', 'python%s' % self.build_config.LLDB_PY_VERSION)) - - - - - - def windows_lib_files_operation(self, lib_files, lib_dir, install_dir): - - # Remove unnecessary Windows lib files. - windows_necessary_lib_files = ['libc++.a', 'libc++abi.a'] - - for lib_file in lib_files: - if lib_file.endswith('.a') and lib_file not in windows_necessary_lib_files: - static_library = os.path.join(lib_dir, lib_file) - os.remove(static_library) - - for necessary_lib_file in windows_necessary_lib_files: - if not os.path.isfile(os.path.join(lib_dir, necessary_lib_file)): - raise RuntimeError('Did not find %s under %s' % (necessary_lib_file, lib_dir)) - self.install_mingw_python(install_dir) - - - def darwin_stripped_xargs(self, bin_dir, necessary_bin_files, script_bins, need_x_bins_darwin): - for bin_filename in os.listdir(bin_dir): - binary = os.path.join(bin_dir, bin_filename) - if not os.path.isfile(binary): - continue - if bin_filename not in necessary_bin_files: - os.remove(binary) - elif bin_filename not in script_bins and self.build_config.strip: - if bin_filename not in need_x_bins_darwin and self.host_is_darwin(): - self.check_call(['strip', '-x', binary]) - else: - self.check_call(['strip', binary]) - - - def strip_lldb_server(self, host, install_dir): - clang_version_bin_dir = os.path.join(install_dir, 'lib', 'clang', self.build_config.CLANG_VERSION, 'bin') - - if not host.startswith('linux') or not os.path.exists(clang_version_bin_dir) or not self.build_config.strip: - return - llvm_strip = os.path.join(install_dir, 'bin', 'llvm-strip') - for llvm_triple_dir in os.listdir(clang_version_bin_dir): - llvm_triple_bin_dir = os.path.join(clang_version_bin_dir, llvm_triple_dir) - - if not os.path.isdir(llvm_triple_bin_dir): - continue - - for bin_filename in os.listdir(llvm_triple_bin_dir): - binary = os.path.join(llvm_triple_bin_dir, bin_filename) - if os.path.isfile(binary): - self.check_call([llvm_strip, binary]) - - - def notice_prebuilts_file(self, host, projects, install_dir): - - # Fetch all the LICENSE.* files under our projects and append them into a - # Single NOTICE file for the resulting prebuilts. - notices = [] - for project in projects: - license_pattern = os.path.abspath(os.path.join(self.build_config.LLVM_PROJECT_DIR, project, 'LICENSE.*')) - for license_file in glob.glob(license_pattern): - with open(license_file) as notice_file: - notices.append(notice_file.read()) - - zlib_license_file = os.path.abspath(os.path.join(self.build_config.REPOROOT_DIR, 'third_party/zlib/LICENSE')) - with open(zlib_license_file) as notice_file: - notices.append(notice_file.read()) - - if host.startswith('windows'): - mingw_license_file = os.path.abspath(os.path.join(self.build_config.REPOROOT_DIR, - 'third_party/mingw-w64/COPYING')) - with open(mingw_license_file) as notice_file: - notices.append(notice_file.read()) - - with open(os.path.join(install_dir, 'NOTICE'), 'w') as notice_file: - notice_file.write('\n'.join(notices)) - - - def tar_windows_mingw(self, host): - - if host.startswith('windows'): - windows64_install = self.merge_out_path('windows-x86_64-install') - clang_mingw_dir = self.merge_out_path('clang_mingw') - clang_mingw_sysroot_dir = os.path.join(clang_mingw_dir, 'clang-%s' % self.build_config.CLANG_VERSION, 'x86_64-w64-mingw32') - package_name = 'clang-mingw-%s' % self.build_config.build_name - clang_mingw_sysroot_lib_dir = os.path.join(clang_mingw_sysroot_dir, 'lib') - clang_windows_lib_dir = os.path.join(windows64_install, 'lib') - - necessary_lib = {'libc++abi.a', 'libc++.a', 'libunwind.a'} - for libname in necessary_lib: - shutil.copy2(os.path.join(clang_windows_lib_dir, libname), clang_mingw_sysroot_lib_dir) - - self.check_copy_tree(os.path.join(windows64_install, 'include', 'c++'), - os.path.join(clang_mingw_sysroot_dir, 'include', 'c++')) - - lib_files = [] - if os.path.isdir(os.path.join(clang_mingw_dir, 'clang-%s' % self.build_config.CLANG_VERSION, 'lib')): - lib_files = os.listdir(os.path.join(clang_mingw_dir, 'clang-%s' % self.build_config.CLANG_VERSION, 'lib')) - for lib_file in lib_files: - if lib_file.endswith('.a'): - static_library = os.path.join(os.path.join(clang_mingw_dir, 'clang-%s' % self.build_config.CLANG_VERSION, 'lib'), lib_file) - os.remove(static_library) - - self.check_rm_tree(os.path.join(clang_mingw_dir, 'clang-%s' % self.build_config.CLANG_VERSION, 'include')) - - package_path = '%s%s' % (self.merge_out_path(package_name), '.tar.bz2') - self.logger().info('Packaging %s', package_path) - toolchain_name = 'clang-%s' % self.build_config.build_name - self.check_copy_tree(os.path.join(clang_mingw_dir, 'clang-%s' % self.build_config.CLANG_VERSION), - os.path.join(clang_mingw_dir, toolchain_name)) - args = ['tar', '-cjC', clang_mingw_dir, '-f', package_path, toolchain_name] - self.check_call(args) - self.check_rm_tree(os.path.join(clang_mingw_dir, toolchain_name)) - - def package_clang_bin_file(self, necessary_bin_files, ext): - necessary_bin_file = [ - 'clang%s' % ext, - 'clang++%s' % ext, - 'clang-cpp%s' % ext, - 'clang-%s%s' % (self.build_config.VERSION.split('.')[0], ext), - 'clang-check%s' % ext, - 'clang-cl%s' % ext, - 'clang-format%s' % ext, - 'clang-tidy%s' % ext, - 'clangd%s' % ext, - 'count%s' % ext, - ] - necessary_bin_files.extend(necessary_bin_file) - - @staticmethod - def package_lldb_bin_file(necessary_bin_files, ext): - necessary_bin_file = [ - 'dsymutil%s' % ext, - 'FileCheck%s' % ext, - 'git-clang-format', - 'ld.lld%s' % ext, - 'ld64.lld%s' % ext, - 'lld%s' % ext, - 'lld-link%s' % ext, - 'lldb%s' % ext, - 'lldb-argdumper%s' % ext, - 'lldb-server%s' % ext, - 'lldb-vscode%s' % ext, - ] - necessary_bin_files.extend(necessary_bin_file) - - @staticmethod - def package_llvm_bin_file(necessary_bin_files, ext): - necessary_bin_file = [ - 'llvm-addr2line%s' % ext, - 'llvm-ar%s' % ext, - 'llvm-as%s' % ext, - 'llvm-cfi-verify%s' % ext, - 'llvm-config%s' % ext, - 'llvm-cov%s' % ext, - 'llvm-cxxfilt%s' % ext, - 'llvm-dis%s' % ext, - 'llvm-lib%s' % ext, - 'llvm-link%s' % ext, - 'llvm-modextract%s' % ext, - 'llvm-nm%s' % ext, - 'llvm-objcopy%s' % ext, - 'llvm-objdump%s' % ext, - 'llvm-profdata%s' % ext, - 'llvm-ranlib%s' % ext, - 'llvm-readelf%s' % ext, - 'llvm-readobj%s' % ext, - 'llvm-size%s' % ext, - 'llvm-strings%s' % ext, - 'llvm-strip%s' % ext, - 'llvm-symbolizer%s' % ext, - ] - necessary_bin_files.extend(necessary_bin_file) - - @staticmethod - def package_scan_bin_file(necessary_bin_files, ext): - necessary_bin_file = [ - 'not%s' % ext, - 'sancov%s' % ext, - 'sanstats%s' % ext, - 'scan-build%s' % ext, - 'scan-view%s' % ext, - 'yaml2obj%s' % ext, - ] - necessary_bin_files.extend(necessary_bin_file) - - @staticmethod - def package_license_project_tuple(): - # Install license files as NOTICE in the toolchain install dir. - projects = ( - 'llvm', - 'compiler-rt', - 'libcxx', - 'libcxxabi', - 'openmp', - 'clang', - 'clang-tools-extra', - 'lld', - 'lldb', - 'libunwind', - ) - return projects - - def remove_unnecessary_bin(self, necessary_bin_files, host, lib_dir, install_dir, ext, shlib_ext): - - lib_files = [] - if os.path.isdir(lib_dir): - lib_files = os.listdir(lib_dir) - if host.startswith('windows'): - vers_major = int(self.build_config.VERSION.split('.')[0]) - # Redefining necessary bin files for Windows. - windows_forbidden_list_bin_files = ['clang-%s%s' % (vers_major, ext), 'scan-build%s' % ext, - 'scan-view%s' % ext] - windows_additional_bin_files = ['liblldb%s' % shlib_ext, 'libpython3.10%s' % shlib_ext, - ('libLLVM%s' if vers_major > 10 else 'LLVM%s') % shlib_ext] - - new_necessary_bin_files = list(set(necessary_bin_files) - set(windows_forbidden_list_bin_files)) - new_necessary_bin_files.extend(windows_additional_bin_files) - del necessary_bin_files[:] - necessary_bin_files.extend(new_necessary_bin_files) - - self.windows_lib_files_operation(lib_files, lib_dir, install_dir) - else: - # Remove unnecessary static libraries. - for lib_file in lib_files: - if lib_file.endswith('.a'): - static_library = os.path.join(lib_dir, lib_file) - os.remove(static_library) - - def package_up_resulting(self, package_name, host, install_host_dir): - # Package up the resulting trimmed install/ directory. - tarball_name = '%s-%s' % (package_name, host) - package_path = '%s%s' % (self.merge_out_path(tarball_name), '.tar.bz2') - self.logger().info('Packaging %s', package_path) - args = ['tar', '-cjC', install_host_dir, '-f', package_path, package_name] - if host.startswith('windows'): - # windows do not support symlinks, - # replace them with file copies - args.insert(1, '--dereference') - - self.check_call(args) - - # Package ohos NDK - if os.path.exists(self.merge_out_path('sysroot')): - tarball_ndk_name = 'ohos-sysroot-%s' % self.build_config.build_name - package_ndk_path = '%s%s' % (self.merge_out_path(tarball_ndk_name), '.tar.bz2') - self.logger().info('Packaging %s', package_ndk_path) - args = ['tar', '-chjC', self.build_config.OUT_PATH, '-f', package_ndk_path, 'sysroot'] - self.check_call(args) - - # Packing Operation. - - def package_operation(self, build_dir, host): - - self.logger().info('Packaging for other environments.') - package_name = 'clang-%s' % self.build_config.build_name - self.set_clang_version(build_dir) - - if host.startswith('windows'): - ext = '.exe' - shlib_ext = '.dll' - elif host.startswith('linux'): - ext = '' - shlib_ext = '.so' - else: - ext = '' - shlib_ext = '.dylib' - - install_dir = self.merge_out_path('install', host, package_name) - bin_dir = os.path.join(install_dir, 'bin') - lib_dir = os.path.join(install_dir, 'lib') - install_host_dir = os.path.abspath(os.path.join(install_dir, '../')) - self.check_rm_tree(install_host_dir) - self.check_copy_tree(build_dir, install_dir) - # copy readme file to install_dir - shutil.copyfile(os.path.join(self.build_config.LLVM_BUILD_DIR, "toolchain_readme.md"), - os.path.join(install_dir, "README.md")) - - # Generate manifest in install_dir - manifest = os.path.join(install_dir, 'manifest.xml') - repo_tool = os.path.join(self.build_config.REPOROOT_DIR, '.repo', 'repo', 'repo') - if os.path.isfile(repo_tool): - self.logger().info('Generating manifest.') - subprocess.run([repo_tool, 'manifest', '-r', '-o', manifest], shell=False, - stdout=subprocess.PIPE, cwd=self.build_config.REPOROOT_DIR) - else: - self.logger().error('Cannot generate manifest, repo tool not found.') - - # Remove unnecessary binaries. - necessary_bin_files = [] - self.package_clang_bin_file(necessary_bin_files, ext) - self.package_lldb_bin_file(necessary_bin_files, ext) - self.package_llvm_bin_file(necessary_bin_files, ext) - self.package_scan_bin_file(necessary_bin_files, ext) - - if self.build_config.need_lldb_mi: - necessary_bin_files.append('lldb-mi%s' % ext) - self.remove_unnecessary_bin(necessary_bin_files, host, lib_dir, install_dir, ext, shlib_ext) - - # Scripts that should not be stripped - script_bins = ['git-clang-format', 'scan-build', 'scan-view'] - need_x_bins_darwin = ['clang', 'clang++', 'clang-9', 'clang-cl', 'clang-cpp'] - - # Bin file in the list should be stripped with -x args when host=darwin - self.darwin_stripped_xargs(bin_dir, necessary_bin_files, script_bins, need_x_bins_darwin) - - # Strip lldb-server - self.strip_lldb_server(host, install_dir) - - for necessary_bin_file in necessary_bin_files: - if not os.path.isfile(os.path.join(bin_dir, necessary_bin_file)): - print('Did not find %s in %s' % (necessary_bin_file, bin_dir)) - raise RuntimeError('Did not find %s in %s' % (necessary_bin_file, bin_dir)) - - cmake_dir = os.path.join(lib_dir, 'cmake') - self.check_rm_tree(cmake_dir) - - self.notice_prebuilts_file(host, self.package_license_project_tuple(), install_dir) - - create_tar = True - if create_tar: - self.package_up_resulting(package_name, host, install_host_dir) - - # Tar windows mingw - self.tar_windows_mingw(host) - return - - - -def main(): - build_config = BuildConfig() - build_utils = BuildUtils(build_config) - sysroot_composer = SysrootComposer(build_config) - llvm_core = LlvmCore(build_config) - llvm_package = LlvmPackage(build_config) - lldb_mi = LldbMi(build_config, llvm_package) - llvm_libs = LlvmLibs(build_config, sysroot_composer, llvm_package) - - args = build_config.parse_args() - need_host = build_utils.host_is_darwin() or ('linux' not in args.no_build) - need_windows = build_utils.host_is_linux() and \ - ('windows' not in args.no_build) - - llvm_install = build_utils.merge_out_path('llvm-install') - windows64_install = build_utils.merge_out_path('windows-x86_64-install') - - configs = [] - if not build_config.no_build_arm: - configs.append(('arm', build_utils.liteos_triple('arm'))) - configs.append(('arm', build_utils.open_ohos_triple('arm'))) - - if not build_config.no_build_aarch64: - configs.append(('arm64', build_utils.open_ohos_triple('aarch64'))) - - if not build_config.no_build_riscv64: - configs.append(('riscv', build_utils.open_ohos_triple('riscv64'))) - - if not build_config.no_build_mipsel: - configs.append(('mipsel', build_utils.open_ohos_triple('mipsel'))) - - if not build_config.no_build_x86_64: - configs.append(('x86_64', build_utils.open_ohos_triple('x86_64'))) - - - if build_config.do_build and need_host: - llvm_core.llvm_compile( - build_config.build_name, - llvm_install, - build_config.debug, - build_config.no_lto, - build_config.build_instrumented, - build_config.xunit_xml_output) - - llvm_core.set_clang_version(llvm_install) - - if build_config.do_build and build_utils.host_is_linux(): - sysroot_composer.setup_cmake_platform(llvm_install) - llvm_libs.build_crt_libs(configs, llvm_install, build_config.need_lldb_server) - - if build_config.need_libs: - for (arch, target) in configs: - llvm_libs.build_libs(build_config.need_lldb_server, llvm_install, target) - - if build_config.do_build and need_windows: - mingw.main() - llvm_libs.build_need_libs_for_windows() - llvm_core.llvm_compile_for_windows(build_config.TARGETS, - build_config.enable_assertions, - build_config.build_name) - - if build_config.need_lldb_mi: - lldb_mi.build_lldb_mi_for_windows() - - if build_config.do_build and build_config.need_lldb_mi and need_host: - lldb_mi.build_lldb_mi(llvm_install) - - if build_config.do_package: - if build_utils.host_is_linux(): - llvm_package.package_libcxx() - llvm_package.package_operation(llvm_install, build_utils.use_platform()) - if build_config.do_package and need_windows: - llvm_package.package_operation(windows64_install, 'windows-x86_64') - -if __name__ == '__main__': - main() diff --git a/llvm-build/build_cpython-mingw.sh b/llvm-build/build_cpython-mingw.sh deleted file mode 100755 index 7419458cc7d9..000000000000 --- a/llvm-build/build_cpython-mingw.sh +++ /dev/null @@ -1,81 +0,0 @@ -#!/bin/bash - -PROJECT_ROOT=$(pwd) -CPYTHON_MINGW_SRC=${PROJECT_ROOT}/third_party/python -MINGW_W64_SRC=${PROJECT_ROOT}/third_party/mingw-w64 - -# prepare SYSROOT for cpython-mingw build -CLANG_MINGW_BUILD=${PROJECT_ROOT}/out/clang_mingw -python3 ${PROJECT_ROOT}/toolchain/llvm-build/mingw.py - -# refreash cpython-mingw config -cd ${CPYTHON_MINGW_SRC} -cat ./patchs/cpython_mingw_v3.10.2.patch | patch -d ./ -p1 -E -rm -rf ${CPYTHON_MINGW_SRC}/configure -autoconf ${CPYTHON_MINGW_SRC}/configure.ac > ${CPYTHON_MINGW_SRC}/configure -chmod 777 ${CPYTHON_MINGW_SRC}/configure -./configure - -# # prepare build config and build libpython for cpython-mingw -CPYTHON_MINGW_BUILD=${PROJECT_ROOT}/out/cpython-mingw-build -mkdir -p ${CPYTHON_MINGW_BUILD} -cd ${CPYTHON_MINGW_BUILD} -MINGW_PREFIX=${CPYTHON_MINGW_BUILD}/mingw64 -MINGW_CHOST=x86_64-w64-mingw32 -MINGW_BUILD=x86_64-unknown-linux-gnu -CLANG_VERSION=clang-10.0.1 -TOOLCHAIN_ROOT=${CLANG_MINGW_BUILD}/${CLANG_VERSION}/bin -SYSROOT=${CLANG_MINGW_BUILD}/${CLANG_VERSION}/x86_64-w64-mingw32 -mkdir $MINGW_BUILD - -export CC=$TOOLCHAIN_ROOT/clang -export CXX=$TOOLCHAIN_ROOT/clang++ -export CFLAGS="-target ${MINGW_CHOST} --sysroot=$SYSROOT" -export LDFLAGS="--sysroot=$SYSROOT -rtlib=compiler-rt -target ${MINGW_CHOST} -lucrt -lucrtbase -fuse-ld=lld" - -${CPYTHON_MINGW_SRC}/configure \ - --prefix=${MINGW_PREFIX} \ - --host=${MINGW_CHOST} \ - --build=${MINGW_BUILD} \ - --enable-shared \ - --enable-static \ - --without-ensurepip \ - --without-c-locale-coercion \ - --enable-loadable-sqlite-extensions - -make -j4 - -# copy build result to mingw-w64 -cp ${CPYTHON_MINGW_BUILD}/libpython3.10.dll.a ${MINGW_W64_SRC}/mingw-w64-crt/lib64 -cp ${CPYTHON_MINGW_BUILD}/libpython3.10.dll ${MINGW_W64_SRC}/mingw-w64-python/3.10 -cd ../.. - -# example steps to install autoconf 2.71 -# wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.71.tar.gz -# export PATH=/mnt/disk2/liwentao/workspace/tools/autoconf/autoconf-2.71/bin:$PATH -# sudo cp -r /mnt/disk2/liwentao/workspace/tools/autoconf/autoconf-2.71/lib /usr/local/share/autoconf - -# refreash configure and Makefile for mingw-w64 -# you need autoconf (2.69 for Ubuntu 20.04 LTS apt install, to support mingw-w64 9.x and later version, please install autoconf 2.71 http://ftp.gnu.org/gnu/autoconf/) -# and automake (1.16.1 for Ubuntu 20.04 LTS apt install) -cd ${MINGW_W64_SRC}/mingw-w64-crt -rm -rf configure -autoconf configure.ac > configure -chmod 777 configure - -aclocal -automake - -cd ${MINGW_W64_SRC}/mingw-w64-headers -rm -rf configure -autoconf configure.ac > configure -chmod 777 configure - -aclocal -automake - -# move cpython-mingw build result and python header file to mingw-w64 -cp -r ${CPYTHON_MINGW_SRC}/Include ${MINGW_W64_SRC}/mingw-w64-headers/include/python3.10 -cp ${CPYTHON_MINGW_SRC}/pyconfig.h ${MINGW_W64_SRC}/mingw-w64-headers/include/python3.10 -mkdir -p ${MINGW_W64_SRC}/mingw-w64-python/3.10 -cp -r ${CPYTHON_MINGW_SRC}/Lib ${MINGW_W64_SRC}/mingw-w64-python/3.10/lib \ No newline at end of file diff --git a/llvm-build/build_musl.sh b/llvm-build/build_musl.sh deleted file mode 100755 index 123da9a1eec6..000000000000 --- a/llvm-build/build_musl.sh +++ /dev/null @@ -1,121 +0,0 @@ -#!/bin/bash -# Copyright (C) 2021 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -set -e - -# This script is used to create musl's libc.so. - -#default variables -CLANG_BIN_ROOT="${PWD}/../../out/install/linux-x86_64/clang-dev/bin/" -TARGET_TRIPLE="" -TOPDIR="${PWD}/../.." -OUT="${PWD}/../../out" -make_libs=0 - -#argument parser -while getopts "c:t:T:o:lh" arg -do - case "${arg}" in - "c") - CLANG_BIN_ROOT=${OPTARG} - ;; - "t") - TARGET_TRIPLE=${OPTARG} - ;; - "T") - TOPDIR=${OPTARG} - ;; - "o") - OUT=${OPTARG} - ;; - "l") - make_libs=1 - ;; - "h") - echo "Usage: ./build_musl.sh [OPTION]" - echo " Build C/C++ dynamic libs and runtime object" - echo " Options are:" - echo " -c Specify clang bin path" - echo " -t Specify target tripple" - echo " -T Specify top of repo tree" - echo " -o Specify the build output directory" - echo " -l Install libs" - exit 0 - ;; - ?) - echo "unkown argument" - exit 1 - ;; - esac -done - -if [ -z "${TARGET_TRIPLE}" ] -then - echo "[ERROR] Empty target triple in build_musl.sh" - exit 1 -fi - -# Canonicalize paths -CLANG_BIN_ROOT=$(readlink -f ${CLANG_BIN_ROOT}) - -CFLAGS_FOR_TARGET=("-mfloat-abi=soft" "-mfloat-abi=soft -mcpu=cortex-a7" -"-mfloat-abi=softfp -mfpu=neon-vfpv4 -mcpu=cortex-a7" "-mfloat-abi=hard -mfpu=neon-vfpv4 -mcpu=cortex-a7") - -if [ $TARGET_TRIPLE == "arm-liteos-ohos" ]; then - TARGET_USER="liteos_a_user" - TARGETS_PREFIX="arm" -elif [ $TARGET_TRIPLE == "arm-linux-ohos" ]; then - TARGET_USER="linux_user" - TARGETS_PREFIX="arm" -elif [ $TARGET_TRIPLE == "mipsel-linux-ohos" ]; then - TARGET_USER="linux_user" - TARGETS_PREFIX="mips" - CFLAGS_FOR_TARGET=(" " "-mnan=legacy") -elif [ $TARGET_TRIPLE == "riscv64-linux-ohos" ]; then - TARGET_USER="linux_user" - TARGETS_PREFIX="riscv64" -elif [ $TARGET_TRIPLE == "x86_64-linux-ohos" ]; then - TARGET_USER="linux_user" - TARGETS_PREFIX="x86_64" -else - TARGET_USER="linux_user" - TARGETS_PREFIX="aarch64" -fi - -echo "CLANG_BIN_ROOT=${CLANG_BIN_ROOT}" -echo "ARCH=${TARGETS_PREFIX}" -echo "TARGET=${TARGET_TRIPLE}" -echo "TOPDIR=${TOPDIR}" -echo "TARGETS=${TARGET_USER}" -echo "OUT=${OUT}" -echo "SYSROOTDIR=${OUT}/sysroot" - -# build musl_headers -make musl_header_install_for_${TARGET_USER} CLANG="${CLANG_BIN_ROOT}/clang" TOPDIR=${TOPDIR} \ - SYSROOTDIR=${OUT}/sysroot TARGETS=${TARGET_USER} TARGET=${TARGET_TRIPLE} ARCH=${TARGETS_PREFIX} -f Makefile - -# build musl_libs -if ((make_libs == 1)); then - if [ $TARGET_TRIPLE == "aarch64-linux-ohos" ] || [ $TARGET_TRIPLE == "riscv64-linux-ohos" ] || \ - [ $TARGET_TRIPLE == "x86_64-linux-ohos" ]; then - make CLANG="${CLANG_BIN_ROOT}/clang" TOPDIR=${TOPDIR} SYSROOTDIR=${OUT}/sysroot TARGETS=${TARGET_USER}\ - TARGET=${TARGET_TRIPLE} ARCH=${TARGETS_PREFIX} -f Makefile - else - for ARCH_CFLAG in "${CFLAGS_FOR_TARGET[@]}" - do - make CLANG="${CLANG_BIN_ROOT}/clang" TOPDIR=${TOPDIR} SYSROOTDIR=${OUT}/sysroot TARGETS=${TARGET_USER}\ - TARGET=${TARGET_TRIPLE} ARCH=${TARGETS_PREFIX} ARCH_CFLAGS="${ARCH_CFLAG}" -f Makefile - done - fi -fi -make distclean -f Makefile diff --git a/llvm-build/env_prepare.sh b/llvm-build/env_prepare.sh deleted file mode 100755 index 552fbdba4772..000000000000 --- a/llvm-build/env_prepare.sh +++ /dev/null @@ -1,113 +0,0 @@ -case $(uname -s) in - Linux) - - host_platform=linux - ;; - Darwin) - host_platform=darwin - ;; - *) - echo "Unsupported host platform: $(uname -s)" - exit 1 -esac - -case $(uname -m) in - arm64) - - host_cpu=arm64 - ;; - *) - host_cpu=x86_64 -esac - -# sync code directory -code_dir=$(pwd) - -# downloaded files will be automatically unzipped under this path -bin_dir=${code_dir}/download_packages - -# download and initialize prebuild files -if [ ! -d "${bin_dir}" ];then - mkdir -p "${bin_dir}" -fi - - -function download_and_archive() { - archive_dir=$1 - download_source_url=$2 - bin_file=$(basename ${download_source_url}) - wget -t3 -T10 -O "${bin_dir}/${bin_file}" "${download_source_url}" - if [ ! -d "${code_dir}/${archive_dir}" ];then - mkdir -p "${code_dir}/${archive_dir}" - fi - if [ "X${bin_file:0-3}" = "Xzip" ];then - unzip -o "${bin_dir}/${bin_file}" -d "${code_dir}/${archive_dir}/" - elif [ "X${bin_file:0-6}" = "Xtar.gz" ];then - tar -xvzf "${bin_dir}/${bin_file}" -C "${code_dir}/${archive_dir}" - else - tar -xvf "${bin_dir}/${bin_file}" -C "${code_dir}/${archive_dir}" - fi -} - - -copy_config=""" -""" - -copy_config_linux_x86_64=""" -prebuilts/cmake,https://mirrors.huaweicloud.com/harmonyos/compiler/cmake/3.16.5/${host_platform}/cmake-${host_platform}-x86-3.16.5.tar.gz -prebuilts/clang/ohos/${host_platform}-${host_cpu},https://mirrors.huaweicloud.com/openharmony/compiler/clang/10.0.1-62608/${host_platform}/llvm.tar.gz -prebuilts/clang/ohos/${host_platform}-${host_cpu},https://github.com/llvm/llvm-project/releases/download/llvmorg-10.0.1/clang+llvm-10.0.1-x86_64-linux-gnu-ubuntu-16.04.tar.xz -""" - - -copy_config_darwin_x86_64=""" -prebuilts/cmake,https://mirrors.huaweicloud.com/harmonyos/compiler/cmake/3.16.5/${host_platform}/cmake-${host_platform}-x86-3.16.5.tar.gz -prebuilts/clang/ohos/${host_platform}-${host_cpu},https://github.com/llvm/llvm-project/releases/download/llvmorg-12.0.0/clang+llvm-12.0.0-x86_64-apple-darwin.tar.xz -""" - - -if [[ "${host_platform}" == "linux" ]]; then - if [[ "${host_cpu}" == "x86_64" ]]; then - copy_config+=${copy_config_linux_x86_64} - echo "add ubuntu here" - else - echo "unknwon host_cpu - ${host_cpu} for linux" - fi -elif [[ "${host_platform}" == "darwin" ]]; then - if [[ "${host_cpu}" == "x86_64" ]]; then - copy_config+=${copy_config_darwin_x86_64} - echo "add x86-64 mac here" - elif [[ "${host_cpu}" == "arm64" ]]; then - echo "add m1 config here" - else - echo "unknwon host_cpu - ${host_cpu} for darwin" - fi -else - echo "unknown ${host_platform}" -fi - - -for i in $(echo ${copy_config}) -do - unzip_dir=$(echo $i|awk -F ',' '{print $1}') - remote_url=$(echo $i|awk -F ',' '{print $2}') - download_and_archive "${unzip_dir}" "${remote_url}" -done - - -if [ -d "${code_dir}/prebuilts/clang/ohos/linux-x86_64/clang-62608" ];then - rm -rf "${code_dir}/prebuilts/clang/ohos/linux-x86_64/llvm" - mv "${code_dir}/prebuilts/clang/ohos/linux-x86_64/clang-62608" "${code_dir}/prebuilts/clang/ohos/linux-x86_64/llvm" - ln -snf 10.0.1 "${code_dir}/prebuilts/clang/ohos/linux-x86_64/llvm/lib/clang/current" -fi - - -if [ -d "${code_dir}/prebuilts/clang/ohos/linux-x86_64/clang+llvm-10.0.1-x86_64-linux-gnu-ubuntu-16.04" ];then - rm -rf "${code_dir}/prebuilts/clang/ohos/linux-x86_64/clang-10.0.1" - mv "${code_dir}/prebuilts/clang/ohos/linux-x86_64/clang+llvm-10.0.1-x86_64-linux-gnu-ubuntu-16.04" "${code_dir}/prebuilts/clang/ohos/linux-x86_64/clang-10.0.1" -fi - -if [ -d "${code_dir}/prebuilts/clang/ohos/darwin-x86_64/clang+llvm-12.0.0-x86_64-apple-darwin" ];then - rm -rf "${code_dir}/prebuilts/clang/ohos/darwin-x86_64/clang-10.0.1" - mv "${code_dir}/prebuilts/clang/ohos/darwin-x86_64/clang+llvm-12.0.0-x86_64-apple-darwin" "${code_dir}/prebuilts/clang/ohos/darwin-x86_64/clang-10.0.1" -fi diff --git a/llvm-build/mingw.py b/llvm-build/mingw.py deleted file mode 100755 index 39bd000c06b7..000000000000 --- a/llvm-build/mingw.py +++ /dev/null @@ -1,277 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# Copyright (C) 2021 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""donwload and build mingw64-7.0.0 sysroot""" - -import logging -import os -import shutil -import subprocess -import sys - - -class BuildConfig(): - - def __init__(self): - self.CLANG_VERSION = '10.0.1' - self.LLVM_BUILD_DIR = os.path.realpath(os.path.dirname(__file__)) - - parent_of_llvm_build = os.path.basename(os.path.dirname(self.LLVM_BUILD_DIR)) - if parent_of_llvm_build == 'toolchain': - self.REPOROOT_DIR = os.path.realpath(os.path.join(self.LLVM_BUILD_DIR, '../..')) - else: - assert parent_of_llvm_build == 'llvm-project' - self.REPOROOT_DIR = os.path.realpath(os.path.join(self.LLVM_BUILD_DIR, '../../..')) - - self.OUT_DIR = os.environ.get('OUT_DIR', self.repo_root('out')) - self.MINGW_DIR = self.out_root('clang_mingw', 'clang-%s' % self.CLANG_VERSION, 'x86_64-w64-mingw32') - - def repo_root(self, *args): - return os.path.join(self.REPOROOT_DIR, *args) - - def out_root(self, *args): - return os.path.join(self.OUT_DIR, *args) - - def mingw64_dir(self): - if os.path.isdir(self.MINGW_DIR): - shutil.rmtree(self.MINGW_DIR) - os.makedirs(self.MINGW_DIR) - return self.MINGW_DIR - - def llvm_path(self, *args): - return os.path.join(self.REPOROOT_DIR, 'toolchain/llvm-project', *args) - - -class LlvmMingw(): - - def __init__(self, build_config): - self.build_config = build_config - - self.CMAKE_BIN_PATH = os.path.join(self.cmake_prebuilt_bin_dir(), 'cmake') - self.NINJA_BIN_PATH = os.path.join(self.cmake_prebuilt_bin_dir(), 'ninja') - - self.CLANG_PATH = self.build_config.out_root('clang_mingw', 'clang-%s' % self.build_config.CLANG_VERSION) - self.LLVM_CONFIG = os.path.join(self.CLANG_PATH, 'bin', 'llvm-config') - self.SYSROOT = self.build_config.out_root('clang_mingw', 'clang-%s' % self.build_config.CLANG_VERSION, 'x86_64-w64-mingw32') - self.LLVM_TRIPLE = 'x86_64-windows-gnu' - # out path - self.CRT_PATH = self.build_config.out_root('clang_mingw', 'lib', 'clangrt-%s' % self.LLVM_TRIPLE) - # install path - self.CRT_INSTALL = self.build_config.out_root('clang_mingw', 'clang-%s' % self.build_config.CLANG_VERSION, 'lib', 'clang', self.build_config.CLANG_VERSION) - # prefix & env - self.prefix = build_config.mingw64_dir() - common_flags = "-target x86_64-w64-mingw32 -rtlib=compiler-rt \ - -stdlib=libc++ -fuse-ld=lld -Qunused-arguments -g -O2" - self.env = { - "CC": "%s/../bin/clang" % self.prefix, - "CXX": "%s/../bin/clang" % self.prefix, - "AR": "%s/../bin/llvm-ar" % self.prefix, - "DLLTOOL": "%s/../bin/llvm-dlltool" % self.prefix, - "LD": "%s/../bin/ld.lld" % self.prefix, - "RANLIB": "%s/../bin/llvm-ranlib" % self.prefix, - "STRIP": "%s/../bin/llvm-strip" % self.prefix, - "LDFLAGS": common_flags, - "CFLAGS": common_flags, - "CXXFLAGS": common_flags, - "PATH": os.environ["PATH"], - } - - def cmake_prebuilt_bin_dir(self): - return self.build_config.repo_root('prebuilts/cmake', 'linux-x86', 'bin') - - def base_cmake_defines(self): - self.cmake_defines = {} - self.cmake_defines['CMAKE_BUILD_TYPE'] = 'Release' - self.cmake_defines['LLVM_ENABLE_ASSERTIONS'] = 'OFF' - self.cmake_defines['LLVM_ENABLE_TERMINFO'] = 'OFF' - self.cmake_defines['LLVM_ENABLE_THREADS'] = 'ON' - self.cmake_defines['LLVM_USE_NEWPM'] = 'ON' - self.cmake_defines['COMPILER_RT_BUILD_XRAY'] = 'OFF' - return self.cmake_defines - - @staticmethod - def check_create_path(path): - if not os.path.exists(path): - os.makedirs(path) - - @staticmethod - def check_call(cmd, *args, **kwargs): - subprocess.check_call(cmd, *args, **kwargs) - - @staticmethod - def update_cmake_sysroot_flags(defines, sysroot): - defines['CMAKE_SYSROOT'] = sysroot - defines['CMAKE_FIND_ROOT_PATH_MODE_INCLUDE'] = 'ONLY' - defines['CMAKE_FIND_ROOT_PATH_MODE_LIBRARY'] = 'ONLY' - defines['CMAKE_FIND_ROOT_PATH_MODE_PACKAGE'] = 'ONLY' - defines['CMAKE_FIND_ROOT_PATH_MODE_PROGRAM'] = 'NEVER' - - def comiler_rt_defines(self): - arch = 'x86_64' - cc = os.path.join(self.CLANG_PATH, 'bin', 'clang') - cxx = os.path.join(self.CLANG_PATH, 'bin', 'clang++') - self.crt_defines = {} - self.crt_defines['CMAKE_C_COMPILER'] = cc - self.crt_defines['CMAKE_CXX_COMPILER'] = cxx - self.crt_defines['LLVM_CONFIG_PATH'] = self.LLVM_CONFIG - clang_libcxx_lib = self.build_config.out_root('clang_mingw', 'clang-%s' % self.build_config.CLANG_VERSION, 'lib') - ldflags = [ - '-L%s' % clang_libcxx_lib, - '-fuse-ld=lld', - '-Wl,--gc-sections', - '-pie', - '--rtlib=compiler-rt', - '-stdlib=libc++', - '-v', - ] - self.crt_defines['CMAKE_EXE_LINKER_FLAGS'] = ' '.join(ldflags) - self.crt_defines['CMAKE_SHARED_LINKER_FLAGS'] = ' '.join(ldflags) - self.crt_defines['CMAKE_MODULE_LINKER_FLAGS'] = ' '.join(ldflags) - self.update_cmake_sysroot_flags(self.crt_defines, self.SYSROOT) - cflags = [ - '--target=%s' % self.LLVM_TRIPLE, - '-ffunction-sections', - '-fdata-sections', - ] - cflags.append('-funwind-tables') - cflags.append('-v') - self.crt_defines['CMAKE_C_FLAGS'] = ' '.join(cflags) - self.crt_defines['CMAKE_ASM_FLAGS'] = ' '.join(cflags) - self.crt_defines['CMAKE_CXX_FLAGS'] = ' '.join(cflags) - self.crt_defines['COMPILER_RT_TEST_COMPILER_CFLAGS'] = ' '.join(cflags) - self.crt_defines['COMPILER_RT_TEST_TARGET_TRIPLE'] = self.LLVM_TRIPLE - self.crt_defines['COMPILER_RT_INCLUDE_TESTS'] = 'OFF' - self.crt_defines['CMAKE_INSTALL_PREFIX'] = self.CRT_INSTALL - self.crt_defines['COMPILER_RT_BUILD_LIBFUZZER'] = 'OFF' - self.crt_defines['COMPILER_RT_USE_BUILTINS_LIBRARY'] = 'TRUE' - self.crt_defines['CMAKE_SYSTEM_NAME'] = 'Windows' - self.crt_defines['CMAKE_CROSSCOMPILING'] = 'True' - self.crt_defines['CMAKE_C_COMPILER_WORKS'] = '1' - self.crt_defines['CMAKE_CXX_COMPILER_WORKS'] = '1' - self.crt_defines['SANITIZER_CXX_ABI'] = 'libcxxabi' - self.crt_defines['CMAKE_TRY_COMPILE_TARGET_TYPE'] = 'STATIC_LIBRARY' - self.crt_defines['COMPILER_RT_BUILD_SANITIZERS'] = 'OFF' - self.crt_defines['COMPILER_RT_EXCLUDE_ATOMIC_BUILTIN'] = 'OFF' - #cmake config - self.crt_defines.update(self.base_cmake_defines()) - return self.crt_defines - - def build_comiler_rt(self): - crt_defines = self.comiler_rt_defines() - #environ - crt_env = dict(dict(os.environ)) - #compiler-rt path - crt_cmake_path = self.build_config.llvm_path('compiler-rt') - #cmake - self.invoke_cmake( - out_path=self.CRT_PATH, - defines=crt_defines, - env=crt_env, - cmake_path=crt_cmake_path) - - def invoke_cmake(self, out_path, defines, env, cmake_path, target=None, install=True): - flags = ['-G', 'Ninja'] - flags += ['-DCMAKE_PREFIX_PATH=%s' % self.cmake_prebuilt_bin_dir()] - - for key in defines: - newdef = ''.join(['-D', key, '=', defines[key]]) - flags += [newdef] - flags += [cmake_path] - - self.check_create_path(out_path) - - if target: - ninja_target = [target] - else: - ninja_target = [] - - self.check_call([self.CMAKE_BIN_PATH] + flags, cwd=out_path, env=env) - self.check_call([self.NINJA_BIN_PATH] + ninja_target, cwd=out_path, env=env) - if install: - self.check_call([self.NINJA_BIN_PATH, 'install'], cwd=out_path, env=env) - - def build_clang_mingw(self): - clang_mingw_dir = self.build_config.out_root('clang_mingw') - if os.path.isdir(clang_mingw_dir): - shutil.rmtree(clang_mingw_dir) - os.makedirs(clang_mingw_dir) - shutil.copytree(self.build_config.repo_root('prebuilts/clang/ohos/linux-x86_64/clang-%s' % self.build_config.CLANG_VERSION), - '%s/clang-%s' % (clang_mingw_dir, self.build_config.CLANG_VERSION)) - # Replace clang binaries to avoid dependency on libtinfo - # TODO: Use `prebuilts/clang/ohos/linux-x86_64/llvm` instead of - # `prebuilts/clang/ohos/linux-x86_64/clang-10.0.1` - shutil.copy(self.build_config.repo_root('prebuilts/clang/ohos/linux-x86_64/llvm/bin/clang'), - '%s/clang-%s/bin/clang' % (clang_mingw_dir, self.build_config.CLANG_VERSION)) - shutil.copy(self.build_config.repo_root('prebuilts/clang/ohos/linux-x86_64/llvm/bin/clang++'), - '%s/clang-%s/bin/clang++' % (clang_mingw_dir, self.build_config.CLANG_VERSION)) - shutil.copy(self.build_config.repo_root('prebuilts/clang/ohos/linux-x86_64/llvm/bin/clang-10'), - '%s/clang-%s/bin/clang-10' % (clang_mingw_dir, self.build_config.CLANG_VERSION)) - - def build_mingw64_headers(self): - headers_dir = self.build_config.repo_root('third_party', 'mingw-w64', 'mingw-w64-headers', 'build') - if os.path.isdir(headers_dir): - shutil.rmtree(headers_dir) - os.makedirs(headers_dir) - os.chdir(headers_dir) - cmd = ['../configure', '--prefix=%s' % self.prefix, - '--enable-idl', '--with-default-win32-winnt=0x600', - '--with-default-msvcrt=ucrt'] - self.env['INSTALL'] = "install -C" - self.check_call(cmd, env=self.env) - self.check_call(['make', 'install'], env=self.env) - - def build_mingw64_crtlibs(self): - crtlibs_dir = self.build_config.repo_root('third_party', 'mingw-w64', 'mingw-w64-crt', 'build') - if os.path.isdir(crtlibs_dir): - shutil.rmtree(crtlibs_dir) - os.makedirs(crtlibs_dir) - os.chdir(crtlibs_dir) - cmd = ['../configure', '--prefix=%s' % self.prefix, - '--host=x86_64-w64-mingw32', '--disable-lib32', - '--enable-lib64', '--with-default-msvcrt=ucrt'] - self.check_call(cmd, env=self.env) - self.check_call(['make', '-j4'], env=self.env) - self.check_call(['make', 'install'], env=self.env) - - def build_mingw64_winpthreads(self): - winpthreads_dir = self.build_config.repo_root('third_party', 'mingw-w64', - 'mingw-w64-libraries', 'winpthreads', 'build') - if os.path.isdir(winpthreads_dir): - shutil.rmtree(winpthreads_dir) - os.makedirs(winpthreads_dir) - os.chdir(winpthreads_dir) - self.env['RC'] = "%s/windres.sh" % self.build_config.LLVM_BUILD_DIR - self.env['EXEEXT'] = ".exe" - cmd = ['../configure', '--prefix=%s' % self.prefix, - '--host=x86_64-w64-mingw32', - '--libdir=%s/lib' % self.prefix] - self.check_call(cmd, env=self.env) - self.check_call(['make', '-j4'], env=self.env) - self.check_call(['make', 'install'], env=self.env) - - -def main(): - build_config = BuildConfig() - llvm_mingw = LlvmMingw(build_config) - - llvm_mingw.build_clang_mingw() - llvm_mingw.build_mingw64_headers() - llvm_mingw.build_mingw64_crtlibs() - llvm_mingw.build_comiler_rt() - llvm_mingw.build_mingw64_winpthreads() - return 0 - -if __name__ == '__main__': - main() diff --git a/llvm-build/toolchain_readme.md b/llvm-build/toolchain_readme.md deleted file mode 100644 index eb042745aa11..000000000000 --- a/llvm-build/toolchain_readme.md +++ /dev/null @@ -1,26 +0,0 @@ -## Overview - -This readme briefly describes the functionality of our LLVM toolchain and what we have included specially to the LLVM toolchain. - -## Functionality - -The LLVM toolchain is built based on LLVM 12.0.1. It is used to provide capability of building ohos image. For detailed information about LLVM 12.0.1, please refer to [LLVM 12.0.1](https://lists.llvm.org/pipermail/llvm-announce/2021-July/000093.html). -
    - - -## Specifically Included Triplets - -Despite all the components provided by LLVM community, we included several triplets for different types of ohos devices to our LLVM toochain, listed as below. For specification, liteos is a newly included OS name which indicate the simplified linux kernel. - -| Triplet Name | Architecture | System Kernel | System | -| ---------------------- | ------------ | ------------- | --------------- | -| arm-liteos-ohos | ARM 32bits | LiteOS | Small system | -| arm-linux-ohos | ARM 32bits | Linux | Small system | -| arm-linux-ohos | ARM 32bits | Linux | Standard system | -| aarch64-linux-ohos | ARM 64bits | Linux | Standard system | - -For detailed definition of Small System and Standard System, please refer to [System Types](https://gitee.com/openharmony/docs/blob/master/en/device-dev/Readme-EN.md). - -### Specify the triplet - -To build images for different types of platform, you can configure the triplet in the build scripts by setting "--target=xxx" using cflags, xxx should be replaced with a specific triplet name. diff --git a/llvm-build/windres.sh b/llvm-build/windres.sh deleted file mode 100755 index 18375c5c37c1..000000000000 --- a/llvm-build/windres.sh +++ /dev/null @@ -1,64 +0,0 @@ -#!/bin/bash -# Copyright (C) 2021 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# This script is used to deal version.rc file. -set -e - -#default variables - -LLVM_BUILD_DIR=$(dirname $0) -PARENT_OF_LLVM_BUILD=$(basename "$(realpath "$LLVM_BUILD_DIR/..")") -case $PARENT_OF_LLVM_BUILD in - toolchain) TOPDIR="$(realpath "$LLVM_BUILD_DIR/../..")" ;; - llvm-project) TOPDIR="$(realpath "$LLVM_BUILD_DIR/../../..")" ;; - *) echo "Cannot detect TOPDIR" 1>&2 ; exit 1 ;; -esac - -CLANG_BIN_ROOT="$TOPDIR/out/clang_mingw/clang-10.0.1/bin/" -CLANG_FLAGS="clang -target x86_64-w64-mingw32 -rtlib=compiler-rt -stdlib=libc++ -fuse-ld=lld -Qunused-arguments -E -xc -DRC_INVOKED=1" -LLVM_RC_FLAGS="llvm-rc -I ../src src/.libs/version.o.preproc.rc -c 1252 -fo src/.libs/version.o.out.res" -LLVM_CVTRES_FLAGS="llvm-cvtres src/.libs/version.o.out.res -machine:X64 -out:" - -while getopts "i:o:h" arg -do - case "${arg}" in - "i") - IN=${OPTARG} - ;; - "o") - OUT=${OPTARG} - ;; - "h") - echo "Usage: ./build_libs.sh [OPTION]" - echo " Build C/C++ dynamic libs and runtime object" - echo " Options are:" - echo " -i Name of the input file." - echo " -o Name of the output file." - echo " -h Display this message and exit." - exit 0 - ;; - ?) - echo "unkown argument" - exit 1 - ;; - esac -done - -CLANG_FLAGS="${CLANG_BIN_ROOT}${CLANG_FLAGS} -v $IN -o src/.libs/version.o.preproc.rc" -LLVM_RC_FLAGS="${CLANG_BIN_ROOT}${LLVM_RC_FLAGS}" -LLVM_CVTRES_FLAGS="${CLANG_BIN_ROOT}${LLVM_CVTRES_FLAGS}${OUT}" - -mkdir src/.libs -${CLANG_FLAGS} -${LLVM_RC_FLAGS} -${LLVM_CVTRES_FLAGS} diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt index b7b5bc247899..454ec561af9a 100644 --- a/llvm/CMakeLists.txt +++ b/llvm/CMakeLists.txt @@ -11,10 +11,10 @@ if(NOT DEFINED LLVM_VERSION_MINOR) set(LLVM_VERSION_MINOR 0) endif() if(NOT DEFINED LLVM_VERSION_PATCH) - set(LLVM_VERSION_PATCH 1) + set(LLVM_VERSION_PATCH 0) endif() if(NOT DEFINED LLVM_VERSION_SUFFIX) - set(LLVM_VERSION_SUFFIX "") + set(LLVM_VERSION_SUFFIX git) endif() if (NOT PACKAGE_VERSION) @@ -545,12 +545,6 @@ option(LLVM_BUILD_RUNTIME "Build the LLVM runtime libraries." ON) option(LLVM_BUILD_EXAMPLES "Build the LLVM example programs. If OFF, just generate build targets." OFF) -option(BUILD_ARK_GC_SUPPORT - "ARK support GC. If ON, support GC." OFF) -if(BUILD_ARK_GC_SUPPORT) - add_definitions(-DARK_GC_SUPPORT) -endif(BUILD_ARK_GC_SUPPORT) - option(LLVM_INCLUDE_EXAMPLES "Generate build targets for the LLVM examples" ON) if(LLVM_BUILD_EXAMPLES) diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake index e9224959dd1b..818fafbce148 100644 --- a/llvm/cmake/config-ix.cmake +++ b/llvm/cmake/config-ix.cmake @@ -210,7 +210,6 @@ endif() # Determine whether we can register EH tables. check_symbol_exists(__register_frame "${CMAKE_CURRENT_LIST_DIR}/unwind.h" HAVE_REGISTER_FRAME) check_symbol_exists(__deregister_frame "${CMAKE_CURRENT_LIST_DIR}/unwind.h" HAVE_DEREGISTER_FRAME) -check_symbol_exists(__unw_add_dynamic_fde "${CMAKE_CURRENT_LIST_DIR}/unwind.h" HAVE_UNW_ADD_DYNAMIC_FDE) check_symbol_exists(_Unwind_Backtrace "unwind.h" HAVE__UNWIND_BACKTRACE) check_symbol_exists(getpagesize unistd.h HAVE_GETPAGESIZE) diff --git a/llvm/cmake/unwind.h b/llvm/cmake/unwind.h index 52243f2af787..e7f53465f9ce 100644 --- a/llvm/cmake/unwind.h +++ b/llvm/cmake/unwind.h @@ -5,4 +5,3 @@ // exist in the runtime. extern void __register_frame(const void *fde); // NOLINT extern void __deregister_frame(const void *fde); // NOLINT -extern void __unw_add_dynamic_fde(); // NOLINT diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst index eaabf8a0192a..cd3bb0de4f34 100644 --- a/llvm/docs/LangRef.rst +++ b/llvm/docs/LangRef.rst @@ -16300,12 +16300,11 @@ Overview: The '``llvm.matrix.column.major.load.*``' intrinsics load a `` x `` matrix using a stride of ``%Stride`` to compute the start address of the -different columns. The offset is computed using ``%Stride``'s bitwidth. This -allows for convenient loading of sub matrixes. If ```` is true, the -intrinsic is considered a :ref:`volatile memory access `. The result -matrix is returned in the result vector. If the ``%Ptr`` argument is known to -be aligned to some boundary, this can be specified as an attribute on the -argument. +different columns. This allows for convenient loading of sub matrixes. If +```` is true, the intrinsic is considered a :ref:`volatile memory +access `. The result matrix is returned in the result vector. If the +``%Ptr`` argument is known to be aligned to some boundary, this can be +specified as an attribute on the argument. Arguments: """""""""" @@ -16340,8 +16339,7 @@ Overview: The '``llvm.matrix.column.major.store.*``' intrinsics store the `` x `` matrix in ``%In`` to memory using a stride of ``%Stride`` between -columns. The offset is computed using ``%Stride``'s bitwidth. If -```` is true, the intrinsic is considered a +columns. If ```` is true, the intrinsic is considered a :ref:`volatile memory access `. If the ``%Ptr`` argument is known to be aligned to some boundary, this can be diff --git a/llvm/docs/ReleaseNotes.rst b/llvm/docs/ReleaseNotes.rst index 542a505bfd2e..de8431fe3908 100644 --- a/llvm/docs/ReleaseNotes.rst +++ b/llvm/docs/ReleaseNotes.rst @@ -92,29 +92,6 @@ Changes to TableGen uses the "`...`" range punctuation (e.g., ``{0...9}``). The hyphen syntax is deprecated. -Changes to the AArch64 Backend --------------------------- - -During this release ... - -* Lots of improvements to generation of Windows unwind data; the unwind - data is optimized and written in packed form where possible, reducing - the size of unwind data (pdata and xdata sections) by around 60% - compared with LLVM 11. The generation of prologs/epilogs is tweaked - when targeting Windows, to increase the chances of being able to use - the packed unwind info format. - -* Support for creating Windows unwind data using ``.seh_*`` assembler - directives. - -* Produce proper assembly output for the Windows target, including - ``:lo12:`` relocation specifiers, to allow the assembly output - to actually be assembled. - -* Changed the assembly comment string for MSVC targets to ``//`` (consistent - with the MinGW and ELF targets), freeing up ``;`` to be used as - statement separator. - Changes to the ARM Backend -------------------------- @@ -129,75 +106,7 @@ During this release ... Changes to the PowerPC Target ----------------------------- -Optimization: - -* Made improvements to loop unroll-and-jam including fix to respect user - provided #pragma unroll-and-jam for loops on targets other than ARM. -* Improved PartialInliner allowing it to handle code regions in a switch - statements. -* Improved PGO support on AIX by building and linking with compiler-rt profile - library. -* Add support for Epilogue Vectorization and enabled it by default. - -CodeGen: - -* POWER10 support - * Implementation of PC Relative addressing in LLD including the associated - linker optimizations. - * Add support for the new matrix multiplication (MMA) instructions to Clang - and LLVM. - * Implementation of Power10 builtins. - -* Scheduling enhancements - * Add a new algorithm to cluster more loads/stores if the DAG is not too - complicated. - * Enable the PowerPC scheduling heuristic for Power10. - -* Target dependent passes tuning - * Enhance LoopStrengthReduce/PPCLoopInstrFormPrep pass for PowerPC, - especially for P10 intrinsics. - * Enhance machine combiner pass to reduce register pressure for PowerPC. - * Improve MachineSink to do more sinking based on register pressure and alias - analysis. - -* General improvements - * Complete the constrained floating point operations support. - * Improve the llvm-exegesis support. - * Improve the stack clash protection to probe the gap between stackptr and - realigned stackptr. - * Improve the IEEE long double support for Power8. - * Enable MemorySSA for LoopSink. - * Enhance LLVM debugging functionality via options such as -print-changed and - -print-before-changed. - * Add builtins for Power9 (i.e. darn, xvtdiv, xvtsqrt etc). - * Add options to disable all or part of LoopIdiomRecognizePass. - * Add support for printing the DDG in DOT form allowing for visual inspection - of the Data Dependence Graph. - * Remove the QPX support. - * Significant number of bug fixes including all the fixes necessary to - achieve a clean test run for Julia. - -AIX Support: - -* Compiler-rt support - * Add support for building compiler-rt for AIX and 32-bit Power targets. - * Made compiler-rt the default rtlib for AIX. - -* General Improvements - * Enable the AIX extended AltiVec ABI under option -mabi=vec-extabi. - * Add partial C99 complex type support. - * Implemente traceback table for functions (encodes vector information, - emits exception handling). - * Implemente code generation for C++ dynamic initialization and finalization. - of non-local variables for use with the -bcdtors option of the AIX linker. - * Add new option -mignore-xcoff-visibility. - * Enable explicit sections on AIX. - * Enable -f[no-]data-sections on AIX and set -fdata-sections to be the default - on AIX. - * Enable -f[no-]function-sections. - * Add support for relocation generation using the large code model. - * Add pragma align natural and sorted out pragma pack stack effect. - +During this release ... Changes to the X86 Target ------------------------- diff --git a/llvm/include/llvm-c/Core.h b/llvm/include/llvm-c/Core.h index 74fcd1621856..8274213aa839 100644 --- a/llvm/include/llvm-c/Core.h +++ b/llvm/include/llvm-c/Core.h @@ -160,10 +160,10 @@ typedef enum { LLVMVectorTypeKind, /**< Fixed width SIMD vector type */ LLVMMetadataTypeKind, /**< Metadata */ LLVMX86_MMXTypeKind, /**< X86 MMX */ + LLVMX86_AMXTypeKind, /**< X86 AMX */ LLVMTokenTypeKind, /**< Tokens */ LLVMScalableVectorTypeKind, /**< Scalable SIMD vector type */ - LLVMBFloatTypeKind, /**< 16 bit brain floating point type */ - LLVMX86_AMXTypeKind /**< X86 AMX */ + LLVMBFloatTypeKind /**< 16 bit brain floating point type */ } LLVMTypeKind; typedef enum { @@ -270,6 +270,7 @@ typedef enum { LLVMConstantVectorValueKind, LLVMUndefValueValueKind, + LLVMPoisonValueValueKind, LLVMConstantAggregateZeroValueKind, LLVMConstantDataArrayValueKind, LLVMConstantDataVectorValueKind, @@ -282,7 +283,6 @@ typedef enum { LLVMInlineAsmValueKind, LLVMInstructionValueKind, - LLVMPoisonValueValueKind } LLVMValueKind; typedef enum { @@ -604,17 +604,6 @@ unsigned LLVMGetEnumAttributeKind(LLVMAttributeRef A); */ uint64_t LLVMGetEnumAttributeValue(LLVMAttributeRef A); -/** - * Create a type attribute - */ -LLVMAttributeRef LLVMCreateTypeAttribute(LLVMContextRef C, unsigned KindID, - LLVMTypeRef type_ref); - -/** - * Get the type attribute's value. - */ -LLVMTypeRef LLVMGetTypeAttributeValue(LLVMAttributeRef A); - /** * Create a string attribute. */ @@ -637,7 +626,6 @@ const char *LLVMGetStringAttributeValue(LLVMAttributeRef A, unsigned *Length); */ LLVMBool LLVMIsEnumAttribute(LLVMAttributeRef A); LLVMBool LLVMIsStringAttribute(LLVMAttributeRef A); -LLVMBool LLVMIsTypeAttribute(LLVMAttributeRef A); /** * Obtain a Type from a context by its registered name. @@ -3946,12 +3934,6 @@ LLVMValueRef LLVMBuildCall(LLVMBuilderRef, LLVMValueRef Fn, LLVMValueRef LLVMBuildCall2(LLVMBuilderRef, LLVMTypeRef, LLVMValueRef Fn, LLVMValueRef *Args, unsigned NumArgs, const char *Name); -#ifdef ARK_GC_SUPPORT -LLVMValueRef LLVMBuildCall3(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Fn, - LLVMValueRef *Args, unsigned NumArgs, - const char *Name, LLVMValueRef *deoptVals, - int NumVals); -#endif LLVMValueRef LLVMBuildSelect(LLVMBuilderRef, LLVMValueRef If, LLVMValueRef Then, LLVMValueRef Else, const char *Name); diff --git a/llvm/include/llvm-c/ExecutionEngine.h b/llvm/include/llvm-c/ExecutionEngine.h index ccd4e5164165..c5fc9bdb4d07 100644 --- a/llvm/include/llvm-c/ExecutionEngine.h +++ b/llvm/include/llvm-c/ExecutionEngine.h @@ -42,9 +42,6 @@ typedef struct LLVMOpaqueMCJITMemoryManager *LLVMMCJITMemoryManagerRef; struct LLVMMCJITCompilerOptions { unsigned OptLevel; -#ifdef ARK_GC_SUPPORT - LLVMRelocMode RelMode; -#endif LLVMCodeModel CodeModel; LLVMBool NoFramePointerElim; LLVMBool EnableFastISel; diff --git a/llvm/include/llvm-c/Orc.h b/llvm/include/llvm-c/Orc.h index 9beef44c89dd..183107c148a6 100644 --- a/llvm/include/llvm-c/Orc.h +++ b/llvm/include/llvm-c/Orc.h @@ -339,7 +339,8 @@ LLVMErrorRef LLVMOrcResourceTrackerRemove(LLVMOrcResourceTrackerRef RT); * ownership has not been passed to a JITDylib (e.g. because some error * prevented the client from calling LLVMOrcJITDylibAddGenerator). */ -void LLVMOrcDisposeDefinitionGenerator(LLVMOrcDefinitionGeneratorRef DG); +void LLVMOrcDisposeDefinitionGenerator( + LLVMOrcDefinitionGeneratorRef DG); /** * Dispose of a MaterializationUnit. @@ -387,9 +388,7 @@ LLVMOrcExecutionSessionCreateJITDylib(LLVMOrcExecutionSessionRef ES, * Returns the JITDylib with the given name, or NULL if no such JITDylib * exists. */ -LLVMOrcJITDylibRef -LLVMOrcExecutionSessionGetJITDylibByName(LLVMOrcExecutionSessionRef ES, - const char *Name); +LLVMOrcJITDylibRef LLVMOrcExecutionSessionGetJITDylibByName(const char *Name); /** * Return a reference to a newly created resource tracker associated with JD. diff --git a/llvm/include/llvm/ADT/Any.h b/llvm/include/llvm/ADT/Any.h index 1e3abca70679..0aded628cda4 100644 --- a/llvm/include/llvm/ADT/Any.h +++ b/llvm/include/llvm/ADT/Any.h @@ -23,12 +23,7 @@ namespace llvm { -class LLVM_EXTERNAL_VISIBILITY Any { - - // The `Typeid::Id` static data member below is a globally unique - // identifier for the type `T`. It is explicitly marked with default - // visibility so that when `-fvisibility=hidden` is used, the loader still - // merges duplicate definitions across DSO boundaries. +class Any { template struct TypeId { static const char Id; }; struct StorageBase { diff --git a/llvm/include/llvm/ADT/Triple.h b/llvm/include/llvm/ADT/Triple.h index cfda6ad94281..eed315c929ad 100644 --- a/llvm/include/llvm/ADT/Triple.h +++ b/llvm/include/llvm/ADT/Triple.h @@ -172,7 +172,7 @@ public: IOS, KFreeBSD, Linux, - Lv2, // PS3 + Lv2, // PS3 MacOSX, NetBSD, OpenBSD, @@ -182,15 +182,15 @@ public: Haiku, Minix, RTEMS, - NaCl, // Native Client + NaCl, // Native Client AIX, - CUDA, // NVIDIA CUDA - NVCL, // NVIDIA OpenCL - AMDHSA, // AMD HSA Runtime + CUDA, // NVIDIA CUDA + NVCL, // NVIDIA OpenCL + AMDHSA, // AMD HSA Runtime PS4, ELFIAMCU, - TvOS, // Apple tvOS - WatchOS, // Apple watchOS + TvOS, // Apple tvOS + WatchOS, // Apple watchOS Mesa3D, Contiki, AMDPAL, // AMD PAL Runtime @@ -198,8 +198,7 @@ public: Hurd, // GNU/Hurd WASI, // Experimental WebAssembly OS Emscripten, - LiteOS, - LastOSType = LiteOS + LastOSType = Emscripten }; enum EnvironmentType { UnknownEnvironment, @@ -224,9 +223,8 @@ public: Cygnus, CoreCLR, Simulator, // Simulator variants of other systems, e.g., Apple's iOS - MacABI, // Mac Catalyst variant of Apple's iOS deployment target. - OpenHOS, - LastEnvironmentType = OpenHOS + MacABI, // Mac Catalyst variant of Apple's iOS deployment target. + LastEnvironmentType = MacABI }; enum ObjectFormatType { UnknownObjectFormat, @@ -689,19 +687,9 @@ public: bool isMusl() const { return getEnvironment() == Triple::Musl || getEnvironment() == Triple::MuslEABI || - getEnvironment() == Triple::MuslEABIHF || - getEnvironment() == Triple::OpenHOS || - isOSLiteOS(); + getEnvironment() == Triple::MuslEABIHF; } - /// Tests whether the target is OHOS - /// LiteOS default enviroment is also OHOS, but omited on triple. - bool isOHOSFamily() const { return isOpenHOS() || isOSLiteOS(); } - - bool isOpenHOS() const { return getEnvironment() == Triple::OpenHOS; } - - bool isOSLiteOS() const { return getOS() == Triple::LiteOS; } - /// Tests whether the target is SPIR (32- or 64-bit). bool isSPIR() const { return getArch() == Triple::spir || getArch() == Triple::spir64; @@ -821,7 +809,7 @@ public: /// Tests whether the target uses emulated TLS as default. bool hasDefaultEmulatedTLS() const { - return isOpenHOS() || isAndroid() || isOSOpenBSD() || isWindowsCygwinEnvironment(); + return isAndroid() || isOSOpenBSD() || isWindowsCygwinEnvironment(); } /// Tests whether the target uses -data-sections as default. diff --git a/llvm/include/llvm/Analysis/AssumptionCache.h b/llvm/include/llvm/Analysis/AssumptionCache.h index c4602d3449c0..0ef63dc68e1c 100644 --- a/llvm/include/llvm/Analysis/AssumptionCache.h +++ b/llvm/include/llvm/Analysis/AssumptionCache.h @@ -45,7 +45,7 @@ public: enum : unsigned { ExprResultIdx = std::numeric_limits::max() }; struct ResultElem { - WeakVH Assume; + WeakTrackingVH Assume; /// contains either ExprResultIdx or the index of the operand bundle /// containing the knowledge. diff --git a/llvm/include/llvm/BinaryFormat/ELF.h b/llvm/include/llvm/BinaryFormat/ELF.h index 133eaaf9f06b..1552303b610c 100644 --- a/llvm/include/llvm/BinaryFormat/ELF.h +++ b/llvm/include/llvm/BinaryFormat/ELF.h @@ -1238,8 +1238,6 @@ enum { PT_OPENBSD_WXNEEDED = 0x65a3dbe7, // Program does W^X violations. PT_OPENBSD_BOOTDATA = 0x65a41be6, // Section for boot arguments. - PT_OHOS_RANDOMDATA = 0x6788FC60, // Fill with random data. - // ARM program header types. PT_ARM_ARCHEXT = 0x70000000, // Platform architecture compatibility info // These all contain stack unwind tables. diff --git a/llvm/include/llvm/BinaryFormat/MinidumpConstants.def b/llvm/include/llvm/BinaryFormat/MinidumpConstants.def index c03a4f8fd9ea..543305feea77 100644 --- a/llvm/include/llvm/BinaryFormat/MinidumpConstants.def +++ b/llvm/include/llvm/BinaryFormat/MinidumpConstants.def @@ -115,7 +115,6 @@ HANDLE_MDMP_PLATFORM(0x8202, Solaris) // Solaris HANDLE_MDMP_PLATFORM(0x8203, Android) // Android HANDLE_MDMP_PLATFORM(0x8204, PS3) // PS3 HANDLE_MDMP_PLATFORM(0x8205, NaCl) // Native Client (NaCl) -HANDLE_MDMP_PLATFORM(0x8207, OpenHOS) HANDLE_MDMP_PROTECT(0x01, NoAccess, PAGE_NO_ACCESS) HANDLE_MDMP_PROTECT(0x02, ReadOnly, PAGE_READ_ONLY) diff --git a/llvm/include/llvm/Bitcode/LLVMBitCodes.h b/llvm/include/llvm/Bitcode/LLVMBitCodes.h index 830f1792de58..5b4854d6c95e 100644 --- a/llvm/include/llvm/Bitcode/LLVMBitCodes.h +++ b/llvm/include/llvm/Bitcode/LLVMBitCodes.h @@ -657,7 +657,6 @@ enum AttributeKindCodes { ATTR_KIND_NO_CALLBACK = 71, ATTR_KIND_HOT = 72, ATTR_KIND_NO_PROFILE = 73, - ATTR_KIND_STACK_PROTECT_RET = 74, }; enum ComdatSelectionKindCodes { diff --git a/llvm/include/llvm/CodeGen/FastISel.h b/llvm/include/llvm/CodeGen/FastISel.h index 26bf4ab2618c..81c1d6aad49a 100644 --- a/llvm/include/llvm/CodeGen/FastISel.h +++ b/llvm/include/llvm/CodeGen/FastISel.h @@ -490,10 +490,7 @@ protected: /// - \c Add has a constant operand. bool canFoldAddIntoGEP(const User *GEP, const Value *Add); - /// Test whether the register associated with this value has exactly one use, - /// in which case that single use is killing. Note that multiple IR values - /// may map onto the same register, in which case this is not the same as - /// checking that an IR value has one use. + /// Test whether the given value has exactly one use. bool hasTrivialKill(const Value *V); /// Create a machine mem operand from the given instruction. diff --git a/llvm/include/llvm/CodeGen/GlobalISel/LegalizerHelper.h b/llvm/include/llvm/CodeGen/GlobalISel/LegalizerHelper.h index 4a982b00125d..c3b494e94ff1 100644 --- a/llvm/include/llvm/CodeGen/GlobalISel/LegalizerHelper.h +++ b/llvm/include/llvm/CodeGen/GlobalISel/LegalizerHelper.h @@ -316,7 +316,6 @@ public: LegalizeResult narrowScalarShift(MachineInstr &MI, unsigned TypeIdx, LLT Ty); LegalizeResult narrowScalarMul(MachineInstr &MI, LLT Ty); - LegalizeResult narrowScalarFPTOI(MachineInstr &MI, unsigned TypeIdx, LLT Ty); LegalizeResult narrowScalarExtract(MachineInstr &MI, unsigned TypeIdx, LLT Ty); LegalizeResult narrowScalarInsert(MachineInstr &MI, unsigned TypeIdx, LLT Ty); diff --git a/llvm/include/llvm/CodeGen/MachineFrameInfo.h b/llvm/include/llvm/CodeGen/MachineFrameInfo.h index cca3cb091b0a..7f0ec0df57c5 100644 --- a/llvm/include/llvm/CodeGen/MachineFrameInfo.h +++ b/llvm/include/llvm/CodeGen/MachineFrameInfo.h @@ -274,13 +274,6 @@ private: /// The frame index for the stack protector. int StackProtectorIdx = -1; - struct StackProtectorRet { - /// The register to use for stack protector & backwrad cfi calculations - unsigned Register = 0; - /// Set to true if this function needs stack-protector-ret - bool Needed = false; - } SPR; - /// The frame index for the function context. Used for SjLj exceptions. int FunctionContextIdx = -1; @@ -362,14 +355,6 @@ public: void setStackProtectorIndex(int I) { StackProtectorIdx = I; } bool hasStackProtectorIndex() const { return StackProtectorIdx != -1; } - /// Get / Set stack protector ret calculation register - unsigned getStackProtectorRetRegister() const { return SPR.Register; } - void setStackProtectorRetRegister(unsigned I) { SPR.Register = I; } - bool hasStackProtectorRetRegister() const { return SPR.Register != 0; } - /// Get / Set if this frame needs backward cfi protect. - void setStackProtectorRetNeeded(bool I) { SPR.Needed = I; } - bool getStackProtectorRetNeeded() const { return SPR.Needed; } - /// Return the index for the function context object. /// This object is used for SjLj exceptions. int getFunctionContextIndex() const { return FunctionContextIdx; } diff --git a/llvm/include/llvm/CodeGen/MachineInstr.h b/llvm/include/llvm/CodeGen/MachineInstr.h index f8d97c2c07a6..6bbe2d03f9e5 100644 --- a/llvm/include/llvm/CodeGen/MachineInstr.h +++ b/llvm/include/llvm/CodeGen/MachineInstr.h @@ -1156,10 +1156,6 @@ public: return getOpcode() == TargetOpcode::CFI_INSTRUCTION; } - bool isPseudoProbe() const { - return getOpcode() == TargetOpcode::PSEUDO_PROBE; - } - // True if the instruction represents a position in the function. bool isPosition() const { return isLabel() || isCFIInstruction(); } @@ -1169,9 +1165,6 @@ public: bool isDebugInstr() const { return isDebugValue() || isDebugLabel() || isDebugRef(); } - bool isDebugOrPseudoInstr() const { - return isDebugInstr() || isPseudoProbe(); - } bool isDebugOffsetImm() const { return getDebugOffset().isImm(); } diff --git a/llvm/include/llvm/CodeGen/StackProtector.h b/llvm/include/llvm/CodeGen/StackProtector.h index d2b82009658f..f6513e8d4ea0 100644 --- a/llvm/include/llvm/CodeGen/StackProtector.h +++ b/llvm/include/llvm/CodeGen/StackProtector.h @@ -101,8 +101,6 @@ private: /// stack protector based upon the stack protector level. bool RequiresStackProtector(); - bool CreateSSPRetCookie(); - public: static char ID; // Pass identification, replacement for typeid. diff --git a/llvm/include/llvm/CodeGen/StackProtectorRetLowering.h b/llvm/include/llvm/CodeGen/StackProtectorRetLowering.h deleted file mode 100644 index 667d0f04ceea..000000000000 --- a/llvm/include/llvm/CodeGen/StackProtectorRetLowering.h +++ /dev/null @@ -1,57 +0,0 @@ -//===-- StackProtectorRetLowering.h -----------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_CODEGEN_STACKPROTECTORRETLOWERING_H -#define LLVM_CODEGEN_STACKPROTECTORRETLOWERING_H - -#include -#include - -namespace llvm { -class CalleeSavedInfo; -class GlobalVariable; -class MachineBasicBlock; -class MachineFunction; -class MachineInstr; - -class StackProtectorRetLowering { -public: - virtual ~StackProtectorRetLowering() {} - - /// insert stack-protector-ret instrumentation in prologue or epilogue. - virtual void insertStackProtectorRetPrologue(MachineFunction &MF, - MachineBasicBlock &MBB, - GlobalVariable *cookie) const {} - virtual void insertStackProtectorRetEpilogue(MachineFunction &MF, - MachineInstr &MI, - GlobalVariable *cookie) const {} - - /// Check if it is a return instruction. - /// Need to overide the implementation for different architectures. - virtual bool instrIsRet(unsigned opcode) const { return false; } - - /// Get a caller saved temporary register for the target architecture. - /// Need to overide the implementation for different architectures. - virtual unsigned getTargetReg(void) const { return 0; } - - /// Check if backward CFI protection is required. - virtual void setupStackProtectorRet(MachineFunction &MF) const; - - /// Set SSPRetReg as a callee saved register to push the computed stack guard value onto the stack. - virtual void saveStackProtectorRetRegister(MachineFunction &MF, std::vector &CSI) const; - - /// Determine an available SSPRet register and feedback the determination result. - virtual bool determineStackProtectorRetRegister(MachineFunction &MF) const; - - /// insertStackProtectorRets - insert stack-protector-ret instrumentation. - virtual void insertStackProtectorRets(MachineFunction &MF) const; -}; - -} // namespace llvm - -#endif diff --git a/llvm/include/llvm/CodeGen/TargetFrameLowering.h b/llvm/include/llvm/CodeGen/TargetFrameLowering.h index ae107867087b..792452f6e81d 100644 --- a/llvm/include/llvm/CodeGen/TargetFrameLowering.h +++ b/llvm/include/llvm/CodeGen/TargetFrameLowering.h @@ -14,12 +14,8 @@ #define LLVM_CODEGEN_TARGETFRAMELOWERING_H #include "llvm/CodeGen/MachineBasicBlock.h" -#include "llvm/CodeGen/StackProtectorRetLowering.h" #include "llvm/Support/TypeSize.h" #include -#ifdef ARK_GC_SUPPORT -#include "llvm/ADT/Triple.h" -#endif namespace llvm { class BitVector; @@ -212,31 +208,6 @@ public: MachineBasicBlock &MBB) const = 0; virtual void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const = 0; -#ifdef ARK_GC_SUPPORT - -template -constexpr T RoundUp(T x, size_t n) const -{ - static_assert(std::is_integral::value, "T must be integral"); - return (static_cast(x) + n - 1U) & (-n); -} - -virtual Triple::ArchType GetArkSupportTarget() const -{ - return Triple::UnknownArch; -} - -virtual int GetFixedFpPosition() const -{ - return 2; -} - -virtual int GetFrameReserveSize(MachineFunction &MF) const; -#endif - - virtual const StackProtectorRetLowering *getStackProtectorRet() const { - return nullptr; - } /// With basic block sections, emit callee saved frame moves for basic blocks /// that are in a different section. diff --git a/llvm/include/llvm/CodeGen/TargetLowering.h b/llvm/include/llvm/CodeGen/TargetLowering.h index 40115fbd2f15..c3221aac8eea 100644 --- a/llvm/include/llvm/CodeGen/TargetLowering.h +++ b/llvm/include/llvm/CodeGen/TargetLowering.h @@ -2785,10 +2785,6 @@ public: return false; } - /// Does this target require the clearing of high-order bits in a register - /// passed to the fp16 to fp conversion library function. - virtual bool shouldKeepZExtForFP16Conv() const { return false; } - //===--------------------------------------------------------------------===// // Runtime Library hooks // diff --git a/llvm/include/llvm/Config/config.h.cmake b/llvm/include/llvm/Config/config.h.cmake index d54ea9a40c69..6664ad335584 100644 --- a/llvm/include/llvm/Config/config.h.cmake +++ b/llvm/include/llvm/Config/config.h.cmake @@ -64,9 +64,6 @@ /* Define to 1 if we can deregister EH frames on this platform. */ #cmakedefine HAVE_DEREGISTER_FRAME ${HAVE_DEREGISTER_FRAME} -/* Define if __unw_add_dynamic_fde() is available on this platform. */ -#cmakedefine HAVE_UNW_ADD_DYNAMIC_FDE ${HAVE_UNW_ADD_DYNAMIC_FDE} - /* Define to 1 if you have the header file. */ #cmakedefine HAVE_ERRNO_H ${HAVE_ERRNO_H} diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h index cf4c827b9267..39ae53c4e7fe 100644 --- a/llvm/include/llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h +++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h @@ -111,16 +111,6 @@ public: return AttributeSpecs[idx].Attr; } - bool getAttrIsImplicitConstByIndex(uint32_t idx) const { - assert(idx < AttributeSpecs.size()); - return AttributeSpecs[idx].isImplicitConst(); - } - - int64_t getAttrImplicitConstValueByIndex(uint32_t idx) const { - assert(idx < AttributeSpecs.size()); - return AttributeSpecs[idx].getImplicitConstValue(); - } - /// Get the index of the specified attribute. /// /// Searches the this abbreviation declaration for the index of the specified diff --git a/llvm/include/llvm/Demangle/ItaniumDemangle.h b/llvm/include/llvm/Demangle/ItaniumDemangle.h index e5fca98f9271..6bfc02d15379 100644 --- a/llvm/include/llvm/Demangle/ItaniumDemangle.h +++ b/llvm/include/llvm/Demangle/ItaniumDemangle.h @@ -96,6 +96,7 @@ X(InitListExpr) \ X(FoldExpr) \ X(ThrowExpr) \ + X(UUIDOfExpr) \ X(BoolExpr) \ X(StringLiteral) \ X(LambdaExpr) \ @@ -2034,6 +2035,21 @@ public: } }; +// MSVC __uuidof extension, generated by clang in -fms-extensions mode. +class UUIDOfExpr : public Node { + Node *Operand; +public: + UUIDOfExpr(Node *Operand_) : Node(KUUIDOfExpr), Operand(Operand_) {} + + template void match(Fn F) const { F(Operand); } + + void printLeft(OutputStream &S) const override { + S << "__uuidof("; + Operand->print(S); + S << ")"; + } +}; + class BoolExpr : public Node { bool Value; @@ -4997,43 +5013,6 @@ Node *AbstractManglingParser::parseExpr() { } } return nullptr; - case 'u': { - ++First; - Node *Name = getDerived().parseSourceName(/*NameState=*/nullptr); - if (!Name) - return nullptr; - // Special case legacy __uuidof mangling. The 't' and 'z' appear where the - // standard encoding expects a , and would be otherwise be - // interpreted as node 'short' or 'ellipsis'. However, neither - // __uuidof(short) nor __uuidof(...) can actually appear, so there is no - // actual conflict here. - if (Name->getBaseName() == "__uuidof") { - if (numLeft() < 2) - return nullptr; - if (*First == 't') { - ++First; - Node *Ty = getDerived().parseType(); - if (!Ty) - return nullptr; - return make(Name, makeNodeArray(&Ty, &Ty + 1)); - } - if (*First == 'z') { - ++First; - Node *Ex = getDerived().parseExpr(); - if (!Ex) - return nullptr; - return make(Name, makeNodeArray(&Ex, &Ex + 1)); - } - } - size_t ExprsBegin = Names.size(); - while (!consumeIf('E')) { - Node *E = getDerived().parseTemplateArg(); - if (E == nullptr) - return E; - Names.push_back(E); - } - return make(Name, popTrailingNodeArray(ExprsBegin)); - } case '1': case '2': case '3': @@ -5045,6 +5024,21 @@ Node *AbstractManglingParser::parseExpr() { case '9': return getDerived().parseUnresolvedName(); } + + if (consumeIf("u8__uuidoft")) { + Node *Ty = getDerived().parseType(); + if (!Ty) + return nullptr; + return make(Ty); + } + + if (consumeIf("u8__uuidofz")) { + Node *Ex = getDerived().parseExpr(); + if (!Ex) + return nullptr; + return make(Ex); + } + return nullptr; } diff --git a/llvm/include/llvm/Frontend/OpenMP/OMPKinds.def b/llvm/include/llvm/Frontend/OpenMP/OMPKinds.def index 75d360bf4237..844046167975 100644 --- a/llvm/include/llvm/Frontend/OpenMP/OMPKinds.def +++ b/llvm/include/llvm/Frontend/OpenMP/OMPKinds.def @@ -375,7 +375,7 @@ __OMP_RTL(__kmpc_init_allocator, false, /* omp_allocator_handle_t */ VoidPtr, __OMP_RTL(__kmpc_destroy_allocator, false, Void, /* Int */ Int32, /* omp_allocator_handle_t */ VoidPtr) -__OMP_RTL(__kmpc_push_target_tripcount_mapper, false, Void, IdentPtr, Int64, Int64) +__OMP_RTL(__kmpc_push_target_tripcount, false, Void, IdentPtr, Int64, Int64) __OMP_RTL(__tgt_target_mapper, false, Int32, IdentPtr, Int64, VoidPtr, Int32, VoidPtrPtr, VoidPtrPtr, Int64Ptr, Int64Ptr, VoidPtrPtr, VoidPtrPtr) __OMP_RTL(__tgt_target_nowait_mapper, false, Int32, IdentPtr, Int64, VoidPtr, Int32, @@ -844,7 +844,7 @@ __OMP_RTL_ATTRS(__kmpc_free, AllocAttrs, AttributeSet(), {}) __OMP_RTL_ATTRS(__kmpc_init_allocator, DefaultAttrs, ReturnPtrAttrs, {}) __OMP_RTL_ATTRS(__kmpc_destroy_allocator, AllocAttrs, AttributeSet(), {}) -__OMP_RTL_ATTRS(__kmpc_push_target_tripcount_mapper, SetterAttrs, AttributeSet(), {}) +__OMP_RTL_ATTRS(__kmpc_push_target_tripcount, SetterAttrs, AttributeSet(), {}) __OMP_RTL_ATTRS(__tgt_target_mapper, ForkAttrs, AttributeSet(), {}) __OMP_RTL_ATTRS(__tgt_target_nowait_mapper, ForkAttrs, AttributeSet(), {}) __OMP_RTL_ATTRS(__tgt_target_teams_mapper, ForkAttrs, AttributeSet(), {}) diff --git a/llvm/include/llvm/IR/Attributes.td b/llvm/include/llvm/IR/Attributes.td index d188980201f2..f7ffc888c65a 100644 --- a/llvm/include/llvm/IR/Attributes.td +++ b/llvm/include/llvm/IR/Attributes.td @@ -203,9 +203,6 @@ def Speculatable : EnumAttr<"speculatable">; /// Stack protection. def StackProtect : EnumAttr<"ssp">; -/// Stack protection for return address. -def StackProtectRet : EnumAttr<"sspret">; - /// Stack protection required. def StackProtectReq : EnumAttr<"sspreq">; diff --git a/llvm/include/llvm/IR/Constant.h b/llvm/include/llvm/IR/Constant.h index 71692c746015..0190aca27b72 100644 --- a/llvm/include/llvm/IR/Constant.h +++ b/llvm/include/llvm/IR/Constant.h @@ -214,10 +214,6 @@ public: /// both must either be scalars or vectors with the same element count. If no /// changes are made, the constant C is returned. static Constant *mergeUndefsWith(Constant *C, Constant *Other); - - /// Return true if a constant is ConstantData or a ConstantAggregate or - /// ConstantExpr that contain only ConstantData. - bool isManifestConstant() const; }; } // end namespace llvm diff --git a/llvm/include/llvm/IR/Function.h b/llvm/include/llvm/IR/Function.h index de6fff21a2ed..7e209bb3769b 100644 --- a/llvm/include/llvm/IR/Function.h +++ b/llvm/include/llvm/IR/Function.h @@ -387,7 +387,7 @@ public: void setGC(std::string Str); void clearGC(); - /// Returns true if the function has ssp, sspstrong, sspret or sspreq fn attrs. + /// Returns true if the function has ssp, sspstrong, or sspreq fn attrs. bool hasStackProtectorFnAttr() const; /// adds the attribute to the list of attributes. diff --git a/llvm/include/llvm/IR/InstrTypes.h b/llvm/include/llvm/IR/InstrTypes.h index 955ac8e537fe..f42ef48de6b3 100644 --- a/llvm/include/llvm/IR/InstrTypes.h +++ b/llvm/include/llvm/IR/InstrTypes.h @@ -1757,6 +1757,9 @@ public: return doesNotAccessMemory() || hasFnAttr(Attribute::ReadOnly); } + /// Returns true if this function is guaranteed to return. + bool willReturn() const { return hasFnAttr(Attribute::WillReturn); } + void setOnlyReadsMemory() { addAttribute(AttributeList::FunctionIndex, Attribute::ReadOnly); } diff --git a/llvm/include/llvm/IR/Instruction.h b/llvm/include/llvm/IR/Instruction.h index b99dc62bbb9d..d2a55f89fac9 100644 --- a/llvm/include/llvm/IR/Instruction.h +++ b/llvm/include/llvm/IR/Instruction.h @@ -633,10 +633,6 @@ public: /// generated program. bool isSafeToRemove() const; - /// Return true if the instruction will return (unwinding is considered as - /// a form of returning control flow here). - bool willReturn() const; - /// Return true if the instruction is a variety of EH-block. bool isEHPad() const { switch (getOpcode()) { @@ -654,9 +650,6 @@ public: /// llvm.lifetime.end marker. bool isLifetimeStartOrEnd() const; - /// Return true if the instruction is a DbgInfoIntrinsic or PseudoProbeInst. - bool isDebugOrPseudoInst() const; - /// Return a pointer to the next non-debug instruction in the same basic /// block as 'this', or nullptr if no such instruction exists. Skip any pseudo /// operations if \c SkipPseudoOp is true. diff --git a/llvm/include/llvm/IR/IntrinsicInst.h b/llvm/include/llvm/IR/IntrinsicInst.h index df3a1d568756..9d68f3fdde6c 100644 --- a/llvm/include/llvm/IR/IntrinsicInst.h +++ b/llvm/include/llvm/IR/IntrinsicInst.h @@ -981,16 +981,12 @@ public: return cast(const_cast(getArgOperand(0))); } - ConstantInt *getIndex() const { - return cast(const_cast(getArgOperand(1))); - } - ConstantInt *getAttributes() const { return cast(const_cast(getArgOperand(2))); } - ConstantInt *getFactor() const { - return cast(const_cast(getArgOperand(3))); + ConstantInt *getIndex() const { + return cast(const_cast(getArgOperand(1))); } }; diff --git a/llvm/include/llvm/IR/Intrinsics.td b/llvm/include/llvm/IR/Intrinsics.td index 2ea4621415b5..b2bfc6e6f9e6 100644 --- a/llvm/include/llvm/IR/Intrinsics.td +++ b/llvm/include/llvm/IR/Intrinsics.td @@ -1298,7 +1298,7 @@ def int_sideeffect : DefaultAttrsIntrinsic<[], [], [IntrInaccessibleMemOnly, Int // Like the sideeffect intrinsic defined above, this intrinsic is treated by the // optimizer as having opaque side effects so that it won't be get rid of or moved // out of the block it probes. -def int_pseudoprobe : Intrinsic<[], [llvm_i64_ty, llvm_i64_ty, llvm_i32_ty, llvm_i64_ty], +def int_pseudoprobe : Intrinsic<[], [llvm_i64_ty, llvm_i64_ty, llvm_i32_ty], [IntrInaccessibleMemOnly, IntrWillReturn]>; // Intrinsics to support half precision floating point format @@ -1560,7 +1560,7 @@ def int_matrix_multiply def int_matrix_column_major_load : DefaultAttrsIntrinsic<[llvm_anyvector_ty], - [LLVMPointerToElt<0>, llvm_anyint_ty, llvm_i1_ty, + [LLVMPointerToElt<0>, llvm_i64_ty, llvm_i1_ty, llvm_i32_ty, llvm_i32_ty], [IntrNoSync, IntrWillReturn, IntrArgMemOnly, IntrReadMem, NoCapture>, ImmArg>, ImmArg>, @@ -1569,7 +1569,7 @@ def int_matrix_column_major_load def int_matrix_column_major_store : DefaultAttrsIntrinsic<[], [llvm_anyvector_ty, LLVMPointerToElt<0>, - llvm_anyint_ty, llvm_i1_ty, llvm_i32_ty, llvm_i32_ty], + llvm_i64_ty, llvm_i1_ty, llvm_i32_ty, llvm_i32_ty], [IntrNoSync, IntrWillReturn, IntrArgMemOnly, IntrWriteMem, WriteOnly>, NoCapture>, ImmArg>, ImmArg>, ImmArg>]>; diff --git a/llvm/include/llvm/IR/IntrinsicsRISCV.td b/llvm/include/llvm/IR/IntrinsicsRISCV.td index c4056895f68e..ab5b09b72ac3 100644 --- a/llvm/include/llvm/IR/IntrinsicsRISCV.td +++ b/llvm/include/llvm/IR/IntrinsicsRISCV.td @@ -790,9 +790,6 @@ let TargetPrefix = "riscv" in { defm vsoxei : RISCVIStore; defm vsuxei : RISCVIStore; - def int_riscv_vle1 : RISCVUSLoad; - def int_riscv_vse1 : RISCVUSStore; - defm vamoswap : RISCVAMO; defm vamoadd : RISCVAMO; defm vamoxor : RISCVAMO; @@ -943,8 +940,8 @@ let TargetPrefix = "riscv" in { defm vfwnmsac : RISCVTernaryWide; defm vfsqrt : RISCVUnaryAA; - defm vfrsqrt7 : RISCVUnaryAA; - defm vfrec7 : RISCVUnaryAA; + defm vfrsqrte7 : RISCVUnaryAA; + defm vfrece7 : RISCVUnaryAA; defm vfmin : RISCVBinaryAAX; defm vfmax : RISCVBinaryAAX; diff --git a/llvm/include/llvm/IR/MatrixBuilder.h b/llvm/include/llvm/IR/MatrixBuilder.h index 017c8c5e06b9..084b1d49569e 100644 --- a/llvm/include/llvm/IR/MatrixBuilder.h +++ b/llvm/include/llvm/IR/MatrixBuilder.h @@ -74,7 +74,7 @@ public: Value *Ops[] = {DataPtr, Stride, B.getInt1(IsVolatile), B.getInt32(Rows), B.getInt32(Columns)}; - Type *OverloadedTypes[] = {RetType, Stride->getType()}; + Type *OverloadedTypes[] = {RetType}; Function *TheFn = Intrinsic::getDeclaration( getModule(), Intrinsic::matrix_column_major_load, OverloadedTypes); @@ -97,7 +97,7 @@ public: Value *Ops[] = {Matrix, Ptr, Stride, B.getInt1(IsVolatile), B.getInt32(Rows), B.getInt32(Columns)}; - Type *OverloadedTypes[] = {Matrix->getType(), Stride->getType()}; + Type *OverloadedTypes[] = {Matrix->getType()}; Function *TheFn = Intrinsic::getDeclaration( getModule(), Intrinsic::matrix_column_major_store, OverloadedTypes); diff --git a/llvm/include/llvm/IR/Metadata.h b/llvm/include/llvm/IR/Metadata.h index 9a4480b75a30..0b87416befe9 100644 --- a/llvm/include/llvm/IR/Metadata.h +++ b/llvm/include/llvm/IR/Metadata.h @@ -667,12 +667,6 @@ struct AAMDNodes { /// The tag specifying the noalias scope. MDNode *NoAlias = nullptr; - // Shift tbaa Metadata node to start off bytes later - static MDNode *ShiftTBAA(MDNode *M, size_t off); - - // Shift tbaa.struct Metadata node to start off bytes later - static MDNode *ShiftTBAAStruct(MDNode *M, size_t off); - /// Given two sets of AAMDNodes that apply to the same pointer, /// give the best AAMDNodes that are compatible with both (i.e. a set of /// nodes whose allowable aliasing conclusions are a subset of those @@ -686,18 +680,6 @@ struct AAMDNodes { Result.NoAlias = Other.NoAlias == NoAlias ? NoAlias : nullptr; return Result; } - - /// Create a new AAMDNode that describes this AAMDNode after applying a - /// constant offset to the start of the pointer - AAMDNodes shift(size_t Offset) { - AAMDNodes Result; - Result.TBAA = TBAA ? ShiftTBAA(TBAA, Offset) : nullptr; - Result.TBAAStruct = - TBAAStruct ? ShiftTBAAStruct(TBAAStruct, Offset) : nullptr; - Result.Scope = Scope; - Result.NoAlias = NoAlias; - return Result; - } }; // Specialize DenseMapInfo for AAMDNodes. diff --git a/llvm/include/llvm/IR/Operator.h b/llvm/include/llvm/IR/Operator.h index 945f7e46e142..acfacbd6c74e 100644 --- a/llvm/include/llvm/IR/Operator.h +++ b/llvm/include/llvm/IR/Operator.h @@ -568,11 +568,6 @@ public: bool accumulateConstantOffset( const DataLayout &DL, APInt &Offset, function_ref ExternalAnalysis = nullptr) const; - - static bool accumulateConstantOffset( - Type *SourceType, ArrayRef Index, const DataLayout &DL, - APInt &Offset, - function_ref ExternalAnalysis = nullptr); }; class PtrToIntOperator diff --git a/llvm/include/llvm/IR/PseudoProbe.h b/llvm/include/llvm/IR/PseudoProbe.h index 5165e80caa2d..e0370c264102 100644 --- a/llvm/include/llvm/IR/PseudoProbe.h +++ b/llvm/include/llvm/IR/PseudoProbe.h @@ -16,39 +16,28 @@ #include "llvm/ADT/Optional.h" #include #include -#include namespace llvm { class Instruction; -class BasicBlock; constexpr const char *PseudoProbeDescMetadataName = "llvm.pseudo_probe_desc"; enum class PseudoProbeType { Block = 0, IndirectCall, DirectCall }; -// The saturated distrution factor representing 100% for block probes. -constexpr static uint64_t PseudoProbeFullDistributionFactor = - std::numeric_limits::max(); - struct PseudoProbeDwarfDiscriminator { -public: // The following APIs encodes/decodes per-probe information to/from a // 32-bit integer which is organized as: // [2:0] - 0x7, this is reserved for regular discriminator, // see DWARF discriminator encoding rule // [18:3] - probe id - // [25:19] - probe distribution factor + // [25:19] - reserved // [28:26] - probe type, see PseudoProbeType // [31:29] - reserved for probe attributes - static uint32_t packProbeData(uint32_t Index, uint32_t Type, uint32_t Flags, - uint32_t Factor) { + static uint32_t packProbeData(uint32_t Index, uint32_t Type) { assert(Index <= 0xFFFF && "Probe index too big to encode, exceeding 2^16"); assert(Type <= 0x7 && "Probe type too big to encode, exceeding 7"); - assert(Flags <= 0x7); - assert(Factor <= 100 && - "Probe distribution factor too big to encode, exceeding 100"); - return (Index << 3) | (Factor << 19) | (Type << 26) | 0x7; + return (Index << 3) | (Type << 26) | 0x7; } static uint32_t extractProbeIndex(uint32_t Value) { @@ -62,26 +51,16 @@ public: static uint32_t extractProbeAttributes(uint32_t Value) { return (Value >> 29) & 0x7; } - - static uint32_t extractProbeFactor(uint32_t Value) { - return (Value >> 19) & 0x7F; - } - - // The saturated distrution factor representing 100% for callsites. - constexpr static uint8_t FullDistributionFactor = 100; }; struct PseudoProbe { uint32_t Id; uint32_t Type; uint32_t Attr; - float Factor; }; Optional extractProbe(const Instruction &Inst); -void setProbeDistributionFactor(Instruction &Inst, float Factor); - } // end namespace llvm #endif // LLVM_IR_PSEUDOPROBE_H diff --git a/llvm/include/llvm/LTO/Config.h b/llvm/include/llvm/LTO/Config.h index 0f88c06d0fd4..88c1452e5aa9 100644 --- a/llvm/include/llvm/LTO/Config.h +++ b/llvm/include/llvm/LTO/Config.h @@ -51,9 +51,6 @@ struct Config { CodeGenOpt::Level CGOptLevel = CodeGenOpt::Default; CodeGenFileType CGFileType = CGFT_ObjectFile; unsigned OptLevel = 2; - unsigned SizeLevel = 0; - bool MergeFunctions = false; - bool DisableVerify = false; /// Use the new pass manager diff --git a/llvm/include/llvm/Passes/StandardInstrumentations.h b/llvm/include/llvm/Passes/StandardInstrumentations.h index 61c86b0468f2..795a980878e2 100644 --- a/llvm/include/llvm/Passes/StandardInstrumentations.h +++ b/llvm/include/llvm/Passes/StandardInstrumentations.h @@ -22,7 +22,6 @@ #include "llvm/IR/PassTimingInfo.h" #include "llvm/IR/ValueHandle.h" #include "llvm/Support/CommandLine.h" -#include "llvm/Transforms/IPO/SampleProfileProbe.h" #include #include @@ -274,7 +273,6 @@ class StandardInstrumentations { OptBisectInstrumentation OptBisect; PreservedCFGCheckerInstrumentation PreservedCFGChecker; IRChangedPrinter PrintChangedIR; - PseudoProbeVerifier PseudoProbeVerification; VerifyInstrumentation Verify; bool VerifyEach; diff --git a/llvm/include/llvm/ProfileData/ProfileCommon.h b/llvm/include/llvm/ProfileData/ProfileCommon.h index 55b94b2e690d..6bb5825339ae 100644 --- a/llvm/include/llvm/ProfileData/ProfileCommon.h +++ b/llvm/include/llvm/ProfileData/ProfileCommon.h @@ -17,7 +17,6 @@ #include "llvm/ADT/ArrayRef.h" #include "llvm/IR/ProfileSummary.h" #include "llvm/ProfileData/InstrProf.h" -#include "llvm/ProfileData/SampleProf.h" #include "llvm/Support/Error.h" #include #include @@ -90,8 +89,6 @@ public: void addRecord(const sampleprof::FunctionSamples &FS, bool isCallsiteSample = false); - std::unique_ptr computeSummaryForProfiles( - const StringMap &Profiles); std::unique_ptr getSummary(); }; diff --git a/llvm/include/llvm/ProfileData/SampleProf.h b/llvm/include/llvm/ProfileData/SampleProf.h index 25d5b2376c11..c45ace9e68c1 100644 --- a/llvm/include/llvm/ProfileData/SampleProf.h +++ b/llvm/include/llvm/ProfileData/SampleProf.h @@ -347,16 +347,6 @@ public: return SortedTargets; } - /// Prorate call targets by a distribution factor. - static const CallTargetMap adjustCallTargets(const CallTargetMap &Targets, - float DistributionFactor) { - CallTargetMap AdjustedTargets; - for (const auto &I : Targets) { - AdjustedTargets[I.first()] = I.second * DistributionFactor; - } - return AdjustedTargets; - } - /// Merge the samples in \p Other into this record. /// Optionally scale sample counts by \p Weight. sampleprof_error merge(const SampleRecord &Other, uint64_t Weight = 1) { @@ -449,11 +439,9 @@ public: void clearState(ContextStateMask S) { State &= (uint32_t)~S; } bool hasContext() const { return State != UnknownContext; } bool isBaseContext() const { return CallingContext.empty(); } - StringRef getNameWithoutContext() const { return Name; } + StringRef getName() const { return Name; } StringRef getCallingContext() const { return CallingContext; } - StringRef getNameWithContext(bool WithBracket = false) const { - return WithBracket ? InputContext : FullContext; - } + StringRef getNameWithContext() const { return FullContext; } private: // Give a context string, decode and populate internal states like @@ -461,7 +449,6 @@ private: // `ContextStr`: `[main:3 @ _Z5funcAi:1 @ _Z8funcLeafi]` void setContext(StringRef ContextStr, ContextStateMask CState) { assert(!ContextStr.empty()); - InputContext = ContextStr; // Note that `[]` wrapped input indicates a full context string, otherwise // it's treated as context-less function name only. bool HasContext = ContextStr.startswith("["); @@ -493,9 +480,6 @@ private: } } - // Input context string including bracketed calling context and leaf function - // name - StringRef InputContext; // Full context string including calling context and leaf function name StringRef FullContext; // Function name for the associated sample profile @@ -692,8 +676,7 @@ public: Name = Other.getName(); if (!GUIDToFuncNameMap) GUIDToFuncNameMap = Other.GUIDToFuncNameMap; - if (Context.getNameWithContext(true).empty()) - Context = Other.getContext(); + if (FunctionHash == 0) { // Set the function hash code for the target profile. FunctionHash = Other.getFunctionHash(); @@ -760,10 +743,8 @@ public: StringRef getName() const { return Name; } /// Return function name with context. - StringRef getNameWithContext(bool WithBracket = false) const { - return FunctionSamples::ProfileIsCS - ? Context.getNameWithContext(WithBracket) - : Name; + StringRef getNameWithContext() const { + return FunctionSamples::ProfileIsCS ? Context.getNameWithContext() : Name; } /// Return the original function name. diff --git a/llvm/include/llvm/ProfileData/SampleProfReader.h b/llvm/include/llvm/ProfileData/SampleProfReader.h index 999e75eddffa..3f52a2f6163b 100644 --- a/llvm/include/llvm/ProfileData/SampleProfReader.h +++ b/llvm/include/llvm/ProfileData/SampleProfReader.h @@ -488,12 +488,8 @@ protected: /// \brief Whether samples are collected based on pseudo probes. bool ProfileIsProbeBased = false; - /// Whether function profiles are context-sensitive. bool ProfileIsCS = false; - /// Number of context-sensitive profiles. - uint32_t CSProfileCount = 0; - /// \brief The format of sample. SampleProfileFormat Format = SPF_None; }; diff --git a/llvm/include/llvm/Support/CommandLine.h b/llvm/include/llvm/Support/CommandLine.h index 0706aa226c0e..38f3e188be55 100644 --- a/llvm/include/llvm/Support/CommandLine.h +++ b/llvm/include/llvm/Support/CommandLine.h @@ -369,22 +369,9 @@ public: virtual void setDefault() = 0; - // Prints the help string for an option. - // - // This maintains the Indent for multi-line descriptions. - // FirstLineIndentedBy is the count of chars of the first line - // i.e. the one containing the --