[cfe-dev] LangOptions of ASTUnit::LoadFromPCHFile() goes out of scope

Argyrios Kyrtzidis kyrtzidis at apple.com
Wed Jul 22 16:16:28 PDT 2009

On Jul 21, 2009, at 12:02 AM, Argyrios Kyrtzidis wrote:

> On Jul 20, 2009, at 11:24 PM, Zhongxing Xu wrote:
>> The LangOptions LangInfo is a local variable of
>> ASTUnit::LoadFromPCHFile(). When it goes out of scope, it is still
>> referenced by the preprocessor (ASTUnit.cpp:126). I think the
>> preprocessor should refer to the LangOptions of ASTContext, which  
>> owns
>> one copy of LangOptions.
> Good catch!
> But a related question is why does the Preprocessor keep a reference
> instead of a copy ?
> Seems unintuitive; should we change Preprocessor to keep a copy like
> ASTContext ?

Changed Preprocessor to keep a copy of LangOptions.

Thanks for reporting the issue Zhongxing.


More information about the cfe-dev mailing list