Creating a builtin with address spaces for OpenCL fails

Hi!

I'm developing a back end for a new target foobar with CLang/LLVM (version 3.4.2). At the current stage I want to create a builtin that accesses some OpenCL local memory.

In cfe-3.4.2.src/lib/Basic/Targets.cpp I define the following address space map:
  static const unsigned FoobarAddrSpaceMap = {
    1, // opencl_global
    2, // opencl_local
    3, // opencl_constant
    0, // cuda_device
    0, // cuda_constant
    0 // cuda_shared
  };
and set the attributes in the target info.

I've added the file cfe-3.4.2.src/include/clang/Basic/BuiltinsFooBar.def:
BUILTIN(__builtin_foobar_copy, "iV8Uc*2V8Uc*i", "") /* first arg reads from address space 2: opencl local */

But when I use the builtin:
  __local uchar8 inbuf[SIZE];
  int res = __builtin_foobar_copy(inbuf, ...

I get the error message:
foorbar_test.cl:90:47: error: passing '__local uchar8 *' to parameter of type
      '__attribute__((__vector_size__(8 * sizeof(unsigned char)))) unsigned char
      __attribute__((address_space(2))) *' changes address space of pointer

What is it that I am doing wrong? Even if I replace address space number 2 by any other number I get this error message.
I use the options "-x cl -Dcl_clang_storage_class_specifiers".

Any hints?
Thanks,
Boris