r267040 - clang-cl: Don't assert on using /Yc with non-source files, PR27450
Vedant Kumar via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 21 13:58:43 PDT 2016
Hi Nico,
This seems to be causing a test failure on one of our bots:
http://lab.llvm.org:8080/green/job/clang-stage1-configure-RA_check/17279/testReport/junit/Clang/Driver/cl_pch_cpp/
Command Output (stderr):
--
/Users/buildslave/jenkins/sharedspace/phase1 at 2/llvm/tools/clang/test/Driver/cl-pch.cpp:314:20: error: expected string not found in input
// CHECK-NoSource: file.prof:{{.*}}input unused
<stdin>:5:7: note: possible intended match here
clang-3.8: error: argument unused during compilation: '-Werror'
I'm not sure what exactly is causing the problem, but if -Werror is being ignored, the "input unused" warning may be suppressed somehow.
I'd appreciate any help looking into this.
thanks,
vedant
> On Apr 21, 2016, at 12:59 PM, Nico Weber via cfe-commits <cfe-commits at lists.llvm.org> wrote:
>
> Author: nico
> Date: Thu Apr 21 14:59:10 2016
> New Revision: 267040
>
> URL: http://llvm.org/viewvc/llvm-project?rev=267040&view=rev
> Log:
> clang-cl: Don't assert on using /Yc with non-source files, PR27450
>
> Move phase handling after input type validation.
>
> Modified:
> cfe/trunk/lib/Driver/Driver.cpp
> cfe/trunk/test/Driver/cl-pch.cpp
>
> Modified: cfe/trunk/lib/Driver/Driver.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=267040&r1=267039&r2=267040&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Driver/Driver.cpp (original)
> +++ cfe/trunk/lib/Driver/Driver.cpp Thu Apr 21 14:59:10 2016
> @@ -1563,25 +1563,6 @@ void Driver::BuildActions(Compilation &C
> PL.clear();
> types::getCompilationPhases(InputType, PL);
>
> - if (YcArg) {
> - // Add a separate precompile phase for the compile phase.
> - if (FinalPhase >= phases::Compile) {
> - llvm::SmallVector<phases::ID, phases::MaxNumberOfPhases> PCHPL;
> - types::getCompilationPhases(types::TY_CXXHeader, PCHPL);
> - Arg *PchInputArg = MakeInputArg(Args, Opts, YcArg->getValue());
> -
> - // Build the pipeline for the pch file.
> - Action *ClangClPch = C.MakeAction<InputAction>(*PchInputArg, InputType);
> - for (phases::ID Phase : PCHPL)
> - ClangClPch = ConstructPhaseAction(C, Args, Phase, ClangClPch);
> - assert(ClangClPch);
> - Actions.push_back(ClangClPch);
> - // The driver currently exits after the first failed command. This
> - // relies on that behavior, to make sure if the pch generation fails,
> - // the main compilation won't run.
> - }
> - }
> -
> // If the first step comes after the final phase we are doing as part of
> // this compilation, warn the user about it.
> phases::ID InitialPhase = PL[0];
> @@ -1614,6 +1595,25 @@ void Driver::BuildActions(Compilation &C
> continue;
> }
>
> + if (YcArg) {
> + // Add a separate precompile phase for the compile phase.
> + if (FinalPhase >= phases::Compile) {
> + llvm::SmallVector<phases::ID, phases::MaxNumberOfPhases> PCHPL;
> + types::getCompilationPhases(types::TY_CXXHeader, PCHPL);
> + Arg *PchInputArg = MakeInputArg(Args, Opts, YcArg->getValue());
> +
> + // Build the pipeline for the pch file.
> + Action *ClangClPch = C.MakeAction<InputAction>(*PchInputArg, InputType);
> + for (phases::ID Phase : PCHPL)
> + ClangClPch = ConstructPhaseAction(C, Args, Phase, ClangClPch);
> + assert(ClangClPch);
> + Actions.push_back(ClangClPch);
> + // The driver currently exits after the first failed command. This
> + // relies on that behavior, to make sure if the pch generation fails,
> + // the main compilation won't run.
> + }
> + }
> +
> phases::ID CudaInjectionPhase =
> (phases::Compile < FinalPhase &&
> llvm::find(PL, phases::Compile) != PL.end())
>
> Modified: cfe/trunk/test/Driver/cl-pch.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/cl-pch.cpp?rev=267040&r1=267039&r2=267040&view=diff
> ==============================================================================
> --- cfe/trunk/test/Driver/cl-pch.cpp (original)
> +++ cfe/trunk/test/Driver/cl-pch.cpp Thu Apr 21 14:59:10 2016
> @@ -296,7 +296,7 @@
> // CHECK-YCTC: -o
> // CHECK-YCTC: pchfile.pch
> // CHECK-YCTC: -x
> -// CHECK-YCTP: "c"
> +// CHECK-YCTC: "c"
>
> // Also check lower-case /Tc variant.
> // RUN: %clang_cl -Werror /Ycpchfile.h /FIpchfile.h /c -### /Tc%s 2>&1 \
> @@ -307,3 +307,18 @@
> // CHECK-YCTc: pchfile.pch
> // CHECK-YCTc: -x
> // CHECK-YCTc: "c"
> +
> +// Don't crash when a non-source file is passed.
> +// RUN: %clang_cl -Werror /Ycpchfile.h /FIpchfile.h /c -### %S/Inputs/file.prof 2>&1 \
> +// RUN: | FileCheck -check-prefix=CHECK-NoSource %s
> +// CHECK-NoSource: file.prof:{{.*}}input unused
> +
> +// ...but if an explicit file turns the file into a source file, handle it:
> +// RUN: %clang_cl /TP -Werror /Ycpchfile.h /FIpchfile.h /c -### %S/Inputs/file.prof 2>&1 \
> +// RUN: | FileCheck -check-prefix=CHECK-NoSourceTP %s
> +// CHECK-NoSourceTP: cc1
> +// CHECK-NoSourceTP: -emit-pch
> +// CHECK-NoSourceTP: -o
> +// CHECK-NoSourceTP: pchfile.pch
> +// CHECK-NoSourceTP: -x
> +// CHECK-NoSourceTP: "c++"
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
More information about the cfe-commits
mailing list