Important: Please read the Qt Code of Conduct -

QtCreator 4.x has incorrect syntax highlighting with Clang code model

  • Has anyone else seen this behavior? I'm seeing things such as all code within a function/method being highlighted as it was a type name, even keywords and local variables, member variables not being highlighted properly all the time, etc.

    Highlighting seems to work fine with the regular code model.

    I've seen this with 4.0 and 4.1 RC1.

  • Lifetime Qt Champion


    You should check the bug report system to see if it's something known.

  • Thanks. I looked at it before, but I'll look a bit closer this time. I probably need to narrow down my search a bit.

  • I looked at the bug report system and couldn't quite find something that matches up. There certainly are issues with the Clang code model.

    The existing issues sometimes have a QtCreator debug log attached. Where do I find the log on Linux? I'd like to know to see if I can either better match up with the issues that I can find or open a new one.

  • Lifetime Qt Champion

    Start Qt Creator from the command line, you'll see what is happening.

    You can also use QtLoggingCategory tom modify what's printed there.

  • @SGaist Ah, thanks for the tip. I usually start it from the command line, so we'll see what I can dig up.

    Curiously, I set up a new project with all new files for experimenting with new features in C++11 (our current compiler here at work only supports C++03, but we're planning on updating our tools soon). I didn't see these errors in the new project, so I wonder if it's something odd with our existing code base or the settings for that code base.

  • Lifetime Qt Champion

    Without knowing the code base it's pretty difficult to guess.

    I'd compare the two projects to see if there's anything different.

  • @SGaist True... I'm going to try to see if I can come up with a simplified project that can reproduce the issue.

    The project where I did not see the issue was just a glorified "Hello world," whereas the one where I do see the issues is my company's code base.

    I'll see if I can somehow boil things down to be reproducible.

Log in to reply