struct brokenfile_t {
brokenfile_t (N::
- // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:6:20 %s -o - | FileCheck %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-1):20 %s -o - | FileCheck %s
// CHECK: SFoo
int test() {
[]() {
- // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:13:1 %s -o - \
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-1):1 %s -o - \
// RUN: | FileCheck %s
// CHECK: priv (InBase,Inaccessible)
// CHECK: prot (InBase)
class Y : public X {
int test() {
this->pub = 10;
- // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:21:11 %s -o - \
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-1):11 %s -o - \
// RUN: | FileCheck -check-prefix=THIS %s
// THIS: priv (InBase,Inaccessible)
// THIS: prot (InBase)
// THIS: pub (InBase)
//
// Also check implicit 'this->', i.e. complete at the start of the line.
- // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:21:1 %s -o - \
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-8):1 %s -o - \
// RUN: | FileCheck -check-prefix=THIS %s
X().pub + 10;
- // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:32:9 %s -o - \
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-1):9 %s -o - \
// RUN: | FileCheck -check-prefix=X-OBJ %s
// X-OBJ: priv (Inaccessible)
// X-OBJ: prot (Inaccessible)
// X-OBJ: pub : [#int#]pub
Y().pub + 10;
- // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:39:9 %s -o - \
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-1):9 %s -o - \
// RUN: | FileCheck -check-prefix=Y-OBJ %s
// Y-OBJ: priv (InBase,Inaccessible)
// Y-OBJ: prot (InBase)
this->X::pub = 10;
X::pub = 10;
- // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:46:14 %s -o - \
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-2):14 %s -o - \
// RUN: | FileCheck -check-prefix=THIS-BASE %s
//
// THIS-BASE: priv (Inaccessible)
// THIS-BASE: prot : [#int#]prot
// THIS-BASE: pub : [#int#]pub
//
- // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:47:8 %s -o - \
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-8):8 %s -o - \
// RUN: | FileCheck -check-prefix=THIS-BASE %s
this->Unrelated::pub = 10; // a check we don't crash in this cases.
Y().Unrelated::pub = 10; // a check we don't crash in this cases.
Unrelated::pub = 10;
- // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:59:22 %s -o - \
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-3):22 %s -o - \
// RUN: | FileCheck -check-prefix=UNRELATED %s
// UNRELATED: priv (Inaccessible)
// UNRELATED: prot (Inaccessible)
// UNRELATED: pub : [#int#]pub
//
- // RUN: not %clang_cc1 -fsyntax-only -code-completion-at=%s:60:20 %s -o - \
+ // RUN: not %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-8):20 %s -o - \
// RUN: | FileCheck -check-prefix=UNRELATED %s
- // RUN: not %clang_cc1 -fsyntax-only -code-completion-at=%s:61:16 %s -o - \
+ // RUN: not %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-9):16 %s -o - \
// RUN: | FileCheck -check-prefix=UNRELATED %s
}
};
class Inner {
int test() {
Outer::pub = 10;
- // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:85:14 %s -o - \
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-1):14 %s -o - \
// RUN: | FileCheck -check-prefix=OUTER %s
// OUTER: priv : [#int#]priv
// OUTER: prot : [#int#]prot
// OUTER: pub : [#int#]pub
// Also check the unqualified case.
- // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:85:1 %s -o - \
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-8):1 %s -o - \
// RUN: | FileCheck -check-prefix=OUTER %s
}
};
class Test : public Accessible, public Inaccessible {
int test() {
this->Accessible::pub = 10;
- // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:112:23 %s -o - \
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-1):23 %s -o - \
// RUN: | FileCheck -check-prefix=ACCESSIBLE %s
// ACCESSIBLE: pub (InBase)
this->Inaccessible::pub = 10;
- // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:117:25 %s -o - \
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-1):25 %s -o - \
// RUN: | FileCheck -check-prefix=INACCESSIBLE %s
// INACCESSIBLE: pub (InBase,Inaccessible)
}
struct A {
A() = default;
- // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:2:9 -std=gnu++11 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:%(line-1):9 -std=gnu++11 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
// CHECK-CC1: COMPLETION: default
// CHECK-CC1-NEXT: COMPLETION: delete
A(const A &) = default;
- // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:7:18 -std=gnu++11 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:%(line-1):18 -std=gnu++11 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s
// CHECK-CC2: COMPLETION: default
// CHECK-CC2-NEXT: COMPLETION: delete
A(const A &, int) = delete;
- // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:12:23 -std=gnu++11 %s -o - | FileCheck -check-prefix=CHECK-CC3 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:%(line-1):23 -std=gnu++11 %s -o - | FileCheck -check-prefix=CHECK-CC3 %s
// CHECK-CC3-NOT: COMPLETION: default
// CHECK-CC3: COMPLETION: delete
A(A &&);
A &operator=(const A &) = default;
- // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:19:29 -std=gnu++11 %s -o - | FileCheck -check-prefix=CHECK-CC4 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:%(line-1):29 -std=gnu++11 %s -o - | FileCheck -check-prefix=CHECK-CC4 %s
// CHECK-CC4: COMPLETION: default
// CHECK-CC4-NEXT: COMPLETION: delete
bool operator==(const A &) const = delete;
- // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:24:38 -std=gnu++11 %s -o - | FileCheck -check-prefix=CHECK-CC5 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:%(line-1):38 -std=gnu++11 %s -o - | FileCheck -check-prefix=CHECK-CC5 %s
// CHECK-CC5-NOT: COMPLETION: default
// CHECK-CC5: COMPLETION: delete
- // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:24:38 -std=gnu++20 %s -o - | FileCheck -check-prefix=CHECK-CC6 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:%(line-5):38 -std=gnu++20 %s -o - | FileCheck -check-prefix=CHECK-CC6 %s
// CHECK-CC6: COMPLETION: default
// CHECK-CC6-NEXT: COMPLETION: delete
void test() = delete;
- // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:33:17 -std=gnu++11 %s -o - | FileCheck -check-prefix=CHECK-CC7 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:%(line-1):17 -std=gnu++11 %s -o - | FileCheck -check-prefix=CHECK-CC7 %s
// CHECK-CC7-NOT: COMPLETION: default
// CHECK-CC7: COMPLETION: delete
};
A::A(A &&) = default;
-// RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:39:14 -std=gnu++11 %s -o - | FileCheck -check-prefix=CHECK-CC8 %s
+// RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:%(line-1):14 -std=gnu++11 %s -o - | FileCheck -check-prefix=CHECK-CC8 %s
// CHECK-CC8: COMPLETION: default
// CHECK-CC8-NEXT: COMPLETION: delete
void test() = delete;
-// RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:44:15 -std=gnu++11 %s -o - | FileCheck -check-prefix=CHECK-CC9 %s
+// RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:%(line-1):15 -std=gnu++11 %s -o - | FileCheck -check-prefix=CHECK-CC9 %s
// CHECK-CC9-NOT: COMPLETION: default
// CHECK-CC9: COMPLETION: delete
\ No newline at end of file
int a [[gnu::used]];
-// RUN: %clang_cc1 -code-completion-at=%s:1:9 %s | FileCheck --check-prefix=STD %s
+// RUN: %clang_cc1 -code-completion-at=%s:%(line-1):9 %s | FileCheck --check-prefix=STD %s
// STD: COMPLETION: Pattern : __carries_dependency__
// STD-NOT: COMPLETION: Pattern : __convergent__
// STD: COMPLETION: Pattern : __gnu__::__used__
// STD: COMPLETION: Pattern : gnu::alias(<#Aliasee#>)
// STD: COMPLETION: Pattern : gnu::used
// STD-NOT: COMPLETION: Pattern : used
-// RUN: %clang_cc1 -code-completion-at=%s:1:9 -xobjective-c++ %s | FileCheck --check-prefix=STD-OBJC %s
+// RUN: %clang_cc1 -code-completion-at=%s:%(line-17):9 -xobjective-c++ %s | FileCheck --check-prefix=STD-OBJC %s
// STD-OBJC: COMPLETION: Pattern : clang::called_once
-// RUN: %clang_cc1 -code-completion-at=%s:1:14 %s | FileCheck --check-prefix=STD-NS %s
+// RUN: %clang_cc1 -code-completion-at=%s:%(line-19):14 %s | FileCheck --check-prefix=STD-NS %s
// STD-NS-NOT: COMPLETION: Pattern : __used__
// STD-NS-NOT: COMPLETION: Pattern : carries_dependency
// STD-NS-NOT: COMPLETION: Pattern : clang::convergent
// STD-NS-NOT: COMPLETION: Pattern : gnu::used
// STD-NS: COMPLETION: Pattern : used
int b [[__gnu__::used]];
-// RUN: %clang_cc1 -code-completion-at=%s:27:18 %s | FileCheck --check-prefix=STD-NSU %s
+// RUN: %clang_cc1 -code-completion-at=%s:%(line-1):18 %s | FileCheck --check-prefix=STD-NSU %s
// STD-NSU: COMPLETION: Pattern : __used__
// STD-NSU-NOT: COMPLETION: Pattern : used
int c [[using gnu: used]];
-// RUN: %clang_cc1 -code-completion-at=%s:32:15 %s | FileCheck --check-prefix=STD-USING %s
+// RUN: %clang_cc1 -code-completion-at=%s:%(line-1):15 %s | FileCheck --check-prefix=STD-USING %s
// STD-USING: COMPLETION: __gnu__
// STD-USING: COMPLETION: _Clang
// STD-USING-NOT: COMPLETION: Pattern : carries_dependency
// STD-USING-NOT: COMPLETION: Pattern : clang::
// STD-USING-NOT: COMPLETION: Pattern : gnu::
// STD-USING: COMPLETION: gnu
-// RUN: %clang_cc1 -code-completion-at=%s:32:20 %s | FileCheck --check-prefix=STD-NS %s
+// RUN: %clang_cc1 -code-completion-at=%s:%(line-9):20 %s | FileCheck --check-prefix=STD-NS %s
int d __attribute__((used));
-// RUN: %clang_cc1 -code-completion-at=%s:43:22 %s | FileCheck --check-prefix=GNU %s
+// RUN: %clang_cc1 -code-completion-at=%s:%(line-1):22 %s | FileCheck --check-prefix=GNU %s
// GNU: COMPLETION: Pattern : __carries_dependency__
// GNU: COMPLETION: Pattern : __convergent__
// GNU-NOT: COMPLETION: Pattern : __gnu__::__used__
#pragma clang attribute push (__attribute__((internal_linkage)), apply_to=variable)
int e;
#pragma clang attribute pop
-// RUN: %clang_cc1 -code-completion-at=%s:56:46 %s | FileCheck --check-prefix=PRAGMA %s
+// RUN: %clang_cc1 -code-completion-at=%s:%(line-3):46 %s | FileCheck --check-prefix=PRAGMA %s
// PRAGMA: COMPLETION: Pattern : internal_linkage
#ifdef MS_EXT
int __declspec(thread) f;
-// RUN: %clang_cc1 -fms-extensions -DMS_EXT -code-completion-at=%s:63:16 %s | FileCheck --check-prefix=DS %s
+// RUN: %clang_cc1 -fms-extensions -DMS_EXT -code-completion-at=%s:%(line-1):16 %s | FileCheck --check-prefix=DS %s
// DS-NOT: COMPLETION: Pattern : __convergent__
// DS-NOT: COMPLETION: Pattern : __used__
// DS-NOT: COMPLETION: Pattern : clang::convergent
// DS: COMPLETION: Pattern : uuid
[uuid("123e4567-e89b-12d3-a456-426614174000")] struct g;
-// RUN: %clang_cc1 -fms-extensions -DMS_EXT -code-completion-at=%s:73:2 %s | FileCheck --check-prefix=MS %s
+// RUN: %clang_cc1 -fms-extensions -DMS_EXT -code-completion-at=%s:%(line-1):2 %s | FileCheck --check-prefix=MS %s
// MS-NOT: COMPLETION: Pattern : __uuid__
// MS-NOT: COMPLETION: Pattern : clang::convergent
// MS-NOT: COMPLETION: Pattern : convergent
{}
}
// FIXME: support for omp attributes would be nice.
-// RUN: %clang_cc1 -fopenmp -code-completion-at=%s:84:5 %s | FileCheck --check-prefix=OMP-NS --allow-empty %s
+// RUN: %clang_cc1 -fopenmp -code-completion-at=%s:%(line-4):5 %s | FileCheck --check-prefix=OMP-NS --allow-empty %s
// OMP-NS-NOT: COMPLETION: omp
-// RUN: %clang_cc1 -fopenmp -code-completion-at=%s:84:10 %s | FileCheck --check-prefix=OMP-ATTR --allow-empty %s
+// RUN: %clang_cc1 -fopenmp -code-completion-at=%s:%(line-6):10 %s | FileCheck --check-prefix=OMP-ATTR --allow-empty %s
// OMP-ATTR-NOT: COMPLETION: Pattern : sequence
-// RUN: %clang_cc1 -fopenmp -code-completion-at=%s:84:19 %s | FileCheck --check-prefix=OMP-NESTED --allow-empty %s
+// RUN: %clang_cc1 -fopenmp -code-completion-at=%s:%(line-8):19 %s | FileCheck --check-prefix=OMP-NESTED --allow-empty %s
// OMP-NESTED-NOT: COMPLETION: Pattern : directive
-// RUN: %clang_cc1 -std=c++11 -code-completion-at=%s:2:9 %s
+// RUN: %clang_cc1 -std=c++11 -code-completion-at=%s:%(line+1):9 %s
auto i =
-// RUN: %clang_cc1 -code-completion-at=%s:3:1 %s | FileCheck %s
+// RUN: %clang_cc1 -code-completion-at=%s:%(line+2):1 %s | FileCheck %s
void func() {
}
void foo() {
char arr[
-// RUN: %clang_cc1 -fsyntax-only -code-completion-macros -code-completion-at=%s:6:12 %s -o - | FileCheck %s
+// RUN: %clang_cc1 -fsyntax-only -code-completion-macros -code-completion-at=%s:%(line-1):12 %s -o - | FileCheck %s
// CHECK: COMPLETION: len
// CHECK: COMPLETION: PATHSIZE
f0(0, 0);
g0(0, 0);
f1(0, 0);
- // RUN: %clang_cc1 -std=c89 -fsyntax-only -code-completion-at=%s:6:6 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
+ // RUN: %clang_cc1 -std=c89 -fsyntax-only -code-completion-at=%s:%(line-3):6 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
// CHECK-CC1: f0(<#float x#>, float y)
- // RUN: %clang_cc1 -std=c89 -fsyntax-only -code-completion-at=%s:6:9 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s
+ // RUN: %clang_cc1 -std=c89 -fsyntax-only -code-completion-at=%s:%(line-5):9 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s
// CHECK-CC2: f0(float x, <#float y#>)
- // RUN: %clang_cc1 -std=c89 -fsyntax-only -code-completion-at=%s:8:6 %s -o - | FileCheck -check-prefix=CHECK-CC3 %s
+ // RUN: %clang_cc1 -std=c89 -fsyntax-only -code-completion-at=%s:%(line-5):6 %s -o - | FileCheck -check-prefix=CHECK-CC3 %s
// CHECK-CC3: f1()
}
void test() {
f(Y(), 0, 0);
- // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:19:9 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:%(line-1):9 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
// CHECK-CC1: f(Y y, <#int ZZ#>)
// CHECK-CC1-NEXT: f(int i, <#int j#>, int k)
// CHECK-CC1-NEXT: f(float x, <#float y#>)
// CHECK-CC1: COMPLETION: Pattern : dynamic_cast<<#type#>>(<#expression#>)
- // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:19:13 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-6):13 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s
// CHECK-CC2-NOT: f(Y y, int ZZ)
// CHECK-CC2: f(int i, int j, <#int k#>)
f({}, 0, 0);
- // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:28:7 %s -o - | FileCheck -check-prefix=CHECK-CC3 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:%(line-1):7 %s -o - | FileCheck -check-prefix=CHECK-CC3 %s
// CHECK-CC3: OVERLOAD: [#void#]f()
// CHECK-CC3-NEXT: OVERLOAD: [#void#]f(<#X#>)
// CHECK-CC3-NEXT: OVERLOAD: [#void#]f(<#int i#>, int j, int k)
template <typename T>
void foo(T t) {
f(t, t, t);
- // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:39:5 %s -o - | FileCheck -check-prefix=CHECK-CC4 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-1):5 %s -o - | FileCheck -check-prefix=CHECK-CC4 %s
// CHECK-CC4: f()
// CHECK-CC4-NEXT: f(<#X#>)
// CHECK-CC4-NEXT: f(<#int i#>, int j, int k)
// CHECK-CC4-NEXT: f(<#float x#>, float y)
- // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:39:8 %s -o - | FileCheck -check-prefix=CHECK-CC5 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-6):8 %s -o - | FileCheck -check-prefix=CHECK-CC5 %s
// CHECK-CC5-NOT: f()
// CHECK-CC5: f(int i, <#int j#>, int k)
// CHECK-CC5-NEXT: f(float x, <#float y#>)
f(5, t, t);
- // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:49:11 %s -o - | FileCheck -check-prefix=CHECK-CC6 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-1):11 %s -o - | FileCheck -check-prefix=CHECK-CC6 %s
// CHECK-CC6-NOT: f(float x, float y)
// CHECK-CC6: f(int, int, <#int#>, int)
// CHECK-CC6-NEXT: f(int i, int j, <#int k#>)
/* <- code completion */
};
-// RUN: %clang_cc1 -I %S/Inputs -fsyntax-only -code-completion-at=%s:7:6 %s
-// RUN: %clang_cc1 -I %S/Inputs -fsyntax-only -code-completion-at=%s:8:6 %s
+// RUN: %clang_cc1 -I %S/Inputs -fsyntax-only -code-completion-at=%s:%(line-4):6 %s
+// RUN: %clang_cc1 -I %S/Inputs -fsyntax-only -code-completion-at=%s:%(line-4):6 %s
// RUN: %clang_cc1 -I %S/Inputs -fsyntax-only -code-completion-at=%S/Inputs/comments.h:3:6 %s
-// RUN: %clang_cc1 -fsyntax-only -std=c++11 -code-completion-at=%s:12:9 %s -o - | FileCheck %s
+// RUN: %clang_cc1 -fsyntax-only -std=c++11 -code-completion-at=%s:%(line+11):9 %s -o - | FileCheck %s
// PR14381: need constexpr function bodies always, even if code-completing.
template<int> struct S;
// Important that BB is unknown.
// This triggers completion in PCC_RecoveryInFunction context, with no function.
int AA(BB cc);
-// RUN: not %clang_cc1 -fsyntax-only -code-completion-at=%s:3:12 %s | FileCheck %s
+// RUN: not %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-1):12 %s | FileCheck %s
// CHECK: COMPLETION: char
int (*foo(int a))(flo
-// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:1:21 %s -o - \
+// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-1):21 %s -o - \
// RUN: | FileCheck %s
// CHECK: COMPLETION: float
#if FOO(
#elif FOO(
#endif
-// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:2:9 %s
-// RUN: not %clang_cc1 -fsyntax-only -code-completion-at=%s:3:11 %s
+// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-3):9 %s
+// RUN: not %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-3):11 %s
loopVa
}
}
-// RUN: not %clang_cc1 -fsyntax-only -code-completion-at=%s:3:11 %s -o - \
+// RUN: not %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-3):11 %s -o - \
// RUN: | FileCheck %s
// CHECK: COMPLETION: loopVar
struct Base1 {
Base1() : {}
- // RUN: %clang_cc1 -fsyntax-only -std=c++98 -code-completion-at=%s:2:12 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
- // RUN: %clang_cc1 -fsyntax-only -std=c++14 -code-completion-at=%s:2:12 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
+ // RUN: %clang_cc1 -fsyntax-only -std=c++98 -code-completion-at=%s:%(line-1):12 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
+ // RUN: %clang_cc1 -fsyntax-only -std=c++14 -code-completion-at=%s:%(line-2):12 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
// CHECK-CC1: COMPLETION: Pattern : member1(<#int#>)
// CHECK-CC1: COMPLETION: Pattern : member2(<#float#>)
Base1(int) : member1(123), {}
- // RUN: %clang_cc1 -fsyntax-only -std=c++98 -code-completion-at=%s:8:30 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s
- // RUN: %clang_cc1 -fsyntax-only -std=c++14 -code-completion-at=%s:8:30 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s
+ // RUN: %clang_cc1 -fsyntax-only -std=c++98 -code-completion-at=%s:%(line-1):30 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s
+ // RUN: %clang_cc1 -fsyntax-only -std=c++14 -code-completion-at=%s:%(line-2):30 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s
// CHECK-CC2-NOT: COMPLETION: Pattern : member1(<#int#>)
// CHECK-CC2: COMPLETION: Pattern : member2(<#float#>)
};
Derived::Derived() : {}
-// RUN: %clang_cc1 -fsyntax-only -std=c++98 -code-completion-at=%s:25:22 %s -o - | FileCheck -check-prefix=CHECK-CC3 %s
-// RUN: %clang_cc1 -fsyntax-only -std=c++14 -code-completion-at=%s:25:22 %s -o - | FileCheck -check-prefix=CHECK-CC3 %s
+// RUN: %clang_cc1 -fsyntax-only -std=c++98 -code-completion-at=%s:%(line-1):22 %s -o - | FileCheck -check-prefix=CHECK-CC3 %s
+// RUN: %clang_cc1 -fsyntax-only -std=c++14 -code-completion-at=%s:%(line-2):22 %s -o - | FileCheck -check-prefix=CHECK-CC3 %s
// CHECK-CC3: COMPLETION: Pattern : Base1()
// CHECK-CC3: COMPLETION: Pattern : Base1(<#int#>)
// CHECK-CC3: COMPLETION: Pattern : deriv1(<#int#>)
Derived::Derived(int) try : {
} catch (...) {
}
-// RUN: %clang_cc1 -fsyntax-only -std=c++98 -code-completion-at=%s:32:29 %s -o - | FileCheck -check-prefix=CHECK-CC3 %s
-// RUN: %clang_cc1 -fsyntax-only -std=c++14 -code-completion-at=%s:32:29 %s -o - | FileCheck -check-prefix=CHECK-CC3 %s
+// RUN: %clang_cc1 -fsyntax-only -std=c++98 -code-completion-at=%s:%(line-3):29 %s -o - | FileCheck -check-prefix=CHECK-CC3 %s
+// RUN: %clang_cc1 -fsyntax-only -std=c++14 -code-completion-at=%s:%(line-4):29 %s -o - | FileCheck -check-prefix=CHECK-CC3 %s
Derived::Derived(float) try : Base1(),
{
} catch (...) {
}
-// RUN: %clang_cc1 -fsyntax-only -std=c++98 -code-completion-at=%s:38:39 %s -o - | FileCheck -check-prefix=CHECK-CC5 %s
-// RUN: %clang_cc1 -fsyntax-only -std=c++14 -code-completion-at=%s:38:39 %s -o - | FileCheck -check-prefix=CHECK-CC5 %s
+// RUN: %clang_cc1 -fsyntax-only -std=c++98 -code-completion-at=%s:%(line-4):39 %s -o - | FileCheck -check-prefix=CHECK-CC5 %s
+// RUN: %clang_cc1 -fsyntax-only -std=c++14 -code-completion-at=%s:%(line-5):39 %s -o - | FileCheck -check-prefix=CHECK-CC5 %s
// CHECK-CC5-NOT: COMPLETION: Pattern : Base1
// CHECK-CC5: COMPLETION: Pattern : deriv1(<#int#>)
struct A {
A() : , member2() {}
- // RUN: %clang_cc1 -fsyntax-only -std=c++98 -code-completion-at=%s:48:9 %s -o - | FileCheck -check-prefix=CHECK-CC6 %s
- // RUN: %clang_cc1 -fsyntax-only -std=c++14 -code-completion-at=%s:48:9 %s -o - | FileCheck -check-prefix=CHECK-CC6 %s
+ // RUN: %clang_cc1 -fsyntax-only -std=c++98 -code-completion-at=%s:%(line-1):9 %s -o - | FileCheck -check-prefix=CHECK-CC6 %s
+ // RUN: %clang_cc1 -fsyntax-only -std=c++14 -code-completion-at=%s:%(line-2):9 %s -o - | FileCheck -check-prefix=CHECK-CC6 %s
// CHECK-CC6: COMPLETION: Pattern : member1(<#int#>)
int member1, member2;
};
struct B {
B() : member2() {}
- // RUN: %clang_cc1 -fsyntax-only -std=c++98 -code-completion-at=%s:56:9 %s -o - | FileCheck -check-prefix=CHECK-CC7 %s
- // RUN: %clang_cc1 -fsyntax-only -std=c++14 -code-completion-at=%s:56:9 %s -o - | FileCheck -check-prefix=CHECK-CC7 %s
+ // RUN: %clang_cc1 -fsyntax-only -std=c++98 -code-completion-at=%s:%(line-1):9 %s -o - | FileCheck -check-prefix=CHECK-CC7 %s
+ // RUN: %clang_cc1 -fsyntax-only -std=c++14 -code-completion-at=%s:%(line-2):9 %s -o - | FileCheck -check-prefix=CHECK-CC7 %s
// CHECK-CC7: COMPLETION: Pattern : member1(<#int#>)
// Check in the middle and at the end of identifier too.
- // RUN: %clang_cc1 -fsyntax-only -std=c++98 -code-completion-at=%s:56:13 %s -o - | FileCheck -check-prefix=CHECK-CC8 %s
- // RUN: %clang_cc1 -fsyntax-only -std=c++98 -code-completion-at=%s:56:16 %s -o - | FileCheck -check-prefix=CHECK-CC8 %s
+ // RUN: %clang_cc1 -fsyntax-only -std=c++98 -code-completion-at=%s:%(line-5):13 %s -o - | FileCheck -check-prefix=CHECK-CC8 %s
+ // RUN: %clang_cc1 -fsyntax-only -std=c++98 -code-completion-at=%s:%(line-6):16 %s -o - | FileCheck -check-prefix=CHECK-CC8 %s
// CHECK-CC8: COMPLETION: Pattern : member2(<#int#>)
int member1, member2;
};
struct Composition1 {
Composition1() : b2_elem(2) {}
- // RUN: %clang_cc1 -fsyntax-only -std=c++98 -code-completion-at=%s:72:28 %s -o - | FileCheck -check-prefix=CHECK-CC9 %s
- // RUN: %clang_cc1 -fsyntax-only -std=c++14 -code-completion-at=%s:72:28 %s -o - | FileCheck -check-prefix=CHECK-CC9 %s
+ // RUN: %clang_cc1 -fsyntax-only -std=c++98 -code-completion-at=%s:%(line-1):28 %s -o - | FileCheck -check-prefix=CHECK-CC9 %s
+ // RUN: %clang_cc1 -fsyntax-only -std=c++14 -code-completion-at=%s:%(line-2):28 %s -o - | FileCheck -check-prefix=CHECK-CC9 %s
// CHECK-CC9: OVERLOAD: Base2(<#int#>)
// CHECK-CC9: OVERLOAD: Base2(<#const Base2 &#>)
// CHECK-CC9-NOT: OVERLOAD: Composition1
struct Composition2 {
Composition2() : c1_elem(Base2(1)) {}
- // RUN: %clang_cc1 -fsyntax-only -std=c++98 -code-completion-at=%s:83:34 %s -o - | FileCheck -check-prefix=CHECK-CC9 %s
- // RUN: %clang_cc1 -fsyntax-only -std=c++14 -code-completion-at=%s:83:34 %s -o - | FileCheck -check-prefix=CHECK-CC9 %s
- // RUN: %clang_cc1 -fsyntax-only -std=c++98 -code-completion-at=%s:83:35 %s -o - | FileCheck -check-prefix=CHECK-CC9 %s
- // RUN: %clang_cc1 -fsyntax-only -std=c++14 -code-completion-at=%s:83:35 %s -o - | FileCheck -check-prefix=CHECK-CC9 %s
+ // RUN: %clang_cc1 -fsyntax-only -std=c++98 -code-completion-at=%s:%(line-1):34 %s -o - | FileCheck -check-prefix=CHECK-CC9 %s
+ // RUN: %clang_cc1 -fsyntax-only -std=c++14 -code-completion-at=%s:%(line-2):34 %s -o - | FileCheck -check-prefix=CHECK-CC9 %s
+ // RUN: %clang_cc1 -fsyntax-only -std=c++98 -code-completion-at=%s:%(line-3):35 %s -o - | FileCheck -check-prefix=CHECK-CC9 %s
+ // RUN: %clang_cc1 -fsyntax-only -std=c++14 -code-completion-at=%s:%(line-4):35 %s -o - | FileCheck -check-prefix=CHECK-CC9 %s
Composition1 c1_elem;
};
-// RUN: %clang_cc1 -fsyntax-only -std=c++98 -code-completion-at=%s:83:20 %s -o - | FileCheck -check-prefix=CHECK-CC10 %s
-// RUN: %clang_cc1 -fsyntax-only -std=c++14 -code-completion-at=%s:83:20 %s -o - | FileCheck -check-prefix=CHECK-CC10 %s
+// RUN: %clang_cc1 -fsyntax-only -std=c++98 -code-completion-at=%s:%(line-7):20 %s -o - | FileCheck -check-prefix=CHECK-CC10 %s
+// RUN: %clang_cc1 -fsyntax-only -std=c++14 -code-completion-at=%s:%(line-8):20 %s -o - | FileCheck -check-prefix=CHECK-CC10 %s
// CHECK-CC10: Pattern : c1_elem()
// CHECK-CC10: Pattern : c1_elem(<#Base2#>)
X() : Y<T>() {};
};
-// RUN: %clang_cc1 -fsyntax-only -std=c++98 -code-completion-at=%s:100:9 %s -o - | FileCheck -check-prefix=CHECK-CC11 %s
-// RUN: %clang_cc1 -fsyntax-only -std=c++14 -code-completion-at=%s:100:9 %s -o - | FileCheck -check-prefix=CHECK-CC11 %s
+// RUN: %clang_cc1 -fsyntax-only -std=c++98 -code-completion-at=%s:%(line-3):9 %s -o - | FileCheck -check-prefix=CHECK-CC11 %s
+// RUN: %clang_cc1 -fsyntax-only -std=c++14 -code-completion-at=%s:%(line-4):9 %s -o - | FileCheck -check-prefix=CHECK-CC11 %s
// CHECK-CC11: Pattern : Y<T>(<#Y<T>#>)
// Test with incomplete init lists. (Relevant as parsing is *not* cut off).
int member1;
int member2;
};
-// RUN: not %clang_cc1 -fsyntax-only -std=c++14 -code-completion-at=%s:109:19 %s -o - | FileCheck -check-prefix=CHECK-CC12 %s
+// RUN: not %clang_cc1 -fsyntax-only -std=c++14 -code-completion-at=%s:%(line-5):19 %s -o - | FileCheck -check-prefix=CHECK-CC12 %s
// CHECK-CC12: COMPLETION: Pattern : member1(<#int#>)
// CHECK-CC12: COMPLETION: Pattern : member2(<#int#>)
int member1;
int member2;
};
-// RUN: not %clang_cc1 -fsyntax-only -std=c++14 -code-completion-at=%s:119:27 %s -o - | FileCheck -check-prefix=CHECK-CC13 %s
+// RUN: not %clang_cc1 -fsyntax-only -std=c++14 -code-completion-at=%s:%(line-5):27 %s -o - | FileCheck -check-prefix=CHECK-CC13 %s
// CHECK-CC13: PREFERRED-TYPE: int
void foo() {
Foo<int>();
- // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:7:12 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-1):12 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
// CHECK-CC1: OVERLOAD: Foo()
// CHECK-CC1: OVERLOAD: Foo(<#const Foo<int> &#>)
// CHECK-CC1: OVERLOAD: Foo(<#Foo<int> &&#>
Foo<int *>(3);
- // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:12:14 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-1):14 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s
// CHECK-CC2: OVERLOAD: Foo(<#int#>)
// CHECK-CC2: OVERLOAD: Foo(<#const Foo<int *> &#>)
// CHECK-CC2: OVERLOAD: Foo(<#Foo<int *> &&#>
};
auto b1 = Bar{};
-// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:36:15 %s | FileCheck -check-prefix=CHECK-BRACED %s
+// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-1):15 %s | FileCheck -check-prefix=CHECK-BRACED %s
Bar b2{};
-// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:38:8 %s | FileCheck -check-prefix=CHECK-BRACED %s
+// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-1):8 %s | FileCheck -check-prefix=CHECK-BRACED %s
static int consumeBar(Bar) { return 0; }
int b3 = consumeBar({});
-// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:41:22 %s | FileCheck -check-prefix=CHECK-BRACED %s
+// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-1):22 %s | FileCheck -check-prefix=CHECK-BRACED %s
struct Aggregate {
int first;
};
Aggregate a{1, 2, 3};
-// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:50:13 %s | FileCheck -check-prefix=CHECK-AGGREGATE-1 %s
+// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-1):13 %s | FileCheck -check-prefix=CHECK-AGGREGATE-1 %s
// CHECK-AGGREGATE-1: OVERLOAD: Aggregate{<#int first#>, int second, int third}
// CHECK-AGGREGATE-1: OVERLOAD: Aggregate{<#const Aggregate &#>}
-// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:50:16 %s | FileCheck -check-prefix=CHECK-AGGREGATE-2 %s
+// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-4):16 %s | FileCheck -check-prefix=CHECK-AGGREGATE-2 %s
// CHECK-AGGREGATE-2: OVERLOAD: Aggregate{int first, <#int second#>, int third}
-// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:50:18 %s | FileCheck -check-prefix=CHECK-AGGREGATE-3 %s
+// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-6):18 %s | FileCheck -check-prefix=CHECK-AGGREGATE-3 %s
// CHECK-AGGREGATE-3: OVERLOAD: Aggregate{int first, int second, <#int third#>}
Aggregate d{.second=1, .first=2, 3, 4, };
-// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:59:13 %s | FileCheck -check-prefix=CHECK-DESIG-1 %s
+// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-1):13 %s | FileCheck -check-prefix=CHECK-DESIG-1 %s
// CHECK-DESIG-1: OVERLOAD: Aggregate{<#int first#>, int second, int third}
// CHECK-DESIG-1: OVERLOAD: Aggregate{<#const Aggregate &#>}
-// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:59:24 %s | FileCheck -check-prefix=CHECK-DESIG-2 %s
+// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-4):24 %s | FileCheck -check-prefix=CHECK-DESIG-2 %s
// CHECK-DESIG-2: OVERLOAD: Aggregate{int first, int second, <#int third#>}
-// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:59:34 %s | FileCheck -check-prefix=CHECK-DESIG-3 %s
+// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-6):34 %s | FileCheck -check-prefix=CHECK-DESIG-3 %s
// CHECK-DESIG-3: OVERLOAD: Aggregate{int first, <#int second#>, int third}
-// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:59:37 %s | FileCheck -check-prefix=CHECK-DESIG-4 %s
+// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-8):37 %s | FileCheck -check-prefix=CHECK-DESIG-4 %s
// CHECK-DESIG-4: OVERLOAD: Aggregate{int first, int second, <#int third#>}
-// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:59:38 %s | FileCheck -check-prefix=CHECK-DESIG-5 %s --allow-empty
+// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-10):38 %s | FileCheck -check-prefix=CHECK-DESIG-5 %s --allow-empty
// CHECK-DESIG-5-NOT: OVERLOAD
void foo() {
Foo F{.x = 2, .b.t = 0};
- // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:11:10 %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-CC1 %s
- // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:11:18 %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-CC1 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:%(line-1):10 %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-CC1 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:%(line-2):18 %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-CC1 %s
// CHECK-CC1: COMPLETION: b : [#Base#]b
// CHECK-CC1-NEXT: COMPLETION: x : [#int#]x
// CHECK-CC1-NOT: foo
// CHECK-CC1-NOT: t
- // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:11:20 %s -o - | FileCheck -check-prefix=CHECK-NESTED %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:%(line-8):20 %s -o - | FileCheck -check-prefix=CHECK-NESTED %s
// CHECK-NESTED: COMPLETION: t : [#int#]t
Base B = {.t = 2};
z({.t = 1});
z(Base{.t = 2});
z((Base){.t = 2});
- // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:22:14 %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-CC2 %s
- // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:24:7 %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-CC2 %s
- // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:25:11 %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-CC2 %s
- // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:26:13 %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-CC2 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:%(line-5):14 %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-CC2 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:%(line-4):7 %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-CC2 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:%(line-4):11 %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-CC2 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:%(line-4):13 %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-CC2 %s
// CHECK-CC2: COMPLETION: t : [#int#]t
auto zr = [](const Base &B) {};
zr({.t = 1});
- // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:33:8 %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-REF %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:%(line-1):8 %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-REF %s
// CHECK-REF: COMPLETION: t : [#int#]t
Foo G1{.b = {.t = 0}};
Foo G2{.b{.t = 0}};
Foo G3{b: {.t = 0}};
- // RUN: %clang_cc1 -code-completion-at=%s:37:17 -fsyntax-only -code-completion-patterns %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-NESTED-2 %s
- // RUN: %clang_cc1 -code-completion-at=%s:38:14 -fsyntax-only -code-completion-patterns %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-NESTED-2 %s
- // RUN: %clang_cc1 -code-completion-at=%s:39:15 -fsyntax-only -code-completion-patterns %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-NESTED-2 %s
+ // RUN: %clang_cc1 -code-completion-at=%s:%(line-3):17 -fsyntax-only -code-completion-patterns %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-NESTED-2 %s
+ // RUN: %clang_cc1 -code-completion-at=%s:%(line-3):14 -fsyntax-only -code-completion-patterns %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-NESTED-2 %s
+ // RUN: %clang_cc1 -code-completion-at=%s:%(line-3):15 -fsyntax-only -code-completion-patterns %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-NESTED-2 %s
// CHECK-NESTED-2: COMPLETION: t : [#int#]t
}
};
void bar() {
Test<char> T{.x = 2};
- // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:55:17 %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-CC3 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:%(line-1):17 %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-CC3 %s
// CHECK-CC3: COMPLETION: x : [#T#]x
Test<int> X{.x = 2};
- // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:58:16 %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-CC4 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:%(line-1):16 %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-CC4 %s
// CHECK-CC4: COMPLETION: x : [#int#]x
// CHECK-CC4-NEXT: COMPLETION: y : [#char#]y
}
template <typename T>
void aux() {
Test<T> X{.x = T(2)};
- // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:66:14 %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-CC3 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:%(line-1):14 %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-CC3 %s
}
namespace signature_regression {
int rightFunction();
int dummy = wrongFunction({1});
int x = rightFunction();
- // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:77:25 %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-SIGNATURE-REGRESSION %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-1):25 %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-SIGNATURE-REGRESSION %s
// CHECK-SIGNATURE-REGRESSION-NOT: OVERLOAD: [#int#]wrongFunction
// CHECK-SIGNATURE-REGRESSION: OVERLOAD: [#int#]rightFunction
// CHECK-SIGNATURE-REGRESSION-NOT: OVERLOAD: [#int#]wrongFunction
struct { int inner; };
};
auto TestWithAnon = WithAnon { .inner = 2 };
- // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:88:33 %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-CC5 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:%(line-1):33 %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-CC5 %s
// CHECK-CC5: COMPLETION: inner : [#int#]inner
// CHECK-CC5: COMPLETION: outer : [#int#]outer
} // namespace std
int x = std::vector<int>{}.at(42);
-// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:17:14 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
+// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-1):14 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
// CHECK-CC1: COMPLETION: __vector_base : __vector_base<<#typename Tp#>>
// CHECK-CC1: COMPLETION: vector : vector<<#typename Tp#>>
-// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:17:28 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s
+// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-4):28 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s
// CHECK-CC2: COMPLETION: __stays_ugly : [#int#]__stays_ugly()
// CHECK-CC2: COMPLETION: at : [#int &#]at(<#unsigned int index#>)[# const#]
-// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:17:31 %s -o - | FileCheck -check-prefix=CHECK-CC3 %s
+// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-7):31 %s -o - | FileCheck -check-prefix=CHECK-CC3 %s
// CHECK-CC3: OVERLOAD: [#int &#]at(<#unsigned int index#>)
t2.
}
-// RUN: %clang_cc1 -fsyntax-only -code-completion-brief-comments -code-completion-at=%s:21:1 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
+// RUN: %clang_cc1 -fsyntax-only -code-completion-brief-comments -code-completion-at=%s:%(line-5):1 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
// CHECK-CC1: COMPLETION: T1 : [#void#]T1(<#float x#>, <#float y#>) : Aaa.
// CHECK-CC1: COMPLETION: T2 : T2 : Bbb.
// CHECK-CC1: COMPLETION: T5 : T5:: : Eee.
-// RUN: %clang_cc1 -fsyntax-only -code-completion-brief-comments -code-completion-at=%s:23:6 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s
+// RUN: %clang_cc1 -fsyntax-only -code-completion-brief-comments -code-completion-at=%s:%(line-8):6 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s
// CHECK-CC2: COMPLETION: T3 : [#void#]T3() : Ccc.
// CHECK-CC2: COMPLETION: T4 : [#int#]T4 : Ddd.
[Test classProp];
}
-// RUN: %clang_cc1 -fsyntax-only -code-completion-brief-comments -code-completion-at=%s:15:8 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
+// RUN: %clang_cc1 -fsyntax-only -code-completion-brief-comments -code-completion-at=%s:%(line-4):8 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
// CHECK-CC1: instanceProp : [#id#]instanceProp : Instance!
// CHECK-CC1: setInstanceProp: : [#void#]setInstanceProp:<#(id)#> : Instance!
-// RUN: %clang_cc1 -fsyntax-only -code-completion-brief-comments -code-completion-at=%s:16:9 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s
+// RUN: %clang_cc1 -fsyntax-only -code-completion-brief-comments -code-completion-at=%s:%(line-7):9 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s
// CHECK-CC2: classProp : [#id#]classProp : Class!
// CHECK-CC2: setClassProp: : [#void#]setClassProp:<#(id)#> : Class!
int test() {
bool fffffff;
- // RUN: %clang_cc1 -std=c++11 -code-completion-at=%s:7:8 %s | FileCheck %s
+ // RUN: %clang_cc1 -std=c++11 -code-completion-at=%s:%(line+2):8 %s | FileCheck %s
// CHECK: COMPLETION: fffffff : [#bool#]fffffff
foo(ff
}
// Check that clang does not crash when completing at the last char in the
// buffer.
// NOTE: This file must *NOT* have newline at the end.
-// RUN: %clang_cc1 -code-completion-at=%s:7:2 %s | FileCheck %s
+// RUN: %clang_cc1 -code-completion-at=%s:%(line+3):2 %s | FileCheck %s
// CHECK: COMPLETION: foo
using foo = int***;
f
\ No newline at end of file
// middle, or end.
FUNC(int) a = 10;
// ^FUNC(int)
-// RUN: %clang_cc1 -code-completion-at=%s:6:1 -code-completion-macros %s | FileCheck %s
+// RUN: %clang_cc1 -code-completion-at=%s:%(line-2):1 -code-completion-macros %s | FileCheck %s
// FU^NC(int)
-// RUN: %clang_cc1 -code-completion-at=%s:6:3 -code-completion-macros %s | FileCheck %s
+// RUN: %clang_cc1 -code-completion-at=%s:%(line-4):3 -code-completion-macros %s | FileCheck %s
// FUNC^(int)
-// RUN: %clang_cc1 -code-completion-at=%s:6:5 -code-completion-macros %s | FileCheck %s
+// RUN: %clang_cc1 -code-completion-at=%s:%(line-6):5 -code-completion-macros %s | FileCheck %s
// CHECK: COMPLETION: FUNC : FUNC(<#X#>)
// CHECK: COMPLETION: FUNCTION : FUNCTION
// middle, or end.
class cls
// ^class cls
-// RUN: %clang_cc1 -code-completion-at=%s:4:1 %s | FileCheck --check-prefix=CHECK-CLS %s
+// RUN: %clang_cc1 -code-completion-at=%s:%(line-2):1 %s | FileCheck --check-prefix=CHECK-CLS %s
// cl^ass cls
-// RUN: %clang_cc1 -code-completion-at=%s:4:3 %s | FileCheck --check-prefix=CHECK-CLS %s
+// RUN: %clang_cc1 -code-completion-at=%s:%(line-4):3 %s | FileCheck --check-prefix=CHECK-CLS %s
// class^ cls
-// RUN: %clang_cc1 -code-completion-at=%s:4:6 %s | FileCheck --check-prefix=CHECK-CLS %s
+// RUN: %clang_cc1 -code-completion-at=%s:%(line-6):6 %s | FileCheck --check-prefix=CHECK-CLS %s
// CHECK-CLS: COMPLETION: class{{$}}
// CHECK-CLS: COMPLETION: classifier : classifier
// class ^cls
-// RUN: %clang_cc1 -code-completion-at=%s:4:7 %s | FileCheck --check-prefix=CHECK-NO-CLS %s
+// RUN: %clang_cc1 -code-completion-at=%s:%(line-12):7 %s | FileCheck --check-prefix=CHECK-NO-CLS %s
// class c^ls
-// RUN: %clang_cc1 -code-completion-at=%s:4:8 %s | FileCheck --check-prefix=CHECK-NO-CLS %s
+// RUN: %clang_cc1 -code-completion-at=%s:%(line-14):8 %s | FileCheck --check-prefix=CHECK-NO-CLS %s
// CHECK-NO-CLS-NOT: COMPLETION: class{{$}}
// CHECK-NO-CLS: COMPLETION: classifier : classifier
// FIXME: ideally, we should not show 'Red' on the next line.
else if (color == N::Color::Blue) {}
- // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:10:11 %s -o - | FileCheck %s
- // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:11:8 %s -o - | FileCheck %s
- // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:12:16 %s -o - | FileCheck %s
- // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:14:21 %s -o - | FileCheck %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-6):11 %s -o - | FileCheck %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-6):8 %s -o - | FileCheck %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-6):16 %s -o - | FileCheck %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-5):21 %s -o - | FileCheck %s
// CHECK: Blue : [#N::Color#]N::Blue
// CHECK: color : [#N::Color#]color
// CHECK: Orange : [#N::Color#]N::Orange
void test(enum N::C::Color color) {
switch (color) {
case
- // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:23:8 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-1):8 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
// CHECK-CC1: Blue : [#M::N::C::Color#]N::C::Blue
// CHECK-CC1-NEXT: Green : [#M::N::C::Color#]N::C::Green
// CHECK-CC1-NEXT: Indigo : [#M::N::C::Color#]N::C::Indigo
case
}
- // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:19:10 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-9):10 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
// CHECK-CC1: Blue
// CHECK-CC1-NEXT: Green
// CHECK-CC1-NEXT: Indigo
// CHECK-CC1-NEXT: Orange
// CHECK-CC1-NEXT: Violet
- // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:25:10 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-10):10 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s
// CHECK-CC2: COMPLETION: Blue : [#enum Color#]Blue
// CHECK-CC2-NEXT: COMPLETION: c2 : [#unsigned int#]c2
// CHECK-CC2-NEXT: COMPLETION: color : [#enum Color#]color
break;
case
- // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:21:8 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-1):8 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
// CHECK-CC1: Blue : [#N::Color#]N::Blue
// CHECK-CC1-NEXT: Green : [#N::Color#]N::Green
// CHECK-CC1-NEXT: Indigo : [#N::Color#]N::Indigo
void f() {
std::sort(1, 2);
Foo().getAs<int>();
- // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:18:8 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-2):8 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
// CHECK-CC1: dyn_cast<<#class X#>>(<#Y *Val#>)
// CHECK-CC1: sort(<#RandomAccessIterator first#>, <#RandomAccessIterator last#>
- // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:19:9 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-4):9 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s
// CHECK-CC2: getAs<<#typename T#>>()
- // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:19:22 %s -o - | FileCheck -check-prefix=CHECK-CC3 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-6):22 %s -o - | FileCheck -check-prefix=CHECK-CC3 %s
// CHECK-CC3: [#V#]doSomething(<#T t#>, <#const U &u#>, <#V *v#>)
}
void test() {
::
- // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:5:5 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-1):5 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
// CHECK-CC1: f(<#int i#>{#, <#int j = 2#>{#, <#int k = 5#>#}#})
// CHECK-CC1: f(<#float x#>, <#float y, ...#>)
void test() {
ns::
-// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:12:7 %s -o - | FileCheck %s --check-prefix=CHECK-1
+// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-1):7 %s -o - | FileCheck %s --check-prefix=CHECK-1
// CHECK-1-DAG: COMPLETION: bar : bar
// CHECK-1-DAG: COMPLETION: baz : baz
// CHECK-1-DAG: COMPLETION: func : [#int#]func(<#int a#>, <#bar b#>, <#baz c#>)
-// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:12:7 -no-code-completion-ns-level-decls %s -o - | FileCheck %s --allow-empty --check-prefix=CHECK-EMPTY
+// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-6):7 -no-code-completion-ns-level-decls %s -o - | FileCheck %s --allow-empty --check-prefix=CHECK-EMPTY
// CHECK-EMPTY-NOT: COMPLETION: bar : bar
// CHECK-EMPTY: {{^}}{{$}}
}
// Suggest symlinked header files.
#include "foo.h"
-// RUN: %clang -fsyntax-only -I%t/links -Xclang -code-completion-at=%s:8:13 %s | FileCheck -check-prefix=CHECK-1 %s
+// RUN: %clang -fsyntax-only -I%t/links -Xclang -code-completion-at=%s:%(line-1):13 %s | FileCheck -check-prefix=CHECK-1 %s
// CHECK-1: foo.h"
// CHECK-1: foobar.h"
// Suggest symlinked folder.
#include "mypr"
-// RUN: %clang -fsyntax-only -I%t/links -Xclang -code-completion-at=%s:14:13 %s | FileCheck -check-prefix=CHECK-2 %s
+// RUN: %clang -fsyntax-only -I%t/links -Xclang -code-completion-at=%s:%(line-1):13 %s | FileCheck -check-prefix=CHECK-2 %s
// CHECK-2: myproj/
IncompleteType *f;
f->x;
}
-// RUN: not %clang_cc1 -fsyntax-only -code-completion-at=%s:5:6 %s -o - | FileCheck %s -allow-empty
+// RUN: not %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-2):6 %s -o - | FileCheck %s -allow-empty
// CHECK-NOT: COMPLETION:
IncompleteType g(in);
// Completing should produce results even if types are incomplete.
// Note that clang is expected to return an error code since 'in' does not resolve.
-// RUN: not %clang_cc1 -fsyntax-only -code-completion-at=%s:5:9 %s -o - | FileCheck %s
-// RUN: not %clang_cc1 -fsyntax-only -code-completion-at=%s:6:19 %s -o - | FileCheck %s
+// RUN: not %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-4):9 %s -o - | FileCheck %s
+// RUN: not %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-4):19 %s -o - | FileCheck %s
// CHECK: COMPLETION: int{{$}}
// CHECK: COMPLETION: int_typedef
// CHECK: COMPLETION: int_value
// Check that input_var shows up when completing at the start, in the middle
// and at the end of the identifier.
//
- // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:4:6 %s -o - | FileCheck %s
- // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:4:8 %s -o - | FileCheck %s
- // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:4:15 %s -o - | FileCheck %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-4):6 %s -o - | FileCheck %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-5):8 %s -o - | FileCheck %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-6):15 %s -o - | FileCheck %s
// CHECK: input_var
}
void test1() {
Foo foo;
foo.;
- // RUN: not %clang_cc1 -fsyntax-only -code-completion-at=%s:5:7 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
+ // RUN: not %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-1):7 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
// CHECK-CC1: COMPLETION: abc
}
void test2() {
Foo foo = garbage();
foo.;
- // RUN: not %clang_cc1 -fsyntax-only -code-completion-at=%s:12:7 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s
+ // RUN: not %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-1):7 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s
// CHECK-CC2: COMPLETION: abc
}
void (*x)(int, double) = nullptr;
function<void(int, double)> y = {};
- // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:7:28 %s -o - | FileCheck -check-prefix=CHECK-1 %s
- // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:9:35 %s -o - | FileCheck -check-prefix=CHECK-1 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:%(line-3):28 %s -o - | FileCheck -check-prefix=CHECK-1 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:%(line-2):35 %s -o - | FileCheck -check-prefix=CHECK-1 %s
// CHECK-1: COMPLETION: Pattern : [<#=#>](int <#parameter#>, double <#parameter#>) { <#body#> }
// == Placeholders for suffix types must be placed properly.
function<void(void(*)(int))> z = {};
- // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:15:36 %s -o - | FileCheck -check-prefix=CHECK-2 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:%(line-1):36 %s -o - | FileCheck -check-prefix=CHECK-2 %s
// CHECK-2: COMPLETION: Pattern : [<#=#>](void (* <#parameter#>)(int)) { <#body#> }
// == No need for a parameter list if function has no parameters.
function<void()> a = {};
- // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:20:24 %s -o - | FileCheck -check-prefix=CHECK-3 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:%(line-1):24 %s -o - | FileCheck -check-prefix=CHECK-3 %s
// CHECK-3: COMPLETION: Pattern : [<#=#>] { <#body#> }
}
using function_typedef = function<void(vector<int>)>;
function_typedef b = {};
- // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:30:35 %s -o - | FileCheck -check-prefix=CHECK-4 %s
- // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:33:24 %s -o - | FileCheck -check-prefix=CHECK-4 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:%(line-4):35 %s -o - | FileCheck -check-prefix=CHECK-4 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:%(line-2):24 %s -o - | FileCheck -check-prefix=CHECK-4 %s
// CHECK-4: COMPLETION: Pattern : [<#=#>](vector<int> <#parameter#>) { <#body#> }
}
void test3() {
unique_function<void()> a = {};
- // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:43:31 %s -o - | FileCheck -check-prefix=CHECK-5 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:%(line-1):31 %s -o - | FileCheck -check-prefix=CHECK-5 %s
// CHECK-5: COMPLETION: Pattern : [<#=#>] { <#body#> }
}
template <class T, class U> struct weird_function {};
void test4() {
weird_function<void(), int> b = {};
- // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:50:35 %s -o - | FileCheck -check-prefix=CHECK-6 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:%(line-1):35 %s -o - | FileCheck -check-prefix=CHECK-6 %s
// CHECK-6-NOT: COMPLETION: Pattern : [<#=
}
void test5() {
// Completions are only added when -code-completion-patterns are enabled.
function<void()> b = {};
- // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:57:24 %s -o - | FileCheck -check-prefix=CHECK-7 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:%(line-1):24 %s -o - | FileCheck -check-prefix=CHECK-7 %s
// CHECK-7: COMPLETION: Pattern : [<#=
- // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:57:24 %s -o - | FileCheck -check-prefix=CHECK-8 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-3):24 %s -o - | FileCheck -check-prefix=CHECK-8 %s
// CHECK-8-NOT: COMPLETION: Pattern : [<#=
}
void test6() {
auto my_lambda = [&](int a, double &b) { return 1.f; };
- // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:65:58 %s -o - | FileCheck -check-prefix=CHECK-9 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-1):58 %s -o - | FileCheck -check-prefix=CHECK-9 %s
// CHECK-9: [#float#]my_lambda(<#int a#>, <#double &b#>)[# const#]
}
void test7() {
auto generic_lambda = [&](auto a, const auto &b) { return a + b; };
- // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:71:70 %s -o - | FileCheck -check-prefix=CHECK-10 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-1):70 %s -o - | FileCheck -check-prefix=CHECK-10 %s
// CHECK-10: [#auto#]generic_lambda(<#auto a#>, <#const auto &b#>)[# const#]
}
// RUN: rm -rf %t && mkdir %t
// RUN: echo 'module Foo { header "foo.h" }' > %t/module.modulemap
// RUN: echo '#define FOO_MACRO 42' > %t/foo.h
-// RUN: c-index-test -code-completion-at=%s:9:1 -I %t %s | FileCheck %s
-// RUN: c-index-test -code-completion-at=%s:9:1 -I %t -fmodules -fmodules-cache-path=%t %s | FileCheck %s
+// RUN: c-index-test -code-completion-at=%s:%(line+5):1 -I %t %s | FileCheck %s
+// RUN: c-index-test -code-completion-at=%s:%(line+4):1 -I %t -fmodules -fmodules-cache-path=%t %s | FileCheck %s
#include "foo.h"
int x =
// RUN: rm -rf %t && mkdir %t
// RUN: echo 'module Foo { header "foo.h" }' > %t/module.modulemap
// RUN: echo '#define FOO_MACRO 42' > %t/foo.h
-// RUN: c-index-test -code-completion-at=%s:8:1 -I %t -fmodules-cache-path=%t -fmodules %s | FileCheck %s
+// RUN: c-index-test -code-completion-at=%s:%(line+4):1 -I %t -fmodules-cache-path=%t -fmodules %s | FileCheck %s
@import Foo;
int x =
};
void test(struct Point *p) {
- // RUN: %clang_cc1 -include %S/Inputs/macros.h -fsyntax-only -code-completion-macros -code-completion-at=%s:12:14 %s -o - | FileCheck -check-prefix=CC1 %s
+ // RUN: %clang_cc1 -include %S/Inputs/macros.h -fsyntax-only -code-completion-macros -code-completion-at=%s:%(line+1):14 %s -o - | FileCheck -check-prefix=CC1 %s
switch (p->IDENTITY(color)) {
- // RUN: %clang_cc1 -include %S/Inputs/macros.h -fsyntax-only -code-completion-macros -code-completion-at=%s:14:10 %s -o - | FileCheck -check-prefix=CC2 %s
+ // RUN: %clang_cc1 -include %S/Inputs/macros.h -fsyntax-only -code-completion-macros -code-completion-at=%s:%(line+1):10 %s -o - | FileCheck -check-prefix=CC2 %s
case
}
- // RUN: %clang_cc1 -include %S/Inputs/macros.h -fsyntax-only -code-completion-macros -code-completion-at=%s:17:8 %s -o - | FileCheck -check-prefix=CC3 %s
+ // RUN: %clang_cc1 -include %S/Inputs/macros.h -fsyntax-only -code-completion-macros -code-completion-at=%s:%(line+1):8 %s -o - | FileCheck -check-prefix=CC3 %s
#ifdef Q
#endif
// Run the same tests, this time with macros loaded from the PCH file.
// RUN: %clang_cc1 -emit-pch -o %t %S/Inputs/macros.h
- // RUN: %clang_cc1 -include-pch %t -fsyntax-only -code-completion-macros -code-completion-at=%s:12:14 %s -o - | FileCheck -check-prefix=CC1 %s
- // RUN: %clang_cc1 -include-pch %t -fsyntax-only -code-completion-macros -code-completion-at=%s:14:10 %s -o - | FileCheck -check-prefix=CC2 %s
- // RUN: %clang_cc1 -include-pch %t -fsyntax-only -code-completion-macros -code-completion-at=%s:17:8 %s -o - | FileCheck -check-prefix=CC3 %s
+ // RUN: %clang_cc1 -include-pch %t -fsyntax-only -code-completion-macros -code-completion-at=%s:%(line-10):14 %s -o - | FileCheck -check-prefix=CC1 %s
+ // RUN: %clang_cc1 -include-pch %t -fsyntax-only -code-completion-macros -code-completion-at=%s:%(line-9):10 %s -o - | FileCheck -check-prefix=CC2 %s
+ // RUN: %clang_cc1 -include-pch %t -fsyntax-only -code-completion-macros -code-completion-at=%s:%(line-7):8 %s -o - | FileCheck -check-prefix=CC3 %s
// CC1: color
// CC1: x
};
auto x = deque().
-// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:10:18 %s -o - | FileCheck %s
+// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-1):18 %s -o - | FileCheck %s
// CHECK: COMPLETION: size : [#int#]size()[# const#]
// CHECK: COMPLETION: size (Hidden,InBase,Inaccessible) : [#int &#]deque_base::size()
void test(struct Point *p) {
p->
- // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:8:6 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-1):6 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
// CHECK-CC1: x
// CHECK-CC1: y
// CHECK-CC1: z
p.
}
-// RUN: %clang_cc1 -fsyntax-only -code-completion-with-fixits -code-completion-at=%s:20:6 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s
-// CHECK-CC2: x (requires fix-it: {20:4-20:6} to ".")
+// RUN: %clang_cc1 -fsyntax-only -code-completion-with-fixits -code-completion-at=%s:%(line-7):6 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s
+// CHECK-CC2: x (requires fix-it: {[[@LINE-8]]:4-[[@LINE-8]]:6} to ".")
-// RUN: %clang_cc1 -fsyntax-only -code-completion-with-fixits -code-completion-at=%s:24:5 %s -o - | FileCheck -check-prefix=CHECK-CC3 %s
-// CHECK-CC3: x (requires fix-it: {24:4-24:5} to "->")
+// RUN: %clang_cc1 -fsyntax-only -code-completion-with-fixits -code-completion-at=%s:%(line-6):5 %s -o - | FileCheck -check-prefix=CHECK-CC3 %s
+// CHECK-CC3: x (requires fix-it: {[[@LINE-7]]:4-[[@LINE-7]]:5} to "->")
void test4(struct Point *p) {
(int)(p)->x;
(int)(0,1,2,3,4,p)->x;
}
-// RUN: %clang_cc1 -fsyntax-only -code-completion-with-fixits -code-completion-at=%s:34:13 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
-// RUN: %clang_cc1 -fsyntax-only -code-completion-with-fixits -code-completion-at=%s:35:23 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
+// RUN: %clang_cc1 -fsyntax-only -code-completion-with-fixits -code-completion-at=%s:%(line-3):13 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
+// RUN: %clang_cc1 -fsyntax-only -code-completion-with-fixits -code-completion-at=%s:%(line-3):23 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
namespace I1 { }
namespace New =
- // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:13:18 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-1):18 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
// CHECK-CC1: I1
// CHECK-CC1: I4
// CHECK-CC1: I5
namespace I1 { }
namespace
- // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:10:13 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-1):13 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
// CHECK-CC1: I1
// CHECK-CC1-NEXT: I5
}
N::
-// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:12:4 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
+// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-1):4 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
// CHECK-CC1: A
// CHECK-CC1: B
// CHECK-CC1: M
return @"";
}
-// RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:4:11 %s -fno-const-strings -o - | FileCheck -check-prefix=CHECK-AT %s
+// RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:%(line-3):11 %s -fno-const-strings -o - | FileCheck -check-prefix=CHECK-AT %s
// CHECK-AT: COMPLETION: Pattern : [#NSString *#]"<#string#>"
// CHECK-AT: COMPLETION: Pattern : [#id#](<#expression#>)
// CHECK-AT: COMPLETION: Pattern : [#NSArray *#][<#objects, ...#>]
// CHECK-AT: COMPLETION: Pattern : [#SEL#]selector(<#selector#>)
// CHECK-AT: COMPLETION: Pattern : [#NSDictionary *#]{<#key#>: <#object, ...#>}
-// RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:4:11 %s -fconst-strings -o - | FileCheck -check-prefix=CHECK-CONST-STRINGS %s
+// RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:%(line-12):11 %s -fconst-strings -o - | FileCheck -check-prefix=CHECK-CONST-STRINGS %s
// CHECK-CONST-STRINGS: COMPLETION: Pattern : [#const char[]#]encode(<#type-name#>)
return foo;
}
-// RUN: %clang_cc1 -fsyntax-only -code-completion-with-fixits -code-completion-at=%s:14:19 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
+// RUN: %clang_cc1 -fsyntax-only -code-completion-with-fixits -code-completion-at=%s:%(line-4):19 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
// CHECK-CC1-NOT: [#int#]_bar
// CHECK-CC1-NOT: [#int#]_foo
// CHECK-CC1: [#int#]bar
Foo *obj = [Foo new];
[obj xx];
}
-// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:23:19 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
+// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-3):19 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
// CHECK-CC1: categoryClassMethod
// CHECK-CC1: classMethod1:withKeyword:
// CHECK-CC1: classMethod2
// CHECK-CC1: new
// CHECK-CC1: protocolClassMethod
-// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:24:8 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s
+// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-8):8 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s
// CHECK-CC2: categoryInstanceMethod
// CHECK-CC2: instanceMethod1
// CHECK-CC2: protocolInstanceMethod
[ptr instanceMethod1];
}
-// RUN: %clang_cc1 -fsyntax-only -std=c++11 -code-completion-at=%s:33:8 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
+// RUN: %clang_cc1 -fsyntax-only -std=c++11 -code-completion-at=%s:%(line-8):8 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
// CHECK-CC1: categoryInstanceMethod : [#id#]categoryInstanceMethod
// CHECK-CC1: instanceMethod1 : [#id#]instanceMethod1
// CHECK-CC1: protocolInstanceMethod (InBase) : [#id#]protocolInstanceMethod
-// RUN: %clang_cc1 -fsyntax-only -std=c++11 -code-completion-at=%s:38:8 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s
+// RUN: %clang_cc1 -fsyntax-only -std=c++11 -code-completion-at=%s:%(line-7):8 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s
// CHECK-CC2: protocolInstanceMethod : [#id#]protocolInstanceMethod
return foo;
}
-// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:17:25 %s -o - | FileCheck %s
+// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-4):25 %s -o - | FileCheck %s
// CHECK: bar (InBase) : [#int#]bar
// CHECK: foo (InBase) : [#int#]foo
// CHECK-NOT: foobar
typedef float Float;
operator
- // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:10:12 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-1):12 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
// CHECK-CC1: +
// CHECK-CC1: Float
// CHECK-CC1: Integer
typedef struct t _TYPEDEF;
void foo() {
int y;
- // RUN: %clang_cc1 -isystem %S/Inputs -fsyntax-only -code-completion-at=%s:6:9 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
+ // RUN: %clang_cc1 -isystem %S/Inputs -fsyntax-only -code-completion-at=%s:%(line-1):9 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
// CHECK-CC1-NOT: __INTEGER_TYPE
// CHECK-CC1: _Imaginary
// CHECK-CC1: _MyPrivateType
// CHECK-CC1: y
// PR8744
- // RUN: %clang_cc1 -isystem %S/Inputs -fsyntax-only -code-completion-at=%s:1:11 %s
+ // RUN: %clang_cc1 -isystem %S/Inputs -fsyntax-only -code-completion-at=%s:%(line-17):11 %s
};
// Runs completion at ^vf
-// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:14:3 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
+// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-4):3 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
// CHECK-CC1: COMPLETION: Pattern : int ttt(bool param, int x = 3) const override{{$}}
// CHECK-CC1: COMPLETION: Pattern : void vfunc(bool param, int p) override{{$}}
// CHECK-CC1-NOT: COMPLETION: Pattern : void vfunc(bool param) override{{$}}
//
// Runs completion at vf^
-// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:14:5 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s
+// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-10):5 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s
// CHECK-CC2-NOT: COMPLETION: Pattern : int ttt(bool param, int x = 3) const override{{$}}
// CHECK-CC2: COMPLETION: Pattern : void vfunc(bool param, int p) override{{$}}
// CHECK-CC2-NOT: COMPLETION: Pattern : void vfunc(bool param) override{{$}}
//
// Runs completion at void ^ on line 13.
-// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:13:8 %s -o - | FileCheck -check-prefix=CHECK-CC3 %s
+// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-17):8 %s -o - | FileCheck -check-prefix=CHECK-CC3 %s
// CHECK-CC3-NOT: COMPLETION: Pattern : int ttt(bool param, int x = 3) const override{{$}}
// CHECK-CC3-NOT: COMPLETION: Pattern : void vfunc(bool param, int p) override{{$}}
// CHECK-CC3-NOT: COMPLETION: Pattern : void vfunc(bool param) override{{$}}
}
// Runs completion at empty line on line 37.
-// RUN: not %clang_cc1 -fsyntax-only -code-completion-at=%s:37:1 %s -o - | FileCheck -check-prefix=CHECK-CC4 %s
+// RUN: not %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-5):1 %s -o - | FileCheck -check-prefix=CHECK-CC4 %s
// CHECK-CC4: COMPLETION: Pattern : void vfunc(bool param, int p) override{{$}}
void test() {
foo(10, );
- // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:5:10 %s -o - \
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-1):10 %s -o - \
// RUN: | FileCheck -check-prefix=CHECK-CC1 %s
// CHECK-CC1: OPENING_PAREN_LOC: {{.*}}paren_locs.cpp:5:6
#define FOO foo(
FOO 10, );
#undef FOO
- // RUN: not %clang_cc1 -fsyntax-only -code-completion-at=%s:11:10 %s -o - \
+ // RUN: not %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-2):10 %s -o - \
// RUN: | FileCheck -check-prefix=CHECK-CC2 %s
// CHECK-CC2: OPENING_PAREN_LOC: {{.*}}paren_locs.cpp:11:3
Foo(int a, int b, int c);
};
Foo a(10, );
- // RUN: not %clang_cc1 -fsyntax-only -code-completion-at=%s:21:12 %s -o - \
+ // RUN: not %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-1):12 %s -o - \
// RUN: | FileCheck -check-prefix=CHECK-CC3 %s
// CHECK-CC3: OPENING_PAREN_LOC: {{.*}}paren_locs.cpp:21:8
Foo(10, );
- // RUN: not %clang_cc1 -fsyntax-only -code-completion-at=%s:25:10 %s -o - \
+ // RUN: not %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-1):10 %s -o - \
// RUN: | FileCheck -check-prefix=CHECK-CC4 %s
// CHECK-CC4: OPENING_PAREN_LOC: {{.*}}paren_locs.cpp:25:6
new Foo(10, );
- // RUN: not %clang_cc1 -fsyntax-only -code-completion-at=%s:29:15 %s -o - \
+ // RUN: not %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-1):15 %s -o - \
// RUN: | FileCheck -check-prefix=CHECK-CC5 %s
// CHECK-CC5: OPENING_PAREN_LOC: {{.*}}paren_locs.cpp:29:10
}
param;
}
-// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:7:1 %s | FileCheck %s
+// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-3):1 %s | FileCheck %s
// CHECK: param : [#int#]param
void completeParamPragmaError(int param) {
param;
}
-// RUN: %clang_cc1 -fsyntax-only -verify -code-completion-at=%s:16:1 %s | FileCheck %s
+// RUN: %clang_cc1 -fsyntax-only -verify -code-completion-at=%s:%(line-2):1 %s | FileCheck %s
struct X x;
x.
-// RUN: env CINDEXTEST_EDITING=1 c-index-test -code-completion-at=%s:4:5 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC1 %s
+// RUN: env CINDEXTEST_EDITING=1 c-index-test -code-completion-at=%s:%(line-2):5 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC1 %s
// CHECK-CC1: FieldDecl:{ResultType int}{TypedText m} (35)
void test(bool x) {
if (x) {}
- // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:2:7 %s | FileCheck %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-1):7 %s | FileCheck %s
// CHECK: PREFERRED-TYPE: _Bool
while (x) {}
- // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:6:10 %s | FileCheck %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-1):10 %s | FileCheck %s
for (; x;) {}
- // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:9:10 %s | FileCheck %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-1):10 %s | FileCheck %s
// FIXME(ibiryukov): the condition in do-while is parsed as expression, so we
// fail to detect it should be converted to bool.
void test() {
foo().method(0, 0, 0, 0);
- // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:23:9 %s -o - | FileCheck %s --check-prefix=CHECK-1
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-1):9 %s -o - | FileCheck %s --check-prefix=CHECK-1
// CHECK-1: COMPLETION: method : [#type#]method(<#type#>, <#foo::type#>, <#::foo::type#>, <#::foo::foo::type#>)
f
- // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:26:3 %s -o - | FileCheck %s --check-prefix=CHECK-2
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-1):3 %s -o - | FileCheck %s --check-prefix=CHECK-2
// FIXME(ibiryukov): We should get rid of CHECK-DAGs here when completion output is made deterministic (see PR35244).
// CHECK-2-DAG: COMPLETION: func : [#int#]func(<#foo a#>, <#bar b#>, <#ns::bar c#>, <#ns::baz d#>
// CHECK-2-DAG: COMPLETION: func : [#int#]func(<#foo::type a#>, <#bar b#>, <#baz c#>
int foo = 10;
-// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:1:11 %s -o - | FileCheck --check-prefix=CC1 %s
+// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-1):11 %s -o - | FileCheck --check-prefix=CC1 %s
// CC1-NOT: foo
int main() {
map *m;
m->find(10);
- // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:8:11 %s -o - | FileCheck %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-1):11 %s -o - | FileCheck %s
// CHECK: OVERLOAD: [#void#]find(<#int#>)
// Also check when the lhs is an explicit pr-value.
(m+0)->find(10);
- // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:13:15 %s -o - | FileCheck %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-1):15 %s -o - | FileCheck %s
}
void test(void) {
enum X { x };
enum
- // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:9:8 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-1):8 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
// CHECK-CC1: X
// CHECK-CC1: Y
void test() {
class
- // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:17:11 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-1):11 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
// FIXME: the redundant Y is really annoying... it needs qualification to
// actually be useful. Here, it just looks redundant :(
// CHECK-CC1: A
template <class, int x> bool overloaded(char);
auto m = overloaded<1, 2>(0);
-// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:4:21 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
+// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-1):21 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
// CHECK-CC1: OPENING_PAREN_LOC: {{.*}}4:20
// CHECK-CC1-DAG: OVERLOAD: [#float#]overloaded<<#int#>, char y>[#()#]
// CHECK-CC1-DAG: OVERLOAD: [#bool#]overloaded<<#class#>, int x>[#()#]
-// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:4:24 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s
+// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-5):24 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s
// CHECK-CC2-NOT: OVERLOAD: {{.*}}int x
// CHECK-CC2: OVERLOAD: [#float#]overloaded<int, <#char y#>>[#()#]
template <class T, T... args> int n = 0;
int val = n<int, 1, 2, 3>;
-// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:14:18 %s -o - | FileCheck -check-prefix=CHECK-CC3 %s
+// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-1):18 %s -o - | FileCheck -check-prefix=CHECK-CC3 %s
// CHECK-CC3: OVERLOAD: [#int#]n<class T, <#T ...args#>>
-// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:14:24 %s -o - | FileCheck -check-prefix=CHECK-CC4 %s
+// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-3):24 %s -o - | FileCheck -check-prefix=CHECK-CC4 %s
// CHECK-CC4: OVERLOAD: [#int#]n<class T, T ...args>
template <typename> struct Vector {};
template <typename Element, template <typename E> class Container = Vector>
struct Collection { Container<Element> container; };
-// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:22:31 %s -o - | FileCheck -check-prefix=CHECK-CC5 %s
+// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-1):31 %s -o - | FileCheck -check-prefix=CHECK-CC5 %s
// CHECK-CC5: OVERLOAD: [#class#]Container<<#typename E#>>
Collection<int, Vector> collection;
-// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:25:12 %s -o - | FileCheck -check-prefix=CHECK-CC6 %s
+// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-1):12 %s -o - | FileCheck -check-prefix=CHECK-CC6 %s
// CHECK-CC6: OVERLOAD: [#struct#]Collection<<#typename Element#>>
void f() {
std::vector<int> v;
v.foo();
- // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:18:8 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-2):8 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
// CHECK-CC1: allocator<<#typename T#>>
// CHECK-CC1-NEXT: vector<<#typename T#>{#, <#typename Alloc#>#}>
- // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:19:5 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-4):5 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s
// CHECK-CC2: foo
// CHECK-CC2: in_base
// CHECK-CC2: stop
template <typename> struct X;
template <typename T> struct X<T*> { X(double); };
X<int*> x(42);
-// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:32:11 %s -o - | FileCheck -check-prefix=CHECK-CONSTRUCTOR %s
+// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-1):11 %s -o - | FileCheck -check-prefix=CHECK-CONSTRUCTOR %s
// CHECK-CONSTRUCTOR: OVERLOAD: X(<#double#>)
// (rather than X<type-parameter-0-0 *>(<#double#>)
[this]() {
}();
- // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:4:1 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-2):1 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
// CHECK-CC1: const_func
// CHECK-CC1: mut_func
}
[this]() {
}();
- // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:13:1 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-2):1 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s
// CHECK-CC2-NOT: mut_func
// CHECK-CC2: const_func
};
// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s.h:4:8 -o - %s | FileCheck -check-prefix=CHECK-CC1 %s
// CHECK-CC1: X
// CHECK-CC1-NEXT: Y
-// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:5:8 -o - %s | FileCheck -check-prefix=CHECK-CC2 %s
+// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-5):8 -o - %s | FileCheck -check-prefix=CHECK-CC2 %s
// CHECK-CC2: X
// CHECK-CC2: Xa
// CHECK-CC2: Y
-// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:3:3 -o - %s
+// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-12):3 -o - %s
void test() {
unique_ptr<int> x;
x.
- // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:10:5 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-1):5 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
// CHECK-CC1: [#void#]reset({#<#pointer ptr = pointer()#>#})
}
namespace N2 {
using enum AAA;
- // RUN: %clang_cc1 -std=c++20 -fsyntax-only -code-completion-at=%s:4:14 %s | FileCheck -check-prefix=CHECK-CC1 %s
+ // RUN: %clang_cc1 -std=c++20 -fsyntax-only -code-completion-at=%s:%(line-1):14 %s | FileCheck -check-prefix=CHECK-CC1 %s
// CHECK-CC1: COMPLETION: AAA
};
void foo() {
using namespace
- // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:14:21 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-1):21 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
// CHECK-CC1: I1
// CHECK-CC1: I4
// CHECK-CC1: I5
int N3;
using
- // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:16:11 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-1):11 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
// CHECK-CC1: I1
// CHECK-CC1: I4
// CHECK-CC1: I5
// Tools, including clangd, can unexpand "args" when showing this to the user.
// The important thing is that we provide OVERLOAD signature in all those cases.
//
- // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:5:7 %s -o - | FileCheck --check-prefix=CHECK-1 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-5):7 %s -o - | FileCheck --check-prefix=CHECK-1 %s
// CHECK-1: OVERLOAD: [#void#]fun(<#T x#>, Args args...)
- // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:5:10 %s -o - | FileCheck --check-prefix=CHECK-2 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-7):10 %s -o - | FileCheck --check-prefix=CHECK-2 %s
// CHECK-2: OVERLOAD: [#void#]fun(int x)
- // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:5:13 %s -o - | FileCheck --check-prefix=CHECK-3 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-9):13 %s -o - | FileCheck --check-prefix=CHECK-3 %s
// CHECK-3: OVERLOAD: [#void#]fun(int x, int args)
- // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:5:16 %s -o - | FileCheck --check-prefix=CHECK-4 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-11):16 %s -o - | FileCheck --check-prefix=CHECK-4 %s
// CHECK-4: OVERLOAD: [#void#]fun(int x, int args, int args)
}
--- /dev/null
+#!/usr/bin/env python3
+
+"""Replaces absolute line numbers in lit-tests with relative line numbers.
+
+Writing line numbers like 152 in 'RUN: or CHECK:' makes tests hard to maintain:
+inserting lines in the middle of the test means updating all the line numbers.
+
+Encoding them relative to the current line helps, and tools support it:
+ Lit will substitute %(line+2) with the actual line number
+ FileCheck supports [[@LINE+2]]
+
+This tool takes a regex which captures a line number, and a list of test files.
+It searches for line numbers in the files and replaces them with a relative
+line number reference.
+"""
+
+USAGE = """Example usage:
+ find -type f clang/test/CodeCompletion | grep -v /Inputs/ | \\
+ xargs relative_lines.py --dry-run --verbose --near=100 \\
+ --pattern='-code-completion-at[ =]%s:(\d+)' \\
+ --pattern='requires fix-it: {(\d+):\d+-(\d+):\d+}'
+"""
+
+import argparse
+import re
+import sys
+
+def b(x):
+ return bytes(x, encoding='utf-8')
+
+parser = argparse.ArgumentParser(prog = 'relative_lines',
+ description = __doc__,
+ epilog = USAGE,
+ formatter_class=argparse.RawTextHelpFormatter)
+parser.add_argument('--near', type=int, default=20,
+ help = "maximum line distance to make relative")
+parser.add_argument('--partial', action='store_true', default=False,
+ help = "apply replacements to files even if others failed")
+parser.add_argument('--pattern', default=[], action='append',
+ type=lambda x: re.compile(b(x)),
+ help = "regex to match, with line numbers captured in ().")
+parser.add_argument('--verbose', action='store_true', default=False,
+ help = "print matches applied")
+parser.add_argument('--dry-run', action='store_true', default=False,
+ help = "don't apply replacements. Best with --verbose.")
+parser.add_argument('files', nargs = '+')
+args = parser.parse_args()
+
+for file in args.files:
+ try:
+ contents = open(file, 'rb').read()
+ except UnicodeDecodeError as e:
+ print(f"{file}: not valid UTF-8 - {e}", file=sys.stderr)
+ failures = 0
+
+ def line_number(offset):
+ return 1 + contents[:offset].count(b'\n')
+
+ def replace_one(capture, line, offset):
+ """Text to replace a capture group, e.g. 42 => %(line+1)"""
+ try:
+ target = int(capture)
+ except ValueError:
+ print(f"{file}:{line}: matched non-number '{capture}'", file=sys.stderr)
+ return capture
+
+ if args.near > 0 and abs(target - line) > args.near:
+ print(f"{file}:{line}: target line {target} is farther than {args.near}", file=sys.stderr)
+ return capture
+ if target > line:
+ delta = b('+' + str(target - line))
+ elif target < line:
+ delta = b('-' + str(line - target))
+ else:
+ delta = b''
+
+ prefix = contents[:offset].rsplit(b'\n')[-1]
+ is_lit = b'RUN' in prefix or b'DEFINE' in prefix
+ text = b(('%(line{0})' if is_lit else '[[@LINE{0}]]').format(delta))
+ if args.verbose:
+ print(f"{file}:{line}: {0} ==> {text}")
+ return text
+
+ def replace_match(m):
+ """Text to replace a whole match, e.g. --at=42:3 => --at=%(line+2):3"""
+ line = 1 + contents[:m.start()].count(b'\n')
+ result = ''
+ pos = m.start()
+ for index, capture in enumerate(m.groups()):
+ index += 1 # re groups are conventionally 1-indexed
+ result += contents[pos:m.start(index)]
+ replacement = replace_one(capture, line, m.start(index))
+ result += replacement
+ if replacement == capture:
+ global failures
+ failures += 1
+ pos = m.end(index)
+ result += contents[pos:m.end()]
+ return result
+
+ for pattern in args.pattern:
+ contents = re.sub(pattern, replace_match, contents)
+ if failures > 0 and not args.partial:
+ print(f"{file}: leaving unchanged (some failed, --partial not given)")
+ continue
+ if not args.dry_run:
+ open(file, "wb").write(contents)