Deleted Added
sdiff udiff text old ( 280031 ) new ( 283526 )
full compact
1//===--- SourceManager.cpp - Track and cache source files -----------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//

--- 2062 unchanged lines hidden (view full) ---

2071
2072 // If we exited because we found a nearest common ancestor, compare the
2073 // locations within the common file and cache them.
2074 if (LOffs.first == ROffs.first) {
2075 IsBeforeInTUCache.setCommonLoc(LOffs.first, LOffs.second, ROffs.second);
2076 return IsBeforeInTUCache.getCachedResult(LOffs.second, ROffs.second);
2077 }
2078
2079 // This can happen if a location is in a built-ins buffer.
2080 // But see PR5662.
2081 // Clear the lookup cache, it depends on a common location.
2082 IsBeforeInTUCache.clear();
2083 bool LIsBuiltins = strcmp("<built-in>",
2084 getBuffer(LOffs.first)->getBufferIdentifier()) == 0;
2085 bool RIsBuiltins = strcmp("<built-in>",
2086 getBuffer(ROffs.first)->getBufferIdentifier()) == 0;
2087 // built-in is before non-built-in
2088 if (LIsBuiltins != RIsBuiltins)
2089 return LIsBuiltins;
2090 assert(LIsBuiltins && RIsBuiltins &&
2091 "Non-built-in locations must be rooted in the main file");
2092 // Both are in built-in buffers, but from different files. We just claim that
2093 // lower IDs come first.
2094 return LOffs.first < ROffs.first;
2095}
2096
2097void SourceManager::PrintStats() const {
2098 llvm::errs() << "\n*** Source Manager Stats:\n";
2099 llvm::errs() << FileInfos.size() << " files mapped, " << MemBufferInfos.size()
2100 << " mem buffers mapped.\n";
2101 llvm::errs() << LocalSLocEntryTable.size() << " local SLocEntry's allocated ("
2102 << llvm::capacity_in_bytes(LocalSLocEntryTable)

--- 56 unchanged lines hidden ---