diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/CodeGen/CGDebugInfo.cpp | 6 | ||||
-rw-r--r-- | lib/Driver/CC1Options.cpp | 2 | ||||
-rw-r--r-- | lib/Frontend/CompilerInvocation.cpp | 8 |
3 files changed, 9 insertions, 7 deletions
diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index 558bb5bc96..317da7e46a 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/lib/CodeGen/CGDebugInfo.cpp @@ -95,10 +95,10 @@ llvm::DICompileUnit CGDebugInfo::getOrCreateCompileUnit(SourceLocation Loc) { // file at a time. bool isMain = false; const LangOptions &LO = M->getLangOptions(); - const char *MainFileName = LO.getMainFileName(); + const CodeGenOptions &CGO = M->getCodeGenOpts(); if (isMainCompileUnitCreated == false) { - if (MainFileName) { - if (!strcmp(AbsFileName.getLast().c_str(), MainFileName)) + if (!CGO.MainFileName.empty()) { + if (AbsFileName.getLast() == CGO.MainFileName) isMain = true; } else { if (Loc.isValid() && SM.isFromMainFile(Loc)) diff --git a/lib/Driver/CC1Options.cpp b/lib/Driver/CC1Options.cpp index e65d3dc37b..1b07578e95 100644 --- a/lib/Driver/CC1Options.cpp +++ b/lib/Driver/CC1Options.cpp @@ -172,6 +172,8 @@ static void ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args) { Opts.SimplifyLibCalls = 1; Opts.UnrollLoops = (Opts.OptimizationLevel > 1 && !Opts.OptimizeSize); + Opts.MainFileName = getLastArgValue(Args, OPT_main_file_name); + // FIXME: Implement! // FIXME: Eliminate this dependency? // if (Lang.NoBuiltin) diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp index be9bab16be..3925ff0648 100644 --- a/lib/Frontend/CompilerInvocation.cpp +++ b/lib/Frontend/CompilerInvocation.cpp @@ -111,6 +111,10 @@ static void CodeGenOptsToArgs(const CodeGenOptions &Opts, Res.push_back("-Os"); } else if (Opts.OptimizationLevel != 0) Res.push_back("-O" + llvm::utostr(Opts.OptimizationLevel)); + if (!Opts.MainFileName.empty()) { + Res.push_back("-main-file-name"); + Res.push_back(Opts.MainFileName); + } // SimplifyLibCalls is only derived. // TimePasses is only derived. // UnitAtATime is unused. @@ -453,10 +457,6 @@ static void LangOptsToArgs(const LangOptions &Opts, Res.push_back("-stack-protector"); Res.push_back(llvm::utostr(Opts.getStackProtectorMode())); } - if (Opts.getMainFileName()) { - Res.push_back("-main-file-name"); - Res.push_back(Opts.getMainFileName()); - } if (Opts.InstantiationDepth != DefaultLangOpts.InstantiationDepth) { Res.push_back("-ftemplate-depth"); Res.push_back(llvm::utostr(Opts.InstantiationDepth)); |