diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Lex/PreprocessingRecord.cpp | 20 | ||||
-rw-r--r-- | lib/Serialization/ASTReader.cpp | 2 |
2 files changed, 19 insertions, 3 deletions
diff --git a/lib/Lex/PreprocessingRecord.cpp b/lib/Lex/PreprocessingRecord.cpp index 34421779c9..f6036ef779 100644 --- a/lib/Lex/PreprocessingRecord.cpp +++ b/lib/Lex/PreprocessingRecord.cpp @@ -21,6 +21,22 @@ using namespace clang; ExternalPreprocessingRecordSource::~ExternalPreprocessingRecordSource() { } + +InclusionDirective::InclusionDirective(PreprocessingRecord &PPRec, + InclusionKind Kind, + llvm::StringRef FileName, + bool InQuotes, const FileEntry *File, + SourceRange Range) + : PreprocessingDirective(InclusionDirectiveKind, Range), + InQuotes(InQuotes), Kind(Kind), File(File) +{ + char *Memory + = (char*)PPRec.Allocate(FileName.size() + 1, llvm::alignOf<char>()); + memcpy(Memory, FileName.data(), FileName.size()); + Memory[FileName.size()] = 0; + this->FileName = llvm::StringRef(Memory, FileName.size()); +} + void PreprocessingRecord::MaybeLoadPreallocatedEntities() const { if (!ExternalSource || LoadedPreallocatedEntities) return; @@ -160,7 +176,7 @@ void PreprocessingRecord::InclusionDirective(SourceLocation HashLoc, } clang::InclusionDirective *ID - = new (*this) clang::InclusionDirective(Kind, FileName, !IsAngled, File, - SourceRange(HashLoc, EndLoc)); + = new (*this) clang::InclusionDirective(*this, Kind, FileName, !IsAngled, + File, SourceRange(HashLoc, EndLoc)); PreprocessedEntities.push_back(ID); } diff --git a/lib/Serialization/ASTReader.cpp b/lib/Serialization/ASTReader.cpp index 22d3cbc68f..5c947bc639 100644 --- a/lib/Serialization/ASTReader.cpp +++ b/lib/Serialization/ASTReader.cpp @@ -1555,7 +1555,7 @@ void ASTReader::ReadMacroRecord(PerFileData &F, uint64_t Offset) { InclusionDirective::InclusionKind Kind = static_cast<InclusionDirective::InclusionKind>(Record[5]); InclusionDirective *ID - = new (PPRec) InclusionDirective(Kind, + = new (PPRec) InclusionDirective(PPRec, Kind, llvm::StringRef(BlobStart, Record[3]), Record[4], File, |