@@ -70,7 +70,7 @@ FileManager::~FileManager() {
70
70
void FileManager::addStatCache (FileSystemStatCache *statCache,
71
71
bool AtBeginning) {
72
72
assert (statCache && " No stat cache provided?" );
73
- if (AtBeginning || StatCache.get () == 0 ) {
73
+ if (AtBeginning || ! StatCache.get ()) {
74
74
statCache->setNextStatCache (StatCache.release ());
75
75
StatCache.reset (statCache);
76
76
return ;
@@ -103,7 +103,7 @@ void FileManager::removeStatCache(FileSystemStatCache *statCache) {
103
103
}
104
104
105
105
void FileManager::clearStatCaches () {
106
- StatCache.reset (0 );
106
+ StatCache.reset (nullptr );
107
107
}
108
108
109
109
// / \brief Retrieve the directory that the given file name resides in.
@@ -112,10 +112,10 @@ static const DirectoryEntry *getDirectoryFromFile(FileManager &FileMgr,
112
112
StringRef Filename,
113
113
bool CacheFailure) {
114
114
if (Filename.empty ())
115
- return NULL ;
115
+ return nullptr ;
116
116
117
117
if (llvm::sys::path::is_separator (Filename[Filename.size () - 1 ]))
118
- return NULL ; // If Filename is a directory.
118
+ return nullptr ; // If Filename is a directory.
119
119
120
120
StringRef DirName = llvm::sys::path::parent_path (Filename);
121
121
// Use the current directory if file has no path component.
@@ -179,8 +179,8 @@ const DirectoryEntry *FileManager::getDirectory(StringRef DirName,
179
179
// See if there was already an entry in the map. Note that the map
180
180
// contains both virtual and real directories.
181
181
if (NamedDirEnt.getValue ())
182
- return NamedDirEnt.getValue () == NON_EXISTENT_DIR
183
- ? 0 : NamedDirEnt.getValue ();
182
+ return NamedDirEnt.getValue () == NON_EXISTENT_DIR ? nullptr
183
+ : NamedDirEnt.getValue ();
184
184
185
185
++NumDirCacheMisses;
186
186
@@ -193,11 +193,11 @@ const DirectoryEntry *FileManager::getDirectory(StringRef DirName,
193
193
194
194
// Check to see if the directory exists.
195
195
FileData Data;
196
- if (getStatValue (InterndDirName, Data, false , 0 /* directory lookup*/ )) {
196
+ if (getStatValue (InterndDirName, Data, false , nullptr /* directory lookup*/ )) {
197
197
// There's no real directory at the given path.
198
198
if (!CacheFailure)
199
199
SeenDirEntries.erase (DirName);
200
- return 0 ;
200
+ return nullptr ;
201
201
}
202
202
203
203
// It exists. See if we have already opened a directory with the
@@ -227,7 +227,7 @@ const FileEntry *FileManager::getFile(StringRef Filename, bool openFile,
227
227
// See if there is already an entry in the map.
228
228
if (NamedFileEnt.getValue ())
229
229
return NamedFileEnt.getValue () == NON_EXISTENT_FILE
230
- ? 0 : NamedFileEnt.getValue ();
230
+ ? nullptr : NamedFileEnt.getValue ();
231
231
232
232
++NumFileCacheMisses;
233
233
@@ -245,25 +245,25 @@ const FileEntry *FileManager::getFile(StringRef Filename, bool openFile,
245
245
// without a 'sys' subdir will get a cached failure result.
246
246
const DirectoryEntry *DirInfo = getDirectoryFromFile (*this , Filename,
247
247
CacheFailure);
248
- if (DirInfo == 0 ) { // Directory doesn't exist, file can't exist.
248
+ if (DirInfo == nullptr ) { // Directory doesn't exist, file can't exist.
249
249
if (!CacheFailure)
250
250
SeenFileEntries.erase (Filename);
251
-
252
- return 0 ;
251
+
252
+ return nullptr ;
253
253
}
254
254
255
255
// FIXME: Use the directory info to prune this, before doing the stat syscall.
256
256
// FIXME: This will reduce the # syscalls.
257
257
258
258
// Nope, there isn't. Check to see if the file exists.
259
- vfs::File *F = 0 ;
259
+ vfs::File *F = nullptr ;
260
260
FileData Data;
261
- if (getStatValue (InterndFileName, Data, true , openFile ? &F : 0 )) {
261
+ if (getStatValue (InterndFileName, Data, true , openFile ? &F : nullptr )) {
262
262
// There's no real file at the given path.
263
263
if (!CacheFailure)
264
264
SeenFileEntries.erase (Filename);
265
-
266
- return 0 ;
265
+
266
+ return nullptr ;
267
267
}
268
268
269
269
assert ((openFile || !F) && " undesired open file" );
@@ -314,7 +314,7 @@ FileManager::getVirtualFile(StringRef Filename, off_t Size,
314
314
NamedFileEnt.setValue (NON_EXISTENT_FILE);
315
315
316
316
addAncestorsAsVirtualDirs (Filename);
317
- FileEntry *UFE = 0 ;
317
+ FileEntry *UFE = nullptr ;
318
318
319
319
// Now that all ancestors of Filename are in the cache, the
320
320
// following call is guaranteed to find the DirectoryEntry from the
@@ -327,7 +327,7 @@ FileManager::getVirtualFile(StringRef Filename, off_t Size,
327
327
// Check to see if the file exists. If so, drop the virtual file
328
328
FileData Data;
329
329
const char *InterndFileName = NamedFileEnt.getKeyData ();
330
- if (getStatValue (InterndFileName, Data, true , 0 ) == 0 ) {
330
+ if (getStatValue (InterndFileName, Data, true , nullptr ) == 0 ) {
331
331
Data.Size = Size ;
332
332
Data.ModTime = ModificationTime;
333
333
UFE = &UniqueRealFiles[Data.UniqueID ];
0 commit comments