I'm not really sure if this is the right thing to do. These expressions and declarations have been marked as containing errors before, so they can't work properly during constant evaluation anyway. But I don't see them being rejected in the current constant interpreter.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
I'd like to see some test coverage for what these changes catch that wasn't caught before. On its face, this seems reasonable in that we don't want to bother running the interpreter (further) once we know we've hit an expression, declaration, or type that's not valid.
Tried to find an example for an invalid declaration but couldn't even manage to find one :|
clang/test/AST/Interp/functions.cpp | ||
---|---|---|
88–97 | There should definitely be diagnostics here, right? There's a use of an undeclared identifier in each function, but also, invalid() doesn't have a return statement despite returning an int. |
clang/test/AST/Interp/functions.cpp | ||
---|---|---|
88–97 | Right, I forgot to update the tests, sorry! |
clang/lib/AST/Interp/ByteCodeExprGen.cpp | ||
---|---|---|
1166–1167 | Because we can't find a case where we hit this, I think we should try asserting instead. |
Because we can't find a case where we hit this, I think we should try asserting instead.