[cfe-commits] r139162 - /cfe/trunk/lib/AST/RecordLayoutBuilder.cpp

Ted Kremenek kremenek at apple.com
Tue Sep 6 12:40:46 PDT 2011


Author: kremenek
Date: Tue Sep  6 14:40:45 2011
New Revision: 139162

URL: http://llvm.org/viewvc/llvm-project?rev=139162&view=rev
Log:
Don't emit -Wpadded warnings without a valid SourceLocation.  This can happen when RecordLayoutBuilder is used by Codegen, not Sema.

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=139162&r1=139161&r2=139162&view=diff
==============================================================================
--- cfe/trunk/lib/AST/RecordLayoutBuilder.cpp (original)
+++ cfe/trunk/lib/AST/RecordLayoutBuilder.cpp Tue Sep  6 14:40:45 2011
@@ -1751,6 +1751,11 @@
   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.





More information about the cfe-commits mailing list