Qt Creator Clang Code Model: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
m (Make terminal commands easier to copy&paste)
Line 6: Line 6:
With the following invocation debugging output will be generated:
With the following invocation debugging output will be generated:


Linux/Mac:
Linux/Mac:
  $ export QT_LOGGING_RULES=qtc.clang*=true
  export QT_LOGGING_RULES=qtc.clang*=true
  $ export LIBCLANG_TIMING=1
  export LIBCLANG_TIMING=1
  $ ./qtcreator
  ./qtcreator


Windows (start [https://technet.microsoft.com/en-us/sysinternals/debugview.aspx DebugView] in advance to see the output):
Windows (start [https://technet.microsoft.com/en-us/sysinternals/debugview.aspx DebugView] in advance to see the output):
  $ set LIBCLANG_TIMING=1
  set QT_LOGGING_RULES=qtc.clang*=true
$ set QT_LOGGING_RULES=qtc.clang*=true
  set LIBCLANG_TIMING=1
  $ qtcreator.exe
qtcreator.exe


The debugging output contains among others:
The debugging output contains among others:

Revision as of 09:12, 15 December 2016

Documentation: http://doc.qt.io/qtcreator/creator-clang-codemodel.html

Debugging

With the following invocation debugging output will be generated:

Linux/Mac:

export QT_LOGGING_RULES=qtc.clang*=true
export LIBCLANG_TIMING=1
./qtcreator

Windows (start DebugView in advance to see the output):

set QT_LOGGING_RULES=qtc.clang*=true
set LIBCLANG_TIMING=1
qtcreator.exe

The debugging output contains among others:

  • The IPC messages send/received
  • Output of libclang while parsing

Internal command line

The debugging output from above will contain all the command line options that are passed on to libclang, which is enough for most cases.

However, to see also the resulting internal command line of libclang run:

  1. Switch to projects mode and there to the "Clang Code Model"
  2. Copy some warning configuration by clicking on "Copy...", give it a name like "Debug"
  3. Replace all the options from the copied configuration with "-###"
  4. Close and re-open the editor document - the new debugging output will contain also the internal command line

Note that libclang/clangbackend will crash afterwards, so do not forget to switch back to a sane warning configuration.