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

Duc Nguyen Duc.Nguyen at arm.com
Tue Sep 18 07:42:23 PDT 2012


Hello,
Does anyone have an idea how to get the parameter list of a C++ function using c-index-test.exe ?
While it works for a C function, I get nothing which can be evaluated in case of C++ function.
Thanks for any answer,
Duc
From: cfe-dev-bounces at cs.uiuc.edu [mailto:cfe-dev-bounces at cs.uiuc.edu] On Behalf Of Duc Nguyen
Sent: Monday, August 27, 2012 10:00 AM
To: cfe-dev at cs.uiuc.edu
Subject: [cfe-dev] Question on C++ code completion - function parameter list

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.

-- 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/20120918/d6c79eb1/attachment.html>


More information about the cfe-dev mailing list