[cfe-commits] r107061 - /cfe/trunk/lib/Frontend/InitPreprocessor.cpp

Reid Kleckner reid.kleckner at gmail.com
Mon Jun 28 13:43:23 PDT 2010


Shouldn't you delete the assert above as well?

Reid

On Mon, Jun 28, 2010 at 1:32 PM, Ted Kremenek <kremenek at apple.com> wrote:
> Author: kremenek
> Date: Mon Jun 28 15:32:40 2010
> New Revision: 107061
>
> URL: http://llvm.org/viewvc/llvm-project?rev=107061&view=rev
> Log:
> Don't crash in InitializePreprocessor() when there is no valid PTHManager.  Fixes <rdar://problem/8098441>.
>
> Modified:
>    cfe/trunk/lib/Frontend/InitPreprocessor.cpp
>
> Modified: cfe/trunk/lib/Frontend/InitPreprocessor.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InitPreprocessor.cpp?rev=107061&r1=107060&r2=107061&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Frontend/InitPreprocessor.cpp (original)
> +++ cfe/trunk/lib/Frontend/InitPreprocessor.cpp Mon Jun 28 15:32:40 2010
> @@ -84,7 +84,8 @@
>                                   llvm::StringRef ImplicitIncludePTH) {
>   PTHManager *P = PP.getPTHManager();
>   assert(P && "No PTHManager.");
> -  const char *OriginalFile = P->getOriginalSourceFile();
> +  // Null check 'P' in the corner case where it couldn't be created.
> +  const char *OriginalFile = P ? P->getOriginalSourceFile() : 0;
>
>   if (!OriginalFile) {
>     PP.getDiagnostics().Report(diag::err_fe_pth_file_has_no_source_header)
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>




More information about the cfe-commits mailing list