if(!var.layout)
var.layout = new Layout;
- Layout::Qualifier qual;
- qual.name = "offset";
- qual.has_value = true;
- qual.value = offset;
- var.layout->qualifiers.push_back(qual);
+ var.layout->qualifiers.push_back(Layout::Qualifier("offset", offset));
}
if(!has_matrix_order)
while(basic && basic->kind==BasicTypeDeclaration::ARRAY)
basic = dynamic_cast<const BasicTypeDeclaration *>(basic->base_type);
if(basic && basic->kind==BasicTypeDeclaration::MATRIX)
- {
- Layout::Qualifier qual;
- qual.name = "column_major";
- var.layout->qualifiers.push_back(qual);
- }
+ var.layout->qualifiers.push_back(Layout::Qualifier("column_major"));
}
offset += mem_reqs.size;
if(!layout)
layout = new Layout;
- Layout::Qualifier qual;
- qual.name = name;
- qual.has_value = true;
- qual.value = value;
- layout->qualifiers.push_back(qual);
+ layout->qualifiers.push_back(Layout::Qualifier(name, value));
}
void LocationAllocator::visit(VariableDeclaration &var)
if(token==")")
throw parse_error(tokenizer.get_location(), token, "a layout qualifier name");
- layout->qualifiers.push_back(Layout::Qualifier());
+ layout->qualifiers.push_back(token);
Layout::Qualifier &qual = layout->qualifiers.back();
- qual.name = token;
if((qual.has_value = check("=")))
{
bool has_value;
int value;
- Qualifier(): has_value(false), value(0) { }
+ Qualifier(const std::string &n = std::string()): name(n), has_value(false), value(0) { }
+ Qualifier(const std::string &n, int v): name(n), has_value(true), value(v) { }
};
std::vector<Qualifier> qualifiers;