diff --git a/driver/cl_options.cpp b/driver/cl_options.cpp index bf27d152e5..b8d373bfbd 100644 --- a/driver/cl_options.cpp +++ b/driver/cl_options.cpp @@ -575,6 +575,12 @@ cl::opt cl::desc("Disable generation of exception stack unwinding " "code, assuming no Exceptions will be thrown")); +cl::opt fNoModuleInfo("fno-moduleinfo", cl::ZeroOrMore, + cl::desc("Disable generation of ModuleInfos")); + +cl::opt fNoRTTI("fno-rtti", cl::ZeroOrMore, + cl::desc("Disable generation of TypeInfos")); + cl::opt fSplitStack("fsplit-stack", cl::ZeroOrMore, cl::desc("Use segmented stack (see Clang documentation)")); diff --git a/driver/cl_options.h b/driver/cl_options.h index 54314f153b..f50fbcbb1a 100644 --- a/driver/cl_options.h +++ b/driver/cl_options.h @@ -101,6 +101,8 @@ void setDefaultMathOptions(llvm::TargetOptions &targetOptions); extern cl::opt fNoDiscardValueNames; extern cl::opt fNullPointerIsValid; extern cl::opt fNoExceptions; +extern cl::opt fNoModuleInfo; +extern cl::opt fNoRTTI; extern cl::opt fSplitStack; // Arguments to -d-debug diff --git a/driver/main.cpp b/driver/main.cpp index 12e01004ff..51b1310753 100644 --- a/driver/main.cpp +++ b/driver/main.cpp @@ -337,6 +337,8 @@ void parseCommandLine(Strings &sourceFiles) { global.params.obj = !dontWriteObj; global.params.useInlineAsm = !noAsm; global.params.useExceptions = !fNoExceptions; + global.params.useModuleInfo = !fNoModuleInfo; + global.params.useTypeInfo = !fNoRTTI; // String options global.params.objname = opts::fromPathString(objectFile); diff --git a/gen/modules.cpp b/gen/modules.cpp index 0348104563..c2a6441469 100644 --- a/gen/modules.cpp +++ b/gen/modules.cpp @@ -449,8 +449,8 @@ void codegenModule(IRState *irs, Module *m) { fatal(); } - // Skip emission of all the additional module metadata if: - // a) the -betterC switch is on, + // Skip emission of the ModuleInfo if: + // a) the -betterC or -fno-moduleinfo switch is on, // b) requested explicitly by the user via pragma(LDC_no_moduleinfo), // c) there's no ModuleInfo declaration, or if // d) the module is a C file. diff --git a/gen/toir.cpp b/gen/toir.cpp index 4264240d6f..24813640b4 100644 --- a/gen/toir.cpp +++ b/gen/toir.cpp @@ -2162,7 +2162,7 @@ public: LOG_SCOPE; // TODO: still required? - if (global.params.betterC) { + if (!global.params.useGC) { error( e->loc, "array concatenation of expression `%s` requires the GC which is not " diff --git a/ir/iraggr.h b/ir/iraggr.h index b818b7172c..8762626c47 100644 --- a/ir/iraggr.h +++ b/ir/iraggr.h @@ -64,9 +64,9 @@ public: /// Return the LLVM type of this Aggregate (w/o the reference for classes) llvm::StructType *getLLStructType(); - /// Whether to suppress the TypeInfo definition for the aggregate via - /// `-betterC`, no `object.TypeInfo`, or `pragma(LDC_no_typeinfo)`. + /// `-betterC` / `-fno-rtti`, no `object.TypeInfo`, or + /// `pragma(LDC_no_typeinfo)`. bool suppressTypeInfo() const; //////////////////////////////////////////////////////////////////////////