File: alljsontests.cpp

package info (click to toggle)
kdevelop 4%3A4.7.0-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 18,360 kB
  • ctags: 11,484
  • sloc: cpp: 105,371; python: 522; ansic: 488; lex: 422; sh: 139; ruby: 120; makefile: 51; xml: 42; php: 12
file content (108 lines) | stat: -rw-r--r-- 4,370 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/* This file is part of KDevelop
   Copyright 2012 Olivier de Gaalon <olivier.jg@gmail.com>

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Library General Public
   License version 2 as published by the Free Software Foundation.

   This library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Library General Public License for more details.

   You should have received a copy of the GNU Library General Public License
   along with this library; see the file COPYING.LIB.  If not, write to
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
   Boston, MA 02110-1301, USA.
*/

// "internalContext" : { "childCount" : 3 }
template<class T>
struct TestEverything
{
public:
    /* "type" : { "toString" : "T" },
     * "useCount" : 0,
     * "instantiations" : {
     *     "<int>::<>" : {
     *         "type" : { "toString" : "int" },
     *         "instantiatedFrom" : { "qualifiedIdentifier" : "TestEverything::member" },
     *         "useCount" : 1
     *     }
     * }
     */
    T member;
    /* "type" : { "toString" : "function T ()" },
     * "returnType" : { "toString" : "T" },
     * "useCount" : 0,
     * "instantiations" : {
     *     "<int>::<>" : {
     *         "returnType" : { "toString" : "int" },
     *         "instantiatedFrom" : { "qualifiedIdentifier" : "TestEverything::memberFunc" },
     *         "useCount" : 1
     *     }
     * }
     */
    T memberFunc();
    /* "type" : { "toString" : "function T (X)" },
     * "returnType" : { "toString" : "T" },
     * "useCount" : 0,
     * "instantiations" : {
     *     "<int>::<>" : {
     *         "returnType" : { "toString" : "int" },
     *         "instantiatedFrom" : { "qualifiedIdentifier" : "TestEverything::templateMemberFunc" },
     *         "useCount" : 0
     *     },
     *     "<int>::<TestEverything< int >>" : {} #This instantiation/specialization is tested below
     * }
     */
    template<class X> T templateMemberFunc(X foo);
};

/* "type" : { "toString"  : "function int (TestEverything< int >)" },
 * "returnType" : { "toString"  : "int" },
 * "internalFunctionContext" : { "findDeclarations" : { "foo" : { "type" : { "toString" : "TestEverything< int >" } } } },
 * "specializedFrom" : { "qualifiedIdentifier" : "TestEverything::templateMemberFunc" },
 * "instantiatedFrom" : { "qualifiedIdentifier" : "TestEverything::templateMemberFunc" },
 * "qualifiedIdentifier" : "TestEverything< int >::templateMemberFunc< TestEverything< int > >",
 * "useCount" : 1
 */
template<>
template<>
int TestEverything<int>::templateMemberFunc< TestEverything<int> >(TestEverything<int> foo) { }

/* "type" : { "toString" : "constint", "isConst" : false },
 * "unaliasedType" : { "toString" : "const int", "isConst" : true },
 * "realType" : { "toString" : "const int", "isConst" : true },
 * "targetType" : { "toString" : "const int", "isConst" : true },
 * "shortenedType" : { "toString" : "constint", "isConst" : false }
 */
typedef const int constint;
/* "type" : { "toString" : "intptr", "isConst" : false },
 * "unaliasedType" : { "toString" : "int*", "isConst" : false },
 * "realType" : { "toString" : "int*", "isConst" : false },
 * "targetType" : { "toString" : "int", "isConst" : false },
 * "shortenedType" : { "toString" : "intptr", "isConst" : false }
 */
typedef int* intptr;
/* "type" : { "toString" : "constintptr", "isConst" : false },
 * # FIXME: unaliasedType can't see through other types (ie, PointerType), which leads to expected results
 * "unaliasedType" : {
 *      "EXPECT_FAIL" : { "toString" : "unaliasedType shows up as 'constint*', but constint is an alias" },
 *      "toString" : "const int*", "isConst" : false
 * },
 * "realType" : { "toString" : "constint*", "isConst" : false },
 * "targetType" : { "toString" : "const int", "isConst" : true },
 * "shortenedType" : { "toString" : "constintptr", "isConst" : false }
 */
typedef constint* constintptr;

int main()
{
    //"type" : { "toString" : "TestEverything< int >", "isConst" : false },
    //"identifiedTypeQid" : "TestEverything< int >"
    TestEverything<int> mytest;
    mytest.member;
    mytest.memberFunc();
    mytest.templateMemberFunc(mytest);
}