diff options
author | Noel Grandin <noel@peralex.com> | 2014-06-18 12:14:29 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2014-06-24 11:34:21 +0200 |
commit | e2080e70fe8b085f18e868e46340454720fa94ca (patch) | |
tree | 4038d1d57b41b68a47d5ebbbe6ad390648ec6303 /sc/source/ui/unoobj/tokenuno.cxx | |
parent | f910280b8704ed9c289150a4ca3c8d60e15d0d97 (diff) |
new compilerplugin returnbyref
Find places where we are returning a pointer to something, where we can
be returning a reference.
e.g.
class A {
struct X x;
public X* getX() { return &x; }
}
which can be:
public X& getX() { return x; }
Change-Id: I796fd23fd36a18aedf6e36bc28f8fab4f518c6c7
Diffstat (limited to 'sc/source/ui/unoobj/tokenuno.cxx')
-rw-r--r-- | sc/source/ui/unoobj/tokenuno.cxx | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/sc/source/ui/unoobj/tokenuno.cxx b/sc/source/ui/unoobj/tokenuno.cxx index 2b7b884e0e11..738d33d8a5be 100644 --- a/sc/source/ui/unoobj/tokenuno.cxx +++ b/sc/source/ui/unoobj/tokenuno.cxx @@ -68,13 +68,13 @@ ScFormulaParserObj::ScFormulaParserObj(ScDocShell* pDocSh) : mbIgnoreSpaces( true ), mbCompileFAP( false ) { - mpDocShell->GetDocument()->AddUnoObject(*this); + mpDocShell->GetDocument().AddUnoObject(*this); } ScFormulaParserObj::~ScFormulaParserObj() { if (mpDocShell) - mpDocShell->GetDocument()->RemoveUnoObject(*this); + mpDocShell->GetDocument().RemoveUnoObject(*this); } void ScFormulaParserObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) @@ -129,17 +129,17 @@ uno::Sequence<sheet::FormulaToken> SAL_CALL ScFormulaParserObj::parseFormula( if (mpDocShell) { - ScDocument* pDoc = mpDocShell->GetDocument(); - ScExternalRefManager::ApiGuard aExtRefGuard(pDoc); + ScDocument& rDoc = mpDocShell->GetDocument(); + ScExternalRefManager::ApiGuard aExtRefGuard(&rDoc); ScAddress aRefPos( ScAddress::UNINITIALIZED ); ScUnoConversion::FillScAddress( aRefPos, rReferencePos ); - ScCompiler aCompiler( pDoc, aRefPos); - aCompiler.SetGrammar(pDoc->GetGrammar()); + ScCompiler aCompiler( &rDoc, aRefPos); + aCompiler.SetGrammar(rDoc.GetGrammar()); SetCompilerFlags( aCompiler ); ScTokenArray* pCode = aCompiler.CompileString( aFormula ); - (void)ScTokenConversion::ConvertToTokenSequence( *pDoc, aRet, *pCode ); + (void)ScTokenConversion::ConvertToTokenSequence( rDoc, aRet, *pCode ); delete pCode; } @@ -155,13 +155,13 @@ OUString SAL_CALL ScFormulaParserObj::printFormula( if (mpDocShell) { - ScDocument* pDoc = mpDocShell->GetDocument(); + ScDocument& rDoc = mpDocShell->GetDocument(); ScTokenArray aCode; - (void)ScTokenConversion::ConvertToTokenArray( *pDoc, aCode, aTokens ); + (void)ScTokenConversion::ConvertToTokenArray( rDoc, aCode, aTokens ); ScAddress aRefPos( ScAddress::UNINITIALIZED ); ScUnoConversion::FillScAddress( aRefPos, rReferencePos ); - ScCompiler aCompiler( pDoc, aRefPos, aCode); - aCompiler.SetGrammar(pDoc->GetGrammar()); + ScCompiler aCompiler( &rDoc, aRefPos, aCode); + aCompiler.SetGrammar(rDoc.GetGrammar()); SetCompilerFlags( aCompiler ); OUStringBuffer aBuffer; @@ -204,9 +204,9 @@ void SAL_CALL ScFormulaParserObj::setPropertyValue( // CompileEnglish _before_ OpCodeMap! if (mxOpCodeMap.get() && mbEnglish != bOldEnglish) { - ScDocument* pDoc = mpDocShell->GetDocument(); - ScCompiler aCompiler( pDoc, ScAddress()); - aCompiler.SetGrammar(pDoc->GetGrammar()); + ScDocument& rDoc = mpDocShell->GetDocument(); + ScCompiler aCompiler( &rDoc, ScAddress()); + aCompiler.SetGrammar(rDoc.GetGrammar()); mxOpCodeMap = aCompiler.CreateOpCodeMap( maOpCodeMapping, mbEnglish); } } @@ -225,9 +225,9 @@ void SAL_CALL ScFormulaParserObj::setPropertyValue( { if (aValue >>= maOpCodeMapping) { - ScDocument* pDoc = mpDocShell->GetDocument(); - ScCompiler aCompiler( pDoc, ScAddress()); - aCompiler.SetGrammar(pDoc->GetGrammar()); + ScDocument& rDoc = mpDocShell->GetDocument(); + ScCompiler aCompiler( &rDoc, ScAddress()); + aCompiler.SetGrammar(rDoc.GetGrammar()); mxOpCodeMap = aCompiler.CreateOpCodeMap( maOpCodeMapping, mbEnglish); } else |