reference, declaration → definition definition → references, declarations, derived classes, virtual overrides reference to multiple definitions → definitions unreferenced |
3044 OS << "static std::string " << Target.getName() 3048 OS << " return \"\";"; 3050 OS << " const unsigned MaxEditDist = 2;\n"; 3051 OS << " std::vector<StringRef> Candidates;\n"; 3052 OS << " StringRef Prev = \"\";\n\n"; 3054 OS << " // Find the appropriate table for this asm variant.\n"; 3055 OS << " const MatchEntry *Start, *End;\n"; 3056 OS << " switch (VariantID) {\n"; 3057 OS << " default: llvm_unreachable(\"invalid variant!\");\n"; 3061 OS << " case " << AsmVariantNo << ": Start = std::begin(MatchTable" << VC 3064 OS << " }\n\n"; 3065 OS << " for (auto I = Start; I < End; I++) {\n"; 3066 OS << " // Ignore unsupported instructions.\n"; 3067 OS << " const FeatureBitset &RequiredFeatures = " 3069 OS << " if ((FBS & RequiredFeatures) != RequiredFeatures)\n"; 3070 OS << " continue;\n"; 3071 OS << "\n"; 3072 OS << " StringRef T = I->getMnemonic();\n"; 3073 OS << " // Avoid recomputing the edit distance for the same string.\n"; 3074 OS << " if (T.equals(Prev))\n"; 3075 OS << " continue;\n"; 3076 OS << "\n"; 3077 OS << " Prev = T;\n"; 3078 OS << " unsigned Dist = S.edit_distance(T, false, MaxEditDist);\n"; 3079 OS << " if (Dist <= MaxEditDist)\n"; 3080 OS << " Candidates.push_back(T);\n"; 3081 OS << " }\n"; 3082 OS << "\n"; 3083 OS << " if (Candidates.empty())\n"; 3084 OS << " return \"\";\n"; 3085 OS << "\n"; 3086 OS << " std::string Res = \", did you mean: \";\n"; 3087 OS << " unsigned i = 0;\n"; 3088 OS << " for( ; i < Candidates.size() - 1; i++)\n"; 3089 OS << " Res += Candidates[i].str() + \", \";\n"; 3090 OS << " return Res + Candidates[i].str() + \"?\";\n"; 3092 OS << "}\n"; 3093 OS << "\n";