[cfe-commits] r74214 - /cfe/trunk/tools/index-test/index-test.cpp
Argiris Kirtzidis
akyrtzi at gmail.com
Thu Jun 25 15:15:12 PDT 2009
Author: akirtzidis
Date: Thu Jun 25 17:15:12 2009
New Revision: 74214
URL: http://llvm.org/viewvc/llvm-project?rev=74214&view=rev
Log:
Check that index-test uses an up-to-date AST file.
Modified:
cfe/trunk/tools/index-test/index-test.cpp
Modified: cfe/trunk/tools/index-test/index-test.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/index-test/index-test.cpp?rev=74214&r1=74213&r2=74214&view=diff
==============================================================================
--- cfe/trunk/tools/index-test/index-test.cpp (original)
+++ cfe/trunk/tools/index-test/index-test.cpp Thu Jun 25 17:15:12 2009
@@ -88,6 +88,18 @@
if (!PointAtLocation.empty()) {
const std::string &Filename = PointAtLocation[0].FileName;
const FileEntry *File = FileMgr.getFile(Filename);
+
+ // Safety check. Using an out-of-date AST file will only lead to crashes
+ // or incorrect results.
+ // FIXME: Check all the source files that make up the AST file.
+ const FileEntry *ASTFile = FileMgr.getFile(InFile);
+ if (File->getModificationTime() > ASTFile->getModificationTime()) {
+ llvm::errs() << "[" << InFile << "] Error: " <<
+ "Pointing at a source file which was modified after creating "
+ "the AST file\n";
+ return 1;
+ }
+
if (File == 0) {
llvm::errs() << "File '" << Filename << "' does not exist\n";
return 1;
More information about the cfe-commits
mailing list