Skip to content

Commit c926bff

Browse files
committed
Revert "[Frontend][PCH]-Add support for ignoring PCH options (-ignore-pch). (#142409)"
This reverts commit 4fb81f1.
1 parent 30cabdd commit c926bff

File tree

8 files changed

+2
-168
lines changed

8 files changed

+2
-168
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,8 +339,6 @@ New Compiler Flags
339339

340340
- New option ``-Wnrvo`` added and disabled by default to warn about missed NRVO opportunities.
341341

342-
- New option ``-ignore-pch`` added to disable precompiled headers. It overrides ``-emit-pch`` and ``-include-pch``. (#GH142409, `PCHDocs <https://clang.llvm.org/docs/UsersManual.html#ignoring-a-pch-file>`_).
343-
344342
Deprecated Compiler Flags
345343
-------------------------
346344

clang/docs/UsersManual.rst

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1458,19 +1458,6 @@ will be processed from the PCH file. Otherwise, Clang will report an error.
14581458
``test.h`` since ``test.h`` was included directly in the source file and not
14591459
specified on the command line using ``-include-pch``.
14601460

1461-
Ignoring a PCH File
1462-
^^^^^^^^^^^^^^^^^^^
1463-
1464-
To ignore PCH options, a `-ignore-pch` option is passed to ``clang``:
1465-
1466-
.. code-block:: console
1467-
1468-
$ clang -x c-header test.h -Xclang -ignore-pch -o test.h.pch
1469-
$ clang -include-pch test.h.pch -Xclang -ignore-pch test.c -o test
1470-
1471-
This option disables precompiled headers, overrides -emit-pch and -include-pch.
1472-
test.h.pch is not generated and not used as a prefix header.
1473-
14741461
Relocatable PCH Files
14751462
^^^^^^^^^^^^^^^^^^^^^
14761463

clang/include/clang/Driver/Options.td

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3348,9 +3348,6 @@ defm pch_codegen: OptInCC1FFlag<"pch-codegen", "Generate ", "Do not generate ",
33483348
"code for uses of this PCH that assumes an explicit object file will be built for the PCH">;
33493349
defm pch_debuginfo: OptInCC1FFlag<"pch-debuginfo", "Generate ", "Do not generate ",
33503350
"debug info for types in an object file built from this PCH and do not generate them elsewhere">;
3351-
def ignore_pch : Flag<["-"], "ignore-pch">, Group<f_Group>,
3352-
Visibility<[ClangOption]>,
3353-
HelpText<"Disable precompiled headers, overrides -emit-pch and -include-pch">;
33543351

33553352
def fimplicit_module_maps : Flag <["-"], "fimplicit-module-maps">, Group<f_Group>,
33563353
Visibility<[ClangOption, CC1Option, CLOption]>,

clang/lib/Driver/Driver.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4331,15 +4331,6 @@ void Driver::handleArguments(Compilation &C, DerivedArgList &Args,
43314331
YcArg = YuArg = nullptr;
43324332
}
43334333

4334-
if (Args.hasArg(options::OPT_include_pch) &&
4335-
(FinalPhase == phases::Preprocess ||
4336-
Args.hasArg(options::OPT_ignore_pch))) {
4337-
// If only preprocessing or -ignore-pch is used, -include-pch is disabled.
4338-
// Since -emit-pch is CC1option, it will not be added to command argments if
4339-
// -ignore-pch is used.
4340-
Args.eraseArg(options::OPT_include_pch);
4341-
}
4342-
43434334
bool LinkOnly = phases::Link == FinalPhase && Inputs.size() > 0;
43444335
for (auto &I : Inputs) {
43454336
types::ID InputType = I.first;

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5184,7 +5184,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
51845184
CmdArgs.push_back("-emit-module-interface");
51855185
else if (JA.getType() == types::TY_HeaderUnit)
51865186
CmdArgs.push_back("-emit-header-unit");
5187-
else if (!Args.hasArg(options::OPT_ignore_pch))
5187+
else
51885188
CmdArgs.push_back("-emit-pch");
51895189
} else if (isa<VerifyPCHJobAction>(JA)) {
51905190
CmdArgs.push_back("-verify-pch");
@@ -5241,8 +5241,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
52415241
} else if (JA.getType() == types::TY_PP_Asm) {
52425242
CmdArgs.push_back("-S");
52435243
} else if (JA.getType() == types::TY_AST) {
5244-
if (!Args.hasArg(options::OPT_ignore_pch))
5245-
CmdArgs.push_back("-emit-pch");
5244+
CmdArgs.push_back("-emit-pch");
52465245
} else if (JA.getType() == types::TY_ModuleFile) {
52475246
CmdArgs.push_back("-module-file-info");
52485247
} else if (JA.getType() == types::TY_RewrittenObjC) {

clang/test/Driver/ignored-pch.cpp

Lines changed: 0 additions & 19 deletions
This file was deleted.

clang/test/PCH/Inputs/ignored-pch.h

Lines changed: 0 additions & 6 deletions
This file was deleted.

clang/test/PCH/ignored-pch.c

Lines changed: 0 additions & 113 deletions
This file was deleted.

0 commit comments

Comments
 (0)