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

Clang Code Model redirects to a file in another project

    XMLWordPrintable

Details

    • Linux/X11, Windows

    Description

      I have 2 clones of the same project:

      • cpp-projects/project-a-clone1
      • cpp-projects/project-a-clone2

      I have opened each project in Qt Creator, never at the same time and in 2 different sessions.

      When I navigate the code using Ctrl+click I can end up in files of the other project.

      The most recent case is:

      1. Open cpp-projects/project-a-clone1 in Qt Creator
      2. Open cpp-projects/project-a-clone1/myclass.h
      3. Ctrl+Click (or F2) on the definition of the constructor MyClass()
      4. Qt Creator opens cpp-projects/project-a-clone2/myclass.h and set the cursor to the definition of the class (class MyClass)
      5. Qt Creator also shows a warning: "This file is not part of any project. The code model might have issues to parse this file properly."
      6. In cpp-projects/project-a-clone2/myclass.h, I Ctrl+Click (or F2) on the definition of the constructor MyClass()
      7. Qt Creator opens cpp-projects/project-a-clone2/myclass.cpp and brings me to the definition of the constructor

      To summarize, navigation does not work inside the opened project, but works in the project that is not opened.

      I noticed this first on a large project on Linux and I was able to reproduce it with a minimal project on Windows. To create it I did:

       

      1. Create "project-a" folder and "project-a/project-a.pro" in Windows explorer.
      2. Opened Qt Creator, create and open a new Session
      3. Open project-a.pro
      4. Add main.cpp and MyClass
      5. Close Qt Creator
      6. Make a copy of project-a folder named project-a-other
      7. Remove project-a.pro.user  from project-a-other
      8. Open Qt Creator
      9. Create and open a new session
      10. Open project-a-other/project-a.pro
      11. Use F2 on MyClass => Qt Creator opens project-a/myclass.h instead of project-a-other/myclass.h

      See "sample.zip"

       

      When using "Find References to Symbol Under Cursor" the search results will show results from both projects.

       

      On Linux, after I removed from disk one of the 2 projects, when trying to F2 to the definition, Qt Creator gives me an error message box saying that the cpp file from the deleted clone is missing. Even after I restarted my computer. I had to delete the content of ~/.cache/QtProject/QtCreator to make it work.

       

      Notes Also I have experienced issues with the code model on multiples project when pressing F2 or using Ctrl+Click.
      Like nothing happening, or Qt Creators navigating to someplace where a function is used instead of where it is defined.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              bterrier Benjamin Terrier
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: