[cfe-commits] r148625 - /cfe/trunk/lib/CodeGen/CGExpr.cpp
Eli Friedman
eli.friedman at gmail.com
Fri Jan 20 20:52:59 PST 2012
Author: efriedma
Date: Fri Jan 20 22:52:58 2012
New Revision: 148625
URL: http://llvm.org/viewvc/llvm-project?rev=148625&view=rev
Log:
Add an assertion that our use-marking actually covers all uses of a variable. The assertion doesn't cover quite as much as it should, but it's a good start, at least.
Modified:
cfe/trunk/lib/CodeGen/CGExpr.cpp
Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=148625&r1=148624&r2=148625&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Fri Jan 20 22:52:58 2012
@@ -1381,6 +1381,13 @@
CharUnits Alignment = getContext().getDeclAlign(ND);
QualType T = E->getType();
+ // FIXME: We should be able to assert this for FunctionDecls as well!
+ // FIXME: We should be able to assert this for all DeclRefExprs, not just
+ // those with a valid source location.
+ assert((ND->isUsed(false) || !isa<VarDecl>(ND) ||
+ !E->getLocation().isValid()) &&
+ "Should not use decl without marking it used!");
+
if (ND->hasAttr<WeakRefAttr>()) {
const ValueDecl *VD = cast<ValueDecl>(ND);
llvm::Constant *Aliasee = CGM.GetWeakRefReference(VD);
More information about the cfe-commits
mailing list