From 2f957ac0923c78f3541585e773073b9d174f565b Mon Sep 17 00:00:00 2001 From: Adrian Prantl Date: Sat, 19 Sep 2015 00:59:22 +0000 Subject: [PATCH] Further simplify CGDebugInfo::getOrCreateModuleRef(). DIBuilder ignoers DICompileUnits that are passed in as scopes anyway. llvm-svn: 248077 --- clang/lib/CodeGen/CGDebugInfo.cpp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index 2743c3f28e80..c0a3db4d61b7 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -1702,19 +1702,17 @@ CGDebugInfo::getOrCreateModuleRef(ExternalASTSource::ASTSourceDescriptor Mod, } } - llvm::DIModule *M = nullptr; if (CreateSkeletonCU) { llvm::DIBuilder DIB(CGM.getModule()); - auto *CU = DIB.createCompileUnit( - TheCU->getSourceLanguage(), Mod.FullModuleName, Mod.Path, - TheCU->getProducer(), true, StringRef(), 0, Mod.ASTFile, - llvm::DIBuilder::FullDebug, Mod.Signature); - M = DIB.createModule(CU, Mod.FullModuleName, ConfigMacros, Mod.Path, - CGM.getHeaderSearchOpts().Sysroot); + DIB.createCompileUnit(TheCU->getSourceLanguage(), Mod.FullModuleName, + Mod.Path, TheCU->getProducer(), true, StringRef(), 0, + Mod.ASTFile, llvm::DIBuilder::FullDebug, + Mod.Signature); DIB.finalize(); - } else - M = DBuilder.createModule(TheCU, Mod.FullModuleName, ConfigMacros, Mod.Path, - CGM.getHeaderSearchOpts().Sysroot); + } + llvm::DIModule *M = + DBuilder.createModule(TheCU, Mod.FullModuleName, ConfigMacros, Mod.Path, + CGM.getHeaderSearchOpts().Sysroot); ModRef.reset(M); return M; }