<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/58810>58810</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            clang-tidy segfault with llvm-15+
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          blaizard
      </td>
    </tr>
</table>

<pre>
    I get a segfault with the new clang-tidy built from source, see below the stack dump.
I noticed this issue with any build from llvm-15+ (15.0.0, 15.0.1, 15.0.2, 15.0.3 and 15.0.4), the same code doesn't crash with the llvm-14.0.6.

Note that most of the clang-tidy calls on the files on my repo seem to work fine with the latest llvm-15.0.4, it seems to crash only when parsing this line:
`        #0 Calling operator""_csv()::StrView::value() at line ./cc/bzd/utility/pattern/pattern.hh:130:43`
Which looks like:
```
template <class Adapter, bzd::concepts::constexprStringView Pattern>
constexpr auto parse() noexcept
{
        struct Result : public ResultStaticString
        {
                typename Adapter::Metadata metadata{};
        };

        // Calculate the size and make the output array.
        constexpr Size size = parseSize<Adapter>(Pattern::value());     //< HERE
```
and `Pattern` is constructed as follow:
```
namespace bzd {

/// Base class for constant StringView from operator""_csv
struct ConstexprStringView
{
};

} // namespace bzd

/// Operator to create a compile time string view out of a string.
template <bzd::meta::StringLiteral str>
constexpr auto operator""_csv() noexcept
{
        struct StrView : ::bzd::ConstexprStringView
        {
                [[nodiscard]] static constexpr const char* value() noexcept { return str.data(); }
        };
        return StrView{};
}
```

Stack dump:
```
0.      Program arguments: clang_tidy --use-color --quiet cc/components/posix/error.hh -- -isystem external/linux_x86_64_clang_15_0_4/include/c++/v1 -isystem external/linux_x86_64_clang_15_0_4/lib/clang/15.0.4/include -isystem external/linux_x86_64_clang_15_0_4/include/x86_64-unknown-linux-gnu/c++/v1/ -isystem /usr/include/x86_64-linux-gnu -isystem /usr/include -Wall -Werror -Wextra -Wpedantic -Wvla -Wextra-semi -Wnull-dereference -Wswitch-enum -ggdb3 -gdwarf-2 -no-canonical-prefixes -ffunction-sections -fdata-sections -flto -std=c++20 -nostdinc --no-standard-includes -O0 -fno-omit-frame-pointer -fstack-protector-all -fno-inline -iquote . -iquote bazel-out/k8-dbg-clang_tidy/bin
1.      <eof> parser at end of file
2.      While analyzing stack: 
        #0 Calling operator""_csv()::StrView::value() at line ./cc/bzd/utility/pattern/pattern.hh:130:43
        #1 Calling bzd::pattern::impl::parse() at line ./cc/bzd/utility/pattern/pattern.hh:258:27
        #2 Calling bzd::pattern::impl::make(const struct StrView &, const class bzd::impl::StringView<const char> &, const int &, char *const &) at line ./cc/bzd/utility/pattern/formatter/to_string.hh:360:3
        #3 Calling toString(class bzd::impl::String<char, class bzd::impl::NonOwningStorage<char> > &, const struct StrView &, const class bzd::impl::StringView<const char> &, const int &, char *const &) at line ./cc/bzd/core/error.hh:58:4
        #4 Calling bzd::Error::Error(const class bzd::SourceLocation &, const enum bzd::ErrorType, struct StrView &&, const class bzd::impl::StringView<const char> &, int &, char *&&) at line ./cc/bzd/container/result.hh:48:51
        #5 Calling bzd::ResultError<bzd::Error>::ResultError(const class bzd::SourceLocation &, enum bzd::ErrorType &&, struct StrView &&, const class bzd::impl::StringView<const char> &, int &, char *&&) at line 15
        #6 Calling bzd::error::Errno::Errno(const bzd::StringView, int, const class bzd::SourceLocation)
3.      ./cc/bzd/container/string_view.hh:78:72: Error evaluating statement
4.      ./cc/bzd/container/string_view.hh:78:72: Error evaluating statement
 #0 0x000055a04aef4344 PrintStackTraceSignalHandler(void*) Signals.cpp:0:0
 #1 0x000055a04aef1ba4 SignalHandler(int) Signals.cpp:0:0
 #2 0x00007f76abade420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #3 0x000055a048f12706 clang::ento::MemRegionManager::getVarRegion(clang::VarDecl const*, clang::LocationContext const*) (bazel-out/k8-dbg-clang_tidy/bin/tools/clang_tidy/clang_tidy.runfiles/__main__/../linux_x86_64_clang_15_0_4/clang_tidy+0x18b8706)
 #4 0x000055a048eadc34 clang::ento::ExprEngine::VisitCommonDeclRefExpr(clang::Expr const*, clang::NamedDecl const*, clang::ento::ExplodedNode*, clang::ento::ExplodedNodeSet&) (bazel-out/k8-dbg-clang_tidy/bin/tools/clang_tidy/clang_tidy.runfiles/__main__/../linux_x86_64_clang_15_0_4/clang_tidy+0x1853c34)
 #5 0x000055a048eb43f3 clang::ento::ExprEngine::Visit(clang::Stmt const*, clang::ento::ExplodedNode*, clang::ento::ExplodedNodeSet&) (bazel-out/k8-dbg-clang_tidy/bin/tools/clang_tidy/clang_tidy.runfiles/__main__/../linux_x86_64_clang_15_0_4/clang_tidy+0x185a3f3)
 #6 0x000055a048eb5cfe clang::ento::ExprEngine::ProcessStmt(clang::Stmt const*, clang::ento::ExplodedNode*) (bazel-out/k8-dbg-clang_tidy/bin/tools/clang_tidy/clang_tidy.runfiles/__main__/../linux_x86_64_clang_15_0_4/clang_tidy+0x185bcfe)
 #7 0x000055a048eb5ec2 clang::ento::ExprEngine::processCFGElement(clang::CFGElement, clang::ento::ExplodedNode*, unsigned int, clang::ento::NodeBuilderContext*) (bazel-out/k8-dbg-clang_tidy/bin/tools/clang_tidy/clang_tidy.runfiles/__main__/../linux_x86_64_clang_15_0_4/clang_tidy+0x185bec2)
 #8 0x000055a048e6d0bc clang::ento::CoreEngine::HandleBlockEntrance(clang::BlockEntrance const&, clang::ento::ExplodedNode*) (bazel-out/k8-dbg-clang_tidy/bin/tools/clang_tidy/clang_tidy.runfiles/__main__/../linux_x86_64_clang_15_0_4/clang_tidy+0x18130bc)
 #9 0x000055a048e6d2c9 clang::ento::CoreEngine::dispatchWorkItem(clang::ento::ExplodedNode*, clang::ProgramPoint, clang::ento::WorkListUnit const&) (bazel-out/k8-dbg-clang_tidy/bin/tools/clang_tidy/clang_tidy.runfiles/__main__/../linux_x86_64_clang_15_0_4/clang_tidy+0x18132c9)
#10 0x000055a048e6d465 clang::ento::CoreEngine::ExecuteWorkList(clang::LocationContext const*, unsigned int, llvm::IntrusiveRefCntPtr<clang::ento::ProgramState const>) (bazel-out/k8-dbg-clang_tidy/bin/tools/clang_tidy/clang_tidy.runfiles/__main__/../linux_x86_64_clang_15_0_4/clang_tidy+0x1813465)
#11 0x000055a0488e864a (anonymous namespace)::AnalysisConsumer::HandleCode(clang::Decl*, unsigned int, clang::ento::ExprEngine::InliningModes, llvm::DenseSet<clang::Decl const*, llvm::DenseMapInfo<clang::Decl const*, void>>*) AnalysisConsumer.cpp:0:0
#12 0x000055a04890d0cc (anonymous namespace)::AnalysisConsumer::HandleTranslationUnit(clang::ASTContext&) AnalysisConsumer.cpp:0:0
#13 0x000055a04915fd40 clang::MultiplexConsumer::HandleTranslationUnit(clang::ASTContext&) (bazel-out/k8-dbg-clang_tidy/bin/tools/clang_tidy/clang_tidy.runfiles/__main__/../linux_x86_64_clang_15_0_4/clang_tidy+0x1b05d40)
#14 0x000055a0493b01c9 clang::ParseAST(clang::Sema&, bool, bool) (bazel-out/k8-dbg-clang_tidy/bin/tools/clang_tidy/clang_tidy.runfiles/__main__/../linux_x86_64_clang_15_0_4/clang_tidy+0x1d561c9)
#15 0x000055a0491250d1 clang::FrontendAction::Execute() (bazel-out/k8-dbg-clang_tidy/bin/tools/clang_tidy/clang_tidy.runfiles/__main__/../linux_x86_64_clang_15_0_4/clang_tidy+0x1acb0d1)
#16 0x000055a0490a6293 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (bazel-out/k8-dbg-clang_tidy/bin/tools/clang_tidy/clang_tidy.runfiles/__main__/../linux_x86_64_clang_15_0_4/clang_tidy+0x1a4c293)
#17 0x000055a0488d8986 clang::tooling::FrontendActionFactory::runInvocation(std::shared_ptr<clang::CompilerInvocation>, clang::FileManager*, std::shared_ptr<clang::PCHContainerOperations>, clang::DiagnosticConsumer*) (bazel-out/k8-dbg-clang_tidy/bin/tools/clang_tidy/clang_tidy.runfiles/__main__/../linux_x86_64_clang_15_0_4/clang_tidy+0x127e986)
#18 0x000055a048879aa0 clang::tidy::runClangTidy(clang::tidy::ClangTidyContext&, clang::tooling::CompilationDatabase const&, llvm::ArrayRef<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, llvm::IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem>, bool, bool, llvm::StringRef)::ActionFactory::runInvocation(std::shared_ptr<clang::CompilerInvocation>, clang::FileManager*, std::shared_ptr<clang::PCHContainerOperations>, clang::DiagnosticConsumer*) ClangTidy.cpp:0:0
#19 0x000055a0488d0a90 clang::tooling::ToolInvocation::runInvocation(char const*, clang::driver::Compilation*, std::shared_ptr<clang::CompilerInvocation>, std::shared_ptr<clang::PCHContainerOperations>) (bazel-out/k8-dbg-clang_tidy/bin/tools/clang_tidy/clang_tidy.runfiles/__main__/../linux_x86_64_clang_15_0_4/clang_tidy+0x1276a90)
#20 0x000055a0488d48b6 clang::tooling::ToolInvocation::run() (bazel-out/k8-dbg-clang_tidy/bin/tools/clang_tidy/clang_tidy.runfiles/__main__/../linux_x86_64_clang_15_0_4/clang_tidy+0x127a8b6)
#21 0x000055a0488d6f42 clang::tooling::ClangTool::run(clang::tooling::ToolAction*) (bazel-out/k8-dbg-clang_tidy/bin/tools/clang_tidy/clang_tidy.runfiles/__main__/../linux_x86_64_clang_15_0_4/clang_tidy+0x127cf42)
#22 0x000055a04887bac2 clang::tidy::runClangTidy(clang::tidy::ClangTidyContext&, clang::tooling::CompilationDatabase const&, llvm::ArrayRef<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, llvm::IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem>, bool, bool, llvm::StringRef) (bazel-out/k8-dbg-clang_tidy/bin/tools/clang_tidy/clang_tidy.runfiles/__main__/../linux_x86_64_clang_15_0_4/clang_tidy+0x1221ac2)
#23 0x000055a048158ba2 clang::tidy::clangTidyMain(int, char const**) (bazel-out/k8-dbg-clang_tidy/bin/tools/clang_tidy/clang_tidy.runfiles/__main__/../linux_x86_64_clang_15_0_4/clang_tidy+0xafeba2)
#24 0x00007f76ab562083 __libc_start_main /build/glibc-SzIz7B/glibc-2.31/csu/../csu/libc-start.c:342:3
#25 0x000055a04814fa6e _start (bazel-out/k8-dbg-clang_tidy/bin/tools/clang_tidy/clang_tidy.runfiles/__main__/../linux_x86_64_clang_15_0_4/clang_tidy+0xaf5a6e)
bazel-out/k8-dbg-clang_tidy/bin/tools/clang_tidy/clang_tidy.runfiles/__main__/toolchains/cc/linux_x86_64_clang/clang_tidy: line 8:     7 Segmentation fault      $RUNFILES_DIR/__main__/../linux_x86_64_clang_15_0_4/clang_tidy $@
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJztW1tz27gO_jXOC0ce3SzbD3lIHOdsZnqburt99FAUZfNEEr0SlTj59QuQkizKdptud2d9Lh1XF15A4AMIgKQSy-Tl-oFsuCKUVHyT0jpT5FmoLVFbTgr-TFhGi42jRPJC4lpAbVrKnFSyLhkf-QvoxUnMM_mse1SKskeS1PluPHLvRu7NAymkEownUC0qIqqq5mYAWhiKiaGYZU-5401G_i0Z-TNvMnbHLtLXT1735HdPAVBIzGM48udYrjmgOSdMJpwkklfFyJ8qwkpabQ9imaFC6Bg1XJrrB6k4NKCK5LJSRKa6dQ8ARrOsIrLQ5anIuH7JX0jJdxKRyImS5FmWj1Bb8N6IVHGg2MhoOF4QoXSfCjsZFmWRvZDnLS_IjpaVKDYGtQyIjYKGy1HkkubfyA9csgCmsKXc8ZIqWY58wMhfs-oJcERgoGNws1Llb4I_m5cnmtXc1BKQFsmT8ci_Zwwu8WsC11qJTKgXeNpRpXhZHJ7G2y3Q8AIXrmEA7Bi-vm4F25JMykdk-NFiuPnpV8XzHeJBRsECsK0qcpPQHRBGSHBwzSKTBeM7VXVvleL7XQligKwoCfnU8BUsDd2uDaE1AIoAtjIWku-RWsPP9LbV-rxSZc0U-cwrNHwYiezqOBOsKVkpCsZrBu369PvDT73seIFG14qhOX7PFU2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