this massive patch introduces a simple new abstraction: it makes
"FileID" a concept that is now enforced by the compiler's type checker
instead of yet-another-random-unsigned floating around.
This is an important distinction from the "FileID" currently tracked by
SourceLocation. *That* FileID may refer to the start of a file or to a
chunk within it. The new FileID *only* refers to the file (and its
#include stack and eventually #line data), it cannot refer to a chunk.
FileID is a completely opaque datatype to all clients, only SourceManager
is allowed to poke and prod it.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62407 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Driver/DiagChecker.cpp b/Driver/DiagChecker.cpp
index 8fa827a..6503214 100644
--- a/Driver/DiagChecker.cpp
+++ b/Driver/DiagChecker.cpp
@@ -117,12 +117,12 @@
DiagList &ExpectedNotes) {
// Create a raw lexer to pull all the comments out of the main file. We don't
// want to look in #include'd headers for expected-error strings.
- unsigned FileID = PP.getSourceManager().getMainFileID();
+ FileID FID = PP.getSourceManager().getMainFileID();
std::pair<const char*,const char*> File =
- PP.getSourceManager().getBufferData(FileID);
+ PP.getSourceManager().getBufferData(FID);
// Create a lexer to lex all the tokens of the main file in raw mode.
- Lexer RawLex(SourceLocation::getFileLoc(FileID, 0),
+ Lexer RawLex(PP.getSourceManager().getLocForStartOfFile(FID),
PP.getLangOptions(), File.first, File.second);
// Return comments as tokens, this is how we find expected diagnostics.