[cfe-commits] r149731 - in /cfe/trunk: lib/Sema/SemaExpr.cpp test/SemaCXX/undefined-internal.cpp
Eli Friedman
eli.friedman at gmail.com
Fri Feb 3 16:54:05 PST 2012
Author: efriedma
Date: Fri Feb 3 18:54:05 2012
New Revision: 149731
URL: http://llvm.org/viewvc/llvm-project?rev=149731&view=rev
Log:
Suppress the used-but-not-defined warning for static data members while I look into a rather nasty bug in the new odr-use marking code.
Modified:
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/test/SemaCXX/undefined-internal.cpp
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=149731&r1=149730&r2=149731&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Fri Feb 3 18:54:05 2012
@@ -9612,8 +9612,10 @@
static void MarkVarDeclODRUsed(Sema &SemaRef, VarDecl *Var,
SourceLocation Loc) {
// Keep track of used but undefined variables.
+ // FIXME: We shouldn't suppress this warning for static data members.
if (Var->hasDefinition() == VarDecl::DeclarationOnly &&
- Var->getLinkage() != ExternalLinkage) {
+ Var->getLinkage() != ExternalLinkage &&
+ !(Var->isStaticDataMember() && Var->hasInit())) {
SourceLocation &old = SemaRef.UndefinedInternals[Var->getCanonicalDecl()];
if (old.isInvalid()) old = Loc;
}
Modified: cfe/trunk/test/SemaCXX/undefined-internal.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/undefined-internal.cpp?rev=149731&r1=149730&r2=149731&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/undefined-internal.cpp (original)
+++ cfe/trunk/test/SemaCXX/undefined-internal.cpp Fri Feb 3 18:54:05 2012
@@ -134,12 +134,15 @@
//
// Note that the warning in question can trigger in cases some people would
// consider false positives; hopefully that happens rarely in practice.
+ //
+ // FIXME: Suppressing this test while I figure out how to fix a bug in the
+ // odr-use marking code.
namespace {
struct A {
static const int unused = 10;
- static const int used1 = 20; // expected-warning {{internal linkage}}
- static const int used2 = 20; // expected-warning {{internal linkage}}
+ static const int used1 = 20; // xpected-warning {{internal linkage}}
+ static const int used2 = 20; // xpected-warning {{internal linkage}}
virtual ~A() {}
};
}
@@ -160,10 +163,10 @@
// Check that the checks work with unevaluated contexts
(void)sizeof(p(A::used1));
- (void)typeid(p(A::used1)); // expected-note {{used here}}
+ (void)typeid(p(A::used1)); // xpected-note {{used here}}
// Misc other testing
- a(A::unused, 1 ? A::used2 : A::used2); // expected-note {{used here}}
+ a(A::unused, 1 ? A::used2 : A::used2); // xpected-note {{used here}}
b();
}
}
More information about the cfe-commits
mailing list