forked from OSchip/llvm-project
parent
8263ffb268
commit
c6317dbf5e
|
@ -264,7 +264,10 @@ namespace clang {
|
||||||
INPUT_FILE_OFFSETS = 7,
|
INPUT_FILE_OFFSETS = 7,
|
||||||
|
|
||||||
/// \brief Record code for the diagnostic options table.
|
/// \brief Record code for the diagnostic options table.
|
||||||
DIAGNOSTIC_OPTIONS = 8
|
DIAGNOSTIC_OPTIONS = 8,
|
||||||
|
|
||||||
|
/// \brief Record code for the filesystem options table.
|
||||||
|
FILE_SYSTEM_OPTIONS = 9
|
||||||
};
|
};
|
||||||
|
|
||||||
/// \brief Record types that occur within the input-files block
|
/// \brief Record types that occur within the input-files block
|
||||||
|
|
|
@ -130,6 +130,15 @@ public:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// \brief Receives the file system options.
|
||||||
|
///
|
||||||
|
/// \returns true to indicate the file system options are invalid, or false
|
||||||
|
/// otherwise.
|
||||||
|
virtual bool ReadFileSystemOptions(const FileSystemOptions &FSOpts,
|
||||||
|
bool Complain) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/// \brief Receives the contents of the predefines buffer.
|
/// \brief Receives the contents of the predefines buffer.
|
||||||
///
|
///
|
||||||
/// \param Buffers Information about the predefines buffers.
|
/// \param Buffers Information about the predefines buffers.
|
||||||
|
@ -925,6 +934,8 @@ private:
|
||||||
ASTReaderListener &Listener);
|
ASTReaderListener &Listener);
|
||||||
static bool ParseDiagnosticOptions(const RecordData &Record, bool Complain,
|
static bool ParseDiagnosticOptions(const RecordData &Record, bool Complain,
|
||||||
ASTReaderListener &Listener);
|
ASTReaderListener &Listener);
|
||||||
|
static bool ParseFileSystemOptions(const RecordData &Record, bool Complain,
|
||||||
|
ASTReaderListener &Listener);
|
||||||
|
|
||||||
struct RecordLocation {
|
struct RecordLocation {
|
||||||
RecordLocation(ModuleFile *M, uint64_t O)
|
RecordLocation(ModuleFile *M, uint64_t O)
|
||||||
|
|
|
@ -2015,6 +2015,16 @@ ASTReader::ReadControlBlock(ModuleFile &F,
|
||||||
return ConfigurationMismatch;
|
return ConfigurationMismatch;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case FILE_SYSTEM_OPTIONS: {
|
||||||
|
bool Complain = (ClientLoadCapabilities & ARR_ConfigurationMismatch)==0;
|
||||||
|
if (Listener && &F == *ModuleMgr.begin() &&
|
||||||
|
ParseFileSystemOptions(Record, Complain, *Listener) &&
|
||||||
|
!DisableValidation)
|
||||||
|
return ConfigurationMismatch;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case ORIGINAL_FILE:
|
case ORIGINAL_FILE:
|
||||||
F.OriginalSourceFileID = FileID::get(Record[0]);
|
F.OriginalSourceFileID = FileID::get(Record[0]);
|
||||||
F.ActualOriginalSourceFileName.assign(BlobStart, BlobLen);
|
F.ActualOriginalSourceFileName.assign(BlobStart, BlobLen);
|
||||||
|
@ -3835,6 +3845,14 @@ bool ASTReader::ParseDiagnosticOptions(const RecordData &Record, bool Complain,
|
||||||
return Listener.ReadDiagnosticOptions(DiagOpts, Complain);
|
return Listener.ReadDiagnosticOptions(DiagOpts, Complain);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ASTReader::ParseFileSystemOptions(const RecordData &Record, bool Complain,
|
||||||
|
ASTReaderListener &Listener) {
|
||||||
|
FileSystemOptions FSOpts;
|
||||||
|
unsigned Idx = 0;
|
||||||
|
FSOpts.WorkingDir = ReadString(Record, Idx);
|
||||||
|
return Listener.ReadFileSystemOptions(FSOpts, Complain);
|
||||||
|
}
|
||||||
|
|
||||||
std::pair<ModuleFile *, unsigned>
|
std::pair<ModuleFile *, unsigned>
|
||||||
ASTReader::getModulePreprocessedEntity(unsigned GlobalIndex) {
|
ASTReader::getModulePreprocessedEntity(unsigned GlobalIndex) {
|
||||||
GlobalPreprocessedEntityMapType::iterator
|
GlobalPreprocessedEntityMapType::iterator
|
||||||
|
|
|
@ -777,7 +777,8 @@ void ASTWriter::WriteBlockInfoBlock() {
|
||||||
RECORD(ORIGINAL_PCH_DIR);
|
RECORD(ORIGINAL_PCH_DIR);
|
||||||
RECORD(INPUT_FILE_OFFSETS);
|
RECORD(INPUT_FILE_OFFSETS);
|
||||||
RECORD(DIAGNOSTIC_OPTIONS);
|
RECORD(DIAGNOSTIC_OPTIONS);
|
||||||
|
RECORD(FILE_SYSTEM_OPTIONS);
|
||||||
|
|
||||||
BLOCK(INPUT_FILES_BLOCK);
|
BLOCK(INPUT_FILES_BLOCK);
|
||||||
RECORD(INPUT_FILE);
|
RECORD(INPUT_FILE);
|
||||||
|
|
||||||
|
@ -1084,6 +1085,13 @@ void ASTWriter::WriteControlBlock(ASTContext &Context, StringRef isysroot,
|
||||||
// are generally transient files and will almost always be overridden.
|
// are generally transient files and will almost always be overridden.
|
||||||
Stream.EmitRecord(DIAGNOSTIC_OPTIONS, Record);
|
Stream.EmitRecord(DIAGNOSTIC_OPTIONS, Record);
|
||||||
|
|
||||||
|
// File system options.
|
||||||
|
Record.clear();
|
||||||
|
const FileSystemOptions &FSOpts
|
||||||
|
= Context.getSourceManager().getFileManager().getFileSystemOptions();
|
||||||
|
AddString(FSOpts.WorkingDir, Record);
|
||||||
|
Stream.EmitRecord(FILE_SYSTEM_OPTIONS, Record);
|
||||||
|
|
||||||
// Original file name and file ID
|
// Original file name and file ID
|
||||||
SourceManager &SM = Context.getSourceManager();
|
SourceManager &SM = Context.getSourceManager();
|
||||||
if (const FileEntry *MainFile = SM.getFileEntryForID(SM.getMainFileID())) {
|
if (const FileEntry *MainFile = SM.getFileEntryForID(SM.getMainFileID())) {
|
||||||
|
|
Loading…
Reference in New Issue