aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build2/cc/guess.cxx13
-rw-r--r--build2/cc/guess.hxx11
2 files changed, 24 insertions, 0 deletions
diff --git a/build2/cc/guess.cxx b/build2/cc/guess.cxx
index e9b102f..0a60ffd 100644
--- a/build2/cc/guess.cxx
+++ b/build2/cc/guess.cxx
@@ -15,6 +15,19 @@ namespace build2
{
namespace cc
{
+ compiler_id::
+ compiler_id (value_type v)
+ {
+ switch (v)
+ {
+ case clang_apple: type = "clang"; variant = "apple"; break;
+ case clang: type = "clang"; break;
+ case gcc: type = "gcc"; break;
+ case msvc: type = "msvc"; break;
+ case icc: type = "icc"; break;
+ }
+ }
+
auto compiler_id::
value () const -> value_type
{
diff --git a/build2/cc/guess.hxx b/build2/cc/guess.hxx
index a762e79..599c56d 100644
--- a/build2/cc/guess.hxx
+++ b/build2/cc/guess.hxx
@@ -48,6 +48,11 @@ namespace build2
value_type
value () const;
+
+ compiler_id () = default;
+ compiler_id (value_type);
+ compiler_id (std::string t, std::string v)
+ : type (move (t)), variant (move (v)) {}
};
inline ostream&
@@ -56,6 +61,12 @@ namespace build2
return os << id.string ();
}
+ inline ostream&
+ operator<< (ostream& os, const compiler_id::value_type& v)
+ {
+ return os << compiler_id (v);
+ }
+
// Compiler class describes a set of compilers that follow more or less
// the same command line interface. Compilers that don't belong to any of
// the existing classes are in classes of their own (say, Sun CC would be