Index: cfe/trunk/include/clang/Driver/CLCompatOptions.td =================================================================== --- cfe/trunk/include/clang/Driver/CLCompatOptions.td +++ cfe/trunk/include/clang/Driver/CLCompatOptions.td @@ -202,6 +202,7 @@ def _SLASH_Fo : CLCompileJoined<"Fo">, HelpText<"Set output object file, or directory (ends in / or \\)">, MetaVarName<"">; +def _SLASH_GL : CLFlag<"GL">, Alias; def _SLASH_LD : CLFlag<"LD">, HelpText<"Create DLL">; def _SLASH_LDd : CLFlag<"LDd">, HelpText<"Create debug DLL">; def _SLASH_link : CLRemainingArgs<"link">, @@ -286,7 +287,6 @@ def _SLASH_Ge : CLFlag<"Ge">; def _SLASH_Gh : CLFlag<"Gh">; def _SLASH_GH : CLFlag<"GH">; -def _SLASH_GL : CLFlag<"GL">; def _SLASH_GL_ : CLFlag<"GL-">; def _SLASH_Gm : CLFlag<"Gm">; def _SLASH_Gm_ : CLFlag<"Gm-">; Index: cfe/trunk/lib/Driver/Driver.cpp =================================================================== --- cfe/trunk/lib/Driver/Driver.cpp +++ cfe/trunk/lib/Driver/Driver.cpp @@ -1744,7 +1744,7 @@ // Determine what the derived output name should be. const char *NamedOutput; - if (JA.getType() == types::TY_Object && + if ((JA.getType() == types::TY_Object || JA.getType() == types::TY_LTO_BC) && C.getArgs().hasArg(options::OPT__SLASH_Fo, options::OPT__SLASH_o)) { // The /Fo or /o flag decides the object filename. StringRef Val = C.getArgs().getLastArg(options::OPT__SLASH_Fo, Index: cfe/trunk/lib/Driver/Types.cpp =================================================================== --- cfe/trunk/lib/Driver/Types.cpp +++ cfe/trunk/lib/Driver/Types.cpp @@ -45,7 +45,7 @@ } const char *types::getTypeTempSuffix(ID Id, bool CLMode) { - if (Id == TY_Object && CLMode) + if ((Id == TY_Object || Id == TY_LTO_BC) && CLMode) return "obj"; if (Id == TY_Image && CLMode) return "exe"; Index: cfe/trunk/test/Driver/cl-outputs.c =================================================================== --- cfe/trunk/test/Driver/cl-outputs.c +++ cfe/trunk/test/Driver/cl-outputs.c @@ -273,3 +273,9 @@ // RUN: %clang_cl /P /Fifoo.x /obar.x -### -- %s 2>&1 | FileCheck -check-prefix=FioRACE2 %s // FioRACE2: "-E" // FioRACE2: "-o" "bar.x" + +// RUN: %clang_cl /c /GL -### -- %s 2>&1 | FileCheck -check-prefix=LTO-DEFAULT %s +// LTO-DEFAULT: "-emit-llvm-bc"{{.*}}"-o" "cl-outputs.obj" + +// RUN: %clang_cl /c /GL /Fofoo -### -- %s 2>&1 | FileCheck -check-prefix=LTO-FO %s +// LTO-FO: "-emit-llvm-bc"{{.*}}"-o" "foo.obj"