Fix some warnings in tests.

This commit is contained in:
Jacob Dufault 2017-12-20 09:43:26 -08:00
parent e26f1caaba
commit cb6aa5f1c9
12 changed files with 212 additions and 199 deletions

View File

@ -3,8 +3,8 @@ struct Type {
};
void Make() {
Type foo;
auto foo = Type();
Type foo0;
auto foo1 = Type();
}
/*
@ -25,8 +25,8 @@ OUTPUT:
"types": [],
"funcs": [0],
"vars": [],
"instances": [0],
"uses": ["1:8-1:12", "2:3-2:7", "6:3-6:7"]
"instances": [0, 1],
"uses": ["1:8-1:12", "2:3-2:7", "6:3-6:7", "7:15-7:19"]
}],
"funcs": [{
"id": 0,
@ -42,7 +42,7 @@ OUTPUT:
"base": [],
"derived": [],
"locals": [],
"callers": ["~1@6:8-6:11"],
"callers": ["~1@6:8-6:12", "1@7:15-7:19"],
"callees": []
}, {
"id": 1,
@ -58,31 +58,32 @@ OUTPUT:
"derived": [],
"locals": [],
"callers": [],
"callees": ["~0@6:8-6:11"]
"callees": ["~0@6:8-6:12", "0@7:15-7:19"]
}],
"vars": [{
"id": 0,
"usr": "c:implicit_constructor.cc@51@F@Make#@foo",
"short_name": "foo",
"detailed_name": "Type foo",
"usr": "c:implicit_constructor.cc@51@F@Make#@foo0",
"short_name": "foo0",
"detailed_name": "Type foo0",
"hover": "Type",
"definition_spelling": "6:8-6:11",
"definition_extent": "6:3-6:11",
"definition_spelling": "6:8-6:12",
"definition_extent": "6:3-6:12",
"variable_type": 0,
"is_local": true,
"is_macro": false,
"uses": ["6:8-6:11"]
"uses": ["6:8-6:12"]
}, {
"id": 1,
"usr": "c:implicit_constructor.cc@64@F@Make#@foo",
"short_name": "foo",
"detailed_name": "auto foo",
"hover": "auto",
"definition_spelling": "7:8-7:11",
"definition_extent": "7:3-7:11",
"usr": "c:implicit_constructor.cc@65@F@Make#@foo1",
"short_name": "foo1",
"detailed_name": "Type foo1",
"hover": "Type",
"definition_spelling": "7:8-7:12",
"definition_extent": "7:3-7:21",
"variable_type": 0,
"is_local": true,
"is_macro": false,
"uses": ["7:8-7:11"]
"uses": ["7:8-7:12"]
}]
}
*/

View File

@ -1,5 +1,5 @@
class IFoo {
virtual void foo() = 0 {}
virtual void foo() = 0;
};
/*
@ -30,9 +30,12 @@ OUTPUT:
"short_name": "foo",
"detailed_name": "void IFoo::foo()",
"hover": "void IFoo::foo()",
"declarations": [],
"definition_spelling": "2:16-2:19",
"definition_extent": "2:3-2:28",
"declarations": [{
"spelling": "2:16-2:19",
"extent": "2:3-2:25",
"content": "virtual void foo() = 0",
"param_spellings": []
}],
"declaring_type": 0,
"base": [],
"derived": [],

View File

@ -5,10 +5,10 @@ namespace foo {
}
}
}
namespace fbz = foo::bar::baz;
void foo() {
void func() {
int a = foo::bar::baz::qux;
int b = fbz::qux;
}
@ -22,12 +22,12 @@ OUTPUT:
"funcs": [{
"id": 0,
"is_operator": false,
"usr": "c:@F@foo#",
"short_name": "foo",
"detailed_name": "void foo()",
"hover": "void foo()",
"usr": "c:@F@func#",
"short_name": "func",
"detailed_name": "void func()",
"hover": "void func()",
"declarations": [],
"definition_spelling": "11:6-11:9",
"definition_spelling": "11:6-11:10",
"definition_extent": "11:1-14:2",
"base": [],
"derived": [],
@ -48,7 +48,7 @@ OUTPUT:
"uses": ["4:18-4:21", "12:26-12:29", "13:16-13:19"]
}, {
"id": 1,
"usr": "c:namespace_alias.cc@167@F@foo#@a",
"usr": "c:namespace_alias.cc@167@F@func#@a",
"short_name": "a",
"detailed_name": "int a",
"hover": "int",
@ -59,7 +59,7 @@ OUTPUT:
"uses": ["12:7-12:8"]
}, {
"id": 2,
"usr": "c:namespace_alias.cc@198@F@foo#@b",
"usr": "c:namespace_alias.cc@198@F@func#@b",
"short_name": "b",
"detailed_name": "int b",
"hover": "int",

View File

@ -4,7 +4,7 @@ class Foo {
int operator()(int a, int b);
};
friend Foo &operator += (const Foo&, const Type&);
Foo &operator += (const Foo&, const int&);
/*
OUTPUT:
@ -25,7 +25,7 @@ OUTPUT:
"funcs": [0, 1, 2],
"vars": [],
"instances": [],
"uses": ["1:7-1:10", "7:8-7:11", "7:32-7:35"]
"uses": ["1:7-1:10", "7:1-7:4", "7:25-7:28"]
}],
"funcs": [{
"id": 0,
@ -89,10 +89,10 @@ OUTPUT:
"detailed_name": "Foo &operator+=(const Foo &, const int &)",
"hover": "Foo &operator+=(const Foo &, const int &)",
"declarations": [{
"spelling": "7:13-7:24",
"extent": "7:1-7:50",
"content": "friend Foo &operator += (const Foo&, const Type&)",
"param_spellings": ["7:36-7:36", "7:49-7:49"]
"spelling": "7:6-7:17",
"extent": "7:1-7:42",
"content": "Foo &operator += (const Foo&, const int&)",
"param_spellings": ["7:29-7:29", "7:41-7:41"]
}],
"base": [],
"derived": [],

View File

@ -22,7 +22,6 @@
#include <stdnoreturn.h>
#include <string.h>
#include <tgmath.h>
#include <threads.h>
#include <time.h>
#include <uchar.h>
#include <wchar.h>
@ -208,316 +207,316 @@ OUTPUT:
"line": 24,
"resolved_path": "&tgmath.h"
}, {
"line": 26,
"line": 25,
"resolved_path": "&time.h"
}, {
"line": 27,
"line": 26,
"resolved_path": "&uchar.h"
}, {
"line": 28,
"line": 27,
"resolved_path": "&wchar.h"
}, {
"line": 29,
"line": 28,
"resolved_path": "&wctype.h"
}, {
"line": 32,
"line": 31,
"resolved_path": "&string"
}, {
"line": 33,
"line": 32,
"resolved_path": "&xiosbase"
}, {
"line": 34,
"line": 33,
"resolved_path": "&algorithm"
}, {
"line": 34,
"resolved_path": "&type_traits"
}, {
"line": 35,
"resolved_path": "&type_traits"
"resolved_path": "&iterator"
}, {
"line": 36,
"resolved_path": "&iterator"
}, {
"line": 37,
"resolved_path": "&stdlib.h"
}, {
"line": 38,
"line": 37,
"resolved_path": "&cstddef"
}, {
"line": 38,
"resolved_path": "&cmath"
}, {
"line": 39,
"resolved_path": "&cmath"
"resolved_path": "&set"
}, {
"line": 40,
"resolved_path": "&set"
"resolved_path": "&iosfwd"
}, {
"line": 41,
"resolved_path": "&iosfwd"
"resolved_path": "&streambuf"
}, {
"line": 42,
"resolved_path": "&streambuf"
"resolved_path": "&ostream"
}, {
"line": 43,
"resolved_path": "&ostream"
"resolved_path": "&fstream"
}, {
"line": 44,
"resolved_path": "&fstream"
"resolved_path": "&memory"
}, {
"line": 45,
"resolved_path": "&memory"
"resolved_path": "&stdexcept"
}, {
"line": 46,
"resolved_path": "&stdexcept"
"resolved_path": "&vector"
}, {
"line": 47,
"resolved_path": "&vector"
"resolved_path": "&sstream"
}, {
"line": 48,
"resolved_path": "&sstream"
"resolved_path": "&iomanip"
}, {
"line": 49,
"resolved_path": "&iomanip"
"resolved_path": "&limits"
}, {
"line": 50,
"resolved_path": "&limits"
"resolved_path": "&tuple"
}, {
"line": 51,
"resolved_path": "&tuple"
}, {
"line": 52,
"resolved_path": "&cstdlib"
}, {
"line": 53,
"line": 52,
"resolved_path": "&csignal"
}, {
"line": 54,
"line": 53,
"resolved_path": "&csetjmp"
}, {
"line": 55,
"line": 54,
"resolved_path": "&cstdarg"
}, {
"line": 56,
"line": 55,
"resolved_path": "&typeinfo"
}, {
"line": 57,
"line": 56,
"resolved_path": "&typeindex"
}, {
"line": 58,
"line": 57,
"resolved_path": "&type_traits"
}, {
"line": 59,
"line": 58,
"resolved_path": "&bitset"
}, {
"line": 60,
"line": 59,
"resolved_path": "&functional"
}, {
"line": 61,
"line": 60,
"resolved_path": "&utility"
}, {
"line": 62,
"line": 61,
"resolved_path": "&ctime"
}, {
"line": 63,
"line": 62,
"resolved_path": "&chrono"
}, {
"line": 64,
"line": 63,
"resolved_path": "&cstddef"
}, {
"line": 65,
"line": 64,
"resolved_path": "&initializer_list"
}, {
"line": 66,
"line": 65,
"resolved_path": "&tuple"
}, {
"line": 67,
"line": 66,
"resolved_path": "&any"
}, {
"line": 68,
"line": 67,
"resolved_path": "&optional"
}, {
"line": 69,
"line": 68,
"resolved_path": "&variant"
}, {
"line": 70,
"line": 69,
"resolved_path": "&new"
}, {
"line": 71,
"line": 70,
"resolved_path": "&memory"
}, {
"line": 72,
"line": 71,
"resolved_path": "&scoped_allocator"
}, {
"line": 74,
"line": 73,
"resolved_path": "&climits"
}, {
"line": 75,
"line": 74,
"resolved_path": "&cfloat"
}, {
"line": 76,
"line": 75,
"resolved_path": "&cstdint"
}, {
"line": 77,
"line": 76,
"resolved_path": "&cinttypes"
}, {
"line": 78,
"line": 77,
"resolved_path": "&limits"
}, {
"line": 79,
"line": 78,
"resolved_path": "&exception"
}, {
"line": 80,
"line": 79,
"resolved_path": "&stdexcept"
}, {
"line": 81,
"line": 80,
"resolved_path": "&cassert"
}, {
"line": 82,
"line": 81,
"resolved_path": "&system_error"
}, {
"line": 83,
"line": 82,
"resolved_path": "&cerrno"
}, {
"line": 84,
"line": 83,
"resolved_path": "&cctype"
}, {
"line": 85,
"line": 84,
"resolved_path": "&cwctype"
}, {
"line": 86,
"line": 85,
"resolved_path": "&cstring"
}, {
"line": 87,
"line": 86,
"resolved_path": "&cwchar"
}, {
"line": 88,
"line": 87,
"resolved_path": "&cuchar"
}, {
"line": 89,
"line": 88,
"resolved_path": "&string"
}, {
"line": 90,
"line": 89,
"resolved_path": "&string_view"
}, {
"line": 91,
"line": 90,
"resolved_path": "&array"
}, {
"line": 92,
"line": 91,
"resolved_path": "&vector"
}, {
"line": 93,
"line": 92,
"resolved_path": "&deque"
}, {
"line": 94,
"line": 93,
"resolved_path": "&list"
}, {
"line": 95,
"line": 94,
"resolved_path": "&forward_list"
}, {
"line": 96,
"line": 95,
"resolved_path": "&set"
}, {
"line": 97,
"line": 96,
"resolved_path": "&map"
}, {
"line": 98,
"line": 97,
"resolved_path": "&unordered_set"
}, {
"line": 99,
"line": 98,
"resolved_path": "&unordered_map"
}, {
"line": 100,
"line": 99,
"resolved_path": "&stack"
}, {
"line": 101,
"line": 100,
"resolved_path": "&queue"
}, {
"line": 102,
"line": 101,
"resolved_path": "&algorithm"
}, {
"line": 104,
"line": 103,
"resolved_path": "&iterator"
}, {
"line": 105,
"line": 104,
"resolved_path": "&cmath"
}, {
"line": 106,
"line": 105,
"resolved_path": "&complex"
}, {
"line": 107,
"line": 106,
"resolved_path": "&valarray"
}, {
"line": 108,
"line": 107,
"resolved_path": "&random"
}, {
"line": 109,
"line": 108,
"resolved_path": "&numeric"
}, {
"line": 110,
"line": 109,
"resolved_path": "&ratio"
}, {
"line": 111,
"line": 110,
"resolved_path": "&cfenv"
}, {
"line": 112,
"line": 111,
"resolved_path": "&iosfwd"
}, {
"line": 113,
"line": 112,
"resolved_path": "&ios"
}, {
"line": 114,
"line": 113,
"resolved_path": "&istream"
}, {
"line": 115,
"line": 114,
"resolved_path": "&ostream"
}, {
"line": 116,
"line": 115,
"resolved_path": "&iostream"
}, {
"line": 117,
"line": 116,
"resolved_path": "&fstream"
}, {
"line": 118,
"line": 117,
"resolved_path": "&sstream"
}, {
"line": 119,
"line": 118,
"resolved_path": "&strstream"
}, {
"line": 120,
"line": 119,
"resolved_path": "&iomanip"
}, {
"line": 121,
"line": 120,
"resolved_path": "&streambuf"
}, {
"line": 122,
"line": 121,
"resolved_path": "&cstdio"
}, {
"line": 123,
"line": 122,
"resolved_path": "&locale"
}, {
"line": 124,
"line": 123,
"resolved_path": "&clocale"
}, {
"line": 125,
"line": 124,
"resolved_path": "&codecvt"
}, {
"line": 126,
"line": 125,
"resolved_path": "&regex"
}, {
"line": 127,
"line": 126,
"resolved_path": "&atomic"
}, {
"line": 128,
"line": 127,
"resolved_path": "&thread"
}, {
"line": 129,
"line": 128,
"resolved_path": "&mutex"
}, {
"line": 130,
"line": 129,
"resolved_path": "&shared_mutex"
}, {
"line": 131,
"line": 130,
"resolved_path": "&future"
}, {
"line": 132,
"line": 131,
"resolved_path": "&condition_variable"
}, {
"line": 133,
"line": 132,
"resolved_path": "&filesystem"
}],
"skipped_by_preprocessor": [],

View File

@ -6,6 +6,7 @@ class Template {
template<class T>
void Template<T>::Foo() {}
template<>
void Template<void>::Foo() {}
@ -31,7 +32,7 @@ OUTPUT:
"funcs": [0],
"vars": [],
"instances": [],
"uses": ["2:7-2:15", "7:6-7:14", "9:6-9:14"]
"uses": ["2:7-2:15", "7:6-7:14", "10:6-10:14"]
}],
"funcs": [{
"id": 0,
@ -46,9 +47,9 @@ OUTPUT:
"content": "void Foo()",
"param_spellings": []
}, {
"spelling": "9:22-9:25",
"extent": "9:1-9:30",
"content": "void Template<void>::Foo() {}",
"spelling": "10:22-10:25",
"extent": "9:1-10:30",
"content": "template<>\n void Template<void>::Foo() {}",
"param_spellings": []
}],
"definition_spelling": "7:19-7:22",

View File

@ -2,10 +2,10 @@ enum A {};
enum B {};
template<typename T>
T var = 3;
T var = T();
int a = var<A>;
int b = var<B>;
A a = var<A>;
B b = var<B>;
// NOTE: libclang before 4.0 doesn't expose template usage on |var|.
@ -28,6 +28,9 @@ UnexposedDecl var
#endif
/*
EXTRA_FLAGS:
-std=c++14
OUTPUT:
{
"includes": [],
@ -45,8 +48,8 @@ OUTPUT:
"types": [],
"funcs": [],
"vars": [],
"instances": [],
"uses": ["1:6-1:7", "7:13-7:14"]
"instances": [1],
"uses": ["1:6-1:7", "7:1-7:2", "7:11-7:12"]
}, {
"id": 1,
"usr": "c:@E@B",
@ -60,8 +63,8 @@ OUTPUT:
"types": [],
"funcs": [],
"vars": [],
"instances": [],
"uses": ["2:6-2:7", "8:13-8:14"]
"instances": [2],
"uses": ["2:6-2:7", "8:1-8:2", "8:11-8:12"]
}, {
"id": 2,
"usr": "c:template_var_usage_folded_into_one.cc@35",
@ -74,7 +77,7 @@ OUTPUT:
"funcs": [],
"vars": [],
"instances": [],
"uses": ["5:1-5:2"]
"uses": ["5:1-5:2", "5:9-5:10"]
}],
"funcs": [],
"vars": [{
@ -84,32 +87,34 @@ OUTPUT:
"detailed_name": "T var",
"hover": "T",
"definition_spelling": "5:3-5:6",
"definition_extent": "5:1-5:10",
"definition_extent": "5:1-5:12",
"is_local": false,
"is_macro": false,
"uses": ["5:3-5:6", "7:9-7:12", "8:9-8:12"]
"uses": ["5:3-5:6", "7:7-7:10", "8:7-8:10"]
}, {
"id": 1,
"usr": "c:@a",
"short_name": "a",
"detailed_name": "int a",
"hover": "int",
"definition_spelling": "7:5-7:6",
"definition_extent": "7:1-7:15",
"detailed_name": "A a",
"hover": "A",
"definition_spelling": "7:3-7:4",
"definition_extent": "7:1-7:13",
"variable_type": 0,
"is_local": false,
"is_macro": false,
"uses": ["7:5-7:6"]
"uses": ["7:3-7:4"]
}, {
"id": 2,
"usr": "c:@b",
"short_name": "b",
"detailed_name": "int b",
"hover": "int",
"definition_spelling": "8:5-8:6",
"definition_extent": "8:1-8:15",
"detailed_name": "B b",
"hover": "B",
"definition_spelling": "8:3-8:4",
"definition_extent": "8:1-8:13",
"variable_type": 1,
"is_local": false,
"is_macro": false,
"uses": ["8:5-8:6"]
"uses": ["8:3-8:4"]
}]
}
*/

View File

@ -1,9 +1,9 @@
void consume(void*) {}
void consume(void (*)()) {}
void used() {}
void user() {
auto x = &used;
void (*x)() = &used;
consume(&used);
}
@ -16,13 +16,13 @@ OUTPUT:
"funcs": [{
"id": 0,
"is_operator": false,
"usr": "c:@F@consume#*v#",
"usr": "c:@F@consume#*Fv#",
"short_name": "consume",
"detailed_name": "void consume(void *)",
"hover": "void consume(void *)",
"detailed_name": "void consume(void (*)())",
"hover": "void consume(void (*)())",
"declarations": [],
"definition_spelling": "1:6-1:13",
"definition_extent": "1:1-1:23",
"definition_extent": "1:1-1:28",
"base": [],
"derived": [],
"locals": [],
@ -41,7 +41,7 @@ OUTPUT:
"base": [],
"derived": [],
"locals": [],
"callers": ["2@6:13-6:17", "2@7:12-7:16"],
"callers": ["2@6:18-6:22", "2@7:12-7:16"],
"callees": []
}, {
"id": 2,
@ -57,19 +57,19 @@ OUTPUT:
"derived": [],
"locals": [],
"callers": [],
"callees": ["1@6:13-6:17", "0@7:3-7:10", "1@7:12-7:16"]
"callees": ["1@6:18-6:22", "0@7:3-7:10", "1@7:12-7:16"]
}],
"vars": [{
"id": 0,
"usr": "c:func_usage_addr_func.cc@61@F@user#@x",
"usr": "c:func_usage_addr_func.cc@66@F@user#@x",
"short_name": "x",
"detailed_name": "void (*)() x",
"hover": "void (*)()",
"definition_spelling": "6:8-6:9",
"definition_extent": "6:3-6:17",
"definition_spelling": "6:10-6:11",
"definition_extent": "6:3-6:22",
"is_local": true,
"is_macro": false,
"uses": ["6:8-6:9"]
"uses": ["6:10-6:11"]
}]
}
*/

View File

@ -1,5 +1,5 @@
template<typename T>
class unique_ptr;
class unique_ptr {};
struct S {};
@ -18,9 +18,11 @@ OUTPUT:
"types": [{
"id": 0,
"usr": "c:@ST>1#T@unique_ptr",
"short_name": "",
"detailed_name": "",
"hover": "",
"short_name": "unique_ptr",
"detailed_name": "unique_ptr",
"hover": "unique_ptr",
"definition_spelling": "2:7-2:17",
"definition_extent": "2:1-2:20",
"parents": [],
"derived": [],
"types": [],
@ -86,7 +88,7 @@ OUTPUT:
"uses": ["7:22-7:24"]
}, {
"id": 2,
"usr": "c:type_usage_as_template_parameter.cc@150@F@return_type#@local",
"usr": "c:type_usage_as_template_parameter.cc@153@F@return_type#@local",
"short_name": "local",
"detailed_name": "unique_ptr<S> * local",
"hover": "unique_ptr<S> *",

View File

@ -4,7 +4,7 @@ void foo(Type& a0, const Type& a1) {
Type a2;
Type* a3;
const Type* a4;
const Type const* a5;
const Type* const a5 = nullptr;
}
/*
OUTPUT:
@ -107,10 +107,10 @@ OUTPUT:
"id": 5,
"usr": "c:type_usage_declare_qualifiers.cc@103@F@foo#&$@S@Type#&1S1_#@a5",
"short_name": "a5",
"detailed_name": "const Type * a5",
"hover": "const Type *",
"detailed_name": "const Type *const a5",
"hover": "const Type *const",
"definition_spelling": "7:21-7:23",
"definition_extent": "7:3-7:23",
"definition_extent": "7:3-7:33",
"variable_type": 0,
"is_local": true,
"is_macro": false,

View File

@ -1,4 +1,4 @@
struct Type;
struct Type {};
static Type t;
/*
OUTPUT:
@ -8,9 +8,11 @@ OUTPUT:
"types": [{
"id": 0,
"usr": "c:@S@Type",
"short_name": "",
"detailed_name": "",
"hover": "",
"short_name": "Type",
"detailed_name": "Type",
"hover": "Type",
"definition_spelling": "1:8-1:12",
"definition_extent": "1:1-1:15",
"parents": [],
"derived": [],
"types": [],

View File

@ -1,5 +1,5 @@
void foo(int p) {
int p = 0;
{ int p = 0; }
}
/*
OUTPUT:
@ -36,15 +36,15 @@ OUTPUT:
"uses": ["1:14-1:15"]
}, {
"id": 1,
"usr": "c:function_shadow_param.cc@21@F@foo#I#@p",
"usr": "c:function_shadow_param.cc@23@F@foo#I#@p",
"short_name": "p",
"detailed_name": "int p",
"hover": "int",
"definition_spelling": "2:7-2:8",
"definition_extent": "2:3-2:8",
"definition_spelling": "2:9-2:10",
"definition_extent": "2:5-2:14",
"is_local": true,
"is_macro": false,
"uses": ["2:7-2:8"]
"uses": ["2:9-2:10"]
}]
}
*/