1 //===- Version.h - Clang Version Number -------------------------*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 // 10 // This header defines version macros and version-related utility functions 11 // for Clang. 12 // 13 //===----------------------------------------------------------------------===// 14 15 #ifndef LLVM_CLANG_BASIC_VERSION_H 16 #define LLVM_CLANG_BASIC_VERSION_H 17 18 #include "llvm/ADT/StringRef.h" 19 20 #include "clang/Basic/Version.inc" 21 22 /// \brief Helper macro for CLANG_VERSION_STRING. 23 #define CLANG_MAKE_VERSION_STRING2(X) #X 24 25 #ifdef CLANG_VERSION_PATCHLEVEL 26 /// \brief Helper macro for CLANG_VERSION_STRING. 27 #define CLANG_MAKE_VERSION_STRING(X,Y,Z) CLANG_MAKE_VERSION_STRING2(X.Y.Z) 28 29 /// \brief A string that describes the Clang version number, e.g., 30 /// "1.0". 31 #define CLANG_VERSION_STRING \ 32 CLANG_MAKE_VERSION_STRING(CLANG_VERSION_MAJOR,CLANG_VERSION_MINOR, \ 33 CLANG_VERSION_PATCHLEVEL) 34 #else 35 /// \brief Helper macro for CLANG_VERSION_STRING. 36 #define CLANG_MAKE_VERSION_STRING(X,Y) CLANG_MAKE_VERSION_STRING2(X.Y) 37 38 /// \brief A string that describes the Clang version number, e.g., 39 /// "1.0". 40 #define CLANG_VERSION_STRING \ 41 CLANG_MAKE_VERSION_STRING(CLANG_VERSION_MAJOR,CLANG_VERSION_MINOR) 42 #endif 43 44 namespace clang { 45 /// \brief Retrieves the repository path (e.g., Subversion path) that 46 /// identifies the particular Clang branch, tag, or trunk from which this 47 /// Clang was built. 48 std::string getClangRepositoryPath(); 49 50 /// \brief Retrieves the repository path from which LLVM was built. Supports 51 /// LLVM residing in a separate repository from clang. 52 std::string getLLVMRepositoryPath(); 53 54 /// \brief Retrieves the repository revision number (or identifer) from which 55 /// this Clang was built. 56 std::string getClangRevision(); 57 58 /// \brief Retrieves the repository revision number (or identifer) from which 59 /// LLVM was built. If Clang and LLVM are in the same repository, this returns 60 /// the same string as getClangRevision. 61 std::string getLLVMRevision(); 62 63 /// \brief Retrieves the full repository version that is an amalgamation of 64 /// the information in getClangRepositoryPath() and getClangRevision(). 65 std::string getClangFullRepositoryVersion(); 66 67 /// \brief Retrieves a string representing the complete clang version, 68 /// which includes the clang version number, the repository version, 69 /// and the vendor tag. 70 std::string getClangFullVersion(); 71 72 /// \brief Retrieves a string representing the complete clang version suitable 73 /// for use in the CPP __VERSION__ macro, which includes the clang version 74 /// number, the repository version, and the vendor tag. 75 std::string getClangFullCPPVersion(); 76 } 77 78 #endif // LLVM_CLANG_BASIC_VERSION_H 79