r285416 - Revert "[Preprocessor] Support for '-dI' flag"
Bruno Cardoso Lopes via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 28 10:02:10 PDT 2016
Author: bruno
Date: Fri Oct 28 12:02:10 2016
New Revision: 285416
URL: http://llvm.org/viewvc/llvm-project?rev=285416&view=rev
Log:
Revert "[Preprocessor] Support for '-dI' flag"
This reverts r285411. Tests failing on
http://lab.llvm.org:8011/builders/clang-x86-windows-msvc2015/builds/141
Removed:
cfe/trunk/test/Preprocessor/dump_import.h
cfe/trunk/test/Preprocessor/dump_import.m
cfe/trunk/test/Preprocessor/dump_include.c
cfe/trunk/test/Preprocessor/dump_include.h
Modified:
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/include/clang/Frontend/PreprocessorOutputOptions.h
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp
Modified: cfe/trunk/include/clang/Driver/Options.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=285416&r1=285415&r2=285416&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Fri Oct 28 12:02:10 2016
@@ -429,8 +429,6 @@ def fno_cuda_approx_transcendentals : Fl
def dA : Flag<["-"], "dA">, Group<d_Group>;
def dD : Flag<["-"], "dD">, Group<d_Group>, Flags<[CC1Option]>,
HelpText<"Print macro definitions in -E mode in addition to normal output">;
-def dI : Flag<["-"], "dI">, Group<d_Group>, Flags<[CC1Option]>,
- HelpText<"Print include directives in -E mode in addition to normal output">;
def dM : Flag<["-"], "dM">, Group<d_Group>, Flags<[CC1Option]>,
HelpText<"Print macro definitions in -E mode instead of normal output">;
def dead__strip : Flag<["-"], "dead_strip">;
Modified: cfe/trunk/include/clang/Frontend/PreprocessorOutputOptions.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/PreprocessorOutputOptions.h?rev=285416&r1=285415&r2=285416&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/PreprocessorOutputOptions.h (original)
+++ cfe/trunk/include/clang/Frontend/PreprocessorOutputOptions.h Fri Oct 28 12:02:10 2016
@@ -22,7 +22,6 @@ public:
unsigned UseLineDirectives : 1; ///< Use \#line instead of GCC-style \# N.
unsigned ShowMacroComments : 1; ///< Show comments, even in macros.
unsigned ShowMacros : 1; ///< Print macro definitions.
- unsigned ShowIncludeDirectives : 1; ///< Print includes, imports etc. within preprocessed output.
unsigned RewriteIncludes : 1; ///< Preprocess include directives only.
public:
@@ -33,7 +32,6 @@ public:
UseLineDirectives = 0;
ShowMacroComments = 0;
ShowMacros = 0;
- ShowIncludeDirectives = 0;
RewriteIncludes = 0;
}
};
Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=285416&r1=285415&r2=285416&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Fri Oct 28 12:02:10 2016
@@ -2353,7 +2353,6 @@ static void ParsePreprocessorOutputArgs(
Opts.ShowLineMarkers = !Args.hasArg(OPT_P);
Opts.ShowMacroComments = Args.hasArg(OPT_CC);
Opts.ShowMacros = Args.hasArg(OPT_dM) || Args.hasArg(OPT_dD);
- Opts.ShowIncludeDirectives = Args.hasArg(OPT_dI);
Opts.RewriteIncludes = Args.hasArg(OPT_frewrite_includes);
Opts.UseLineDirectives = Args.hasArg(OPT_fuse_line_directives);
}
Modified: cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp?rev=285416&r1=285415&r2=285416&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp (original)
+++ cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp Fri Oct 28 12:02:10 2016
@@ -93,16 +93,13 @@ private:
bool Initialized;
bool DisableLineMarkers;
bool DumpDefines;
- bool DumpIncludeDirectives;
bool UseLineDirectives;
bool IsFirstFileEntered;
public:
PrintPPOutputPPCallbacks(Preprocessor &pp, raw_ostream &os, bool lineMarkers,
- bool defines, bool DumpIncludeDirectives,
- bool UseLineDirectives)
+ bool defines, bool UseLineDirectives)
: PP(pp), SM(PP.getSourceManager()), ConcatInfo(PP), OS(os),
DisableLineMarkers(lineMarkers), DumpDefines(defines),
- DumpIncludeDirectives(DumpIncludeDirectives),
UseLineDirectives(UseLineDirectives) {
CurLine = 0;
CurFilename += "<uninit>";
@@ -323,10 +320,10 @@ void PrintPPOutputPPCallbacks::Inclusion
StringRef SearchPath,
StringRef RelativePath,
const Module *Imported) {
+ // When preprocessing, turn implicit imports into @imports.
+ // FIXME: This is a stop-gap until a more comprehensive "preprocessing with
+ // modules" solution is introduced.
if (Imported) {
- // When preprocessing, turn implicit imports into @imports.
- // FIXME: This is a stop-gap until a more comprehensive "preprocessing with
- // modules" solution is introduced.
startNewLineIfNeeded();
MoveToLine(HashLoc);
if (PP.getLangOpts().ObjC2) {
@@ -334,9 +331,9 @@ void PrintPPOutputPPCallbacks::Inclusion
<< " /* clang -E: implicit import for \"" << File->getName()
<< "\" */";
} else {
- const std::string TokenText = PP.getSpelling(IncludeTok);
- assert(!TokenText.empty());
- OS << "#" << TokenText << " "
+ // FIXME: Preseve whether this was a
+ // #include/#include_next/#include_macros/#import.
+ OS << "#include "
<< (IsAngled ? '<' : '"')
<< FileName
<< (IsAngled ? '>' : '"')
@@ -347,20 +344,6 @@ void PrintPPOutputPPCallbacks::Inclusion
// line immediately.
EmittedTokensOnThisLine = true;
startNewLineIfNeeded();
- } else {
- // Not a module import; it's a more vanilla inclusion of some file using one
- // of: #include, #import, #include_next, #include_macros.
- if (DumpIncludeDirectives) {
- startNewLineIfNeeded();
- MoveToLine(HashLoc);
- const std::string TokenText = PP.getSpelling(IncludeTok);
- assert(!TokenText.empty());
- OS << "#" << TokenText << " "
- << (IsAngled ? '<' : '"') << FileName << (IsAngled ? '>' : '"')
- << " /* clang -E -dI */";
- setEmittedDirectiveOnThisLine();
- startNewLineIfNeeded();
- }
}
}
@@ -768,8 +751,7 @@ void clang::DoPrintPreprocessedInput(Pre
PP.SetCommentRetentionState(Opts.ShowComments, Opts.ShowMacroComments);
PrintPPOutputPPCallbacks *Callbacks = new PrintPPOutputPPCallbacks(
- PP, *OS, !Opts.ShowLineMarkers, Opts.ShowMacros,
- Opts.ShowIncludeDirectives, Opts.UseLineDirectives);
+ PP, *OS, !Opts.ShowLineMarkers, Opts.ShowMacros, Opts.UseLineDirectives);
// Expand macros in pragmas with -fms-extensions. The assumption is that
// the majority of pragmas in such a file will be Microsoft pragmas.
Removed: cfe/trunk/test/Preprocessor/dump_import.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/dump_import.h?rev=285415&view=auto
==============================================================================
--- cfe/trunk/test/Preprocessor/dump_import.h (original)
+++ cfe/trunk/test/Preprocessor/dump_import.h (removed)
@@ -1 +0,0 @@
-#define DUMP_IMPORT_TESTVAL 1
Removed: cfe/trunk/test/Preprocessor/dump_import.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/dump_import.m?rev=285415&view=auto
==============================================================================
--- cfe/trunk/test/Preprocessor/dump_import.m (original)
+++ cfe/trunk/test/Preprocessor/dump_import.m (removed)
@@ -1,6 +0,0 @@
-// RUN: %clang_cc1 -E -dI %s -o - | FileCheck %s
-// CHECK: {{^}}#import "dump_
-
-// See also `dump_include.c` which tests other inclusion cases with `-dI`.
-
-#import "dump_import.h"
Removed: cfe/trunk/test/Preprocessor/dump_include.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/dump_include.c?rev=285415&view=auto
==============================================================================
--- cfe/trunk/test/Preprocessor/dump_include.c (original)
+++ cfe/trunk/test/Preprocessor/dump_include.c (removed)
@@ -1,11 +0,0 @@
-// RUN: %clang_cc1 -w -E -dI -isystem %S -imacros %S/dump_include.h %s -o - | FileCheck %s
-// CHECK: {{^}}#__include_macros "/{{([^/]+/)+}}dump_
-// CHECK: {{^}}#include <dump_
-// CHECK: {{^}}#include "dump_
-// CHECK: {{^}}#include_next "dump_
-
-// See also `dump_import.m` which tests the `#import` directive with `-dI`.
-
-#include <dump_include.h>
-#include "dump_include.h"
-#include_next "dump_include.h"
Removed: cfe/trunk/test/Preprocessor/dump_include.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/dump_include.h?rev=285415&view=auto
==============================================================================
--- cfe/trunk/test/Preprocessor/dump_include.h (original)
+++ cfe/trunk/test/Preprocessor/dump_include.h (removed)
@@ -1,2 +0,0 @@
-#pragma once
-#define DUMP_INCLUDE_TESTVAL 1
More information about the cfe-commits
mailing list