Details
-
Suggestion
-
Resolution: Out of scope
-
P2: Important
-
None
-
Qt Creator 4.7.0, Qt Creator 4.8.0-beta1
Description
I started trying out Clang Core Model, since I heard the old one is going to be eventually be removed (note apart: it is a bit of a resource hog, but a quick google shows it's a very common complaint).
There is an issue that is happening all the time for me, and it is becoming too annoying to the point I had to disable the plugin.
When I have simple functions, such as this one:
void test( int width, int height, int depth, int numMipmaps ); void foo() { int width = 0, height = 0, depth = 0, numMipmaps = 0; test( width, height, depth, numMipmaps ); }
It will show up like this:
If I enter a mistake, the old code model would stop highlighting "depth_wrong" because it is invalid:
But with the Clang model, the following happens:
depth_wrong is underlined (nice) but the whole arguments stopped being highlighted!!!
It is very hard to code like this when QtCreator keeps shifting between highlighted and all-black variables as I type. It is very distracting.
The same problem arises when I'm modifying a pre-existing function (specially complex ones): the whole thing flashes to black and now it is very hard what is wrong and what is right; despite the underline.
I understand that Clang has worse error recovery but it sounds like QtCreator still has enough information to show the proper colour, given that autocompletion still works, and so do snippets that come afterwards.
QtCreator could overcome this limitation by:
- Using old information. The correct information was working 10 seconds ago, just fetch old data
- Internally fix those silly errors. depth_wrong is not valid? Replace it int(0), clang will now work
What's wrong is that baseMipLevel & mapType are not defined.
mTextureArrays is declared as:
enum TextureMapType
{
TEXTURE_TYPE_DIFFUSE,
NUM_TEXTURE_TYPES
};
typedef vector<TextureArray>::type TextureArrayVec;
TextureArrayVec mTextureArrays[NUM_TEXTURE_TYPES];
If I replace baseMipLevel with uint8() and mapType with TextureMapType() highlighting works again:
Also considering that even when highlighting is broken "Follow Symbol Under Cursor" still works for black text, it seems like QtCreator still has enough information to keep highlighting working correctly.
Whether it's a QtCreator bug, or an issue on how Clang works, QtCreator should be capable of recovering from such simple errors and greatly enhance as a tool.
Because frankly as it is right now, with such poor error recovery the overall coding productivity decreases, outweighing the benefits.
Cheers
Attachments
Issue Links
- is duplicated by
-
QTCREATORBUG-21123 Regression in C++ Code Model: error in expression prevents all its symbols from being interactive
- Closed
- relates to
-
QTCREATORBUG-20960 Can't navigate to declaration (incomplete AST due errors)
- Closed