• Raphael Kubo da Costa's avatar
    CredentialsContainerTest: Rename methods to avoid naming conflicts · debfb4ec
    Raphael Kubo da Costa authored
    GCC is stricter than clang when it comes to class members' names and how
    they can change the meaning of a previously existing symbol with the same
    name:
    
           Document* Document() { return &dummy_context_.GetDocument(); }
                                                                    ^
        In file included from ../../third_party/WebKit/Source/modules/credentialmanager/CredentialsContainerTest.cpp:12:0:
        ../../third_party/WebKit/Source/core/dom/Document.h:248:19: error: changes meaning of ‘Document’ from ‘class blink::Document’ [-fpermissive]
         class CORE_EXPORT Document : public ContainerNode,
                       ^~~~~~~~
        ../../third_party/WebKit/Source/modules/credentialmanager/CredentialsContainerTest.cpp:114:72: error: declaration of ‘blink::ScriptState* blink::{anonymous}::CredentialManagerTestingContext::ScriptState()’ [-fpermissive]
           ScriptState* ScriptState() { return dummy_context_.GetScriptState(); }
                                                                            ^
        In file included from ../../third_party/WebKit/Source/bindings/core/v8/ScriptValue.h:37:0,
                         from ../../third_party/WebKit/Source/bindings/core/v8/ScriptFunction.h:34,
                         from ../../third_party/WebKit/Source/bindings/core/v8/ScriptPromise.h:35,
                         from ../../third_party/WebKit/Source/bindings/core/v8/ExceptionState.h:34,
                         from ../../third_party/WebKit/Source/bindings/core/v8/V8BindingForTesting.h:8,
                         from ../../third_party/WebKit/Source/modules/credentialmanager/CredentialsContainerTest.cpp:10:
        ../../third_party/WebKit/Source/platform/bindings/ScriptState.h:66:23: error: changes meaning of ‘ScriptState’ from ‘class blink::ScriptState’ [-fpermissive]
         class PLATFORM_EXPORT ScriptState : public RefCounted<ScriptState> {
                               ^~~~~~~~~~~
    
    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84709 contains a longer
    explanation, but essentially having a |Document()| or |ScriptState()| method
    can change the meaning of references to the outside types in the code
    depending on where it is declared, which contradicts the C++ standard.
    
    Fix it by renaming the methods to |GetDocument()| and |GetScriptState()|.
    
    Change-Id: I037d009c52a5e44838e90d1b8ea330acf922afaa
    Reviewed-on: https://chromium-review.googlesource.com/968515Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
    Reviewed-by: default avatarBalazs Engedy <engedy@chromium.org>
    Commit-Queue: Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com>
    Cr-Commit-Position: refs/heads/master@{#544041}
    debfb4ec
CredentialsContainerTest.cpp 5.63 KB