Clarify the ownership semantics of the Diagnostic object used by
ASTUnit. Previously, we would end up with use-after-free errors because the Diagnostic object would be creating in one place (say, CIndex) and its ownership would not be transferred into the ASTUnit. Fixes <rdar://problem/7818608>. llvm-svn: 100464
This commit is contained in:
@@ -37,7 +37,8 @@ void ASTMergeAction::ExecuteAction() {
|
||||
CI.getDiagnostics().SetArgToStringFn(&FormatASTNodeDiagnosticArgument,
|
||||
&CI.getASTContext());
|
||||
for (unsigned I = 0, N = ASTFiles.size(); I != N; ++I) {
|
||||
ASTUnit *Unit = ASTUnit::LoadFromPCHFile(ASTFiles[I], CI.getDiagnostics(),
|
||||
ASTUnit *Unit = ASTUnit::LoadFromPCHFile(ASTFiles[I],
|
||||
UnownedDiag(CI.getDiagnostics()),
|
||||
false);
|
||||
if (!Unit)
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user