[PATCH] D79730: [NFCi] Switch ordering of ParseLangArgs and ParseCodeGenArgs.

Puyan Lotfi via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 11 11:18:05 PDT 2020


plotfi created this revision.
plotfi added reviewers: rjmccall, ab.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

After speaking with @ab and @rjmccall on https://reviews.llvm.org/D72841#2027740 and https://github.com/apple/llvm-project/pull/1202.

it sounds like code-gen option parsing should depend on language-option parsing, not the other way around. Apple Clang llvm-project master does this in the right order but upstream llvm.org does it in the opposite order.

This patch changes the order to the way apple-master does it, which we think is the correct order. At the moment D72841 <https://reviews.llvm.org/D72841> causes some bot failures on apple-master (only on tests added in D72841 <https://reviews.llvm.org/D72841>). I think D72841 <https://reviews.llvm.org/D72841> should be reverted, and then reapplied after _this_  patch is landed.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D79730

Files:
  clang/lib/Frontend/CompilerInvocation.cpp


Index: clang/lib/Frontend/CompilerInvocation.cpp
===================================================================
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -3626,8 +3626,6 @@
   InputKind DashX = ParseFrontendArgs(Res.getFrontendOpts(), Args, Diags,
                                       LangOpts.IsHeaderFile);
   ParseTargetArgs(Res.getTargetOpts(), Args, Diags);
-  Success &= ParseCodeGenArgs(Res.getCodeGenOpts(), Args, DashX, Diags,
-                              Res.getTargetOpts(), Res.getFrontendOpts());
   ParseHeaderSearchArgs(Res.getHeaderSearchOpts(), Args,
                         Res.getFileSystemOpts().WorkingDir);
   llvm::Triple T(Res.getTargetOpts().Triple);
@@ -3665,6 +3663,9 @@
   LangOpts.FunctionAlignment =
       getLastArgIntValue(Args, OPT_function_alignment, 0, Diags);
 
+  Success &= ParseCodeGenArgs(Res.getCodeGenOpts(), Args, DashX, Diags,
+                              Res.getTargetOpts(), Res.getFrontendOpts());
+
   if (LangOpts.CUDA) {
     // During CUDA device-side compilation, the aux triple is the
     // triple used for host compilation.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79730.263215.patch
Type: text/x-patch
Size: 1146 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200511/f0e060dc/attachment-0001.bin>


More information about the cfe-commits mailing list