r230649 - Patch to prevent crash when default argument expression

jahanian fjahanian at apple.com
Thu Feb 26 12:06:45 PST 2015


Yes, it needs a test case. It is from a very large program involving templates and it will take time
for me to reduce it. In the meantime, it is a goodness to check for a pointer which will be 
dereferenced in the callee right away.

- Fariborz

> On Feb 26, 2015, at 10:35 AM, David Blaikie <dblaikie at gmail.com> wrote:
> 
> 
> 
> On Thu, Feb 26, 2015 at 9:59 AM, Fariborz Jahanian <fjahanian at apple.com <mailto:fjahanian at apple.com>> wrote:
> Author: fjahanian
> Date: Thu Feb 26 11:59:54 2015
> New Revision: 230649
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=230649&view=rev <http://llvm.org/viewvc/llvm-project?rev=230649&view=rev>
> Log:
> Patch to prevent crash when default argument expression
> is null due to its previous bad declaration, etc.
> 
> Test case?
>  
> rdar://19871240
> 
> Modified:
>     cfe/trunk/lib/Sema/SemaChecking.cpp
> 
> Modified: cfe/trunk/lib/Sema/SemaChecking.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=230649&r1=230648&r2=230649&view=diff <http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=230649&r1=230648&r2=230649&view=diff>
> ==============================================================================
> --- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaChecking.cpp Thu Feb 26 11:59:54 2015
> @@ -6774,8 +6774,11 @@ void AnalyzeImplicitConversions(Sema &S,
>        E = POE->getResultExpr();
>    }
> 
> -  if (const OpaqueValueExpr *OVE = dyn_cast<OpaqueValueExpr>(E))
> -    return AnalyzeImplicitConversions(S, OVE->getSourceExpr(), CC);
> +  if (const OpaqueValueExpr *OVE = dyn_cast<OpaqueValueExpr>(E)) {
> +    if (OVE->getSourceExpr())
> +      AnalyzeImplicitConversions(S, OVE->getSourceExpr(), CC);
> +    return;
> +  }
> 
>    // Skip past explicit casts.
>    if (isa<ExplicitCastExpr>(E)) {
> 
> 
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu <mailto:cfe-commits at cs.uiuc.edu>
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits <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/20150226/6347d12d/attachment.html>


More information about the cfe-commits mailing list