Page MenuHomePhabricator

[WIP][AST] Allow ExprConstant to evaluate structs in C.
Needs ReviewPublic

Authored by efriedma on Fri, Mar 13, 5:14 PM.

Details

Reviewers
nickdesaulniers
Summary

Just a proof of concept to show this works. Handles all the examples from D76096, as far as I can tell.

Diff Detail

Unit TestsFailed

TimeTest
20 msClang.CodeGen::2009-06-14-anonymous-union-init.c
Script: -- : 'RUN: at line 1'; /mnt/disks/ssd0/agent/workspace/amd64_debian_testing_clang8/build/bin/clang -cc1 -internal-isystem /mnt/disks/ssd0/agent/workspace/amd64_debian_testing_clang8/build/lib/clang/11.0.0/include -nostdsysteminc -emit-llvm < /mnt/disks/ssd0/agent/workspace/amd64_debian_testing_clang8/clang/test/CodeGen/2009-06-14-anonymous-union-init.c | grep "zeroinitializer, i16 16877"
40 msClang.CodeGen::builtin-constant-p.c
Script: -- : 'RUN: at line 1'; /mnt/disks/ssd0/agent/workspace/amd64_debian_testing_clang8/build/bin/clang -cc1 -internal-isystem /mnt/disks/ssd0/agent/workspace/amd64_debian_testing_clang8/build/lib/clang/11.0.0/include -nostdsysteminc -triple x86_64-unknown-unknown -emit-llvm -disable-llvm-optzns -o - /mnt/disks/ssd0/agent/workspace/amd64_debian_testing_clang8/clang/test/CodeGen/builtin-constant-p.c -O2 | /mnt/disks/ssd0/agent/workspace/amd64_debian_testing_clang8/build/bin/FileCheck /mnt/disks/ssd0/agent/workspace/amd64_debian_testing_clang8/clang/test/CodeGen/builtin-constant-p.c
120 msClang.CodeGen::pascal-string.c
Script: -- : 'RUN: at line 1'; /mnt/disks/ssd0/agent/workspace/amd64_debian_testing_clang8/build/bin/clang -cc1 -internal-isystem /mnt/disks/ssd0/agent/workspace/amd64_debian_testing_clang8/build/lib/clang/11.0.0/include -nostdsysteminc -emit-llvm -o - /mnt/disks/ssd0/agent/workspace/amd64_debian_testing_clang8/clang/test/CodeGen/pascal-string.c -fpascal-strings | grep "05Hello"
60 msClang.CodeGenCXX::arm-swiftcall.cpp
Script: -- : 'RUN: at line 1'; /mnt/disks/ssd0/agent/workspace/amd64_debian_testing_clang8/build/bin/clang -cc1 -internal-isystem /mnt/disks/ssd0/agent/workspace/amd64_debian_testing_clang8/build/lib/clang/11.0.0/include -nostdsysteminc -triple armv7-apple-darwin9 -emit-llvm -o - /mnt/disks/ssd0/agent/workspace/amd64_debian_testing_clang8/clang/test/CodeGenCXX/arm-swiftcall.cpp -Wno-return-type-c-linkage -std=c++03 | /mnt/disks/ssd0/agent/workspace/amd64_debian_testing_clang8/build/bin/FileCheck /mnt/disks/ssd0/agent/workspace/amd64_debian_testing_clang8/clang/test/CodeGenCXX/arm-swiftcall.cpp -check-prefixes=CHECK
70 msClang.Sema::builtins.c
Script: -- : 'RUN: at line 1'; /mnt/disks/ssd0/agent/workspace/amd64_debian_testing_clang8/build/bin/clang -cc1 -internal-isystem /mnt/disks/ssd0/agent/workspace/amd64_debian_testing_clang8/build/lib/clang/11.0.0/include -nostdsysteminc /mnt/disks/ssd0/agent/workspace/amd64_debian_testing_clang8/clang/test/Sema/builtins.c -fsyntax-only -verify -pedantic -Wstrlcpy-strlcat-size -Wno-string-plus-int -triple=i686-apple-darwin9