forked from OSchip/llvm-project
[AST][Introspection][NFC] Remove unnecessary temporary strings.
This commit is contained in:
parent
b9fc47745a
commit
a0898f0cec
|
@ -94,7 +94,7 @@ llvm::json::Object toJSON(llvm::StringMap<ClassData> const &Obj) {
|
||||||
return JsonObj;
|
return JsonObj;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WriteJSON(std::string JsonPath, llvm::json::Object &&ClassInheritance,
|
void WriteJSON(StringRef JsonPath, llvm::json::Object &&ClassInheritance,
|
||||||
llvm::json::Object &&ClassesInClade,
|
llvm::json::Object &&ClassesInClade,
|
||||||
llvm::json::Object &&ClassEntries) {
|
llvm::json::Object &&ClassEntries) {
|
||||||
llvm::json::Object JsonObj;
|
llvm::json::Object JsonObj;
|
||||||
|
@ -213,20 +213,21 @@ void ASTSrcLocProcessor::run(const MatchFinder::MatchResult &Result) {
|
||||||
|
|
||||||
const auto &TArgs = Templ->getTemplateArgs();
|
const auto &TArgs = Templ->getTemplateArgs();
|
||||||
|
|
||||||
std::string TArgsString = (DerivedFrom->getName() + "<").str();
|
SmallString<256> TArgsString;
|
||||||
|
llvm::raw_svector_ostream OS(TArgsString);
|
||||||
|
OS << DerivedFrom->getName() << '<';
|
||||||
|
|
||||||
for (unsigned I = 0; I < TArgs.size(); ++I) {
|
|
||||||
if (I > 0) {
|
|
||||||
TArgsString += ", ";
|
|
||||||
}
|
|
||||||
auto Ty = TArgs.get(I).getAsType();
|
|
||||||
clang::PrintingPolicy PPol(Result.Context->getLangOpts());
|
clang::PrintingPolicy PPol(Result.Context->getLangOpts());
|
||||||
PPol.TerseOutput = true;
|
PPol.TerseOutput = true;
|
||||||
TArgsString += Ty.getAsString(PPol);
|
|
||||||
}
|
|
||||||
TArgsString += ">";
|
|
||||||
|
|
||||||
ClassInheritance[ClassName] = std::move(TArgsString);
|
for (unsigned I = 0; I < TArgs.size(); ++I) {
|
||||||
|
if (I > 0)
|
||||||
|
OS << ", ";
|
||||||
|
TArgs.get(I).getAsType().print(OS, PPol);
|
||||||
|
}
|
||||||
|
OS << '>';
|
||||||
|
|
||||||
|
ClassInheritance[ClassName] = TArgsString.str().str();
|
||||||
} else {
|
} else {
|
||||||
ClassInheritance[ClassName] = DerivedFrom->getName().str();
|
ClassInheritance[ClassName] = DerivedFrom->getName().str();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue