[PATCH] Fix fallout from r219557

Anton Korobeynikov anton at korobeynikov.info
Tue Nov 11 13:04:30 PST 2014


The AST before (e.g. generated by clang from XCode release) is:

```
`-FunctionDecl 0x102850b40 <line:4:1, line:7:1> main 'int (void)'
  `-CompoundStmt 0x102850e98 <line:4:16, line:7:1>
    |-ConditionalOperator 0x102850e28 <line:5:3, col:32> '_Complex long double'
    | |-IntegerLiteral 0x102850c38 <col:3> 'int' 0
    | |-ImplicitCastExpr 0x102850e10 <col:7, col:17> '_Complex long double' <FloatingRealToComplex>
    | | `-CallExpr 0x102850ce0 <col:7, col:17> 'long double'
    | |   |-ImplicitCastExpr 0x102850cc8 <col:7> 'long double (*)(long double)' <FunctionToPointerDecay>
    | |   | `-DeclRefExpr 0x102850c58 <col:7> 'long double (long double)' Function 0x102850970 'sqrtl' 'long double (long double)'
    | |   `-ImplicitCastExpr 0x102850d10 <col:13> 'long double' <FloatingCast>
    | |     `-FloatingLiteral 0x102850c80 <col:13> 'float' 2.000000e+00
    | `-CallExpr 0x102850db0 <col:21, col:32> '_Complex long double'
    |   |-ImplicitCastExpr 0x102850d98 <col:21> '_Complex long double (*)(_Complex long double)' <FunctionToPointerDecay>
    |   | `-DeclRefExpr 0x102850d28 <col:21> '_Complex long double (_Complex long double)' Function 0x10280c400 'csqrtl' '_Complex long double (_Complex long double)'
    |   `-ImplicitCastExpr 0x102850df8 <col:28> '_Complex long double' <FloatingRealToComplex>
    |     `-ImplicitCastExpr 0x102850de0 <col:28> 'long double' <FloatingCast>
    |       `-FloatingLiteral 0x102850d50 <col:28> 'float' 2.000000e+00
    `-ReturnStmt 0x102850e78 <line:6:3, col:10>
      `-IntegerLiteral 0x102850e58 <col:10> 'int' 0
```

Note the additional 
```
-ImplicitCastExpr 0x102850e10 <col:7, col:17> '_Complex long double' <FloatingRealToComplex>
```

Prior to r219557 the conversion was done inside handleOtherComplexFloatConversion() which was a helper inside UsualArithmeticConversion(). Now the functionality was refactored into handleComplexFloatConversion(), but the it inserts conversions only for types of different orders (e.g. it would promote float to _Complex long double).

REPOSITORY
  rL LLVM

http://reviews.llvm.org/D6217






More information about the cfe-commits mailing list