Details
-
Bug
-
Resolution: Done
-
P2: Important
-
None
-
Qt Creator 4.6.0
-
None
Description
When project with multiple subprojects contains multiple headers with the same name header lookup during initial parsing after opening the project incorrectly chooses which copy of header was included. Precompiled headers usually have the name in each subproject making it quite common. This is causing problems for other functionality like autotest/google test plugin which relies on correctly resolved includes to decide if a source file includes unit test framework and thus could contain unit tests.
I did some debugging and it seems that the same instance of CppSourcePreprocessor gets reused for analyzing all source files. It contains m_fileNameCache for caching header lookups. The cache doesn't expect include directories to change resulting in incorrectly resolved headers. To confirm my theory I tried commenting out cache usage in CppSourceProcessor::resolveFile and it helped but this obviously isn't a proper fix.
To reproduce problem:
1) open the project in attachment, but do not open any source files
2) configure the project and wait until source files are parsed
3) open tools/C+/C+ code model inspector
4) observe that it incorrectly indicates that both proja/sub/a.cpp and projb/sub/b.cpp include the same common.h instead of common.h from corresponding subproject
Attachments
Issue Links
- duplicates
-
QTCREATORBUG-23162 Clang Code Model redirects to a file in another project
-
- Closed
-