Clang OpenCL support

Hi All,
     Currently, I am trying to analysis OpenCL source code by using clang
AST.
I modified a sample to do this . But due to some keyword , clang doesn't
support. I
have define as the following way.
#define __global __attribute__((address_space(1)))
#define __kernel __attribute__((address_space(2)))
#define __constant __attribute__((address_space(3)))
#define CLK_LOCAL_MEM_FENCE 0
#define __local __attribute__((address_space(4)))

ahead of opencl source file before using it, otherwise it will occur some
errors.
I have set langoptions , but it seems no effect. I don't know why. Can
anyone help me fix this out ?
so that I don't have to add some defines ahead of .cl files
  langOpts.OpenCL= 1
91 Invocation->setLangDefaults(langOpts,
92 clang::IK_OpenCL,
93 clang::LangStandard::lang_opencl);

This is my codes:
#include <iostream>

#include "llvm/Support/Host.h"
#include "llvm/ADT/IntrusiveRefCntPtr.h"

#include "clang/Basic/DiagnosticOptions.h"
#include "clang/Frontend/TextDiagnosticPrinter.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Basic/TargetOptions.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/Basic/FileManager.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/Basic/Diagnostic.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/ASTConsumer.h"
#include "clang/Parse/Parser.h"
#include "clang/Parse/ParseAST.h"

/******************************************************************************

This is my makefile:

CXX := clang++
LLVMCOMPONENTS := cppbackend
RTTIFLAG := -fno-rtti
LLVMCONFIG := /home/xiuxia/work/codes/build/Debug+Asserts/bin/llvm-config

CXXFLAGS := -I$(shell $(LLVMCONFIG) --src-root)/tools/clang/include
-I$(shell $(LLVMCONFIG) --obj-root)/tools/clang/include $(shell
$(LLVMCONFIG) --cxxflags) $(RTTIFLAG)
LLVMLDFLAGS := $(shell $(LLVMCONFIG) --ldflags --libs $(LLVMCOMPONENTS))

SOURCES = CI_opencl.cpp

OBJECTS = $(SOURCES:.cpp=.o)
EXES = $(OBJECTS:.o=)
CLANGLIBS = \
                -lclangTooling\
                -lclangFrontendTool\
                -lclangFrontend\
                -lclangDriver\
                -lclangSerialization\
                -lclangCodeGen\
                -lclangParse\
                -lclangSema\
                -lclangStaticAnalyzerFrontend\
                -lclangStaticAnalyzerCheckers\
                -lclangStaticAnalyzerCore\
                -lclangAnalysis\
                -lclangARCMigrate\
                -lclangRewriteFrontend\
                -lclangRewriteCore\
                -lclangEdit\
                -lclangAST\
                -lclangLex\
                -lclangBasic\
                $(shell $(LLVMCONFIG) --libs)\
                -lcurses

all: $(OBJECTS) $(EXES)

%: %.o
    $(CXX) -o $@ $< $(CLANGLIBS) $(LLVMLDFLAGS)

Hi,

What about if you also use '-Dcl_clang_storage_class_specifiers'?

Cheers,
Sam

Sam Parker
Research Student
Electronic Systems Design Group
School of Electronic and Systems Engineering
Loughborough University
UK

I tried , but it has no effect .Same errors reported .
input_fun.c:42:1: error: unknown type name '__kernel'
input_fun.c:42:26: error: unknown type name '__global'