1 //===- Version.h - Clang Version Number -------------------------*- 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 //===----------------------------------------------------------------------===//
11 /// \brief Defines version macros and version-related utility functions
14 //===----------------------------------------------------------------------===//
16 #ifndef LLVM_CLANG_BASIC_VERSION_H
17 #define LLVM_CLANG_BASIC_VERSION_H
19 #include "llvm/ADT/StringRef.h"
21 #include "clang/Basic/Version.inc"
23 /// \brief Helper macro for CLANG_VERSION_STRING.
24 #define CLANG_MAKE_VERSION_STRING2(X) #X
26 #ifdef CLANG_VERSION_PATCHLEVEL
27 /// \brief Helper macro for CLANG_VERSION_STRING.
28 #define CLANG_MAKE_VERSION_STRING(X,Y,Z) CLANG_MAKE_VERSION_STRING2(X.Y.Z)
30 /// \brief A string that describes the Clang version number, e.g., "1.0".
31 #define CLANG_VERSION_STRING \
32 CLANG_MAKE_VERSION_STRING(CLANG_VERSION_MAJOR,CLANG_VERSION_MINOR, \
33 CLANG_VERSION_PATCHLEVEL)
35 /// \brief Helper macro for CLANG_VERSION_STRING.
36 #define CLANG_MAKE_VERSION_STRING(X,Y) CLANG_MAKE_VERSION_STRING2(X.Y)
38 /// \brief A string that describes the Clang version number, e.g., "1.0".
39 #define CLANG_VERSION_STRING \
40 CLANG_MAKE_VERSION_STRING(CLANG_VERSION_MAJOR,CLANG_VERSION_MINOR)
44 /// \brief Retrieves the repository path (e.g., Subversion path) that
45 /// identifies the particular Clang branch, tag, or trunk from which this
47 std::string getClangRepositoryPath();
49 /// \brief Retrieves the repository path from which LLVM was built.
51 /// This supports LLVM residing in a separate repository from clang.
52 std::string getLLVMRepositoryPath();
54 /// \brief Retrieves the repository revision number (or identifer) from which
55 /// this Clang was built.
56 std::string getClangRevision();
58 /// \brief Retrieves the repository revision number (or identifer) from which
61 /// If Clang and LLVM are in the same repository, this returns the same
62 /// string as getClangRevision.
63 std::string getLLVMRevision();
65 /// \brief Retrieves the full repository version that is an amalgamation of
66 /// the information in getClangRepositoryPath() and getClangRevision().
67 std::string getClangFullRepositoryVersion();
69 /// \brief Retrieves a string representing the complete clang version,
70 /// which includes the clang version number, the repository version,
71 /// and the vendor tag.
72 std::string getClangFullVersion();
74 /// \brief Retrieves a string representing the complete clang version suitable
75 /// for use in the CPP __VERSION__ macro, which includes the clang version
76 /// number, the repository version, and the vendor tag.
77 std::string getClangFullCPPVersion();
80 #endif // LLVM_CLANG_BASIC_VERSION_H