[llvm-commits] [dragonegg] r137718 - /dragonegg/trunk/src/Constants.cpp
Duncan Sands
baldrick at free.fr
Tue Aug 16 07:08:18 PDT 2011
Author: baldrick
Date: Tue Aug 16 09:08:18 2011
New Revision: 137718
URL: http://llvm.org/viewvc/llvm-project?rev=137718&view=rev
Log:
Do not default initialize fields of a QUAL_UNION that are not
present. This is theoretical since default initializing these
beasts doesn't make a lot of sense, and the only language that
supports them (Ada) only does explicit initialization using a
non-qualified version of the type.
Modified:
dragonegg/trunk/src/Constants.cpp
Modified: dragonegg/trunk/src/Constants.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Constants.cpp?rev=137718&r1=137717&r2=137718&view=diff
==============================================================================
--- dragonegg/trunk/src/Constants.cpp (original)
+++ dragonegg/trunk/src/Constants.cpp Tue Aug 16 09:08:18 2011
@@ -1083,8 +1083,13 @@
assert(TREE_CODE(field) == FIELD_DECL && "Lang data not freed?");
// Ignore fields with variable or unknown position since they cannot be
// default initialized.
- if (OffsetIsLLVMCompatible(field))
- Fields.push_back(field);
+ if (!OffsetIsLLVMCompatible(field))
+ continue;
+ // Skip fields that are known not to be present.
+ if (TREE_CODE(TREE_TYPE(exp)) == QUAL_UNION_TYPE &&
+ integer_zerop(DECL_QUALIFIER(field)))
+ continue;
+ Fields.push_back(field);
}
// Process the fields in reverse order. This is for the benefit of union
More information about the llvm-commits
mailing list