Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] ASTVisitor
  • From: Ming Cheng <chengm349@xxxxxxxxxxx>
  • Date: Tue, 25 Feb 2020 04:31:19 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Xtafi51ZpEKCT9cUVx1UAvAheIHMlMsfjlAgU1WqOZU=; b=VydqHtkLrsKP33QqLxoUXFyZ37svi6oQQaEz3GwQ63D37oxgKL0fUOi4yNSBWOC1k+WIO6DEI5srVoKRb5HHYsP1JDp0PgNjfiuwxXkMcJdbMXnISwRsZuU4szRAiPDG4Uycch7Iv+RLf8Cys42Y/xd1EYbVY/jNfToQdjz+30RfCZCWjBGSP4DkVQcZ9ebllbgov+YZr4JFE5XTgByP51uO/S7Fdm8TXJS3z+3R2TWuxYz52opfhrzHLl12Bkq7y+1H61oJ3pMkWtN9NZ96qG/3T8Dm50h4GSw7WcYBk/ZdnLorR6YZi+HTw/o+mWt2XwR+nAdeC24JlfqLHPwcFw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FA/X8ByenBOHe84yxm1jMv5zOV3qlCIWHI8kDUnGvS3tjf4FVnKoMweV9HDAF3L8Bg0stYMo4I1sMvfVLABc6PDxM5TgUsvCbypyKmsFugf7UUGUbmpXeBEhZ1ADobQvPDMIrVebGoSLJKnJVklyu9GPZJGcDuT5BvqPEsop6/BtIS2eB5NP96YAtfyJPiRSs6TGS+5YA/VkXmLMN9va62wWbyt5uCEfYrRCCnUqzlTtlhjzd7lnSyY3Fu33ZcLKiKRz8aTQo/A6goF6S6k2CNhvG6ep73ewgANV4qgolqjnstHiKIPPBP/PoGbI3L+SGOCflGEGLm4UNcWLYBjkoA==
  • Delivered-to: cdt-dev@xxxxxxxxxxx
  • List-archive: <https://www.eclipse.org/mailman/private/cdt-dev>
  • List-help: <mailto:cdt-dev-request@eclipse.org?subject=help>
  • List-subscribe: <https://www.eclipse.org/mailman/listinfo/cdt-dev>, <mailto:cdt-dev-request@eclipse.org?subject=subscribe>
  • List-unsubscribe: <https://www.eclipse.org/mailman/options/cdt-dev>, <mailto:cdt-dev-request@eclipse.org?subject=unsubscribe>
  • Thread-index: AQHV6Vz0OMzcOHgJuUmjUuYoR8kAx6gnNyuAgAQc4PU=
  • Thread-topic: [cdt-dev] ASTVisitor

Hi Jonah and All,

 

Thanks for your kind help so I can move further along the a possible long way. Now I encountered another issue.

 

private static int visit(IIndex index, CPPASTFunctionDeclarator cppFunctionDeclarator) {

        display("Visiting CPPASTFunctionDeclarator: " + cppFunctionDeclarator.getRawSignature());

        processFuncName(index, cppFunctionDeclarator.getName().toString());

        return PROCESS_CONTINUE;

    }

 

private static void processFuncName(IIndex index, String funcName) {

        // find bindings for name

       

        try {

            index.acquireReadLock();

            IIndexBinding[] bindings= index.findBindings(funcName.toCharArray(),IndexFilter.ALL_DECLARED, new NullProgressMonitor());

            // find references for each binding

            JOptionPane.showMessageDialog(CurrentGui.getInstance().getGui().getMainFrame(), "IIndexBinding size=" + bindings.length, "INFO", JOptionPane.INFORMATION_MESSAGE);

            for (IIndexBinding b : bindings) {

                if (b instanceof IFunction) {

                    outputReferences(index, b);

                } else {

                    display("non IFunction");

                }

            }

        } catch (CoreException e) {

            log.error(e.getMessage());

        } catch (InterruptedException e) {

            log.error(e.getMessage());

        } finally {

            index.releaseReadLock();

        }

    }

 

When my program ran here:

 

 

The next prompt is “non IFunction”.

 

Index was created like this:

 

IIndex index= CCorePlugin.getIndexManager().getIndex(cproject, IIndexManager.UPDATE_ALL |

                                                                                IIndexManager.UPDATE_EXTERNAL_FILES_FOR_PROJECT);

 

Thanks.

Sent from Mail for Windows 10

 

From: Jonah Graham
Sent: Saturday, February 22, 2020 9:36 PM
To: CDT General developers list.
Subject: Re: [cdt-dev] ASTVisitor

 

Hello,

 

I believe you want visit(IASTDeclaration) for ICPPASTLinkageSpecification.

 

IIRC IASTPreprocessorIncludeStatement and the pre-processor in general is not visitable, use IASTTranslationUnit.getAllPreprocessorStatements() and/or getIncludeDirectives

 

Jonah

 


~~~
Jonah Graham
Kichwa Coders
www.kichwacoders.com

 

 

On Sat, 22 Feb 2020 at 03:59, Ming Cheng <chengm349@xxxxxxxxxxx> wrote:

Hi,

 

ASTVisitor does not provide visit(ICPPASTLinkageSpecification ) and many other CPP specific types callback interface; neither of IASTPreprocessorIncludeStatement. What's the best practice of read these lines?

 

Thanks.

_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/cdt-dev

 


Back to the top