...which was least buggy.
The bugs fixed by the changes we revert here (highlighting/completion
for code involving templates) were minor compared to ones we currently
have. Those bugs will be addressed by the clang code model anyway.
Relevant commits were collected via:
$ cd ${QTC}/src/libs/cplusplus
$ git log \
--no-merges \
--format=oneline \
v3.4.2..HEAD \
-- LookupContext.* ResolveExpression.* TypeResolver.* TypeOfExpression.* \
../../plugins/cpptools/cppcompletion_test.cpp
From this list the following were skipped due to irrelevance:
88c5b47e53 # CppTools: Minor cleanup in completion tests
e5255a1f5c # CppTools: Add a test for ObjC not replacing dot with arrow
5b12c8d63a # CppTools: Support ObjC in member access operator tests
9fef4fb9ca # CPlusPlus: Fix warnings about overriding visit(...) methods
There were only minor conflicts while reverting those.
This changes touches so many files because there were quite some
cleanups and renames after the 3.4.2 release.
Task-number: QTCREATORBUG-14889
Task-number: QTCREATORBUG-15211
Task-number: QTCREATORBUG-15213
Task-number: QTCREATORBUG-15257
Task-number: QTCREATORBUG-15264
Task-number: QTCREATORBUG-15291
Task-number: QTCREATORBUG-15329
Change-Id: I01f759f8f35ecb4228928a4f22086e279c1a5435
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
For the function
auto foo() -> @Foo {}
whereas '@' denotes the cursor position, we detected the expression
under cursor as "foo() -> Foo" and tried to resolve the member "Foo"
within the type of "foo()".
ExpressionUnderCursor can't detect whether we are on a trailing return
type since it only looks at the tokens. Thus, check also the AST.
Task-number: QTCREATORBUG-13096
Change-Id: Ifc14e402fb70e722940e5fa13f1eaaa9973362e4
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
Mostly done using the following ruby script:
Dir.glob('**/*.cpp').each { |file|
next if file =~ %r{src/shared/qbs|/qmljs/}
s = File.read(file)
s.scan(/^using namespace (.*);$/) {
ns = $1
t = s.gsub(/^(.*)\b#{ns}::((?!Const)[A-Z])/) { |m|
before = $1
char = $2
if before =~ /"|\/\/|\\|using|SIGNAL|SLOT|Q_/
m
else
before + char
end
}
if t != s
puts file
File.open(file, 'w').write(t)
end
}
}
Change-Id: I6fbe13ddc1485efe95c3156097bf41d90c0febac
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
* 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>
... and some of the related implementation details
Change-Id: I1f03aa5acf2d3fb2cfc2a6a7845f3d3578b0408d
Reviewed-by: David Schulz <david.schulz@digia.com>
Replace the CppModelManagerInterface/derived CppModelManager
combo by a more common CppModelManager/CppModelManagerPrivate
pimpl pattern.
Change-Id: Ia4582845ed94d5ef60b8571bab9b2260c6290287
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
That is, if the user does Ctrl+LeftClick or (Ctrl+E,) F2, but not on
hover.
The described bug in the report occurred because we immediately jump to
an item if there is only one, e.g. in case of no overrides. That could
also happen on hover, which lead to the undesired effect.
Change-Id: I79f6fa1f90d37ea209da022d55d48aab2c13c21a
Task-number: QTCREATORBUG-12986
Reviewed-by: David Schulz <david.schulz@digia.com>
They do not really depend on CppEditorWidget and will be re-used in a
follow-up change.
CppEditorWidget::identifierUnderCursor()
CppEditorWidget::findCanonicalMacro()
Change-Id: I553bb68694fb4b5f1baa331debf33ae234e3dedf
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
There was document(), textDocument() and baseTextDocument().
Two should be enough...
Change-Id: Id9e41c8d857c5cb3269a9fce5ab594d34448c982
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
The base pattern is FooEditor for BaseTextEditor derived classes
and FooEditorWidget for BaseTextEditorWidget derived classes. So:
CPPEditorWidget -> CppEditorWidget
CPPEditorWidgetPrivate -> CppEditorWidgetPrivate
...::EditorWidget -> PythonEditorWidget
GLSLTextEditorWidget -> GlslEditorWidget
GLSLEditorEditable -> GlslEditor
Change-Id: I76d34a3694c2fb35491982d86e83f7e4774c0be6
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
...from the semantic info before trying to use it.
Just after opening a file and using Follow Symbol the semantic document
might not be yet calculated.
Change-Id: I62deaf86415a2e2b0d7f1285f90bdcd9b5925a2e
Reviewed-by: Nikita Baryshnikov <nib952051@gmail.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
The condition didn't make sense. tk.kind() can't be < T_FIRST_QT_KEYWORD
*and* tk.kind() > T_LAST_KEYWORD at the same time.
Change-Id: Id300ad84f37eeff5081b0389c00d574a9cb23f35
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
In most cases we need to work with the utf16 indices. Only in
cppfindreferences the byte interface is still needed since there we read
in files and work on a QByteArray to save memory.
Change-Id: I6ef6a93fc1875a8c9a305c075d51a9ca034c41bb
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* Consolidate code dealing with C++ identifiers into cpptoolsreuse.h
* Handle code points that are represented with two QChars
Change-Id: I4fb4435aa539f65d88598cac0b50629f33f32440
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
...especially in CppTools/CppEditor where the offsets are used with a
QString/QTextDocument.
Change-Id: Ic6d18fbc01fb9cc899a9bd2d7424cd2edae487f1
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
This will avoid confusion when later more length and indices methods are
added.
In Token:
length() --> bytes()
begin() --> bytesBegin()
end() --> bytesEnd()
Change-Id: I244c69b022e239ee762b4114559e707f93ff344f
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Doesn't really make sense to have the additional IDocument *editorDocument()
method.
Change-Id: I0a7420eb1afaa76f63c3f7e9c4b373acf624ffb9
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
Required for correct resolving of first virtual appearance
Change-Id: I2307027f769fb2f4c0942f4aa4e0d2b5327562b5
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
This takes too much memory. For qtcreator.pro the numbers are as
follows:
Patch applied: ~ 1600MB (RES)
Patch reverted: ~ 510MB (RES)
This reverts commit 4c2daa90ce.
Task-number: QTCREATORBUG-10973
Change-Id: I843bd7c1ea4a26a1ec55ddc14c2a34a98d040922
Reviewed-by: hjk <hjk121@nokiamail.com>
Reviewed-by: Robert Loehning <robert.loehning@digia.com>
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
This adds definitions for the macros __FILE__, __LINE__, __DATE__ and
__TIME__ on demand.
As a side effect, this also introduces highlighting for the uses of
these macros.
Task-number: QTCREATORBUG-8036
Change-Id: Ib7546c7d45d2eecbc50c7883fc684e3497154405
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
Reviewed-by: hjk <hjk121@nokiamail.com>
If the cursor is at the end of the virtual function name but before '('
then scope is a function.
Task-number: QTCREATORBUG-10294
Change-Id: I83699d3fa33bc0f33d6524fa6d84cfc2b9e71f85
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
...when searching the overrides for virtual functions.
In case there is no override for the static type of a function call
expression, make sure to:
1) include the last provided override (look up bases)
2) and all overrides whose classes are derived from that static type
Task-number: QTCREATORBUG-10470
Change-Id: I2c01bfdc6cb35c5a01a000ebd81a2b322ce2b795
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
- Moves the findMatchingClassDeclaration() call from
FollowSymbolUnderCursor::findLink into VirtualFunctionsAssistProcessor
since we already have a SymbolFinder there
- Make canLookupVirtualFunctionOverrides a class member because we plan
to add some methods
- Better parameter names/order for FunctionHelper::overrides()
Change-Id: I0a93ff5445352d47e808adad45485e520f06946e
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
...when using the mouse (Ctrl + Hover).
Task-number: QTCREATORBUG-10480
Change-Id: Ifac5cf7859e724da910a2f7b2fcecd901eca5e13
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
...when using the mouse (Ctrl + Left click).
Task-number: QTCREATORBUG-10479
Change-Id: I54a21c449d8bb8e608d383752beb3b31c9c81783
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>