diff options
Diffstat (limited to 'lib/Frontend/CompilerInvocation.cpp')
| -rw-r--r-- | lib/Frontend/CompilerInvocation.cpp | 44 | 
1 files changed, 25 insertions, 19 deletions
diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp index 85467631c943a..dd664ca652f0a 100644 --- a/lib/Frontend/CompilerInvocation.cpp +++ b/lib/Frontend/CompilerInvocation.cpp @@ -1521,6 +1521,8 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,        Args.hasArg(OPT_fmodules_decluse) || Opts.ModulesStrictDeclUse;    Opts.ModulesLocalVisibility =        Args.hasArg(OPT_fmodules_local_submodule_visibility); +  Opts.ModulesHideInternalLinkage = +      !Args.hasArg(OPT_fno_modules_hide_internal_linkage);    Opts.ModulesSearchAll = Opts.Modules &&      !Args.hasArg(OPT_fno_modules_search_all) &&      Args.hasArg(OPT_fmodules_search_all); @@ -1586,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); @@ -1847,37 +1850,37 @@ bool CompilerInvocation::CreateFromArgs(CompilerInvocation &Res,    std::unique_ptr<OptTable> Opts(createDriverOptTable());    const unsigned IncludedFlagsBitmask = options::CC1Option;    unsigned MissingArgIndex, MissingArgCount; -  std::unique_ptr<InputArgList> Args( -      Opts->ParseArgs(ArgBegin, ArgEnd, MissingArgIndex, MissingArgCount, -                      IncludedFlagsBitmask)); +  InputArgList Args = +      Opts->ParseArgs(llvm::makeArrayRef(ArgBegin, ArgEnd), MissingArgIndex, +                      MissingArgCount, IncludedFlagsBitmask);    // Check for missing argument error.    if (MissingArgCount) {      Diags.Report(diag::err_drv_missing_argument) -      << Args->getArgString(MissingArgIndex) << MissingArgCount; +        << Args.getArgString(MissingArgIndex) << MissingArgCount;      Success = false;    }    // Issue errors on unknown arguments. -  for (const Arg *A : Args->filtered(OPT_UNKNOWN)) { -    Diags.Report(diag::err_drv_unknown_argument) << A->getAsString(*Args); +  for (const Arg *A : Args.filtered(OPT_UNKNOWN)) { +    Diags.Report(diag::err_drv_unknown_argument) << A->getAsString(Args);      Success = false;    } -  Success &= ParseAnalyzerArgs(*Res.getAnalyzerOpts(), *Args, Diags); -  Success &= ParseMigratorArgs(Res.getMigratorOpts(), *Args); -  ParseDependencyOutputArgs(Res.getDependencyOutputOpts(), *Args); -  Success &= ParseDiagnosticArgs(Res.getDiagnosticOpts(), *Args, &Diags); -  ParseCommentArgs(Res.getLangOpts()->CommentOpts, *Args); -  ParseFileSystemArgs(Res.getFileSystemOpts(), *Args); +  Success &= ParseAnalyzerArgs(*Res.getAnalyzerOpts(), Args, Diags); +  Success &= ParseMigratorArgs(Res.getMigratorOpts(), Args); +  ParseDependencyOutputArgs(Res.getDependencyOutputOpts(), Args); +  Success &= ParseDiagnosticArgs(Res.getDiagnosticOpts(), Args, &Diags); +  ParseCommentArgs(Res.getLangOpts()->CommentOpts, Args); +  ParseFileSystemArgs(Res.getFileSystemOpts(), Args);    // FIXME: We shouldn't have to pass the DashX option around here -  InputKind DashX = ParseFrontendArgs(Res.getFrontendOpts(), *Args, Diags); -  ParseTargetArgs(Res.getTargetOpts(), *Args); -  Success &= ParseCodeGenArgs(Res.getCodeGenOpts(), *Args, DashX, Diags, +  InputKind DashX = ParseFrontendArgs(Res.getFrontendOpts(), Args, Diags); +  ParseTargetArgs(Res.getTargetOpts(), Args); +  Success &= ParseCodeGenArgs(Res.getCodeGenOpts(), Args, DashX, Diags,                                Res.getTargetOpts()); -  ParseHeaderSearchArgs(Res.getHeaderSearchOpts(), *Args); +  ParseHeaderSearchArgs(Res.getHeaderSearchOpts(), Args);    if (DashX != IK_AST && DashX != IK_LLVM_IR) { -    ParseLangArgs(*Res.getLangOpts(), *Args, DashX, Diags); +    ParseLangArgs(*Res.getLangOpts(), Args, DashX, Diags);      if (Res.getFrontendOpts().ProgramAction == frontend::RewriteObjC)        Res.getLangOpts()->ObjCExceptions = 1;    } @@ -1886,8 +1889,8 @@ bool CompilerInvocation::CreateFromArgs(CompilerInvocation &Res,    // ParsePreprocessorArgs and remove the FileManager     // parameters from the function and the "FileManager.h" #include.    FileManager FileMgr(Res.getFileSystemOpts()); -  ParsePreprocessorArgs(Res.getPreprocessorOpts(), *Args, FileMgr, Diags); -  ParsePreprocessorOutputArgs(Res.getPreprocessorOutputOpts(), *Args, +  ParsePreprocessorArgs(Res.getPreprocessorOpts(), Args, FileMgr, Diags); +  ParsePreprocessorOutputArgs(Res.getPreprocessorOutputOpts(), Args,                                Res.getFrontendOpts().ProgramAction);    return Success;  } @@ -1965,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,  | 
