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"
/******************************************************************************