[cfe-dev] TreeTransform question
    Chris Lattner 
    clattner at apple.com
       
    Thu Feb 17 00:32:52 PST 2011
    
    
  
I'm working on making the new labeldecl stuff instantiate properly with TreeTransform (fixing some attributes related stuff along the way) and am running into a stumbling block.
I have LabelStmt doing:
+  Decl *LD = getDerived().TransformDefinition(S->getDecl()->getLocation(),
+                                              S->getDecl());
+  if (!LD)
+    return StmtError();
which seems to work, and uses of labels (like goto) do this:
 TreeTransform<Derived>::TransformGotoStmt(GotoStmt *S) {
+  Decl *LD = getDerived().TransformDecl(S->getLabel()->getLocation(),
+                                        S->getLabel());
+  if (!LD)
+    return StmtError();
The problem is that cases where the label is used before it is defined explodes tree transform with:
Assertion failed: (D->isInvalidDecl() && "declaration was not instantiated in this scope!"), function findInstantiationOf, file SemaTemplateInstantiate.cpp, line 2206.
What is the right level to instantiate the label decl?  It seems that I could just make TransformDecl do the instantiation... is this the best place to do it?
This is my patch in progress, mostly for my own benefit when I get to work tomorrow, but also perhaps useful:
-Chris
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p.patch
Type: application/octet-stream
Size: 20491 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110217/15d8dc90/attachment.obj>
    
    
More information about the cfe-dev
mailing list