Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Confusion again.
  • From: Ming Cheng <chengm349@xxxxxxxxxxx>
  • Date: Wed, 4 Mar 2020 01:42:35 +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=kpICHUkjKD2GdFUJAJFXtAh9IoihJLvq0LhRBahirUQ=; b=j1+mEE7Z5C6GsHmVqZdWJQtnb78qQ18FdKmyOr9BBfBTtO5XXOP7DjnpZZc4Fct7wwIq5f+NXRZVBYv6yMH6uWiIrspX7pHeo2sJsWVH30nWOT0t/D762IuJze9alN6FESArm5m1MJO/JC0iIRiiN4js10pzAzRg230GnkchdDD921wxFOVi3N6x2HIp9SmvAT27tJcp+hD1dClt2wio+JWapr3dby04po+sdH/K28C661mh6ZPzQjySXaWgQKBZ7KErsOlJxp+cVRZSR2kvT7+itvCJI/FMtfvyCtPO8Wp/J3bTqr73PY3fW7x90R9JBKOtxeUIgM3LPKC8sJye3w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LZK0ayeN1NOg7uamQVpUiGRsonTb6jN53NvsdLp7e7hIrqFa3Ea0dA7RlovogYIcEtxsHWq5hyWUE0ugdVVvh4nWwbRXR6Gal6JhFjA5szAS07PCEa2sHYMD9bupmq+yVBDyHivRMzVeSYrhtg0uMfvVBW33sE5qGkJIBYgEwXSkKD43jJ6ESUcUnbNYNNW1MWndzJc74cmXccYDrCpV0FySdQczkjF8caQ1wS9dTjs2Mx9uYVgfCpus63thLV0WffJQpWNxtS8e/r0+tJXWY1RGt3KxguR5c4S1AT2q3469iISq7shE/QxLgasqbYh2F+wkW/llPFjtOmmtkpUYcA==
  • 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: AQHV8H2NHtXLElb12U+Hd2ShrTFmAqg3qbPO
  • Thread-topic: Confusion again.

I know when my program parses my C++ src, it came to my function:

private static int visit(IIndex index, ICPPASTFunctionDeclarator cppFunctionDeclarator) {
        display("Visiting ICPPASTFunctionDeclarator: " + cppFunctionDeclarator.getRawSignature());
        //display(cppName.getBinding().getName());
        IBinding b = CPPVisitor.createBinding(cppFunctionDeclarator.getName());
        if (b != null)
            processFuncName(index, b);
        else {
            display("failed to find IBinding");
        }
        return PROCESS_CONTINUE;
    }



However processFuncName() prompts "non IFunction":

private static void processFuncName(IIndex index, IBinding b) {
        try {
                    if (b instanceof IFunction) {
                        outputReferences(index, b);
                    } else if (b instanceof IProblemBinding) {
                        display("IProblemBinding");
                    } else if (b instanceof ICPPUnknownBinding) {
                        display("ICPPUnknownBinding");
                    }  else {    
                        display("non IFunction");
                    }
        } catch (CoreException e) {
            log.error(e.getMessage());
        } 
    }

Where did it go wrong?

Thanks.

From: Ming Cheng
Sent: Monday, March 2, 2020 10:32 AM
To: cdt-dev@xxxxxxxxxxx <cdt-dev@xxxxxxxxxxx>
Subject: Confusion again.
 
My C++ source code:

void initPluginAgentMsgCopy(PFO_PluginAgent& );

class CPlImplMsgCopy : public QFIXFLEX_NMSP::CPluginImplBase<CPlImplMsgCopy>
{
public:
    CPlImplMsgCopy() : m_pMgr(NULL), m_bDoRecovery(false)
    {
    }
    ~CPlImplMsgCopy()
    {
        if (NULL != m_pMgr)
        {
            delete m_pMgr;
            m_pMgr = NULL;
        }
    }

    static const std::string& name()
    {
        static const std::string s_name("MSGCOPY");
        return s_name;
    }
}


My Java processing code:

private static void processFuncName(IIndex index, IASTName funcName) {
        // find bindings for name
        try {
            index.acquireReadLock();
            IBinding binding = funcName.resolveBinding();
            if (binding != null) {
                display(binding.getName());
                IIndexBinding[] bindings= index.findBindings(binding.getName().toCharArray(), IndexFilter.ALL_DECLARED, new NullProgressMonitor());
                display("bindings=" + bindings.length);
                for (IIndexBinding b : bindings) {
                    if (binding instanceof IFunction) {
                        outputReferences(index, binding);
                    } else {
                         
                        display("non IFunction");
                    }
                }
            }
        } catch (CoreException e) {
            log.error(e.getMessage());
        } catch (InterruptedException e) {
            log.error(e.getMessage());
        } finally {
            index.releaseReadLock();
        }
    }

initPluginAgentMsgCopy() will come to outputReferences() but CPlImplMsgCopy() /name().

display("bindings=" + bindings.length); does show these 3 (initPluginAgentMsgCopy() /CPlImplMsgCopy() /name() binding size are 1.

Thanks.

Back to the top