r241088 - Use an early exit to improve readability. (NFC)
Adrian Prantl
aprantl at apple.com
Tue Jun 30 11:01:05 PDT 2015
Author: adrian
Date: Tue Jun 30 13:01:05 2015
New Revision: 241088
URL: http://llvm.org/viewvc/llvm-project?rev=241088&view=rev
Log:
Use an early exit to improve readability. (NFC)
Modified:
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=241088&r1=241087&r2=241088&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Tue Jun 30 13:01:05 2015
@@ -1665,44 +1665,42 @@ llvm::DIType *CGDebugInfo::CreateType(co
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;
}
More information about the cfe-commits
mailing list