[PATCH] D83405: Factor out EXTRACTOR call

Daniel Grumberg via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 8 09:35:54 PDT 2020


dang created this revision.
Herald added subscribers: cfe-commits, dexonsmith.
Herald added a project: clang.

Depends on D83071 <https://reviews.llvm.org/D83071>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D83405

Files:
  clang/lib/Frontend/CompilerInvocation.cpp


Index: clang/lib/Frontend/CompilerInvocation.cpp
===================================================================
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -3934,9 +3934,10 @@
     PREFIX_TYPE, NAME, ID, KIND, GROUP, ALIAS, ALIASARGS, FLAGS, PARAM,        \
     HELPTEXT, METAVAR, VALUES, SPELLING, ALWAYS_EMIT, KEYPATH, DEFAULT_VALUE,  \
     TYPE, NORMALIZER, DENORMALIZER, MERGER, EXTRACTOR, TABLE_INDEX)            \
-  if (((FLAGS)&options::CC1Option) &&                                          \
-      (ALWAYS_EMIT || EXTRACTOR(this->KEYPATH) != DEFAULT_VALUE)) {            \
-    DENORMALIZER(Args, SPELLING, SA, TABLE_INDEX, EXTRACTOR(this->KEYPATH));   \
+  if ((FLAGS)&options::CC1Option) {                                            \
+    const auto &Extracted = EXTRACTOR(this->KEYPATH);                          \
+    if (ALWAYS_EMIT || Extracted != DEFAULT_VALUE)                             \
+      DENORMALIZER(Args, SPELLING, SA, TABLE_INDEX, Extracted);                \
   }
 
 #define OPTION_WITH_MARSHALLING_BOOLEAN(                                       \
@@ -3944,10 +3945,10 @@
     HELPTEXT, METAVAR, VALUES, SPELLING, ALWAYS_EMIT, KEYPATH, DEFAULT_VALUE,  \
     TYPE, NORMALIZER, DENORMALIZER, MERGER, EXTRACTOR, TABLE_INDEX, NEG_ID,    \
     NEG_SPELLING)                                                              \
-  if (((FLAGS)&options::CC1Option) &&                                          \
-      (ALWAYS_EMIT || EXTRACTOR(this->KEYPATH) != DEFAULT_VALUE)) {            \
-    DENORMALIZER(Args, SPELLING, NEG_SPELLING, SA, TABLE_INDEX,                \
-                 EXTRACTOR(this->KEYPATH));                                    \
+  if ((FLAGS)&options::CC1Option) {                                            \
+    const auto &Extracted = EXTRACTOR(this->KEYPATH);                          \
+    if (ALWAYS_EMIT || Extracted != DEFAULT_VALUE)                             \
+      DENORMALIZER(Args, SPELLING, NEG_SPELLING, SA, TABLE_INDEX, Extracted);  \
   }
 
 #include "clang/Driver/Options.inc"


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83405.276465.patch
Type: text/x-patch
Size: 2111 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200708/1abf629c/attachment-0001.bin>


More information about the cfe-commits mailing list