C/C++ adjustments and bug fixes.

Bug: 37751376

Test: dumped the abi of libminijail, removed the "struct" keyword from
the abi-dump and confirmed that this did not result in an abi breakage
getting reported.

Bug: 37749718

Test: manually invoked header-abi-diff with file containing a list of
symbols to omit abi checks on from libminijail after changing sizes and
alignments of those symbols from libminijail's abi dumps. Diffs were not
reported.

Bug: 37918686

Test: dumped the abi of libbcinfo, it contains records as well as
symbols which adhere to the regex in the symbol file.

Also make function signature diffing independent of C++ name mangling.

Change-Id: Id34209ef24d1202745ca69765a4e2a96d1a05c2a
This commit is contained in:
Jayant Chowdhary
2017-04-27 14:59:16 -07:00
parent 206e1f132d
commit 51406197dd
17 changed files with 308 additions and 117 deletions

View File

@@ -15,6 +15,7 @@
#include "abi_diff.h"
#include <llvm/Support/CommandLine.h>
#include <llvm/Support/FileSystem.h>
#include <llvm/Support/raw_ostream.h>
static llvm::cl::OptionCategory header_checker_category(
@@ -36,11 +37,34 @@ static llvm::cl::opt<bool> advice_only(
"advice-only", llvm::cl::desc("Advisory mode only"), llvm::cl::Optional,
llvm::cl::cat(header_checker_category));
static llvm::cl::opt<std::string> ignore_symbol_list(
"ignore-symbols", llvm::cl::desc("ignore symbols"), llvm::cl::Optional,
llvm::cl::cat(header_checker_category));
static std::set<std::string> LoadIgnoredSymbols(std::string &symbol_list_path) {
std::ifstream symbol_ifstream(symbol_list_path);
std::set<std::string> ignored_symbols;
if (!symbol_ifstream) {
llvm::errs() << "Failed to open file containing symbols to ignore\n";
::exit(1);
}
std::string line = "";
while (std::getline(symbol_ifstream, line)) {
ignored_symbols.insert(line);
}
return ignored_symbols;
}
int main(int argc, const char **argv) {
GOOGLE_PROTOBUF_VERIFY_VERSION;
llvm::cl::ParseCommandLineOptions(argc, argv, "header-checker");
uint8_t extension_or_incompatible = 0;
HeaderAbiDiff judge(old_dump, new_dump, compatibility_report);
std::set<std::string> ignored_symbols;
if (llvm::sys::fs::exists(ignore_symbol_list)) {
ignored_symbols = LoadIgnoredSymbols(ignore_symbol_list);
}
HeaderAbiDiff judge(old_dump, new_dump, compatibility_report,
ignored_symbols);
switch (judge.GenerateCompatibilityReport()) {
case HeaderAbiDiff::COMPATIBLE:
break;