1 //===- VersionTuple.cpp - Version Number Handling ---------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file implements the VersionTuple class, which represents a version in
11 // the form major[.minor[.subminor]].
13 //===----------------------------------------------------------------------===//
14 #include "clang/Basic/VersionTuple.h"
15 #include "llvm/Support/raw_ostream.h"
17 using namespace clang;
19 std::string VersionTuple::getAsString() const {
22 llvm::raw_string_ostream Out(Result);
28 raw_ostream& clang::operator<<(raw_ostream &Out,
29 const VersionTuple &V) {
31 if (llvm::Optional<unsigned> Minor = V.getMinor())
33 if (llvm::Optional<unsigned> Subminor = V.getSubminor())
34 Out << '.' << *Subminor;