Skip to content
  • Nikolai Kosjar's avatar
    Clang: Add possibility to "pgo-train" libclang with a batch file · ca1d1dfb
    Nikolai Kosjar authored
    
    
    This allows to start Qt Creator in batch processing mode:
    
      $ export QTC_CLANG_BATCH=/path/to/file
      $ export QT_LOGGING_RULES=qtc.clangcodemodel.batch=true
      $ ./qtcreator -load ClangCodeModel
    
    The batch file will be executed and Qt Creator will exit. Advanced
    logging output can be activated as stated above.
    
    Note that it is required that the project was already configured/set up
    properly with the used settingspath, otherwise the wrong configuration
    will be taken or a pop-up dialog will block the execution.
    
    A small example follows that covers all the understood and so far needed
    batch file commands in order to train libclang for profile guided
    optimization. ${PWD} expands to the directory of the batch file.
    
        openProject "${PWD}/calendarwidget.pro"
    
        # Initial parsing
        openDocument "${PWD}/window.cpp"
        closeAllDocuments
        openDocument "${PWD}/window.cpp"
    
        # Reparse
        setCursor 478 1
        insertText " "
        insertText " "
        insertText " "
    
        # Completion
        complete
        complete
        complete
    
        # Member completion
        insertText "comboBox->"
        complete
        complete
        complete
    
        # Wait in order to inspect the result
        processEvents 3000
    
    Change-Id: I7dc5dddc6752272ecc2fb4f30497b17cee3f9a9f
    Reviewed-by: default avatarhjk <hjk@qt.io>
    Reviewed-by: default avatarDavid Schulz <david.schulz@qt.io>
    ca1d1dfb