CppParser, CodeCompletion and ClassView Problem
Robert Gruber
rgruber at users.sourceforge.net
Wed May 31 08:53:49 UTC 2006
On Wed May 31 09:58:59 amantia at kde.org wrote:
> 1) Why don't you use gcc instead of g++?
Actually the *.c files get compiled by gcc.
*.cc Files get compiled by g++ because even if there are just function (and no
class definitions) they might be using the STL or some of our own C++
libraries.
> 2) Why don't you use g++ -x c (man g++ to see what I mean)?
We use the extern "C" to disable the C++ name-mangling for function which
resides in a file for the C++ compiler but in fact are ANSI-C functions.
Besides that g++ has a much stricter type check and so on.
But nevertheless, why is there a difference between the ClassView and the
"Functions in file" combobox. Don't they both get their data from the
CppParser?
> 3) I hope you are talking about the branches/kdevelop/3.4 and not
> branches/KDE/3.5/kdevelop.
You're right. Sorry, just a typo :-(
Is there any prossibility to find out if the parser has a problem with the a
file or is it possible to test which data the parser is able to extract from
a file?
Best Regards, Robert
On Wed May 31 09:51:05 CEST 2006 Robert Gruber wrote:
>Hi,
>
>i've got some questions about the classview and the new codecompletion in
>"kdevelop/3.5" branch.
>
>At work I use KDevelop to develop our software. It is written mainly in
>ANSI-C
>but gets compiled by g++ and therefor each implementation file (*.cc and *.c)
>and header file has a >> extern "C" { .... } << around the declaration and
>the definition of the functions.
>
>
>1) [ Actually I don't really know if this is a problem of the parser or the
>classview ]
>Unfortunatly the functions that are defined inside the extern "C" block do
>not
>show up in the classview at all but gets shown in the "Functions in file"
>combobox.
>
>What is really strange is this. If I remove the extern "C" part from both the
>header and the implementation file, the functions show up in the classview
>and when I select one KDevelop jumps to the declaration of the function. But
>I still cannot jump to the implementation of the function. I only saw this
>behavior if the implementation of the function is inside a *.cc file. It
>seams to me that if the functions are in a *.c file the classview can jump to
>both the declaration as well as to the implementation.
>
>So my questions are: Is there a problem with extern "C" in the parser? And
>does the parser or the classview ignore *.cc files?
>
>
>2)
>I also have some strange behavior with the codecompletion.
>First of all our project contains several hundreds of files. In some files I
>get codecompletion in most of then not.
>
>If codecompletion works in a file I only get the localy defined variables and
>the parameters of the function. Not a single function shows up in the
>selection list. (This might be related to the extern "C" problem
>somehow!?!?). But for most of the files codecompletion does not works at all.
>Hitting <Ctrl>+<Space> has no effect. What really confuses me is, that I
>can't find big differences between files with working and files with none
>working codecompletion.
>
>
>
>Here are some messages that get written to stdout while loading the project:
>kdevelop (cpp support): projectOpened( )
>kdevelop (cpp support): CppSupportPart::setupCatalog()
>kdevelop (cpp support): ProblemReporter::configure()
>kdevelop (cpp support): [void
>CppCodeCompletion::slotActivePartChanged(KParts::Part*)]
>kdevelop (cpp support): [void
>CppCodeCompletion::slotActivePartChanged(KParts::Part*)] -- end
>kdevelop (cpp support): [void
>CppCodeCompletion::integratePart(KParts::Part*)]
>integrate document: 0x9574e10
>kdevelop (cpp support): CppSupportPart::parseProject 1
>kdevelop (cpp support): CppSupportPart::parseProject 2
>kdevelop (cpp support): CppSupportPart::parseProject 3
>kdevelop (cpp support): CppSupportPart::parseProject 4
>kdevelop (cpp support): CppSupportPart::parseProject 5
>ASSERT: "part && parent" in /tmp/kdevelop_34/parts/fileview/partwidget.cpp
>(41)
>ERROR: syntax error
>ERROR: syntax error
>ERROR: syntax error
>ERROR: syntax error
>ERROR: syntax error
>ERROR: syntax error
>ERROR: syntax error
>ERROR: syntax error
>ERROR: syntax error
>ERROR: syntax error
>ERROR: syntax error
>kdevelop (cpp support): CppSupportPart::customEvent(2000)
>kdevelop (cpp support): ParseEmitWaiting: file
>"/mybig/product/WAMAS/llr/src.rgruber.HEAD/wamas-wamasp/wppool/wppool_s/dcckommprn_util.cc"
>has no group waiting for it
>kdevelop (cpp support): remove with
>references: /mybig/product/WAMAS/llr/src.rgruber.HEAD/wamas-wamasp/wpgirad/wpgirad_s/wpgirad_ctxutil.h
>kdevelop (cpp support): remove with
>references: /mybig/product/WAMAS/llr/src.rgruber.HEAD/wamas-wamasp/wpgirad/wpgirad_s/wpgirad_lists.h
>kdevelop (cpp support): remove with
>references: /mybig/product/WAMAS/llr/src.rgruber.HEAD/wamas-wamasp/wpgirad/wpgirad_s/wpgirad_ctxutil.cc
>kdevelop (cpp support): updating sourceinfo
>
>
>
>
>When hitting <Ctrl>+<Space> in a file where codecompletion works this shows
>up:
>kdevelop (cpp
>support): /mybig/product/WAMAS/llr/src.rgruber.HEAD/wamas-wamasp/wppool/wppool_s/dcckommprn_util.cc--->
>file added to background-parser(by problem-reporter)
>kdevelop (cpp support): CppSupportPart::customEvent(2000)
>kdevelop (cpp support): not updating code-model because at least one file has
>errors
>kdevelop (cpp support): CppCodeCompletion::computeRecoveryPoints
>kdevelop (cpp support): found 3 recovery points
>kdevelop (cpp support): CppCodeCompletion::completeText()
>kdevelop (cpp support): using code-model for completion
>kdevelop (cpp support): startLine = int GetNextTeIdToIdentifyByKsNrPos (
>kdevelop (cpp support): -------------> reparse text
>kdevelop (cpp support): int GetNextTeIdToIdentifyByKsNrPos (
> const void *kpvTid,
> const char *kpcFac,
> const long klKsNr,
> const POS *kptTpmPos,
> TEK *ptTek)
>{
> const char *kpcFctName =
>"GetNextTeIdToIdentifyByKsNrPos";
> int iDbRv = 0;
> string strStmt = "";
>
>pt
>kdevelop (cpp support): --------------------------------------------
>kdevelop (cpp support): is function definition= true
>kdevelop (cpp support): endLine = 11, endColumn 2
>kdevelop (cpp support): [int CppCodeCompletion::expressionAt(const QString&,
>int)]
>kdevelop (cpp support): CppCodeCompletion::computeContext() -- main
>kdevelop (cpp support): scope is empty
>kdevelop (cpp support): inserting import (std) into the global scole
>kdevelop (cpp support): (34)Initializing evaluation of expression false
>kdevelop (cpp support): ===========================> type is:
>kdevelop (cpp support): ===========================> word is: pt
>kdevelop (cpp support): 8types in type-store before destruction
>kdevelop (cpp support): type-store is not empty, 8 types are left over
>kdevelop (cpp support): type left: ()
>kdevelop (cpp support): type left: ()
>kdevelop (cpp support): type left: ()
>kdevelop (cpp support): type left: ()
>kdevelop (cpp support): type left: ()
>kdevelop (cpp support): type left: ()
>kdevelop (cpp support): type left: ()
>kdevelop (cpp support): type left: ()
>kdevelop (cpp
>support): /mybig/product/WAMAS/llr/src.rgruber.HEAD/wamas-wamasp/wppool/wppool_s/dcckommprn_util.cc--->
>file added to background-parser(by problem-reporter)
>kdevelop (cpp support): CppSupportPart::customEvent(2000)
>kdevelop (cpp support): not updating code-model because at least one file has
>errors
>kdevelop (cpp support): CppCodeCompletion::computeRecoveryPoints
>kdevelop (cpp support): found 3 recovery points
>
>
>
>
>
>
>
>
>When hitting <Ctrl>+<Space> in a file where codecompletion does NOT work this
>shows up:
>kdevelop (cpp support): CppCodeCompletion::completeText()
>kdevelop (cpp support): using code-model for completion
>kdevelop (cpp support): startLine = int WpGiRad_HandleCbStack(void* pvTid,
>const char* pkcFac,
>kdevelop (cpp support): -------------> reparse text
>kdevelop (cpp support): int WpGiRad_HandleCbStack(void* pvTid, const char*
>pkcFac,
> OpmsgTCbStackPtr ptStack, int iError,
>CbStackQuestion&
>question)
>{
> int iRv;
>kdevelop (cpp support):
>kdevelop (cpp support): --------------------------------------------
>kdevelop (cpp support): is function definition= true
>kdevelop (cpp support): endLine = 3, endColumn 9
>kdevelop (cpp support): [int CppCodeCompletion::expressionAt(const QString&,
>int)]
>kdevelop (cpp support): CppCodeCompletion::computeContext() -- main
>kdevelop (cpp support): inserting import (wamas,wamasp) into the global scole
>kdevelop (cpp support): (70)Initializing evaluation of expression false
>kdevelop (cpp support): ===========================> type is:
>kdevelop (cpp support): ===========================> word is:
>kdevelop (cpp support): 30types in type-store before destruction
>kdevelop (cpp support): type-store is not empty, 10 types are left over
>kdevelop (cpp support): type left: ()
>kdevelop (cpp support): type left: wamasp (wamas::wamasp)
>kdevelop (cpp support): type left: wamasp ()
>kdevelop (cpp support): type left: wamasp (wamas::wamasp)
>kdevelop (cpp support): type left: ()
>kdevelop (cpp support): type left: ()
>kdevelop (cpp support): type left: wamasp* (wamas::wamasp)
>kdevelop (cpp support): type left: ()
>kdevelop (cpp support): type left: ()
>kdevelop (cpp support): type left: wamasp ()
>
>
>
>
>
>Hopefully this helps you in any way. If you need any further information or
>there is anything else I could do just let me know.
>
>Just to make sure, I'm using KDevelop compiled from sources from the
>"kdevelop/3.5" branch. Last updated on 30th of May with my developer svn
>account.
>
>
>Best Regards, Robert
More information about the KDevelop-devel
mailing list