c2c/Clang/SourceManager.cpp
/// getOrCreateContentCache - Create or return a cached ContentCache for the
/// specified file.
Create or return a cached ContentCache for the
specified file.
Create or return a cached ContentCache for the specified file .
const ContentCache *
SourceManager::getOrCreateContentCache(const FileEntry *FileEnt,
                                       bool isSystemFile) {
  assert(FileEnt && "Didn't specify a file entry to use?");
  ContentCache *&Entry = FileInfos[FileEnt];
  if (Entry) return Entry;
  Entry = ContentCacheAlloc.Allocate<ContentCache>();
  if (OverriddenFilesInfo) {
    llvm::DenseMap<const FileEntry *, const FileEntry *>::iterator
        overI = OverriddenFilesInfo->OverriddenFiles.find(FileEnt);
    if (overI == OverriddenFilesInfo->OverriddenFiles.end())
      new (Entry) ContentCache(FileEnt);
    else
      new (Entry) ContentCache(OverridenFilesKeepOriginalName ? FileEnt
                                                              : overI->second,
                               overI->second);
  } else {
    new (Entry) ContentCache(FileEnt);
  }
  Entry->IsSystemFile = isSystemFile;
  Entry->IsTransient = FilesAreTransient;
  return Entry;
}
const ContentCache * SourceManager :: getOrCreateContentCache ( const FileEntry * FileEnt , bool isSystemFile ) { assert ( FileEnt && " " ) ; ContentCache * & Entry = FileInfos [ FileEnt ] ; if ( Entry ) return Entry ; Entry = ContentCacheAlloc . Allocate < ContentCache > ( ) ; if ( OverriddenFilesInfo ) { llvm :: DenseMap < const FileEntry * , const FileEntry * > :: iterator overI = OverriddenFilesInfo -> OverriddenFiles . find ( FileEnt ) ; if ( overI == OverriddenFilesInfo -> OverriddenFiles . end ( ) ) new ( Entry ) ContentCache ( FileEnt ) ; else new ( Entry ) ContentCache ( OverridenFilesKeepOriginalName ? FileEnt : overI -> second , overI -> second ) ; } else { new ( Entry ) ContentCache ( FileEnt ) ; } Entry -> IsSystemFile = isSystemFile ; Entry -> IsTransient = FilesAreTransient ; return Entry ; }
getOrCreateContentCache - Create or return a cached ContentCache for the
specified file.
getOrCreateContentCache - Create or return a cached ContentCache for the specified file .
// Do we already have information about this file? // Nope, create a new Cache entry. // If the file contents are overridden with contents from another file, // pass that file to ContentCache.