[cfe-dev] AST references

Kevin Cathey kcathey2 at illinois.edu
Tue Oct 13 15:41:57 PDT 2009


I have the following file:

@protocol MyProtocol
- (void)someProtocolMethod;
@end

@interface MyBaseClass <MyProtocol> {
    id myIvar;
}
@end

When printing out the AST node for the @protocol declaration, I get:
$4 = {
  DeclKind = clang::Decl::ObjCProtocol, 
  ExternalLexicalStorage = false, 
  ExternalVisibleStorage = false, 
  LookupPtr = 0x0, 
  FirstDecl = 0x1033160c0, 
  LastDecl = 0x1033160c0
}

However, when I print out the AST node for <MyProtocol>, I get a different value:
$5 = {
  <clang::Decl> = {
    _vptr$Decl = 0x1016f80d0, 
    NextDeclInContext = 0x103316150, 
    DeclCtx = {
      Val = {
        Value = 4348516192
      }
    }, 
    Loc = {
      ID = 2
    }, 
    DeclKind = clang::Decl::ObjCProtocol, 
    InvalidDecl = 0, 
    HasAttrs = 0, 
    Implicit = false, 
    Used = false, 
    IdentifierNamespace = 16, 
    Access = 0
  }, 
  members of clang::NamedDecl: 
  Name = {
    Ptr = 4353910984
  }
}

I was under the impression that clang would resolve references. So MyProtocol would be the same in both places. If not, how do I resolve these references?

Thanks.

Kevin

-------------------------------------------------
Kevin Cathey
Department of Computer Science - College of Engineering
University of Illinois Urbana Champaign


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20091013/ee5dcbba/attachment.html>


More information about the cfe-dev mailing list