Incorrect "Encapsulation not preserved" error
With KWStyle.xml:
<?xml version="1.0" encoding="iso-8859-1"?>
<Description>
<InternalVariables>m_[A-Z],0,1</InternalVariables>
</Description>
and Outer.h:
class Outer
{
public:
Outer() {}
private:
class Inner
{
public:
Inner() {}
};
Inner m_Inner;
};
KWStyle shows an error:
$ KWStyle -xml KWStyle.xml -v Outer.h -gcc
Processing Outer.h
Error #1 (0) Encapsulation not preserved
The error refers to the Inner m_Inner; line and suggests that the internal variable m_Inner is not in a protected or private section. However, it's clear that m_Inner is in a private section.
Tested with Kitware/KWStyle@0620fdd3ef07d124514331ae35c22b7a4c1d0d71.
The nested class definitions is not handled correctly. Good catch!
One way to fix this is to update KWStyle/kwsParser.h/.cxx with a function to determine scope and then FindArea should only find tags (public, private, ...) that are at the same scope.
s
On Tue, Nov 29, 2016 at 12:15 PM, Max Smolens [email protected] wrote:
With KWStyle.xml:
m_[A-Z],0,1 and Outer.h:
class Outer { public: Outer() {}
private: class Inner { public: Inner() {} };
Inner m_Inner;};
$ KWStyle -xml KWStyle.xml -v Outer.h -gcc Processing Outer.h Error #1 (0) Encapsulation not preserved
The error refers to the Inner m_Inner; line and suggests that the internal variable m_Inner is not in a protected or private section. However, it's clear that m_Inner is in private section.
Tested with Kitware/KWStyle@0620fdd https://github.com/Kitware/KWStyle/commit/0620fdd3ef07d124514331ae35c22b7a4c1d0d71 .
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Kitware/KWStyle/issues/45, or mute the thread https://github.com/notifications/unsubscribe-auth/AAREr8l7wL5Kigb8__BTeNuqfngE7NeAks5rDF2zgaJpZM4K_PSg .