]> granicus.if.org Git - clang/commitdiff
Don't emit -Wpadded warnings without a valid SourceLocation. This can happen when...
authorTed Kremenek <kremenek@apple.com>
Tue, 6 Sep 2011 19:40:45 +0000 (19:40 +0000)
committerTed Kremenek <kremenek@apple.com>
Tue, 6 Sep 2011 19:40:45 +0000 (19:40 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139162 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/RecordLayoutBuilder.cpp

index eff1daea46c39274444c05504f214c52cc9781bf..b33c8d730e30d6f8c18a8d40e9d6d45527d0890e 100644 (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.