[cfe-commits] r93198 - /cfe/trunk/lib/Sema/SemaType.cpp

Douglas Gregor dgregor at apple.com
Mon Jan 11 15:01:42 PST 2010


On Jan 11, 2010, at 2:33 PM, David Chisnall wrote:

> Author: theraven
> Date: Mon Jan 11 16:33:19 2010
> New Revision: 93198
>
> URL: http://llvm.org/viewvc/llvm-project?rev=93198&view=rev
> Log:
> Allow VLAs in C++ if in GNU mode (GNU C++ permits them).  Clang can  
> now compile LanguageKit, although the resulting code crashes  
> (although not in any of the functions that use VLAs).

As noted in the PR about this

	http://llvm.org/bugs/show_bug.cgi?id=5678

there is CodeGen work that needs to be done to make VLAs work in C++,  
and that CodeGen work needs to happen before we enable VLAs in C++.  
Otherwise, people using VLAs (or accidentally using VLAs) will end up  
tracking down annoying miscompiles for a feature that we know doesn't  
work. Not good.

Of course, there's also the problem that we're not even certain that  
we even *want* to ever support VLAs in C++. However, having a proper  
implementation that generates correct code goes a long way to  
answering "yes".

In any case, please revert this change until you or someone else has  
some working CodeGen support for VLAs, so that we know they aren't  
totally broken.

	- Doug

> Modified:
>    cfe/trunk/lib/Sema/SemaType.cpp
>
> Modified: cfe/trunk/lib/Sema/SemaType.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=93198&r1=93197&r2=93198&view=diff
>
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- cfe/trunk/lib/Sema/SemaType.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaType.cpp Mon Jan 11 16:33:19 2010
> @@ -651,8 +651,10 @@
>     }
>     T = Context.getConstantArrayType(T, ConstVal, ASM, Quals);
>   }
> -  // If this is not C99, extwarn about VLA's and C99 array size  
> modifiers.
> -  if (!getLangOptions().C99) {
> +  // If this is not C99 or C++ with GNU extenisons, extwarn about  
> VLA's and C99
> +  // array size modifiers.
> +  if (!getLangOptions().C99 &&
> +      !(getLangOptions().CPlusPlus && getLangOptions().GNUMode)) {
>     if (ArraySize && !ArraySize->isTypeDependent() &&
>         !ArraySize->isValueDependent() &&
>         !ArraySize->isIntegerConstantExpr(Context))
>
>
> _______________________________________________
> 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