[PATCH] D149884: [clang][deps] Teach dep directive scanner about _Pragma

Ben Langmuir via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 4 11:42:30 PDT 2023


benlangmuir created this revision.
benlangmuir added reviewers: akyrtzi, Bigcheese, jansvoboda11.
Herald added a project: All.
benlangmuir requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

While we cannot handle `_Pragma` used inside macros, we an handle this at the top level, and it some projects use the `_Pragma("once")` spelling like that, which was causing spurious failures in the scanner.

Limitations

- Cannot handle #define ONCE _Pragma("once"), same issue as using @import in a macro -- ideally we should diagnose this in obvious cases
- Our LangOpts are currently fixed, so we are not handling u"" strings or R"()" strings that require C11/C++11.

rdar://108629982


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D149884

Files:
  clang/include/clang/Lex/Pragma.h
  clang/lib/Lex/DependencyDirectivesScanner.cpp
  clang/lib/Lex/Pragma.cpp
  clang/test/ClangScanDeps/_Pragma-once.c
  clang/unittests/Lex/DependencyDirectivesScannerTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149884.519586.patch
Type: text/x-patch
Size: 17003 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230504/f7be68b6/attachment-0001.bin>


More information about the cfe-commits mailing list