Parser: Precise: Recognize 'precise', tag types, and do related semantic checking.
This partly overlaps pull request #222, we have divided the work on this one.
This commit is contained in:
@@ -1711,6 +1711,7 @@ void HlslParseContext::mergeQualifiers(const TSourceLoc& loc, TQualifier& dst, c
|
||||
bool repeated = false;
|
||||
#define MERGE_SINGLETON(field) repeated |= dst.field && src.field; dst.field |= src.field;
|
||||
MERGE_SINGLETON(invariant);
|
||||
MERGE_SINGLETON(noContraction);
|
||||
MERGE_SINGLETON(centroid);
|
||||
MERGE_SINGLETON(smooth);
|
||||
MERGE_SINGLETON(flat);
|
||||
@@ -2016,6 +2017,7 @@ void HlslParseContext::redeclareBuiltinBlock(const TSourceLoc& loc, TTypeList& n
|
||||
oldType.getQualifier().centroid = newType.getQualifier().centroid;
|
||||
oldType.getQualifier().sample = newType.getQualifier().sample;
|
||||
oldType.getQualifier().invariant = newType.getQualifier().invariant;
|
||||
oldType.getQualifier().noContraction = newType.getQualifier().noContraction;
|
||||
oldType.getQualifier().smooth = newType.getQualifier().smooth;
|
||||
oldType.getQualifier().flat = newType.getQualifier().flat;
|
||||
oldType.getQualifier().nopersp = newType.getQualifier().nopersp;
|
||||
@@ -3380,6 +3382,14 @@ void HlslParseContext::addQualifierToExisting(const TSourceLoc& loc, TQualifier
|
||||
if (intermediate.inIoAccessed(identifier))
|
||||
error(loc, "cannot change qualification after use", "invariant", "");
|
||||
symbol->getWritableType().getQualifier().invariant = true;
|
||||
} else if (qualifier.noContraction) {
|
||||
if (intermediate.inIoAccessed(identifier))
|
||||
error(loc, "cannot change qualification after use", "precise", "");
|
||||
symbol->getWritableType().getQualifier().noContraction = true;
|
||||
} else if (qualifier.specConstant) {
|
||||
symbol->getWritableType().getQualifier().makeSpecConstant();
|
||||
if (qualifier.hasSpecConstantId())
|
||||
symbol->getWritableType().getQualifier().layoutSpecConstantId = qualifier.layoutSpecConstantId;
|
||||
} else
|
||||
warn(loc, "unknown requalification", "", "");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user