[cfe-dev] OpenCL : invalid operands to binary expression

Sam Parker S.Parker3 at lboro.ac.uk
Mon Apr 21 14:37:52 PDT 2014


Hi,

Ok, I though you were just trying to compile on the command line...
Haven't checked this, but something along like this should work:

Invocation->setLangDefaults(langOpts,
                              clang::IK_CXX,                                    // change to clang::IK_OpenCL
                              clang::LangStandard::lang_opencl);

And grab the opencl header files from libclc.llvm.org and add these to your search path:
hso->AddPath("/path/to/libclc/headers", clang::frontend::Angled, false, false);

and you'll also have to enable the storage classes:
ci.getPreprocessorOpts().addMacroDef("cl_clang_storage_class_specifiers");

good luck,
Sam

Sam Parker
Research Student
Electronic Systems Design Group
Loughborough University
UK

________________________________________
From: cfe-dev-bounces at cs.uiuc.edu [cfe-dev-bounces at cs.uiuc.edu] on behalf of Xiuxia [zhangxiuxia1 at gmail.com]
Sent: 21 April 2014 17:20
To: cfe-dev at cs.uiuc.edu
Subject: Re: [cfe-dev] OpenCL :  invalid operands to binary expression

Hi Sam,
       I am using clang3.4 version.
My makefile is

CXX := clang++
LLVMCOMPONENTS := cppbackend
RTTIFLAG := -fno-rtti
LLVMCONFIG := /sandbox/xiuxia/llvm_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)


Here is my source file : I put it on the attachment. CI_opencl.cpp
<http://clang-developers.42468.n3.nabble.com/file/n4038913/CI_opencl.cpp>





-----
Good good study, day day up
--
View this message in context: http://clang-developers.42468.n3.nabble.com/OpenCL-invalid-operands-to-binary-expression-tp4038893p4038913.html
Sent from the Clang Developers mailing list archive at Nabble.com.
_______________________________________________
cfe-dev mailing list
cfe-dev at cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev



More information about the cfe-dev mailing list