Hello,

When using the Clang Code Model in QtCreator, it turned out that having
the C system include dirs can make it report false positives for most
uses on the STL. This is due to the order the Clang Code Model looks at
the include directories and some C includes in /usr/include could be
incompatible with the used STL if found first.

For further details on how this is currently processed within QtCreator and 
how the issue shows up on my computer, you can take a look at this issue:
https://bugreports.qt.io/browse/QTCREATORBUG-16432

It got a previous fix earlier, but it looks like I am in a loophole which 
requires slight adjustment of the previous commit by Tobias Hunger.

I've been successfully using the attached patch for the last two weeks now. 
Obviously I'd like to see it merged upstream instead of having this locally 
only. It looks trivial enough to me, but please let me know if something needs 
to be changed with it which I didn't spot.

Regards.
-- 
Kévin Ottens, http://ervin.ipsquad.net

KDAB - proud supporter of KDE, http://www.kdab.com

From=20017a5f63d4175a8b0853982daec99945a7374263 Mon Sep 17 00:00:00 2001
From: Kevin Ottens <er...@kde.org>
Date: Wed, 17 Aug 2016 22:45:06 +0200
Subject: [PATCH] QtCreator integration: C++ includes must come first

When using the Clang Code Model in QtCreator, it turned out that having
the C system include dirs can make it report false positives for most
uses on the STL. This is due to the order the Clang Code Model looks at
the include directories and some C includes in /usr/include could be
incompatible with the used STL if found first.
---
 Source/cmExtraCodeBlocksGenerator.cxx | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx
index 0ded17a..cd4b9ce 100644
--- a/Source/cmExtraCodeBlocksGenerator.cxx
+++ b/Source/cmExtraCodeBlocksGenerator.cxx
@@ -595,7 +595,7 @@ void cmExtraCodeBlocksGenerator::AppendTarget(
                           includes.end());
 
     std::string systemIncludeDirs = makefile->GetSafeDefinition(
-      "CMAKE_EXTRA_GENERATOR_C_SYSTEM_INCLUDE_DIRS");
+      "CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_INCLUDE_DIRS");
     if (!systemIncludeDirs.empty()) {
       std::vector<std::string> dirs;
       cmSystemTools::ExpandListArgument(systemIncludeDirs, dirs);
@@ -603,7 +603,7 @@ void cmExtraCodeBlocksGenerator::AppendTarget(
     }
 
     systemIncludeDirs = makefile->GetSafeDefinition(
-      "CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_INCLUDE_DIRS");
+      "CMAKE_EXTRA_GENERATOR_C_SYSTEM_INCLUDE_DIRS");
     if (!systemIncludeDirs.empty()) {
       std::vector<std::string> dirs;
       cmSystemTools::ExpandListArgument(systemIncludeDirs, dirs);
-- 
2.9.2

Attachment: signature.asc
Description: This is a digitally signed message part.

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to