[PATCH] D129061: [Lex] Diagnose macro in command lines
Jack Huang via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Jul 10 10:15:48 PDT 2022
jackhong12 added inline comments.
================
Comment at: clang/include/clang/Driver/Options.td:664
HelpText<"Define <macro> to <value> (or 1 if <value> omitted)">;
+def DriverDefine : JoinedOrSeparate<["-"], "driver-define">, Group<Preprocessor_Group>,
+ Flags<[CC1Option, FlangOption, FC1Option]>, MetaVarName<"<macro>=<value>">,
----------------
MaskRay wrote:
> Make this CC1 only option `NoDriverOption` by moving it somewhere under `let Flags = [CC1Option, NoDriverOption] in {`
>
> Don't add new `Separate` or `JoinedOrSeparate` options. They are legacy.
I tried to add `=` behind `driver-define`. But I got the following error messages when I ran `ninja check-all`.
```
[416/433] cd /home/zhenhong/ssd/zhenhong/llvm-project/clang/bindings/python && /usr/bin/cmake -E env CLANG_LIBRARY_PATH=/home/zhenhong/ssd/zhenhong/llvm-project/release/lib /usr/bin/python3.8 -m unittest discover
FAILED: tools/clang/bindings/python/tests/CMakeFiles/check-clang-python
cd /home/zhenhong/ssd/zhenhong/llvm-project/clang/bindings/python && /usr/bin/cmake -E env CLANG_LIBRARY_PATH=/home/zhenhong/ssd/zhenhong/llvm-project/release/lib /usr/bin/python3.8 -m unittest discover
E..........EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE...EEEEEEEEEE.EEEEE......EEEE..EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
======================================================================
ERROR: test_access_specifiers (tests.cindex.test_access_specifiers.TestAccessSpecifiers)
Ensure that C++ access specifiers are available on cursors
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/zhenhong/ssd/zhenhong/llvm-project/clang/bindings/python/tests/cindex/test_access_specifiers.py", line 20, in test_access_specifiers
tu = get_tu("""
File "/home/zhenhong/ssd/zhenhong/llvm-project/clang/bindings/python/tests/cindex/util.py", line 40, in get_tu
return TranslationUnit.from_source(name, args, unsaved_files=[(name,
File "/home/zhenhong/ssd/zhenhong/llvm-project/clang/bindings/python/clang/cindex.py", line 2837, in from_source
raise TranslationUnitLoadError("Error parsing translation unit.")
clang.cindex.TranslationUnitLoadError: Error parsing translation unit.
...
```
I don't know what triggers the crash.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D129061/new/
https://reviews.llvm.org/D129061
More information about the cfe-commits
mailing list