[flang-commits] [flang] 9ce8eb0 - [flang] Remove macro replacement in angular bracket includes

Ethan Luis McDonough via flang-commits flang-commits at lists.llvm.org
Fri Feb 17 23:59:38 PST 2023


Author: Ethan Luis McDonough
Date: 2023-02-18T01:59:32-06:00
New Revision: 9ce8eb0fbc83d9652f9266e5c7077727b8012db9

URL: https://github.com/llvm/llvm-project/commit/9ce8eb0fbc83d9652f9266e5c7077727b8012db9
DIFF: https://github.com/llvm/llvm-project/commit/9ce8eb0fbc83d9652f9266e5c7077727b8012db9.diff

LOG: [flang] Remove macro replacement in angular bracket includes

Addresses Github issue [[ https://github.com/llvm/llvm-project/issues/60317 | #60317 ]].

Reviewed By: klausler

Differential Revision: https://reviews.llvm.org/D143469

Added: 
    flang/test/Preprocessing/preserve-brace-include.F90

Modified: 
    flang/lib/Parser/preprocessor.cpp

Removed: 
    


################################################################################
diff  --git a/flang/lib/Parser/preprocessor.cpp b/flang/lib/Parser/preprocessor.cpp
index c8f944e4a5967..58b54f4f1a8c9 100644
--- a/flang/lib/Parser/preprocessor.cpp
+++ b/flang/lib/Parser/preprocessor.cpp
@@ -599,7 +599,7 @@ void Preprocessor::Directive(const TokenSequence &dir, Prescanner &prescanner) {
             "#include: expected '>' at end of included file"_port_en_US);
       }
       TokenSequence braced{dir, j + 1, k - j - 1};
-      include = ReplaceMacros(braced, prescanner).ToString();
+      include = braced.ToString();
       j = k;
     } else if ((include = dir.TokenAt(j).ToString()).substr(0, 1) == "\"" &&
         include.substr(include.size() - 1, 1) == "\"") { // #include "foo"

diff  --git a/flang/test/Preprocessing/preserve-brace-include.F90 b/flang/test/Preprocessing/preserve-brace-include.F90
new file mode 100644
index 0000000000000..22df3543b510a
--- /dev/null
+++ b/flang/test/Preprocessing/preserve-brace-include.F90
@@ -0,0 +1,5 @@
+! RUN: %flang -E -I%S %s | FileCheck %s
+
+#define empty ERR_NONEXISTENT
+! CHECK-NOT: :5:
+#include <empty.h>


        


More information about the flang-commits mailing list