[cfe-commits] r77291 - in /cfe/trunk: include/clang/AST/ASTContext.h include/clang/Basic/Builtins.def include/clang/Basic/DiagnosticSemaKinds.td include/clang/Frontend/PCHBitCodes.h lib/AST/ASTContext.cpp lib/Frontend/PCHReader.cpp lib/Frontend/PCHWriter.cpp lib/Sema/SemaDecl.cpp

Chris Lattner clattner at apple.com
Tue Jul 28 15:57:09 PDT 2009


On Jul 28, 2009, at 3:42 PM, Chris Lattner wrote:

>>  }
>> +  case 'J': {
>> +    if (Signed) {
>> +      Type = Context.getsigjmp_bufType();
>> +      if (Type.isNull()) {
>> +        Error = ASTContext::GE_Missing_sigjmp_buf;
>> +        return QualType();
>> +      } else {
>
> No need for "else" after return.
>
>> +        break;
>> +      }
>> +    } else {
>
> or break.
>
>> +      Type = Context.getjmp_bufType();
>> +      if (Type.isNull()) {
>> +        Error = ASTContext::GE_Missing_jmp_buf;
>> +        return QualType();
>> +      } else {
>> +        break;
>
> likewise.

FWIW, I explicitly added this to the coding standards:
http://llvm.org/docs/CodingStandards.html#hl_else_after_return

Please use something like:

case 'J':
     if (Signed)
       Type = Context.getsigjmp_bufType();
     else
       Type = Context.getjmp_bufType();

     if (Type.isNull()) {
       Error = Signed ? ASTContext::GE_Missing_sigjmp_buf :
                        ASTContext::GE_Missing_jmp_buf;
       return QualType();
     }
     break;

-Chris



More information about the cfe-commits mailing list