tdf#123936 Formatting files in module idl with clang-format

Change-Id: I0a2681218773288c14b6faf98dd0bb8a7dbac56d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105679
Tested-by: Jenkins
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
This commit is contained in:
Philipp Hofer
2020-11-12 13:00:40 +01:00
committed by Christian Lohmaier
parent 7721e7a797
commit 9c9a822920
15 changed files with 107 additions and 120 deletions

View File

@@ -22,10 +22,7 @@
#include <database.hxx>
#include <osl/file.hxx>
SvMetaModule::SvMetaModule()
{
}
SvMetaModule::SvMetaModule() {}
void SvMetaModule::WriteSfx(SvIdlDataBase& rBase, SvStream& rOutStm)
{

View File

@@ -26,7 +26,8 @@ class AstConstants final : public AstModule
public:
AstConstants(const OString& name, AstScope* pScope)
: AstModule(NT_constants, name, pScope)
{}
{
}
};
#endif // INCLUDED_IDLC_INC_ASTCONSTANTS_HXX

View File

@@ -23,16 +23,14 @@
#include "astscope.hxx"
#include "astconstant.hxx"
class AstEnum final : public AstType
, public AstScope
class AstEnum final : public AstType, public AstScope
{
public:
AstEnum(const OString& name, AstScope* pScope);
virtual ~AstEnum() override;
sal_Int32 getEnumValueCount()
{ return m_enumValueCount++; }
sal_Int32 getEnumValueCount() { return m_enumValueCount++; }
AstConstant* checkValue(AstExpression* pExpr);

View File

@@ -26,7 +26,8 @@ class AstException final : public AstStruct
public:
AstException(const OString& name, AstException const* pBaseType, AstScope* pScope)
: AstStruct(NT_exception, name, pBaseType, pScope)
{}
{
}
};
#endif // INCLUDED_IDLC_INC_ASTEXCEPTION_HXX

View File

@@ -22,18 +22,19 @@
#include "astdeclaration.hxx"
#include "astscope.hxx"
class AstModule : public AstDeclaration
, public AstScope
class AstModule : public AstDeclaration, public AstScope
{
public:
AstModule(const OString& name, AstScope* pScope)
: AstDeclaration(NT_module, name, pScope)
, AstScope(NT_module)
{}
{
}
AstModule(NodeType type, const OString& name, AstScope* pScope)
: AstDeclaration(type, name, pScope)
, AstScope(type)
{}
{
}
virtual bool dump(RegistryKey& rKey) override;
};

View File

@@ -27,10 +27,11 @@ public:
AstNeeds(AstService* pRealService, const OString& name, AstScope* pScope)
: AstDeclaration(NT_needs, name, pScope)
, m_pRealService(pRealService)
{}
{
}
AstService* getRealService() { return m_pRealService; }
AstService* getRealService()
{ return m_pRealService; }
private:
AstService* m_pRealService;
};

View File

@@ -27,10 +27,11 @@ public:
AstObserves(AstInterface* pRealInterface, const OString& name, AstScope* pScope)
: AstDeclaration(NT_observes, name, pScope)
, m_pRealInterface(pRealInterface)
{}
{
}
AstInterface* getRealInterface() { return m_pRealInterface; }
AstInterface* getRealInterface()
{ return m_pRealInterface; }
private:
AstInterface* m_pRealInterface;
};

View File

@@ -31,17 +31,13 @@ public:
AstScope(NodeType nodeType);
virtual ~AstScope();
NodeType getScopeNodeType() const
{ return m_nodeType; }
NodeType getScopeNodeType() const { return m_nodeType; }
AstDeclaration* addDeclaration(AstDeclaration* pDecl);
sal_uInt32 nMembers() const
{ return static_cast<sal_uInt32>(m_declarations.size()); }
DeclList::const_iterator getIteratorBegin() const
{ return m_declarations.begin(); }
DeclList::const_iterator getIteratorEnd() const
{ return m_declarations.end(); }
sal_uInt32 nMembers() const { return static_cast<sal_uInt32>(m_declarations.size()); }
DeclList::const_iterator getIteratorBegin() const { return m_declarations.begin(); }
DeclList::const_iterator getIteratorEnd() const { return m_declarations.end(); }
sal_uInt16 getNodeCount(NodeType nType) const;
// Name look up mechanism
@@ -57,8 +53,7 @@ public:
AstDeclaration* lookupForAdd(AstDeclaration const* pDecl) const;
protected:
AstDeclaration const * getLast() const
{ return m_declarations.back(); }
AstDeclaration const* getLast() const { return m_declarations.back(); }
private:
DeclList m_declarations;

View File

@@ -27,15 +27,18 @@ public:
AstSequence(AstType const* pMemberType, AstScope* pScope)
: AstType(NT_sequence, OStringLiteral("[]") + pMemberType->getScopedName(), pScope)
, m_pMemberType(pMemberType)
{}
{
}
AstType const * getMemberType() const
{ return m_pMemberType; }
AstType const* getMemberType() const { return m_pMemberType; }
virtual bool isUnsigned() const override
{ return m_pMemberType != nullptr && m_pMemberType->isUnsigned(); }
{
return m_pMemberType != nullptr && m_pMemberType->isUnsigned();
}
virtual const char* getRelativName() const override;
private:
AstType const* m_pMemberType;
mutable std::optional<OString> m_xRelativName;

View File

@@ -26,7 +26,8 @@ class AstType : public AstDeclaration
public:
AstType(const NodeType type, const OString& name, AstScope* pScope)
: AstDeclaration(type, name, pScope)
{}
{
}
virtual bool isUnsigned() const { return false; }
};

View File

@@ -17,7 +17,6 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <astexpression.hxx>
#include <astconstant.hxx>
#include <astscope.hxx>
@@ -84,17 +83,14 @@ AstExpression::AstExpression(OString* scopedName)
m_xSymbolicName = *scopedName;
}
AstExpression::~AstExpression()
{
}
AstExpression::~AstExpression() {}
/*
* Perform the coercion from the given AstExprValue to the requested
* ExprType. Return an AstExprValue if successful, NULL if failed.
* must be done for hyper, uhyper
*/
static bool
coerce_value(AstExprValue *ev, ExprType t)
static bool coerce_value(AstExprValue* ev, ExprType t)
{
if (ev == nullptr)
return false;
@@ -735,7 +731,8 @@ coerce_value(AstExprValue *ev, ExprType t)
return true;
case ET_double:
{
if (static_cast<float>(ev->u.dval) > FLT_MAX || static_cast<float>(ev->u.dval) < -FLT_MAX)
if (static_cast<float>(ev->u.dval) > FLT_MAX
|| static_cast<float>(ev->u.dval) < -FLT_MAX)
return false;
auto tmp = static_cast<float>(ev->u.dval);
ev->u.fval = tmp;
@@ -1034,21 +1031,26 @@ std::unique_ptr<AstExprValue> AstExpression::eval_bin_op()
case ExprComb::Mod:
if (m_subExpr2->getExprValue()->u.hval == 0)
return nullptr;
retval->u.hval = m_subExpr1->getExprValue()->u.hval % m_subExpr2->getExprValue()->u.hval;
retval->u.hval
= m_subExpr1->getExprValue()->u.hval % m_subExpr2->getExprValue()->u.hval;
break;
case ExprComb::Add:
retval->u.dval = m_subExpr1->getExprValue()->u.dval + m_subExpr2->getExprValue()->u.dval;
retval->u.dval
= m_subExpr1->getExprValue()->u.dval + m_subExpr2->getExprValue()->u.dval;
break;
case ExprComb::Minus:
retval->u.dval = m_subExpr1->getExprValue()->u.dval - m_subExpr2->getExprValue()->u.dval;
retval->u.dval
= m_subExpr1->getExprValue()->u.dval - m_subExpr2->getExprValue()->u.dval;
break;
case ExprComb::Mul:
retval->u.dval = m_subExpr1->getExprValue()->u.dval * m_subExpr2->getExprValue()->u.dval;
retval->u.dval
= m_subExpr1->getExprValue()->u.dval * m_subExpr2->getExprValue()->u.dval;
break;
case ExprComb::Div:
if (m_subExpr2->getExprValue()->u.dval == 0.0)
return nullptr;
retval->u.dval = m_subExpr1->getExprValue()->u.dval / m_subExpr2->getExprValue()->u.dval;
retval->u.dval
= m_subExpr1->getExprValue()->u.dval / m_subExpr2->getExprValue()->u.dval;
break;
default:
return nullptr;
@@ -1078,19 +1080,24 @@ std::unique_ptr<AstExprValue> AstExpression::eval_bit_op()
switch (m_combOperator)
{
case ExprComb::Or:
retval->u.lval = m_subExpr1->getExprValue()->u.lval | m_subExpr2->getExprValue()->u.lval;
retval->u.lval
= m_subExpr1->getExprValue()->u.lval | m_subExpr2->getExprValue()->u.lval;
break;
case ExprComb::Xor:
retval->u.lval = m_subExpr1->getExprValue()->u.lval ^ m_subExpr2->getExprValue()->u.lval;
retval->u.lval
= m_subExpr1->getExprValue()->u.lval ^ m_subExpr2->getExprValue()->u.lval;
break;
case ExprComb::And:
retval->u.lval = m_subExpr1->getExprValue()->u.lval & m_subExpr2->getExprValue()->u.lval;
retval->u.lval
= m_subExpr1->getExprValue()->u.lval & m_subExpr2->getExprValue()->u.lval;
break;
case ExprComb::Left:
retval->u.lval = m_subExpr1->getExprValue()->u.lval << m_subExpr2->getExprValue()->u.lval;
retval->u.lval = m_subExpr1->getExprValue()->u.lval
<< m_subExpr2->getExprValue()->u.lval;
break;
case ExprComb::Right:
retval->u.lval = m_subExpr1->getExprValue()->u.lval >> m_subExpr2->getExprValue()->u.lval;
retval->u.lval
= m_subExpr1->getExprValue()->u.lval >> m_subExpr2->getExprValue()->u.lval;
break;
default:
return nullptr;
@@ -1163,8 +1170,7 @@ std::unique_ptr<AstExprValue> AstExpression::eval_symbol()
/*
* Is it a constant?
*/
if (pDecl->getNodeType() != NT_const &&
pDecl->getNodeType() != NT_enum_val)
if (pDecl->getNodeType() != NT_const && pDecl->getNodeType() != NT_enum_val)
{
ErrorHandler::constantExpected(pDecl, *m_xSymbolicName);
return nullptr;

View File

@@ -21,9 +21,7 @@
#include <aststack.hxx>
#include <astscope.hxx>
AstStack::AstStack()
{
}
AstStack::AstStack() {}
AstStack::~AstStack()
{
@@ -31,7 +29,6 @@ AstStack::~AstStack()
delete p;
}
AstScope* AstStack::top()
{
if (m_stack.empty())
@@ -77,9 +74,6 @@ void AstStack::pop()
m_stack.pop_back();
}
void AstStack::clear()
{
m_stack.clear();
}
void AstStack::clear() { m_stack.clear(); }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -22,8 +22,10 @@
#include <rtl/ustring.hxx>
struct AttributeExceptions {
struct Part {
struct AttributeExceptions
{
struct Part
{
OUString const* documentation;
DeclList const* exceptions;
};

View File

@@ -5020,7 +5020,6 @@ idl/source/cmptools/hash.cxx
idl/source/cmptools/lex.cxx
idl/source/objects/basobj.cxx
idl/source/objects/bastype.cxx
idl/source/objects/module.cxx
idl/source/objects/object.cxx
idl/source/objects/slot.cxx
idl/source/objects/types.cxx
@@ -5032,27 +5031,17 @@ idl/source/prj/svidl.cxx
idlc/inc/astattribute.hxx
idlc/inc/astbasetype.hxx
idlc/inc/astconstant.hxx
idlc/inc/astconstants.hxx
idlc/inc/astdeclaration.hxx
idlc/inc/astenum.hxx
idlc/inc/astexception.hxx
idlc/inc/astexpression.hxx
idlc/inc/astinterface.hxx
idlc/inc/astinterfacemember.hxx
idlc/inc/astmember.hxx
idlc/inc/astmodule.hxx
idlc/inc/astneeds.hxx
idlc/inc/astobserves.hxx
idlc/inc/astoperation.hxx
idlc/inc/astparameter.hxx
idlc/inc/astscope.hxx
idlc/inc/astsequence.hxx
idlc/inc/astservice.hxx
idlc/inc/astservicemember.hxx
idlc/inc/aststack.hxx
idlc/inc/aststruct.hxx
idlc/inc/aststructinstance.hxx
idlc/inc/asttype.hxx
idlc/inc/asttypedef.hxx
idlc/inc/errorhandler.hxx
idlc/inc/fehelper.hxx
@@ -5064,15 +5053,12 @@ idlc/source/astconstant.cxx
idlc/source/astdeclaration.cxx
idlc/source/astdump.cxx
idlc/source/astenum.cxx
idlc/source/astexpression.cxx
idlc/source/astinterface.cxx
idlc/source/astoperation.cxx
idlc/source/astscope.cxx
idlc/source/astservice.cxx
idlc/source/aststack.cxx
idlc/source/aststruct.cxx
idlc/source/aststructinstance.cxx
idlc/source/attributeexceptions.hxx
idlc/source/errorhandler.cxx
idlc/source/fehelper.cxx
idlc/source/idlc.cxx