Merge "Fix: Inaccurate mangled names."
diff --git a/vndk/tools/header-checker/header-abi-dumper/src/abi_wrappers.cpp b/vndk/tools/header-checker/header-abi-dumper/src/abi_wrappers.cpp
index d82b96c..5ceca8f 100644
--- a/vndk/tools/header-checker/header-abi-dumper/src/abi_wrappers.cpp
+++ b/vndk/tools/header-checker/header-abi-dumper/src/abi_wrappers.cpp
@@ -100,16 +100,16 @@
}
std::string ABIWrapper::GetMangledNameDecl(const clang::NamedDecl *decl) const {
- clang::IdentifierInfo *identifier = decl->getIdentifier();
- std::string mangled_or_demangled_name =
- identifier ? identifier->getName() : "";
- if (mangle_contextp_->shouldMangleDeclName(decl)) {
- assert(&(mangle_contextp_->getASTContext()) == ast_contextp_);
- llvm::raw_string_ostream ostream(mangled_or_demangled_name);
- mangle_contextp_->mangleName(decl, ostream);
- ostream.flush();
+ assert(&(mangle_contextp_->getASTContext()) == ast_contextp_);
+ if (!mangle_contextp_->shouldMangleDeclName(decl)) {
+ clang::IdentifierInfo *identifier = decl->getIdentifier();
+ return identifier ? identifier->getName() : "";
}
- return mangled_or_demangled_name;
+ std::string mangled_name;
+ llvm::raw_string_ostream ostream(mangled_name);
+ mangle_contextp_->mangleName(decl, ostream);
+ ostream.flush();
+ return mangled_name;
}
bool ABIWrapper::SetupTemplateParamNames(
diff --git a/vndk/tools/header-checker/header-abi-dumper/src/frontend_action.cpp b/vndk/tools/header-checker/header-abi-dumper/src/frontend_action.cpp
index f00cca7..00abf66 100644
--- a/vndk/tools/header-checker/header-abi-dumper/src/frontend_action.cpp
+++ b/vndk/tools/header-checker/header-abi-dumper/src/frontend_action.cpp
@@ -45,6 +45,13 @@
exported_headers);
}
+static bool ShouldSkipFile(llvm::StringRef &file_name) {
+ return (file_name.empty() || file_name.startswith(".") ||
+ file_name.endswith(".swp") || file_name.endswith(".swo") ||
+ file_name.endswith("#") || file_name.endswith(".cpp") ||
+ file_name.endswith(".cc") || file_name.endswith(".c"));
+}
+
bool HeaderCheckerFrontendAction::CollectExportedHeaderSet(
const std::string &dir_name,
std::set<std::string> *exported_headers) {
@@ -65,10 +72,7 @@
// Ignore swap files and hidden files / dirs. Do not recurse into them too.
// We should also not look at source files. Many projects include source
// files in their exports.
- if (file_name.empty() || file_name.startswith(".") ||
- file_name.endswith(".swp") || file_name.endswith(".swo") ||
- file_name.endswith("#") || file_name.endswith(".cpp") ||
- file_name.endswith(".cc") || file_name.endswith(".c")) {
+ if (ShouldSkipFile(file_name)) {
walker.no_push();
continue;
}