[llvm-commits] [llvm] r45238 - in /llvm/trunk: include/llvm/LinkTimeOptimizer.h tools/lto/lto.cpp
Devang Patel
dpatel at apple.com
Wed Dec 19 16:24:01 PST 2007
Author: dpatel
Date: Wed Dec 19 18:24:01 2007
New Revision: 45238
URL: http://llvm.org/viewvc/llvm-project?rev=45238&view=rev
Log:
Add lto version check mechanism.
Modified:
llvm/trunk/include/llvm/LinkTimeOptimizer.h
llvm/trunk/tools/lto/lto.cpp
Modified: llvm/trunk/include/llvm/LinkTimeOptimizer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/LinkTimeOptimizer.h?rev=45238&r1=45237&r2=45238&view=diff
==============================================================================
--- llvm/trunk/include/llvm/LinkTimeOptimizer.h (original)
+++ llvm/trunk/include/llvm/LinkTimeOptimizer.h Wed Dec 19 18:24:01 2007
@@ -20,6 +20,8 @@
#include <set>
#include <llvm/ADT/hash_map>
+#define LLVM_LTO_VERSION 1
+
namespace llvm {
class Module;
@@ -148,6 +150,6 @@
/// linker to use dlopen() interface to dynamically load LinkTimeOptimizer.
/// extern "C" helps, because dlopen() interface uses name to find the symbol.
extern "C"
-llvm::LinkTimeOptimizer *createLLVMOptimizer();
+llvm::LinkTimeOptimizer *createLLVMOptimizer(unsigned VERSION = LLVM_LTO_VERSION);
#endif
Modified: llvm/trunk/tools/lto/lto.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/lto.cpp?rev=45238&r1=45237&r2=45238&view=diff
==============================================================================
--- llvm/trunk/tools/lto/lto.cpp (original)
+++ llvm/trunk/tools/lto/lto.cpp Wed Dec 19 18:24:01 2007
@@ -45,8 +45,11 @@
using namespace llvm;
extern "C"
-llvm::LinkTimeOptimizer *createLLVMOptimizer()
+llvm::LinkTimeOptimizer *createLLVMOptimizer(unsigned VERSION)
{
+ if (VERSION != LLVM_LTO_VERSION)
+ return NULL;
+
llvm::LTO *l = new llvm::LTO();
return l;
}
More information about the llvm-commits
mailing list