[PATCH] D129061: [Lex] Diagnose macro in command lines

Jack Huang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Jul 9 10:16:40 PDT 2022


jackhong12 updated this revision to Diff 443447.
jackhong12 added a comment.
Herald added subscribers: mstorsjo, MaskRay.
Herald added a reviewer: sscalpone.
Herald added a project: clang-tools-extra.

I added two flags, `-driver-define` and `-driver-undefine`, to indicate macros that the driver defines. And I moved driver-defined macros from `<command line>` file to `<built-in>` file, like

  # 1 "<built-in>" 3
  #define __llvm__ 1
  #define __clang__ 1
  ...
  # 1 "<command line>" 1
  #define __WHY_NOT_ME__ 1
  #undef __STDC__
  # 1 "<built-in>" 2
  #define __GCC_HAVE_DWARF2_CFI_ASM 1
  ...


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

https://reviews.llvm.org/D129061

Files:
  clang-tools-extra/test/pp-trace/pp-trace-include.cpp
  clang/include/clang/Basic/SourceManager.h
  clang/include/clang/Driver/Options.td
  clang/include/clang/Lex/PreprocessorOptions.h
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/lib/Frontend/InitPreprocessor.cpp
  clang/lib/Lex/PPDirectives.cpp
  clang/test/Driver/cl-runtime-flags.c
  clang/test/Driver/mingw.cpp
  clang/test/Preprocessor/macro-command-line-diagnosis.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D129061.443447.patch
Type: text/x-patch
Size: 16836 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220709/ae6046c3/attachment-0001.bin>


More information about the cfe-commits mailing list