/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qt Creator
**
**
** GNU Free Documentation License
**
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of this
** file.
**
**
****************************************************************************/

// **********************************************************************
// NOTE: the sections are not ordered by their logical order to avoid
// reshuffling the file each time the index order changes (i.e., often).
// Run the fixnavi.pl script to adjust the links to the index order.
// **********************************************************************

/*!
    \contentspage {Qt Creator Manual}
    \previouspage creator-diff-editor.html
    \page creator-clang-codemodel.html
    \nextpage creator-finding-overview.html

    \title Parsing C++ Files

    The \e {code model} is the part of an IDE that understands the language you
    are using to write your application. It is the framework that allows \QC
    to provide the following services:

    \list

        \li \l{Completing Code}{Code completion}

        \li Syntactic and \l{Semantic Highlighting}{semantic highlighting}

        \li Navigating in the code by using the \l{Searching with the Locator}
            {locator}, \l{Moving to Symbol Definition or Declaration}
            {following symbols}, and so on

        \li Inspecting code by using the \l{Browsing Project Contents}
            {class browser}, the \l{Viewing QML Types}{outline}, and so on

        \li Diagnostics and \l{Viewing Function Tooltips}{tooltips}

        \li \l{Finding Symbols}{Finding and renaming symbols}

        \li \l{Applying Refactoring Actions}{Refactoring actions}

    \endlist

    An IDE needs a parser for the language and the semantic analyzes.

    \section1 Using Clang Code Model

    The \l{http://clang.llvm.org/}{Clang} project provides libraries for parsing
    C and C++ source files. The feedback you get through warning and
    error markers is the same as a compiler will give you, not an incomplete
    set or a close approximation, as when using the built-in \QC code model.
    Clang focuses on detailed information for diagnostics, which is really
    useful if the code contains typos, for example.

    Clang keeps up with the development of the C++ language. At the time of this
    writing, it supports C++98/03, C++11, C++14, C89, C99, Objective-C, and
    Objective-C++.

    On the downside, for large projects using Clang as code model is slower than
    using the built-in code model. Clang does not need to generate object files,
    but it still needs to parse and analyze the source files. For small projects
    that only use STL, this is relatively fast. But for larger projects that
    include several files, processing a single file and all the included files
    can take a while.

    To make parsing faster, pre-compiled headers are ignored by default. You can
    specify that Clang processes them in \uicontrol {Code Model} options.

    The following services are currently implemented in the experimental Clang
    code model plugin:

    \list

        \li Code completion
        \li Syntactic and semantic highlighting

    \endlist

    To use the plugin, you must build it and configure it in \QC.

    \section2 Building Clang Code Model Plugin

    \list 1

        \li Acquire Clang 3.6.0 or higher in one of the following ways:

            \list

                \li Use the package manager of your system.

                \li Download and install LLVM from the
                    \l{http://llvm.org/releases/}{LLVM Download Page} or
                    \l{http://llvm.org/builds/}{LLVM Snapshot Builds}.

                \li Build Clang by following
                    \l{http://clang.llvm.org/get_started.html}
                    {Getting Started: Building and Running Clang}.

                    Add the following options to the \c cmake call in order to
                    build an optimized version and to specify the installation
                    directory:

                        \c -DCMAKE_BUILD_TYPE=Release
                        \c -DCMAKE_INSTALL_PREFIX=/your/install/dir

                    After building, install with

                        \c {make install}

            \endlist

        \li Set LLVM_INSTALL_DIR to point to the installation directory
            of LLVM either as part of the build environment or pass it directly
            to qmake when you build \QC.

    \li Rerun \c qmake and build \QC.

    \endlist

    \section2 Configuring Clang Code Model Plugin

    \list 1

        \li Select \uicontrol Help > \uicontrol {About Plugins} >
            \uicontrol {C++} > \uicontrol ClangCodeModel to enable the plugin.

        \li Restart \QC to be able to use the plugin.

        \li Select \uicontrol Tools > \uicontrol Options >
            \uicontrol {C++} > \uicontrol {Code Model},
            and select \uicontrol {Use Clang Code Model}.

        \li To process pre-compiled headers before processing any project files,
            deselect the \uicontrol {Ignore pre-compiled headers} check box.

    \endlist

*/
