Minor cleanup to the code-completion-point logic suggested by Chris.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90459 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Douglas Gregor 2009-12-03 17:05:59 +00:00
Родитель c085a981ce
Коммит 109ae73ec7
3 изменённых файлов: 3 добавлений и 4 удалений

Просмотреть файл

@ -507,7 +507,7 @@ public:
/// \brief Determine if this source location refers into the file /// \brief Determine if this source location refers into the file
/// for which we are performing code completion. /// for which we are performing code completion.
bool isCodeCompletionFile(SourceLocation FileLoc); bool isCodeCompletionFile(SourceLocation FileLoc) const;
/// Diag - Forwarding function for diagnostics. This emits a diagnostic at /// Diag - Forwarding function for diagnostics. This emits a diagnostic at
/// the specified Token's location, translating the token's start /// the specified Token's location, translating the token's start

Просмотреть файл

@ -47,8 +47,7 @@ unsigned ContentCache::getSize() const {
} }
void ContentCache::replaceBuffer(const llvm::MemoryBuffer *B) { void ContentCache::replaceBuffer(const llvm::MemoryBuffer *B) {
if (B == Buffer) assert(B != Buffer);
return;
delete Buffer; delete Buffer;
Buffer = B; Buffer = B;

Просмотреть файл

@ -240,7 +240,7 @@ bool Preprocessor::SetCodeCompletionPoint(const FileEntry *File,
return false; return false;
} }
bool Preprocessor::isCodeCompletionFile(SourceLocation FileLoc) { bool Preprocessor::isCodeCompletionFile(SourceLocation FileLoc) const {
return CodeCompletionFile && FileLoc.isFileID() && return CodeCompletionFile && FileLoc.isFileID() &&
SourceMgr.getFileEntryForID(SourceMgr.getFileID(FileLoc)) SourceMgr.getFileEntryForID(SourceMgr.getFileID(FileLoc))
== CodeCompletionFile; == CodeCompletionFile;