[RFC] Using duchain in QMake support
Andreas Pakulat
apaku at gmx.de
Sat Mar 8 18:23:58 UTC 2008
On 08.03.08 12:42:49, David Nolden wrote:
> On Saturday 08 March 2008 10:19:08 Andreas Pakulat wrote:
> > - 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.
Hmm, thats not soo good. Well, I guess I can find the AST for a given
range and use the expression from that...
> > - 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.
Well, it works similar to
#if defined(Q_OS_WIN)
<some code>
#elif defines(Q_OS_UNIX)
...
#endif
and the qmake support obviously needs to know which code belongs to
which config option (or combination of them). Specifically the user can
define its own config options, so its not solely about the platform.
> > - 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.
Yeah, in QMake im in kind of a "lucky" position as its relatively
limited and most of the functions are also defined in the QMake language
(for example loops and such).
Andreas
--
You are capable of planning your future.
More information about the KDevelop-devel
mailing list