From 47bcd4c5c56cdc2d63a0c2ed4e7f68e6ccf523f6 Mon Sep 17 00:00:00 2001 From: weili Date: Thu, 16 Jun 2016 08:00:06 -0700 Subject: Make code compile with clang_use_chrome_plugin (part V) This change mainly contains files in xfa/fxfa directory. This is part of the efforts to make PDFium code compilable by Clang chromium style plugins. The changes are mainly the following: -- move inline constructor/destructor of complex class/struct out-of-line; -- add constructor/destructor of complex class/struct if not explicitly defined; -- add explicit out-of-line copy constructor when needed; -- move inline virtual functions out-of-line; -- Properly mark virtual functions with 'override'; -- some minor cleanups; BUG=pdfium:469 Review-Url: https://codereview.chromium.org/2071683002 --- xfa/fxfa/fm2js/xfa_expression.cpp | 12 ++++++++++++ xfa/fxfa/fm2js/xfa_expression.h | 12 ++++++++++++ xfa/fxfa/fm2js/xfa_fm2jscontext.h | 10 +++++----- xfa/fxfa/fm2js/xfa_fmparse.cpp | 2 ++ xfa/fxfa/fm2js/xfa_fmparse.h | 2 ++ xfa/fxfa/fm2js/xfa_lexer.cpp | 2 ++ xfa/fxfa/fm2js/xfa_lexer.h | 2 ++ xfa/fxfa/fm2js/xfa_simpleexpression.cpp | 14 ++++++++++++++ xfa/fxfa/fm2js/xfa_simpleexpression.h | 15 ++++++++++----- 9 files changed, 61 insertions(+), 10 deletions(-) (limited to 'xfa/fxfa/fm2js') diff --git a/xfa/fxfa/fm2js/xfa_expression.cpp b/xfa/fxfa/fm2js/xfa_expression.cpp index 72020c3f0c..ad6acafd48 100644 --- a/xfa/fxfa/fm2js/xfa_expression.cpp +++ b/xfa/fxfa/fm2js/xfa_expression.cpp @@ -120,6 +120,8 @@ CXFA_FMVarExpression::CXFA_FMVarExpression(uint32_t line, m_wsName(wsName), m_pInit(pInit) {} +CXFA_FMVarExpression::~CXFA_FMVarExpression() {} + void CXFA_FMVarExpression::ToJavaScript(CFX_WideTextBuf& javascript) { javascript << FX_WSTRC(L"var "); CFX_WideString tempName(m_wsName); @@ -170,6 +172,8 @@ CXFA_FMExpExpression::CXFA_FMExpExpression(uint32_t line, CXFA_FMSimpleExpression* pExpression) : CXFA_FMExpression(line, XFA_FM_EXPTYPE_EXP), m_pExpression(pExpression) {} +CXFA_FMExpExpression::~CXFA_FMExpExpression() {} + void CXFA_FMExpExpression::ToJavaScript(CFX_WideTextBuf& javascript) { if (m_pExpression->GetOperatorToken() == TOKassign) { m_pExpression->ToJavaScript(javascript); @@ -246,6 +250,8 @@ CXFA_FMDoExpression::CXFA_FMDoExpression(uint32_t line, CXFA_FMExpression* pList) : CXFA_FMExpression(line), m_pList(pList) {} +CXFA_FMDoExpression::~CXFA_FMDoExpression() {} + void CXFA_FMDoExpression::ToJavaScript(CFX_WideTextBuf& javascript) { m_pList->ToJavaScript(javascript); } @@ -263,6 +269,8 @@ CXFA_FMIfExpression::CXFA_FMIfExpression(uint32_t line, m_pIfExpression(pIfExpression), m_pElseExpression(pElseExpression) {} +CXFA_FMIfExpression::~CXFA_FMIfExpression() {} + void CXFA_FMIfExpression::ToJavaScript(CFX_WideTextBuf& javascript) { javascript << FX_WSTRC(L"if ("); if (m_pExpression) { @@ -329,6 +337,8 @@ CXFA_FMWhileExpression::CXFA_FMWhileExpression( m_pCondition(pCondition), m_pExpression(pExpression) {} +CXFA_FMWhileExpression::~CXFA_FMWhileExpression() {} + void CXFA_FMWhileExpression::ToJavaScript(CFX_WideTextBuf& javascript) { javascript << FX_WSTRC(L"while ("); m_pCondition->ToJavaScript(javascript); @@ -394,6 +404,8 @@ CXFA_FMForExpression::CXFA_FMForExpression(uint32_t line, m_pStep(pStep), m_pList(pList) {} +CXFA_FMForExpression::~CXFA_FMForExpression() {} + void CXFA_FMForExpression::ToJavaScript(CFX_WideTextBuf& javascript) { javascript << FX_WSTRC(L"{\nvar "); CFX_WideString tempVariant; diff --git a/xfa/fxfa/fm2js/xfa_expression.h b/xfa/fxfa/fm2js/xfa_expression.h index ff898a9c41..8134988f4e 100644 --- a/xfa/fxfa/fm2js/xfa_expression.h +++ b/xfa/fxfa/fm2js/xfa_expression.h @@ -63,6 +63,8 @@ class CXFA_FMVarExpression : public CXFA_FMExpression { CXFA_FMVarExpression(uint32_t line, const CFX_WideStringC& wsName, CXFA_FMExpression* pInit); + ~CXFA_FMVarExpression() override; + void ToJavaScript(CFX_WideTextBuf& javascript) override; void ToImpliedReturnJS(CFX_WideTextBuf&) override; @@ -74,6 +76,8 @@ class CXFA_FMVarExpression : public CXFA_FMExpression { class CXFA_FMExpExpression : public CXFA_FMExpression { public: CXFA_FMExpExpression(uint32_t line, CXFA_FMSimpleExpression* pExpression); + ~CXFA_FMExpExpression() override; + void ToJavaScript(CFX_WideTextBuf& javascript) override; void ToImpliedReturnJS(CFX_WideTextBuf&) override; @@ -99,6 +103,8 @@ class CXFA_FMBlockExpression : public CXFA_FMExpression { class CXFA_FMDoExpression : public CXFA_FMExpression { public: CXFA_FMDoExpression(uint32_t line, CXFA_FMExpression* pList); + ~CXFA_FMDoExpression() override; + void ToJavaScript(CFX_WideTextBuf& javascript) override; void ToImpliedReturnJS(CFX_WideTextBuf&) override; @@ -112,6 +118,8 @@ class CXFA_FMIfExpression : public CXFA_FMExpression { CXFA_FMSimpleExpression* pExpression, CXFA_FMExpression* pIfExpression, CXFA_FMExpression* pElseExpression); + ~CXFA_FMIfExpression() override; + void ToJavaScript(CFX_WideTextBuf& javascript) override; void ToImpliedReturnJS(CFX_WideTextBuf&) override; @@ -134,6 +142,8 @@ class CXFA_FMWhileExpression : public CXFA_FMLoopExpression { CXFA_FMWhileExpression(uint32_t line, CXFA_FMSimpleExpression* pCodition, CXFA_FMExpression* pExpression); + ~CXFA_FMWhileExpression() override; + void ToJavaScript(CFX_WideTextBuf& javascript) override; void ToImpliedReturnJS(CFX_WideTextBuf&) override; @@ -167,6 +177,8 @@ class CXFA_FMForExpression : public CXFA_FMLoopExpression { int32_t iDirection, CXFA_FMSimpleExpression* pStep, CXFA_FMExpression* pList); + ~CXFA_FMForExpression() override; + void ToJavaScript(CFX_WideTextBuf& javascript) override; void ToImpliedReturnJS(CFX_WideTextBuf&) override; diff --git a/xfa/fxfa/fm2js/xfa_fm2jscontext.h b/xfa/fxfa/fm2js/xfa_fm2jscontext.h index eb16435f12..344c4bcda8 100644 --- a/xfa/fxfa/fm2js/xfa_fm2jscontext.h +++ b/xfa/fxfa/fm2js/xfa_fm2jscontext.h @@ -12,6 +12,11 @@ class CXFA_FM2JSContext : public CFXJSE_HostObject { public: + CXFA_FM2JSContext(v8::Isolate* pScriptIsolate, + CFXJSE_Context* pScriptContext, + CXFA_Document* pDoc); + ~CXFA_FM2JSContext() override; + static void Abs(CFXJSE_Value* pThis, const CFX_ByteStringC& szFuncName, CFXJSE_Arguments& args); @@ -439,11 +444,6 @@ class CXFA_FM2JSContext : public CFXJSE_HostObject { CFX_WideTextBuf& wsJavascript, CFX_WideString& wsError); - CXFA_FM2JSContext(v8::Isolate* pScriptIsolate, - CFXJSE_Context* pScriptContext, - CXFA_Document* pDoc); - ~CXFA_FM2JSContext(); - void GlobalPropertyGetter(CFXJSE_Value* pValue); private: diff --git a/xfa/fxfa/fm2js/xfa_fmparse.cpp b/xfa/fxfa/fm2js/xfa_fmparse.cpp index 5fd6c06613..ebe68b9408 100644 --- a/xfa/fxfa/fm2js/xfa_fmparse.cpp +++ b/xfa/fxfa/fm2js/xfa_fmparse.cpp @@ -10,6 +10,8 @@ CXFA_FMParse::CXFA_FMParse() : m_pToken(nullptr), m_pErrorInfo(0) {} +CXFA_FMParse::~CXFA_FMParse() {} + int32_t CXFA_FMParse::Init(const CFX_WideStringC& wsFormcalc, CXFA_FMErrorInfo* pErrorInfo) { m_pErrorInfo = pErrorInfo; diff --git a/xfa/fxfa/fm2js/xfa_fmparse.h b/xfa/fxfa/fm2js/xfa_fmparse.h index 3c11a73572..0283edaed0 100644 --- a/xfa/fxfa/fm2js/xfa_fmparse.h +++ b/xfa/fxfa/fm2js/xfa_fmparse.h @@ -15,6 +15,8 @@ class CXFA_FMParse { public: CXFA_FMParse(); + ~CXFA_FMParse(); + int32_t Init(const CFX_WideStringC& wsFormcalc, CXFA_FMErrorInfo* pErrorInfo); void NextToken(); void Check(XFA_FM_TOKEN op); diff --git a/xfa/fxfa/fm2js/xfa_lexer.cpp b/xfa/fxfa/fm2js/xfa_lexer.cpp index f048f42668..e480b37d4c 100644 --- a/xfa/fxfa/fm2js/xfa_lexer.cpp +++ b/xfa/fxfa/fm2js/xfa_lexer.cpp @@ -167,6 +167,8 @@ CXFA_FMLexer::CXFA_FMLexer(const CFX_WideStringC& wsFormCalc, CXFA_FMErrorInfo* pErrorInfo) : m_ptr(wsFormCalc.c_str()), m_uCurrentLine(1), m_pErrorInfo(pErrorInfo) {} +CXFA_FMLexer::~CXFA_FMLexer() {} + CXFA_FMToken* CXFA_FMLexer::NextToken() { m_pToken.reset(Scan()); return m_pToken.get(); diff --git a/xfa/fxfa/fm2js/xfa_lexer.h b/xfa/fxfa/fm2js/xfa_lexer.h index c21c00255a..a910d1790c 100644 --- a/xfa/fxfa/fm2js/xfa_lexer.h +++ b/xfa/fxfa/fm2js/xfa_lexer.h @@ -104,6 +104,8 @@ class CXFA_FMToken { class CXFA_FMLexer { public: CXFA_FMLexer(const CFX_WideStringC& wsFormcalc, CXFA_FMErrorInfo* pErrorInfo); + ~CXFA_FMLexer(); + CXFA_FMToken* NextToken(); uint32_t Number(CXFA_FMToken* t, const FX_WCHAR* p, const FX_WCHAR*& pEnd); uint32_t String(CXFA_FMToken* t, const FX_WCHAR* p, const FX_WCHAR*& pEnd); diff --git a/xfa/fxfa/fm2js/xfa_simpleexpression.cpp b/xfa/fxfa/fm2js/xfa_simpleexpression.cpp index e77623de3a..47bb9df235 100644 --- a/xfa/fxfa/fm2js/xfa_simpleexpression.cpp +++ b/xfa/fxfa/fm2js/xfa_simpleexpression.cpp @@ -137,6 +137,8 @@ CXFA_FMNumberExpression::CXFA_FMNumberExpression(uint32_t line, CFX_WideStringC wsNumber) : CXFA_FMSimpleExpression(line, TOKnumber), m_wsNumber(wsNumber) {} +CXFA_FMNumberExpression::~CXFA_FMNumberExpression() {} + void CXFA_FMNumberExpression::ToJavaScript(CFX_WideTextBuf& javascript) { javascript << m_wsNumber; } @@ -145,6 +147,8 @@ CXFA_FMStringExpression::CXFA_FMStringExpression(uint32_t line, CFX_WideStringC wsString) : CXFA_FMSimpleExpression(line, TOKstring), m_wsString(wsString) {} +CXFA_FMStringExpression::~CXFA_FMStringExpression() {} + void CXFA_FMStringExpression::ToJavaScript(CFX_WideTextBuf& javascript) { CFX_WideString tempStr(m_wsString); if (tempStr.GetLength() > 2) { @@ -177,6 +181,8 @@ CXFA_FMIdentifierExpressionn::CXFA_FMIdentifierExpressionn( : CXFA_FMSimpleExpression(line, TOKidentifier), m_wsIdentifier(wsIdentifier) {} +CXFA_FMIdentifierExpressionn::~CXFA_FMIdentifierExpressionn() {} + void CXFA_FMIdentifierExpressionn::ToJavaScript(CFX_WideTextBuf& javascript) { CFX_WideString tempStr(m_wsIdentifier); if (tempStr == FX_WSTRC(L"$")) { @@ -206,6 +212,8 @@ CXFA_FMUnaryExpression::CXFA_FMUnaryExpression(uint32_t line, CXFA_FMSimpleExpression* pExp) : CXFA_FMSimpleExpression(line, op), m_pExp(pExp) {} +CXFA_FMUnaryExpression::~CXFA_FMUnaryExpression() {} + void CXFA_FMUnaryExpression::ToJavaScript(CFX_WideTextBuf& javascript) {} CXFA_FMBinExpression::CXFA_FMBinExpression(uint32_t line, @@ -214,6 +222,8 @@ CXFA_FMBinExpression::CXFA_FMBinExpression(uint32_t line, CXFA_FMSimpleExpression* pExp2) : CXFA_FMSimpleExpression(line, op), m_pExp1(pExp1), m_pExp2(pExp2) {} +CXFA_FMBinExpression::~CXFA_FMBinExpression() {} + void CXFA_FMBinExpression::ToJavaScript(CFX_WideTextBuf& javascript) {} CXFA_FMAssignExpression::CXFA_FMAssignExpression(uint32_t line, @@ -616,6 +626,8 @@ CXFA_FMDotAccessorExpression::CXFA_FMDotAccessorExpression( : CXFA_FMBinExpression(line, op, pAccessor, pIndexExp), m_wsIdentifier(wsIdentifier) {} +CXFA_FMDotAccessorExpression::~CXFA_FMDotAccessorExpression() {} + void CXFA_FMDotAccessorExpression::ToJavaScript(CFX_WideTextBuf& javascript) { javascript << gs_lpStrExpFuncName[DOT]; javascript << FX_WSTRC(L"("); @@ -692,6 +704,8 @@ CXFA_FMDotDotAccessorExpression::CXFA_FMDotDotAccessorExpression( : CXFA_FMBinExpression(line, op, pAccessor, pIndexExp), m_wsIdentifier(wsIdentifier) {} +CXFA_FMDotDotAccessorExpression::~CXFA_FMDotDotAccessorExpression() {} + void CXFA_FMDotDotAccessorExpression::ToJavaScript( CFX_WideTextBuf& javascript) { javascript << gs_lpStrExpFuncName[DOTDOT]; diff --git a/xfa/fxfa/fm2js/xfa_simpleexpression.h b/xfa/fxfa/fm2js/xfa_simpleexpression.h index 2530128846..27086f4cc4 100644 --- a/xfa/fxfa/fm2js/xfa_simpleexpression.h +++ b/xfa/fxfa/fm2js/xfa_simpleexpression.h @@ -79,7 +79,7 @@ class CXFA_FMNullExpression : public CXFA_FMSimpleExpression { class CXFA_FMNumberExpression : public CXFA_FMSimpleExpression { public: CXFA_FMNumberExpression(uint32_t line, CFX_WideStringC wsNumber); - ~CXFA_FMNumberExpression() override {} + ~CXFA_FMNumberExpression() override; void ToJavaScript(CFX_WideTextBuf& javascript) override; private: @@ -89,7 +89,7 @@ class CXFA_FMNumberExpression : public CXFA_FMSimpleExpression { class CXFA_FMStringExpression : public CXFA_FMSimpleExpression { public: CXFA_FMStringExpression(uint32_t line, CFX_WideStringC wsString); - ~CXFA_FMStringExpression() override {} + ~CXFA_FMStringExpression() override; void ToJavaScript(CFX_WideTextBuf& javascript) override; private: @@ -99,7 +99,7 @@ class CXFA_FMStringExpression : public CXFA_FMSimpleExpression { class CXFA_FMIdentifierExpressionn : public CXFA_FMSimpleExpression { public: CXFA_FMIdentifierExpressionn(uint32_t line, CFX_WideStringC wsIdentifier); - ~CXFA_FMIdentifierExpressionn() override {} + ~CXFA_FMIdentifierExpressionn() override; void ToJavaScript(CFX_WideTextBuf& javascript) override; private: @@ -111,6 +111,8 @@ class CXFA_FMUnaryExpression : public CXFA_FMSimpleExpression { CXFA_FMUnaryExpression(uint32_t line, XFA_FM_TOKEN op, CXFA_FMSimpleExpression* pExp); + ~CXFA_FMUnaryExpression() override; + void ToJavaScript(CFX_WideTextBuf& javascript) override; protected: @@ -123,6 +125,8 @@ class CXFA_FMBinExpression : public CXFA_FMSimpleExpression { XFA_FM_TOKEN op, CXFA_FMSimpleExpression* pExp1, CXFA_FMSimpleExpression* pExp2); + ~CXFA_FMBinExpression() override; + void ToJavaScript(CFX_WideTextBuf& javascript) override; protected: @@ -246,7 +250,7 @@ class CXFA_FMDotAccessorExpression : public CXFA_FMBinExpression { XFA_FM_TOKEN op, CFX_WideStringC wsIdentifier, CXFA_FMSimpleExpression* pIndexExp); - ~CXFA_FMDotAccessorExpression() override {} + ~CXFA_FMDotAccessorExpression() override; void ToJavaScript(CFX_WideTextBuf& javascript) override; private: @@ -274,7 +278,8 @@ class CXFA_FMDotDotAccessorExpression : public CXFA_FMBinExpression { XFA_FM_TOKEN op, CFX_WideStringC wsIdentifier, CXFA_FMSimpleExpression* pIndexExp); - ~CXFA_FMDotDotAccessorExpression() override {} + ~CXFA_FMDotDotAccessorExpression() override; + void ToJavaScript(CFX_WideTextBuf& javascript) override; private: -- cgit v1.2.3