[flang-commits] [flang] 0586067 - [Flang] Build fix without precompiled headers

Michael Kruse via flang-commits flang-commits at lists.llvm.org
Wed Jul 23 01:22:15 PDT 2025


Author: Michael Kruse
Date: 2025-07-23T10:22:10+02:00
New Revision: 0586067cf07bef0f04fd1dc7135a9b773ebaa07a

URL: https://github.com/llvm/llvm-project/commit/0586067cf07bef0f04fd1dc7135a9b773ebaa07a
DIFF: https://github.com/llvm/llvm-project/commit/0586067cf07bef0f04fd1dc7135a9b773ebaa07a.diff

LOG: [Flang] Build fix without precompiled headers

The header semantics.h is added implitly in the precompiled headers, but
the build was failing when precompiled headers are disabled (e.g.
using CMAKE_DISABLE_PRECOMPILE_HEADERS=ON):

```
../_src/flang/lib/Semantics/canonicalize-omp.cpp: In constructor ‘Fortran::semantics::CanonicalizationOfOmp::CanonicalizationOfOmp(Fortran::semantics::SemanticsContext&)’:
../_src/flang/lib/Semantics/canonicalize-omp.cpp:31:38: error: invalid use of incomplete type ‘class Fortran::semantics::SemanticsContext’
   31 |       : context_{context}, messages_{context.messages()} {}
      |                                      ^~~~~~~
In file included from ../_src/flang/lib/Semantics/canonicalize-omp.cpp:9:
../_src/flang/lib/Semantics/canonicalize-omp.h:17:7: note: forward declaration of ‘class Fortran::semantics::SemanticsContext’
   17 | class SemanticsContext;
      |       ^~~~~~~~~~~~~~~~
compilation terminated due to -fmax-errors=1.
```

Added: 
    

Modified: 
    flang/lib/Semantics/canonicalize-omp.cpp

Removed: 
    


################################################################################
diff  --git a/flang/lib/Semantics/canonicalize-omp.cpp b/flang/lib/Semantics/canonicalize-omp.cpp
index 77e2fd6ca5097..9722eca19447d 100644
--- a/flang/lib/Semantics/canonicalize-omp.cpp
+++ b/flang/lib/Semantics/canonicalize-omp.cpp
@@ -9,6 +9,7 @@
 #include "canonicalize-omp.h"
 #include "flang/Parser/parse-tree-visitor.h"
 #include "flang/Parser/parse-tree.h"
+#include "flang/Semantics/semantics.h"
 
 // After Loop Canonicalization, rewrite OpenMP parse tree to make OpenMP
 // Constructs more structured which provide explicit scopes for later


        


More information about the flang-commits mailing list