Files
qt-creator/tests/unit/unittest/unittest.pro
Nikolai Kosjar 8d6549fa74 Clang: Correct member access operator if possible
1 struct Foo { int member; };
 2 void f(Foo *foo)
 3 {
 4     foo.<REQUEST COMPLETION> // correct '.' to '->' and provide results
 5 }

The preferred approach would be to check if "foo" in line 4 is of
pointer type, but there is no suitable cursor (only CompoundStmt) at
that position since the code is usually not yet parsed and thus invalid.

Thus, just run the completion as is. If there are not any results for a
dot completion, re-run the completion with "." exchanged by "->". This
approach is inherently slower than the preferred approach implemented in
the built-in code model.

The following rare cases are not handled:

 1) Requesting completion after white space:
      Works: foo.<COMPLETE HERE>
      Fails: foo. <COMPLETE HERE>

 2) Opening a file and requesting completion (ctrl+space) without prior
    editing. No editing before triggering completion means that no
    unsaved file is generated on the backend side, which is a
    requirement for the correction.

Task-number: QTCREATORBUG-11581
Change-Id: I6bc8e8594778774ab342755fdb01a8a3e5c52ba0
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2016-01-19 13:20:35 +00:00

75 lines
2.2 KiB
Prolog

INCLUDEPATH += ../mockup
include(gmock_dependency.pri)
include(clang_dependency.pri)
include(creator_dependency.pri)
QT += core network testlib widgets
CONFIG += console c++14 testcase
CONFIG -= app_bundle
osx:QMAKE_CXXFLAGS = -stdlib=libc++
DEFINES += \
QT_NO_CAST_FROM_ASCII \
CLANGBACKEND_TESTS \
DONT_CHECK_MESSAGE_COUNTER \
TESTDATA_DIR=\"R\\\"xxx($$PWD/data)xxx\\\"\"
win32-msvc*:QMAKE_CXXFLAGS_WARN_ON -= -w34100 # 'unreferenced formal parameter' in MATCHER_* functions
win32:DEFINES += ECHOSERVER=\"R\\\"xxx($$OUT_PWD/../echo)xxx\\\"\"
unix: DEFINES += ECHOSERVER=\"R\\\"xxx($$OUT_PWD/../echoserver/echo)xxx\\\"\"
SOURCES += \
activationsequencecontextprocessortest.cpp \
activationsequenceprocessortest.cpp \
clangcodecompleteresultstest.cpp \
clangcompletioncontextanalyzertest.cpp \
clangdiagnosticfiltertest.cpp \
clangfixitoperationtest.cpp \
clangipcservertest.cpp \
clangstringtest.cpp \
clientserverinprocesstest.cpp \
clientserveroutsideprocess.cpp \
codecompletionsextractortest.cpp \
codecompletiontest.cpp \
completionchunkstotextconvertertest.cpp \
createtablesqlstatementbuildertest.cpp \
diagnosticsettest.cpp \
diagnostictest.cpp \
fixittest.cpp \
lineprefixertest.cpp \
main.cpp \
projecttest.cpp \
readandwritemessageblocktest.cpp \
sourcelocationtest.cpp \
sourcerangetest.cpp \
spydummy.cpp \
sqlitecolumntest.cpp \
sqlitedatabasebackendtest.cpp \
sqlitedatabasetest.cpp \
sqlitestatementtest.cpp \
sqlitetabletest.cpp \
sqlstatementbuildertest.cpp \
translationunitstest.cpp \
translationunittest.cpp \
unsavedfilestest.cpp \
utf8test.cpp \
senddocumenttrackertest.cpp \
cursortest.cpp \
highlightinginformationstest.cpp \
skippedsourcerangestest.cpp \
highlightingmarksreportertest.cpp \
chunksreportedmonitor.cpp \
temporarymodifiedunsavedfilestest.cpp
HEADERS += \
gtest-qt-printing.h \
mockipclient.h \
mockipcserver.h \
spydummy.h \
matcher-diagnosticcontainer.h \
chunksreportedmonitor.h \
mocksenddocumentannotationscallback.h
OTHER_FILES += $$files(data/*)