[cfe-commits] r139514 - /cfe/trunk/lib/CodeGen/CGDebugInfo.cpp

Ted Kremenek kremenek at apple.com
Mon Sep 12 11:34:53 PDT 2011


Hi Devang,

This seems like bad form.  Can you just enumerate all the cases?  Adding a "default" with an assert(0) just turns something that could be caught by a compile-time check into a runtime assertion.

Ted

On Sep 12, 2011, at 11:24 AM, Devang Patel wrote:

> Author: dpatel
> Date: Mon Sep 12 13:24:46 2011
> New Revision: 139514
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=139514&view=rev
> Log:
> Add an assert so that new builtins do not sneak without proper debug info.
> 
> Modified:
>    cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
> 
> Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=139514&r1=139513&r2=139514&view=diff
> ==============================================================================
> --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Mon Sep 12 13:24:46 2011
> @@ -290,6 +290,8 @@
>   const char *BTName = NULL;
>   switch (BT->getKind()) {
>   default:
> +    assert(0 && "Unexpected builtin");
> +    return llvm::DIType();
>   case BuiltinType::Void:
>     return llvm::DIType();
>   case BuiltinType::ObjCClass:
> 
> 
> _______________________________________________
> 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