diff options
| author | Chris Lattner <sabre@nondot.org> | 2006-07-29 06:30:25 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2006-07-29 06:30:25 +0000 |
| commit | 457fc15bc5beb48fb3041a7525b6731edf720cc8 (patch) | |
| tree | 878e141457ea9f7f4b03d3f6d3c8a707dfaa6cd1 /clang/Driver/PrintPreprocessedOutput.cpp | |
| parent | 2be41154652c162e5ab5db6ea41a651c4dc3263f (diff) | |
| download | bcm5719-llvm-457fc15bc5beb48fb3041a7525b6731edf720cc8.tar.gz bcm5719-llvm-457fc15bc5beb48fb3041a7525b6731edf720cc8.zip | |
Implement comment saving mode: the -C and -CC options.
llvm-svn: 38783
Diffstat (limited to 'clang/Driver/PrintPreprocessedOutput.cpp')
| -rw-r--r-- | clang/Driver/PrintPreprocessedOutput.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/clang/Driver/PrintPreprocessedOutput.cpp b/clang/Driver/PrintPreprocessedOutput.cpp index dff4411ef2a..e1fb1aa42a7 100644 --- a/clang/Driver/PrintPreprocessedOutput.cpp +++ b/clang/Driver/PrintPreprocessedOutput.cpp @@ -99,6 +99,11 @@ static void OutputString(const char *Ptr, unsigned Size) { static cl::opt<bool> DisableLineMarkers("P", cl::desc("Disable linemarker output in -E mode")); +static cl::opt<bool> +EnableCommentOutput("C", cl::desc("Enable comment output in -E mode")); +static cl::opt<bool> +EnableMacroCommentOutput("CC", cl::desc("Enable comment output in -E mode, " + "even from macro expansions")); static unsigned EModeCurLine; static std::string EModeCurFilename; @@ -357,7 +362,12 @@ static bool AvoidConcat(const LexerToken &PrevTok, const LexerToken &Tok, /// DoPrintPreprocessedInput - This implements -E mode. /// -void clang::DoPrintPreprocessedInput(Preprocessor &PP) { +void clang::DoPrintPreprocessedInput(Preprocessor &PP, LangOptions &Options) { + if (EnableCommentOutput) // -C specified? + Options.KeepComments = 1; + if (EnableMacroCommentOutput) // -CC specified? + Options.KeepComments = Options.KeepMacroComments = 1; + InitOutputBuffer(); LexerToken Tok, PrevTok; |

