Skip to content

Commit f33e236

Browse files
authored
[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 834dfd2 and 7dfdca1). This PR makes the required updates so that clang/llvm builds when `-DLLVM_ENABLE_MODULES=ON`. rdar://140803058
1 parent a674209 commit f33e236

File tree

10 files changed

+33
-7
lines changed

10 files changed

+33
-7
lines changed

clang/include/clang/AST/Attr.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "clang/Basic/OpenMPKinds.h"
2525
#include "clang/Basic/Sanitizers.h"
2626
#include "clang/Basic/SourceLocation.h"
27+
#include "clang/Support/Compiler.h"
2728
#include "llvm/Frontend/HLSL/HLSLResource.h"
2829
#include "llvm/Support/CodeGen.h"
2930
#include "llvm/Support/ErrorHandling.h"

clang/include/module.modulemap

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ module Clang_Diagnostics {
115115
module Driver { header "clang/Driver/DriverDiagnostic.h" export * }
116116
module Frontend { header "clang/Frontend/FrontendDiagnostic.h" export * }
117117
module Lex { header "clang/Lex/LexDiagnostic.h" export * }
118-
module Parse { header "clang/Parse/ParseDiagnostic.h" export * }
118+
module Parse { header "clang/Basic/DiagnosticParse.h" export * }
119119
module Serialization { header "clang/Serialization/SerializationDiagnostic.h" export * }
120120
module Refactoring { header "clang/Tooling/Refactoring/RefactoringDiagnostic.h" export * }
121121
}
@@ -183,9 +183,14 @@ module Clang_StaticAnalyzer_Frontend {
183183
module * { export * }
184184
}
185185

186+
module Clang_Support { requires cplusplus umbrella "clang/Support" module * { export * } }
187+
186188
module Clang_Testing {
187189
requires cplusplus
188190
umbrella "clang/Testing"
191+
192+
textual header "clang/Testing/TestLanguage.def"
193+
189194
module * { export * }
190195
}
191196

clang/utils/TableGen/ClangAttrEmitter.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3183,7 +3183,6 @@ void clang::EmitClangAttrClass(const RecordKeeper &Records, raw_ostream &OS) {
31833183

31843184
OS << "#ifndef LLVM_CLANG_ATTR_CLASSES_INC\n";
31853185
OS << "#define LLVM_CLANG_ATTR_CLASSES_INC\n";
3186-
OS << "#include \"clang/Support/Compiler.h\"\n\n";
31873186

31883187
emitAttributes(Records, OS, true);
31893188

llvm/include/llvm/DebugInfo/DWARF/DWARFTypePrinter.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#ifndef LLVM_DEBUGINFO_DWARF_DWARFTYPEPRINTER_H
1010
#define LLVM_DEBUGINFO_DWARF_DWARFTYPEPRINTER_H
1111

12+
#include "llvm/ADT/StringExtras.h"
1213
#include "llvm/ADT/StringRef.h"
1314
#include "llvm/BinaryFormat/Dwarf.h"
1415
#include "llvm/Support/Error.h"

llvm/include/llvm/IR/NVVMIntrinsicFlags.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
#ifndef LLVM_IR_NVVMINTRINSICFLAGS_H
1616
#define LLVM_IR_NVVMINTRINSICFLAGS_H
1717

18+
#include <stdint.h>
19+
1820
namespace llvm {
1921
namespace nvvm {
2022

llvm/include/llvm/SandboxIR/Type.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -283,11 +283,8 @@ class Type {
283283
}
284284

285285
#ifndef NDEBUG
286-
void dumpOS(raw_ostream &OS) { LLVMTy->print(OS); }
287-
LLVM_DUMP_METHOD void dump() {
288-
dumpOS(dbgs());
289-
dbgs() << "\n";
290-
}
286+
void dumpOS(raw_ostream &OS);
287+
LLVM_DUMP_METHOD void dump();
291288
#endif // NDEBUG
292289
};
293290

llvm/include/llvm/Support/Memory.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
#include "llvm/Support/DataTypes.h"
1717
#include <system_error>
18+
#include <utility>
1819

1920
namespace llvm {
2021

llvm/include/llvm/TargetParser/AArch64TargetParser.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
#include "llvm/ADT/ArrayRef.h"
1818
#include "llvm/ADT/Bitset.h"
19+
#include "llvm/ADT/StringExtras.h"
1920
#include "llvm/ADT/StringMap.h"
2021
#include "llvm/ADT/StringRef.h"
2122
#include "llvm/Support/VersionTuple.h"

llvm/include/module.modulemap

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,7 @@ extern module LLVM_Extern_Utils_DataTypes "module.extern.modulemap"
346346
// TargetParser module before building the TargetParser module itself.
347347
module TargetParserGen {
348348
module AArch64TargetParserDef {
349+
textual header "llvm/TargetParser/AArch64CPUFeatures.inc"
349350
header "llvm/TargetParser/AArch64TargetParser.h"
350351
extern module LLVM_Extern_TargetParser_Gen "module.extern.modulemap"
351352
export *
@@ -426,3 +427,12 @@ module LLVM_WindowsManifest {
426427
umbrella "llvm/WindowsManifest"
427428
module * { export * }
428429
}
430+
431+
module LLVM_SandboxIR {
432+
requires cplusplus
433+
434+
umbrella "llvm/SandboxIR"
435+
module * { export * }
436+
437+
textual header "llvm/SandboxIR/Values.def"
438+
}

llvm/lib/SandboxIR/Type.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,15 @@ Type *Type::getDoubleTy(Context &Ctx) {
3636
Type *Type::getFloatTy(Context &Ctx) {
3737
return Ctx.getType(llvm::Type::getFloatTy(Ctx.LLVMCtx));
3838
}
39+
40+
#ifndef NDEBUG
41+
void Type::dumpOS(raw_ostream &OS) { LLVMTy->print(OS); }
42+
void Type::dump() {
43+
dumpOS(dbgs());
44+
dbgs() << "\n";
45+
}
46+
#endif
47+
3948
PointerType *PointerType::get(Type *ElementType, unsigned AddressSpace) {
4049
return cast<PointerType>(ElementType->getContext().getType(
4150
llvm::PointerType::get(ElementType->LLVMTy, AddressSpace)));

0 commit comments

Comments
 (0)