summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2011-09-06 19:40:45 +0000
committerTed Kremenek <kremenek@apple.com>2011-09-06 19:40:45 +0000
commitfed48af3def19576dee6d499126f5de80d3676e8 (patch)
tree552b41084b1190df0a8d88e9562b5b9ba64144a6
parent9d96c942783c15b7bae2a26f1e253a60f1bd39cc (diff)
downloadbcm5719-llvm-fed48af3def19576dee6d499126f5de80d3676e8.tar.gz
bcm5719-llvm-fed48af3def19576dee6d499126f5de80d3676e8.zip
Don't emit -Wpadded warnings without a valid SourceLocation. This can happen when RecordLayoutBuilder is used by Codegen, not Sema.
llvm-svn: 139162
-rw-r--r--clang/lib/AST/RecordLayoutBuilder.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/lib/AST/RecordLayoutBuilder.cpp b/clang/lib/AST/RecordLayoutBuilder.cpp
index eff1daea46c..b33c8d730e3 100644
--- a/clang/lib/AST/RecordLayoutBuilder.cpp
+++ b/clang/lib/AST/RecordLayoutBuilder.cpp
@@ -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.
OpenPOWER on IntegriCloud