[PATCH] D127284: [clang-repl] Support statements on global scope in incremental mode.

Vassil Vassilev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 1 08:35:45 PST 2022


v.g.vassilev added inline comments.


================
Comment at: clang/lib/Parse/ParseDecl.cpp:5395-5400
+  // FIXME: Tell the user this is unsupported.
+  if (!Stmts.empty()) {
+    unsigned ID = Actions.getDiagnostics().getCustomDiagID(
+        DiagnosticsEngine::Error, "Unsupported statement on the global scope");
+    Actions.Diag(Stmts.back()->getBeginLoc(), ID);
+  }
----------------
aaron.ballman wrote:
> v.g.vassilev wrote:
> > aaron.ballman wrote:
> > > Why is this using a custom diagnostic instead of adding a typical diagnostic to DiagnosticParseKinds.td?
> > I don't have a problem converting this to a DiagnosticParseKind. However, this is a temporary diagnostic and we risk once the FIXME is resolved to leave a stray diagnostic id. 
> It's been my experience that there's nothing more permanent than a temporary solution, so I'd say we should go with the regular diagnostic. Also, it should be worded `unsupported statement at global scope` to fit the usual diagnostic wording style.
I took the liberty to address the FIXME. 


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

https://reviews.llvm.org/D127284



More information about the cfe-commits mailing list