Files
swift-mirror/lib/Basic/Version.cpp
Connor Wakamo ed2038585f Initial set of changes to add a new 'swift_driver' executable.
- Added a couple of new targets:
  - libswiftDriver, which contains most of the driver implementation
  - swift_driver, which produces the actual executable

- Added centralized version information into libswiftBasic.

- Added a new "Driver Design & Internals" document, which currently describes
  the high-level design of the Swift driver.

- Implemented an early version of the functionality of the driver, including
  versions of the Parse, Pipeline, Bind, Translate, and Execute driver stages.
  Parse, Pipeline, and Bind are largely implemented; Translate and Execute are
  early placeholders. (Translate produces "swift_driver --version" and "ld -v"
  commands, while Execute performs all subtasks sequentially, rather than in
  parallel.)

This is just the starting point for the Swift driver. Tests for the existing
behavior are forthcoming.

Swift SVN r10933
2013-12-06 21:23:01 +00:00

57 lines
1.8 KiB
C++

//===- Version.cpp - Swift Version Number -----------------------*- C++ -*-===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See http://swift.org/LICENSE.txt for license information
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
//
// This file defines several version-related utility functions for Swift.
//
//===----------------------------------------------------------------------===//
#include "swift/Basic/Version.h"
#include "swift/Basic/LLVM.h"
#include "llvm/Support/raw_ostream.h"
/// \brief Helper macro for SWIFT_VERSION_STRING.
#define SWIFT_MAKE_VERSION_STRING2(X) #X
#ifdef SWIFT_VERSION_PATCHLEVEL
/// \brief Helper macro for SWIFT_VERSION_STRING.
#define SWIFT_MAKE_VERSION_STRING(X,Y,Z) SWIFT_MAKE_VERSION_STRING2(X.Y.Z)
/// \brief A string that describes the Swift version number, e.g., "1.0".
#define SWIFT_VERSION_STRING \
SWIFT_MAKE_VERSION_STRING(SWIFT_VERSION_MAJOR,SWIFT_VERSION_MINOR, \
SWIFT_VERSION_PATCHLEVEL)
#else
/// \brief Helper macro for SWIFT_VERSION_STRING.
#define SWIFT_MAKE_VERSION_STRING(X,Y) SWIFT_MAKE_VERSION_STRING2(X.Y)
/// \brief A string that describes the Swift version number, e.g., "1.0".
#define SWIFT_VERSION_STRING \
SWIFT_MAKE_VERSION_STRING(SWIFT_VERSION_MAJOR,SWIFT_VERSION_MINOR)
#endif
namespace swift {
namespace version {
std::string getSwiftFullVersion() {
std::string buf;
llvm::raw_string_ostream OS(buf);
#ifdef SWIFT_VENDOR
OS << SWIFT_VENDOR;
#endif
OS << "Swift version " SWIFT_VERSION_STRING;
return OS.str();
}
} // end namespace version
} // end namespace swift