diff options
author | peter klausler <pklausler@nvidia.com> | 2021-07-23 16:41:04 -0700 |
---|---|---|
committer | peter klausler <pklausler@nvidia.com> | 2021-07-30 15:13:56 -0700 |
commit | 3338ef93b02837edf69abc203e15a42fa55aa1b3 (patch) | |
tree | 0fb8f1461450b302d91246d01b2b30f5247e2dca /flang/lib/FrontendTool | |
parent | 3df649e6191516547c6ddbcf26d507cd9b824519 (diff) | |
download | llvm-3338ef93b02837edf69abc203e15a42fa55aa1b3.zip llvm-3338ef93b02837edf69abc203e15a42fa55aa1b3.tar.gz llvm-3338ef93b02837edf69abc203e15a42fa55aa1b3.tar.bz2 |
[flang] Produce proper "preprocessor output" for -E option
Rename the current -E option to "-E -Xflang -fno-reformat".
Add a new Parsing::EmitPreprocessedSource() routine to convert the
cooked character stream output of the prescanner back to something
more closely resembling output from a traditional preprocessor;
call this new routine when -E appears.
The new -E output is suitable for use as fixed form Fortran source to
compilation by (one hopes) any Fortran compiler. If the original
top-level source file had been free form source, the output will be
suitable for use as free form source as well; otherwise there may be
diagnostics about missing spaces if they were indeed absent in the
original fixed form source.
Unless the -P option appears, #line directives are interspersed
with the output (but be advised, f18 will ignore these if presented
with them in a later compilation).
An effort has been made to preserve original alphabetic character case
and source indentation.
Add -P and -fno-reformat to the new drivers.
Tweak test options to avoid confusion with prior -E output; use
-fno-reformat where needed, but prefer to keep -E, sometimes
in concert with -P, on most, updating expected results accordingly.
Differential Revision: https://reviews.llvm.org/D106727
Diffstat (limited to 'flang/lib/FrontendTool')
-rw-r--r-- | flang/lib/FrontendTool/ExecuteCompilerInvocation.cpp | 18 |
1 files changed, 0 insertions, 18 deletions
diff --git a/flang/lib/FrontendTool/ExecuteCompilerInvocation.cpp b/flang/lib/FrontendTool/ExecuteCompilerInvocation.cpp index 243e251..9c3b13b6 100644 --- a/flang/lib/FrontendTool/ExecuteCompilerInvocation.cpp +++ b/flang/lib/FrontendTool/ExecuteCompilerInvocation.cpp @@ -28,61 +28,43 @@ static std::unique_ptr<FrontendAction> CreateFrontendBaseAction( switch (ak) { case InputOutputTest: return std::make_unique<InputOutputTestAction>(); - break; case PrintPreprocessedInput: return std::make_unique<PrintPreprocessedAction>(); - break; case ParseSyntaxOnly: return std::make_unique<ParseSyntaxOnlyAction>(); case EmitObj: return std::make_unique<EmitObjAction>(); - break; case DebugUnparse: return std::make_unique<DebugUnparseAction>(); - break; case DebugUnparseNoSema: return std::make_unique<DebugUnparseNoSemaAction>(); - break; case DebugUnparseWithSymbols: return std::make_unique<DebugUnparseWithSymbolsAction>(); - break; case DebugDumpSymbols: return std::make_unique<DebugDumpSymbolsAction>(); - break; case DebugDumpParseTree: return std::make_unique<DebugDumpParseTreeAction>(); - break; case DebugDumpParseTreeNoSema: return std::make_unique<DebugDumpParseTreeNoSemaAction>(); - break; case DebugDumpAll: return std::make_unique<DebugDumpAllAction>(); - break; case DebugDumpProvenance: return std::make_unique<DebugDumpProvenanceAction>(); - break; case DebugDumpParsingLog: return std::make_unique<DebugDumpParsingLogAction>(); - break; case DebugMeasureParseTree: return std::make_unique<DebugMeasureParseTreeAction>(); - break; case DebugPreFIRTree: return std::make_unique<DebugPreFIRTreeAction>(); - break; case GetDefinition: return std::make_unique<GetDefinitionAction>(); - break; case GetSymbolsSources: return std::make_unique<GetSymbolsSourcesAction>(); - break; case InitOnly: return std::make_unique<InitOnlyAction>(); - break; default: break; // TODO: - // case RunPreprocessor: // case ParserSyntaxOnly: // case EmitLLVM: // case EmitLLVMOnly: |