Unit test: Remove libclang test remains

Change-Id: Ifa2cd2727ecf80d3b29dc2bc2a10af11baa2f1dc
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Christian Kandeler
2022-06-22 14:42:54 +02:00
parent 224be9add8
commit e2b99e6b31
68 changed files with 12 additions and 2355 deletions

View File

@@ -60,7 +60,6 @@ add_qtc_test(unittest GTEST
processevents-utilities.cpp processevents-utilities.h
sizedarray-test.cpp
smallstring-test.cpp
sourcerangecontainer-matcher.h
spydummy.cpp spydummy.h
sqlitealgorithms-test.cpp
sqliteindex-test.cpp
@@ -331,13 +330,6 @@ extend_qtc_test(unittest
locator/ilocatorfilter.cpp locator/ilocatorfilter.h
)
extend_qtc_test(unittest
SOURCES_PREFIX ../../../src/plugins/cppeditor
DEFINES CPPEDITOR_STATIC_LIBRARY
SOURCES
cppprojectfile.cpp cppprojectfile.h
)
get_filename_component(
QMLDOM_STANDALONE_CMAKELISTS
"${CMAKE_CURRENT_SOURCE_DIR}/../../../../qmldom_standalone/src/qmldom/standalone/"

View File

@@ -1,6 +0,0 @@
struct Foo { int member; };
void g(Foo *foo)
{
foo->
}

View File

@@ -1,28 +0,0 @@
#include "complete_forwarding_header_1.h"
void Function()
{
}
class Foo;
void FunctionWithArguments(int i, char *c, const Foo &ref)
{
}
void SavedFunction()
{
}
void f()
{
}

View File

@@ -1,28 +0,0 @@
#include "complete_forwarding_header_2.h"
void Function()
{
}
class Foo;
void FunctionWithArguments(int i, char *c, const Foo &ref)
{
}
void UnsavedFunction()
{
}
#define Macro
int GlobalVariableInUnsavedFile;
void f()
{
int VariableInUnsavedFile;
}

View File

@@ -1,11 +0,0 @@
/**
* A brief comment
*/
void BriefComment()
{
}
void f() {
}

View File

@@ -1,21 +0,0 @@
class Class {};
struct Struct{};
union Union{};
typedef Class TypeDef;
using UsingClass = Class;
template<class T> class TemplateClass{};
template<class T> class ClassTemplatePartialSpecialization;
template<class T> class ClassTemplatePartialSpecialization<T*>;
template<class TemplateTypeParameter, template<class> class TemplateTemplateParameter>
void function()
{
}

View File

@@ -1,22 +0,0 @@
class Constructor {
Constructor();
~Constructor();
void function()
{
}
};

View File

@@ -1,5 +0,0 @@
class Constructor {
Constructor() : {}
int member;
};

View File

@@ -1,22 +0,0 @@
enum Enumeration {
Enumerator
};
void function()
{
}

View File

@@ -1,22 +0,0 @@
void Function();
template<class T> void TemplateFunction();
void FunctionWithOptional(int x, char y = 1, int z = 5);
#define FunctionMacro(X, Y) X + Y
class base {
void NotAccessibleFunction();
};
class Class : public base {
void Method();
void MethodWithParameters(int x = 30);
__attribute__((annotate("qt_slot"))) void Slot();
__attribute__((annotate("qt_signal"))) void Signal();
__attribute__ ((deprecated)) void DeprecatedFunction();
void NotAvailableFunction() = delete;
public:
void function()
{
}
};

View File

@@ -1,22 +0,0 @@
void Function();
template<class T> void TemplateFunction();
#define FunctionMacro(X, Y) X + Y
class base {
void NotAccessibleFunction();
};
class Class : public base {
void Method2();
void MethodWithParameters(int x = 30);
__attribute__((annotate("qt_slot"))) void Slot();
__attribute__((annotate("qt_signal"))) void Signal();
__attribute__ ((deprecated)) void DeprecatedFunction();
void NotAvailableFunction() = delete;
public:
void function()
{
}
};

View File

@@ -1,22 +0,0 @@
void Function();
template<class T> void TemplateFunction();
#define FunctionMacro(X, Y) X + Y
class base {
void NotAccessibleFunction();
};
class Class : public base {
void Method3();
void MethodWithParameters(int x = 30);
__attribute__((annotate("qt_slot"))) void Slot();
__attribute__((annotate("qt_signal"))) void Signal();
__attribute__ ((deprecated)) void DeprecatedFunction();
void NotAvailableFunction() = delete;
public:
void function()
{
}
};

View File

@@ -1,9 +0,0 @@
struct Foo {
Foo(const Foo &foo);
Foo(char c);
};
void f()
{
Foo foo(
}

View File

@@ -1,22 +0,0 @@
namespace Namespace {}
namespace NamespaceAlias = Namespace;
void function()
{
}

View File

@@ -1,5 +0,0 @@
class Foo {
void method();
};
void Foo::m

View File

@@ -1,36 +0,0 @@
void function(int Parameter)
{
int Var = 0;
}
void function2()
{
int Var = 0;
auto Lambda = [&Var]()
{
};
}
class Class {
int Field;
void function() {
}
};
template <int NonTypeTemplateParameter>
void function3() {}
#define MacroDefinition
void function4()
{
#ifdef ArgumentDefinition
int ArgumentDefinitionVariable;
#endif
}

View File

@@ -1,3 +0,0 @@
#pragma once
#include <complete_target_header.h>

View File

@@ -1,3 +0,0 @@
#pragma once
#include <complete_target_header.h>

View File

@@ -1,63 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
namespace std {
template<class Type, class... Args>
class unique_ptr {};
template<class Type, class... Args>
class shared_ptr {
public:
void reset();
Type *operator->();
};
template<class Type, class... Args>
unique_ptr<Type> make_unique(Args&&... args);
template<class Type, class... Args>
shared_ptr<Type> make_shared(Args&&... args);
} // namespace std
template<class Type>
class QSharedPointer
{
public:
template<class... Args>
static QSharedPointer<Type> create(Args&&... args);
};
class Bar
{
public:
Bar();
Bar(int, int);
};
void f2()
{
std::unique_ptr<Bar> bar = std::make_unique<Bar>();
std::shared_ptr<Bar> bar2 = std::make_shared<Bar>();
QSharedPointer<Bar> bar3 = QSharedPointer<Bar>::create();
bar2->
}

View File

@@ -1,3 +0,0 @@
#pragma once
void FunctionInIncludedHeader();

View File

@@ -1,4 +0,0 @@
#pragma once
void FunctionInIncludedHeader();
void FunctionInIncludedHeaderChanged();

View File

@@ -1,4 +0,0 @@
#pragma once
void FunctionInIncludedHeader();
void FunctionInIncludedHeaderUnsaved();

View File

@@ -1,45 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
void function()
{
}
class Foo;
void functionWithArguments(int i, char *c, const Foo &ref)
{
}
void otherFunction()
{
}
void f()
{
}

View File

@@ -1,6 +0,0 @@
struct Bar;
void g(Bar *bar)
{
bar.
}

View File

@@ -1,6 +0,0 @@
struct Foo { int member; };
void g(Foo *foo)
{
foo.
}

View File

@@ -1,6 +0,0 @@
struct Foo { int member; };
void g(Foo *foo)
{
}

View File

@@ -1,6 +0,0 @@
struct Foo { int member; };
void g(Foo *foo)
{
foo.
}

View File

@@ -1,6 +0,0 @@
struct Foo { int member; };
void g(Foo *foo)
{
foo.
}

View File

@@ -1,6 +0,0 @@
struct Foo { int member; };
void g(Foo *foo)
{
}

View File

@@ -1,7 +0,0 @@
struct Bar;
void g(Bar *bar)
{
bar->
// white space preserver
}

View File

@@ -1,7 +0,0 @@
struct Foo { int member; };
void g(Foo *foo)
{
foo->.
}

View File

@@ -1,7 +0,0 @@
struct Foo { int member; };
void g(Foo *foo)
{
foo..
}

View File

@@ -1,4 +0,0 @@
void f()
{
float pi = 3.
}

View File

@@ -1,6 +0,0 @@
struct Foo { int member; };
void g(Foo foo)
{
foo.
}

View File

@@ -1,9 +0,0 @@
struct Foo {
Foo *operator->();
int member;
};
void g(Foo foo)
{
foo.
}

View File

@@ -1,7 +0,0 @@
struct Foo { int member; };
void g(Foo *foo)
{
. // white space preserver
}

View File

@@ -1,41 +0,0 @@
class Constructor {
public:
Constructor() = default;
Constructor(int) {}
};
void testConstructor() {
}
class Base {
virtual void bar(int a) const;
};
class DifferentPriorities : public Base {
public:
void foo();
void foo() const;
void bar(int a) const override;
void testBar() {
}
};
void testPriorities() {
DifferentPriorities d;
d.
}
class LexicographicalSorting
{
public:
void memberFuncBB();
void memberFuncC();
void memberFuncAAA() const;
};
void testLexicographicalSorting() {
LexicographicalSorting ls;
ls.memberFunc
}

View File

@@ -1,147 +0,0 @@
#include "cursor.h"
void function(int x)
{
}
namespace Namespace
{
SuperClass::SuperClass(int x) noexcept
: y(x)
{
int LocalVariable;
}
int SuperClass::Method()
{
Method();
AbstractVirtualMethod(y);
int LocalVariable;
return y;
}
int SuperClass::VirtualMethod(int z)
{
AbstractVirtualMethod(z);
return y;
}
bool SuperClass::ConstMethod() const
{
return y;
}
void SuperClass::StaticMethod()
{
using longint = long long int;
using lint = longint;
lint foo;
foo = 30;
const lint bar = 20;
}
}
template <class T>
void TemplateFunction(T LocalVariableParameter)
{
T LocalVariable;
}
Namespace::SuperClass::operator int() const
{
int LocalVariable;
}
int Namespace::SuperClass::operator ++() const
{
int LocalVariable;
return LocalVariable;
}
Namespace::SuperClass::~SuperClass()
{
int LocalVariable;
}
void Struct::FinalVirtualMethod()
{
}
void f1(Struct *FindFunctionCaller)
{
FindFunctionCaller->FinalVirtualMethod();
}
void f2(){
Struct *s = new Struct;
f1(s);
}
void f3()
{
auto FindFunctionCaller = Struct();
FindFunctionCaller.FinalVirtualMethod();
}
void f4()
{
Struct s;
auto *sPointer = &s;
auto sValue = s;
}
void NonFinalStruct::function()
{
FinalVirtualMethod();
}
void OutputFunction(int &out, int in = 1, const int &in2=2, int *out2=nullptr);
void InputFunction(const int &value);
void f5()
{
int OutputValue;
int InputValue = 20;
OutputFunction(OutputValue);
InputFunction(InputValue);
}
void ArgumentCountZero();
void ArgumentCountTwo(int one, const int &two);
void IntegerValue(int);
void LValueReference(int &);
void ConstLValueReference(const int &);
void PointerToConst(const int *);
void Pointer(int *);
void ConstantPointer(int *const);
void ConstIntegerValue(const int);
void NonFinalStruct::ProtectedMethodAccessSpecifier() {}
extern int ExternVarStorageClass;
static void StaticMethodStorageClass() {}
template<class T> const T &InvalidStorageClass(const T &type) { return type; }
namespace Outer {
namespace {
}
enum {
X, Y
};
}

View File

@@ -1,44 +0,0 @@
namespace Namespace
{
class SuperClass;
/**
* A brief comment
*/
class SuperClass
{
SuperClass() = default;
SuperClass(int x) noexcept;
int Method();
virtual int VirtualMethod(int z);
virtual int AbstractVirtualMethod(int z) = 0;
bool ConstMethod() const;
static void StaticMethod();
operator int() const;
int operator ++() const;
~SuperClass();
private:
int y;
};
}
struct Struct final
{
virtual void FinalVirtualMethod() final;
};
union Union
{
};
struct NonFinalStruct
{
virtual void FinalVirtualMethod() final;
void function();
protected:
void ProtectedMethodAccessSpecifier();
};

View File

@@ -1,8 +0,0 @@
int noReturnValue()
{
}
void f(int)
{
f();
}

View File

@@ -1,5 +0,0 @@
int function()
{
}

View File

@@ -1,2 +0,0 @@
void f() {}

View File

@@ -1,4 +0,0 @@
#include "diagnostic_diagnosticset_header.cpp"
void f() {}

View File

@@ -1,11 +0,0 @@
int warningInHeader()
{
}
void myfun()
{
int i = 0;
if (i = 3) {}
}
errorInHeader;

View File

@@ -1,24 +0,0 @@
#include "diagnostic_erroneous_header.h"
enum Numbers { One, Two, Three };
void f(Numbers n)
{
switch (n) {
case One: return;
case Two: return;
}
}
void g()
{
return 3;
}
void function()
{
int i = 0;
if (i = 3) {}
}

View File

@@ -1,4 +0,0 @@
int function()
{
return 3
}

View File

@@ -1,9 +0,0 @@
int function()
{
}
int function2()
{
/*abcdЙf*/
}

View File

@@ -1,13 +0,0 @@
class XXX
{
};
int function(XXX i)
{
i + 20;
}
struct Foo {
someIdentifierLeadingToInvalidRange;
};

View File

@@ -1,59 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#pragma once
#define TEST_DEFINE 1
namespace Fooish
{
float flvalue = 100.f;
class Bar;
class Bar {
public:
Bar();
volatile int member = 0;
};
struct Barish
{
int foo(float p, int u);
int mem = 10;
};
}
class FooClass;
int foo(const float p, int u);
int foo();
int foo(float p, int u)
{
return foo() + p + u;
}
int foo(int x, float y);

View File

@@ -1,95 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#include "followsymbol_header.h"
#include "cursor.h"
Fooish::Bar::Bar() {
}
class X;
using YYY = Fooish::Bar;
int foo() {
YYY bar;
bar.member = 30;
Fooish::Barish barish;
bar.member++;
barish.mem = Fooish::flvalue;
barish.foo(1.f, 2);
foo(1, 2.f);
return 1;
X* x;
}
int Fooish::Barish::foo(float p, int u)
{
return ::foo() + p + u;
}
class FooClass
{
public:
FooClass();
static int mememember;
};
FooClass::FooClass() {
NonFinalStruct nfStruct; nfStruct.function();
}
int main() {
return foo() + FooClass::mememember + TEST_DEFINE;
}
class Bar
{
public:
int operator&();
Bar& operator[](int);
};
int Bar::operator&() {
return 0;
}
Bar& Bar::operator[](int) {
return *this;
}
struct S {
union {
int i = 12;
void *something;
};
int func(bool b) {
if (b)
return i;
int i = 42;
return i;
}
};

View File

@@ -1,811 +0,0 @@
auto *Variable = "Variable";
auto *u8Variable = u8"Variable";
auto *rawVariable = R"(Variable)";
auto Character = 'c';
auto integer = 1;
auto numFloat = 1.2f;
int function(int x)
{
return x;
}
struct Foo
{
void memberFunction() {}
};
int functionDeclaration(int x);
struct Foo2
{
void memberFunction();
};
void f()
{
function(1);
}
struct ConversionFunction {
operator Foo();
operator int();
};
void TypeReference()
{
Foo foo;
}
void LocalVariableDeclaration()
{
Foo foo;
foo.memberFunction();
}
void LocalVariableFunctionArgument(Foo &foo)
{
foo.memberFunction();
}
struct Foo3 {
int ClassMember;
void ClassMemberReference()
{
ClassMember++;
}
};
struct Foo4
{
void MemberFunctionReference();
void function()
{
MemberFunctionReference();
}
};
struct Foo5
{
void StaticMethod();
void function()
{
Foo5::StaticMethod();
}
};
enum Enumeration
{
Enumerator
};
void f2()
{
Enumeration enumeration;
enumeration = Enumerator;
}
class ForwardReference;
class Class
{ public:
Class();
~Class();
};
ForwardReference *f3()
{
Class ConstructorReference;
return 0;
}
union Union
{
};
Union UnionDeclarationReference;
namespace NameSpace {
struct StructInNameSpace {};
}
namespace NameSpaceAlias = NameSpace;
using NameSpace::StructInNameSpace;
NameSpace::StructInNameSpace foo6;
class BaseClass {
public:
virtual void VirtualFunction();
virtual void FinalVirtualFunction();
};
void f8()
{
BaseClass NonVirtualFunctionCall;
NonVirtualFunctionCall.VirtualFunction();
BaseClass *NonVirtualFunctionCallPointer = new BaseClass();
NonVirtualFunctionCallPointer->VirtualFunction();
}
class DerivedClass : public BaseClass
{public:
void VirtualFunction() override;
void FinalVirtualFunction() final;
};
void f8(BaseClass *VirtualFunctionCallPointer)
{
VirtualFunctionCallPointer->VirtualFunction();
}
class FinalClass final : public DerivedClass
{
void FinalClassThisCall();
};
void f8(DerivedClass *FinalVirtualFunctionCallPointer)
{
FinalVirtualFunctionCallPointer->FinalVirtualFunction();
}
void f9(BaseClass *NonFinalVirtualFunctionCallPointer)
{
NonFinalVirtualFunctionCallPointer->FinalVirtualFunction();
}
void f10(FinalClass *ClassFinalVirtualFunctionCallPointer)
{
ClassFinalVirtualFunctionCallPointer->VirtualFunction();
}
class Operator {
public:
Operator operator+=(const Operator &first);
};
Operator operator+(const Operator &first, const Operator &second);
void f10()
{
auto PlusOperator = Operator() + Operator();
Operator PlusAssignOperator;
PlusAssignOperator += Operator();
}
/* Comment */
#define PreprocessorDefinition Class
#define MacroDefinition(a,b) ((a)>(b)?(a):(b))
void f11()
{
MacroDefinition(2, 4);
}
#include "highlightingmarks.h"
void f12() {
GOTO_LABEL:
goto GOTO_LABEL;
}
template <class T>
void TemplateFunction(T v)
{
T XXXXX = v;
}
void TemplateReference()
{
TemplateFunction(1);
// std::vector<int> TemplateIntance;
}
template <class T>
class TemplateFoo {};
template <class TemplateTypeParameter = Foo, int NonTypeTemplateParameter = 1, template <class> class TemplateTemplateParameter = TemplateFoo>
void TemplateFunction(TemplateTypeParameter TemplateParameter)
{
TemplateTypeParameter TemplateTypeParameterReference;
auto NonTypeTemplateParameterReference = NonTypeTemplateParameter;
TemplateTemplateParameter<TemplateTypeParameter> TemplateTemplateParameterReference;
}
void FinalClass::FinalClassThisCall()
{
VirtualFunction();
}
void OutputArgument(int &one, const int &two, int *three=0);
void f12b()
{
int One;
OutputArgument(One, 2);
}
#include <highlightingmarks.h>
#define FOREACH(variable, container) \
variable; \
auto x = container;
#define foreach2 FOREACH
void f13()
{
auto container = 1;
foreach2(int index, container);
}
class SecondArgumentInMacroExpansionIsField {
int container = 1;
void f()
{
foreach2(int index, container);
}
};
typedef unsigned uint32;
enum EnumerationType : uint32
{
Other = 0,
};
struct TypeInCast {
void function();
};
void f14()
{
static_cast<void (TypeInCast::*)()>(&TypeInCast::function);
reinterpret_cast<void (TypeInCast::*)()>(&TypeInCast::function);
}
using IntegerAlias = int;
using SecondIntegerAlias = IntegerAlias;
typedef int IntegerTypedef;
using Function = void (*)();
void f15()
{
IntegerAlias integerAlias;
SecondIntegerAlias secondIntegerAlias;
IntegerTypedef integerTypedef;
Function();
}
class FriendFoo
{
public:
friend class FooFriend;
friend bool operator==(const FriendFoo &first, const FriendFoo &second);
};
class FieldInitialization
{
public:
FieldInitialization() :
member(0)
{}
int member;
};
template<class Type>
void TemplateFunctionCall(Type type)
{
type + type;
}
void f16()
{
TemplateFunctionCall(1);
}
template <typename T>
class TemplatedType
{
T value = T();
};
void f17()
{
TemplatedType<int> TemplatedTypeDeclaration;
}
void f18()
{
auto value = 1 + 2;
}
class ScopeClass
{
public:
static void ScopeOperator();
};
void f19()
{
ScopeClass::ScopeOperator();
}
namespace TemplateClassNamespace {
template<class X>
class TemplateClass
{
};
}
void f20()
{
TemplateClassNamespace::TemplateClass<ScopeClass> TemplateClassDefinition;
}
void f21()
{
typedef int TypeDefDeclaration;
TypeDefDeclaration TypeDefDeclarationUsage;
}
typedef int EnumerationTypeDef;
enum Enumeration2 : EnumerationTypeDef {
};
struct Bar {
Bar &operator[](int &key);
};
void argumentToUserDefinedIndexOperator(Bar object, int index = 3)
{
object[index];
}
struct LambdaTester
{
int member = 0;
void func() {
const int var = 42, var2 = 84;
auto lambda = [var, this](int input) {
return var + input + member;
};
lambda(var2);
}
};
void NonConstReferenceArgument(int &argument);
void f22()
{
int x = 1;
NonConstReferenceArgument(x);
}
void ConstReferenceArgument(const int &argument);
void f23()
{
int x = 1;
ConstReferenceArgument(x);
}
void RValueReferenceArgument(int &&argument);
void f24()
{
int x = 1;
RValueReferenceArgument(static_cast<int&&>(x));
}
void NonConstPointerArgument(int *argument);
void f25()
{
int *x;
NonConstPointerArgument(x);
}
void PointerToConstArgument(const int *argument);
void ConstPointerArgument(int *const argument);
void f26()
{
int *x;
PointerToConstArgument(x);
ConstPointerArgument(x);
}
void NonConstReferenceArgumentCallInsideCall(int x, int &argument);
int GetArgument(int x);
void f27()
{
int x = 1;
NonConstReferenceArgumentCallInsideCall(GetArgument(x), x);
}
void f28(int &Reference)
{
NonConstReferenceArgument(Reference);
}
void f29()
{
int x;
NonConstPointerArgument(&x);
}
struct NonConstPointerArgumentAsMemberOfClass
{
int member;
};
void f30()
{
NonConstPointerArgumentAsMemberOfClass instance;
NonConstReferenceArgument(instance.member);
}
struct NonConstReferenceArgumentConstructor
{
NonConstReferenceArgumentConstructor() = default;
NonConstReferenceArgumentConstructor(NonConstReferenceArgumentConstructor &other);
void NonConstReferenceArgumentMember(NonConstReferenceArgumentConstructor &other);
};
void f31()
{
NonConstReferenceArgumentConstructor instance;
NonConstReferenceArgumentConstructor copy(instance);
}
struct NonConstReferenceMemberInitialization
{
NonConstReferenceMemberInitialization(int &foo)
: foo(foo)
{}
int &foo;
};
template<class T> class Coo;
template<class T> class Coo<T*>;
namespace N { void goo(); }
using N::goo;
#if 1
#endif
#include <new>
struct OtherOperator { void operator()(int); };
void g(OtherOperator o, int var)
{
o(var);
}
void NonConstPointerArgument(int &argument);
struct PointerGetterClass
{
int &getter();
};
void f32()
{
PointerGetterClass x;
NonConstPointerArgument(x.getter());
}
namespace N { template <typename T> void SizeIs(); }
using N::SizeIs;
void BaseClass::VirtualFunction() {}
class WithVirtualFunctionDefined {
virtual void VirtualFunctionDefinition() {};
};
namespace NFoo { namespace NBar { namespace NTest { class NamespaceTypeSpelling; } } }
Undeclared u;
#define Q_PROPERTY(arg) static_assert("Q_PROPERTY", #arg); // Keep these in sync with wrappedQtHeaders/QtCore/qobjectdefs.h
#define SIGNAL(arg) #arg
#define SLOT(arg) #arg
class Property {
Q_PROPERTY(const volatile unsigned long long * prop READ getProp WRITE setProp NOTIFY propChanged)
Q_PROPERTY(const QString str READ getStr)
};
struct X {
void operator*(int) {}
};
void operator*(X, float) {}
void CallSite() {
X x;
int y = 10;
float z = 10;
x * y;
x * z;
}
struct Dummy {
Dummy operator<<=(int key);
Dummy operator()(int a);
int& operator[] (unsigned index);
void* operator new(unsigned size);
void operator delete(void* ptr);
void* operator new[](unsigned size);
void operator delete[](void* ptr);
};
void TryOverloadedOperators(Dummy object)
{
object <<= 3;
Dummy stacked;
stacked(4);
stacked[1];
int *i = new int;
Dummy* use_new = new Dummy();
delete use_new;
Dummy* many = new Dummy[10];
delete [] many;
}
enum {
Test = 0
};
namespace {
class B {
struct {
int a;
};
};
}
struct Dummy2 {
Dummy2 operator()();
int operator*();
Dummy2 operator=(int foo);
};
void TryOverloadedOperators2(Dummy object)
{
Dummy2 dummy2;
dummy2();
*dummy2;
dummy2 = 3;
}
int OperatorTest() {
return 1 < 2 ? 20 : 30;
}
int signalSlotTest() {
SIGNAL(something(QString));
SLOT(something(QString));
SIGNAL(something(QString (*func1)(QString)));
1 == 2;
}
class NonConstParameterConstructor
{
NonConstParameterConstructor() = default;
NonConstParameterConstructor(NonConstParameterConstructor &buildDependenciesStorage);
void Call()
{
NonConstParameterConstructor foo;
NonConstParameterConstructor bar(foo);
}
};
class StaticMembersAccess
{
protected:
static int protectedValue;
private:
static int privateValue;
};
template <int i, int j> struct S { };
template <int i> using spec = S<i, 1>;
spec<2> s;
class Property {
Q_PROPERTY(
const
volatile
unsigned
long
long
*
prop
READ
getProp
WRITE
setProp
NOTIFY
propChanged
)
};
void structuredBindingTest() {
const int a[] = {1, 2};
const auto [x, y] = a;
}
#define ASSIGN(decl, ptr) do { decl = *ptr; } while (false)
#define ASSIGN2 ASSIGN
void f4()
{
int *thePointer = 0;
ASSIGN(int i, thePointer);
ASSIGN2(int i, thePointer);
}
const int MyConstant = 8;
void f5()
{
int arr[MyConstant][8];
}
static int GlobalVar = 0;
namespace N { [[deprecated]] void f(); }
template<typename T>
void func(T v);
void f6()
{
GlobalVar = 5;
func(1); // QTCREATORBUG-21856
}
template<typename T>
void func(T v) {
GlobalVar = 5;
}
static std::vector<std::pair<int, int>> pv;
template <class T, long S>
struct vecn
{
T v[S];
};
template <class T, long S>
static inline constexpr vecn<T, S> operator<(vecn<T, S> a, vecn<T, S> b)
{
vecn<T, S> x = vecn<T, S>{};
for(long i = 0; i < S; ++i)
{
x[i] = a[i] < b[i];
}
return x;
}
const char *cyrillic = "б";
struct foo {
#define blubb
};
#define test_micro(A,B) ((A##B>1?A:B))
int a = (a1 > 0);
int func() {
int a = (a1 > 0);
}
namespace std {
template<typename T1, typename T2> struct pair;
template<typename T> struct vector;
}
static std::vector<std::pair<int, int>> pvr;

View File

@@ -1,27 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#include <vector>

View File

@@ -1,174 +0,0 @@
void variableSingleReference()
{
int foo;
}
int variableMultipleReferences()
{
int foo = 0;
return foo;
}
class Foo {};
void bla()
{
Foo foo;
}
namespace N { class Bar {}; }
namespace N { class Baz {}; }
N::Bar bar;
namespace G { class App {}; }
using G::App;
class Hoo;
void f(const Hoo &);
class Moo {};
void x()
{
new Moo;
}
class Element {};
template<typename T> struct Wrap { T member; };
void g()
{
Wrap<Element> con;
con.member;
}
template<typename T>
struct Wrapper {
T f()
{
int foo;
++foo;
return mem;
}
T mem;
};
template<typename T>
void f()
{
T mem;
mem.foo();
}
struct Woo {
Woo();
~Woo();
};
int muu();
int muu(int);
struct Doo {
int muu();
int muu(int);
};
template<typename T> int tuu();
int tuu(int);
struct Xoo {
template<typename T> int tuu();
int tuu(int);
};
enum ET { E1 };
bool e(ET e)
{
return e == E1;
}
struct LData { int member; };
void lambda(LData foo) {
auto l = [bar=foo] { return bar.member; };
}
template<class T> class Coo;
template<class T> class Coo<T*>;
template<> class Coo<int>;
template<typename T> typename T::foo n()
{
typename T::bla hello;
}
int rec(int n = 100)
{
return n == 0 ? 0 : rec(--n);
}
#define FOO 3
int objectLikeMacro()
{
return FOO;
}
#define BAR(x) x
int functionLikeMacro(int foo)
{
return BAR(foo);
}
template<class T>
class Container
{
public:
T &operator[](int); T &operator()(int, int);
};
int testOperator() {
Container<int> vec;
int n = 10;
vec[n] = n * 100;
vec(n, n) = 100;
}

View File

@@ -1,19 +0,0 @@
#if 0
void f();
#endif
#ifndef BLAH
class Class
{
};
#endif
#ifdef BLAH
class Class
{
};
#endif

View File

@@ -1,3 +0,0 @@
void function(int x)
{
}

View File

@@ -1,212 +0,0 @@
void f(int foo, const int *cfoo)
{
foo++;
cfoo++;
}
struct Foo { int member = 0; };
int g(const Foo &foo)
{
return foo.member;
const Foo bar;
bar;
}
struct Bar { virtual ~Bar(); int mem(){} virtual int virtualConstMem() const; };
void h(const Foo &foo, Bar &bar)
{
g(foo);
bar.mem();
bar.virtualConstMem();
}
template <typename T>
void t(int foo) { (void)foo; }
void c()
{
t<Foo>(3);
}
/**
* \brief This is a crazy function.
*/
void documentedFunction();
void d()
{
documentedFunction();
}
enum EnumType { V1, V2, Custom = V2 + 5 };
EnumType e()
{
return EnumType::Custom;
}
template <typename T> struct Baz { T member; };
void t2(const Baz<int> &b) {
Baz<int> baz; baz = b;
}
#include "tooltipinfo.h"
#define MACRO_FROM_MAINFILE(x) x + 3
void foo()
{
MACRO_FROM_MAINFILE(7);
MACRO_FROM_HEADER(7);
}
namespace N { struct Muu{}; }
namespace G = N;
void o()
{
using namespace N;
Muu muu; (void)muu;
}
void n()
{
using namespace G;
Muu muu; (void)muu;
}
void q()
{
using N::Muu;
Muu muu; (void)muu;
}
struct Sizes
{
char memberChar1;
char memberChar2;
};
enum class FancyEnumType { V1, V2 };
union Union
{
char memberChar1;
char memberChar2;
};
namespace X {
namespace Y {
}
}
template<typename T> struct Ptr {};
struct Nuu {};
typedef Ptr<Nuu> PtrFromTypeDef;
using PtrFromTypeAlias = Ptr<Nuu>;
template<typename T> using PtrFromTemplateTypeAlias = Ptr<T>;
void y()
{
PtrFromTypeDef b; (void)b;
PtrFromTypeAlias a; (void)a;
PtrFromTemplateTypeAlias<Nuu> c; (void)c;
}
template <typename T> struct Zii {};
namespace U { template <typename T> struct Yii {}; }
void mc()
{
using namespace U;
Zii<int> zii; (void) zii;
Yii<int> yii; (void) yii;
}
namespace A { struct X {}; }
namespace B = A;
void ab()
{
B::X x; (void)x;
}
namespace N {
struct Outer
{
template <typename T> struct Inner {};
Inner<int> inner;
};
}
void f();
namespace R { void f(); }
void f(int param);
void z(int = 1);
void user()
{
f();
R::f();
f(1);
z();
}
void autoTypes()
{
auto a = 3; (void)a;
auto b = EnumType::V1; (void)b;
auto c = Bar(); (void)c;
auto d = Zii<int>(); (void)d;
}
struct Con {};
struct ExplicitCon {
ExplicitCon() = default;
ExplicitCon(int m) :member(m) {}
int member;
};
void constructor()
{
Con();
ExplicitCon();
ExplicitCon(2);
}
Nuu **pointers(Nuu **p1)
{
return p1;
}
static constexpr int calcValue() { return 1 + 2; }
const auto val = calcValue() + sizeof(char);
const int zero = 0;
static void func()
{
const int i = 5;
const int j = i;
}

View File

@@ -1,3 +0,0 @@
#define MACRO_FROM_HEADER(x) x + \
x + \
x

View File

@@ -1,8 +0,0 @@
#include "translationunits.h"
#include "some/unresolved/file.h"
void function()
{
}

View File

@@ -1,3 +0,0 @@
#pragma once
void FunctionInIncludedHeader();

View File

@@ -1,3 +0,0 @@
#include "uicheader.h"
static UicObject o;

View File

@@ -1,67 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#pragma once
#include "googletest.h"
using testing::PrintToString;
namespace {
MATCHER_P4(IsSourceRange, startLine, startColumn, endLine, endColumn,
std::string(negation ? "isn't" : "is")
+ "[(" + PrintToString(startLine)
+ ", " + PrintToString(startColumn)
+ "), (" + PrintToString(endLine)
+ ", " + PrintToString(endColumn)
+ ")]"
)
{
return arg.start.line == uint(startLine)
&& arg.start.column == uint(startColumn)
&& arg.end.line == uint(endLine)
&& arg.end.column == uint(endColumn);
}
MATCHER_P5(IsSourceRangeWithText, startLine, startColumn, endLine, endColumn, text,
std::string(negation ? "isn't " : "is ")
+ "((" + PrintToString(startLine)
+ ", " + PrintToString(startColumn)
+ "), (" + PrintToString(endLine)
+ ", " + PrintToString(endColumn)
+ "), " + PrintToString(text)
+ ")"
)
{
return arg.start.line == uint(startLine)
&& arg.start.column == uint(startColumn)
&& arg.end.line == uint(endLine)
&& arg.end.column == uint(endColumn)
&& arg.text.toCarriageReturnsStripped() == text;
}
}

View File

@@ -15,9 +15,6 @@ Project {
FileInfo.relativePath(project.ide_source_tree, sourceDirectory))
install: false
Depends { name: "libclang"; required: false }
Depends { name: "clang_defines" }
Depends { name: "QmlDesigner"; required: false }
Depends { name: "sqlite_sources" }
@@ -39,7 +36,6 @@ Project {
"QT_RESTRICTED_CAST_FROM_ASCII",
"QT_USE_FAST_OPERATOR_PLUS",
"QT_USE_FAST_CONCATENATION",
"CPPEDITOR_STATIC_LIBRARY",
"UNIT_TESTS",
"DONT_CHECK_MESSAGE_COUNTER",
'QTC_RESOURCE_DIR="' + path + "/../../../share/qtcreator" + '"',
@@ -47,9 +43,6 @@ Project {
'RELATIVE_DATA_PATH="' + FileInfo.relativePath(destinationDirectory,
FileInfo.joinPaths(project.sourceDirectory, "share", "qtcreator")) + '"',
];
if (libclang.present) {
defines.push("CLANG_UNIT_TESTS");
}
var absLibExecPath = FileInfo.joinPaths(qbs.installRoot, qbs.installPrefix,
qtc.ide_libexec_path);
var relLibExecPath = FileInfo.relativePath(destinationDirectory, absLibExecPath);
@@ -76,47 +69,18 @@ Project {
return flags;
}
cpp.cxxLanguageVersion: "c++17"
cpp.dynamicLibraries: {
var libs = [];
if (libclang.present) {
libs = libs.concat(libclang.llvmLibs);
if (libclang.llvmFormattingLibs.length
&& (!qbs.targetOS.contains("windows") || libclang.llvmBuildModeMatches)) {
libs = libs.concat(libclang.llvmFormattingLibs);
}
}
return libs;
}
cpp.includePaths: {
var paths = [
".",
"../mockup",
"../../../src/libs",
"../../../src/libs/3rdparty",
"../../../src/plugins",
"../../../src/plugins/clangcodemodel",
"../../../share/qtcreator/qml/qmlpuppet/types",
];
if (libclang.present) {
paths.push(libclang.llvmIncludeDir);
}
return paths;
}
cpp.libraryPaths: {
var paths = [];
if (libclang.present)
paths.push(libclang.llvmLibDir);
return paths;
}
cpp.rpaths: {
var paths = [
FileInfo.joinPaths(project.buildDirectory, qtc.ide_library_path),
FileInfo.joinPaths(project.buildDirectory, qtc.ide_plugin_path)
];
if (libclang.present)
paths.push(libclang.llvmLibDir);
return paths;
}
cpp.includePaths: [
".",
"../mockup",
"../../../src/libs",
"../../../src/libs/3rdparty",
"../../../src/plugins",
"../../../share/qtcreator/qml/qmlpuppet/types",
]
cpp.rpaths: [
FileInfo.joinPaths(project.buildDirectory, qtc.ide_library_path),
FileInfo.joinPaths(project.buildDirectory, qtc.ide_plugin_path)
]
files: [
"compare-operators.h",
@@ -147,7 +111,6 @@ Project {
"processevents-utilities.h",
"sizedarray-test.cpp",
"smallstring-test.cpp",
"sourcerangecontainer-matcher.h",
"spydummy.cpp",
"spydummy.h",
"sqlitecolumn-test.cpp",
@@ -179,18 +142,8 @@ Project {
name: "data"
files: [
"data/*",
"data/include/*",
]
fileTags: []
}
Group {
name: "sources from cppeditor"
prefix: "../../../src/plugins/cppeditor/"
files: [
"cppprojectfile.cpp",
"cppprojectfile.h",
]
}
}
}