jansvoboda11 added inline comments.

================
Comment at: clang/lib/Frontend/CompilerInvocation.cpp:3040
 
-#define OPTION_WITH_MARSHALLING(                                               
\
-    PREFIX_TYPE, NAME, ID, KIND, GROUP, ALIAS, ALIASARGS, FLAGS, PARAM,        
\
-    HELPTEXT, METAVAR, VALUES, SPELLING, ALWAYS_EMIT, KEYPATH, DEFAULT_VALUE,  
\
-    IMPLIED_CHECK, IMPLIED_VALUE, NORMALIZER, DENORMALIZER, MERGER, EXTRACTOR, 
\
-    TABLE_INDEX)                                                               
\
-  if ((FLAGS)&options::CC1Option) {                                            
\
-    this->KEYPATH = MERGER(this->KEYPATH, DEFAULT_VALUE);                      
\
-    if (IMPLIED_CHECK)                                                         
\
-      this->KEYPATH = MERGER(this->KEYPATH, IMPLIED_VALUE);                    
\
-    if (auto MaybeValue =                                                      
\
-            NORMALIZER(OPT_##ID, TABLE_INDEX, Args, Diags, Success))           
\
-      this->KEYPATH = MERGER(                                                  
\
-          this->KEYPATH, static_cast<decltype(this->KEYPATH)>(*MaybeValue));   
\
-  }
-
+#define OPTION_WITH_MARSHALLING PARSE_OPTION_WITH_MARSHALLING
 #include "clang/Driver/Options.inc"
----------------
dexonsmith wrote:
> One concern I have with this change is that the macro is using local variable 
> names; it really would be better to have the macro content local to the 
> function(s) where the variables are defined.
> 
> Can you give more context about why this has to be called from another place? 
> Maybe there's another way to solve the problem.
I've provided more context here: D93701.

We can solve the problem with implicit use of local variables inside the macro 
by promoting them to macro parameters.
This will make the forwarding call from `OPTION_WITH_MARSHALLING` to 
`PARSE_OPTION_WITH_MARSHALLING` longer, as it will need to spell out all 
parameters, but it would solve your concern I think.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93702

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to