From cd98cb731288722bf44204feb2f570caaec6617c Mon Sep 17 00:00:00 2001 From: Ben Langmuir Date: Tue, 23 Jun 2015 18:20:18 +0000 Subject: [Modules] Consider -fmodule-feature in module hash and when loading Any extra features from -fmodule-feature are part of the module hash and need to get validated on load. Also print them with -module-file-info. llvm-svn: 240433 --- clang/lib/Frontend/CompilerInvocation.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'clang/lib/Frontend/CompilerInvocation.cpp') diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index 250c992cbde..dd664ca652f 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -1588,6 +1588,7 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK, Opts.ImplementationOfModule = Args.getLastArgValue(OPT_fmodule_implementation_of); Opts.ModuleFeatures = Args.getAllArgValues(OPT_fmodule_feature); + std::sort(Opts.ModuleFeatures.begin(), Opts.ModuleFeatures.end()); Opts.NativeHalfType |= Args.hasArg(OPT_fnative_half_type); Opts.HalfArgsAndReturns = Args.hasArg(OPT_fallow_half_arguments_and_returns); Opts.GNUAsm = !Args.hasArg(OPT_fno_gnu_inline_asm); @@ -1967,6 +1968,9 @@ std::string CompilerInvocation::getModuleHash() const { #define BENIGN_LANGOPT(Name, Bits, Default, Description) #define BENIGN_ENUM_LANGOPT(Name, Type, Bits, Default, Description) #include "clang/Basic/LangOptions.def" + + for (StringRef Feature : LangOpts->ModuleFeatures) + code = hash_combine(code, Feature); // Extend the signature with the target options. code = hash_combine(code, TargetOpts->Triple, TargetOpts->CPU, -- cgit v1.2.3