Exemplo n.º 1
0
TEST(AttrOrderTest, setPtrAdrsSpace) {
  // func(restrict volatile const __local int*)
  const char* s = "_Z4funcPrU3AS3i";

  FunctionDescriptor fd;
  RefParamType primitiveInt(new PrimitiveType(PRIMITIVE_INT));
  PointerType *ptrInt = new PointerType(primitiveInt);
  ptrInt->setQualifier(ATTR_RESTRICT, true);
  ptrInt->setAddressSpace(ATTR_CONSTANT);
  ptrInt->setAddressSpace(ATTR_LOCAL);
  ptrInt->setAddressSpace(ATTR_GLOBAL);
  ptrInt->setAddressSpace(ATTR_LOCAL);
  RefParamType ptrIntRef(ptrInt);

  fd.name = "func";
  fd.parameters.push_back(ptrIntRef);

  std::string mangled = mangle(fd);
  ASSERT_STREQ(s, mangled.c_str());
}
Exemplo n.º 2
0
TEST(AttrOrderTest, pointerAttributes3) {
  // func(restrict const __constant int*)
  const char* s = "_Z4funcPrKU3AS2i";

  FunctionDescriptor fd;
  RefParamType primitiveInt(new PrimitiveType(PRIMITIVE_INT));
  PointerType *ptrInt = new PointerType(primitiveInt);
  ptrInt->setAddressSpace(ATTR_CONSTANT);
  ptrInt->setQualifier(ATTR_RESTRICT, true);
  ptrInt->setQualifier(ATTR_CONST, true);
  RefParamType ptrIntRef(ptrInt);

  fd.name = "func";
  fd.parameters.push_back(ptrIntRef);

  std::string mangled = mangle(fd);
  ASSERT_STREQ(s, mangled.c_str());
}
Exemplo n.º 3
0
TEST(MangleTest, vecAndVecPtr) {
  // "frexp(float2, __global int2*)"
  const char* s = "_Z5frexpDv2_fPU3AS1Dv2_i";
  FunctionDescriptor fd;
  RefParamType primitiveFloat(new PrimitiveType(PRIMITIVE_FLOAT));
  RefParamType vectorFloat(new VectorType(primitiveFloat, 2));

  RefParamType primitiveInt(new PrimitiveType(PRIMITIVE_INT));
  RefParamType vectorInt(new VectorType(primitiveInt, 2));
  PointerType *ptrInt = new PointerType(vectorInt);
  ptrInt->setAddressSpace(ATTR_GLOBAL);
  RefParamType ptrIntRef(ptrInt);

  fd.name = "frexp";
  fd.parameters.push_back(vectorFloat);
  fd.parameters.push_back(ptrIntRef);

  std::string mangled = mangle(fd);
  ASSERT_STREQ(s, mangled.c_str());
}