On Feb 24, 2012, at 3:02 PM, Eli Friedman <[email protected]> wrote:

> On Fri, Feb 24, 2012 at 2:40 PM, Douglas Gregor <[email protected]> wrote:
>> Author: dgregor
>> Date: Fri Feb 24 16:40:36 2012
>> New Revision: 151403
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=151403&view=rev
>> Log:
>> For the purposes of building LLVM types, a forward-declared
>> enumeration type with a fixed underlying type is complete. Fixes
>> <rdar://problem/10916155>.
>> 
>> Added:
>>    cfe/trunk/test/CodeGenCXX/forward-enum.cpp
>> Modified:
>>    cfe/trunk/lib/CodeGen/CodeGenTypes.cpp
>> 
>> Modified: cfe/trunk/lib/CodeGen/CodeGenTypes.cpp
>> URL: 
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenTypes.cpp?rev=151403&r1=151402&r2=151403&view=diff
>> ==============================================================================
>> --- cfe/trunk/lib/CodeGen/CodeGenTypes.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/CodeGenTypes.cpp Fri Feb 24 16:40:36 2012
>> @@ -199,8 +199,13 @@
>> 
>>   // If it's a tagged type used by-value, but is just a forward decl, we 
>> can't
>>   // convert it.  Note that getDefinition()==0 is not the same as 
>> !isDefinition.
>> -  if (TT->getDecl()->getDefinition() == 0)
>> +  // The exception is an enumeration type with a fixed underlying type; 
>> these
>> +  // can be converted even if they are forward declarations.
>> +  if (TT->getDecl()->getDefinition() == 0 &&
>> +      !(isa<EnumDecl>(TT->getDecl()) &&
>> +        cast<EnumDecl>(TT->getDecl())->isFixed())) {
>>     return false;
>> +  }
> 
> It might be a bit more readable to use TT->isIncompleteType() here.

Good point. r151412.

        - Doug
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to