12#include "llvm/ADT/StringMap.h"
13#include "llvm/ADT/StringRef.h"
14#include "gtest/gtest.h"
24TEST_F(AddUsingTest, Prepare) {
27 WithContextValue WithConfig(
Config::Key, std::move(Cfg));
29 const std::string Header = R
"cpp(
30#define NS(name) one::two::name
31namespace ban { void foo() {} }
32namespace banana { void foo() {} }
35template<typename TT> class tt {};
37enum ee { ee_enum_value };
43 cc operator|(const cc& x) const { return x; }
53 "void fun() { o^n^e^:^:^t^w^o^:^:^c^c^:^:^m^m(); }");
55 "void fun() { o^n^e^:^:^t^w^o^:^:^c^c^:^:^s^t inst; }");
57 "void fun() { o^n^e^:^:^t^w^o^:^:^c^c^:^:^s^t inst; }");
62 "template<typename TT> using foo = one::tt<T^T>;");
65 "void fun() { one::two::cc() ^| one::two::cc(); }");
77 #define ID(Y, X) Y;ID2(X)
78 namespace ns { struct Foo{}; }
79 ID(int xyz, ns::F^oo) f;)cpp");
83 ExtraArgs.push_back(
"-xc++-header");
89TEST_F(AddUsingTest, Crash1072) {
92 const char *
Code = R
"cpp(
93 namespace ns { class A; }
105 llvm::StringRef TestSource;
106 llvm::StringRef ExpectedSource;
119namespace {using one::two::ff;
132 ::one::t^wo::cc inst;
137namespace {using ::one::two::cc;
177using one::two::ff;using one::two::ee;
207using one::oo;using one::two::ff;
230namespace {using one::two::ff;
258#define NS_BEGIN(name) namespace name {
268#define NS_BEGIN(name) namespace name {
281#define CALL(name) name()
288#define CALL(name) name()
298namespace foo { void fun(); }
307namespace foo { void fun(); }
331 using NS::foo;using NS::unrelated;
349using ::one::two::ff;using ::one::two::ee;
368using ::one::two::ff;using ::one::two::ee;
387using one::two::ff;using one::two::ee;
417namespace {using two::cc;
443 using yy = one::two::cc;
452 using yy = one::two::cc;
483using one::two::ee::ee_one;
488using one::two::cc;using one::two::ee::ee_one;
519 switch(one::two::ee{}) { case two::ee_^one:break; }
525using one::two::ee_one;
528 switch(one::two::ee{}) { case ee_one:break; }
534 one::f^unc_temp<int>();
556 llvm::StringMap<std::string> EditedFiles;
557 for (
const auto &Case : Cases) {
558 ExtraFiles[
"test.hpp"] = R
"cpp(
566 struct st { struct nested {}; };
571template<typename T> struct vec {};
572template <typename T> void func_temp();
573template <typename T> T var_temp();
576 ExtraArgs.push_back(
"-fno-ms-compatibility");
577 EXPECT_EQ(apply(Case.TestSource, &EditedFiles), Case.ExpectedSource);
std::vector< llvm::unique_function< void(const Params &, Config &) const > > Apply
#define TWEAK_TEST(TweakID)
#define EXPECT_AVAILABLE(MarkedCode)
#define EXPECT_UNAVAILABLE(MarkedCode)
TEST_F(BackgroundIndexTest, NoCrashOnErrorFile)
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
static clangd::Key< Config > Key
Context key which can be used to set the current Config.
struct clang::clangd::Config::@5 Style
Style of the codebase.
std::vector< std::string > FullyQualifiedNamespaces