Commit Graph

1714 Commits

Author SHA1 Message Date
Nikolai Kosjar
2992653a4d CppTools: Remove workaround for quotes in defines
...since by now we get the defines in the correct format from
QMakeProject.

See the change this one depends on.

Tested with:

    Qbs:   cpp.defines: [ 'PATH1="/some/path"', "PATH2=\"/some/path\"" ]
    QMake: DEFINES += PATH1=\\\"/some/path\\\" "PATH2=\\\"/some/path\\\""
    CMake: add_definitions(-DPATH1="/some/path" "-DPATH2=\"/some/path\"")

All these lines translate to

    #define PATH1 "/some/path"
    #define PATH2 "/some/path"

for the code model.

Change-Id: Ifc3d3acff3abab6897ccbd0c5fafd5c415dfb53c
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
2015-02-04 09:05:58 +00:00
Christian Kandeler
b6a0dbeec7 CppTools: Make CompilerOptionsBuilder hide intrinsics.
Change-Id: I8b677fc82672ca5fd36bae18480467ef95201dcc
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-02-03 15:19:18 +00:00
hjk
2d81c18028 Test compile fix after 063251eb
Change-Id: I3bf9d65b73a4ab1619c8e48815792f35e2359f45
Reviewed-by: hjk <hjk@theqtcompany.com>
2015-01-30 12:05:22 +00:00
Montel Laurent
063251ebbc Port to new connect api
Change-Id: I873a36601d54065b61d0666558b93dc839ad0dfc
Reviewed-by: hjk <hjk@theqtcompany.com>
2015-01-30 10:40:25 +00:00
Christian Kandeler
f567565d26 CppTools: Filter out "bad" symbols when collecting compiler defines.
Not all defines make sense for non-compilation purposes.

Change-Id: I7c5dd5aaa6de5c8916dfc10eb54ae49efa22959d
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-01-29 12:12:42 +00:00
Orgad Shaneh
8b5dcc13c5 Replace QFileInfo::fileName() with FileName::fileName()
Change-Id: I4852ff215abf25649fc5eac1e922ae901839ca3d
Reviewed-by: hjk <hjk@theqtcompany.com>
2015-01-29 11:15:43 +00:00
Christian Kandeler
e7a18108e1 CppTools: Fix macro collection.
"#define XYZ" does not correspond to "-DXYZ" (which means
"#define XYZ 1"), but to "-DXYZ=".

Change-Id: I3ed44e1457b3df52dc9bdb930ba8f4a04784d207
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-01-27 15:25:23 +00:00
Nikolai Kosjar
93e82d731e CppEditor: Move CppEditorOutline to CppTools
Change-Id: I75768f548f8f914e76fbdeaf3c318c207782fe1b
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2015-01-26 18:15:29 +01:00
Nikolai Kosjar
21e50b2fde CppEditor: Make CppEditorOutline independent of CppEditor plugin
Change-Id: I1cafcd8daf93ffc2f672bf7e2ba5d1c8ea5e8652
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2015-01-26 18:15:25 +01:00
Nikolai Kosjar
cfd3b56187 CppEditor: Move CppEditorWidget::linkToSymbol to CppTools
* Cuts direct dependency to CPlusPlus from cppeditor.h, but
  cppfunctiondecldeflink.h still pulls it in.

* Cuts direct dependency to
  cppeditor.h from cppvirtualfunctionassistprovider.cpp, but it still
  depends on cppeditorconstants.h.

* Cuts direct dependency to cppeditor.h from cppelementevaluator.cpp.

The long-term goal is to make the CppEditor independent from concrete
code model backends.

Change-Id: I291ee0d0da5fc5ed1a839a763fe7be11dcf7a6fb
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2015-01-26 18:15:10 +01:00
Christian Kandeler
ea1efad6f1 CppTools: Support MSVC in CompilerOptionsBuilder.
Needed for clang static analyzer.

Change-Id: I0221b7e87f7b52a4aa5ebf7f4b26c19e584d63e7
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-01-26 17:01:40 +01:00
Nikolai Kosjar
df1bbb07d1 CppTools: Extract base class CppCompletionAssistProcessor
As as side effect, this also brings some more pragma completions for the
builtin-in completion engine, e.g. "pragma once" or "pragma omp atomic".

Change-Id: If3ef22076c331c653b78a87cfff836c1da38c8fb
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
2015-01-21 12:19:12 +01:00
Nikolai Kosjar
6d22df7d3f CppTools: Rename CppCompletionAssistProcessor to InternalCpp...
We will introduce a base class with the name
CppCompletionAssistProcessor.

Change-Id: I74a39d0b14d4ee30d7bd7675ad968e83f377de7f
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
2015-01-21 12:18:51 +01:00
Nikolai Kosjar
046f510e19 CppTools: Fix revision check in CppLocatorData
Bug was exhibited by running e.g.

 ./qtcreator -test CppEditor,test_quickfix_MoveFuncDefOutside_FreeFuncToCppNS \
   -test CppTools,test_cpplocatorfilters_CppLocatorFilter:CppFunctionsFilter-WithNamespacePrefix

Change-Id: I57d96a8f7bf0aea6eb11cb68d1b981808533ce41
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
2015-01-21 09:41:38 +01:00
Nikolai Kosjar
4d3d0e0290 CppTools: Rename EditorDocumentHandle to CppEditorDocumentHandle
...and related functions. For clarity in client code.

Change-Id: Icad6fc7b1eee2ce46a2eba8435359837a23409c8
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
2015-01-14 12:33:15 +01:00
Nikolai Kosjar
845cb2e432 C++: Better names for Scope's iterators
Scope::lastMember() was misleading.

Change-Id: I953d489b8a2a9b86321f73cad3b7b371c4acf91f
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Przemyslaw Gorszkowski <pgorszkowski@gmail.com>
2015-01-14 12:29:37 +01:00
Nikolai Kosjar
d9c70f43d9 CppEditor: Tests: Use QTemporaryDir and avoid writing into creator source tree
This should improve results of CI tests where multiple creator instances
execute the plugin tests.

Change-Id: I557a0964568655662108df201589ba369096f4bf
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
2015-01-14 12:10:39 +01:00
Nikolai Kosjar
71c27ba4cc CppTools: Consider unresolved includes for new include directive position
Now adding a new include directive by the refactoring action will cover
more cases.

This will also help us to simplity the corresponding tests, since it is
not necessary anymore to create actual files.

Change-Id: Id7612b13c392735d6ae1fb2ce3c36169eff3628e
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
2015-01-14 12:07:18 +01:00
Nikolai Kosjar
dbeae8cb43 C++: FastPreprocessor: Add only includes if there are none
For the case that the document is based upon another one (see
Snapshot::preprocessedDocument(), the only client of FastPreprocessor)
the FastPreprocessor added extra unresolved includes.

Change-Id: I0a7719fa8806af59f87a48bc6914270efd653e84
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
2015-01-14 12:07:03 +01:00
Orgad Shaneh
33ae764554 C++: Fix completion for enum inside member functions
Take 2

Task-number: QTCREATORBUG-13757
Change-Id: I9c2558bf01121e53710db984a99d37c2c6cafaf4
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-01-13 18:09:15 +01:00
Eike Ziller
bae5782166 Add locator filter for all included files.
Collects all included files from any file of any project or
that is open in an editor. It has the same shortcut as the
files from any project filter and is also enabled by default.

Task-number: QTCREATORBUG-280
Change-Id: I7cd89ee68d2f8ec4e0ea03de0c11671f489c47dc
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-01-12 15:06:20 +01:00
Orgad Shaneh
c6a983d271 Core: Use FileName for file path in IDocument
Change-Id: I85f7398aee59d0d36f0e5c3bf88ff3c96002e394
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2015-01-12 10:23:37 +01:00
Eike Ziller
b5b47f7df2 Merge remote-tracking branch 'origin/3.3'
Conflicts:
	src/plugins/cppeditor/cppdocumentationcommenthelper.cpp

Change-Id: I2cf25eba1de149765a6c44ad354d606ce9de512d
2015-01-08 10:38:20 +01:00
Christian Stenger
91fabc4868 CppTools: Fix hanging test on OSX
Temporary directory is created in a folder having a symbolic link,
verification was done with the unresolved path and failed.

Change-Id: I40c943a307fe136a0f3f6fdbea5145296a63a19e
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-01-07 15:21:18 +01:00
Nikolai Kosjar
a5e2b4b149 CppTools: Check for valid active target
The active target might be 0 if e.g. there are not kits and a project is
imported.

Task-number: QTCREATORBUG-13730
Change-Id: I48ade507fefc555d1d3f8230ba82c00270fa457b
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2015-01-06 10:19:03 +01:00
Orgad Shaneh
9180555f26 Revert "C++: Fix completion for enum inside member functions"
Breaks loading of qtcreator project.

This reverts commit 4c6ad5e305.

Change-Id: I7c4cdaf57eed16d7643d05b9456e03d5120259b3
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-01-06 10:02:12 +01:00
Orgad Shaneh
4c6ad5e305 C++: Fix completion for enum inside member functions
Task-number: QTCREATORBUG-13757
Change-Id: I283306b0c8348ee82e8e9bf47d404c1ecd473fde
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-01-06 09:34:45 +01:00
Orgad Shaneh
fb396ffbd4 CppTools: Cover all permutations for each enum testcase
* named enum, access by value names
* named enum, access by enum name (C++11)
* anonymous enum

+ Add some failing tests

Task-number: QTCREATORBUG-13757
Change-Id: I7b0a859805a5979c3c886a6dbec703639fb374be
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-01-06 09:23:08 +01:00
Nikolai Kosjar
6cafc424e8 CppTools: Tests: Stop writing into source dir
Instead, always write into a unique temporary directory in
QDir::tempPath().

Where applicable, read the test source from files instead of first
writing the file.

Some clean ups in test_codegen*.

Change-Id: Id48dc50c6ca16252edfd9fc8a86ba0de9f9be486
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
2014-12-19 10:29:16 +01:00
Nikolai Kosjar
cb3c7538be CppTools: Fix flaky test_cpplocatorfilters_CppLocatorFilter
The GenericProjectManager tests left over some state in CppModelManager.

Change-Id: I3f5c5bf27b9443e6753eb6c24114e2e5b99e7372
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
2014-12-19 10:25:03 +01:00
Nikolai Kosjar
b94b7b3ee6 CppTools: Fix test_modelmanager_extraeditorsupport_uiFiles
The test was broken since the QmakeProject was changed to work
asynchronously.

FAIL!  : CppTools::Internal::CppToolsPlugin::test_modelmanager_extraeditorsupport_uiFiles() Compared values are not the same
   Actual   (workingCopy.size()): 1
   Expected (2)                 : 2

Change-Id: I6f7d05fb70af3def5fc371a9783b606309686e32
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
2014-12-19 10:24:55 +01:00
Nikolai Kosjar
ef403a4515 GenericProjectManager: Tests: Clean up
* Get rid of CppModelManagerHelper.
  Now we simply use CppModelManager::projectInfo(someProject).isValid() to
  test whether a project is loaded.

* Copy project data to temporary dir before opening the projects.
  This avoids creating *.user files in the Qt Creator source tree and
  annoying pop ups on test start.

Change-Id: I1a57441ca2099beb6bb96cf620390d669fb47601
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
2014-12-19 10:24:48 +01:00
Nikolai Kosjar
fb8e3b9963 CppTools: Clean up commentssettings
Change-Id: I397195a3e6d8b40a55d2a68429daf6c812f52da2
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
2014-12-19 10:24:26 +01:00
Nikolai Kosjar
205170a9e5 CppTools: Create ProjectInfos explicitly
...instead of going through CppModelManager::projectInfo().

Now CppModelManager::projectInfo() returns an invalid ProjectInfo in
case there is no valid data for the given Project.

Change-Id: I11908bf2ddf865b1d3d71ff176eaf4139292b21c
Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
2014-12-19 10:16:37 +01:00
Eike Ziller
b2bb7ea2da Locator: Shuffle the priorities a bit
Introduce a "Highest" priority for the filters-filter. Keep "Low"
available for lower priority than the default all projects and current
project filter.

Change-Id: I9152d2e6c64b65478416cee18183bce1240ee187
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2014-12-18 12:30:47 +01:00
Erik Verbruggen
7d377850d0 C++: handle case-insensitive file names for project files.
... by keying on Utils::FileName.

Task-number: QTCREATORBUG-12390
Change-Id: Ib99eefcf3440d4383f624a614a3093f427efffbd
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2014-12-18 11:54:12 +01:00
Erik Verbruggen
a48adcf9be C++: handle case-insensitive file names in the CPlusPlus::Snapshot
... by keying on Utils::FileName

Task-number: QTCREATORBUG-12390
Change-Id: Ia98afb5a9160a7fd9225a2f9e02539ff3c35ae86
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2014-12-17 14:32:17 +01:00
Ulf Hermann
4b5d38c8cc C++: Avoid digraph "<:" in template specialization
This translates into "[" on compilers that handle digraphs.

Change-Id: Iba650d6929a1d3850018203b4f8331888ec8a257
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2014-12-15 17:06:05 +01:00
Erik Verbruggen
be4a030696 C++: handle case-insensitive file names in the WorkingCopy
... by keying on Utils::FileName

Task-number: QTCREATORBUG-12390
Change-Id: Ia1a59d2e422b4f92300ac6a8e0e52dd7456a6e70
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2014-12-15 15:58:25 +01:00
Nikolai Kosjar
e3977de08e C++: Finish gcc's include_next support
This implements the actual include_next logic and thus completes

    commit b934cc1
    C++: pass #include_next down to CppPreprocessor::tryIncludeFile

    commmit 140b502
    C++: Highlight argument to gcc's #include_next extension

Based on https://gcc.gnu.org/onlinedocs/cpp/Wrapper-Headers.html

Task-number: QTCREATORBUG-10225
Change-Id: I7eef7f5ea64a114f6d092304d32b72c55c2ce134
Reviewed-by: hjk <hjk121@nokiamail.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
2014-12-15 15:37:36 +01:00
Nikolai Kosjar
ec6c13d02c TextEditor: Make automatic completion timeout configurable
Allow to configure the timeout in the range from 0 to 500ms.

Task-number: QTCREATORBUG-13393
Change-Id: I3e421109db919ab0dd5d63b8cbb9339fce132dbb
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@theqtcompany.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
2014-12-15 15:24:37 +01:00
Nikolai Kosjar
65bb5856d0 CppTools: Do not append '/' to fallback header paths
...since this will confuse the completer.

Task-number: QTCREATORBUG-13567
Change-Id: I4172d433f23f3907690d4c00f92fadb68fa354e8
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2014-12-15 14:33:52 +01:00
Eike Ziller
541d00453a Merge remote-tracking branch 'origin/3.3'
Conflicts:
	qtcreator.pri
	qtcreator.qbs
	src/plugins/projectexplorer/projectexplorer.cpp
	src/shared/qbs

Change-Id: I6d91042bb48314d00be721099aed19feca74e0ce
2014-12-10 13:20:02 +01:00
Nikolai Kosjar
6b894b50e6 CppTools: Remove QTC_ASSERT in CppModelManager::editorDocument()
This fixes

    SOFT ASSERT: "!filePath.isEmpty()" in file
    /home/nik/dev/creator/creator-ut/src/plugins/cpptools/cppmodelmanager.cpp,
    line 467

which can be triggered by e.g. a "git show" document
(onCurrentEditorChanged does not check for an empty file path).

Change-Id: If4ed8e552069b290cb4ac93da52427b7ed2b91e8
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2014-12-03 13:07:58 +01:00
Daniel Teske
4943510b60 Completely rework currentNode/currentProject handling
Centralize the handling inside a new class ProjectTree.
React to moving focus and remove most special handling.

This properly fixes the linked task.

Task-number: QTCREATORBUG-13357
Change-Id: I6b06aa32b1e4305ec8a6d432857b302585d8734b
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2014-12-03 12:36:20 +01:00
Nikolai Kosjar
cb0d136926 CppTools: Update document on activation
...if the project was updated in the meanwhile.

If a project is updated mark invisible editor documents dirty and update
them if they get focus.

This also fixes document highlighting when restoring a session for
documents that the user "switched away" before the project info is
pushed to CppModelManager.

This completes

    CppTools: Update visible documents on project update
    commit c2eb91e053

which only takes care of visible documents.

Task-number: QTCREATORBUG-13270
Change-Id: Id445e7f509deac5d03194aecc54ce4629b7926ce
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
2014-12-03 10:53:39 +01:00
Nikolai Kosjar
9cd552a165 CppTools: Do not offer pointless ")" signature completion
If "Automatically insert matching characters" is activated and '(' is
typed before the semicolon in the declaration

    int f;

we offered the ')' completion, although the ')' was already inserted.

Change-Id: Id5a50fa94c2cb7b5c4056d87028501b0b90afc73
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
2014-12-03 10:37:24 +01:00
Eike Ziller
d341c48246 Merge remote-tracking branch 'origin/3.3' 2014-12-01 15:44:30 +01:00
Nikolai Kosjar
9ccb6b81c9 CppTools: Fix include hierarchy for clang code model
This makes the editor document snapshot accessible through
BaseEditorDocumentProcessor since we need it for the include hierarchy
if the the clang code model is activated.

Task-number: QTCREATORBUG-13553
Change-Id: I7214cc578d05fe5cad6e12b4d29fe6f840a88e8d
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
2014-11-28 14:20:29 +01:00
Nikolai Kosjar
488bf91797 CppTools: Always check for a valid BuiltinEditorDocumentParser*
This fixes a crash if the include hierarchy sidebar is invoked with the
clang code model. BuiltinEditorDocumentParser::get(editorFilePath)
returns 0 in that case.

Task-number: QTCREATORBUG-13553
Change-Id: I9292691c8156bdaaffcac1c3864201ba8a6cbdef
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
2014-11-28 14:20:23 +01:00