rsmith added a comment.

(No blocking concerns here.)


================
Comment at: clang/lib/AST/Stmt.cpp:1000-1003
+  if (Optional<Stmt *> Result =
+          const_cast<IfStmt *>(this)->getNondiscardedCase(Ctx))
+    return *Result;
+  return None;
----------------
Can this simply be
```
  return const_cast<IfStmt *>(this)->getNondiscardedCase(Ctx));
```
? I would expect that if `T` implicitly converts to `U` then `Optional<T>` 
implicitly converts to `Optional<U>`.


================
Comment at: clang/lib/Sema/Sema.cpp:1545
 class DeferredDiagnosticsEmitter
     : public UsedDeclVisitor<DeferredDiagnosticsEmitter> {
 public:
----------------
I wonder if there are other `UsedDeclVisitor`s that would want this behavior, 
largely because of [basic.def.odr]p10: "Every program shall contain exactly one 
definition of every non-inline function or variable that is odr-used in that 
program outside of a discarded statement (8.5.2)". It seems worth checking, and 
maybe moving this functionality to an optional behavior in the base class, but 
I don't want to hold up this patch on that.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D102251/new/

https://reviews.llvm.org/D102251

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to