forked from qt-creator/qt-creator
Clang: Fallback to global completion if function call completion fails
We can not offer proper constructor completion with libclang <= 3.6, so fall back to normal/global completion. Change-Id: I90bb8d981ae20ed4c228f829ad4267221b92f8a1 Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
This commit is contained in:
@@ -20,5 +20,6 @@
|
||||
<file>exampleIncludeDir/otherFile.h</file>
|
||||
<file>exampleIncludeDir/mylib/mylib.h</file>
|
||||
<file>globalCompletion.cpp</file>
|
||||
<file>constructorCompletion.cpp</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
@@ -874,6 +874,15 @@ void ClangCodeCompletionTest::testCompleteFunctions()
|
||||
QVERIFY(hasItem(t.proposal, "TType<QString> f(bool)"));
|
||||
}
|
||||
|
||||
void ClangCodeCompletionTest::testCompleteConstructorAndFallbackToGlobalCompletion()
|
||||
{
|
||||
ProjectLessCompletionTest t("constructorCompletion.cpp");
|
||||
|
||||
QVERIFY(hasItem(t.proposal, "globalVariable"));
|
||||
QVERIFY(hasItem(t.proposal, "GlobalClassWithCustomConstructor"));
|
||||
QVERIFY(!hasSnippet(t.proposal, "class"));
|
||||
}
|
||||
|
||||
void ClangCodeCompletionTest::testProjectDependentCompletion()
|
||||
{
|
||||
const TestDocument testDocument("completionWithProject.cpp");
|
||||
|
||||
@@ -57,6 +57,7 @@ private slots:
|
||||
void testCompleteGlobals();
|
||||
void testCompleteMembers();
|
||||
void testCompleteFunctions();
|
||||
void testCompleteConstructorAndFallbackToGlobalCompletion();
|
||||
|
||||
void testProjectDependentCompletion();
|
||||
void testChangingProjectDependentCompletion();
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
int globalVariable;
|
||||
|
||||
struct GlobalClassWithCustomConstructor {
|
||||
GlobalClassWithCustomConstructor(int) {}
|
||||
};
|
||||
|
||||
void f() {
|
||||
GlobalClassWithCustomConstructor foo( /* COMPLETE HERE */
|
||||
}
|
||||
Reference in New Issue
Block a user