Details
-
Bug
-
Resolution: Done
-
Not Evaluated
-
None
-
Qt Creator 4.9.0, Qt Creator 4.10.0-beta2
Description
The clang code model fails to parse any files which include a precompiled header is included using the -include of the compiler.
I can reproduce the problem in both 4.9.0 and 4.10.0-beta2. The problem does not seem to appear in 4.8.2.
When the problem occurs the following error message is printed to the shell, from which the creator has been started:
Parsing [...]/source.cpp failed: CXError_ASTReadError Reparsing [...]/source.cpp failed: 3
Additionally syntax highlighting does not work correctly, and neither does auto completion, making the IDE nearly unusable.
The following CMakeLists.txt reproduces the problem i have reliably. header.h and source.cpp do not need contain any code.
configure_file(header.h ${CMAKE_CURRENT_BINARY_DIR}/precompiled_header.h COPYONLY) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/precompiled_header.h.gch COMMAND ${CMAKE_CXX_COMPILER} -x c++-header ${CMAKE_CURRENT_BINARY_DIR}/precompiled_header.h -o ${CMAKE_CURRENT_BINARY_DIR}/precompiled_header.h.gch BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/precompiled_header.h.gch) add_custom_target(pch ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/precompiled_header.h.gch ) add_library(lib source.cpp) add_dependencies(lib pch) target_include_directories(lib PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) target_compile_options(lib PRIVATE -include "${CMAKE_CURRENT_BINARY_DIR}/precompiled_header.h")