unsigned PreallocatedID = 0,
unsigned Offset = 0) {
const SrcMgr::ContentCache *IR = getOrCreateContentCache(SourceFile);
- if (IR == 0) return FileID(); // Error opening file?
+ assert(IR && "getOrCreateContentCache() cannot return NULL");
return createFileID(IR, IncludePos, FileCharacter, PreallocatedID, Offset);
}
///
/// \param DoNotFree If true, then the buffer will not be freed when the
/// source manager is destroyed.
- ///
- /// \returns true if an error occurred, false otherwise.
- bool overrideFileContents(const FileEntry *SourceFile,
+ void overrideFileContents(const FileEntry *SourceFile,
const llvm::MemoryBuffer *Buffer,
bool DoNotFree = false);
return IR->getBuffer(Diag, *this, SourceLocation(), Invalid);
}
-bool SourceManager::overrideFileContents(const FileEntry *SourceFile,
+void SourceManager::overrideFileContents(const FileEntry *SourceFile,
const llvm::MemoryBuffer *Buffer,
bool DoNotFree) {
const SrcMgr::ContentCache *IR = getOrCreateContentCache(SourceFile);
- if (IR == 0)
- return true;
+ assert(IR && "getOrCreateContentCache() cannot return NULL");
const_cast<SrcMgr::ContentCache *>(IR)->replaceBuffer(Buffer, DoNotFree);
- return false;
}
llvm::StringRef SourceManager::getBufferData(FileID FID, bool *Invalid) const {