[flang-commits] [flang] [flang] Main program symbol no longer conflicts with the other symbols (PR #149169)

Peter Klausler via flang-commits flang-commits at lists.llvm.org
Wed Jul 16 12:49:21 PDT 2025


================
@@ -489,15 +489,32 @@ class ParseTreeAnalyzer {
 
   // C1401
   void Post(const parser::MainProgram &mainProgram) {
-    if (const parser::CharBlock *
-        endName{GetStmtName(std::get<parser::Statement<parser::EndProgramStmt>>(
-            mainProgram.t))}) {
-      if (const auto &program{
-              std::get<std::optional<parser::Statement<parser::ProgramStmt>>>(
-                  mainProgram.t)}) {
-        if (*endName != program->statement.v.source) {
+    // Uppercase the name of the main program, so that its symbol name
+    // would be unique from similarly named non-main-program symbols.
+    auto upperCaseCharBlock = [](const parser::CharBlock &cb) {
+      char *ch = const_cast<char *>(cb.begin());
----------------
klausler wrote:

Please always use braced initialization in the bits of flang-new that are modern C++.

https://github.com/llvm/llvm-project/pull/149169


More information about the flang-commits mailing list