From: Ted Kremenek Date: Tue, 6 Sep 2011 19:40:45 +0000 (+0000) Subject: Don't emit -Wpadded warnings without a valid SourceLocation. This can happen when... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ae5860e1787230dd8b8948a08632c9be777d8522;p=clang Don't emit -Wpadded warnings without a valid SourceLocation. This can happen when RecordLayoutBuilder is used by Codegen, not Sema. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139162 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/RecordLayoutBuilder.cpp b/lib/AST/RecordLayoutBuilder.cpp index eff1daea46..b33c8d730e 100644 --- a/lib/AST/RecordLayoutBuilder.cpp +++ b/lib/AST/RecordLayoutBuilder.cpp @@ -1751,6 +1751,11 @@ void RecordLayoutBuilder::CheckFieldPadding(uint64_t Offset, if (isa(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.