Sarcasm / irony-mode

A C/C++ minor mode for Emacs powered by libclang
GNU General Public License v3.0
901 stars 98 forks source link

Fixed list args error for irony-completion--filter-candidates #571

Closed 3246251196 closed 3 years ago

3246251196 commented 3 years ago

@Sarcasm ,

Hello. I have fixed the issue with #569 and tested locally.

I used the following program to test:

#include <string>

struct MyClass0
{
    MyClass0( void ) { }
    ~MyClass0( void ) { }
    virtual int theFunction( float x ) = 0;
    const std::string thisFunc( void ) const { }
    std::string thisFunc( void ) { }

    virtual const float overrideMe(void){}
    virtual float overrideMe(void) const {}
protected:
    std::string myProtected( void ) { return std::string( " HELLO! " ); };
};

struct MyClass1 : public MyClass0
{
    MyClass1( void ) : MyClass0() { }
    virtual ~MyClass1( void ) { }

    virtual int theFunction( float x ) override { (void)x; }
    virtual const float overrideMe(void) override { ; }
protected:
    int x;
};

struct MyClass2 : public MyClass1
{
    MyClass2( void ) : MyClass1() { }
    ~MyClass2( void ) { }

    virtual int theFunction( float x ) override { (void)x; }

    void someOtherFn()
        {
            std::string x = myProtected();
            (void)x;
        }

    virtual float overrideMe( void ) const { ; }
};

int main( void )
{
    MyClass2 my_class_2;
    return 0;
}

It demonstrates that with Clang version 10 the "protected" bug is not a problem because I get completion for myProtected() inside someOtherFn(). https://bugs.llvm.org//show_bug.cgi?id=24329 (this is not marked as resolved on their end, but probably should be. There are no doubt duplicate issues)

It also demonstrates the continued need for my other merged pull-request (#503) about filtering out duplicates; the duplicate option continues to be disabled by default.

Merci.

Sarcasm commented 3 years ago

Thank you for following up on this. The commit does not start with "bad", so I think it will be ok this time. :D