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,7 @@
[
{
"directory": "test_dir/build",
"command": "clang++ -I../include -o bar.o test_dir/src/bar.cpp",
"file": "test_dir/src/bar.cpp"
}
]

View File

@@ -0,0 +1,71 @@
---
Name: foo
Contexts:
- ContextType: Namespace
ContextName: a
- ContextType: Namespace
ContextName: b
FilePath: foo.h
Type: Class
Seen: 1
Used: 0
---
Name: foo_bar
Contexts:
- ContextType: Namespace
ContextName: a
- ContextType: Namespace
ContextName: b
FilePath: foobar.h
Type: Class
Seen: 0
Used: 0
---
Name: bar
Contexts:
- ContextType: Namespace
ContextName: a
- ContextType: Namespace
ContextName: b
FilePath: ../include/bar.h
Type: Class
Seen: 1
Used: 0
---
Name: bar
Contexts:
- ContextType: Namespace
ContextName: a
- ContextType: Namespace
ContextName: b
FilePath: ../include/bar.h
Type: Class
Seen: 3
Used: 0
---
Name: bar
Contexts:
- ContextType: Namespace
ContextName: a
- ContextType: Namespace
ContextName: b
FilePath: ../include/zbar.h
Type: Class
Seen: 3
Used: 0
---
Name: b
Contexts:
FilePath: var.h
Type: Variable
Seen: 1
Used: 0
---
Name: bar
Contexts:
- ContextType: Namespace
ContextName: c
FilePath: test/include-fixer/baz.h
Type: Class
Seen: 1
Used: 0

View File

@@ -0,0 +1,20 @@
---
Name: foo
Contexts:
- ContextType: Namespace
ContextName: a
FilePath: foo.h
Type: Class
Seen: 1
Used: 1
...
---
Name: bar
Contexts:
- ContextType: Namespace
ContextName: a
FilePath: ../include/bar.h
Type: Class
Seen: 1
Used: 2
...

View File

@@ -0,0 +1,20 @@
---
Name: foo
Contexts:
- ContextType: Namespace
ContextName: a
FilePath: foo.h
Type: Class
Seen: 1
Used: 2
...
---
Name: bar
Contexts:
- ContextType: Namespace
ContextName: a
FilePath: ../include/barbar.h
Type: Class
Seen: 1
Used: 0
...

View File

@@ -0,0 +1,15 @@
// RUN: echo "foo f;" > %t.cpp
// RUN: clang-include-fixer -db=fixed -input='foo= "foo.h","bar.h"' -output-headers %t.cpp -- | FileCheck %s
// RUN: cat %t.cpp | clang-include-fixer -stdin -insert-header='{FilePath: "%/t.cpp", QuerySymbolInfos: [{RawIdentifier: foo, Range: {Offset: 0, Length: 3}}], HeaderInfos: [{Header: "\"foo.h\"", QualifiedName: "foo"}]}' %t.cpp | FileCheck %s -check-prefix=CHECK-CODE
// RUN: cat %t.cpp | not clang-include-fixer -stdin -insert-header='{FilePath: "%/t.cpp", QuerySymbolInfos: [{RawIdentifier: foo, Range: {Offset: 0, Length: 3}}], HeaderInfos: [{Header: "\"foo.h\"", QualifiedName: "foo"},{Header: "\"foo2.h\"", QualifiedName: "foo"}]}' %t.cpp
// RUN: cat %t.cpp | clang-include-fixer -stdin -insert-header='{FilePath: "%/t.cpp", QuerySymbolInfos: [{RawIdentifier: foo, Range: {Offset: 0, Length: 3}}], HeaderInfos: [{Header: "\"foo.h\"", QualifiedName: "a:foo"},{Header: "\"foo.h\"", QualifiedName: "b:foo"}]}' %t.cpp
//
// CHECK: "HeaderInfos": [
// CHECK-NEXT: {"Header": "\"foo.h\"",
// CHECK-NEXT: "QualifiedName": "foo"},
// CHECK-NEXT: {"Header": "\"bar.h\"",
// CHECK-NEXT: "QualifiedName": "foo"}
// CHECK-NEXT:]
//
// CHECK-CODE: #include "foo.h"
// CHECK-CODE: foo f;

View File

@@ -0,0 +1,10 @@
// RUN: sed -e 's#//.*$##' %s > %t.cpp
// RUN: not clang-include-fixer -db=fixed -input='foo= "foo.h"' %t.cpp --
// RUN: FileCheck %s -input-file=%t.cpp
// CHECK-NOT: #include
// CHECK: #include "doesnotexist.h"
// CHECK-NEXT: foo f;
#include "doesnotexist.h"
foo f;

View File

@@ -0,0 +1,8 @@
// RUN: sed -e 's#//.*$##' %s > %t.cpp
// RUN: clang-include-fixer -db=fixed -input='foo= "foo.h","bar.h"' %t.cpp --
// RUN: FileCheck %s -input-file=%t.cpp
// CHECK: #include "foo.h"
// CHECK: foo f;
foo f;

View File

@@ -0,0 +1,19 @@
// RUN: mkdir -p %T/include-fixer/include
// RUN: mkdir -p %T/include-fixer/symbols
// RUN: mkdir -p %T/include-fixer/build
// RUN: mkdir -p %T/include-fixer/src
// RUN: sed 's|test_dir|%/T/include-fixer|g' %S/Inputs/database_template.json > %T/include-fixer/build/compile_commands.json
// RUN: echo -e '#include "bar.h"\nb::a::bar f;' > %T/include-fixer/src/bar.cpp
// RUN: echo 'namespace b { namespace a { class bar {}; } }' > %T/include-fixer/include/bar.h
// RUN: cd %T/include-fixer/build
// RUN: find-all-symbols -output-dir=%T/include-fixer/symbols -p=. %T/include-fixer/src/bar.cpp
// RUN: find-all-symbols -merge-dir=%T/include-fixer/symbols %T/include-fixer/build/find_all_symbols.yaml
// RUN: FileCheck -input-file=%T/include-fixer/build/find_all_symbols.yaml -check-prefix=CHECK-YAML %s
//
// RUN: echo 'b::a::bar f;' > %T/include-fixer/src/bar.cpp
// RUN: clang-include-fixer -db=yaml -input=%T/include-fixer/build/find_all_symbols.yaml -minimize-paths=true -p=. %T/include-fixer/src/bar.cpp
// RUN: FileCheck -input-file=%T/include-fixer/src/bar.cpp %s
// CHECK-YAML: ..{{[/\\]}}include{{[/\\]}}bar.h
// CHECK: #include "bar.h"
// CHECK: b::a::bar f;

View File

@@ -0,0 +1,33 @@
# RUN: find-all-symbols -merge-dir=%S/Inputs/merge %t.merged
# RUN: sed '/^#/d' %s > %t.golden
# RUN: diff -u %t.golden %t.merged
---
Name: bar
Contexts:
- ContextType: Namespace
ContextName: a
FilePath: ../include/bar.h
Type: Class
Seen: 1
Used: 1
...
---
Name: bar
Contexts:
- ContextType: Namespace
ContextName: a
FilePath: ../include/barbar.h
Type: Class
Seen: 1
Used: 0
...
---
Name: foo
Contexts:
- ContextType: Namespace
ContextName: a
FilePath: foo.h
Type: Class
Seen: 2
Used: 2
...

View File

@@ -0,0 +1,13 @@
// REQUIRES: shell
// RUN: sed -e 's#//.*$##' %s > %t.cpp
// RUN: mkdir -p %T/include-fixer/multiple-fixes
// RUN: echo 'foo f;' > %T/include-fixer/multiple-fixes/foo.cpp
// RUN: echo 'bar b;' > %T/include-fixer/multiple-fixes/bar.cpp
// RUN: clang-include-fixer -db=fixed -input='foo= "foo.h";bar= "bar.h"' %T/include-fixer/multiple-fixes/*.cpp --
// RUN: FileCheck -input-file=%T/include-fixer/multiple-fixes/bar.cpp %s -check-prefix=CHECK-BAR
// RUN: FileCheck -input-file=%T/include-fixer/multiple-fixes/foo.cpp %s -check-prefix=CHECK-FOO
//
// CHECK-FOO: #include "foo.h"
// CHECK-FOO: foo f;
// CHECK-BAR: #include "bar.h"
// CHECK-BAR: bar b;

View File

@@ -0,0 +1,10 @@
// RUN: sed -e 's#//.*$##' %s > %t.cpp
// RUN: clang-include-fixer -db=yaml -input=%p/Inputs/fake_yaml_db.yaml %t.cpp --
// RUN: FileCheck %s -input-file=%t.cpp
// CHECK-NOT: #include
// CHECK: doesnotexist f;
namespace b {
doesnotexist f;
}

View File

@@ -0,0 +1,13 @@
// RUN: clang-include-fixer -db=fixed -input='foo= "foo.h","bar.h"' -query-symbol="foo" test.cpp -- | FileCheck %s
// CHECK: "FilePath": "test.cpp",
// CHECK-NEXT:"QuerySymbolInfos": [
// CHECK-NEXT: {"RawIdentifier": "foo",
// CHECK-NEXT: "Range":{"Offset":0,"Length":0}}
// CHECK-NEXT:],
// CHECK-NEXT:"HeaderInfos": [
// CHECK-NEXT: {"Header": "\"foo.h\"",
// CHECK-NEXT: "QualifiedName": "foo"},
// CHECK-NEXT: {"Header": "\"bar.h\"",
// CHECK-NEXT: "QualifiedName": "foo"}
// CHECK-NEXT:]

View File

@@ -0,0 +1,13 @@
// RUN: clang-include-fixer -db=yaml -input=%S/Inputs/fake_yaml_db.yaml -output-headers %s -- | FileCheck %s
// RUN: clang-include-fixer -query-symbol bar -db=yaml -input=%S/Inputs/fake_yaml_db.yaml -output-headers %s -- | FileCheck %s
// CHECK: "HeaderInfos": [
// CHECK-NEXT: {"Header": "\"test/include-fixer/baz.h\"",
// CHECK-NEXT: "QualifiedName": "c::bar"},
// CHECK-NEXT: {"Header": "\"../include/bar.h\"",
// CHECK-NEXT: "QualifiedName": "b::a::bar"},
// CHECK-NEXT: {"Header": "\"../include/zbar.h\"",
// CHECK-NEXT: "QualifiedName": "b::a::bar"}
// CHECK-NEXT:]
bar b;

View File

@@ -0,0 +1,9 @@
// RUN: sed -e 's#//.*$##' %s > %t.cpp
// RUN: clang-include-fixer -db=fuzzyYaml -input=%p/Inputs/fake_yaml_db.yaml %t.cpp --
// RUN: FileCheck %s -input-file=%t.cpp
// include-fixer will add the include, but doesn't complete the symbol.
// CHECK: #include "foobar.h"
// CHECK: fba f;
b::a::fba f;

View File

@@ -0,0 +1,8 @@
// RUN: sed -e 's#//.*$##' %s > %t.cpp
// RUN: clang-include-fixer -db=yaml -input=%p/Inputs/fake_yaml_db.yaml %t.cpp --
// RUN: FileCheck %s -input-file=%t.cpp
// CHECK: #include "foo.h"
// CHECK: b::a::foo f;
b::a::foo f;

View File

@@ -0,0 +1,11 @@
// RUN: mkdir -p %T/foo/bar
// RUN: cp %p/Inputs/fake_yaml_db.yaml %T/find_all_symbols_db.yaml
// RUN: cd %T/foo
// RUN: sed -e 's#//.*$##' %s > bar/test.cpp
// RUN: clang-include-fixer -db=yaml bar/test.cpp --
// RUN: FileCheck %s -input-file=bar/test.cpp
// CHECK: #include "foo.h"
// CHECK: b::a::foo f;
b::a::foo f;

View File

@@ -0,0 +1,25 @@
// REQUIRES: static-analyzer
// RUN: c-index-test -test-load-source-reparse 2 all %s -Xclang -add-plugin -Xclang clang-include-fixer -fspell-checking -Xclang -plugin-arg-clang-include-fixer -Xclang -input=%p/Inputs/fake_yaml_db.yaml 2>&1 | FileCheck %s
foo f;
foo g;
unknown u;
// CHECK: yamldb_plugin.cpp:4:1: error: unknown type name 'foo'; did you mean 'foo'?
// CHECK: Number FIX-ITs = 1
// CHECK: FIX-IT: Replace [4:1 - 4:4] with "foo"
// CHECK: yamldb_plugin.cpp:4:1: note: Add '#include "foo.h"' to provide the missing declaration [clang-include-fixer]
// CHECK: Number FIX-ITs = 1
// CHECK: FIX-IT: Insert "#include "foo.h"
// CHECK: yamldb_plugin.cpp:5:1: error: unknown type name 'foo'; did you mean 'foo'?
// CHECK: Number FIX-ITs = 1
// CHECK: FIX-IT: Replace [5:1 - 5:4] with "foo"
// CHECK: yamldb_plugin.cpp:5:1: note: Add '#include "foo.h"' to provide the missing declaration [clang-include-fixer]
// CHECK: Number FIX-ITs = 1
// CHECK: FIX-IT: Insert "#include "foo.h"
// CHECK: " at 4:1
// CHECK: yamldb_plugin.cpp:6:1:
// CHECK: error: unknown type name 'unknown'
// CHECK: Number FIX-ITs = 0
// CHECK-NOT: error
// CHECK-NOT: FIX-IT