[RFC] Using duchain in QMake support
David Nolden
zwabel at googlemail.com
Sat Mar 8 11:42:49 UTC 2008
On Saturday 08 March 2008 10:19:08 Andreas Pakulat wrote:
> - Is "Foo = Bar\n...\nFoo = A B C" only a definition or also a use of
> the Variable Foo? i.e. Foo is re-defined to a different value.
That depends on how you interpret it. After all it's you who builds the
uses/declarations specifically for the language, in the way that you think it
makes sense.
However I'd say that the first assignment is a declaration, because "Foo"
isn't declared yet, and the second assignment contains a use of the
declaration of "Foo".
> - Can I find the last occurence of a variable assignment within a
> certain context?
Sure, as long as you record each assignment as a use. However a use doesn't
contain additional information like the actual expression that is being
assigned.
> - qmake supports config scopes, i.e. "win32 { ... } unix { ...}"
> can I map that with the environment stuff? How do I later on access
> all the different config-parts (so I can enable a switch in the ui
> "show files from all platform-configs")
I don't think you will need such complicated stuff like the C++ environment
management, but I also don't know how this exactly works within QMake, so I
cannot answer it clearly.
> - I guess the include-file stuff in C++ still works properly when having
> a #include in the middle of the file right? (In qmake its not uncommon
> to do a include(somefile.pri) in the middle of a file, especially with
> the config scopes)
Yep in C++ that works. In general, it should be nothing more than a simple
import.
> - Does expression evaluation in C++ support function calls? I guess not,
> but I probably need this for QMake. Is it feasible to calculate this
> during duchain building, or should I just note a use of the function
> and later on calculate it "on the fly"?
In C++, usually only the return-types of functions are evaluated, because
that's all that can be represented statically. Static expressions like "const
int a = otherInt + 5" or "SomeClass<otherConstInt + 5>" are also evaluated
wherever needed, either while building the duchain, or later.
Probably it'll be fine for you to evaluate the functions while building the
duchain.
Greetings, David
More information about the KDevelop-devel
mailing list