Make 'LangOptions' in CompilerInvocation a heap-allocated, reference counted...
Make 'LangOptions' in CompilerInvocation a heap-allocated, reference counted object. I discovered that llvm::RefCountedBase<T> has a bug where the reference count is copied in the copy constructor, which means that there were cases when the CompilerInvocation objects created by ASTUnit were actually leaked. When I fixed that bug locally, it showed that a whole bunch of code assumed that the LangOptions object that was part of CompilerInvocation was still alive. By making it heap-allocated and reference counted, we can keep it around after the CompilerInvocation object goes away. As part of this change, change CompilerInvocation:getLangOptions() to return a pointer, acting as another clue that this object may outlive the CompilerInvocation object. This commit doesn't fix the CompilerInvocation leak itself. That will come when I commit the fix to llvm::RefCountedBase<T> to mainline LLVM. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144930 91177308-0d34-0410-b5e6-96231b3b80d8
Showing
- include/clang/Basic/LangOptions.h 2 additions, 1 deletioninclude/clang/Basic/LangOptions.h
- include/clang/Frontend/ASTUnit.h 2 additions, 0 deletionsinclude/clang/Frontend/ASTUnit.h
- include/clang/Frontend/CompilerInstance.h 2 additions, 2 deletionsinclude/clang/Frontend/CompilerInstance.h
- include/clang/Frontend/CompilerInvocation.h 7 additions, 5 deletionsinclude/clang/Frontend/CompilerInvocation.h
- lib/ARCMigrate/ARCMT.cpp 12 additions, 11 deletionslib/ARCMigrate/ARCMT.cpp
- lib/Frontend/ASTUnit.cpp 3 additions, 2 deletionslib/Frontend/ASTUnit.cpp
- lib/Frontend/CompilerInstance.cpp 3 additions, 3 deletionslib/Frontend/CompilerInstance.cpp
- lib/Frontend/CompilerInvocation.cpp 20 additions, 5 deletionslib/Frontend/CompilerInvocation.cpp
- tools/arcmt-test/arcmt-test.cpp 3 additions, 3 deletionstools/arcmt-test/arcmt-test.cpp
- tools/libclang/Indexing.cpp 1 addition, 1 deletiontools/libclang/Indexing.cpp
Loading
Please register or sign in to comment