]> granicus.if.org Git - clang/commit
Use the more general Evaluate infrastructure for folding constant DeclRefs
authorEli Friedman <eli.friedman@gmail.com>
Thu, 26 Nov 2009 03:22:21 +0000 (03:22 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Thu, 26 Nov 2009 03:22:21 +0000 (03:22 +0000)
commit28665272c36cccb1014a6ea1217354b0519e2b59
tree12b805fd49de51660a7bc940be6d352ed5d47ddc
parent7622cd3410846d28862ecfe862117894a259a7fa
Use the more general Evaluate infrastructure for folding constant DeclRefs
instead of checking explicitly for an EnumConstantDecl.  This folds references
to constant integer VarDecls, which has two benefits:

1. Slightly smaller emitted code from emitting a constant instead of a load,
and skipping emitting some constant globals.
2. Some code forgets to define static constant member variables; emitting a
load instead of the value in that case leads to a link error. (Such programs
are technically not well-formed, but in practice build with g++.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89934 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/CGExprScalar.cpp