[PATCH] D26350: Keep invalid Switch in the AST

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 28 16:49:42 PST 2018


rsmith added inline comments.


================
Comment at: lib/Sema/SemaStmt.cpp:823
+                                  CondExpr->isValueDependent() ||
+                                  isa<OpaqueValueExpr>(CondExpr);
+  unsigned CondWidth =
----------------
It's fragile to assume that the only way you can see an `OpaqueValueExpr` here is by it being created in `ActOnStartOfSwitchStmt`. We could tunnel this information through in another way, though, such as by tracking a bool in the `SwitchStack` in addition to the statement.

However, perhaps it's time to bite the bullet and add actual support for error nodes in the AST. For example, we could add a new kind of placeholder type for an erroneous expression, and build syntactic expression trees with that type when we encounter errors.


https://reviews.llvm.org/D26350





More information about the cfe-commits mailing list