[PATCH] D26350: Keep invalid Switch in the AST

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 28 18:45:34 PST 2018


aaron.ballman added inline comments.


================
Comment at: lib/Sema/SemaStmt.cpp:823
+                                  CondExpr->isValueDependent() ||
+                                  isa<OpaqueValueExpr>(CondExpr);
+  unsigned CondWidth =
----------------
rsmith wrote:
> 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.
FWIW, I would find error nodes in the AST to be extremely useful.


https://reviews.llvm.org/D26350





More information about the cfe-commits mailing list