[cfe-dev] Default argument promotion should promote functions/arrays

Steve Naroff snaroff at apple.com
Mon Jan 28 17:34:45 PST 2008


On Jan 28, 2008, at 5:26 PM, Eli Friedman wrote:

> Testcase:
> int a();
> int b() {
> a("asdf");
> }
>
> Run clang -ast-dump to see the issue.
>
> Patch attached.
>

Eli,

The AST dumps look identical (see below).

What am I missing?

snaroff

[snaroff:llvm/tools/clang] snarofflocal% ../../Debug/bin/clang -ast- 
dump eli.c
typedef char *__builtin_va_list;

int a();

int b()
(CompoundStmt 0x906350 <eli.c:3:9, line:5:1>
   (CallExpr 0x9062f0 <line:4:1, col:9> 'int'
     (ImplicitCastExpr 0x906340 <col:1> 'int (*)()'
       (DeclRefExpr 0x9062b0 <col:1> 'int ()' FunctionDecl='a'  
0x9025e0))
     (StringLiteral 0x9062d0 <col:3> 'char *' "asdf")))

[snaroff:llvm/tools/clang] snarofflocal% cp /var/folders/IN/ 
IN1spQWVEDm8jU4ww+SauE+++TI/-Tmp-/com.apple.mail.drag- 
T0x7124b0.tmp.OTiSyY/unnamedargpromotionfix.txt .
[snaroff:llvm/tools/clang] snarofflocal% patch -p0 <  
unnamedargpromotionfix.txt
patching file Sema/SemaExpr.cpp
[snaroff:llvm/tools/clang] snarofflocal% make
make[1]: Nothing to be done for `all'.
make[1]: Nothing to be done for `all'.
make[1]: Nothing to be done for `all'.
make[1]: Nothing to be done for `all'.
llvm[1]: Compiling SemaExpr.cpp for Debug build
llvm[1]: Building Debug Archive Library libclangSEMA.a
make[1]: Nothing to be done for `all'.
make[1]: Nothing to be done for `all'.
make[1]: Nothing to be done for `all'.
llvm[1]: Linking Debug executable clang
llvm[1]: ======= Finished Linking Debug Executable clang
[snaroff:llvm/tools/clang] snarofflocal% ../../Debug/bin/clang -ast- 
dump eli.c                      typedef char *__builtin_va_list;

int a();

int b()
(CompoundStmt 0x906350 <eli.c:3:9, line:5:1>
   (CallExpr 0x9062f0 <line:4:1, col:9> 'int'
     (ImplicitCastExpr 0x906340 <col:1> 'int (*)()'
       (DeclRefExpr 0x9062b0 <col:1> 'int ()' FunctionDecl='a'  
0x9025e0))
     (StringLiteral 0x9062d0 <col:3> 'char *' "asdf")))

[snaroff:llvm/tools/clang] snarofflocal%

> -Eli
> < 
> unnamedargpromotionfix 
> .txt>_______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev




More information about the cfe-dev mailing list