diff options
| author | Tim Foley <tfoleyNV@users.noreply.github.com> | 2018-05-11 13:56:14 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-05-11 13:56:14 -0700 |
| commit | 5e604a6f39ef8e8086702d41113ea78856804c99 (patch) | |
| tree | 035a4de9b84bdc04f377344dcaea931aa1896fa4 /source/slang/ir-legalize-types.cpp | |
| parent | 10c0ffa7de111bd2c0096015bba5ca2110d03bc1 (diff) | |
Cleanups around behavior when the compiler fails (#553)
* Cleanups around behavior when the compiler fails
* Add another case where we try to `noteInternalErrorLoc()` if an exception in thrown. This one is the in the logic for emitting an IR instruciton. This could be improved by adding another layer at the function level (as a catch-all for instructions with no location), but something is better than nothing.
* Change a bunch of `assert()`s over to `SLANG_ASSERT()`s, so that we can theoretically take more control over them (e.g., make release builds with asserts enabled)
* Some other small cleanups around the assertions we perform.
In the survey I made, I didn't really see many obvious "smoking gun" cases where we could produce a significantly better error message for some of the unimplemented/unexpected paths, other than to actually implement the missing functionality.
* fixup
Diffstat (limited to 'source/slang/ir-legalize-types.cpp')
| -rw-r--r-- | source/slang/ir-legalize-types.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/source/slang/ir-legalize-types.cpp b/source/slang/ir-legalize-types.cpp index 3465662f3..05b8ca647 100644 --- a/source/slang/ir-legalize-types.cpp +++ b/source/slang/ir-legalize-types.cpp @@ -68,7 +68,7 @@ LegalVal LegalVal::implicitDeref(LegalVal const& val) LegalVal LegalVal::getImplicitDeref() { - assert(flavor == Flavor::implicitDeref); + SLANG_ASSERT(flavor == Flavor::implicitDeref); return obj.As<ImplicitDerefVal>()->val; } @@ -622,10 +622,10 @@ static LegalVal legalizeGetElementPtr( RefPtr<TuplePseudoVal> resTupleInfo = new TuplePseudoVal(); auto tupleType = type.getTuple(); - assert(tupleType); + SLANG_ASSERT(tupleType); auto elemCount = ptrTupleInfo->elements.Count(); - assert(elemCount == tupleType->elements.Count()); + SLANG_ASSERT(elemCount == tupleType->elements.Count()); for(UInt ee = 0; ee < elemCount; ++ee) { @@ -951,7 +951,7 @@ static void addParamType(List<IRType*>& ioParamTypes, LegalType t) } break; default: - SLANG_ASSERT(false); + SLANG_UNEXPECTED("unknown legalized type flavor"); } } |
