forked from qt-creator/qt-creator
Clang: Provide highlighting for identifier under cursor
Change-Id: I80ffe23cbcc84ab7323124581d9dd6afbe974fd0 Reviewed-by: Marco Bubke <marco.bubke@qt.io>
This commit is contained in:
159
tests/unit/unittest/data/references.cpp
Normal file
159
tests/unit/unittest/data/references.cpp
Normal file
@@ -0,0 +1,159 @@
|
||||
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);
|
||||
}
|
||||
Reference in New Issue
Block a user