MCPcopy Create free account
hub / github.com/beefytech/Beef / Autocomplete

Method Autocomplete

IDEHelper/Clang/ClangHelper.cpp:1189–1503  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1187}
1188
1189const char* ClangHelper::Autocomplete(const StringImpl& fileName, BfSourceClassifier::CharData* charData, int charLen, int cursorIdx)
1190{
1191 gClangPerfManager.StartRecording();
1192
1193 //Sleep(500);
1194
1195 BfLogClang("%d Clang Autocomplete %s\n", ::GetCurrentThreadId(), fileName.c_str());
1196
1197 static int gACCount = 0;
1198 gACCount++;
1199
1200 gClangPerfManager.ZoneStart("GetTranslationUnit");
1201 ClangTranslationUnit* clangTransUnit = NULL;
1202 /*if (headerFileName != NULL)
1203 {
1204 GetTranslationUnit(headerFileName, NULL, charData, charLen, NULL, 0, false, true);
1205 clangTransUnit = GetTranslationUnit(fileName, NULL, NULL, 0, NULL, 0, true);
1206 }
1207 else*/
1208 {
1209 bool noReparse = false;
1210 clangTransUnit = GetTranslationUnit(fileName, NULL, charData, charLen, NULL, 0, false, false, noReparse);
1211 }
1212 //const char* cursorFileName = (headerFileName != NULL) ? headerFileName : fileName.c_str();
1213 const char* cursorFileName = clangTransUnit->mTransFileName.c_str();
1214
1215 CXTranslationUnit transUnit = clangTransUnit->mTransUnit;
1216 gClangPerfManager.ZoneEnd();
1217 if (transUnit == NULL)
1218 return NULL;
1219
1220 gClangPerfManager.ZoneStart("Autocomplete");
1221
1222 String namespaceFind;
1223 String filter;
1224 int startIdx = std::max(0, cursorIdx - 1);
1225 bool isInvocation = false;
1226 int parenPos = -1;
1227 int lastCharIdx = -1;
1228 while (startIdx > 0)
1229 {
1230 char c = charData[startIdx].mChar;
1231 if (charData[startIdx].mDisplayTypeId == BfSourceElementType_Comment)
1232 {
1233 startIdx--;
1234 continue;;
1235 }
1236
1237 if ((c == '(') && (filter.length() == 0))
1238 {
1239 isInvocation = true;
1240 mInvokeString.clear();
1241 startIdx--;
1242 cursorIdx--;
1243 parenPos = startIdx;
1244
1245 while (startIdx > 0)
1246 {

Callers 1

Calls 15

IsIdentifierCharFunction · 0.85
VecFirstRefFunction · 0.85
StringClass · 0.85
StartRecordingMethod · 0.80
ZoneStartMethod · 0.80
ZoneEndMethod · 0.80
AddEntryMethod · 0.80
StopRecordingMethod · 0.80
DbgPrintMethod · 0.80
EntryClass · 0.50
c_strMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected