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 // This header defines version macros and version-related utility functions
00011 // for Clang.
00012 //
00013 //===----------------------------------------------------------------------===//
00014 
00015 #ifndef LLVM_CLANG_BASIC_VERSION_H
00016 #define LLVM_CLANG_BASIC_VERSION_H
00017 
00018 #include "llvm/ADT/StringRef.h"
00019 
00020 #include "clang/Basic/Version.inc"
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.,
00030 /// "1.0".
00031 #define CLANG_VERSION_STRING \
00032   CLANG_MAKE_VERSION_STRING(CLANG_VERSION_MAJOR,CLANG_VERSION_MINOR, \
00033                             CLANG_VERSION_PATCHLEVEL)
00034 #else
00035 /// \brief Helper macro for CLANG_VERSION_STRING.
00036 #define CLANG_MAKE_VERSION_STRING(X,Y) CLANG_MAKE_VERSION_STRING2(X.Y)
00037 
00038 /// \brief A string that describes the Clang version number, e.g.,
00039 /// "1.0".
00040 #define CLANG_VERSION_STRING \
00041   CLANG_MAKE_VERSION_STRING(CLANG_VERSION_MAJOR,CLANG_VERSION_MINOR)
00042 #endif
00043 
00044 namespace clang {
00045   /// \brief Retrieves the repository path (e.g., Subversion path) that
00046   /// identifies the particular Clang branch, tag, or trunk from which this
00047   /// Clang was built.
00048   std::string getClangRepositoryPath();
00049 
00050   /// \brief Retrieves the repository path from which LLVM was built. Supports
00051   /// LLVM residing in a separate repository from clang.
00052   std::string getLLVMRepositoryPath();
00053 
00054   /// \brief Retrieves the repository revision number (or identifer) from which
00055   ///  this Clang was built.
00056   std::string getClangRevision();
00057 
00058   /// \brief Retrieves the repository revision number (or identifer) from which
00059   /// LLVM was built. If Clang and LLVM are in the same repository, this returns
00060   /// the same string as getClangRevision.
00061   std::string getLLVMRevision();
00062 
00063   /// \brief Retrieves the full repository version that is an amalgamation of
00064   ///  the information in getClangRepositoryPath() and getClangRevision().
00065   std::string getClangFullRepositoryVersion();
00066 
00067   /// \brief Retrieves a string representing the complete clang version,
00068   ///   which includes the clang version number, the repository version,
00069   ///   and the vendor tag.
00070   std::string getClangFullVersion();
00071 
00072   /// \brief Retrieves a string representing the complete clang version suitable
00073   ///   for use in the CPP __VERSION__ macro, which includes the clang version
00074   ///   number, the repository version, and the vendor tag.
00075   std::string getClangFullCPPVersion();
00076 }
00077 
00078 #endif // LLVM_CLANG_BASIC_VERSION_H