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
diff --git a/include/clang/Lex/Preprocessor.h b/include/clang/Lex/Preprocessor.h
index 9394441..cd202e5 100644
--- a/include/clang/Lex/Preprocessor.h
+++ b/include/clang/Lex/Preprocessor.h
@@ -507,7 +507,7 @@
/// \brief Determine if this source location refers into the file
/// 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
/// the specified Token's location, translating the token's start
diff --git a/lib/Basic/SourceManager.cpp b/lib/Basic/SourceManager.cpp
index 8cc7a84..a3e72e8 100644
--- a/lib/Basic/SourceManager.cpp
+++ b/lib/Basic/SourceManager.cpp
@@ -47,8 +47,7 @@
}
void ContentCache::replaceBuffer(const llvm::MemoryBuffer *B) {
- if (B == Buffer)
- return;
+ assert(B != Buffer);
delete Buffer;
Buffer = B;
diff --git a/lib/Lex/Preprocessor.cpp b/lib/Lex/Preprocessor.cpp
index c757820..229826a 100644
--- a/lib/Lex/Preprocessor.cpp
+++ b/lib/Lex/Preprocessor.cpp
@@ -240,7 +240,7 @@
return false;
}
-bool Preprocessor::isCodeCompletionFile(SourceLocation FileLoc) {
+bool Preprocessor::isCodeCompletionFile(SourceLocation FileLoc) const {
return CodeCompletionFile && FileLoc.isFileID() &&
SourceMgr.getFileEntryForID(SourceMgr.getFileID(FileLoc))
== CodeCompletionFile;