Issue 185421
Summary [clang-format] Assertion `Tok' failed.
Labels clang-format
Assignees
Reporter k-arrows
    Reproducer:
```cpp
>
 f({
   {}inner> () __attribute __attribute__((target_version())) int foo(void)
   {};
   }, );
```

Assertion failure:
```console
clang-format: /path_to_project/llvm-project/clang/lib/Format/ContinuationIndenter.cpp:713: bool clang::format::ContinuationIndenter::mustBreak(const clang::format::LineState &): Assertion `Tok' failed.
```

Backtrace:
```console
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
Stack dump:
0.      Program arguments: clang-format test.cpp
 #0 0x000072282a5ccde7 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) 
 #1 0x000072282a5c9cc5 llvm::sys::RunSignalHandlers() 
 #2 0x000072282a5cdc15 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #3 0x0000722829c42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x0000722829c969fc __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
 #5 0x0000722829c969fc __pthread_kill_internal ./nptl/pthread_kill.c:78:10
 #6 0x0000722829c969fc pthread_kill ./nptl/pthread_kill.c:89:10
 #7 0x0000722829c42476 gsignal ./signal/../sysdeps/posix/raise.c:27:6
 #8 0x0000722829c287f3 abort ./stdlib/abort.c:81:7
 #9 0x0000722829c2871b _nl_load_domain ./intl/loadmsgcat.c:1177:9
#10 0x0000722829c39e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#11 0x000072282ad6ea0c clang::format::ContinuationIndenter::mustBreak(clang::format::LineState const&) 
#12 0x000072282adf2b7f clang::format::(anonymous namespace)::OptimizingLineFormatter::addNextStateToQueue(unsigned int, clang::format::(anonymous namespace)::OptimizingLineFormatter::StateNode*, bool, unsigned int*, std::priority_queue<std::pair<std::pair<unsigned int, unsigned int>, clang::format::(anonymous namespace)::OptimizingLineFormatter::StateNode*>, llvm::SmallVector<std::pair<std::pair<unsigned int, unsigned int>, clang::format::(anonymous namespace)::OptimizingLineFormatter::StateNode*>, 3u>, std::greater<std::pair<std::pair<unsigned int, unsigned int>, clang::format::(anonymous namespace)::OptimizingLineFormatter::StateNode*>>>*) UnwrappedLineFormatter.cpp:0:0
#13 0x000072282adf2163 clang::format::(anonymous namespace)::OptimizingLineFormatter::analyzeSolutionSpace(clang::format::LineState&, bool) UnwrappedLineFormatter.cpp:0:0
#14 0x000072282adee6aa clang::format::UnwrappedLineFormatter::format(llvm::SmallVectorImpl<clang::format::AnnotatedLine*> const&, bool, int, bool, unsigned int, unsigned int, unsigned int) 
#15 0x000072282adf1a6d clang::format::(anonymous namespace)::LineFormatter::formatChildren(clang::format::LineState&, bool, bool, unsigned int&) UnwrappedLineFormatter.cpp:0:0
#16 0x000072282adf2c3e clang::format::(anonymous namespace)::OptimizingLineFormatter::addNextStateToQueue(unsigned int, clang::format::(anonymous namespace)::OptimizingLineFormatter::StateNode*, bool, unsigned int*, std::priority_queue<std::pair<std::pair<unsigned int, unsigned int>, clang::format::(anonymous namespace)::OptimizingLineFormatter::StateNode*>, llvm::SmallVector<std::pair<std::pair<unsigned int, unsigned int>, clang::format::(anonymous namespace)::OptimizingLineFormatter::StateNode*>, 3u>, std::greater<std::pair<std::pair<unsigned int, unsigned int>, clang::format::(anonymous namespace)::OptimizingLineFormatter::StateNode*>>>*) UnwrappedLineFormatter.cpp:0:0
#17 0x000072282adf218f clang::format::(anonymous namespace)::OptimizingLineFormatter::analyzeSolutionSpace(clang::format::LineState&, bool) UnwrappedLineFormatter.cpp:0:0
#18 0x000072282adee6aa clang::format::UnwrappedLineFormatter::format(llvm::SmallVectorImpl<clang::format::AnnotatedLine*> const&, bool, int, bool, unsigned int, unsigned int, unsigned int) 
#19 0x000072282ad91d3b clang::format::(anonymous namespace)::Formatter::analyze(clang::format::TokenAnnotator&, llvm::SmallVectorImpl<clang::format::AnnotatedLine*>&, clang::format::FormatTokenLexer&) Format.cpp:0:0
#20 0x000072282add713b clang::format::TokenAnalyzer::process(bool) 
#21 0x000072282adaa66e std::_Function_handler<std::pair<clang::tooling::Replacements, unsigned int> (clang::format::Environment const&), clang::format::internal::reformat(clang::format::FormatStyle const&, llvm::StringRef, llvm::ArrayRef<clang::tooling::Range>, unsigned int, unsigned int, unsigned int, llvm::StringRef, clang::format::FormattingAttemptStatus*)::$_18>::_M_invoke(std::_Any_data const&, clang::format::Environment const&) Format.cpp:0:0
#22 0x000072282ad8868e clang::format::internal::reformat(clang::format::FormatStyle const&, llvm::StringRef, llvm::ArrayRef<clang::tooling::Range>, unsigned int, unsigned int, unsigned int, llvm::StringRef, clang::format::FormattingAttemptStatus*) 
#23 0x000072282ad89eb3 clang::format::reformat(clang::format::FormatStyle const&, llvm::StringRef, llvm::ArrayRef<clang::tooling::Range>, llvm::StringRef, clang::format::FormattingAttemptStatus*) 
#24 0x00005858cec0f278 clang::format::format(llvm::StringRef, bool) ClangFormat.cpp:0:0
#25 0x00005858cec0d186 main 
#26 0x0000722829c29d90 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#27 0x0000722829c29e40 call_init ./csu/../csu/libc-start.c:128:20
#28 0x0000722829c29e40 __libc_start_main ./csu/../csu/libc-start.c:379:5
#29 0x00005858cec09835 _start 
Aborted (core dumped)
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to