This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Suppress warning about system_header pragma when editing headers
ClosedPublic

Authored by sammccall on Jan 10 2022, 3:47 AM.

Details

Summary

Not sure it's OK to suppress this in clang itself - if we're building a PCH
or module, maybe it matters?

Diff Detail

Event Timeline

sammccall created this revision.Jan 10 2022, 3:47 AM
sammccall requested review of this revision.Jan 10 2022, 3:47 AM

I wasn't sure whether to suppress this in clang or clangd, wonder what you think.

I wasn't sure whether to suppress this in clang or clangd, wonder what you think.

I think it is fine to do it in clang. pp_pragma_once_in_main_file is a similar diag, and clang has already suppressed it.

I wasn't sure whether to suppress this in clang or clangd, wonder what you think.

I think it is fine to do it in clang. pp_pragma_once_in_main_file is a similar diag, and clang has already suppressed it.

As discussed offline, if we drop the warning in clang it's not clear whether we can/should keep ignoring the pragma.
Probably the principled answer is we should respect the pragma, but the implications of the extra FileChanged call aren't clear to me.

Simply suppressing the warning in clang (but continuing to ignore the pragma) seems no more principled than this patch.
Until we work it out, I think we should just suppress here.

add a unittest?

sammccall updated this revision to Diff 399656.Jan 13 2022, 6:21 AM

add test, fix build

hokein accepted this revision.Jan 13 2022, 11:36 AM
This revision is now accepted and ready to land.Jan 13 2022, 11:36 AM