r247445 - Cleanup: Get rid of a bunch of unnecessary invocations of internString()

Adrian Prantl via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 11 11:45:03 PDT 2015


Author: adrian
Date: Fri Sep 11 13:45:02 2015
New Revision: 247445

URL: http://llvm.org/viewvc/llvm-project?rev=247445&view=rev
Log:
Cleanup: Get rid of a bunch of unnecessary invocations of internString()
in CGDebugInfo.cpp: MDString::get() copies its arguments.

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=247445&r1=247444&r2=247445&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Fri Sep 11 13:45:02 2015
@@ -345,13 +345,6 @@ void CGDebugInfo::CreateCompileUnit() {
     }
   }
 
-  // Save filename string.
-  StringRef Filename = internString(MainFileName);
-
-  // Save split dwarf file string.
-  std::string SplitDwarfFile = CGM.getCodeGenOpts().SplitDwarfFile;
-  StringRef SplitDwarfFilename = internString(SplitDwarfFile);
-
   llvm::dwarf::SourceLanguage LangTag;
   const LangOptions &LO = CGM.getLangOpts();
   if (LO.CPlusPlus) {
@@ -377,13 +370,13 @@ void CGDebugInfo::CreateCompileUnit() {
   // Create new compile unit.
   // FIXME - Eliminate TheCU.
   TheCU = DBuilder.createCompileUnit(
-      LangTag, Filename, getCurrentDirname(), Producer, LO.Optimize,
-      CGM.getCodeGenOpts().DwarfDebugFlags, RuntimeVers, SplitDwarfFilename,
+      LangTag, MainFileName, getCurrentDirname(), Producer, LO.Optimize,
+      CGM.getCodeGenOpts().DwarfDebugFlags, RuntimeVers,
+      CGM.getCodeGenOpts().SplitDwarfFile,
       DebugKind <= CodeGenOptions::DebugLineTablesOnly
           ? llvm::DIBuilder::LineTablesOnly
           : llvm::DIBuilder::FullDebug,
-      0 /* DWOid */,
-      DebugKind != CodeGenOptions::LocTrackingOnly);
+      0 /* DWOid */, DebugKind != CodeGenOptions::LocTrackingOnly);
 }
 
 llvm::DIType *CGDebugInfo::CreateType(const BuiltinType *BT) {
@@ -775,9 +768,9 @@ llvm::DIType *CGDebugInfo::CreateType(co
       Ty->getTemplateName().getAsTemplateDecl())->getTemplatedDecl();
 
   SourceLocation Loc = AliasDecl->getLocation();
-  return DBuilder.createTypedef(
-      Src, internString(OS.str()), getOrCreateFile(Loc), getLineNumber(Loc),
-      getDeclContextDescriptor(AliasDecl));
+  return DBuilder.createTypedef(Src, OS.str(), getOrCreateFile(Loc),
+                                getLineNumber(Loc),
+                                getDeclContextDescriptor(AliasDecl));
 }
 
 llvm::DIType *CGDebugInfo::CreateType(const TypedefType *Ty,
@@ -1688,13 +1681,13 @@ CGDebugInfo::getOrCreateModuleRef(Extern
     }
   }
   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 *M = DIB.createModule(
-      CU, Mod.ModuleName, ConfigMacros, internString(Mod.Path),
-      internString(CGM.getHeaderSearchOpts().Sysroot));
+  auto *CU = DIB.createCompileUnit(TheCU->getSourceLanguage(), Mod.ModuleName,
+                                   Mod.Path, TheCU->getProducer(), true,
+                                   StringRef(), 0, Mod.ASTFile,
+                                   llvm::DIBuilder::FullDebug, Mod.Signature);
+  llvm::DIModule *M =
+      DIB.createModule(CU, Mod.ModuleName, ConfigMacros, Mod.Path,
+                       CGM.getHeaderSearchOpts().Sysroot);
   DIB.finalize();
   ModRef.reset(M);
   return M;




More information about the cfe-commits mailing list