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

Method Classify

IDEHelper/Clang/ClangHelper.cpp:855–1115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

853}
854
855const char* ClangHelper::Classify(const StringImpl& fileName, BfSourceClassifier::CharData* charData, int charLen, int cursorIdx, int errorLookupTextIdx, bool ignoreErrors)
856{
857 ThreadProtect threadProtect(this);
858
859 gClangPerfManager.StartRecording();
860
861 //OutputDebugStrF("Classify: %s\n", fileName.c_str());
862
863 BfLogClang("%d Clang Classify %s\n", ::GetCurrentThreadId(), fileName.c_str());
864
865
866 //Sleep(500);
867 ClangClassifier clangClassifier;
868 clangClassifier.mClassifierPassId = 2; //SourceDisplayId_FullClassify;
869 clangClassifier.mCharData = charData;
870 //clangClassifier.SetElementType(0, charLen, BfSourceElementType_Normal);
871 clangClassifier.ModifyFlags(0, charLen, 0, 0);
872
873 gClangPerfManager.ZoneStart("GetTranslationUnit");
874 //ClangTranslationUnit* clangTransUnit = GetTranslationUnit(fileName, charData, charLen);
875
876 ClangTranslationUnit* clangTransUnit = NULL;
877 /*if (headerFileName != NULL)
878 {
879 GetTranslationUnit(headerFileName, NULL, charData, charLen, NULL, 0, false, true);
880 clangTransUnit = GetTranslationUnit(fileName, NULL, 0, NULL, 0, true);
881 }
882 else*/
883 {
884 clangTransUnit = GetTranslationUnit(fileName, NULL, charData, charLen, NULL, 0, false);
885 }
886 int adjustedCursorIdx = cursorIdx + clangTransUnit->mHeaderPrefixLen;
887 const char* cursorFileName = clangTransUnit->mTransFileName.c_str(); //(headerFileName != NULL) ? headerFileName : fileName.c_str();
888
889 CXTranslationUnit transUnit = clangTransUnit->mTransUnit;
890 gClangPerfManager.ZoneEnd();
891 if (transUnit == NULL)
892 return NULL;
893
894 CXFile file = clang_getFile(transUnit, cursorFileName);
895
896 mReturnString.clear();
897
898 bool showErrors = false;
899
900 gClangPerfManager.ZoneStart("Diagnostics");
901 int numDiagnostics = clang_getNumDiagnostics(transUnit);
902 for (int diagIdx = 0; diagIdx < numDiagnostics; diagIdx++)
903 {
904 if (ignoreErrors)
905 break;
906
907 CXDiagnostic diag = clang_getDiagnostic(transUnit, diagIdx);
908
909 CXDiagnosticSeverity severity = clang_getDiagnosticSeverity(diag);
910 auto var = clang_getDiagnosticCategory(diag);
911 int flag = 0;
912 if ((severity == CXDiagnostic_Error) || (severity == CXDiagnostic_Fatal))

Callers 1

Calls 15

GetRangeFunction · 0.85
GetLocationFunction · 0.85
IsIdentifierCharFunction · 0.85
StartRecordingMethod · 0.80
ZoneStartMethod · 0.80
ZoneEndMethod · 0.80
findMethod · 0.80
StopRecordingMethod · 0.80
DbgPrintMethod · 0.80
ToStringFunction · 0.70
c_strMethod · 0.45
ModifyFlagsMethod · 0.45

Tested by

no test coverage detected