When indexing a module file, for the ppIncludedFile callback give
an invalid location if the location points to the synthetic buffer
for the module input.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165592 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Serialization/ASTReader.cpp b/lib/Serialization/ASTReader.cpp
index d060e79..4e6673b 100644
--- a/lib/Serialization/ASTReader.cpp
+++ b/lib/Serialization/ASTReader.cpp
@@ -63,7 +63,8 @@
ASTReaderListener::~ASTReaderListener() {}
bool
-PCHValidator::ReadLanguageOptions(const LangOptions &LangOpts) {
+PCHValidator::ReadLanguageOptions(const ModuleFile &M,
+ const LangOptions &LangOpts) {
const LangOptions &PPLangOpts = PP.getLangOpts();
#define LANGOPT(Name, Bits, Default, Description) \
@@ -100,7 +101,7 @@
return false;
}
-bool PCHValidator::ReadTargetTriple(StringRef Triple) {
+bool PCHValidator::ReadTargetTriple(const ModuleFile &M, StringRef Triple) {
if (Triple == PP.getTargetInfo().getTriple().str())
return false;
@@ -408,7 +409,7 @@
++NumHeaderInfos;
}
-void PCHValidator::ReadCounter(unsigned Value) {
+void PCHValidator::ReadCounter(const ModuleFile &M, unsigned Value) {
PP.setCounterValue(Value);
}
@@ -1828,7 +1829,7 @@
RelocatablePCH = Record[4];
if (Listener) {
std::string TargetTriple(BlobStart, BlobLen);
- if (Listener->ReadTargetTriple(TargetTriple))
+ if (Listener->ReadTargetTriple(F, TargetTriple))
return IgnorePCH;
}
break;
@@ -1938,7 +1939,7 @@
}
case LANGUAGE_OPTIONS:
- if (ParseLanguageOptions(Record) && !DisableValidation)
+ if (ParseLanguageOptions(F, Record) && !DisableValidation)
return IgnorePCH;
break;
@@ -2083,7 +2084,7 @@
case PP_COUNTER_VALUE:
if (!Record.empty() && Listener)
- Listener->ReadCounter(Record[0]);
+ Listener->ReadCounter(F, Record[0]);
break;
case FILE_SORTED_DECLS:
@@ -3430,7 +3431,8 @@
/// them to the AST listener if one is set.
///
/// \returns true if the listener deems the file unacceptable, false otherwise.
-bool ASTReader::ParseLanguageOptions(const RecordData &Record) {
+bool ASTReader::ParseLanguageOptions(const ModuleFile &M,
+ const RecordData &Record) {
if (Listener) {
LangOptions LangOpts;
unsigned Idx = 0;
@@ -3447,7 +3449,7 @@
unsigned Length = Record[Idx++];
LangOpts.CurrentModule.assign(Record.begin() + Idx,
Record.begin() + Idx + Length);
- return Listener->ReadLanguageOptions(LangOpts);
+ return Listener->ReadLanguageOptions(M, LangOpts);
}
return false;