aaron.ballman added inline comments.

================
Comment at: clang/lib/Parse/ParsePragma.cpp:3578
+
+  if (Tok.isNot(tok::l_paren)) {
+    PP.Diag(Tok.getLocation(), diag::warn_pragma_expected_lparen)
----------------
steplong wrote:
> aaron.ballman wrote:
> > Can we use `ExpectAndConsume()` here instead?
> I don't think we can use `ExpectAndConsume()` here because it's not a `Parser`
Oh good point! Sorry for the noise.


================
Comment at: clang/lib/Sema/SemaAttr.cpp:1070
+    SourceLocation Loc, const llvm::SmallSetVector<StringRef, 4> &Intrinsics) {
+  if (!CurContext->getRedeclContext()->isFileContext()) {
+    Diag(Loc, diag::err_pragma_intrinsic_function_scope);
----------------
steplong wrote:
> aaron.ballman wrote:
> > What is `CurContext` when this gets called for your .c test file? I would 
> > have expected it to be the `TranslationUnitDecl` which should be a file 
> > context (getting the redecl context shouldn't do anything in the cases I've 
> > seen).
> It looks like it's a `FunctionDecl`
Wha? That seems rather surprising -- which function does it think the pragma is 
scoped to?

You might consider putting breakpoints in `PushDeclContext()` and 
`PopDeclContext()` to see what's going on (or search for other places where we 
assign to `CurContext` and break on those).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D124702

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

Reply via email to