Skip to content

Commit

Permalink
Merge changes from topic "clang-tools-r365631"
Browse files Browse the repository at this point in the history
* changes:
  versioner: Add R to codename map
  versioner: Update clang prebuilts to clang-r365631
  • Loading branch information
loganchien authored and Gerrit Code Review committed Aug 28, 2019
2 parents eab2046 + 8fd8b99 commit 9e544d3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
5 changes: 4 additions & 1 deletion tools/versioner/src/Arch.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,9 @@ static ArchMap<std::string> arch_targets = {
{ Arch::x86_64, "x86_64-linux-android" },
};

static const std::set<int> default_levels = { 14, 15, 16, 17, 18, 19, 21, 23, 24, 25, 26, 27, 28, 29 };
static const std::set<int> default_levels = {
14, 15, 16, 17, 18, 19, 21, 23, 24, 25, 26, 27, 28, 29, 30,
};

static const ArchMap<int> arch_min_api = {
{ Arch::arm, 9 },
Expand All @@ -165,4 +167,5 @@ static const std::unordered_map<std::string, int> api_codename_map{
{"O-MR1", 27},
{"P", 28},
{"Q", 29},
{"R", 30},
};
2 changes: 1 addition & 1 deletion tools/versioner/src/Driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ void compileHeader(llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> vfs,

Compiler.setInvocation(std::move(invocation));
Compiler.setDiagnostics(diags.get());
Compiler.setVirtualFileSystem(vfs);
Compiler.createFileManager(vfs);

VersionerASTAction versioner_action(header_database, type);
if (!Compiler.ExecuteAction(versioner_action)) {
Expand Down
12 changes: 8 additions & 4 deletions tools/versioner/src/SymbolFileParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,19 +266,23 @@ class SymbolFileParser {
if (!api_level.empty()) {
// If an api-level tag is specified, it must be an exact match (mainly
// for versioner unit tests).
return compilation_type.api_level == decodeApiLevelValue(api_level);
return compilation_type.api_level == parseApiLevelValue(api_level);
}

return compilation_type.api_level >= decodeApiLevelValue(intro);
return compilation_type.api_level >= parseApiLevelValue(intro);
}

// Extract and decode the integer API level from api-level or introduced tags.
static int decodeApiLevelValue(const std::string& tag) {
// Parse the integer API level from api-level or introduced tags.
int parseApiLevelValue(const std::string& tag) const {
std::string api_level = tag.substr(tag.find('=') + 1);
auto it = api_codename_map.find(api_level);
if (it != api_codename_map.end()) {
return it->second;
}
if (api_level.find_first_not_of("0123456789") != std::string::npos) {
errx(1, "%s:%zu: error: unknown API level codename specified: \"%s\"",
file_path.c_str(), curr_line_num, tag.c_str());
}
return std::stoi(api_level);
}

Expand Down

0 comments on commit 9e544d3

Please sign in to comment.