diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -1091,7 +1091,7 @@ def dynamic : Flag<["-"], "dynamic">, Flags<[NoArgumentUnused]>; def d_Flag : Flag<["-"], "d">, Group; def d_Joined : Joined<["-"], "d">, Group; -def emit_ast : Flag<["-"], "emit-ast">, +def emit_ast : Flag<["-"], "emit-ast">, Flags<[CoreOption]>, HelpText<"Emit Clang AST files for source inputs">; def emit_llvm : Flag<["-"], "emit-llvm">, Flags<[CC1Option, FC1Option, FlangOption]>, Group, HelpText<"Use the LLVM representation for assembler and object files">; diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp --- a/clang/lib/Driver/Driver.cpp +++ b/clang/lib/Driver/Driver.cpp @@ -5625,7 +5625,8 @@ // Determine what the derived output name should be. const char *NamedOutput; - if ((JA.getType() == types::TY_Object || JA.getType() == types::TY_LTO_BC) && + if ((JA.getType() == types::TY_Object || JA.getType() == types::TY_LTO_BC || + JA.getType() == types::TY_AST || JA.getType() == types::TY_Plist) && C.getArgs().hasArg(options::OPT__SLASH_Fo, options::OPT__SLASH_o)) { // The /Fo or /o flag decides the object filename. StringRef Val =