Skip to content

Commit 9399945

Browse files
committed
Revert "[Preprocessor] Implement -fminimize-whitespace."
This reverts commit ae6b400 to unblock the llorg->sycl pulldown. This fixes SYCL::fsycl-save-temps and SYCL::warnings failures which are soon expected to be addressed in community.
1 parent fbdceb1 commit 9399945

19 files changed

+144
-395
lines changed

clang/docs/ClangCommandLineReference.rst

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2475,16 +2475,6 @@ Turn on loop unroller
24752475

24762476
Use #line in preprocessed output
24772477

2478-
.. option:: -fminimize-whitespace, -fno-minimize-whitespace
2479-
2480-
Ignore the whitespace from the input file when emitting preprocessor
2481-
output. It will only contain whitespace when necessary, e.g. to keep two
2482-
minus signs from merging into to an increment operator. Useful with the
2483-
-P option to normalize whitespace such that two files with only formatting
2484-
changes are equal.
2485-
2486-
Only valid with -E on C-like inputs and incompatible with -traditional-cpp.
2487-
24882478
.. option:: -fvalidate-ast-input-files-content
24892479

24902480
Compute and store the hash of input files used to build an AST. Files with mismatching mtime's are considered valid if both contents is identical

clang/include/clang/Basic/DiagnosticDriverKinds.td

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,6 @@ def warn_drv_mismatch_fpga_archive : Warning<
144144
def err_drv_unsupported_opt_dpcpp : Error<"option '%0' unsupported with DPC++">;
145145
def err_drv_argument_only_allowed_with : Error<
146146
"invalid argument '%0' only allowed with '%1'">;
147-
def err_drv_minws_unsupported_input_type : Error<
148-
"'-fminimize-whitespace' invalid for input of type %0">;
149147
def err_drv_amdgpu_ieee_without_no_honor_nans : Error<
150148
"invalid argument '-mno-amdgpu-ieee' only allowed with relaxed NaN handling">;
151149
def err_drv_argument_not_allowed_with : Error<

clang/include/clang/Driver/Options.td

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1820,9 +1820,6 @@ def frewrite_map_file_EQ : Joined<["-"], "frewrite-map-file=">,
18201820
defm use_line_directives : BoolFOption<"use-line-directives",
18211821
PreprocessorOutputOpts<"UseLineDirectives">, DefaultFalse,
18221822
PosFlag<SetTrue, [CC1Option], "Use #line in preprocessed output">, NegFlag<SetFalse>>;
1823-
defm minimize_whitespace : BoolFOption<"minimize-whitespace",
1824-
PreprocessorOutputOpts<"MinimizeWhitespace">, DefaultFalse,
1825-
PosFlag<SetTrue, [CC1Option], "Minimize whitespace when emitting preprocessor output">, NegFlag<SetFalse>>;
18261823

18271824
def ffreestanding : Flag<["-"], "ffreestanding">, Group<f_Group>, Flags<[CC1Option]>,
18281825
HelpText<"Assert that the compilation takes place in a freestanding environment">,

clang/include/clang/Driver/Types.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,6 @@ namespace types {
6666
/// isAcceptedByClang - Can clang handle this input type.
6767
bool isAcceptedByClang(ID Id);
6868

69-
/// isDerivedFromC - Is the input derived from C.
70-
///
71-
/// That is, does the lexer follow the rules of
72-
/// TokenConcatenation::AvoidConcat. If this is the case, the preprocessor may
73-
/// add and remove whitespace between tokens. Used to determine whether the
74-
/// input can be processed by -fminimize-whitespace.
75-
bool isDerivedFromC(ID Id);
76-
7769
/// isCXX - Is this a "C++" input (C++ and Obj-C++ sources and headers).
7870
bool isCXX(ID Id);
7971

clang/include/clang/Frontend/PreprocessorOutputOptions.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ class PreprocessorOutputOptions {
2424
unsigned ShowIncludeDirectives : 1; ///< Print includes, imports etc. within preprocessed output.
2525
unsigned RewriteIncludes : 1; ///< Preprocess include directives only.
2626
unsigned RewriteImports : 1; ///< Include contents of transitively-imported modules.
27-
unsigned MinimizeWhitespace : 1; ///< Ignore whitespace from input.
2827

2928
public:
3029
PreprocessorOutputOptions() {
@@ -37,7 +36,6 @@ class PreprocessorOutputOptions {
3736
ShowIncludeDirectives = 0;
3837
RewriteIncludes = 0;
3938
RewriteImports = 0;
40-
MinimizeWhitespace = 0;
4139
}
4240
};
4341

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,8 @@ using namespace clang;
5656
using namespace llvm::opt;
5757

5858
static void CheckPreprocessingOptions(const Driver &D, const ArgList &Args) {
59-
if (Arg *A = Args.getLastArg(clang::driver::options::OPT_C, options::OPT_CC,
60-
options::OPT_fminimize_whitespace,
61-
options::OPT_fno_minimize_whitespace)) {
59+
if (Arg *A =
60+
Args.getLastArg(clang::driver::options::OPT_C, options::OPT_CC)) {
6261
if (!Args.hasArg(options::OPT_E) && !Args.hasArg(options::OPT__SLASH_P) &&
6362
!Args.hasArg(options::OPT__SLASH_EP) && !D.CCCIsCPP()) {
6463
D.Diag(clang::diag::err_drv_argument_only_allowed_with)
@@ -6516,16 +6515,6 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
65166515
options::OPT_fno_use_line_directives, false))
65176516
CmdArgs.push_back("-fuse-line-directives");
65186517

6519-
// -fno-minimize-whitespace is default.
6520-
if (Args.hasFlag(options::OPT_fminimize_whitespace,
6521-
options::OPT_fno_minimize_whitespace, false)) {
6522-
types::ID InputType = Inputs[0].getType();
6523-
if (!isDerivedFromC(InputType))
6524-
D.Diag(diag::err_drv_minws_unsupported_input_type)
6525-
<< types::getTypeName(InputType);
6526-
CmdArgs.push_back("-fminimize-whitespace");
6527-
}
6528-
65296518
// -fms-extensions=0 is default.
65306519
if (Args.hasFlag(options::OPT_fms_extensions, options::OPT_fno_ms_extensions,
65316520
IsWindowsMSVC))

clang/lib/Driver/Types.cpp

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -148,45 +148,6 @@ bool types::isAcceptedByClang(ID Id) {
148148
}
149149
}
150150

151-
bool types::isDerivedFromC(ID Id) {
152-
switch (Id) {
153-
default:
154-
return false;
155-
156-
case TY_PP_C:
157-
case TY_C:
158-
case TY_CL:
159-
case TY_CLCXX:
160-
case TY_PP_CUDA:
161-
case TY_CUDA:
162-
case TY_CUDA_DEVICE:
163-
case TY_PP_HIP:
164-
case TY_HIP:
165-
case TY_HIP_DEVICE:
166-
case TY_PP_ObjC:
167-
case TY_PP_ObjC_Alias:
168-
case TY_ObjC:
169-
case TY_PP_CXX:
170-
case TY_CXX:
171-
case TY_PP_ObjCXX:
172-
case TY_PP_ObjCXX_Alias:
173-
case TY_ObjCXX:
174-
case TY_RenderScript:
175-
case TY_PP_CHeader:
176-
case TY_CHeader:
177-
case TY_CLHeader:
178-
case TY_PP_ObjCHeader:
179-
case TY_ObjCHeader:
180-
case TY_PP_CXXHeader:
181-
case TY_CXXHeader:
182-
case TY_PP_ObjCXXHeader:
183-
case TY_ObjCXXHeader:
184-
case TY_CXXModule:
185-
case TY_PP_CXXModule:
186-
return true;
187-
}
188-
}
189-
190151
bool types::isObjC(ID Id) {
191152
switch (Id) {
192153
default:

0 commit comments

Comments
 (0)