[llvm] f33e236 - [clang][Modules] Fixing Build Breaks When -DLLVM_ENABLE_MODULES=ON (#119473)

via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 11 17:33:29 PST 2024


Author: Qiongsi Wu
Date: 2024-12-11T17:33:25-08:00
New Revision: f33e2369051e13a54a05dd361d89c1ba77f4f593

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

LOG: [clang][Modules] Fixing Build Breaks When -DLLVM_ENABLE_MODULES=ON (#119473)

A few recent changes are causing build breaks when
`-DLLVM_ENABLE_MODULES=ON` (such as
834dfd23155351c9885eddf7b9664f7697326946 and
7dfdca1961aadc75ca397818bfb9bd32f1879248).

This PR makes the required updates so that clang/llvm builds when
`-DLLVM_ENABLE_MODULES=ON`.

rdar://140803058

Added: 
    

Modified: 
    clang/include/clang/AST/Attr.h
    clang/include/module.modulemap
    clang/utils/TableGen/ClangAttrEmitter.cpp
    llvm/include/llvm/DebugInfo/DWARF/DWARFTypePrinter.h
    llvm/include/llvm/IR/NVVMIntrinsicFlags.h
    llvm/include/llvm/SandboxIR/Type.h
    llvm/include/llvm/Support/Memory.h
    llvm/include/llvm/TargetParser/AArch64TargetParser.h
    llvm/include/module.modulemap
    llvm/lib/SandboxIR/Type.cpp

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/AST/Attr.h b/clang/include/clang/AST/Attr.h
index 725498e132fc28..3365ebe4d9012b 100644
--- a/clang/include/clang/AST/Attr.h
+++ b/clang/include/clang/AST/Attr.h
@@ -24,6 +24,7 @@
 #include "clang/Basic/OpenMPKinds.h"
 #include "clang/Basic/Sanitizers.h"
 #include "clang/Basic/SourceLocation.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/Frontend/HLSL/HLSLResource.h"
 #include "llvm/Support/CodeGen.h"
 #include "llvm/Support/ErrorHandling.h"

diff  --git a/clang/include/module.modulemap b/clang/include/module.modulemap
index b399f0beee59a1..5bb9f6b7a91f67 100644
--- a/clang/include/module.modulemap
+++ b/clang/include/module.modulemap
@@ -115,7 +115,7 @@ module Clang_Diagnostics {
   module Driver { header "clang/Driver/DriverDiagnostic.h" export * }
   module Frontend { header "clang/Frontend/FrontendDiagnostic.h" export * }
   module Lex { header "clang/Lex/LexDiagnostic.h" export * }
-  module Parse { header "clang/Parse/ParseDiagnostic.h" export * }
+  module Parse { header "clang/Basic/DiagnosticParse.h" export * }
   module Serialization { header "clang/Serialization/SerializationDiagnostic.h" export * }
   module Refactoring { header "clang/Tooling/Refactoring/RefactoringDiagnostic.h" export * }
 }
@@ -183,9 +183,14 @@ module Clang_StaticAnalyzer_Frontend {
   module * { export * }
 }
 
+module Clang_Support { requires cplusplus umbrella "clang/Support" module * { export * } }
+
 module Clang_Testing {
   requires cplusplus
   umbrella "clang/Testing"
+
+  textual header "clang/Testing/TestLanguage.def"
+
   module * { export * }
 }
 

diff  --git a/clang/utils/TableGen/ClangAttrEmitter.cpp b/clang/utils/TableGen/ClangAttrEmitter.cpp
index 630beaef983bc6..cc6a8eaebd44ec 100644
--- a/clang/utils/TableGen/ClangAttrEmitter.cpp
+++ b/clang/utils/TableGen/ClangAttrEmitter.cpp
@@ -3183,7 +3183,6 @@ void clang::EmitClangAttrClass(const RecordKeeper &Records, raw_ostream &OS) {
 
   OS << "#ifndef LLVM_CLANG_ATTR_CLASSES_INC\n";
   OS << "#define LLVM_CLANG_ATTR_CLASSES_INC\n";
-  OS << "#include \"clang/Support/Compiler.h\"\n\n";
 
   emitAttributes(Records, OS, true);
 

diff  --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFTypePrinter.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFTypePrinter.h
index 3c936b93865045..bd25f6c30ebf1f 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFTypePrinter.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFTypePrinter.h
@@ -9,6 +9,7 @@
 #ifndef LLVM_DEBUGINFO_DWARF_DWARFTYPEPRINTER_H
 #define LLVM_DEBUGINFO_DWARF_DWARFTYPEPRINTER_H
 
+#include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/BinaryFormat/Dwarf.h"
 #include "llvm/Support/Error.h"

diff  --git a/llvm/include/llvm/IR/NVVMIntrinsicFlags.h b/llvm/include/llvm/IR/NVVMIntrinsicFlags.h
index 43dde42bbbd620..dfb6e857b3a6ad 100644
--- a/llvm/include/llvm/IR/NVVMIntrinsicFlags.h
+++ b/llvm/include/llvm/IR/NVVMIntrinsicFlags.h
@@ -15,6 +15,8 @@
 #ifndef LLVM_IR_NVVMINTRINSICFLAGS_H
 #define LLVM_IR_NVVMINTRINSICFLAGS_H
 
+#include <stdint.h>
+
 namespace llvm {
 namespace nvvm {
 

diff  --git a/llvm/include/llvm/SandboxIR/Type.h b/llvm/include/llvm/SandboxIR/Type.h
index 9d1db11edb05ae..3218b991b31a20 100644
--- a/llvm/include/llvm/SandboxIR/Type.h
+++ b/llvm/include/llvm/SandboxIR/Type.h
@@ -283,11 +283,8 @@ class Type {
   }
 
 #ifndef NDEBUG
-  void dumpOS(raw_ostream &OS) { LLVMTy->print(OS); }
-  LLVM_DUMP_METHOD void dump() {
-    dumpOS(dbgs());
-    dbgs() << "\n";
-  }
+  void dumpOS(raw_ostream &OS);
+  LLVM_DUMP_METHOD void dump();
 #endif // NDEBUG
 };
 

diff  --git a/llvm/include/llvm/Support/Memory.h b/llvm/include/llvm/Support/Memory.h
index c02a3cc14dc7de..a587f2a8542b2e 100644
--- a/llvm/include/llvm/Support/Memory.h
+++ b/llvm/include/llvm/Support/Memory.h
@@ -15,6 +15,7 @@
 
 #include "llvm/Support/DataTypes.h"
 #include <system_error>
+#include <utility>
 
 namespace llvm {
 

diff  --git a/llvm/include/llvm/TargetParser/AArch64TargetParser.h b/llvm/include/llvm/TargetParser/AArch64TargetParser.h
index 2dd8469becbb9e..ac8006d671a06d 100644
--- a/llvm/include/llvm/TargetParser/AArch64TargetParser.h
+++ b/llvm/include/llvm/TargetParser/AArch64TargetParser.h
@@ -16,6 +16,7 @@
 
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/Bitset.h"
+#include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/VersionTuple.h"

diff  --git a/llvm/include/module.modulemap b/llvm/include/module.modulemap
index b00da6d7cd28c7..6beb0e03e222d5 100644
--- a/llvm/include/module.modulemap
+++ b/llvm/include/module.modulemap
@@ -346,6 +346,7 @@ extern module LLVM_Extern_Utils_DataTypes "module.extern.modulemap"
 // TargetParser module before building the TargetParser module itself.
 module TargetParserGen {
   module AArch64TargetParserDef {
+    textual header "llvm/TargetParser/AArch64CPUFeatures.inc"
     header "llvm/TargetParser/AArch64TargetParser.h"
     extern module LLVM_Extern_TargetParser_Gen "module.extern.modulemap"
     export *
@@ -426,3 +427,12 @@ module LLVM_WindowsManifest {
   umbrella "llvm/WindowsManifest"
   module * { export * }
 }
+
+module LLVM_SandboxIR {
+  requires cplusplus
+
+  umbrella "llvm/SandboxIR"
+  module * { export * }
+
+  textual header "llvm/SandboxIR/Values.def"
+}

diff  --git a/llvm/lib/SandboxIR/Type.cpp b/llvm/lib/SandboxIR/Type.cpp
index 7bb788ecf25a64..9ecff5f0165a9d 100644
--- a/llvm/lib/SandboxIR/Type.cpp
+++ b/llvm/lib/SandboxIR/Type.cpp
@@ -36,6 +36,15 @@ Type *Type::getDoubleTy(Context &Ctx) {
 Type *Type::getFloatTy(Context &Ctx) {
   return Ctx.getType(llvm::Type::getFloatTy(Ctx.LLVMCtx));
 }
+
+#ifndef NDEBUG
+void Type::dumpOS(raw_ostream &OS) { LLVMTy->print(OS); }
+void Type::dump() {
+  dumpOS(dbgs());
+  dbgs() << "\n";
+}
+#endif
+
 PointerType *PointerType::get(Type *ElementType, unsigned AddressSpace) {
   return cast<PointerType>(ElementType->getContext().getType(
       llvm::PointerType::get(ElementType->LLVMTy, AddressSpace)));


        


More information about the llvm-commits mailing list