Change ASTUnit::LoadFromCommandLine to return a std::unique_ptr instead of a +1 pointer, fixing a leak in the unit test LoadFromCommandLineWorkingDirectory.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
Gotta love return AST.release() being passed directly back into std::unique_ptr<ASTUnit>(...). Thanks for fixing!
clang/tools/libclang/CIndex.cpp | ||
---|---|---|
3965 | Nit: the style guidance for auto in llvm is "type is already obvious from the context". Since I don't think that's obvious here (in particular, this code would have compiled with the raw pointer return type), and the type name will not be verbose, I think we should keep std::unique_ptr<ASTUnit>. Same for the other calls below. |
clang/tools/libclang/CIndex.cpp | ||
---|---|---|
3965 | Fair enough, updated |
Nit: the style guidance for auto in llvm is "type is already obvious from the context". Since I don't think that's obvious here (in particular, this code would have compiled with the raw pointer return type), and the type name will not be verbose, I think we should keep std::unique_ptr<ASTUnit>. Same for the other calls below.