Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Fix for build error "member access into incomplete type 'const clang::FileEntry'"



  • The fix:

    diff --git a/src/tools/clangrefactoringbackend/source/sourcelocationsutils.h b/src/tools/clangrefactoringbackend/source/sourcelocationsutils.h
    index 45bc71f..6304523 100644
    --- a/src/tools/clangrefactoringbackend/source/sourcelocationsutils.h
    +++ b/src/tools/clangrefactoringbackend/source/sourcelocationsutils.h
    @@ -30,6 +30,7 @@
     #include <sourcerangescontainer.h>
     
     #include <clang/Basic/SourceManager.h>
    +#include <clang/Basic/FileManager.h>
     #include <clang/Lex/Lexer.h>
     #include <llvm/Support/FileSystem.h>
     #include <llvm/Support/FileUtilities.h>
    

    The error:

    In file included from src/tools/clangrefactoringbackend/source/collectsymbolsaction.cpp:26:
    In file included from src/tools/clangrefactoringbackend/source/collectsymbolsaction.h:29:
    In file included from src/tools/clangrefactoringbackend/source/indexdataconsumer.h:32:
    In file included from src/tools/clangrefactoringbackend/source/symbolsvisitorbase.h:28:
    src/tools/clangrefactoringbackend/source/sourcelocationsutils.h:90:76: error: member access into incomplete type 'const clang::FileEntry'
            auto filePath = FilePath::fromNativeFilePath(absolutePath(fileEntry->getName()));
                                                                               ^
    In file included from src/tools/clangrefactoringbackend/source/collectsymbolsaction.cpp:26:
    In file included from src/tools/clangrefactoringbackend/source/collectsymbolsaction.h:29:
    In file included from src/tools/clangrefactoringbackend/source/indexdataconsumer.h:32:
    In file included from src/tools/clangrefactoringbackend/source/symbolsvisitorbase.h:28:
    In file included from src/tools/clangrefactoringbackend/source/sourcelocationsutils.h:32:
    In file included from include/clang/Basic/SourceManager.h:37:
    In file included from include/clang/Basic/Diagnostic.h:19:
    include/clang/Basic/SourceLocation.h:356:7: note: forward declaration of 'clang::FileEntry'
    class FileEntry;
          ^
    In file included from src/tools/clangrefactoringbackend/source/collectsymbolsaction.cpp:26:
    In file included from src/tools/clangrefactoringbackend/source/collectsymbolsaction.h:29:
    In file included from src/tools/clangrefactoringbackend/source/indexdataconsumer.h:32:
    src/tools/clangrefactoringbackend/source/symbolsvisitorbase.h:66:36: error: member access into incomplete type 'const clang::FileEntry'
                uint fileId = fileEntry->getUID();
                                       ^
    In file included from src/tools/clangrefactoringbackend/source/collectsymbolsaction.cpp:26:
    In file included from src/tools/clangrefactoringbackend/source/collectsymbolsaction.h:29:
    In file included from src/tools/clangrefactoringbackend/source/indexdataconsumer.h:32:
    In file included from src/tools/clangrefactoringbackend/source/symbolsvisitorbase.h:28:
    In file included from src/tools/clangrefactoringbackend/source/sourcelocationsutils.h:32:
    In file included from include/clang/Basic/SourceManager.h:37:
    In file included from include/clang/Basic/Diagnostic.h:19:
    include/clang/Basic/SourceLocation.h:356:7: note: forward declaration of 'clang::FileEntry'
    class FileEntry;
          ^
    In file included from src/tools/clangrefactoringbackend/source/collectsymbolsaction.cpp:26:
    In file included from src/tools/clangrefactoringbackend/source/collectsymbolsaction.h:29:
    In file included from src/tools/clangrefactoringbackend/source/indexdataconsumer.h:32:
    src/tools/clangrefactoringbackend/source/symbolsvisitorbase.h:76:38: error: member access into incomplete type 'const clang::FileEntry'
                auto filePath = fileEntry->getName();
                                         ^
    In file included from src/tools/clangrefactoringbackend/source/collectsymbolsaction.cpp:26:
    In file included from src/tools/clangrefactoringbackend/source/collectsymbolsaction.h:29:
    In file included from src/tools/clangrefactoringbackend/source/indexdataconsumer.h:32:
    In file included from src/tools/clangrefactoringbackend/source/symbolsvisitorbase.h:28:
    In file included from src/tools/clangrefactoringbackend/source/sourcelocationsutils.h:32:
    In file included from include/clang/Basic/SourceManager.h:37:
    In file included from include/clang/Basic/Diagnostic.h:19:
    include/clang/Basic/SourceLocation.h:356:7: note: forward declaration of 'clang::FileEntry'
    class FileEntry;
          ^
    3 errors generated.
    

    Cheers!




  • Lifetime Qt Champion

    @TBRZ In src/tools/clangrefactoringbackend/source/sourcelocationsutils.h you need to include header file containing FileEntry



  • @jsulm Hey, yes I'm aware of that. I didn't want to go through the pain of setting up accounts for such a minor diff.
    If possible please fix this in master.


  • Lifetime Qt Champion

    @TBRZ said in Fix for build error "member access into incomplete type 'const clang::FileEntry'":

    If possible please fix this in master.

    Please create a bug ticket in Qt bug tracker.



  • @jsulm I get internal error, maintenance messages and connection hanging up etc, when I open http://bugreports.qt.io/


  • Lifetime Qt Champion

    @TBRZ Try later then




  • Lifetime Qt Champion

    @TBRZ said in Fix for build error "member access into incomplete type 'const clang::FileEntry'":

    @jsulm Hey, yes I'm aware of that. I didn't want to go through the pain of setting up accounts for such a minor diff.
    If possible please fix this in master.

    You already have an account :-)
    You just need to send your patch to Gerrit :-)



  • @SGaist I appreciate the welcoming gesture. If I was not occupied with some deadlines, I'll definitely do so. But going through the wiki page for gerrit is daunting.

    I came here for help about https://forum.qt.io/topic/118454/how-to-enable-clangrefactoring-and-clangpchmanager-plugin/1 and thought now that I'm here, I might as well notify the developers about a problem.


  • Lifetime Qt Champion

    @TBRZ said in Fix for build error "member access into incomplete type 'const clang::FileEntry'":

    notify the developers about a problem

    This is user forum. If you want to communicate with developers you should either use bug tracker or the mailing list.