]> granicus.if.org Git - clang/commitdiff
[Basic] Fix DRY violation, just call getLineTable() (NFC)
authorVedant Kumar <vsk@apple.com>
Thu, 12 Nov 2015 00:11:19 +0000 (00:11 +0000)
committerVedant Kumar <vsk@apple.com>
Thu, 12 Nov 2015 00:11:19 +0000 (00:11 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@252828 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Basic/SourceManager.cpp

index 536ae7ff5c8fe0e39f0475ff63c371b4cd5c3377..734f2042b786e4162bfa5c35c45eed5f469d8efc 100644 (file)
@@ -279,9 +279,7 @@ void LineTableInfo::AddEntry(FileID FID,
 /// getLineTableFilenameID - Return the uniqued ID for the specified filename.
 ///
 unsigned SourceManager::getLineTableFilenameID(StringRef Name) {
-  if (!LineTable)
-    LineTable = new LineTableInfo();
-  return LineTable->getLineTableFilenameID(Name);
+  return getLineTable().getLineTableFilenameID(Name);
 }
 
 
@@ -302,9 +300,7 @@ void SourceManager::AddLineNote(SourceLocation Loc, unsigned LineNo,
   // Remember that this file has #line directives now if it doesn't already.
   const_cast<SrcMgr::FileInfo&>(FileInfo).setHasLineDirectives();
 
-  if (!LineTable)
-    LineTable = new LineTableInfo();
-  LineTable->AddLineNote(LocInfo.first, LocInfo.second, LineNo, FilenameID);
+  getLineTable().AddLineNote(LocInfo.first, LocInfo.second, LineNo, FilenameID);
 }
 
 /// AddLineNote - Add a GNU line marker to the line table.
@@ -332,8 +328,7 @@ void SourceManager::AddLineNote(SourceLocation Loc, unsigned LineNo,
   // Remember that this file has #line directives now if it doesn't already.
   const_cast<SrcMgr::FileInfo&>(FileInfo).setHasLineDirectives();
 
-  if (!LineTable)
-    LineTable = new LineTableInfo();
+  (void) getLineTable();
 
   SrcMgr::CharacteristicKind FileKind;
   if (IsExternCHeader)