aboutsummaryrefslogtreecommitdiff
path: root/flang/lib/Parser/preprocessor.cpp
diff options
context:
space:
mode:
authorPeter Klausler <pklausler@nvidia.com>2024-09-12 09:08:00 -0700
committerGitHub <noreply@github.com>2024-09-12 09:08:00 -0700
commitfc1c481cf45b41137a08a753c543d8a69d393671 (patch)
tree3efd91e0c5a99865555de9d88d38aa6ef4f0796a /flang/lib/Parser/preprocessor.cpp
parent1ad84d7961ec3ddab9233370066110ecaa5eb329 (diff)
downloadllvm-fc1c481cf45b41137a08a753c543d8a69d393671.zip
llvm-fc1c481cf45b41137a08a753c543d8a69d393671.tar.gz
llvm-fc1c481cf45b41137a08a753c543d8a69d393671.tar.bz2
[flang][preprocessor] Change handling of macros in text from Fortran … (#108113)
…INCLUDE lines The compiler current treats an INCLUDE line as essentially a synonym for a preprocessing #include directive. The causes macros that have been defined at the point where the INCLUDE line is processed to be replaced within the text of the included file. This behavior is surprising to users who expect an INCLUDE line to be expanded into its contents *after* preprocessing has been applied to the original source file, with no further macro expansion. Change INCLUDE line processing to use a fresh instance of Preprocessor containing no macro definitions except _CUDA in CUDA Fortran compilations and, if the original file was being preprocessed, the standard definitions of __FILE__, __LINE__, and so forth.
Diffstat (limited to 'flang/lib/Parser/preprocessor.cpp')
-rw-r--r--flang/lib/Parser/preprocessor.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/flang/lib/Parser/preprocessor.cpp b/flang/lib/Parser/preprocessor.cpp
index 7d3130c..cb3725b 100644
--- a/flang/lib/Parser/preprocessor.cpp
+++ b/flang/lib/Parser/preprocessor.cpp
@@ -769,7 +769,7 @@ void Preprocessor::Directive(const TokenSequence &dir, Prescanner &prescanner) {
if (included->bytes() > 0) {
ProvenanceRange fileRange{
allSources_.AddIncludedFile(*included, dir.GetProvenanceRange())};
- Prescanner{prescanner, /*isNestedInIncludeDirective=*/true}
+ Prescanner{prescanner, *this, /*isNestedInIncludeDirective=*/true}
.set_encoding(included->encoding())
.Prescan(fileRange);
}