From 3aab8beaf4c585e66179f14fac2f63b51f034520 Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Thu, 16 Feb 2012 15:09:56 +0100 Subject: Supply c++11 flags and per-project info to c++ code model. A manual squash/merge of the changes below, plus a couple of subsequent code fixes. 59085aa5fbb99e2d786cd2c1a06c24a111ccb49f: Modify CppModel::ProjectInfo Adding per project node information, to pass on the correct defines/includes for each file, instead of aggregating them incorrectly. Also split up SOURCES and OBJECTIVE_SOURCES. Also ask the toolchain to convert the compilerflags to flags the codemodel understands, for now only gcc and only c++11. Also make the toolchain aware of the flags used to compile, so that it can emit the correct defines. Note: No header files are passed on. 74028802314cd4e75b41b46407433e07090a304d: GCC: Evaluate cxxflags when checking for predefined macros ebaaa4957e4c02cc9637a998eddae1d0acd74f83: MSVC: Take cxxflags into account when checking for predefined macros 9bfce7e889bcf7bcc47bf880e3ea25945ca7d0d7: Compile fixes Change-Id: I9de94ad038dfc5dc1987732e84b13fb4419c96f5 Reviewed-by: Erik Verbruggen --- src/plugins/cpptools/cpptoolsreuse.cpp | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'src/plugins/cpptools/cpptoolsreuse.cpp') diff --git a/src/plugins/cpptools/cpptoolsreuse.cpp b/src/plugins/cpptools/cpptoolsreuse.cpp index 4b7713cf7e..305e84aded 100644 --- a/src/plugins/cpptools/cpptoolsreuse.cpp +++ b/src/plugins/cpptools/cpptoolsreuse.cpp @@ -45,18 +45,31 @@ using namespace CPlusPlus; namespace CppTools { -void moveCursorToEndOfIdentifier(QTextCursor *tc) { +static void moveCursorToStartOrEndOfIdentifier(QTextCursor *tc, + QTextCursor::MoveOperation op, + int posDiff = 0) +{ QTextDocument *doc = tc->document(); if (!doc) return; - QChar ch = doc->characterAt(tc->position()); + QChar ch = doc->characterAt(tc->position() - posDiff); while (ch.isLetterOrNumber() || ch == QLatin1Char('_')) { - tc->movePosition(QTextCursor::NextCharacter); - ch = doc->characterAt(tc->position()); + tc->movePosition(op); + ch = doc->characterAt(tc->position() - posDiff); } } +void moveCursorToEndOfIdentifier(QTextCursor *tc) +{ + moveCursorToStartOrEndOfIdentifier(tc, QTextCursor::NextCharacter); +} + +void moveCursorToStartOfIdentifier(QTextCursor *tc) +{ + moveCursorToStartOrEndOfIdentifier(tc, QTextCursor::PreviousCharacter, 1); +} + static bool isOwnershipRAIIName(const QString &name) { static QSet knownNames; -- cgit v1.2.1