[clang] [clang-tools-extra] [lldb] [llvm] [mlir] Fix compatibility issues with GCC15+ in C++23 (PR #182522)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 20 08:11:24 PST 2026
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-amdgpu
@llvm/pr-subscribers-clang-tools-extra
Author: ppQwQqq (2876225417)
<details>
<summary>Changes</summary>
## Description
GCC 15's libstdc++ implementation has stricter conformance to the C++ standard regarding type completeness:
1. **`std::unique_ptr<T>` destruction** requires complete type `T` at the point of destructor instantiation
2. **`std::vector<T>` operations** require complete type `T` for pointer arithmetic
3. **`std::make_unique<T>()`** requires complete type `T` at the call site
4. **Default parameters with `unique_ptr<T>`** require complete type `T` in header files
These issues cause compilation failures when inline constructors/destructors or template instantiations encounter forward-declared types.
## Compatibility Issue Summary List
| Category | Index | File | Issue Type |
|------|------|------|---------|
| **LLVM Core** | [1](#issue1) | `llvm/include/llvm/ADT/STLExtras.h` | reverse_iterator requires default ctor |
| | [2](#issue2) | `llvm/include/llvm/IR/CFG.h` | reverse_iterator requires default ctor |
| | [3](#issue3) | `llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp` | Requires complete type |
| | [4](#issue4) | `llvm/lib/Target/BPF/BPFAsmPrinter.h` | unique_ptr requires complete type |
| | [5](#issue5) | `llvm/lib/Target/BPF/BPFAsmPrinter.cpp` | unique_ptr requires complete type |
| **Clang** | [6](#issue6) | `clang/lib/Interpreter/IncrementalParser.h` | Default params requires complete type |
| | [7](#issue7) | `clang/lib/Interpreter/IncrementalParser.cpp` | Default params requires complete type |
| | [8](#issue8) | `clang/tools/libclang/CIndexDiagnostic.h` | unique_ptr requires complete type |
| | [9](#issue9) | `clang/tools/libclang/CIndexDiagnostic.cpp` | unique_ptr requires complete type |
| **Clang Tools** | [10](#issue10) | `clang-tools-extra/clangd/GlobalCompilationDatabase.cpp` | make_unique requires complete type |
| **LLDB** | [11](#issue11) | `lldb/include/lldb/Core/EmulateInstruction.h` | unique_ptr requires complete type |
| | [12](#issue12) | `lldb/source/Core/EmulateInstruction.cpp` | unique_ptr requires complete type |
| | [13](#issue13) | `lldb/include/lldb/Interpreter/Interfaces/ScriptedBreakpointInterface.h` | Cannot convert nullopt to nullptr |
| | [14](#issue14) | `lldb/source/Plugins/ExpressionParser/Clang/ASTStructExtractor.h` | unique_ptr requires complete type |
| | [15](#issue15) | `lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h` | unique_ptr requires complete type |
| | [16](#issue16) | `lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.h` | unique_ptr requires complete type |
| | [17](#issue17) | `lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.cpp` | unique_ptr requires complete type |
| | [18](#issue18) | `lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.h` | unique_ptr requires complete type |
| | [19](#issue19) | `lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp` | unique_ptr requires complete type |
| **MLIR** | [20](#issue20) | `mlir/include/mlir/Query/Matcher/MatchersInternal.h` | vector/ArrayRef requires complete type |
| | [21](#issue21) | `mlir/lib/Query/Matcher/MatchFinder.cpp` | Explicit template instantiation |
## Build Configurations
```bash
-- The C compiler identification is Clang 23.0.0
-- The CXX compiler identification is Clang 23.0.0
-- The ASM compiler identification is Clang with GNU-like command-line
-- Found assembler: /run/media/ppqwqqq/22254a39-a5f0-4e28-93d1-96678a650d53/recover_hq1024/llvm/llvm-project-built/bin/clang
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /run/media/ppqwqqq/22254a39-a5f0-4e28-93d1-96678a650d53/recover_hq1024/llvm/llvm-project-built/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /run/media/ppqwqqq/22254a39-a5f0-4e28-93d1-96678a650d53/recover_hq1024/llvm/llvm-project-built/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- bolt project is disabled
-- clang project is enabled
-- clang-tools-extra project is enabled
-- cross-project-tests project is disabled
-- lld project is enabled
-- lldb project is enabled
-- mlir project is enabled
-- polly project is disabled
-- flang project is disabled
-- libc project is disabled
-- compiler-rt project is disabled
-- Doxygen disabled.
-- Found Python3: /home/ppqwqqq/.pyenv/shims/python3.12 (found suitable version "3.12.9", minimum required is "3.8") found components: Interpreter
-- Performing Test LLVM_LIBSTDCXX_MIN
-- Performing Test LLVM_LIBSTDCXX_MIN - Success
-- Performing Test LLVM_LIBSTDCXX_SOFT_ERROR
-- Performing Test LLVM_LIBSTDCXX_SOFT_ERROR - Success
-- Looking for __GLIBC__
-- Looking for __GLIBC__ - found
-- Looking for valgrind/valgrind.h
-- Looking for valgrind/valgrind.h - found
-- Looking for FE_ALL_EXCEPT
-- Looking for FE_ALL_EXCEPT - found
-- Looking for FE_INEXACT
-- Looking for FE_INEXACT - found
-- Performing Test HAVE_BUILTIN_THREAD_POINTER
-- Performing Test HAVE_BUILTIN_THREAD_POINTER - Success
-- Looking for CrashReporterClient.h
-- Looking for CrashReporterClient.h - not found
-- Looking for linux/magic.h
-- Looking for linux/magic.h - found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Looking for pthread_rwlock_init in pthread
-- Looking for pthread_rwlock_init in pthread - found
-- Looking for pthread_mutex_lock in pthread
-- Looking for pthread_mutex_lock in pthread - found
-- Looking for dlopen in dl
-- Looking for dlopen in dl - found
-- Looking for shm_open in rt
-- Looking for shm_open in rt - found
-- Looking for pfm_initialize in pfm
-- Looking for pfm_initialize in pfm - not found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Found ZLIB: /usr/lib/libz.so (found version "1.3.2")
-- Looking for compress2
-- Looking for compress2 - found
-- Found LibXml2: /usr/lib/libxml2.so (found version "2.15.1")
-- Looking for xmlReadMemory
-- Looking for xmlReadMemory - found
-- Looking for histedit.h
-- Looking for histedit.h - found
-- Found LibEdit: /usr/include (found version "2.11")
-- Looking for arc4random
-- Looking for arc4random - found
-- Looking for backtrace
-- Looking for backtrace - found
-- backtrace facility detected in default set of libraries
-- Found Backtrace: /usr/include
-- Performing Test C_SUPPORTS_WERROR_UNGUARDED_AVAILABILITY_NEW
-- Performing Test C_SUPPORTS_WERROR_UNGUARDED_AVAILABILITY_NEW - Success
-- Looking for __register_frame
-- Looking for __register_frame - found
-- Looking for __deregister_frame
-- Looking for __deregister_frame - found
-- Looking for __unw_add_dynamic_fde
-- Looking for __unw_add_dynamic_fde - not found
-- Looking for _Unwind_Backtrace
-- Looking for _Unwind_Backtrace - found
-- Looking for getpagesize
-- Looking for getpagesize - found
-- Looking for sysconf
-- Looking for sysconf - found
-- Looking for getrusage
-- Looking for getrusage - found
-- Looking for isatty
-- Looking for isatty - found
-- Looking for futimens
-- Looking for futimens - found
-- Looking for futimes
-- Looking for futimes - found
-- Looking for getauxval
-- Looking for getauxval - found
-- Looking for sigaltstack
-- Looking for sigaltstack - found
-- Looking for mallctl
-- Looking for mallctl - not found
-- Looking for mallinfo
-- Looking for mallinfo - found
-- Looking for mallinfo2
-- Looking for mallinfo2 - found
-- Looking for malloc_zone_statistics
-- Looking for malloc_zone_statistics - not found
-- Looking for posix_spawn
-- Looking for posix_spawn - found
-- Looking for pread
-- Looking for pread - found
-- Looking for sbrk
-- Looking for sbrk - found
-- Looking for strerror_r
-- Looking for strerror_r - found
-- Looking for strerror_s
-- Looking for strerror_s - not found
-- Looking for setenv
-- Looking for setenv - found
-- Performing Test HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC
-- Performing Test HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC - Failed
-- Performing Test HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC
-- Performing Test HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC - Success
-- Looking for pthread_getname_np
-- Looking for pthread_getname_np - found
-- Looking for pthread_setname_np
-- Looking for pthread_setname_np - found
-- Looking for pthread_get_name_np
-- Looking for pthread_get_name_np - not found
-- Looking for pthread_set_name_np
-- Looking for pthread_set_name_np - not found
-- Looking for dlopen
-- Looking for dlopen - found
-- Looking for proc_pid_rusage
-- Looking for proc_pid_rusage - not found
-- Performing Test HAVE_CXX_ATOMICS_WITHOUT_LIB
-- Performing Test HAVE_CXX_ATOMICS_WITHOUT_LIB - Success
-- Performing Test HAVE_CXX_ATOMICS64_WITHOUT_LIB
-- Performing Test HAVE_CXX_ATOMICS64_WITHOUT_LIB - Success
-- Performing Test LLVM_HAS_ATOMICS
-- Performing Test LLVM_HAS_ATOMICS - Success
-- LLVM host triple: x86_64-unknown-linux-gnu
-- Native target architecture is X86
-- Threads enabled.
-- Ninja version: 1.13.2
-- Could NOT find OCaml (missing: OCAMLFIND OCAML_VERSION OCAML_STDLIB_PATH)
-- Could NOT find OCaml (missing: OCAMLFIND OCAML_VERSION OCAML_STDLIB_PATH)
-- OCaml bindings disabled.
-- Found Python module pygments
-- Found Python module pygments.lexers.c_cpp
-- Found Python module yaml
-- LLVM default target triple: x86_64-unknown-linux-gnu
-- Performing Test LLVM_USES_LIBSTDCXX
-- Performing Test LLVM_USES_LIBSTDCXX - Success
-- Performing Test LLVM_DEFAULT_TO_GLIBCXX_USE_CXX11_ABI
-- Performing Test LLVM_DEFAULT_TO_GLIBCXX_USE_CXX11_ABI - Success
-- Performing Test CXX_SUPPORTS_CUSTOM_LINKER
-- Performing Test CXX_SUPPORTS_CUSTOM_LINKER - Success
-- Performing Test C_SUPPORTS_FPIC
-- Performing Test C_SUPPORTS_FPIC - Success
-- Performing Test CXX_SUPPORTS_FPIC
-- Performing Test CXX_SUPPORTS_FPIC - Success
-- Building with -fPIC
-- Performing Test C_SUPPORTS_FNO_SEMANTIC_INTERPOSITION
-- Performing Test C_SUPPORTS_FNO_SEMANTIC_INTERPOSITION - Success
-- Performing Test CXX_SUPPORTS_FNO_SEMANTIC_INTERPOSITION
-- Performing Test CXX_SUPPORTS_FNO_SEMANTIC_INTERPOSITION - Success
-- Performing Test SUPPORTS_FVISIBILITY_INLINES_HIDDEN_FLAG
-- Performing Test SUPPORTS_FVISIBILITY_INLINES_HIDDEN_FLAG - Success
-- Performing Test C_SUPPORTS_CXX98_COMPAT_EXTRA_SEMI_FLAG
-- Performing Test C_SUPPORTS_CXX98_COMPAT_EXTRA_SEMI_FLAG - Success
-- Performing Test CXX_SUPPORTS_CXX98_COMPAT_EXTRA_SEMI_FLAG
-- Performing Test CXX_SUPPORTS_CXX98_COMPAT_EXTRA_SEMI_FLAG - Success
-- Performing Test CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG
-- Performing Test CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG - Success
-- Performing Test CXX_WSUGGEST_OVERRIDE_ALLOWS_ONLY_FINAL
-- Performing Test CXX_WSUGGEST_OVERRIDE_ALLOWS_ONLY_FINAL - Success
-- Performing Test C_WCOMMENT_ALLOWS_LINE_WRAP
-- Performing Test C_WCOMMENT_ALLOWS_LINE_WRAP - Success
-- Performing Test C_SUPPORTS_MISLEADING_INDENTATION_FLAG
-- Performing Test C_SUPPORTS_MISLEADING_INDENTATION_FLAG - Success
-- Performing Test CXX_SUPPORTS_MISLEADING_INDENTATION_FLAG
-- Performing Test CXX_SUPPORTS_MISLEADING_INDENTATION_FLAG - Success
-- Performing Test C_SUPPORTS_CTAD_MAYBE_UNSPPORTED_FLAG
-- Performing Test C_SUPPORTS_CTAD_MAYBE_UNSPPORTED_FLAG - Success
-- Performing Test CXX_SUPPORTS_CTAD_MAYBE_UNSPPORTED_FLAG
-- Performing Test CXX_SUPPORTS_CTAD_MAYBE_UNSPPORTED_FLAG - Success
-- Performing Test LINKER_SUPPORTS_COLOR_DIAGNOSTICS
-- Performing Test LINKER_SUPPORTS_COLOR_DIAGNOSTICS - Success
-- Looking for os_signpost_interval_begin
-- Looking for os_signpost_interval_begin - not found
-- Looking for flock
-- Looking for flock - found
-- Linker detection: LLD
-- Performing Test LLVM_LINKER_SUPPORTS_B_SYMBOLIC_FUNCTIONS
-- Performing Test LLVM_LINKER_SUPPORTS_B_SYMBOLIC_FUNCTIONS - Success
-- Performing Test HAS_WERROR_GLOBAL_CTORS
-- Performing Test HAS_WERROR_GLOBAL_CTORS - Success
-- Performing Test LLVM_HAS_NOGLOBAL_CTOR_MUTEX
-- Performing Test LLVM_HAS_NOGLOBAL_CTOR_MUTEX - Success
-- Looking for __x86_64__
-- Looking for __x86_64__ - found
-- Found Git: /usr/bin/git (found version "2.53.0")
-- Looking for logf128
-- Looking for logf128 - found
-- Targeting AArch64
-- Targeting AMDGPU
-- Targeting ARM
-- Targeting AVR
-- Targeting BPF
-- Targeting Hexagon
-- Targeting Lanai
-- Targeting LoongArch
-- Targeting Mips
-- Targeting MSP430
-- Targeting NVPTX
-- Targeting PowerPC
-- Targeting RISCV
-- Targeting Sparc
-- Targeting SPIRV
-- Targeting SystemZ
-- Targeting VE
-- Targeting WebAssembly
-- Targeting X86
-- Targeting XCore
-- LLD version: 23.0.0
-- Performing Test C_SUPPORTS_WERROR_IMPLICIT_FUNCTION_DECLARATION
-- Performing Test C_SUPPORTS_WERROR_IMPLICIT_FUNCTION_DECLARATION - Success
-- Performing Test C_SUPPORTS_WUNDEF
-- Performing Test C_SUPPORTS_WUNDEF - Success
-- Performing Test C_SUPPORTS_WERROR_MISMATCHED_TAGS
-- Performing Test C_SUPPORTS_WERROR_MISMATCHED_TAGS - Success
-- Performing Test C_SUPPORTS_WERROR_GLOBAL_CONSTRUCTOR
-- Performing Test C_SUPPORTS_WERROR_GLOBAL_CONSTRUCTOR - Success
-- Performing Test CXX_SUPPORTS_WERROR_GLOBAL_CONSTRUCTOR
-- Performing Test CXX_SUPPORTS_WERROR_GLOBAL_CONSTRUCTOR - Success
-- Found CUDAToolkit: /opt/cuda/targets/x86_64-linux/include;/opt/cuda/targets/x86_64-linux/include/cccl (found version "13.1.115")
-- Performing Test COMPILER_SUPPORTS_WARNING_WEAK_VTABLES
-- Performing Test COMPILER_SUPPORTS_WARNING_WEAK_VTABLES - Success
-- Looking for sys/resource.h
-- Looking for sys/resource.h - found
-- Looking for dlfcn.h
-- Looking for dlfcn.h - found
-- Looking for dladdr
-- Looking for dladdr - found
-- Clang version: 23.0.0git
-- Looking for include file sys/inotify.h
-- Looking for include file sys/inotify.h - found
-- Performing Test HAVE_LINKER_FLAG_LONG_PLT
-- Performing Test HAVE_LINKER_FLAG_LONG_PLT - Success
-- Found Perl: /usr/bin/perl (found version "5.42.0")
-- Found Python3: /home/ppqwqqq/.pyenv/shims/python3.12 (found version "3.12.9") found components: Interpreter
-- Could NOT find SWIG (missing: SWIG_EXECUTABLE SWIG_DIR) (Required is at least version "4")
-- Enable SWIG to generate LLDB bindings: FALSE
-- Enable editline support in LLDB: TRUE
-- Looking for acs_map
-- Looking for acs_map - found
-- Found CursesAndPanel: /usr/include
-- Enable curses support in LLDB: TRUE
-- Looking for lzma_auto_decoder in /usr/lib/liblzma.so
-- Looking for lzma_auto_decoder in /usr/lib/liblzma.so - found
-- Looking for lzma_easy_encoder in /usr/lib/liblzma.so
-- Looking for lzma_easy_encoder in /usr/lib/liblzma.so - found
-- Looking for lzma_lzma_preset in /usr/lib/liblzma.so
-- Looking for lzma_lzma_preset in /usr/lib/liblzma.so - found
-- Found LibLZMA: /usr/lib/liblzma.so (found version "5.8.2")
-- Enable LZMA compression support in LLDB: TRUE
-- SWIG 4 or later is required for Lua support in LLDB but could not be found
-- Could NOT find LuaAndSwig (missing: LUA_EXECUTABLE LUA_LIBRARIES LUA_INCLUDE_DIR LUA_VERSION_MINOR LUA_VERSION_MAJOR LLDB_ENABLE_SWIG)
-- Enable Lua scripting support in LLDB: FALSE
-- SWIG 4 or later is required for Python support in LLDB but could not be found
-- Could NOT find PythonAndSwig (missing: Python3_LIBRARIES Python3_INCLUDE_DIRS LLDB_ENABLE_SWIG)
-- Enable Python scripting support in LLDB: FALSE
-- Found LibXml2: /usr/lib/libxml2.so (found suitable version "2.15.1", minimum required is "2.8")
-- Enable Libxml 2 support in LLDB: TRUE
-- Could NOT find TreeSitter (missing: TreeSitter_BINARY)
-- Enable Tree-sitter syntax highlighting: FALSE
-- Looking for el_winsertstr
-- Looking for el_winsertstr - found
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of el_rfunc_t
-- Check size of el_rfunc_t - done
-- Performing Test CXX_SUPPORTS_STRINGOP_TRUNCATION
-- Performing Test CXX_SUPPORTS_STRINGOP_TRUNCATION - Failed
-- LLDB version: 23.0.0git
-- Looking for ppoll
-- Looking for ppoll - found
-- Looking for ptsname_r
-- Looking for ptsname_r - found
-- Looking for accept4
-- Looking for accept4 - found
-- Looking for termios.h
-- Looking for termios.h - found
-- Looking for include files sys/types.h, sys/event.h
-- Looking for include files sys/types.h, sys/event.h - not found
-- Looking for process_vm_readv
-- Looking for process_vm_readv - found
-- Looking for __NR_process_vm_readv
-- Looking for __NR_process_vm_readv - found
-- Looking for compression_encode_buffer in compression
-- Looking for compression_encode_buffer in compression - not found
-- Symbols (liblldb): exporting all symbols from the lldb namespace
-- Found Doxygen: /usr/bin/doxygen (found version "1.16.1") found components: doxygen dot
-- Found make: /usr/bin/make
-- Found dirname: /usr/bin/dirname
-- Performing Test CXX_SUPPORTS_DOCUMENTATION
-- Performing Test CXX_SUPPORTS_DOCUMENTATION - Success
-- Performing Test CXX_SUPPORTS_NO_DOCUMENTATION_DEPRECATED_SYNC
-- Performing Test CXX_SUPPORTS_NO_DOCUMENTATION_DEPRECATED_SYNC - Success
-- Looking for gettid
-- Looking for gettid - found
-- Registering ExampleIRTransforms as a pass plugin (static build: OFF)
-- Registering Bye as a pass plugin (static build: OFF)
-- LLVM FileCheck Found: /usr/bin/FileCheck
-- Google Benchmark version: v0.0.0, normalized to 0.0.0
-- Looking for shm_open in rt
-- Looking for shm_open in rt - found
-- Performing Test HAVE_CXX_FLAG_WALL
-- Performing Test HAVE_CXX_FLAG_WALL - Success
-- Performing Test HAVE_CXX_FLAG_WEXTRA
-- Performing Test HAVE_CXX_FLAG_WEXTRA - Success
-- Performing Test HAVE_CXX_FLAG_WSHADOW
-- Performing Test HAVE_CXX_FLAG_WSHADOW - Success
-- Performing Test HAVE_CXX_FLAG_WFLOAT_EQUAL
-- Performing Test HAVE_CXX_FLAG_WFLOAT_EQUAL - Success
-- Performing Test HAVE_CXX_FLAG_WOLD_STYLE_CAST
-- Performing Test HAVE_CXX_FLAG_WOLD_STYLE_CAST - Success
-- Performing Test HAVE_CXX_FLAG_WSUGGEST_OVERRIDE
-- Performing Test HAVE_CXX_FLAG_WSUGGEST_OVERRIDE - Success
-- Performing Test HAVE_CXX_FLAG_PEDANTIC
-- Performing Test HAVE_CXX_FLAG_PEDANTIC - Success
-- Performing Test HAVE_CXX_FLAG_PEDANTIC_ERRORS
-- Performing Test HAVE_CXX_FLAG_PEDANTIC_ERRORS - Success
-- Performing Test HAVE_CXX_FLAG_WSHORTEN_64_TO_32
-- Performing Test HAVE_CXX_FLAG_WSHORTEN_64_TO_32 - Success
-- Performing Test HAVE_CXX_FLAG_FSTRICT_ALIASING
-- Performing Test HAVE_CXX_FLAG_FSTRICT_ALIASING - Success
-- Performing Test HAVE_CXX_FLAG_WNO_DEPRECATED_DECLARATIONS
-- Performing Test HAVE_CXX_FLAG_WNO_DEPRECATED_DECLARATIONS - Success
-- Performing Test HAVE_CXX_FLAG_FNO_EXCEPTIONS
-- Performing Test HAVE_CXX_FLAG_FNO_EXCEPTIONS - Success
-- Performing Test HAVE_CXX_FLAG_WSTRICT_ALIASING
-- Performing Test HAVE_CXX_FLAG_WSTRICT_ALIASING - Success
-- Performing Test HAVE_CXX_FLAG_WD654
-- Performing Test HAVE_CXX_FLAG_WD654 - Failed
-- Performing Test HAVE_CXX_FLAG_WTHREAD_SAFETY
-- Performing Test HAVE_CXX_FLAG_WTHREAD_SAFETY - Success
-- Enabling additional flags: -DINCLUDE_DIRECTORIES=/run/media/ppqwqqq/22254a39-a5f0-4e28-93d1-96678a650d53/recover_hq1024/llvm/llvm-project/third-party/benchmark/include
-- Compiling and running to test HAVE_THREAD_SAFETY_ATTRIBUTES
-- Performing Test HAVE_THREAD_SAFETY_ATTRIBUTES -- success
-- Performing Test HAVE_CXX_FLAG_COVERAGE
-- Performing Test HAVE_CXX_FLAG_COVERAGE - Failed
-- Compiling and running to test HAVE_GNU_POSIX_REGEX
-- Performing Test HAVE_GNU_POSIX_REGEX -- failed to compile
-- Compiling and running to test HAVE_POSIX_REGEX
-- Performing Test HAVE_POSIX_REGEX -- success
-- Compiling and running to test HAVE_STEADY_CLOCK
-- Performing Test HAVE_STEADY_CLOCK -- success
-- Compiling and running to test HAVE_PTHREAD_AFFINITY
-- Performing Test HAVE_PTHREAD_AFFINITY -- success
-- Configuring done (31.1s)
-- Generating done (9.3s)
```
### Extra
```bash
GLIBCXX_3.4.32
GLIBCXX_3.4.33
GLIBCXX_3.4.34
GLIBCXX_DEBUG_MESSAGE_LENGTH
GLIBCXX_TUNABLES
```
---
Patch is 81.70 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/182522.diff
21 Files Affected:
- (modified) clang-tools-extra/clangd/GlobalCompilationDatabase.cpp (+88-88)
- (modified) clang/lib/Interpreter/IncrementalParser.cpp (+7-1)
- (modified) clang/lib/Interpreter/IncrementalParser.h (+2-1)
- (modified) clang/tools/libclang/CIndexDiagnostic.cpp (+64-52)
- (modified) clang/tools/libclang/CIndexDiagnostic.h (+27-31)
- (modified) lldb/include/lldb/Core/EmulateInstruction.h (+6-7)
- (modified) lldb/include/lldb/Interpreter/Interfaces/ScriptedBreakpointInterface.h (+1-1)
- (modified) lldb/source/Core/EmulateInstruction.cpp (+7)
- (modified) lldb/source/Plugins/ExpressionParser/Clang/ASTStructExtractor.h (+5-5)
- (modified) lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h (+16-17)
- (modified) lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.cpp (+7)
- (modified) lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.h (+8-4)
- (modified) lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp (+16-1)
- (modified) lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.h (+5-4)
- (modified) llvm/include/llvm/ADT/STLExtras.h (+42-47)
- (modified) llvm/include/llvm/IR/CFG.h (+27-23)
- (modified) llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp (+330-241)
- (modified) llvm/lib/Target/BPF/BPFAsmPrinter.cpp (+14-4)
- (modified) llvm/lib/Target/BPF/BPFAsmPrinter.h (+2-2)
- (modified) mlir/include/mlir/Query/Matcher/MatchersInternal.h (+6-10)
- (modified) mlir/lib/Query/Matcher/MatchFinder.cpp (+24)
``````````diff
diff --git a/clang-tools-extra/clangd/GlobalCompilationDatabase.cpp b/clang-tools-extra/clangd/GlobalCompilationDatabase.cpp
index a1d9135111ca8..7dca3cd3e58f1 100644
--- a/clang-tools-extra/clangd/GlobalCompilationDatabase.cpp
+++ b/clang-tools-extra/clangd/GlobalCompilationDatabase.cpp
@@ -349,6 +349,94 @@ bool DirectoryBasedGlobalCompilationDatabase::DirectoryCache::load(
return true;
}
+// The broadcast thread announces files with new compile commands to the world.
+// Primarily this is used to enqueue them for background indexing.
+//
+// It's on a separate thread because:
+// - otherwise it would block the first parse of the initial file
+// - we need to enumerate all files in the CDB, of which there are many
+// - we (will) have to evaluate config for every file in the CDB, which is slow
+class DirectoryBasedGlobalCompilationDatabase::BroadcastThread {
+ class Filter;
+ DirectoryBasedGlobalCompilationDatabase &Parent;
+
+ std::mutex Mu;
+ std::condition_variable CV;
+ // Shutdown flag (CV is notified after writing).
+ // This is atomic so that broadcasts can also observe it and abort early.
+ std::atomic<bool> ShouldStop = {false};
+ struct Task {
+ CDBLookupResult Lookup;
+ Context Ctx;
+ };
+ std::deque<Task> Queue;
+ std::optional<Task> ActiveTask;
+ std::thread Thread; // Must be last member.
+
+ // Thread body: this is just the basic queue procesing boilerplate.
+ void run() {
+ std::unique_lock<std::mutex> Lock(Mu);
+ while (true) {
+ bool Stopping = false;
+ CV.wait(Lock, [&] {
+ return (Stopping = ShouldStop.load(std::memory_order_acquire)) ||
+ !Queue.empty();
+ });
+ if (Stopping) {
+ Queue.clear();
+ CV.notify_all();
+ return;
+ }
+ ActiveTask = std::move(Queue.front());
+ Queue.pop_front();
+
+ Lock.unlock();
+ {
+ WithContext WithCtx(std::move(ActiveTask->Ctx));
+ process(ActiveTask->Lookup);
+ }
+ Lock.lock();
+ ActiveTask.reset();
+ CV.notify_all();
+ }
+ }
+
+ // Inspects a new CDB and broadcasts the files it owns.
+ void process(const CDBLookupResult &T);
+
+public:
+ BroadcastThread(DirectoryBasedGlobalCompilationDatabase &Parent)
+ : Parent(Parent), Thread([this] { run(); }) {}
+
+ void enqueue(CDBLookupResult Lookup) {
+ {
+ assert(!Lookup.PI.SourceRoot.empty());
+ std::lock_guard<std::mutex> Lock(Mu);
+ // New CDB takes precedence over any queued one for the same directory.
+ llvm::erase_if(Queue, [&](const Task &T) {
+ return T.Lookup.PI.SourceRoot == Lookup.PI.SourceRoot;
+ });
+ Queue.push_back({std::move(Lookup), Context::current().clone()});
+ }
+ CV.notify_all();
+ }
+
+ bool blockUntilIdle(Deadline Timeout) {
+ std::unique_lock<std::mutex> Lock(Mu);
+ return wait(Lock, CV, Timeout,
+ [&] { return Queue.empty() && !ActiveTask; });
+ }
+
+ ~BroadcastThread() {
+ {
+ std::lock_guard<std::mutex> Lock(Mu);
+ ShouldStop.store(true, std::memory_order_release);
+ }
+ CV.notify_all();
+ Thread.join();
+ }
+};
+
DirectoryBasedGlobalCompilationDatabase::
DirectoryBasedGlobalCompilationDatabase(const Options &Opts)
: GlobalCompilationDatabase(Opts.FallbackWorkingDirectory), Opts(Opts),
@@ -478,94 +566,6 @@ void DirectoryBasedGlobalCompilationDatabase::Options::
}
}
-// The broadcast thread announces files with new compile commands to the world.
-// Primarily this is used to enqueue them for background indexing.
-//
-// It's on a separate thread because:
-// - otherwise it would block the first parse of the initial file
-// - we need to enumerate all files in the CDB, of which there are many
-// - we (will) have to evaluate config for every file in the CDB, which is slow
-class DirectoryBasedGlobalCompilationDatabase::BroadcastThread {
- class Filter;
- DirectoryBasedGlobalCompilationDatabase &Parent;
-
- std::mutex Mu;
- std::condition_variable CV;
- // Shutdown flag (CV is notified after writing).
- // This is atomic so that broadcasts can also observe it and abort early.
- std::atomic<bool> ShouldStop = {false};
- struct Task {
- CDBLookupResult Lookup;
- Context Ctx;
- };
- std::deque<Task> Queue;
- std::optional<Task> ActiveTask;
- std::thread Thread; // Must be last member.
-
- // Thread body: this is just the basic queue procesing boilerplate.
- void run() {
- std::unique_lock<std::mutex> Lock(Mu);
- while (true) {
- bool Stopping = false;
- CV.wait(Lock, [&] {
- return (Stopping = ShouldStop.load(std::memory_order_acquire)) ||
- !Queue.empty();
- });
- if (Stopping) {
- Queue.clear();
- CV.notify_all();
- return;
- }
- ActiveTask = std::move(Queue.front());
- Queue.pop_front();
-
- Lock.unlock();
- {
- WithContext WithCtx(std::move(ActiveTask->Ctx));
- process(ActiveTask->Lookup);
- }
- Lock.lock();
- ActiveTask.reset();
- CV.notify_all();
- }
- }
-
- // Inspects a new CDB and broadcasts the files it owns.
- void process(const CDBLookupResult &T);
-
-public:
- BroadcastThread(DirectoryBasedGlobalCompilationDatabase &Parent)
- : Parent(Parent), Thread([this] { run(); }) {}
-
- void enqueue(CDBLookupResult Lookup) {
- {
- assert(!Lookup.PI.SourceRoot.empty());
- std::lock_guard<std::mutex> Lock(Mu);
- // New CDB takes precedence over any queued one for the same directory.
- llvm::erase_if(Queue, [&](const Task &T) {
- return T.Lookup.PI.SourceRoot == Lookup.PI.SourceRoot;
- });
- Queue.push_back({std::move(Lookup), Context::current().clone()});
- }
- CV.notify_all();
- }
-
- bool blockUntilIdle(Deadline Timeout) {
- std::unique_lock<std::mutex> Lock(Mu);
- return wait(Lock, CV, Timeout,
- [&] { return Queue.empty() && !ActiveTask; });
- }
-
- ~BroadcastThread() {
- {
- std::lock_guard<std::mutex> Lock(Mu);
- ShouldStop.store(true, std::memory_order_release);
- }
- CV.notify_all();
- Thread.join();
- }
-};
-
// The DirBasedCDB associates each file with a specific CDB.
// When a CDB is discovered, it may claim to describe files that we associate
// with a different CDB. We do not want to broadcast discovery of these, and
diff --git a/clang/lib/Interpreter/IncrementalParser.cpp b/clang/lib/Interpreter/IncrementalParser.cpp
index bf08911e23533..3a8a094f85504 100644
--- a/clang/lib/Interpreter/IncrementalParser.cpp
+++ b/clang/lib/Interpreter/IncrementalParser.cpp
@@ -196,7 +196,7 @@ void IncrementalParser::CleanUpPTU(TranslationUnitDecl *MostRecentTU) {
PartialTranslationUnit &
IncrementalParser::RegisterPTU(TranslationUnitDecl *TU,
- std::unique_ptr<llvm::Module> M /*={}*/) {
+ std::unique_ptr<llvm::Module> M) {
PTUs.emplace_back(PartialTranslationUnit());
PartialTranslationUnit &LastPTU = PTUs.back();
LastPTU.TUPart = TU;
@@ -215,4 +215,10 @@ IncrementalParser::RegisterPTU(TranslationUnitDecl *TU,
LLVM_DEBUG(llvm::dbgs() << "]\n");
return LastPTU;
}
+
+PartialTranslationUnit &
+IncrementalParser::RegisterPTU(TranslationUnitDecl *TU) {
+ return RegisterPTU(TU, nullptr);
+}
+
} // end namespace clang
diff --git a/clang/lib/Interpreter/IncrementalParser.h b/clang/lib/Interpreter/IncrementalParser.h
index 9b042bc494efb..7be2a445c2cbd 100644
--- a/clang/lib/Interpreter/IncrementalParser.h
+++ b/clang/lib/Interpreter/IncrementalParser.h
@@ -68,7 +68,8 @@ class IncrementalParser {
/// Register a PTU produced by Parse.
PartialTranslationUnit &RegisterPTU(TranslationUnitDecl *TU,
- std::unique_ptr<llvm::Module> M = {});
+ std::unique_ptr<llvm::Module> M);
+ PartialTranslationUnit &RegisterPTU(TranslationUnitDecl *TU);
private:
llvm::Expected<TranslationUnitDecl *> ParseOrWrapTopLevelDecl();
diff --git a/clang/tools/libclang/CIndexDiagnostic.cpp b/clang/tools/libclang/CIndexDiagnostic.cpp
index d37597e747a84..7be91786c8a65 100644
--- a/clang/tools/libclang/CIndexDiagnostic.cpp
+++ b/clang/tools/libclang/CIndexDiagnostic.cpp
@@ -12,9 +12,9 @@
#include "CIndexDiagnostic.h"
#include "CIndexer.h"
-#include "CXTranslationUnit.h"
#include "CXSourceLocation.h"
#include "CXString.h"
+#include "CXTranslationUnit.h"
#include "clang/Basic/DiagnosticOptions.h"
#include "clang/Frontend/ASTUnit.h"
@@ -27,10 +27,13 @@ using namespace clang::cxloc;
using namespace clang::cxdiag;
using namespace llvm;
+CXDiagnosticSetImpl::CXDiagnosticSetImpl(bool isManaged)
+ : IsExternallyManaged(isManaged) {}
+
CXDiagnosticSetImpl::~CXDiagnosticSetImpl() {}
-void
-CXDiagnosticSetImpl::appendDiagnostic(std::unique_ptr<CXDiagnosticImpl> D) {
+void CXDiagnosticSetImpl::appendDiagnostic(
+ std::unique_ptr<CXDiagnosticImpl> D) {
Diagnostics.push_back(std::move(D));
}
@@ -40,6 +43,7 @@ namespace {
class CXDiagnosticCustomNoteImpl : public CXDiagnosticImpl {
std::string Message;
CXSourceLocation Loc;
+
public:
CXDiagnosticCustomNoteImpl(StringRef Msg, CXSourceLocation L)
: CXDiagnosticImpl(CustomNoteDiagnosticKind), Message(std::string(Msg)),
@@ -77,8 +81,8 @@ class CXDiagnosticCustomNoteImpl : public CXDiagnosticImpl {
*ReplacementRange = clang_getNullRange();
return cxstring::createEmpty();
}
-};
-
+};
+
class CXDiagnosticRenderer : public DiagnosticNoteRenderer {
public:
CXDiagnosticRenderer(const LangOptions &LangOpts, DiagnosticOptions &DiagOpts,
@@ -95,7 +99,7 @@ class CXDiagnosticRenderer : public DiagnosticNoteRenderer {
dyn_cast_if_present<const StoredDiagnostic *>(D);
if (!SD)
return;
-
+
if (Level != DiagnosticsEngine::Note)
CurrentSet = MainSet;
@@ -113,7 +117,7 @@ class CXDiagnosticRenderer : public DiagnosticNoteRenderer {
DiagOrStoredDiag D) override {
if (!D.isNull())
return;
-
+
CXSourceLocation L;
if (Loc.hasManager())
L = translateSourceLocation(Loc.getManager(), LangOpts, Loc);
@@ -143,8 +147,8 @@ class CXDiagnosticRenderer : public DiagnosticNoteRenderer {
CXDiagnosticSetImpl *CurrentSet;
CXDiagnosticSetImpl *MainSet;
-};
-}
+};
+} // namespace
CXDiagnosticSetImpl *cxdiag::lazyCreateDiags(CXTranslationUnit TU,
bool checkIfChanged) {
@@ -168,8 +172,8 @@ CXDiagnosticSetImpl *cxdiag::lazyCreateDiags(CXTranslationUnit TU,
// We check here if a new diagnostic was appended since the last time the
// diagnostic set was created, in which case we reset it.
- CXDiagnosticSetImpl *
- Set = static_cast<CXDiagnosticSetImpl*>(TU->Diagnostics);
+ CXDiagnosticSetImpl *Set =
+ static_cast<CXDiagnosticSetImpl *>(TU->Diagnostics);
if (AU->stored_diag_size() != Set->getNumDiagnostics()) {
// Diagnostics in the ASTUnit were updated, reset the associated
// diagnostics.
@@ -186,11 +190,12 @@ CXDiagnosticSetImpl *cxdiag::lazyCreateDiags(CXTranslationUnit TU,
Set);
for (ASTUnit::stored_diag_iterator it = AU->stored_diag_begin(),
- ei = AU->stored_diag_end(); it != ei; ++it) {
+ ei = AU->stored_diag_end();
+ it != ei; ++it) {
Renderer.emitStoredDiagnostic(*it);
}
}
- return static_cast<CXDiagnosticSetImpl*>(TU->Diagnostics);
+ return static_cast<CXDiagnosticSetImpl *>(TU->Diagnostics);
}
//-----------------------------------------------------------------------------
@@ -216,7 +221,7 @@ CXDiagnostic clang_getDiagnostic(CXTranslationUnit Unit, unsigned Index) {
if (!D)
return nullptr;
- CXDiagnosticSetImpl *Diags = static_cast<CXDiagnosticSetImpl*>(D);
+ CXDiagnosticSetImpl *Diags = static_cast<CXDiagnosticSetImpl *>(D);
if (Index >= Diags->getNumDiagnostics())
return nullptr;
@@ -246,14 +251,14 @@ CXString clang_formatDiagnostic(CXDiagnostic Diagnostic, unsigned Options) {
SmallString<256> Str;
llvm::raw_svector_ostream Out(Str);
-
+
if (Options & CXDiagnostic_DisplaySourceLocation) {
// Print source location (file:line), along with optional column
// and source ranges.
CXFile File;
unsigned Line, Column;
- clang_getSpellingLocation(clang_getDiagnosticLocation(Diagnostic),
- &File, &Line, &Column, nullptr);
+ clang_getSpellingLocation(clang_getDiagnosticLocation(Diagnostic), &File,
+ &Line, &Column, nullptr);
if (File) {
CXString FName = clang_getFileName(File);
Out << clang_getCString(FName) << ":" << Line << ":";
@@ -267,36 +272,44 @@ CXString clang_formatDiagnostic(CXDiagnostic Diagnostic, unsigned Options) {
for (unsigned I = 0; I != N; ++I) {
CXFile StartFile, EndFile;
CXSourceRange Range = clang_getDiagnosticRange(Diagnostic, I);
-
+
unsigned StartLine, StartColumn, EndLine, EndColumn;
- clang_getSpellingLocation(clang_getRangeStart(Range),
- &StartFile, &StartLine, &StartColumn,
- nullptr);
- clang_getSpellingLocation(clang_getRangeEnd(Range),
- &EndFile, &EndLine, &EndColumn, nullptr);
+ clang_getSpellingLocation(clang_getRangeStart(Range), &StartFile,
+ &StartLine, &StartColumn, nullptr);
+ clang_getSpellingLocation(clang_getRangeEnd(Range), &EndFile,
+ &EndLine, &EndColumn, nullptr);
if (StartFile != EndFile || StartFile != File)
continue;
-
- Out << "{" << StartLine << ":" << StartColumn << "-"
- << EndLine << ":" << EndColumn << "}";
+
+ Out << "{" << StartLine << ":" << StartColumn << "-" << EndLine << ":"
+ << EndColumn << "}";
PrintedRange = true;
}
if (PrintedRange)
Out << ":";
}
-
+
Out << " ";
}
}
/* Print warning/error/etc. */
switch (Severity) {
- case CXDiagnostic_Ignored: llvm_unreachable("impossible");
- case CXDiagnostic_Note: Out << "note: "; break;
- case CXDiagnostic_Warning: Out << "warning: "; break;
- case CXDiagnostic_Error: Out << "error: "; break;
- case CXDiagnostic_Fatal: Out << "fatal error: "; break;
+ case CXDiagnostic_Ignored:
+ llvm_unreachable("impossible");
+ case CXDiagnostic_Note:
+ Out << "note: ";
+ break;
+ case CXDiagnostic_Warning:
+ Out << "warning: ";
+ break;
+ case CXDiagnostic_Error:
+ Out << "error: ";
+ break;
+ case CXDiagnostic_Fatal:
+ Out << "fatal error: ";
+ break;
}
CXString Text = clang_getDiagnosticSpelling(Diagnostic);
@@ -305,7 +318,7 @@ CXString clang_formatDiagnostic(CXDiagnostic Diagnostic, unsigned Options) {
else
Out << "<no diagnostic text>";
clang_disposeString(Text);
-
+
if (Options & (CXDiagnostic_DisplayOption | CXDiagnostic_DisplayCategoryId |
CXDiagnostic_DisplayCategoryName)) {
bool NeedBracket = true;
@@ -322,9 +335,9 @@ CXString clang_formatDiagnostic(CXDiagnostic Diagnostic, unsigned Options) {
}
clang_disposeString(OptionName);
}
-
- if (Options & (CXDiagnostic_DisplayCategoryId |
- CXDiagnostic_DisplayCategoryName)) {
+
+ if (Options &
+ (CXDiagnostic_DisplayCategoryId | CXDiagnostic_DisplayCategoryName)) {
if (unsigned CategoryID = clang_getDiagnosticCategory(Diagnostic)) {
if (Options & CXDiagnostic_DisplayCategoryId) {
if (NeedBracket)
@@ -335,7 +348,7 @@ CXString clang_formatDiagnostic(CXDiagnostic Diagnostic, unsigned Options) {
NeedBracket = false;
NeedComma = true;
}
-
+
if (Options & CXDiagnostic_DisplayCategoryName) {
CXString CategoryName = clang_getDiagnosticCategoryText(Diagnostic);
if (NeedBracket)
@@ -350,11 +363,11 @@ CXString clang_formatDiagnostic(CXDiagnostic Diagnostic, unsigned Options) {
}
}
- (void) NeedComma; // Silence dead store warning.
+ (void)NeedComma; // Silence dead store warning.
if (!NeedBracket)
Out << "]";
}
-
+
return cxstring::createDup(Out.str());
}
@@ -364,13 +377,13 @@ unsigned clang_defaultDiagnosticDisplayOptions() {
}
enum CXDiagnosticSeverity clang_getDiagnosticSeverity(CXDiagnostic Diag) {
- if (CXDiagnosticImpl *D = static_cast<CXDiagnosticImpl*>(Diag))
+ if (CXDiagnosticImpl *D = static_cast<CXDiagnosticImpl *>(Diag))
return D->getSeverity();
return CXDiagnostic_Ignored;
}
CXSourceLocation clang_getDiagnosticLocation(CXDiagnostic Diag) {
- if (CXDiagnosticImpl *D = static_cast<CXDiagnosticImpl*>(Diag))
+ if (CXDiagnosticImpl *D = static_cast<CXDiagnosticImpl *>(Diag))
return D->getLocation();
return clang_getNullLocation();
}
@@ -396,18 +409,18 @@ unsigned clang_getDiagnosticCategory(CXDiagnostic Diag) {
return D->getCategory();
return 0;
}
-
+
CXString clang_getDiagnosticCategoryName(unsigned Category) {
// Kept for backward compatibility.
return cxstring::createRef(DiagnosticIDs::getCategoryNameFromID(Category));
}
-
+
CXString clang_getDiagnosticCategoryText(CXDiagnostic Diag) {
if (CXDiagnosticImpl *D = static_cast<CXDiagnosticImpl *>(Diag))
return D->getCategoryText();
return cxstring::createEmpty();
}
-
+
unsigned clang_getDiagnosticNumRanges(CXDiagnostic Diag) {
if (CXDiagnosticImpl *D = static_cast<CXDiagnosticImpl *>(Diag))
return D->getNumRanges();
@@ -415,7 +428,7 @@ unsigned clang_getDiagnosticNumRanges(CXDiagnostic Diag) {
}
CXSourceRange clang_getDiagnosticRange(CXDiagnostic Diag, unsigned Range) {
- CXDiagnosticImpl *D = static_cast<CXDiagnosticImpl *>(Diag);
+ CXDiagnosticImpl *D = static_cast<CXDiagnosticImpl *>(Diag);
if (!D || Range >= D->getNumRanges())
return clang_getNullRange();
return D->getRange(Range);
@@ -444,25 +457,24 @@ void clang_disposeDiagnosticSet(CXDiagnosticSet Diags) {
delete D;
}
}
-
-CXDiagnostic clang_getDiagnosticInSet(CXDiagnosticSet Diags,
- unsigned Index) {
- if (CXDiagnosticSetImpl *D = static_cast<CXDiagnosticSetImpl*>(Diags))
+
+CXDiagnostic clang_getDiagnosticInSet(CXDiagnosticSet Diags, unsigned Index) {
+ if (CXDiagnosticSetImpl *D = static_cast<CXDiagnosticSetImpl *>(Diags))
if (Index < D->getNumDiagnostics())
return D->getDiagnostic(Index);
return nullptr;
}
-
+
CXDiagnosticSet clang_getChildDiagnostics(CXDiagnostic Diag) {
if (CXDiagnosticImpl *D = static_cast<CXDiagnosticImpl *>(Diag)) {
CXDiagnosticSetImpl &ChildDiags = D->getChildDiagnostics();
- return ChildDiags.empty() ? nullptr : (CXDiagnosticSet) &ChildDiags;
+ return ChildDiags.empty() ? nullptr : (CXDiagnosticSet)&ChildDiags;
}
return nullptr;
}
unsigned clang_getNumDiagnosticsInSet(CXDiagnosticSet Diags) {
- if (CXDiagnosticSetImpl *D = static_cast<CXDiagnosticSetImpl*>(Diags))
+ if (CXDiagnosticSetImpl *D = static_cast<CXDiagnosticSetImpl *>(Diags))
return D->getNumDiagnostics();
return 0;
}
diff --git a/clang/tools/libclang/CIndexDiagnostic.h b/clang/tools/libclang/CIndexDiagnostic.h
index 25589bb57474a..c109710475fd3 100644
--- a/clang/tools/libclang/CIndexDiagnostic.h
+++ b/clang/tools/libclang/CIndexDiagnostic.h
@@ -14,29 +14,27 @@
#define LLVM_CLANG_TOOLS_LIBCLANG_CINDEXDIAGNOSTIC_H
#include "clang-c/Index.h"
+#include <assert.h>
#include <memory>
#include <vector>
-#include <assert.h>
namespace clang {
class LangOptions;
class StoredDiagnostic;
class CXDiagnosticImpl;
-
+
class CXDiagnosticSetImpl {
std::vector<std::unique_ptr<CXDiagnosticImpl>> Diagnostics;
const bool IsExternallyManaged;
+
public:
- CXDiagnosticSetImpl(bool isManaged = false)
- : IsExternallyManaged(isManaged) {}
+ CXDiagnosticSetImpl(bool isManaged = false);
virtual ~CXDiagnosticSetImpl();
- size_t getNumDiagnostics() const {
- return Diagnostics.size();
- }
-
+ size_t getNumDiagnostics() const { return Diagnostics.size(); }
+
CXDiagnosti...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/182522
More information about the cfe-commits
mailing list