aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-05-02 18:36:10 +0000
committerAnders Carlsson <andersca@mac.com>2009-05-02 18:36:10 +0000
commit5992e4a9cf7e2762a746a6d355dfab4598125012 (patch)
tree071d577f53be0b02440f22e7ecb40910977f1cc4 /lib
parent11e1b40d759a643086f590f6ffbd9d68360bad46 (diff)
Fix a thinko and a test.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70637 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Sema/SemaExpr.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index dc058b2a3a..2986cc366a 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -4734,6 +4734,8 @@ Sema::OwningExprResult Sema::ActOnBuiltinOffsetOf(Scope *S,
<< SourceRange(CompPtr[1].LocStart, CompPtr[NumComponents-1].LocEnd);
if (!Dependent) {
+ bool DidWarnAboutNonPOD;
+
// FIXME: Dependent case loses a lot of information here. And probably
// leaks like a sieve.
for (unsigned i = 0; i != NumComponents; ++i) {
@@ -4776,10 +4778,12 @@ Sema::OwningExprResult Sema::ActOnBuiltinOffsetOf(Scope *S,
// Get the decl corresponding to this.
RecordDecl *RD = RC->getDecl();
if (CXXRecordDecl *CRD = dyn_cast<CXXRecordDecl>(RD)) {
- if (!CRD->isPOD())
+ if (!CRD->isPOD() && !DidWarnAboutNonPOD) {
ExprError(Diag(BuiltinLoc, diag::warn_offsetof_non_pod_type)
<< SourceRange(CompPtr[0].LocStart, OC.LocEnd)
<< Res->getType());
+ DidWarnAboutNonPOD = true;
+ }
}
FieldDecl *MemberDecl