022dbc1672 
								
							 
						 
						
							
							
								
								Simplify crash recovery cleanup registration.  
							
							... 
							
							
							
							llvm-svn: 128057 
							
						 
						
							2011-03-22 01:15:19 +00:00  
				
					
						
							
							
								 
						
							
								f75d089679 
								
							 
						 
						
							
							
								
								Recover memory from RecordLayoutBuilders during crashes.  
							
							... 
							
							
							
							llvm-svn: 127931 
							
						 
						
							2011-03-19 01:00:36 +00:00  
				
					
						
							
							
								 
						
							
								a1a2e8decb 
								
							 
						 
						
							
							
								
								Instead of round up sizes to '8', round them up to the alignment of the char  
							
							... 
							
							
							
							type.
llvm-svn: 127391 
							
						 
						
							2011-03-10 02:00:35 +00:00  
				
					
						
							
							
								 
						
							
								e73807538a 
								
							 
						 
						
							
							
								
								Round up the non-virtual size to the next char instead of rounding down.  
							
							... 
							
							
							
							llvm-svn: 127390 
							
						 
						
							2011-03-10 01:53:59 +00:00  
				
					
						
							
							
								 
						
							
								dbe37f38d0 
								
							 
						 
						
							
							
								
								Use CharUnits for TypeAlign variable in LayoutWideBitField(). No change in  
							
							... 
							
							
							
							functionality intended.
llvm-svn: 126730 
							
						 
						
							2011-03-01 01:36:00 +00:00  
				
					
						
							
							
								 
						
							
								aab635e67a 
								
							 
						 
						
							
							
								
								Change the return type of GetVirtualPointersSize() to CharUnits. No change  
							
							... 
							
							
							
							in functionality intended.
llvm-svn: 126727 
							
						 
						
							2011-03-01 01:22:45 +00:00  
				
					
						
							
							
								 
						
							
								1b4420ed42 
								
							 
						 
						
							
							
								
								Retry r126357. Use CharUnits for the Size and DataSize calculations when  
							
							... 
							
							
							
							they are known to be exact multiples of the width of the char type. Add a
test case to CodeGen/union.c that would have caught the problem with the
previous attempt. No change in functionality intended.
llvm-svn: 126628 
							
						 
						
							2011-02-28 02:01:38 +00:00  
				
					
						
							
							
								 
						
							
								30cdc7022b 
								
							 
						 
						
							
							
								
								Revert "Use CharUnits values for Size and DataSize outside of the bitfield  
							
							... 
							
							
							
							layout", it broke some GCC tests.
llvm-svn: 126386 
							
						 
						
							2011-02-24 16:40:53 +00:00  
				
					
						
							
							
								 
						
							
								8e74e79145 
								
							 
						 
						
							
							
								
								Use CharUnits values for Size and DataSize outside of the bitfield layout  
							
							... 
							
							
							
							methods, when they are known to be exact multiples of the width of the char
type. 
llvm-svn: 126357 
							
						 
						
							2011-02-24 02:12:14 +00:00  
				
					
						
							
							
								 
						
							
								3c215f2fd1 
								
							 
						 
						
							
							
								
								Use Context.getCharWidth() in place of literal '8's in assertions.  
							
							... 
							
							
							
							llvm-svn: 126356 
							
						 
						
							2011-02-24 01:33:05 +00:00  
				
					
						
							
							
								 
						
							
								ecfc75529f 
								
							 
						 
						
							
							
								
								Make the Size and DataSize members more CharUnits-friendly by wrapping them  
							
							... 
							
							
							
							with getter and setter methods in both bit units and CharUnits. This will help
simplify some of the unit mismatch in the parts of the code where sizes are
known to be exact multiples of the width of the char type.
Assertions in the getters help guard against accidentally converting to
CharUnits when sizes are not exact multiples of the char width.
llvm-svn: 126354 
							
						 
						
							2011-02-24 01:13:28 +00:00  
				
					
						
							
							
								 
						
							
								6d90e8937c 
								
							 
						 
						
							
							
								
								Expand use of CharUnits  in LayoutField(). No change in functionality  
							
							... 
							
							
							
							intended.
llvm-svn: 126066 
							
						 
						
							2011-02-20 02:06:09 +00:00  
				
					
						
							
							
								 
						
							
								85ef0431a7 
								
							 
						 
						
							
							
								
								Expand use of CharUnits for alignments further. No change in functionality  
							
							... 
							
							
							
							intended.
llvm-svn: 126034 
							
						 
						
							2011-02-19 18:58:07 +00:00  
				
					
						
							
							
								 
						
							
								02ced6fd19 
								
							 
						 
						
							
							
								
								Convert MaxFieldAlignment to CharUnits from bits. No change in functionality  
							
							... 
							
							
							
							intended.
llvm-svn: 125704 
							
						 
						
							2011-02-17 01:49:42 +00:00  
				
					
						
							
							
								 
						
							
								1300b3b357 
								
							 
						 
						
							
							
								
								Convert the UnpackedAlignment field to CharUnits from bits. No change in  
							
							... 
							
							
							
							functionality intended.
llvm-svn: 125643 
							
						 
						
							2011-02-16 02:11:31 +00:00  
				
					
						
							
							
								 
						
							
								4731d5b65a 
								
							 
						 
						
							
							
								
								Convert Alignment member to CharUnits from bits. No change in functionality  
							
							... 
							
							
							
							intended.
llvm-svn: 125641 
							
						 
						
							2011-02-16 02:05:21 +00:00  
				
					
						
							
							
								 
						
							
								af1c83fbe7 
								
							 
						 
						
							
							
								
								Convert NonVirtualSize to CharUnits from bits. No change in functionality  
							
							... 
							
							
							
							intended.
llvm-svn: 125639 
							
						 
						
							2011-02-16 01:52:01 +00:00  
				
					
						
							
							
								 
						
							
								a2d3dda041 
								
							 
						 
						
							
							
								
								Convert NonVirtualAlignment to CharUnits. No change in functionality  
							
							... 
							
							
							
							intended.
llvm-svn: 125638 
							
						 
						
							2011-02-16 01:43:15 +00:00  
				
					
						
							
							
								 
						
							
								7ad11e70b6 
								
							 
						 
						
							
							
								
								Convert RecordLayout::Alignment to CharUnits from bit units. No change in  
							
							... 
							
							
							
							functionality intended. 
llvm-svn: 125549 
							
						 
						
							2011-02-15 02:32:40 +00:00  
				
					
						
							
							
								 
						
							
								d5090c16f8 
								
							 
						 
						
							
							
								
								Convert RecordLayout::DataSize to CharUnits from bits, eliminating two  
							
							... 
							
							
							
							unnecessary calls to RoundUpToAlignment. No changes to functionality
intended.
llvm-svn: 125356 
							
						 
						
							2011-02-11 02:20:09 +00:00  
				
					
						
							
							
								 
						
							
								b0fcc59e19 
								
							 
						 
						
							
							
								
								Add a helper function, ASTContext::toBits(), that converts sizes in  
							
							... 
							
							
							
							CharUnits to sizes in bits, and use it to tidy up the places where the
conversion was done explicitly.
llvm-svn: 125332 
							
						 
						
							2011-02-11 01:54:29 +00:00  
				
					
						
							
							
								 
						
							
								c8ae55050d 
								
							 
						 
						
							
							
								
								Convert RecordLayout::Size to CharUnits from bits. No changes to  
							
							... 
							
							
							
							functionality intended.
llvm-svn: 125156 
							
						 
						
							2011-02-09 01:59:34 +00:00  
				
					
						
							
							
								 
						
							
								bec0285d7f 
								
							 
						 
						
							
							
								
								Convert RecordLayout::NonVirtualAlign to CharUnits. No change in  
							
							... 
							
							
							
							functionality intended.
llvm-svn: 125069 
							
						 
						
							2011-02-08 02:02:47 +00:00  
				
					
						
							
							
								 
						
							
								09b2331cf7 
								
							 
						 
						
							
							
								
								For gcc compatibility, size of a class which is zero  
							
							... 
							
							
							
							but has non-empty data fields, such as array of zero length,
remains zero.
// rdar://8945175
llvm-svn: 124741 
							
						 
						
							2011-02-02 19:36:18 +00:00  
				
					
						
							
							
								 
						
							
								dbe3927026 
								
							 
						 
						
							
							
								
								Basic support for -mms-bitfields, from Carl Norum!  
							
							... 
							
							
							
							llvm-svn: 124661 
							
						 
						
							2011-02-01 15:15:22 +00:00  
				
					
						
							
							
								 
						
							
								316d6f69bc 
								
							 
						 
						
							
							
								
								Convert RecordLayout::NonVirtualSize from bit units to CharUnits.  
							
							... 
							
							
							
							llvm-svn: 124646 
							
						 
						
							2011-02-01 01:52:10 +00:00  
				
					
						
							
							
								 
						
							
								7c4026bea7 
								
							 
						 
						
							
							
								
								Remove private toCharUnits() helper method, replacing with calls to  
							
							... 
							
							
							
							ASTContext::toCharUnitsFromBits().
llvm-svn: 124092 
							
						 
						
							2011-01-24 01:28:50 +00:00  
				
					
						
							
							
								 
						
							
								86a7fcc19c 
								
							 
						 
						
							
							
								
								Replace calls to CharUnits::fromQuantity() with ones  
							
							... 
							
							
							
							ASTContext::toCharUnitsFromBits() when converting from bit sizes to char units.
llvm-svn: 123715 
							
						 
						
							2011-01-18 01:56:16 +00:00  
				
					
						
							
							
								 
						
							
								39c7980772 
								
							 
						 
						
							
							
								
								PR3558: mark "logically const" accessor methods in ASTContext as const,  
							
							... 
							
							
							
							and mark the fields they use as mutable. This allows us to remove a few
const_casts.
llvm-svn: 123314 
							
						 
						
							2011-01-12 09:06:06 +00:00  
				
					
						
							
							
								 
						
							
								7bcde197d7 
								
							 
						 
						
							
							
								
								Fix PR8796.  
							
							... 
							
							
							
							The problem was that we were asserting the we never added an empty class
to the same offset twice. This is not true for unions, where two members, empty
or not, can have the some offset.
llvm-svn: 122633 
							
						 
						
							2010-12-29 23:02:58 +00:00  
				
					
						
							
							
								 
						
							
								d62c9be4fc 
								
							 
						 
						
							
							
								
								Fix another unnecessary-struct-padding issue.  
							
							... 
							
							
							
							llvm-svn: 121352 
							
						 
						
							2010-12-09 02:47:58 +00:00  
				
					
						
							
							
								 
						
							
								8b54274fcf 
								
							 
						 
						
							
							
								
								Before determining the effect the alignment of base struct will have in the aligment of the sub-struct,  
							
							... 
							
							
							
							take into account if the sub-struct is packed and its maximum field alignment.
Fixes rdar://8745206
llvm-svn: 121335 
							
						 
						
							2010-12-09 00:35:20 +00:00  
				
					
						
							
							
								 
						
							
								60a6263ee8 
								
							 
						 
						
							
							
								
								Move isNearlyEmpty out into the ASTContext so it can be called from CodeGen as well.  
							
							... 
							
							
							
							llvm-svn: 120137 
							
						 
						
							2010-11-25 01:51:53 +00:00  
				
					
						
							
							
								 
						
							
								7f95cd1817 
								
							 
						 
						
							
							
								
								Rename RecordLayout::getPrimaryBaseWasVirtual to isPrimaryBaseVirtual.  
							
							... 
							
							
							
							llvm-svn: 120133 
							
						 
						
							2010-11-24 23:12:57 +00:00  
				
					
						
							
							
								 
						
							
								5adde29d86 
								
							 
						 
						
							
							
								
								Use the newly added function in ASTRecordLayoutBuilder.  
							
							... 
							
							
							
							llvm-svn: 120131 
							
						 
						
							2010-11-24 22:55:48 +00:00  
				
					
						
							
							
								 
						
							
								d004064864 
								
							 
						 
						
							
							
								
								Refactoring of Diagnostic class.  
							
							... 
							
							
							
							-Move the stuff of Diagnostic related to creating/querying diagnostic IDs into a new DiagnosticIDs class.
-DiagnosticIDs can be shared among multiple Diagnostics for multiple translation units.
-The rest of the state in Diagnostic object is considered related and tied to one translation unit.
-Have Diagnostic point to the SourceManager that is related with. Diagnostic can now accept just a
   SourceLocation instead of a FullSourceLoc.
-Reflect the changes to various interfaces.
llvm-svn: 119730 
							
						 
						
							2010-11-18 20:06:41 +00:00  
				
					
						
							
							
								 
						
							
								09814d3f3a 
								
							 
						 
						
							
							
								
								Don't update empty field subobjects for bitfields. Fixes PR8519.  
							
							... 
							
							
							
							llvm-svn: 117921 
							
						 
						
							2010-11-01 15:14:51 +00:00  
				
					
						
							
							
								 
						
							
								0a14ee9ed8 
								
							 
						 
						
							
							
								
								Get rid of more calls to getBaseClassOffsetInBits.  
							
							... 
							
							
							
							llvm-svn: 117883 
							
						 
						
							2010-11-01 00:21:58 +00:00  
				
					
						
							
							
								 
						
							
								3f01871647 
								
							 
						 
						
							
							
								
								Port over a couple of getVBaseClassOffsetInBits call sites to use getVBaseClassOffset instead.  
							
							... 
							
							
							
							llvm-svn: 117882 
							
						 
						
							2010-10-31 23:45:59 +00:00  
				
					
						
							
							
								 
						
							
								fd88a6160d 
								
							 
						 
						
							
							
								
								Rename getBaseClassOffset to getBaseClassOffsetInBits and introduce a getBaseClassOffset which returns the offset in CharUnits. Do the same thing for getVBaseClassOffset.  
							
							... 
							
							
							
							llvm-svn: 117881 
							
						 
						
							2010-10-31 23:22:37 +00:00  
				
					
						
							
							
								 
						
							
								a2f8e41a0a 
								
							 
						 
						
							
							
								
								Start converting over the RecordLayoutBuilder next.  
							
							... 
							
							
							
							llvm-svn: 117878 
							
						 
						
							2010-10-31 22:20:42 +00:00  
				
					
						
							
							
								 
						
							
								28466ab8f4 
								
							 
						 
						
							
							
								
								EmptyObjectMap now uses CharUnits wherever possible.  
							
							... 
							
							
							
							llvm-svn: 117877 
							
						 
						
							2010-10-31 22:13:23 +00:00  
				
					
						
							
							
								 
						
							
								233e272775 
								
							 
						 
						
							
							
								
								More CharUnits conversion.  
							
							... 
							
							
							
							llvm-svn: 117875 
							
						 
						
							2010-10-31 21:54:55 +00:00  
				
					
						
							
							
								 
						
							
								725190ff3f 
								
							 
						 
						
							
							
								
								More CharUnits conversion.  
							
							... 
							
							
							
							llvm-svn: 117874 
							
						 
						
							2010-10-31 21:39:24 +00:00  
				
					
						
							
							
								 
						
							
								f8f756d1d5 
								
							 
						 
						
							
							
								
								Use CharUnits in the EmptyClassOffsets map.  
							
							... 
							
							
							
							llvm-svn: 117873 
							
						 
						
							2010-10-31 21:22:43 +00:00  
				
					
						
							
							
								 
						
							
								22f5720c27 
								
							 
						 
						
							
							
								
								Baby steps towards using only CharUnits for base class offsets in ASTRecordLayout. Start by storing the offsets in CharUnits in the ASTRecordLayout object.  
							
							... 
							
							
							
							llvm-svn: 117869 
							
						 
						
							2010-10-31 21:01:46 +00:00  
				
					
						
							
							
								 
						
							
								2fc373e155 
								
							 
						 
						
							
							
								
								Move classes into anonymous namespaces.  
							
							... 
							
							
							
							llvm-svn: 117104 
							
						 
						
							2010-10-22 16:33:16 +00:00  
				
					
						
							
							
								 
						
							
								6843141d39 
								
							 
						 
						
							
							
								
								Store in PCH the key function of C++ class to avoid deserializing the complete declaration context in order to compute it.  
							
							... 
							
							
							
							Progress for rdar://7260160.
llvm-svn: 116508 
							
						 
						
							2010-10-14 20:14:38 +00:00  
				
					
						
							
							
								 
						
							
								8c64bbe032 
								
							 
						 
						
							
							
								
								Embrace C++ ABI 5.2.6 and consider that template instantiations don't have key functions (same as GCC).  
							
							... 
							
							
							
							llvm-svn: 116391 
							
						 
						
							2010-10-13 02:39:41 +00:00  
				
					
						
							
							
								 
						
							
								ca0d0cd3b9 
								
							 
						 
						
							
							
								
								Implement -Wpadded and -Wpacked.  
							
							... 
							
							
							
							-Wpadded warns when undesired padding is introduced in a struct. (rdar://7469556)
-Wpacked warns if a struct is given the packed attribute, but the packed attribute has no effect
  on the layout or the size of the struct. Such structs may be mis-aligned for little benefit.
The warnings are emitted at the point where layout is calculated, that is at RecordLayoutBuilder.
To avoid calculating the layouts of all structs regardless of whether they are needed or not,
I let the layouts be lazily constructed when needed. This has the disadvantage that the above warnings
will be emitted only when they are used for IR gen, and not e.g with -fsyntax-only:
$ cat t.c
struct S {
  char c;
  int i;
};
void f(struct S* s) {}
$ clang -fsyntax-only -Wpadded t.c
$ clang -c -Wpadded t.c -o t.o
t.c:3:7: warning: padding struct 'struct S' with 3 bytes to align 'i' [-Wpadded]
  int i;
      ^
1 warning generated.
This is a good tradeoff between providing the warnings and not calculating layouts for all
structs in case the user has enabled a couple of rarely used warnings.
llvm-svn: 114544 
							
						 
						
							2010-09-22 14:32:24 +00:00