summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGDebugInfo.cpp
diff options
context:
space:
mode:
authorAdrian Prantl <aprantl@apple.com>2015-06-30 18:01:05 +0000
committerAdrian Prantl <aprantl@apple.com>2015-06-30 18:01:05 +0000
commit2388eadbd8a67ddd1439ff48a082d618e969c79d (patch)
tree0e1e0639306aab8f87b641edf95d04cbfb70f0ca /clang/lib/CodeGen/CGDebugInfo.cpp
parent5d26fa835d67b9e9344ee9459f3d4ba1589a5295 (diff)
downloadbcm5719-llvm-2388eadbd8a67ddd1439ff48a082d618e969c79d.tar.gz
bcm5719-llvm-2388eadbd8a67ddd1439ff48a082d618e969c79d.zip
Use an early exit to improve readability. (NFC)
llvm-svn: 241088
Diffstat (limited to 'clang/lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r--clang/lib/CodeGen/CGDebugInfo.cpp66
1 files changed, 32 insertions, 34 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index 8daf8af4e18..8c4b4b3d061 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -1665,44 +1665,42 @@ llvm::DIType *CGDebugInfo::CreateType(const ObjCInterfaceType *Ty,
llvm::DIModule *
CGDebugInfo::getOrCreateModuleRef(ExternalASTSource::ASTSourceDescriptor Mod) {
- llvm::DIModule *ModuleRef = nullptr;
auto it = ModuleRefCache.find(Mod.Signature);
if (it != ModuleRefCache.end())
- ModuleRef = it->second;
- else {
- // Macro definitions that were defined with "-D" on the command line.
- SmallString<128> ConfigMacros;
- {
- llvm::raw_svector_ostream OS(ConfigMacros);
- const auto &PPOpts = CGM.getPreprocessorOpts();
- unsigned I = 0;
- // Translate the macro definitions back into a commmand line.
- for (auto &M : PPOpts.Macros) {
- if (++I > 1)
- OS << " ";
- const std::string &Macro = M.first;
- bool Undef = M.second;
- OS << "\"-" << (Undef ? 'U' : 'D');
- for (char c : Macro)
- switch (c) {
- case '\\' : OS << "\\\\"; break;
- case '"' : OS << "\\\""; break;
- default: OS << c;
- }
- OS << '\"';
- }
+ return it->second;
+
+ // Macro definitions that were defined with "-D" on the command line.
+ SmallString<128> ConfigMacros;
+ {
+ llvm::raw_svector_ostream OS(ConfigMacros);
+ const auto &PPOpts = CGM.getPreprocessorOpts();
+ unsigned I = 0;
+ // Translate the macro definitions back into a commmand line.
+ for (auto &M : PPOpts.Macros) {
+ if (++I > 1)
+ OS << " ";
+ const std::string &Macro = M.first;
+ bool Undef = M.second;
+ OS << "\"-" << (Undef ? 'U' : 'D');
+ for (char c : Macro)
+ switch (c) {
+ case '\\' : OS << "\\\\"; break;
+ case '"' : OS << "\\\""; break;
+ default: OS << c;
+ }
+ OS << '\"';
}
- llvm::DIBuilder DIB(CGM.getModule());
- auto *CU = DIB.createCompileUnit(
- TheCU->getSourceLanguage(), internString(Mod.ModuleName),
- internString(Mod.Path), TheCU->getProducer(), true, StringRef(), 0,
- internString(Mod.ASTFile), llvm::DIBuilder::FullDebug, Mod.Signature);
- ModuleRef = DIB.createModule(
- CU, Mod.ModuleName, ConfigMacros, internString(Mod.Path),
- internString(CGM.getHeaderSearchOpts().Sysroot));
- DIB.finalize();
- ModuleRefCache.insert(std::make_pair(Mod.Signature, ModuleRef));
}
+ llvm::DIBuilder DIB(CGM.getModule());
+ auto *CU = DIB.createCompileUnit(
+ TheCU->getSourceLanguage(), internString(Mod.ModuleName),
+ internString(Mod.Path), TheCU->getProducer(), true, StringRef(), 0,
+ internString(Mod.ASTFile), llvm::DIBuilder::FullDebug, Mod.Signature);
+ llvm::DIModule *ModuleRef =
+ DIB.createModule(CU, Mod.ModuleName, ConfigMacros, internString(Mod.Path),
+ internString(CGM.getHeaderSearchOpts().Sysroot));
+ DIB.finalize();
+ ModuleRefCache.insert(std::make_pair(Mod.Signature, ModuleRef));
return ModuleRef;
}
OpenPOWER on IntegriCloud