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

Argyrios Kyrtzidis kyrtzidis at apple.com
Tue Jul 21 00:02:50 PDT 2009


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 ?

-Argiris



More information about the cfe-dev mailing list