[cfe-dev] Clang: error accessing vector
GabrieleCocco
cocco at di.unipi.it
Sat Oct 27 18:15:29 PDT 2012
Hi to everybody.
I'm getting the following error while working on a Clang plugin:
error: call to a function
'std::vector<clang::CallExpr*,std::allocator<clang::CallExpr*>
>::operator[](unsigned long)' that is not present in the target
The interesting code is the following:
Expr*
OpenCLKernelCallDiscover::findParamSizeAttribute(vector<CallExpr*>&
attributes, string name) {
for(int i = 0; i < attributes.size(); i++) {
if(attributes.at(i)->getDirectCallee()->getName().str() ==
"call_this_opencl_buffer_size") {
Expr* param = attributes[i]->getArg(0);
// Attribute first arg must be a call (buffer) arg name
if(param->isEvaluatable(context)) {
string param_name;
llvm::raw_string_ostream stream(param_name);
param->printPretty(stream, NULL,
context.getPrintingPolicy());
if(param_name == name) {
int arg = attributes.at(i)->getNumArgs();
Expr* size_arg = attributes.at(i)->getArg(1);
size_arg->dump();
printf(" OK\n");
return size_arg;
}
}
}
}
return NULL;
}
The problem is that I'm getting erroneous values for some of the variables
in the code, such as size_arg. I argue the error reported affects the
correctness of the entire function body.
I tried to google the error with ne results.
Can you help me?
Thank you very much!
--
View this message in context: http://clang-developers.42468.n3.nabble.com/Clang-error-accessing-vector-tp4027780.html
Sent from the Clang Developers mailing list archive at Nabble.com.
More information about the cfe-dev
mailing list