--- include/llvm-c/Core.h (revision 132525) +++ include/llvm-c/Core.h (working copy) @@ -290,6 +290,17 @@ void LLVMDisposeMessage(char *Message); +/*===-- Version -----------------------------------------------------------===*/ + +typedef enum { + /* Terminator Instructions */ + LLVMVersionNumber = 1, + LLVMVersionRepository = 2 +} LLVMVersion; + +const char* LLVMGetVersion(LLVMVersion VN); + + /*===-- Contexts ----------------------------------------------------------===*/ /* Create and destroy contexts. */ --- lib/VMCore/Core.cpp (revision 132525) +++ lib/VMCore/Core.cpp (working copy) @@ -53,7 +53,19 @@ free(Message); } +/*===-- Version -----------------------------------------------------------===*/ +const char * LLVMGetVersion(LLVMVersion VN) { + switch (VN) { + case LLVMVersionNumber: + return PACKAGE_VERSION; + case LLVMVersionRepository: + return REPOSITORY_REVISION; + default: + return ""; + } +} + /*===-- Operations on contexts --------------------------------------------===*/ LLVMContextRef LLVMContextCreate() { --- lib/VMCore/Makefile (revision 132525) +++ 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