r216697 - Don't create a null reference in ASTUnit::LoadFromCommandLine.

Nico Weber thakis at chromium.org
Thu Aug 28 19:38:52 PDT 2014


Nice!


On Thu, Aug 28, 2014 at 4:51 PM, Alexey Samsonov <vonosmas at gmail.com> wrote:

> Author: samsonov
> Date: Thu Aug 28 18:51:01 2014
> New Revision: 216697
>
> URL: http://llvm.org/viewvc/llvm-project?rev=216697&view=rev
> Log:
> Don't create a null reference in ASTUnit::LoadFromCommandLine.
>
> This change is the last in the pack of five commits
> (also see r216691, r216694, r216695, and r216696) that reduces the number
> of test failures in "check-clang" invocation in UBSan bootstrap
> from 2443 down to 5.
>
> Modified:
>     cfe/trunk/lib/Frontend/ASTUnit.cpp
>
> Modified: cfe/trunk/lib/Frontend/ASTUnit.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/ASTUnit.cpp?rev=216697&r1=216696&r2=216697&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/Frontend/ASTUnit.cpp (original)
> +++ cfe/trunk/lib/Frontend/ASTUnit.cpp Thu Aug 28 18:51:01 2014
> @@ -1985,7 +1985,6 @@ ASTUnit *ASTUnit::LoadFromCommandLine(
>    AST.reset(new ASTUnit(false));
>    ConfigureDiags(Diags, ArgBegin, ArgEnd, *AST, CaptureDiagnostics);
>    AST->Diagnostics = Diags;
> -  Diags = nullptr; // Zero out now to ease cleanup during crash recovery.
>    AST->FileSystemOpts = CI->getFileSystemOpts();
>    IntrusiveRefCntPtr<vfs::FileSystem> VFS =
>        createVFSFromCompilerInvocation(*CI, *Diags);
> @@ -2004,7 +2003,9 @@ ASTUnit *ASTUnit::LoadFromCommandLine(
>    AST->Invocation = CI;
>    if (ForSerialization)
>      AST->WriterData.reset(new ASTWriterData());
> -  CI = nullptr; // Zero out now to ease cleanup during crash recovery.
> +  // Zero out now to ease cleanup during crash recovery.
> +  CI = nullptr;
> +  Diags = nullptr;
>
>    // Recover resources if we crash before exiting this method.
>    llvm::CrashRecoveryContextCleanupRegistrar<ASTUnit>
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140828/6196f627/attachment.html>


More information about the cfe-commits mailing list