[libc] Include only the relevant header files in the integration test.

This commit is contained in:
Siva Chandra
2021-01-27 11:08:31 -08:00
parent 98c21ae7a8
commit d90bb66dd9
2 changed files with 14 additions and 1 deletions

View File

@@ -1,5 +1,6 @@
set(PUBLIC_HEADERS
libc.include.errno
libc.include.math
libc.include.stdlib
libc.include.sys_syscall
)

View File

@@ -24,9 +24,21 @@ llvm::cl::list<std::string>
bool TestGeneratorMain(llvm::raw_ostream &OS, llvm::RecordKeeper &records) {
OS << "#include \"TypeTraits.h\"\n";
llvm_libc::APIIndexer G(records);
for (const auto &header : G.PublicHeaders)
std::unordered_set<std::string> headerFileSet;
for (const auto &entrypoint : EntrypointNamesOption) {
auto match = G.FunctionToHeaderMap.find(entrypoint);
if (match == G.FunctionToHeaderMap.end()) {
llvm::errs() << "ERROR: entrypoint '" << entrypoint
<< "' could not be found in spec in any public header\n";
return true;
}
headerFileSet.insert(match->second);
}
for (const auto &header : headerFileSet)
OS << "#include <" << header << ">\n";
OS << '\n';
OS << "int main() {\n";
for (const auto &entrypoint : EntrypointNamesOption) {
auto match = G.FunctionSpecMap.find(entrypoint);