[all-commits] [llvm/llvm-project] ee8ed0: [clang][deps] Teach dep directive scanner about _P...

Ben Langmuir via All-commits all-commits at lists.llvm.org
Tue May 9 10:31:17 PDT 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ee8ed0b3099e63ba0a18cca42b9cfdf098bc6201
  Author: Ben Langmuir <blangmuir at apple.com>
  Date:   2023-05-09 (Tue, 09 May 2023)

  Changed paths:
    M clang/include/clang/Lex/Pragma.h
    M clang/lib/Lex/DependencyDirectivesScanner.cpp
    M clang/lib/Lex/Pragma.cpp
    A clang/test/ClangScanDeps/_Pragma-once.c
    M clang/unittests/Lex/DependencyDirectivesScannerTest.cpp

  Log Message:
  [clang][deps] Teach dep directive scanner about _Pragma

While we cannot handle `_Pragma` used inside macros, we can 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.

* 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.


Differential Revision: https://reviews.llvm.org/D149884

More information about the All-commits mailing list