diff options
| author | Anders Carlsson <andersca@mac.com> | 2009-05-02 18:36:10 +0000 |
|---|---|---|
| committer | Anders Carlsson <andersca@mac.com> | 2009-05-02 18:36:10 +0000 |
| commit | 38ebcaa8c83d3fa9d0efcf7a076e827538b92c82 (patch) | |
| tree | 8c6bca16e99cd0fb6eca4b46381c91df87917008 | |
| parent | ff08995589871d57a15207a24aeaa8959933c896 (diff) | |
| download | bcm5719-llvm-38ebcaa8c83d3fa9d0efcf7a076e827538b92c82.tar.gz bcm5719-llvm-38ebcaa8c83d3fa9d0efcf7a076e827538b92c82.zip | |
Fix a thinko and a test.
llvm-svn: 70637
| -rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 6 | ||||
| -rw-r--r-- | clang/test/SemaCXX/offsetof.cpp | 2 |
2 files changed, 6 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index dc058b2a3a5..2986cc366a8 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/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 diff --git a/clang/test/SemaCXX/offsetof.cpp b/clang/test/SemaCXX/offsetof.cpp index c8a3d3df457..f0290e889a2 100644 --- a/clang/test/SemaCXX/offsetof.cpp +++ b/clang/test/SemaCXX/offsetof.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang-cc -fsyntax-only -verify %s -Winvalid-offsetof struct NonPOD { virtual void f(); |

