[clang-tools-extra] c797952 - [clangd] Minor fixes to ExtractVariableTests missed in D124486
David Goldman via cfe-commits
cfe-commits at lists.llvm.org
Tue May 31 08:34:58 PDT 2022
Author: David Goldman
Date: 2022-05-31T11:34:35-04:00
New Revision: c797952d4f012275b2e23f5ffcab1f39eacd184d
URL: https://github.com/llvm/llvm-project/commit/c797952d4f012275b2e23f5ffcab1f39eacd184d
DIFF: https://github.com/llvm/llvm-project/commit/c797952d4f012275b2e23f5ffcab1f39eacd184d.diff
LOG: [clangd] Minor fixes to ExtractVariableTests missed in D124486
Added:
Modified:
clang-tools-extra/clangd/unittests/tweaks/ExtractVariableTests.cpp
Removed:
################################################################################
diff --git a/clang-tools-extra/clangd/unittests/tweaks/ExtractVariableTests.cpp b/clang-tools-extra/clangd/unittests/tweaks/ExtractVariableTests.cpp
index bd06f318b2a9..70ecc202d0b2 100644
--- a/clang-tools-extra/clangd/unittests/tweaks/ExtractVariableTests.cpp
+++ b/clang-tools-extra/clangd/unittests/tweaks/ExtractVariableTests.cpp
@@ -305,22 +305,7 @@ TEST_F(ExtractVariableTest, Test) {
EXPECT_EQ(IO.second, apply(IO.first)) << IO.first;
}
- ExtraArgs = {"-xobjective-c"};
- EXPECT_UNAVAILABLE(R"cpp(
- __attribute__((objc_root_class))
- @interface Foo
- - (void)setMethod1:(int)a;
- - (int)method1;
- @property int prop1;
- @end
- @implementation Foo
- - (void)method {
- [[self.method1]] = 1;
- [[self.method1]] += 1;
- [[self.prop1]] = 1;
- [[self.prop1]] += 1;
- }
- @end)cpp");
+ ExtraArgs = {"-xc"};
InputOutputs = {
// Function Pointers
{R"cpp(struct Handlers {
@@ -345,6 +330,7 @@ TEST_F(ExtractVariableTest, Test) {
void bar() {
int (*placeholder)(int) = foo('c'); (void)placeholder;
})cpp"},
+ // Arithmetic on typedef types yields plain integer types
{R"cpp(typedef long NSInteger;
void varDecl() {
NSInteger a = 2 * 5;
@@ -355,6 +341,28 @@ TEST_F(ExtractVariableTest, Test) {
NSInteger a = 2 * 5;
long placeholder = a * 7; NSInteger b = placeholder + 3;
})cpp"},
+ };
+ for (const auto &IO : InputOutputs) {
+ EXPECT_EQ(IO.second, apply(IO.first)) << IO.first;
+ }
+
+ ExtraArgs = {"-xobjective-c"};
+ EXPECT_UNAVAILABLE(R"cpp(
+ __attribute__((objc_root_class))
+ @interface Foo
+ - (void)setMethod1:(int)a;
+ - (int)method1;
+ @property int prop1;
+ @end
+ @implementation Foo
+ - (void)method {
+ [[self.method1]] = 1;
+ [[self.method1]] += 1;
+ [[self.prop1]] = 1;
+ [[self.prop1]] += 1;
+ }
+ @end)cpp");
+ InputOutputs = {
// Support ObjC property references (explicit property getter).
{R"cpp(__attribute__((objc_root_class))
@interface Foo
More information about the cfe-commits
mailing list