[clang-tools-extra] r366568 - [Clangd] Fixed ExtractVariable test
Shaurya Gupta via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 19 05:11:05 PDT 2019
Author: sureyeaah
Date: Fri Jul 19 05:11:04 2019
New Revision: 366568
URL: http://llvm.org/viewvc/llvm-project?rev=366568&view=rev
Log:
[Clangd] Fixed ExtractVariable test
Modified:
clang-tools-extra/trunk/clangd/unittests/TweakTests.cpp
Modified: clang-tools-extra/trunk/clangd/unittests/TweakTests.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/unittests/TweakTests.cpp?rev=366568&r1=366567&r2=366568&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/unittests/TweakTests.cpp (original)
+++ clang-tools-extra/trunk/clangd/unittests/TweakTests.cpp Fri Jul 19 05:11:04 2019
@@ -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
More information about the cfe-commits
mailing list