Merge "Explicitly search header files in abi dumper." am: a3871b8183
Original change: https://android-review.googlesource.com/c/platform/development/+/2359334 Change-Id: Ia375ae3def2ce033e6fee1d90501c6a71e5e3648 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -18,23 +18,26 @@
|
|||||||
#include <llvm/Support/Path.h>
|
#include <llvm/Support/Path.h>
|
||||||
#include <llvm/Support/raw_ostream.h>
|
#include <llvm/Support/raw_ostream.h>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
|
||||||
namespace header_checker {
|
namespace header_checker {
|
||||||
namespace utils {
|
namespace utils {
|
||||||
|
|
||||||
|
static const std::vector<std::string> header_extensions{
|
||||||
|
".h", ".hh", ".hpp", ".hxx", ".h++", ".inl", ".inc", ".ipp", ".h.generic"};
|
||||||
|
|
||||||
static bool ShouldSkipFile(llvm::StringRef &file_name) {
|
static bool ShouldSkipFile(llvm::StringRef &file_name) {
|
||||||
// Ignore swap files, hidden files, and hidden directories. Do not recurse
|
// Look for header files only
|
||||||
// into hidden directories either. We should also not look at source files.
|
if (file_name.empty() || file_name.startswith(".")) {
|
||||||
// Many projects include source files in their exports.
|
return true;
|
||||||
return (file_name.empty() || file_name.startswith(".") ||
|
}
|
||||||
file_name.endswith(".swp") || file_name.endswith(".swo") ||
|
return std::find_if(header_extensions.begin(), header_extensions.end(),
|
||||||
file_name.endswith("#") || file_name.endswith(".cpp") ||
|
[file_name](const std::string &e) {
|
||||||
file_name.endswith(".cc") || file_name.endswith(".c"));
|
return file_name.endswith(e);
|
||||||
|
}) == header_extensions.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::string GetCwd() {
|
static std::string GetCwd() {
|
||||||
@@ -132,9 +135,7 @@ static bool CollectExportedHeaderSet(const std::string &dir_name,
|
|||||||
const std::string &file_path = walker->path();
|
const std::string &file_path = walker->path();
|
||||||
|
|
||||||
llvm::StringRef file_name(llvm::sys::path::filename(file_path));
|
llvm::StringRef file_name(llvm::sys::path::filename(file_path));
|
||||||
// Ignore swap files and hidden files / dirs. Do not recurse into them too.
|
// Ignore non header files.
|
||||||
// We should also not look at source files. Many projects include source
|
|
||||||
// files in their exports.
|
|
||||||
if (ShouldSkipFile(file_name)) {
|
if (ShouldSkipFile(file_name)) {
|
||||||
walker.no_push();
|
walker.no_push();
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
Reference in New Issue
Block a user