r241579 - Appease MSVC 2013 a few more times, which was complaining about a syntax error with an unexpected close curly brace. For some reason, the range-based for loop requires curly braces to compile in MSVC.

Aaron Ballman aaron at aaronballman.com
Tue Jul 7 07:35:32 PDT 2015


On Tue, Jul 7, 2015 at 10:29 AM, Sebastian Redl
<sebastian.redl at getdesigned.at> wrote:
>
>
> On 07.07.2015 15:19, Aaron Ballman wrote:
>>
>> Author: aaronballman
>> Date: Tue Jul  7 08:19:10 2015
>> New Revision: 241579
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=241579&view=rev
>> Log:
>> Appease MSVC 2013 a few more times, which was complaining about a syntax
>> error with an unexpected close curly brace. For some reason, the range-based
>> for loop requires curly braces to compile in MSVC.
>>
>> Modified:
>>      cfe/trunk/include/clang/AST/DataRecursiveASTVisitor.h
>>      cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
>>
>> Modified: cfe/trunk/include/clang/AST/DataRecursiveASTVisitor.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DataRecursiveASTVisitor.h?rev=241579&r1=241578&r2=241579&view=diff
>>
>> ==============================================================================
>> --- cfe/trunk/include/clang/AST/DataRecursiveASTVisitor.h (original)
>> +++ cfe/trunk/include/clang/AST/DataRecursiveASTVisitor.h Tue Jul  7
>> 08:19:10 2015
>> @@ -940,8 +940,9 @@ DEF_TRAVERSE_TYPE(ObjCObjectType, {
>>     // type is itself.
>>     if (T->getBaseType().getTypePtr() != T)
>>       TRY_TO(TraverseType(T->getBaseType()));
>> -  for (auto typeArg : T->getTypeArgsAsWritten())
>> +  for (auto typeArg : T->getTypeArgsAsWritten()) {
>>       TRY_TO(TraverseType(typeArg));
>> +  }
>>   })
>>
>
>
> That's interesting. What does TRY_TO expand to? This looks like something a
> bug report could be written about.

#define TRY_TO(CALL_EXPR)                                                      \
  do {                                                                         \
    if (!getDerived().CALL_EXPR)                                               \
      return false;                                                            \
  } while (0)

While reproducible in VS2013, the issue is resolved in VS 2015.

~Aaron



More information about the cfe-commits mailing list