Skip to content

Commit

Permalink
Revert "[Preprocessor] Implement -fminimize-whitespace."
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
vmaksimo committed Jul 29, 2021
1 parent fbdceb1 commit 9399945
Show file tree
Hide file tree
Showing 19 changed files with 144 additions and 395 deletions.
10 changes: 0 additions & 10 deletions clang/docs/ClangCommandLineReference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2475,16 +2475,6 @@ Turn on loop unroller

Use #line in preprocessed output

.. option:: -fminimize-whitespace, -fno-minimize-whitespace

Ignore the whitespace from the input file when emitting preprocessor
output. It will only contain whitespace when necessary, e.g. to keep two
minus signs from merging into to an increment operator. Useful with the
-P option to normalize whitespace such that two files with only formatting
changes are equal.

Only valid with -E on C-like inputs and incompatible with -traditional-cpp.

.. option:: -fvalidate-ast-input-files-content

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
Expand Down
2 changes: 0 additions & 2 deletions clang/include/clang/Basic/DiagnosticDriverKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,6 @@ def warn_drv_mismatch_fpga_archive : Warning<
def err_drv_unsupported_opt_dpcpp : Error<"option '%0' unsupported with DPC++">;
def err_drv_argument_only_allowed_with : Error<
"invalid argument '%0' only allowed with '%1'">;
def err_drv_minws_unsupported_input_type : Error<
"'-fminimize-whitespace' invalid for input of type %0">;
def err_drv_amdgpu_ieee_without_no_honor_nans : Error<
"invalid argument '-mno-amdgpu-ieee' only allowed with relaxed NaN handling">;
def err_drv_argument_not_allowed_with : Error<
Expand Down
3 changes: 0 additions & 3 deletions clang/include/clang/Driver/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -1820,9 +1820,6 @@ def frewrite_map_file_EQ : Joined<["-"], "frewrite-map-file=">,
defm use_line_directives : BoolFOption<"use-line-directives",
PreprocessorOutputOpts<"UseLineDirectives">, DefaultFalse,
PosFlag<SetTrue, [CC1Option], "Use #line in preprocessed output">, NegFlag<SetFalse>>;
defm minimize_whitespace : BoolFOption<"minimize-whitespace",
PreprocessorOutputOpts<"MinimizeWhitespace">, DefaultFalse,
PosFlag<SetTrue, [CC1Option], "Minimize whitespace when emitting preprocessor output">, NegFlag<SetFalse>>;

def ffreestanding : Flag<["-"], "ffreestanding">, Group<f_Group>, Flags<[CC1Option]>,
HelpText<"Assert that the compilation takes place in a freestanding environment">,
Expand Down
8 changes: 0 additions & 8 deletions clang/include/clang/Driver/Types.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,6 @@ namespace types {
/// isAcceptedByClang - Can clang handle this input type.
bool isAcceptedByClang(ID Id);

/// isDerivedFromC - Is the input derived from C.
///
/// That is, does the lexer follow the rules of
/// TokenConcatenation::AvoidConcat. If this is the case, the preprocessor may
/// add and remove whitespace between tokens. Used to determine whether the
/// input can be processed by -fminimize-whitespace.
bool isDerivedFromC(ID Id);

/// isCXX - Is this a "C++" input (C++ and Obj-C++ sources and headers).
bool isCXX(ID Id);

Expand Down
2 changes: 0 additions & 2 deletions clang/include/clang/Frontend/PreprocessorOutputOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ class PreprocessorOutputOptions {
unsigned ShowIncludeDirectives : 1; ///< Print includes, imports etc. within preprocessed output.
unsigned RewriteIncludes : 1; ///< Preprocess include directives only.
unsigned RewriteImports : 1; ///< Include contents of transitively-imported modules.
unsigned MinimizeWhitespace : 1; ///< Ignore whitespace from input.

public:
PreprocessorOutputOptions() {
Expand All @@ -37,7 +36,6 @@ class PreprocessorOutputOptions {
ShowIncludeDirectives = 0;
RewriteIncludes = 0;
RewriteImports = 0;
MinimizeWhitespace = 0;
}
};

Expand Down
15 changes: 2 additions & 13 deletions clang/lib/Driver/ToolChains/Clang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,8 @@ using namespace clang;
using namespace llvm::opt;

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

// -fno-minimize-whitespace is default.
if (Args.hasFlag(options::OPT_fminimize_whitespace,
options::OPT_fno_minimize_whitespace, false)) {
types::ID InputType = Inputs[0].getType();
if (!isDerivedFromC(InputType))
D.Diag(diag::err_drv_minws_unsupported_input_type)
<< types::getTypeName(InputType);
CmdArgs.push_back("-fminimize-whitespace");
}

// -fms-extensions=0 is default.
if (Args.hasFlag(options::OPT_fms_extensions, options::OPT_fno_ms_extensions,
IsWindowsMSVC))
Expand Down
39 changes: 0 additions & 39 deletions clang/lib/Driver/Types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,45 +148,6 @@ bool types::isAcceptedByClang(ID Id) {
}
}

bool types::isDerivedFromC(ID Id) {
switch (Id) {
default:
return false;

case TY_PP_C:
case TY_C:
case TY_CL:
case TY_CLCXX:
case TY_PP_CUDA:
case TY_CUDA:
case TY_CUDA_DEVICE:
case TY_PP_HIP:
case TY_HIP:
case TY_HIP_DEVICE:
case TY_PP_ObjC:
case TY_PP_ObjC_Alias:
case TY_ObjC:
case TY_PP_CXX:
case TY_CXX:
case TY_PP_ObjCXX:
case TY_PP_ObjCXX_Alias:
case TY_ObjCXX:
case TY_RenderScript:
case TY_PP_CHeader:
case TY_CHeader:
case TY_CLHeader:
case TY_PP_ObjCHeader:
case TY_ObjCHeader:
case TY_PP_CXXHeader:
case TY_CXXHeader:
case TY_PP_ObjCXXHeader:
case TY_ObjCXXHeader:
case TY_CXXModule:
case TY_PP_CXXModule:
return true;
}
}

bool types::isObjC(ID Id) {
switch (Id) {
default:
Expand Down
Loading

0 comments on commit 9399945

Please sign in to comment.