summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang-tools-extra/clangd/unittests/TweakTests.cpp24
1 files changed, 15 insertions, 9 deletions
diff --git a/clang-tools-extra/clangd/unittests/TweakTests.cpp b/clang-tools-extra/clangd/unittests/TweakTests.cpp
index f918b731ba6..c5c5ca07ee4 100644
--- a/clang-tools-extra/clangd/unittests/TweakTests.cpp
+++ b/clang-tools-extra/clangd/unittests/TweakTests.cpp
@@ -398,17 +398,23 @@ TEST(TweakTest, ExtractVariable) {
}
})cpp"},*/
// ensure InsertionPoint isn't inside a macro
- // FIXME: SelectionTree needs to be fixed for macros
- /*{R"cpp(#define LOOP(x) while (1) {a = x;}
+ {R"cpp(#define LOOP(x) while (1) {a = x;}
void f(int a) {
if(1)
LOOP(5 + [[3]])
})cpp",
- R"cpp(#define LOOP(x) while (1) {a = x;}
+ /*FIXME: It should be extracted like this. SelectionTree needs to be
+ * fixed for macros.
+ R"cpp(#define LOOP(x) while (1) {a = x;}
+ void f(int a) {
+ auto dummy = 3; if(1)
+ LOOP(5 + dummy)
+ })cpp"},*/
+ R"cpp(#define LOOP(x) while (1) {a = x;}
void f(int a) {
- auto dummy = 3; if(1)
- LOOP(5 + dummy)
- })cpp"},*/
+ auto dummy = LOOP(5 + 3); if(1)
+ dummy
+ })cpp"},
{R"cpp(#define LOOP(x) do {x;} while(1);
void f(int a) {
if(1)
@@ -426,15 +432,15 @@ TEST(TweakTest, ExtractVariable) {
R"cpp(void f(int a) {
auto dummy = 1; label: [ [gsl::suppress("type")] ] for (;;) a = dummy;
})cpp"},
- // FIXME: Doesn't work because bug in selection tree
- /*{R"cpp(#define PLUS(x) x++
+ // macro testing
+ {R"cpp(#define PLUS(x) x++
void f(int a) {
PLUS([[a]]);
})cpp",
R"cpp(#define PLUS(x) x++
void f(int a) {
auto dummy = a; PLUS(dummy);
- })cpp"},*/
+ })cpp"},
// FIXME: Doesn't work correctly for \[\[clang::uninitialized\]\] int
// b = [[1]]; since the attr is inside the DeclStmt and the bounds of
// DeclStmt don't cover the attribute
OpenPOWER on IntegriCloud