--- include/llvm-c/Core.h (revision 132133) +++ include/llvm-c/Core.h (working copy) @@ -290,6 +290,11 @@ void LLVMDisposeMessage(char *Message); +/*===-- Version -----------------------------------------------------------===*/ + +const char* LLVMGetVersion(int ShowRepositoryRevision); + + /*===-- Contexts ----------------------------------------------------------===*/ /* Create and destroy contexts. */ --- lib/VMCore/Core.cpp (revision 132133) +++ lib/VMCore/Core.cpp (working copy) @@ -53,7 +53,16 @@ free(Message); } +/*===-- Version -----------------------------------------------------------===*/ +const char * LLVMGetVersion(int ShowRepositoryRevision) { + if (ShowRepositoryRevision) { + return REPOSITORY_REVISION; + } else { + return PACKAGE_VERSION; + } +} + /*===-- Operations on contexts --------------------------------------------===*/ LLVMContextRef LLVMContextCreate() { --- lib/VMCore/Makefile (revision 132133) +++ lib/VMCore/Makefile (working copy) @@ -19,6 +19,8 @@ INTRINSICTD := $(PROJ_SRC_ROOT)/include/llvm/Intrinsics.td INTRINSICTDS := $(wildcard $(PROJ_SRC_ROOT)/include/llvm/Intrinsics*.td) +SVNVERSION := $(shell cd $(PROJ_SRC_ROOT) && (LC_ALL=C svnversion -cn . 2>/dev/null | sed -e "s/.*://" -e "s/\([0-9]*\).*/\1/" | grep "[0-9]" || LC_ALL=C svn info . 2>/dev/null | awk '/^Revision:/ {print $$2 }' | grep "[0-9]" || LC_ALL=C git svn info . 2>/dev/null | awk '/^Revision:/ {print $$2 }' | grep "[0-9]" || echo unknown)) +CPPFLAGS += -DREPOSITORY_REVISION="\"$(SVNVERSION)\"" $(ObjDir)/Intrinsics.gen.tmp: $(ObjDir)/.dir $(INTRINSICTDS) $(TBLGEN) $(Echo) Building Intrinsics.gen.tmp from Intrinsics.td