forked from qt-creator/qt-creator
Workaround for wrong cursor annotated by Clang. Use clang_getCursor in case of the variable used as operator argument to get the proper cursor. Task-number: QTCREATORBUG-20966 Change-Id: Idb195bffc2296f3fae27595cf9c43c9e6b2c5cd0 Reviewed-by: Marco Bubke <marco.bubke@qt.io>
175 lines
1.6 KiB
C++
175 lines
1.6 KiB
C++
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;
|
|
}
|