diff --git a/clang/include/clang/Basic/SourceManager.h b/clang/include/clang/Basic/SourceManager.h index ce33423551039..ab3a6d749597a 100644 --- a/clang/include/clang/Basic/SourceManager.h +++ b/clang/include/clang/Basic/SourceManager.h @@ -724,7 +724,7 @@ class SourceManager : public RefCountedBase { /// /// Negative FileIDs are indexes into this table. To get from ID to an index, /// use (-ID - 2). - llvm::PagedVector LoadedSLocEntryTable; + llvm::PagedVector LoadedSLocEntryTable; /// For each allocation in LoadedSLocEntryTable, we keep the first FileID. /// We assume exactly one allocation per AST file, and use that to determine diff --git a/llvm/include/llvm/ADT/PagedVector.h b/llvm/include/llvm/ADT/PagedVector.h index 3fcca6d82cb33..52ecd0bb0ba11 100644 --- a/llvm/include/llvm/ADT/PagedVector.h +++ b/llvm/include/llvm/ADT/PagedVector.h @@ -84,7 +84,7 @@ template class PagedVector { assert(Index / PageSize < PageToDataPtrs.size()); T *&PagePtr = PageToDataPtrs[Index / PageSize]; // If the page was not yet allocated, allocate it. - if (!PagePtr) { + if (LLVM_UNLIKELY(!PagePtr)) { PagePtr = Allocator.getPointer()->template Allocate(PageSize); // We need to invoke the default constructor on all the elements of the // page.