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

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 16 09:56:29 PDT 2023


aaron.ballman added a comment.

This review went cold for about a year now (sorry for not noticing we hadn't answered your question!), so I'm uncertain if @jackhong12 is still interested in pursuing this. If not, that's totally fine, just let us know so we can remove you as the assignee on the issue (https://github.com/llvm/llvm-project/issues/56159).



================
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>">,
----------------
jackhong12 wrote:
> 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.
I've never seen output like that before -- were you able to resolve this crash? @MaskRay do you have ideas?


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

https://reviews.llvm.org/D129061



More information about the cfe-commits mailing list