clang fails to build with latest LLVM revision

This morning I did an update of both my LLVM and clang trees. Now clang doesn't compile:

llvm[1]: Compiling CGExprComplex.cpp for Debug build
/Volumes/Data/Users/kremenek/dev/src/llvm/include/llvm/Instructions.h: In member function ‘void llvm::GetElementPtrInst::init(llvm::Value*, InputIterator, InputIterator, const std::string&, std::random_access_iterator_tag) [with InputIterator = llvm::Constant*]’:
/Volumes/Data/Users/kremenek/dev/src/llvm/include/llvm/Instructions.h:459: instantiated from ‘llvm::GetElementPtrInst::GetElementPtrInst(llvm::Value*, InputIterator, InputIterator, const std::string&, llvm::Instruction*) [with InputIterator = llvm::Constant*]’
/Volumes/Data/Users/kremenek/dev/src/llvm/include/llvm/Support/LLVMBuilder.h:223: instantiated from ‘llvm::GetElementPtrInst* llvm::LLVMBuilder::CreateGEP(llvm::Value*, InputIterator, InputIterator, const char*) [with InputIterator = llvm::Constant*]’
CGExprComplex.cpp:194: instantiated from here
/Volumes/Data/Users/kremenek/dev/src/llvm/include/llvm/Instructions.h:404: error: no matching function for call to ‘llvm::GetElementPtrInst::init(llvm::Value*&, llvm::Constant*, ptrdiff_t&)’
/Volumes/Data/Users/kremenek/dev/src/llvm/include/llvm/Instructions.h:390: note: candidates are: void llvm::GetElementPtrInst::init(llvm::Value*, llvm::Value* const*, unsigned int)
/Volumes/Data/Users/kremenek/dev/src/llvm/include/llvm/Instructions.h:391: note: void llvm::GetElementPtrInst::init(llvm::Value*, llvm::Value*)
make[1]: *** [/Volumes/Data/Users/kremenek/dev/src/llvm/tools/clang/CodeGen/Debug/CGExprComplex.o] Error 1
make: *** [all] Error 1

The revision numbers for the trees are as follows:

(kremenek@grue:llvm)$ svn update
At revision 41699.

(kremenek@grue:clang)$ svn update
At revision 41699.

It appears that the signature for GetElementPtrInst::init has changed. I can look into fixing this, but I'm not super savvy on the latest changes to the LLVM tree and how those changes effect the CodeGen component of clang.

It looks like the mainline interfaces were changed. Before it used to have several versions, including one that took a an array of operands as a base pointer + count, now it only takes two iterators as input.

Please change stuff like this:
   llvm::Value *ImagPtr = Builder.CreateGEP(SrcPtr, Zero, One, Name.c_str());


   Value *Ops = {Zero, One};
   llvm::Value *ImagPtr = Builder.CreateGEP(SrcPtr, Ops, Ops+2, Name.c_str());

and it should work.


OK. I've patched the calls to CreateGEP in the CodeGen directory. The code now compiles. Haven't tested it though.

Correction: make test works fine.