versioner: cache -cc1 flags generated by the clang Driver.
Profiling showed that majority of time spent by versioner was being
spent in the x86 and x86_64 driver statting random files in /usr/lib,
looking for a toolchain. Hardcode a list of per-target flags which
correspond to a subset of the ones generated by clang, and use those
instead of calling out to Driver.
This changes the result of `time versioner` from:
versioner 156.57s user 1180.08s system 4109% cpu 32.525 total
to:
versioner 109.12s user 17.43s system 2433% cpu 5.201 total
Bug: http://b/32748936
Test: python run_tests.py
Change-Id: I7d254a105bf1a283cbba0546321b04e308e703d1
diff --git a/tools/versioner/src/DeclarationDatabase.h b/tools/versioner/src/DeclarationDatabase.h
index 4ec15d9..6f577a5 100644
--- a/tools/versioner/src/DeclarationDatabase.h
+++ b/tools/versioner/src/DeclarationDatabase.h
@@ -27,6 +27,7 @@
#include <llvm/ADT/StringRef.h>
#include "Arch.h"
+#include "CompilationType.h"
#include "Utils.h"
namespace clang {
@@ -40,28 +41,6 @@
inconsistent,
};
-struct CompilationType {
- Arch arch;
- int api_level;
- int file_offset_bits;
-
- private:
- auto tie() const {
- return std::tie(arch, api_level, file_offset_bits);
- }
-
- public:
- bool operator<(const CompilationType& other) const {
- return tie() < other.tie();
- }
-
- bool operator==(const CompilationType& other) const {
- return tie() == other.tie();
- }
-};
-
-std::string to_string(const CompilationType& type);
-
struct AvailabilityValues {
bool future = false;
int introduced = 0;