diff options
author | Peter Klausler <pklausler@nvidia.com> | 2024-09-30 12:38:47 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-30 12:38:47 -0700 |
commit | 4dfed691a9f846b1ff773e28b878404b78559890 (patch) | |
tree | b024b0dec81535ab81aa180815d9edf98f4bf0c4 /flang/lib/Frontend/CompilerInvocation.cpp | |
parent | 9b3818ecae5a5c47eb6a8dd44cf7e1c3666a0f02 (diff) | |
download | llvm-4dfed691a9f846b1ff773e28b878404b78559890.zip llvm-4dfed691a9f846b1ff773e28b878404b78559890.tar.gz llvm-4dfed691a9f846b1ff773e28b878404b78559890.tar.bz2 |
[flang][preprocessor] Don't expand INCLUDE under -E by default (#110333)
Fortran INCLUDE lines have (until now) been treated like #include
directives. This isn't how things work with other Fortran compilers when
running under the -E option for preprocessing only, so stop doing it by
default, and add -fpreprocess-include-lines to turn it back on when
desired.
Diffstat (limited to 'flang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r-- | flang/lib/Frontend/CompilerInvocation.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/flang/lib/Frontend/CompilerInvocation.cpp b/flang/lib/Frontend/CompilerInvocation.cpp index d68534d..2154b9a 100644 --- a/flang/lib/Frontend/CompilerInvocation.cpp +++ b/flang/lib/Frontend/CompilerInvocation.cpp @@ -820,6 +820,8 @@ static void parsePreprocessorArgs(Fortran::frontend::PreprocessorOptions &opts, : PPMacrosFlag::Exclude; opts.noReformat = args.hasArg(clang::driver::options::OPT_fno_reformat); + opts.preprocessIncludeLines = + args.hasArg(clang::driver::options::OPT_fpreprocess_include_lines); opts.noLineDirectives = args.hasArg(clang::driver::options::OPT_P); opts.showMacros = args.hasArg(clang::driver::options::OPT_dM); } @@ -1486,6 +1488,10 @@ void CompilerInvocation::setFortranOpts() { } fortranOptions.fixedFormColumns = frontendOptions.fixedFormColumns; + // -E + fortranOptions.prescanAndReformat = + frontendOptions.programAction == PrintPreprocessedInput; + fortranOptions.features = frontendOptions.features; fortranOptions.encoding = frontendOptions.encoding; |