Skip to content

Commit

Permalink
Expose LLVM version string via macro in llvm-config.h, and modify Go …
Browse files Browse the repository at this point in the history
…bindings

to make use of it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222307 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
pcc committed Nov 19, 2014
1 parent 8f4a49f commit 2dea1fe
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 4 deletions.
1 change: 1 addition & 0 deletions autoconf/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ LLVM_VERSION_SUFFIX=svn
AC_DEFINE_UNQUOTED([LLVM_VERSION_MAJOR], $LLVM_VERSION_MAJOR, [Major version of the LLVM API])
AC_DEFINE_UNQUOTED([LLVM_VERSION_MINOR], $LLVM_VERSION_MINOR, [Minor version of the LLVM API])
AC_DEFINE_UNQUOTED([LLVM_VERSION_PATCH], $LLVM_VERSION_PATCH, [Patch version of the LLVM API])
AC_DEFINE_UNQUOTED([LLVM_VERSION_STRING], "$PACKAGE_VERSION", [LLVM version string])

AC_SUBST([LLVM_VERSION_MAJOR])
AC_SUBST([LLVM_VERSION_MINOR])
Expand Down
3 changes: 0 additions & 3 deletions bindings/go/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,3 @@ else
fi

$llvm_go print-config > $gollvmdir/llvm_config.go

llvm_version="$($llvm_config --version)"
printf "package llvm\n\nconst Version = \"%s\"\n" "$llvm_version" > $gollvmdir/version.go
20 changes: 19 additions & 1 deletion bindings/go/llvm/version.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
//===- version.go - LLVM version info -------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file defines LLVM version information.
//
//===----------------------------------------------------------------------===//

package llvm

const Version = "3.6.0svn"
/*
#include "llvm/Config/llvm-config.h"
*/
import "C"

const Version = C.LLVM_VERSION_STRING
5 changes: 5 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -1941,6 +1941,11 @@ cat >>confdefs.h <<_ACEOF
_ACEOF


cat >>confdefs.h <<_ACEOF
#define LLVM_VERSION_STRING "$PACKAGE_VERSION"
_ACEOF





Expand Down
3 changes: 3 additions & 0 deletions include/llvm/Config/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,9 @@
/* Patch version of the LLVM API */
#undef LLVM_VERSION_PATCH

/* LLVM version string */
#undef LLVM_VERSION_STRING

/* The shared library extension */
#undef LTDL_SHLIB_EXT

Expand Down
3 changes: 3 additions & 0 deletions include/llvm/Config/llvm-config.h.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@
/* Minor version of the LLVM API */
#cmakedefine LLVM_VERSION_MINOR ${LLVM_VERSION_MINOR}

/* LLVM version string */
#define LLVM_VERSION_STRING "${PACKAGE_VERSION}"

/* Define if we link Polly to the tools */
#cmakedefine LINK_POLLY_INTO_TOOLS

Expand Down
3 changes: 3 additions & 0 deletions include/llvm/Config/llvm-config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,7 @@
/* Minor version of the LLVM API */
#undef LLVM_VERSION_MINOR

/* LLVM version string */
#undef LLVM_VERSION_STRING

#endif

0 comments on commit 2dea1fe

Please sign in to comment.