Esempio n. 1
0
TEST(AttrOrderTest, pointerAttributes4) {
  // func(restrict const int*)
  const char* s = "_Z4funcPrKi";

  FunctionDescriptor fd;
  RefParamType primitiveInt(new PrimitiveType(PRIMITIVE_INT));
  PointerType *ptrInt = new PointerType(primitiveInt);
  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());
}
Esempio n. 2
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());
}