[cfe-dev] Question on C++ code completion - function parameter list

Duc Nguyen Duc.Nguyen at arm.com
Mon Aug 27 01:00:09 PDT 2012


Hello,
Using c-index-test.exe I'm learning clang code completion for C++.
I have an issue to get the current parameter list of a C++ function.  While it works for a C function, I get nothing which can be evaluated in case of C++ function.
 I use the following command line:
"c-index-test -code-completion-at=x.cpp:9:10 -x c++ -fsyntax-only -x.cpp"
Where:

-          "9:10" is the line:column number just after the parenthesis behind the function name.
If the function is a C function, "c-index-test" returns a function parameter list for the function with the node 'CurrentParameter' which is important for code completion:
NotImplemented:{ResultType int}{Text geti}{LeftParen (}{CurrentParameter int i}{Comma , }{Text char c}{RightParen )} (1)
But if I use the same command line asking for the C++ function parameter list, the expected result is not returned.
Hereafter is the source code x.cpp:
int geti(int i, char c) { return 1; }   // C function

class myclass {
public:
  myclass() {}
  ~myclass() {}
  int func(int i, char c) { return 1; }
  void test() {
    func(//line and column number for code completion here, after the parenthesis
  }
};

Could you please tell me, whether the command line to retrieve the parameter list for the C++ function differs from that in C?  And, which command line would be appropriate?
Thanks for any answer and tips.
Duc

-- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120827/0866dae5/attachment.html>


More information about the cfe-dev mailing list