LangOptions of ASTUnit::LoadFromPCHFile() goes out of scope

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.