/// Holds information for \#line directives.
///
/// This is referenced by indices from SLocEntryTable.
- LineTableInfo *LineTable = nullptr;
+ std::unique_ptr<LineTableInfo> LineTable;
/// These ivars serve as a cache used in the getLineNumber
/// method which is used to speedup getLineNumber calls to nearby locations.
LineTableInfo &SourceManager::getLineTable() {
if (!LineTable)
- LineTable = new LineTableInfo();
+ LineTable.reset(new LineTableInfo());
return *LineTable;
}
}
SourceManager::~SourceManager() {
- delete LineTable;
-
// Delete FileEntry objects corresponding to content caches. Since the actual
// content cache objects are bump pointer allocated, we just have to run the
// dtors, but we call the deallocate method for completeness.