This is an archive of the discontinued LLVM Phabricator instance.

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

Authored by efriedma on Mar 13 2020, 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

Event Timeline

efriedma created this revision.Mar 13 2020, 5:14 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 13 2020, 5:14 PM
nickdesaulniers added a subscriber: erichkeane.

Looks like @erichkeane was in the neighborhood in 606a734755d1fb6c35a17680d0c251f834b79334 ("[PR47636] Fix tryEmitPrivate to handle non-constantarraytypes").

I took the tests from https://reviews.llvm.org/D76096 and combined it with this change. As mentioned in the last comment 606a734755d1fb6c35a17680d0c251f834b79334 causes conflicts, so I tried applying it to the commit just prior (f2efb5742cc9f74ad73987760651e3d23894a416). When running ninja clang-test, the following tests fail:

Failed Tests (8):
  Clang :: CodeGen/2009-06-14-anonymous-union-init.c
  Clang :: CodeGen/builtin-constant-p.c
  Clang :: CodeGen/pascal-string.c
  Clang :: CodeGenCXX/arm-swiftcall.cpp
  Clang :: Sema/array-init.c
  Clang :: Sema/builtins.c
  Clang :: Sema/const-eval.c
  Clang :: Sema/init.c
nickdesaulniers requested changes to this revision.Jul 20 2023, 1:52 PM

Folded into D151587.

This revision now requires changes to proceed.Jul 20 2023, 1:52 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 20 2023, 1:52 PM