Issue |
131157
|
Summary |
[clang-format] crashes upon expanding function macros with missing closing paren
|
Labels |
clang-format
|
Assignees |
|
Reporter |
zeule
|
Given the input:
```C++
MACRO_A(
#endif
```
and config:
```yaml
Macros:
- MACRO_A=void func_a
```
clang-format 20.1.0 crashes:
```
Assertion failed: PreviousOriginalWhitespaceEndOffset <= OriginalWhitespaceStartOffset, file C:\develop\src\alien\llvm-project\clang\lib\Format\WhitespaceManager.cpp, line 145
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: C:\\develop\\build\\alien\\llvm\\vs\\Debug\\bin\\clang-format.exe C:\\develop\\src\\Software\\test2.cpp
Exception Code: 0x80000003
#0 0x00007ff7de83e66c HandleAbort C:\develop\src\alien\llvm-project\llvm\lib\Support\Windows\Signals.inc:429:0
#1 0x00007ffad5109ea7 (C:\WINDOWS\SYSTEM32\ucrtbased.dll+0x99ea7)
#2 0x00007ffad510bae9 (C:\WINDOWS\SYSTEM32\ucrtbased.dll+0x9bae9)
#3 0x00007ffad5111745 (C:\WINDOWS\SYSTEM32\ucrtbased.dll+0xa1745)
#4 0x00007ffad51113b7 (C:\WINDOWS\SYSTEM32\ucrtbased.dll+0xa13b7)
#5 0x00007ffad510f381 (C:\WINDOWS\SYSTEM32\ucrtbased.dll+0x9f381)
#6 0x00007ffad5111caf (C:\WINDOWS\SYSTEM32\ucrtbased.dll+0xa1caf)
#7 0x00007ff7dea3f32b clang::format::WhitespaceManager::calculateLineBreakInformation(void) C:\develop\src\alien\llvm-project\clang\lib\Format\WhitespaceManager.cpp:144:0
#8 0x00007ff7dea3ecfc clang::format::WhitespaceManager::generateReplacements(void) C:\develop\src\alien\llvm-project\clang\lib\Format\WhitespaceManager.cpp:109:0
#9 0x00007ff7de98db6e clang::format::`anonymous namespace'::Formatter::analyze C:\develop\src\alien\llvm-project\clang\lib\Format\Format.cpp:2535:0
#10 0x00007ff7dea2fffc clang::format::TokenAnalyzer::process(bool) C:\develop\src\alien\llvm-project\clang\lib\Format\TokenAnalyzer.cpp:129:0
#11 0x00007ff7de99891b `clang::format::internal::reformat'::`2'::<lambda_11>::operator() C:\develop\src\alien\llvm-project\clang\lib\Format\Format.cpp:3840:0
#12 0x00007ff7de781798 std::invoke<`clang::format::internal::reformat'::`2'::<lambda_11> &,clang::format::Environment const &> C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.43.34808\include\type_traits:1706:0
#13 0x00007ff7de99b48f std::_Func_impl_no_alloc<`clang::format::internal::reformat'::`2'::<lambda_11>,std::pair<clang::tooling::Replacements,unsigned int>,clang::format::Environment const &>::_Do_call C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.43.34808\include\functional:881:0
#14 0x00007ff7de7ca7de std::_Func_class<struct std::pair<class clang::tooling::Replacements, unsigned int>, class clang::format::Environment const &>::operator()(class clang::format::Environment const &) const C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.43.34808\include\functional:925:0
#15 0x00007ff7de99763d clang::format::internal::reformat(struct clang::format::FormatStyle const &, class llvm::StringRef, class llvm::ArrayRef<class clang::tooling::Range>, unsigned int, unsigned int, unsigned int, class llvm::StringRef, struct clang::format::FormattingAttemptStatus *) C:\develop\src\alien\llvm-project\clang\lib\Format\Format.cpp:3854:0
#16 0x00007ff7de9885d9 clang::format::reformat(struct clang::format::FormatStyle const &, class llvm::StringRef, class llvm::ArrayRef<class clang::tooling::Range>, class llvm::StringRef, struct clang::format::FormattingAttemptStatus *) C:\develop\src\alien\llvm-project\clang\lib\Format\Format.cpp:3898:0
#17 0x00007ff7de6d479f clang::format::format C:\develop\src\alien\llvm-project\clang\tools\clang-format\ClangFormat.cpp:509:0
#18 0x00007ff7de6d6b7f main C:\develop\src\alien\llvm-project\clang\tools\clang-format\ClangFormat.cpp:738:0
#19 0x00007ff7ded7e3f9 invoke_main D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:79:0
#20 0x00007ff7ded7e2e2 __scrt_common_main_seh D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288:0
#21 0x00007ff7ded7e19e __scrt_common_main D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:331:0
#22 0x00007ff7ded7e48e mainCRTStartup D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_main.cpp:17:0
#23 0x00007ffb3750e8d7 (C:\WINDOWS\System32\KERNEL32.DLL+0x2e8d7)
#24 0x00007ffb37a9bf2c (C:\WINDOWS\SYSTEM32\ntdll.dll+0xbbf2c)
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs