Don't emit -Wpadded warnings without a valid SourceLocation. This can happen when RecordLayoutBuilder is used by Codegen, not Sema.

llvm-svn: 139162
This commit is contained in:
Ted Kremenek 2011-09-06 19:40:45 +00:00
parent 9d96c94278
commit fed48af3de
1 changed files with 5 additions and 0 deletions

View File

@ -1751,6 +1751,11 @@ void RecordLayoutBuilder::CheckFieldPadding(uint64_t Offset,
if (isa<ObjCIvarDecl>(D))
return;
// Don't warn about structs created without a SourceLocation. This can
// be done by clients of the AST, such as codegen.
if (D->getLocation().isInvalid())
return;
unsigned CharBitNum = Context.getTargetInfo().getCharWidth();
// Warn if padding was introduced to the struct/class.