Imported Upstream version 6.10.0.49

Former-commit-id: 1d6753294b2993e1fbf92de9366bb9544db4189b
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2020-01-16 16:38:04 +00:00
parent d94e79959b
commit 468663ddbb
48518 changed files with 2789335 additions and 61176 deletions

View File

@@ -0,0 +1,11 @@
// RUN: rm -rf %t
// RUN: mkdir -p %t/fixes
// RUN: cat %s > %t.cpp
// RUN: clang-rename -offset=254 -new-name=Bar -export-fixes=%t/fixes/clang-rename.yaml %t.cpp --
// RUN: clang-apply-replacements %t
// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s
class Foo {}; // CHECK: class Bar {};
// Use grep -FUbo 'Foo' <file> to get the correct offset of Cla when changing
// this file.

View File

@@ -0,0 +1,32 @@
#ifndef BASIC_H
#define BASIC_H
class Parent {
public:
virtual void func() {}
};
class Derived : public Parent {
public:
virtual void func() {}
// CHECK: virtual void func() override {}
};
extern void ext(int (&)[5], const Parent &);
void func(int t) {
int ints[5];
for (unsigned i = 0; i < 5; ++i) {
int &e = ints[i];
e = t;
// CHECK: for (auto & elem : ints) {
// CHECK-NEXT: elem = t;
}
Derived d;
ext(ints, d);
}
#endif // BASIC_H

View File

@@ -0,0 +1,25 @@
---
MainSourceFile: source1.cpp
Diagnostics:
- DiagnosticName: test-basic
Message: Fix
FilePath: $(path)/basic.h
FileOffset: 242
Replacements:
- FilePath: $(path)/basic.h
Offset: 242
Length: 26
ReplacementText: 'auto & elem : ints'
- FilePath: $(path)/basic.h
Offset: 276
Length: 22
ReplacementText: ''
- FilePath: $(path)/basic.h
Offset: 298
Length: 1
ReplacementText: elem
- FilePath: $(path)/../basic/basic.h
Offset: 148
Length: 0
ReplacementText: 'override '
...

View File

@@ -0,0 +1,13 @@
---
MainSourceFile: source2.cpp
Diagnostics:
- DiagnosticName: test-basic
Message: Fix
FilePath: $(path)/basic.h
FileOffset: 148
Replacements:
- FilePath: $(path)/basic.h
Offset: 148
Length: 0
ReplacementText: 'override '
...

View File

@@ -0,0 +1,17 @@
#ifndef COMMON_H
#define COMMON_H
extern void ext(int (&)[5]);
void func(int t) {
int ints[5];
for (unsigned i = 0; i < 5; ++i) {
ints[i] = t;
}
int *i = 0;
ext(ints);
}
#endif // COMMON_H

View File

@@ -0,0 +1,11 @@
There are conflicting changes to $(path)/common.h:
The following changes conflict:
Replace 8:8-8:33 with "auto & i : ints"
Replace 8:8-8:33 with "int & elem : ints"
The following changes conflict:
Replace 9:5-9:11 with "elem"
Replace 9:5-9:11 with "i"
The following changes conflict:
Remove 12:3-12:14
Insert at 12:12 (int*)
Replace 12:12-12:12 with "nullptr"

View File

@@ -0,0 +1,21 @@
---
MainSourceFile: source1.cpp
Diagnostics:
- DiagnosticName: test-conflict
Message: Fix
FilePath: $(path)/common.h
FileOffset: 106
Replacements:
- FilePath: $(path)/common.h
Offset: 106
Length: 26
ReplacementText: 'auto & i : ints'
- FilePath: $(path)/common.h
Offset: 140
Length: 7
ReplacementText: i
- FilePath: $(path)/common.h
Offset: 160
Length: 12
ReplacementText: ''
...

View File

@@ -0,0 +1,21 @@
---
MainSourceFile: source2.cpp
Diagnostics:
- DiagnosticName: test-conflict
Message: Fix
FilePath: $(path)/common.h
FileOffset: 106
Replacements:
- FilePath: $(path)/common.h
Offset: 106
Length: 26
ReplacementText: 'int & elem : ints'
- FilePath: $(path)/common.h
Offset: 140
Length: 7
ReplacementText: elem
- FilePath: $(path)/common.h
Offset: 169
Length: 1
ReplacementText: nullptr
...

View File

@@ -0,0 +1,13 @@
---
MainSourceFile: source1.cpp
Diagnostics:
- DiagnosticName: test-conflict
Message: Fix
FilePath: $(path)/common.h
FileOffset: 169
Replacements:
- FilePath: $(path)/common.h
Offset: 169
Length: 0
ReplacementText: "(int*)"
...

View File

@@ -0,0 +1,6 @@
// This file intentionally uses a CRLF newlines!
void foo() {
int *x = 0;
}

View File

@@ -0,0 +1,6 @@
// This file intentionally uses a CRLF newlines!
void foo() {
int *x = nullptr;
}

View File

@@ -0,0 +1,13 @@
---
MainSourceFile: source1.cpp
Diagnostics:
- DiagnosticName: test-crlf
Message: Fix
FilePath: $(path)/crlf.cpp
FileOffset: 79
Replacements:
- FilePath: $(path)/crlf.cpp
Offset: 79
Length: 1
ReplacementText: nullptr
...

View File

@@ -0,0 +1,6 @@
class C {};
void f() { // This comment necessary to prevent formatting as void f() { ... }
C *a = new C();
// CHECK: {{^\ \ auto\ a\ \=\ new\ C\(\);}}
}

View File

@@ -0,0 +1,13 @@
---
MainSourceFile: no.cpp
Diagnostics:
- DiagnosticName: test-no
Message: Fix
FilePath: $(path)/no.cpp
FileOffset: 94
Replacements:
- FilePath: $(path)/no.cpp
Offset: 94
Length: 3
ReplacementText: 'auto '
...

View File

@@ -0,0 +1,22 @@
class MyType012345678901234567890123456789 {};
void g(int, int*, int, int*, int, int*, int);
void f() {
MyType012345678901234567890123456789 *a =
new MyType012345678901234567890123456789();
// CHECK: {{^\ \ auto\ a\ \=\ new\ MyType012345678901234567890123456789\(\);}}
int iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii;
int jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj;
int kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk;
int mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm;
g(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii, 0, jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj,
0, kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk, 0, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm);
// CHECK: g(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii, nullptr,
// CHECK-NEXT: jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj, nullptr,
// CHECK-NEXT: kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk, nullptr,
// CHECK-NEXT: mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm);
delete a;
}

View File

@@ -0,0 +1,27 @@
# These replacements are out of order on purpose to test that they get sorted
# so that formatting happens correctly.
---
MainSourceFile: yes.cpp
Diagnostics:
- DiagnosticName: test-yes
Message: Fix
FilePath: $(path)/yes.cpp
FileOffset: 494
Replacements:
- FilePath: $(path)/yes.cpp
Offset: 494
Length: 1
ReplacementText: nullptr
- FilePath: $(path)/yes.cpp
Offset: 410
Length: 1
ReplacementText: nullptr
- FilePath: $(path)/yes.cpp
Offset: 454
Length: 1
ReplacementText: nullptr
- FilePath: $(path)/yes.cpp
Offset: 108
Length: 38
ReplacementText: 'auto '
...

View File

@@ -0,0 +1,12 @@
---
MainSourceFile: ''
Replacements:
- FilePath: idontexist.h
Offset: 2669
Length: 0
ReplacementText: ' override'
- FilePath: idontexist.h
Offset: 2669
Length: 0
ReplacementText: ' override'
...

View File

@@ -0,0 +1,17 @@
// RUN: mkdir -p %T/Inputs/basic
// RUN: grep -Ev "// *[A-Z-]+:" %S/Inputs/basic/basic.h > %T/Inputs/basic/basic.h
// RUN: sed "s#\$(path)#%/T/Inputs/basic#" %S/Inputs/basic/file1.yaml > %T/Inputs/basic/file1.yaml
// RUN: sed "s#\$(path)#%/T/Inputs/basic#" %S/Inputs/basic/file2.yaml > %T/Inputs/basic/file2.yaml
// RUN: clang-apply-replacements %T/Inputs/basic
// RUN: FileCheck -input-file=%T/Inputs/basic/basic.h %S/Inputs/basic/basic.h
//
// Check that the yaml files are *not* deleted after running clang-apply-replacements without remove-change-desc-files.
// RUN: ls -1 %T/Inputs/basic | FileCheck %s --check-prefix=YAML
//
// Check that the yaml files *are* deleted after running clang-apply-replacements with remove-change-desc-files.
// RUN: grep -Ev "// *[A-Z-]+:" %S/Inputs/basic/basic.h > %T/Inputs/basic/basic.h
// RUN: clang-apply-replacements -remove-change-desc-files %T/Inputs/basic
// RUN: ls -1 %T/Inputs/basic | FileCheck %s --check-prefix=NO_YAML
//
// YAML: {{^file.\.yaml$}}
// NO_YAML-NOT: {{^file.\.yaml$}}

View File

@@ -0,0 +1,17 @@
// RUN: mkdir -p %T/Inputs/conflict
// RUN: sed "s#\$(path)#%/S/Inputs/conflict#" %S/Inputs/conflict/file1.yaml > %T/Inputs/conflict/file1.yaml
// RUN: sed "s#\$(path)#%/S/Inputs/conflict#" %S/Inputs/conflict/file2.yaml > %T/Inputs/conflict/file2.yaml
// RUN: sed "s#\$(path)#%/S/Inputs/conflict#" %S/Inputs/conflict/file3.yaml > %T/Inputs/conflict/file3.yaml
// RUN: sed "s#\$(path)#%/S/Inputs/conflict#" %S/Inputs/conflict/expected.txt > %T/Inputs/conflict/expected.txt
// RUN: not clang-apply-replacements %T/Inputs/conflict > %T/Inputs/conflict/output.txt 2>&1
// RUN: diff -b %T/Inputs/conflict/output.txt %T/Inputs/conflict/expected.txt
//
// Check that the yaml files are *not* deleted after running clang-apply-replacements without remove-change-desc-files even when there is a failure.
// RUN: ls -1 %T/Inputs/conflict | FileCheck %s --check-prefix=YAML
//
// Check that the yaml files *are* deleted after running clang-apply-replacements with remove-change-desc-files even when there is a failure.
// RUN: not clang-apply-replacements %T/Inputs/conflict -remove-change-desc-files > %T/Inputs/conflict/output.txt 2>&1
// RUN: ls -1 %T/Inputs/conflict | FileCheck %s --check-prefix=NO_YAML
//
// YAML: {{^file.\.yaml$}}
// NO_YAML-NOT: {{^file.\.yaml$}}

View File

@@ -0,0 +1,5 @@
// RUN: mkdir -p %T/Inputs/crlf
// RUN: cp %S/Inputs/crlf/crlf.cpp %T/Inputs/crlf/crlf.cpp
// RUN: sed "s#\$(path)#%/T/Inputs/crlf#" %S/Inputs/crlf/file1.yaml > %T/Inputs/crlf/file1.yaml
// RUN: clang-apply-replacements %T/Inputs/crlf
// RUN: diff %T/Inputs/crlf/crlf.cpp %S/Inputs/crlf/crlf.cpp.expected

Some files were not shown because too many files have changed in this diff Show More