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

    <tr>
        <th>Summary</th>
        <td>
            clang-tidy crash on self include file 
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang-tidy
      </td>
    </tr>

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

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

<pre>
    ```c++
/// a.h

#include "a.h"
```

`clang-tidy -checks="-*,misc-header-include-cycle" a.h`

```bash
Assertion failed: (Loc.isValid()), function diag, file ClangTidyDiagnosticConsumer.cpp, line 178.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: ./builddebug/bin/clang-tidy builddebug/a.cpp -checks=-*,misc-header-include-cycle
1. /Users/caicongcong/dev/llvm/tidy/builddebug/a.cpp:1:2: current parser token 'include'
 #0 0x00000001007248c8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/Users/caicongcong/dev/llvm/tidy/builddebug/bin/clang-tidy+0x1004108c8)
 #1 0x0000000100724e60 PrintStackTraceSignalHandler(void*) (/Users/caicongcong/dev/llvm/tidy/builddebug/bin/clang-tidy+0x100410e60)
 #2 0x0000000100722ae4 llvm::sys::RunSignalHandlers() (/Users/caicongcong/dev/llvm/tidy/builddebug/bin/clang-tidy+0x10040eae4)
 #3 0x00000001007262b8 SignalHandler(int) (/Users/caicongcong/dev/llvm/tidy/builddebug/bin/clang-tidy+0x1004122b8)
 #4 0x00000001891f3584 (/usr/lib/system/libsystem_platform.dylib+0x180477584)
 #5 0x00000001891c2c20 (/usr/lib/system/libsystem_pthread.dylib+0x180446c20)
 #6 0x00000001890cfa30 (/usr/lib/system/libsystem_c.dylib+0x180353a30)
 #7 0x00000001890ced20 (/usr/lib/system/libsystem_c.dylib+0x180352d20)
 #8 0x000000010180d784 clang::tidy::ClangTidyContext::diag(llvm::StringRef, clang::SourceLocation, llvm::StringRef, clang::DiagnosticIDs::Level) (/Users/caicongcong/dev/llvm/tidy/builddebug/bin/clang-tidy+0x1014f9784)
 #9 0x0000000101808bc4 clang::tidy::ClangTidyCheck::diag(clang::SourceLocation, llvm::StringRef, clang::DiagnosticIDs::Level) (/Users/caicongcong/dev/llvm/tidy/builddebug/bin/clang-tidy+0x1014f4bc4)
#10 0x0000000101ee1690 clang::tidy::misc::(anonymous namespace)::CyclicDependencyCallbacks::checkForDoubleInclude(clang::FileID, llvm::StringRef, clang::SourceLocation) (/Users/caicongcong/dev/llvm/tidy/builddebug/bin/clang-tidy+0x101bcd690)
#11 0x0000000101edc454 clang::tidy::misc::(anonymous namespace)::CyclicDependencyCallbacks::InclusionDirective(clang::SourceLocation, clang::Token const&, llvm::StringRef, bool, clang::CharSourceRange, clang::CustomizableOptional<clang::FileEntryRef>, llvm::StringRef, llvm::StringRef, clang::Module const*, bool, clang::SrcMgr::CharacteristicKind) (/Users/caicongcong/dev/llvm/tidy/builddebug/bin/clang-tidy+0x101bc8454)
#12 0x00000001061fd10c clang::PPChainedCallbacks::InclusionDirective(clang::SourceLocation, clang::Token const&, llvm::StringRef, bool, clang::CharSourceRange, clang::CustomizableOptional<clang::FileEntryRef>, llvm::StringRef, llvm::StringRef, clang::Module const*, bool, clang::SrcMgr::CharacteristicKind) (/Users/caicongcong/dev/llvm/tidy/builddebug/bin/clang-tidy+0x105ee910c)
#13 0x000000010620b638 clang::Preprocessor::HandleHeaderIncludeOrImport(clang::SourceLocation, clang::Token&, clang::Token&, clang::SourceLocation, clang::detail::SearchDirIteratorImpl<true>, clang::FileEntry const*) (/Users/caicongcong/dev/llvm/tidy/builddebug/bin/clang-tidy+0x105ef7638)
#14 0x00000001062062fc clang::Preprocessor::HandleIncludeDirective(clang::SourceLocation, clang::Token&, clang::detail::SearchDirIteratorImpl<true>, clang::FileEntry const*) (/Users/caicongcong/dev/llvm/tidy/builddebug/bin/clang-tidy+0x105ef22fc)
#15 0x0000000106206a58 clang::Preprocessor::HandleDirective(clang::Token&) (/Users/caicongcong/dev/llvm/tidy/builddebug/bin/clang-tidy+0x105ef2a58)
#16 0x00000001061ba0b0 clang::Lexer::LexTokenInternal(clang::Token&, bool) (/Users/caicongcong/dev/llvm/tidy/builddebug/bin/clang-tidy+0x105ea60b0)
#17 0x00000001061b5898 clang::Lexer::Lex(clang::Token&) (/Users/caicongcong/dev/llvm/tidy/builddebug/bin/clang-tidy+0x105ea1898)
#18 0x00000001041f1a74 clang::Preprocessor::CLK_Lexer(clang::Preprocessor&, clang::Token&) (/Users/caicongcong/dev/llvm/tidy/builddebug/bin/clang-tidy+0x103edda74)
#19 0x0000000106252f48 clang::Preprocessor::Lex(clang::Token&) (/Users/caicongcong/dev/llvm/tidy/builddebug/bin/clang-tidy+0x105f3ef48)
#20 0x0000000104197e1c clang::Parser::ConsumeToken() (/Users/caicongcong/dev/llvm/tidy/builddebug/bin/clang-tidy+0x103e83e1c)
#21 0x00000001042b7d28 clang::Parser::Initialize() (/Users/caicongcong/dev/llvm/tidy/builddebug/bin/clang-tidy+0x103fa3d28)
#22 0x0000000104193cc4 clang::ParseAST(clang::Sema&, bool, bool) (/Users/caicongcong/dev/llvm/tidy/builddebug/bin/clang-tidy+0x103e7fcc4)
#23 0x0000000103f1b418 clang::ASTFrontendAction::ExecuteAction() (/Users/caicongcong/dev/llvm/tidy/builddebug/bin/clang-tidy+0x103c07418)
#24 0x0000000103f1acb4 clang::FrontendAction::Execute() (/Users/caicongcong/dev/llvm/tidy/builddebug/bin/clang-tidy+0x103c06cb4)
#25 0x0000000103e36bc8 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/Users/caicongcong/dev/llvm/tidy/builddebug/bin/clang-tidy+0x103b22bc8)
#26 0x00000001017cc5e4 clang::tooling::FrontendActionFactory::runInvocation(std::__1::shared_ptr<clang::CompilerInvocation>, clang::FileManager*, std::__1::shared_ptr<clang::PCHContainerOperations>, clang::DiagnosticConsumer*) (/Users/caicongcong/dev/llvm/tidy/builddebug/bin/clang-tidy+0x1014b85e4)
#27 0x00000001017f4a58 clang::tidy::runClangTidy(clang::tidy::ClangTidyContext&, clang::tooling::CompilationDatabase const&, llvm::ArrayRef<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, llvm::IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem>, bool, bool, llvm::StringRef)::ActionFactory::runInvocation(std::__1::shared_ptr<clang::CompilerInvocation>, clang::FileManager*, std::__1::shared_ptr<clang::PCHContainerOperations>, clang::DiagnosticConsumer*) (/Users/caicongcong/dev/llvm/tidy/builddebug/bin/clang-tidy+0x1014e0a58)
#28 0x00000001017cc400 clang::tooling::ToolInvocation::runInvocation(char const*, clang::driver::Compilation*, std::__1::shared_ptr<clang::CompilerInvocation>, std::__1::shared_ptr<clang::PCHContainerOperations>) (/Users/caicongcong/dev/llvm/tidy/builddebug/bin/clang-tidy+0x1014b8400)
#29 0x00000001017cae10 clang::tooling::ToolInvocation::run() (/Users/caicongcong/dev/llvm/tidy/builddebug/bin/clang-tidy+0x1014b6e10)
#30 0x00000001017cd840 clang::tooling::ClangTool::run(clang::tooling::ToolAction*) (/Users/caicongcong/dev/llvm/tidy/builddebug/bin/clang-tidy+0x1014b9840)
#31 0x00000001017edca8 clang::tidy::runClangTidy(clang::tidy::ClangTidyContext&, clang::tooling::CompilationDatabase const&, llvm::ArrayRef<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, llvm::IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem>, bool, bool, llvm::StringRef) (/Users/caicongcong/dev/llvm/tidy/builddebug/bin/clang-tidy+0x1014d9ca8)
#32 0x000000010185a094 clang::tidy::clangTidyMain(int, char const**) (/Users/caicongcong/dev/llvm/tidy/builddebug/bin/clang-tidy+0x101546094)
#33 0x0000000100319054 main (/Users/caicongcong/dev/llvm/tidy/builddebug/bin/clang-tidy+0x100005054)
#34 0x0000000188e3a0e0 
zsh: abort      ./builddebug/bin/clang-tidy builddebug/a.cpp 
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsWl1v2zrS_jXKjRCDor4vfOHaNRqcFA2avO9tMCJHNrcyaZBUtu6vX1BSYlOJk7R7dLAFaiiILNKcZ54ZznAogjFiIxHnQfohSFcX0Nqt0vNPqPUSBClJflEpfpgHGekvFtAP7iKrgCwCuu6vEGbb4dHQEAvJmpZjGFDqGikdWh4H8rpnhDUgN5dW8EN4ybbIvpkgXgWUXgZ0EdDlThh2uUXgqC-HkS_ZgTUYUNoJfzZgf1VgBmALY1BboWRYg2iQB_EiDGhxrdhMmP-HRvCAFgEtu2sZ1q1kXW8uYNM9EA2GS4fyTvDDSsBGKmMFWypp2h3qGdvvXb9GSAyjvJj1Ym-uPy5uP4amrXbChhBW7SbUuFfahlaFW2v3JogHIjfCbttqxtQuoOumeXj8d7nX6l_IbEDXwpgWTce45OEjx3aLIdNgtmEF7JvVwHAQf2uBfQt5u9s7Kd0jMgu7z41WGw27EPSm3aG0Dkc4C-i6akXDOVbtxn0RMqDrE-t4reC0PjHYm9bqEESzMKDr_zOonSYMBFNy4_4Cuub4cFTeCRwD6kQG8SIK4gV1kFmrNUob7kEb1KFV31CGAc0HwQHNe6lhQGMSku-k_0SE5DQpWBF2wuJFEC_MwfQ3N1pI23F358gMaHHspOHf98pYjbALaOZMLqQNaBl2_vOrao15DugH8j0iJIlIwTq_fFIiGiuBGQlHiG_FRkLzCSRvUAe0eFDOvxdTwsSMeDDpCCYFTF7i-msrPbSmn4cT4SQImHg44xHOjFZFOOZvWhNTWvkmTk4wFWVUx2mRDMJbo50YUQV0bQ7G4q7_2t_f7xuwtdK7GT90fZyIgiR5nha-2qkvglFGyTtF2K1G4CMJScao7wCZJ4GwGuJ3SmD-2HEaQ-yPnY_GRv5e9M_GpnyEuzh1iKggPC-SsDNb77Cd7bq7p3SwVNLid9s_7TPGScS4tVrIzVesXbA4G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