clang API Documentation

Version.h
Go to the documentation of this file.
00001 //===- Version.h - Clang Version Number -------------------------*- C++ -*-===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 ///
00010 /// \file
00011 /// \brief Defines version macros and version-related utility functions
00012 /// for Clang.
00013 ///
00014 //===----------------------------------------------------------------------===//
00015 
00016 #ifndef LLVM_CLANG_BASIC_VERSION_H
00017 #define LLVM_CLANG_BASIC_VERSION_H
00018 
00019 #include "clang/Basic/Version.inc"
00020 #include "llvm/ADT/StringRef.h"
00021 
00022 /// \brief Helper macro for CLANG_VERSION_STRING.
00023 #define CLANG_MAKE_VERSION_STRING2(X) #X
00024 
00025 #ifdef CLANG_VERSION_PATCHLEVEL
00026 /// \brief Helper macro for CLANG_VERSION_STRING.
00027 #define CLANG_MAKE_VERSION_STRING(X,Y,Z) CLANG_MAKE_VERSION_STRING2(X.Y.Z)
00028 
00029 /// \brief A string that describes the Clang version number, e.g., "1.0".
00030 #define CLANG_VERSION_STRING \
00031   CLANG_MAKE_VERSION_STRING(CLANG_VERSION_MAJOR,CLANG_VERSION_MINOR, \
00032                             CLANG_VERSION_PATCHLEVEL)
00033 #else
00034 /// \brief Helper macro for CLANG_VERSION_STRING.
00035 #define CLANG_MAKE_VERSION_STRING(X,Y) CLANG_MAKE_VERSION_STRING2(X.Y)
00036 
00037 /// \brief A string that describes the Clang version number, e.g., "1.0".
00038 #define CLANG_VERSION_STRING \
00039   CLANG_MAKE_VERSION_STRING(CLANG_VERSION_MAJOR,CLANG_VERSION_MINOR)
00040 #endif
00041 
00042 namespace clang {
00043   /// \brief Retrieves the repository path (e.g., Subversion path) that
00044   /// identifies the particular Clang branch, tag, or trunk from which this
00045   /// Clang was built.
00046   std::string getClangRepositoryPath();
00047 
00048   /// \brief Retrieves the repository path from which LLVM was built.
00049   ///
00050   /// This supports LLVM residing in a separate repository from clang.
00051   std::string getLLVMRepositoryPath();
00052 
00053   /// \brief Retrieves the repository revision number (or identifer) from which
00054   /// this Clang was built.
00055   std::string getClangRevision();
00056 
00057   /// \brief Retrieves the repository revision number (or identifer) from which
00058   /// LLVM was built.
00059   ///
00060   /// If Clang and LLVM are in the same repository, this returns the same
00061   /// string as getClangRevision.
00062   std::string getLLVMRevision();
00063 
00064   /// \brief Retrieves the full repository version that is an amalgamation of
00065   /// the information in getClangRepositoryPath() and getClangRevision().
00066   std::string getClangFullRepositoryVersion();
00067 
00068   /// \brief Retrieves a string representing the complete clang version,
00069   /// which includes the clang version number, the repository version,
00070   /// and the vendor tag.
00071   std::string getClangFullVersion();
00072 
00073   /// \brief Like getClangFullVersion(), but with a custom tool name.
00074   std::string getClangToolFullVersion(llvm::StringRef ToolName);
00075 
00076   /// \brief Retrieves a string representing the complete clang version suitable
00077   /// for use in the CPP __VERSION__ macro, which includes the clang version
00078   /// number, the repository version, and the vendor tag.
00079   std::string getClangFullCPPVersion();
00080 }
00081 
00082 #endif // LLVM_CLANG_BASIC_VERSION_H