Internal change.

PiperOrigin-RevId: 316414698
Change-Id: Ib0d43bfc7c95a3029618b4ed758990f78cb25529
This commit is contained in:
Christian Blichmann 2020-06-15 00:58:58 -07:00 committed by Copybara-Service
parent fdf5fd5854
commit 89e80d4c80

View File

@ -19,6 +19,7 @@
#include "absl/strings/escaping.h" #include "absl/strings/escaping.h"
#include "absl/strings/match.h" #include "absl/strings/match.h"
#include "absl/strings/str_cat.h" #include "absl/strings/str_cat.h"
#include "absl/strings/str_format.h"
#include "absl/strings/str_join.h" #include "absl/strings/str_join.h"
#include "absl/strings/str_replace.h" #include "absl/strings/str_replace.h"
#include "absl/strings/strip.h" #include "absl/strings/strip.h"
@ -168,7 +169,7 @@ std::string PrintAstDecl(const clang::Decl* decl) {
} }
std::string GetParamName(const clang::ParmVarDecl* decl, int index) { std::string GetParamName(const clang::ParmVarDecl* decl, int index) {
if (std::string name = decl->getName(); !name.empty()) { if (std::string name = decl->getName().str(); !name.empty()) {
return absl::StrCat(name, "_"); // Suffix to avoid collisions return absl::StrCat(name, "_"); // Suffix to avoid collisions
} }
return absl::StrCat("unnamed", index, "_"); return absl::StrCat("unnamed", index, "_");
@ -187,7 +188,7 @@ std::string PrintFunctionPrototype(const clang::FunctionDecl* decl) {
absl::StrAppend(&out, print_separator); absl::StrAppend(&out, print_separator);
print_separator = ", "; print_separator = ", ";
absl::StrAppend(&out, param->getType().getAsString()); absl::StrAppend(&out, param->getType().getAsString());
if (std::string name = param->getName(); !name.empty()) { if (std::string name = param->getName().str(); !name.empty()) {
absl::StrAppend(&out, " ", name); absl::StrAppend(&out, " ", name);
} }
} }