Re: Semantic does not pick up auto variables in a BOOST_FOREACH loop

Eric Ludlam <[email protected]> Tue, 23 Dec 2014 11:41:01 -0500
Newsgroups gmane.emacs.semantic
Message-ID <[email protected]>
On 12/08/2014 12:16 PM, Dixon Ryan (ETAS/ESW6) wrote:
> I am quite surprised by this particular issue:
>
> Here is the single file:
> ======START=====
> #include <boost/foreach.hpp>
> #include <iostream>
> #include <vector>
>
> struct MyStruct {
>     int data;
>     int getData( void ) { return data; }
> };
>
> int main ( void ) {
>     std::vector<MyStruct*> myVec;
>     myVec.push_back ( new MyStruct() );
>     myVec.push_back ( new MyStruct() );
>
>     BOOST_FOREACH( MyStruct* ms, myVec )
>     {
>        std::cout << "Addr: " << ms << std::endl;
>        ms-> // does not work


The local context engine does not find variables in any "function call" 
like syntax, only after { block starts.  It is not impossible to add 
support, it is just that similar blocks, such as for(int i ... never had 
structured data that mattered enough to warrant the effort.

There is a project active for a g++ plugin that David Engster is working 
on that will improve the c++ support in CEDET/Semantic.  Hopefully that 
will help with cases like this since it will have the full preprocessor 
doing the work.

Eric



------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net