Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-24698

clangbackend crashes on function-like macros

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: Not Evaluated
    • Resolution: Unresolved
    • Affects Version/s: Qt Creator 4.14.0-beta1
    • Fix Version/s: None
    • Component/s: C/C++/Obj-C++ Support
    • Labels:
      None
    • Environment:
      qt-creator/master/f1c9f8e628eb87a861aca68f72678f038a794221
      llvm-project/release_10.0.1-based/21b8c5e351ca6a666c1880dcef5977cf11f4a3a6
      Win 10 x64 MSVC 2019.7

      Description

      clangbackend crashes when you insert the following line

      #if QT_VERSION >= QT_VERSION_CHECK(6
      

      and press comma.

      ntdll!NtWaitForMultipleObjects+0x14
      KERNELBASE!WaitForMultipleObjectsEx+0x107
      KERNELBASE!WaitForMultipleObjects+0xe
      kernel32!WerpReportFaultInternal+0x51b
      kernel32!WerpReportFault+0xac
      KERNELBASE!UnhandledExceptionFilter+0x3b8
      ntdll!RtlUserThreadStart$filt$0+0xa2
      ntdll!_C_specific_handler+0x96
      ntdll!RtlpExecuteHandlerForException+0xf
      ntdll!RtlDispatchException+0x219
      ntdll!KiUserExceptionDispatch+0x2e
      libclang!clang::Preprocessor::HandleIfDirective+0x4e [llvm_qtc_10\clang\lib\Lex\PPDirectives.cpp @ 2942] 
      libclang!clang::Preprocessor::HandleDirective+0x2a7 [llvm_qtc_10\clang\lib\Lex\PPDirectives.cpp @ 983] 
      libclang!clang::Lexer::LexTokenInternal+0x210e [llvm_qtc_10\clang\lib\Lex\Lexer.cpp @ 3946] 
      libclang!clang::Preprocessor::Lex+0x66 [llvm_qtc_10\clang\lib\Lex\Preprocessor.cpp @ 907] 
      libclang!clang::Preprocessor::CachingLex+0xa1 [llvm_qtc_10\clang\lib\Lex\PPCaching.cpp @ 65] 
      libclang!clang::Preprocessor::Lex+0x7a [llvm_qtc_10\clang\lib\Lex\Preprocessor.cpp @ 909] 
      libclang!clang::Parser::ConsumeBrace+0x54 [llvm_qtc_10\clang\include\clang\Parse\Parser.h @ 600] 
      libclang!clang::BalancedDelimiterTracker::consumeClose+0x3c [llvm_qtc_10\clang\include\clang\Parse\RAIIObjectsForParser.h @ 448] 
      libclang!clang::Parser::ParseInnerNamespace+0x16d [llvm_qtc_10\clang\lib\Parse\ParseDeclCXX.cpp @ 253] 
      libclang!clang::Parser::ParseNamespace+0xd88 [llvm_qtc_10\clang\lib\Parse\ParseDeclCXX.cpp @ 227] 
      libclang!clang::Parser::ParseDeclaration+0x16e [llvm_qtc_10\clang\lib\Parse\ParseDecl.cpp @ 1788] 
      libclang!clang::Parser::ParseExternalDeclaration+0x55f [llvm_qtc_10\clang\lib\Parse\Parser.cpp @ 941] 
      libclang!clang::Parser::ParseTopLevelDecl+0x2f5 [llvm_qtc_10\clang\lib\Parse\Parser.cpp @ 687] 
      libclang!clang::Parser::ParseFirstTopLevelDecl+0x27 [llvm_qtc_10\clang\lib\Parse\Parser.cpp @ 564] 
      libclang!clang::ParseAST+0x1e8 [llvm_qtc_10\clang\lib\Parse\ParseAST.cpp @ 157] 
      libclang!clang::ASTFrontendAction::ExecuteAction+0xa2 [llvm_qtc_10\clang\lib\Frontend\FrontendAction.cpp @ 1043] 
      libclang!clang::FrontendAction::Execute+0x44 [llvm_qtc_10\clang\lib\Frontend\FrontendAction.cpp @ 940] 
      libclang!clang::ASTUnit::CodeComplete+0xe43 [llvm_qtc_10\clang\lib\Frontend\ASTUnit.cpp @ 2349] 
      libclang!clang_codeCompleteAt_Impl+0x8df [llvm_qtc_10\clang\tools\libclang\CIndexCodeCompletion.cpp @ 767] 
      libclang!clang_codeCompleteAt::__l2::<lambda_f43074fd63737ffd71d7eccc280487a8>::operator()+0x43 [llvm_qtc_10\clang\tools\libclang\CIndexCodeCompletion.cpp @ 869] 
      libclang!llvm::function_ref<void __cdecl(void)>::callback_fn<<lambda_f43074fd63737ffd71d7eccc280487a8> >+0x49 [llvm_qtc_10\llvm\include\llvm\ADT\STLExtras.h @ 108] 
      libclang!llvm::function_ref<void __cdecl(void)>::operator()+0x6 [llvm_qtc_10\llvm\include\llvm\ADT\STLExtras.h @ 125] 
      libclang!llvm::CrashRecoveryContext::RunSafely+0x2a [llvm_qtc_10\llvm\lib\Support\CrashRecoveryContext.cpp @ 233] 
      libclang!clang::RunSafely+0x77 [llvm_qtc_10\clang\tools\libclang\CIndex.cpp @ 8801] 
      libclang!clang_codeCompleteAt+0x20e [llvm_qtc_10\clang\tools\libclang\CIndexCodeCompletion.cpp @ 876] 
      clangbackend!ClangBackEnd::CodeCompleter::completeHelper+0xbf [qt-creator\src\tools\clangbackend\source\codecompleter.cpp @ 190] 
      clangbackend!ClangBackEnd::CodeCompleter::complete+0xc9 [qt-creator\src\tools\clangbackend\source\codecompleter.cpp @ 119] 
      clangbackend!ClangBackEnd::TranslationUnit::complete+0x4a [qt-creator\src\tools\clangbackend\source\clangtranslationunit.cpp @ 117] 
      clangbackend!ClangBackEnd::CompleteCodeJob::prepareAsyncRun::__l2::<lambda_c2d716376d1291d3d116451d0685ef30>::operator()+0x67 [qt-creator\src\tools\clangbackend\source\clangcompletecodejob.cpp @ 54] 
      clangbackend!std::invoke+0x67 [Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.27.29110\include\type_traits @ 1596] 
      clangbackend!std::_Invoker_ret<QVector<ClangBackEnd::CodeCompletion>,0>::_Call+0x67 [Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.27.29110\include\type_traits @ 1648] 
      clangbackend!std::_Func_impl_no_alloc<<lambda_c2d716376d1291d3d116451d0685ef30>,QVector<ClangBackEnd::CodeCompletion> >::_Do_call+0x84 [Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.27.29110\include\functional @ 903] 
      clangbackend!std::_Func_class<QVector<ClangBackEnd::CodeCompletion> >::operator()+0x18 [Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.27.29110\include\functional @ 951] 
      clangbackend!Utils::Internal::runAsyncReturnVoidDispatch<QVector<ClangBackEnd::CodeCompletion>,std::function<QVector<ClangBackEnd::CodeCompletion> __cdecl(void)> >+0x2a [qt-creator\src\libs\utils\runextensions.h @ 250] 
      clangbackend!Utils::Internal::runAsyncQFutureInterfaceDispatch<QVector<ClangBackEnd::CodeCompletion>,std::function<QVector<ClangBackEnd::CodeCompletion> __cdecl(void)> >+0x5a [qt-creator\src\libs\utils\runextensions.h @ 264] 
      clangbackend!Utils::Internal::runAsyncMemberDispatch<QVector<ClangBackEnd::CodeCompletion>,std::function<QVector<ClangBackEnd::CodeCompletion> __cdecl(void)>,void>+0x5d [qt-creator\src\libs\utils\runextensions.h @ 274] 
      clangbackend!Utils::Internal::runAsyncImpl<QVector<ClangBackEnd::CodeCompletion>,std::function<QVector<ClangBackEnd::CodeCompletion> __cdecl(void)> >+0x58 [qt-creator\src\libs\utils\runextensions.h @ 303] 
      clangbackend!Utils::Internal::AsyncJob<QVector<ClangBackEnd::CodeCompletion>,std::function<QVector<ClangBackEnd::CodeCompletion> __cdecl(void)> &>::runHelper+0x40 [qt-creator\src\libs\utils\runextensions.h @ 372] 
      clangbackend!Utils::Internal::AsyncJob<QVector<ClangBackEnd::CodeCompletion>,std::function<QVector<ClangBackEnd::CodeCompletion> __cdecl(void)> &>::run+0x8f [qt-creator\src\libs\utils\runextensions.h @ 352] 
      Utils4!Utils::Internal::RunnableThread::run+0x12 [qt-creator\src\libs\utils\runextensions.cpp @ 40] 
      Qt5Core!QThread::start+0x373
      kernel32!BaseThreadInitThunk+0x14
      ntdll!RtlUserThreadStart+0x21
      

      It seems to affect every macro which is defined with parentheses.

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            kandeler Christian Kandeler
            Reporter:
            mkrems Marcel Krems
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes