Improvements to constant folding.

We can now do constant folding with all basic datatypes (the previous
implementation handled int32 well, but had limited, if any, coverage
for other datatypes.)

Reduced a bit of repeated code in the constant folding implementation
through template helper functions.
This commit is contained in:
Matt Pharr
2013-07-22 16:12:02 -07:00
parent abf43ad01d
commit 564e61c828
7 changed files with 267 additions and 270 deletions

View File

@@ -1196,7 +1196,7 @@ lEmitEnumDecls(const std::vector<const EnumType *> &enumTypes, FILE *file) {
const Symbol *e = enumTypes[i]->GetEnumerator(j);
Assert(e->constValue != NULL);
unsigned int enumValue;
int count = e->constValue->AsUInt32(&enumValue);
int count = e->constValue->GetValues(&enumValue);
Assert(count == 1);
// Always print an initializer to set the value. We could be