diff options
author | rdivacky <rdivacky@FreeBSD.org> | 2009-10-14 18:03:49 +0000 |
---|---|---|
committer | rdivacky <rdivacky@FreeBSD.org> | 2009-10-14 18:03:49 +0000 |
commit | 9092c3e0fa01f3139b016d05d267a89e3b07747a (patch) | |
tree | 137ebebcae16fb0ce7ab4af456992bbd8d22fced /lib/Basic/Version.cpp | |
parent | 4981926bf654fe5a2c3893f24ca44106b217e71e (diff) | |
download | FreeBSD-src-9092c3e0fa01f3139b016d05d267a89e3b07747a.zip FreeBSD-src-9092c3e0fa01f3139b016d05d267a89e3b07747a.tar.gz |
Update clang to r84119.
Diffstat (limited to 'lib/Basic/Version.cpp')
-rw-r--r-- | lib/Basic/Version.cpp | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/lib/Basic/Version.cpp b/lib/Basic/Version.cpp new file mode 100644 index 0000000..30383f6 --- /dev/null +++ b/lib/Basic/Version.cpp @@ -0,0 +1,49 @@ +//===- Version.cpp - Clang Version Number -----------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file defines several version-related utility functions for Clang. +// +//===----------------------------------------------------------------------===// +#include <cstring> +#include <cstdlib> +using namespace std; + +namespace clang { + +const char *getClangSubversionPath() { + static const char *Path = 0; + if (Path) + return Path; + + static char URL[] = "$URL: http://llvm.org/svn/llvm-project/cfe/trunk/lib/Basic/Version.cpp $"; + char *End = strstr(URL, "/lib/Basic"); + if (End) + *End = 0; + + char *Begin = strstr(URL, "cfe/"); + if (Begin) { + Path = Begin + 4; + return Path; + } + + Path = URL; + return Path; +} + + +unsigned getClangSubversionRevision() { +#ifndef SVN_REVISION + // Subversion was not available at build time? + return 0; +#else + return strtol(SVN_REVISION, 0, 10); +#endif +} + +} // end namespace clang |