简体   繁体   中英

Emacs CEDET Semantic no autocomplete for `this` keyword. (C++)

#include <iostream>

class SomeStructure
{
  int mMemberOne;
  float mMemberTwo;

  char MemberFunction()
    {
      int test = 0;
      ++test;
      this->  
    }
};

  int main()
  {
    SomeStructure abc;
    abc.MemberFunctionMemberFunction
  }

Any other autocompletion works in this file except when I'm trying to autocomplete this-> . I get no suggestions. Running semantic-analyze-debug-assist gives me this:

 Unable to find symbol this. The prefix lookup code threw the following error: (error "Cannot find definition for \\"this\\"") To debug this error you can do this: Mx toggle-debug-on-error RET [ Do It ] and then re-run the debug analyzer. 

Mx bovinate gives me:

(("iostream" include   (:system-flag t)   (unlink-hook    (semantic--tag-unlink-secondary-overlays)    secondary-overlays    (#<overlay from 1 to 20 in junk.cpp>)    dependency-file "c:/Program Files (x86)/Microsoft Visual Studio 11.0/VC/include/iostream" link-hook    (semantic--tag-link-secondary-overlays)    unlink-copy-hook    (semantic--tag-unlink-copy-secondary-overlays)    :filename "d:/project/client/junk.cpp")   #<overlay from 1 to 20 in junk.cpp>)  ("SomeStructure" type   (:members    (("mMemberOne" variable
     (:type "int")
     (reparse-symbol classsubparts)
     #<overlay from 46 to 61 in junk.cpp>)
    ("mMemberTwo" variable
     (:type "float")
     (reparse-symbol classsubparts)
     #<overlay from 64 to 81 in junk.cpp>)
    ("MemberFunction" function
     (:type "char")
     (unlink-copy-hook
      (semantic--tag-unlink-copy-secondary-overlays)
      link-hook
      (semantic--tag-link-secondary-overlays)
      reparse-symbol classsubparts secondary-overlays
      (#<overlay from 85 to 107 in junk.cpp>)
      unlink-hook
      (semantic--tag-unlink-secondary-overlays))
     #<overlay from 85 to 165 in junk.cpp>))    :type "class")   (unlink-copy-hook    (semantic--tag-unlink-copy-secondary-overlays)    link-hook    (semantic--tag-link-secondary-overlays)    secondary-overlays    (#<overlay from 22 to 42 in junk.cpp>)    unlink-hook    (semantic--tag-unlink-secondary-overlays))   #<overlay from 22 to 168 in junk.cpp>)  ("main" function   (:type "int")   (unlink-copy-hook    (semantic--tag-unlink-copy-secondary-overlays)    link-hook    (semantic--tag-link-secondary-overlays)    secondary-overlays    (#<overlay from 172 to 183 in junk.cpp>)    unlink-hook    (semantic--tag-unlink-secondary-overlays))   #<overlay from 172 to 250 in junk.cpp>))

So it looks like the SomeStructure structure is parsed correctly. It just looks like semantic has some kind of problem with this .

Also I followed the error's suggestion of re-running with toggle-debug-on-error enabled, however even with that enabled the debugger doesn't appear to break on error.

Using the latest version of emacs (24) and cedet (trunk).

I can't believe I'm the only one having this problem, it must be something I'm doing wrong...

I have corresponded with one of the maintainers (David Engster), and he was very responsive to provide a fix for this. The fix can be found in the CEDET's bzr repository as of revision 8490

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM