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

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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D84188

Files:
  clang/include/clang/Driver/Options.td
  clang/lib/Frontend/CompilerInvocation.cpp


Index: clang/lib/Frontend/CompilerInvocation.cpp
===================================================================
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -1570,10 +1570,6 @@
   return Success;
 }
 
-static void ParseFileSystemArgs(FileSystemOptions &Opts, ArgList &Args) {
-  Opts.WorkingDir = std::string(Args.getLastArgValue(OPT_working_directory));
-}
-
 /// Parse the argument to the -ftest-module-file-extension
 /// command-line argument.
 ///
@@ -3273,7 +3269,6 @@
   Success &= ParseDiagnosticArgs(Res.getDiagnosticOpts(), Args, &Diags,
                                  /*DefaultDiagColor=*/false);
   ParseCommentArgs(LangOpts.CommentOpts, Args);
-  ParseFileSystemArgs(Res.getFileSystemOpts(), Args);
   // FIXME: We shouldn't have to pass the DashX option around here
   InputKind DashX = ParseFrontendArgs(Res.getFrontendOpts(), Args, Diags,
                                       LangOpts.IsHeaderFile);
Index: clang/include/clang/Driver/Options.td
===================================================================
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -342,6 +342,14 @@
 def fparse_all_comments : Flag<["-"], "fparse-all-comments">, 
Group<f_clang_Group>, Flags<[CC1Option]>,
   MarshallingInfoFlag<"LangOpts->CommentOpts.ParseAllComments", "false">;
 
+// Filesystem Options FileSystemOpts
+
+def working_directory : JoinedOrSeparate<["-"], "working-directory">, 
Flags<[CC1Option]>,
+  HelpText<"Resolve file paths relative to the specified directory">,
+  MarshallingInfoString<"FileSystemOpts.WorkingDir">;
+def working_directory_EQ : Joined<["-"], "working-directory=">, 
Flags<[CC1Option]>,
+  Alias<working_directory>;
+
 // Dependency Output Options
 
 def MV : Flag<["-"], "MV">, Group<M_Group>, Flags<[CC1Option]>,
@@ -3516,11 +3524,6 @@
 def : Flag<["-"], "no-integrated-as">, Alias<fno_integrated_as>,
       Flags<[CC1Option, DriverOption]>;
 
-def working_directory : JoinedOrSeparate<["-"], "working-directory">, 
Flags<[CC1Option]>,
-  HelpText<"Resolve file paths relative to the specified directory">;
-def working_directory_EQ : Joined<["-"], "working-directory=">, 
Flags<[CC1Option]>,
-  Alias<working_directory>;
-
 // Double dash options, which are usually an alias for one of the previous
 // options.
 


Index: clang/lib/Frontend/CompilerInvocation.cpp
===================================================================
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -1570,10 +1570,6 @@
   return Success;
 }
 
-static void ParseFileSystemArgs(FileSystemOptions &Opts, ArgList &Args) {
-  Opts.WorkingDir = std::string(Args.getLastArgValue(OPT_working_directory));
-}
-
 /// Parse the argument to the -ftest-module-file-extension
 /// command-line argument.
 ///
@@ -3273,7 +3269,6 @@
   Success &= ParseDiagnosticArgs(Res.getDiagnosticOpts(), Args, &Diags,
                                  /*DefaultDiagColor=*/false);
   ParseCommentArgs(LangOpts.CommentOpts, Args);
-  ParseFileSystemArgs(Res.getFileSystemOpts(), Args);
   // FIXME: We shouldn't have to pass the DashX option around here
   InputKind DashX = ParseFrontendArgs(Res.getFrontendOpts(), Args, Diags,
                                       LangOpts.IsHeaderFile);
Index: clang/include/clang/Driver/Options.td
===================================================================
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -342,6 +342,14 @@
 def fparse_all_comments : Flag<["-"], "fparse-all-comments">, Group<f_clang_Group>, Flags<[CC1Option]>,
   MarshallingInfoFlag<"LangOpts->CommentOpts.ParseAllComments", "false">;
 
+// Filesystem Options FileSystemOpts
+
+def working_directory : JoinedOrSeparate<["-"], "working-directory">, Flags<[CC1Option]>,
+  HelpText<"Resolve file paths relative to the specified directory">,
+  MarshallingInfoString<"FileSystemOpts.WorkingDir">;
+def working_directory_EQ : Joined<["-"], "working-directory=">, Flags<[CC1Option]>,
+  Alias<working_directory>;
+
 // Dependency Output Options
 
 def MV : Flag<["-"], "MV">, Group<M_Group>, Flags<[CC1Option]>,
@@ -3516,11 +3524,6 @@
 def : Flag<["-"], "no-integrated-as">, Alias<fno_integrated_as>,
       Flags<[CC1Option, DriverOption]>;
 
-def working_directory : JoinedOrSeparate<["-"], "working-directory">, Flags<[CC1Option]>,
-  HelpText<"Resolve file paths relative to the specified directory">;
-def working_directory_EQ : Joined<["-"], "working-directory=">, Flags<[CC1Option]>,
-  Alias<working_directory>;
-
 // Double dash options, which are usually an alias for one of the previous
 // options.
 
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to