[PATCH] D144115: [clang] Extend pragma dump to support expressions

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 22 06:02:05 PDT 2023


aaron.ballman added inline comments.


================
Comment at: clang/lib/Parse/ParsePragma.cpp:15-17
 #include "clang/Basic/TargetInfo.h"
+#include "clang/Lex/LexDiagnostic.h"
 #include "clang/Lex/Preprocessor.h"
----------------
Endill wrote:
> aaron.ballman wrote:
> > 
> I'm using `warn_pragma_debug_unexpected_argument` and `warn_pragma_debug_missing_argument` from there as well, and not just added diagnostics. What should I do about that? Copying them over to `DiagnosticParseKinds.td` doesn't work.
Ah, those should move into `DiagnosticCommonKinds.td` under the `// Parse && Lex` heading, then they should be available from here as well without the extra include.


================
Comment at: clang/lib/Parse/ParsePragma.cpp:731-736
+    } else if (E.get()->isTypeDependent()) {
+      PP.Diag(StartLoc, diag::warn_pragma_debug_type_dependent_argument)
+        << SourceRange(StartLoc, Tok.getLocation());
+    } else if (E.get()->isValueDependent()) {
+      PP.Diag(StartLoc, diag::warn_pragma_debug_value_dependent_argument)
+        << SourceRange(StartLoc, Tok.getLocation());
----------------
Endill wrote:
> aaron.ballman wrote:
> > 
> I see quite a lot of items inside `ExprDependence`. Are you sure we don't miss any corner cases by using `isValueDependent()` to select between value- and type-dependent diagnostic text? 
I was trying to think of a case where we'd run into problems, but I can't come up with one, so I believe we're fine here.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D144115



More information about the cfe-commits mailing list