[cfe-commits] r163031 - /cfe/trunk/lib/AST/RecordLayoutBuilder.cpp
Benjamin Kramer
benny.kra at googlemail.com
Fri Aug 31 15:14:25 PDT 2012
Author: d0k
Date: Fri Aug 31 17:14:25 2012
New Revision: 163031
URL: http://llvm.org/viewvc/llvm-project?rev=163031&view=rev
Log:
Remove windows line endings.
While there fix a dead assert.
Modified:
cfe/trunk/lib/AST/RecordLayoutBuilder.cpp
Modified: cfe/trunk/lib/AST/RecordLayoutBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/RecordLayoutBuilder.cpp?rev=163031&r1=163030&r2=163031&view=diff
==============================================================================
--- cfe/trunk/lib/AST/RecordLayoutBuilder.cpp (original)
+++ cfe/trunk/lib/AST/RecordLayoutBuilder.cpp Fri Aug 31 17:14:25 2012
@@ -2260,28 +2260,26 @@
}
// Use the externally-supplied field offset.
- return ExternalFieldOffset;
-}
-
-/// \brief Get diagnostic %select index for tag kind for
-/// field padding diagnostic message.
-/// WARNING: Indexes apply to particular diagnostics only!
-///
-/// \returns diagnostic %select index.
-static unsigned getPaddingDiagFromTagKind(TagTypeKind Tag)
-{
- switch (Tag) {
- case TTK_Struct: return 0;
- case TTK_Interface: return 1;
- case TTK_Class: return 2;
- default: assert("Invalid tag kind for field padding diagnostic!");
- }
- return -1;
-}
-
-void RecordLayoutBuilder::CheckFieldPadding(uint64_t Offset,
- uint64_t UnpaddedOffset,
- uint64_t UnpackedOffset,
+ return ExternalFieldOffset;
+}
+
+/// \brief Get diagnostic %select index for tag kind for
+/// field padding diagnostic message.
+/// WARNING: Indexes apply to particular diagnostics only!
+///
+/// \returns diagnostic %select index.
+static unsigned getPaddingDiagFromTagKind(TagTypeKind Tag) {
+ switch (Tag) {
+ case TTK_Struct: return 0;
+ case TTK_Interface: return 1;
+ case TTK_Class: return 2;
+ default: llvm_unreachable("Invalid tag kind for field padding diagnostic!");
+ }
+}
+
+void RecordLayoutBuilder::CheckFieldPadding(uint64_t Offset,
+ uint64_t UnpaddedOffset,
+ uint64_t UnpackedOffset,
unsigned UnpackedAlign,
bool isPacked,
const FieldDecl *D) {
@@ -2304,20 +2302,20 @@
if (PadSize % CharBitNum == 0) {
PadSize = PadSize / CharBitNum;
InBits = false;
- }
- if (D->getIdentifier())
- Diag(D->getLocation(), diag::warn_padded_struct_field)
- << getPaddingDiagFromTagKind(D->getParent()->getTagKind())
- << Context.getTypeDeclType(D->getParent())
- << PadSize
- << (InBits ? 1 : 0) /*(byte|bit)*/ << (PadSize > 1) // plural or not
- << D->getIdentifier();
- else
- Diag(D->getLocation(), diag::warn_padded_struct_anon_field)
- << getPaddingDiagFromTagKind(D->getParent()->getTagKind())
- << Context.getTypeDeclType(D->getParent())
- << PadSize
- << (InBits ? 1 : 0) /*(byte|bit)*/ << (PadSize > 1); // plural or not
+ }
+ if (D->getIdentifier())
+ Diag(D->getLocation(), diag::warn_padded_struct_field)
+ << getPaddingDiagFromTagKind(D->getParent()->getTagKind())
+ << Context.getTypeDeclType(D->getParent())
+ << PadSize
+ << (InBits ? 1 : 0) /*(byte|bit)*/ << (PadSize > 1) // plural or not
+ << D->getIdentifier();
+ else
+ Diag(D->getLocation(), diag::warn_padded_struct_anon_field)
+ << getPaddingDiagFromTagKind(D->getParent()->getTagKind())
+ << Context.getTypeDeclType(D->getParent())
+ << PadSize
+ << (InBits ? 1 : 0) /*(byte|bit)*/ << (PadSize > 1); // plural or not
}
// Warn if we packed it unnecessarily. If the alignment is 1 byte don't
More information about the cfe-commits
mailing list