FieldDecl *getInstantiatedFromUnnamedFieldDecl(FieldDecl *Field);
void setInstantiatedFromUnnamedFieldDecl(FieldDecl *Inst, FieldDecl *Tmpl);
+
+ /// ZeroBitfieldFollowsNonBitfield - return 'true" if 'FD' is a zero-length
+ /// bitfield which follows the non-bitfield 'LastFD'.
+ bool ZeroBitfieldFollowsNonBitfield(const FieldDecl *FD,
+ const FieldDecl *LastFD) const;
// Access to the set of methods overridden by the given C++ method.
typedef CXXMethodVector::iterator overridden_cxx_method_iterator;
InstantiatedFromUnnamedFieldDecl[Inst] = Tmpl;
}
+bool ASTContext::ZeroBitfieldFollowsNonBitfield(const FieldDecl *FD,
+ const FieldDecl *LastFD) const {
+ return (FD->isBitField() && LastFD && !LastFD->isBitField() &&
+ FD->getBitWidth()-> EvaluateAsInt(*this).getZExtValue() == 0);
+
+}
+
ASTContext::overridden_cxx_method_iterator
ASTContext::overridden_methods_begin(const CXXMethodDecl *Method) const {
llvm::DenseMap<const CXXMethodDecl *, CXXMethodVector>::const_iterator Pos
// Zero-length bitfields following non-bitfield members are
// ignored:
const FieldDecl *FD = (*Field);
- if (FD->isBitField() && LastFD && !LastFD->isBitField() &&
- FD->getBitWidth()->EvaluateAsInt(Context).getZExtValue() == 0) {
+ if (Context.ZeroBitfieldFollowsNonBitfield(FD, LastFD))
continue;
- }
LastFD = FD;
}
LayoutField(*Field);
// Zero-length bitfields following non-bitfield members are
// ignored:
const FieldDecl *FD = (*Field);
- // FIXME. Refactor into common code as it is used in several places.
- if (FD->isBitField() && LastFD && !LastFD->isBitField() &&
- FD->getBitWidth()->
- EvaluateAsInt(Types.getContext()).getZExtValue() == 0) {
+ if (Types.getContext().ZeroBitfieldFollowsNonBitfield(FD, LastFD)) {
--FieldNo;
continue;
}
if (IsMsStruct) {
// Zero-length bitfields following non-bitfield members are
// ignored:
- if (FD->isBitField() && LastFD && !LastFD->isBitField() &&
- FD->getBitWidth()->
- EvaluateAsInt(getContext()).getZExtValue() == 0) {
+ if (getContext().ZeroBitfieldFollowsNonBitfield(FD, LastFD)) {
--i;
continue;
}