MCPcopy Create free account
hub / github.com/KDE/kdevelop / makeId

Function makeId

plugins/clang/duchain/builder.cpp:111–137  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

109}
110
111Identifier makeId(CXCursor cursor)
112{
113 if (CursorKindTraits::isClassTemplate(cursor.kind)) {
114 // TODO: how to handle functions here? We don't want to add the "real" function arguments here
115 // and there does not seem to be an API to get the template arguments for non-specializations easily
116 // NOTE: using the QString overload of the Identifier ctor here, so that the template name gets parsed
117 return Identifier(ClangString(clang_getCursorDisplayName(cursor)).toString());
118 }
119
120 const ClangString spelling(clang_getCursorSpelling(cursor));
121 if (!spelling.isEmpty() && spelling.c_str()[0] == '[') {
122 // skip unexposed DecompositionDecl, we want to get hold of the BindingsDecl inside instead
123 return Identifier();
124 }
125
126 auto name = spelling.toIndexed();
127 if (name.isEmpty() && CursorKindTraits::isClass(cursor.kind)) {
128 // try to use the type name for typedef'ed anon structs etc. as a fallback
129 auto type = ClangString(clang_getTypeSpelling(clang_getCursorType(cursor))).toString();
130 // but don't associate a super long name for anon structs without a typedef
131 if (!type.startsWith(QLatin1String("(anonymous "))) {
132 name = IndexedString(type);
133 }
134 }
135
136 return Identifier(name);
137}
138
139#if CINDEX_VERSION_MINOR >= 100 // FIXME https://bugs.llvm.org/show_bug.cgi?id=35333
140QByteArray makeComment(CXComment comment)

Callers 2

buildDeclarationMethod · 0.85

Calls 9

isClassTemplateFunction · 0.85
ClangStringClass · 0.85
isClassFunction · 0.85
toIndexedMethod · 0.80
IdentifierFunction · 0.50
IndexedStringClass · 0.50
toStringMethod · 0.45
isEmptyMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected