[cfe-commits] [PATCH] Allow PCHReader to be used without having a pre-initialized Preprocessor
Argyrios Kyrtzidis
kyrtzidis at apple.com
Thu Jun 18 17:05:56 PDT 2009
On Jun 18, 2009, at 10:14 AM, Douglas Gregor wrote:
>
> On Jun 17, 2009, at 6:19 PM, Argyrios Kyrtzidis wrote:
>
>> Currently PCHReader depends on getting a pre-initialized
>> Preprocessor.
>> The attached patch modifies PCHReader so that we can use it to load
>> a .pch file, get the information we need and *afterwards*
>> initialize a Preprocessor with that info.
>
> Looks good. I have one question about these two changes:
>
> @@ -1116,7 +1233,8 @@
> (const unsigned char *)IdentifierTableData +
> Record[0],
> (const unsigned char *)IdentifierTableData,
> PCHIdentifierLookupTrait(*this));
> - PP.getIdentifierTable().setExternalIdentifierLookup(this);
> + if (PP)
> + PP->getIdentifierTable().setExternalIdentifierLookup(this);
> }
> break;
>
> @@ -1127,7 +1245,8 @@
> }
> IdentifierOffsets = (const uint32_t *)BlobStart;
> IdentifiersLoaded.resize(Record[0]);
> - PP.getHeaderSearchInfo().SetExternalLookup(this);
> + if (PP)
> + PP->getHeaderSearchInfo().SetExternalLookup(this);
> break;
>
> case pch::EXTERNAL_DEFINITIONS:
>
> If PP ends up being NULL, then these two external lookup hooks won't
> be added. I suspect that we want to add them int
> PCHReader::InitializeContext.
Done & commited.
Thanks for reviewing!
-Argiris
More information about the cfe-commits
mailing list