[PATCH 4/4] fix trailing white spaces and remove previously commented, now invalid lines
Floris Ruijter
flo.ruijt at hotmail.com
Sun Feb 6 23:44:40 UTC 2011
---
languages/cpp/cppduchain/expressionvisitor.cpp | 22 +++++++--------
languages/cpp/cppduchain/ptrtomembertype.h | 34 +++++++++++-----------
languages/cpp/cppduchain/tests/test_duchain.cpp | 12 ++++----
languages/cpp/parser/tests/test_parser.cpp | 22 +++++++--------
4 files changed, 43 insertions(+), 47 deletions(-)
diff --git a/languages/cpp/cppduchain/expressionvisitor.cpp b/languages/cpp/cppduchain/expressionvisitor.cpp
index af75b1e..a1af174 100644
--- a/languages/cpp/cppduchain/expressionvisitor.cpp
+++ b/languages/cpp/cppduchain/expressionvisitor.cpp
@@ -458,7 +458,7 @@ void ExpressionVisitor::findMember( AST* node, AbstractType::Ptr base, const Ide
DUContext* searchInContext = m_currentContext;
m_hadMemberAccess = m_memberAccess;
-
+
CursorInRevision position = m_session->positionAt( m_session->token_stream->position(node->start_token) );
if( m_currentContext->url() != m_session->m_url ) //.equals( m_session->m_url, KUrl::CompareWithoutTrailingSlash ) )
position = position.invalid();
@@ -540,7 +540,7 @@ void ExpressionVisitor::findMember( AST* node, AbstractType::Ptr base, const Ide
KSharedPtr<KDevelop::Problem> problem(new Cpp::MissingDeclarationProblem(missing));
problem->setSource(KDevelop::ProblemData::SemanticAnalysis);
CppEditorIntegrator editor(session());
-
+
problem->setFinalLocation(DocumentRange(m_currentContext->url(), editor.findRange(node).castToSimpleRange()));
if(!problem->range().isEmpty() && !editor.findRangeForContext(node->start_token, node->end_token).isEmpty())
m_problems << problem;
@@ -1264,7 +1264,6 @@ void ExpressionVisitor::createDelayedType( AST* node , bool expression ) {
m_lastType = lastType;
m_lastInstance = instance;
-// LOCKDUCHAIN;
visit(node->ptr_op);
}
@@ -1306,8 +1305,7 @@ void ExpressionVisitor::createDelayedType( AST* node , bool expression ) {
// return;
}
-// LOCKDUCHAIN;
-
+
///pointer-to-member
if(node->op==0){
PtrToMemberType::Ptr p( new PtrToMemberType() );
@@ -1317,7 +1315,7 @@ void ExpressionVisitor::createDelayedType( AST* node , bool expression ) {
p->setClassType( m_lastType );
m_lastType = p.cast<AbstractType>();
} else {
-
+
static IndexedString ref("&");
static IndexedString ptr("*");
@@ -1874,7 +1872,7 @@ void ExpressionVisitor::createDelayedType( AST* node , bool expression ) {
OverloadResolutionHelper helper( ptr, KDevelop::TopDUContextPointer(topContext()) );
MissingDeclarationType::Ptr missing;
-
+
if( declarations.isEmpty()) {
missing = oldLastType.cast<Cpp::MissingDeclarationType>();
if (missing) {
@@ -1890,7 +1888,7 @@ void ExpressionVisitor::createDelayedType( AST* node , bool expression ) {
if(!m_hadMemberAccess)
helper.setFunctionNameForADL(QualifiedIdentifier(declarations.first()->identifier()));
}
-
+
ViableFunction viable;
//Resolve functions normally
@@ -1902,7 +1900,7 @@ void ExpressionVisitor::createDelayedType( AST* node , bool expression ) {
if(viable.isValid())
chosenFunction = viable.declaration();
}
-
+
if( !chosenFunction && constructedType )
{
//Default-constructor is used
@@ -1919,7 +1917,7 @@ void ExpressionVisitor::createDelayedType( AST* node , bool expression ) {
m_parameters = oldParams;
return;
}
-
+
if( !chosenFunction && !m_strict ) {
//Because we do not want to rely too much on our understanding of the code, we take the first function instead of totally failing.
#ifdef DEBUG_FUNCTION_CALLS
@@ -1947,7 +1945,7 @@ void ExpressionVisitor::createDelayedType( AST* node , bool expression ) {
//Since not all parameters could be evaluated, Choose the first function
chosenFunction = declarations.front();
}
-
+
if(missing && viable.isValid())
{
// Remove the MissingDeclarationProblem which has been created alongside MissingDeclarationType
@@ -1962,7 +1960,7 @@ void ExpressionVisitor::createDelayedType( AST* node , bool expression ) {
}
}
}
-
+
clearLast();
if( constructedType ) {
diff --git a/languages/cpp/cppduchain/ptrtomembertype.h b/languages/cpp/cppduchain/ptrtomembertype.h
index 202aa48..01d31d2 100644
--- a/languages/cpp/cppduchain/ptrtomembertype.h
+++ b/languages/cpp/cppduchain/ptrtomembertype.h
@@ -3,16 +3,16 @@
* Copyright 2006-2008 Hamish Rodda <rodda at kde.org>
* Copyright 2007-2008 David Nolden <david.nolden.kdevelop at art-master.de>
* Copyright 2010 Floris Ruijter <flo.ruijt at hotmail.com> , adaption of pointertype by above-mentioned authors
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License version 2 as published by the Free Software Foundation.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
@@ -31,7 +31,7 @@ class KDEVCPPDUCHAIN_EXPORT PtrToMemberType : public KDevelop::PointerType
public:
typedef TypePtr<PtrToMemberType> Ptr;
typedef PointerType BaseType;
-
+
/// Default constructor
PtrToMemberType ();
/// Copy constructor. \param rhs type to copy
@@ -40,39 +40,39 @@ class KDEVCPPDUCHAIN_EXPORT PtrToMemberType : public KDevelop::PointerType
PtrToMemberType(PtrToMemberTypeData& data);
/// Destructor
virtual ~PtrToMemberType();
-
+
/**
* sets the class type, ie. the B of A B::* foo
*
* \param ClassType : B
*/
void setClassType(AbstractType::Ptr type);
-
+
AbstractType::Ptr classType () const;
-
+
virtual QString toString() const;
-
+
virtual uint hash() const;
-
+
virtual WhichType whichType() const;
-
+
virtual AbstractType* clone() const;
-
+
virtual bool equals(const AbstractType* rhs) const;
-
+
virtual void exchangeTypes( KDevelop::TypeExchanger* exchanger );
-
+
enum {
Identity = 42
};
-
+
typedef PtrToMemberTypeData Data;
-
+
protected:
virtual void accept0 (KDevelop::TypeVisitor *v) const;
-
+
TYPE_DECLARE_DATA(PtrToMemberType)
-
+
};
}
#endif // PTRTOMEMBERTYPE_H
\ No newline at end of file
diff --git a/languages/cpp/cppduchain/tests/test_duchain.cpp b/languages/cpp/cppduchain/tests/test_duchain.cpp
index 1ad4865..2f4f850 100644
--- a/languages/cpp/cppduchain/tests/test_duchain.cpp
+++ b/languages/cpp/cppduchain/tests/test_duchain.cpp
@@ -5867,18 +5867,18 @@ void TestDUChain::testPointerToMember()
QVERIFY(top->problems().isEmpty());
QCOMPARE(top->childContexts().size(),4);
QCOMPARE(top->localDeclarations().size(),3);
-
+
QCOMPARE(top->localDeclarations().at(0)->uses().begin()->size(),3);
QCOMPARE(top->localDeclarations().at(1)->uses().begin()->size(),3);
-
+
QCOMPARE(top->localDeclarations().at(0)->uses().begin()->at(0),RangeInRevision(4,6,4,8));
QCOMPARE(top->localDeclarations().at(0)->uses().begin()->at(1),RangeInRevision(6,11,6,13));
QCOMPARE(top->localDeclarations().at(0)->uses().begin()->at(2),RangeInRevision(8,6,8,8));
-
+
QCOMPARE(top->localDeclarations().at(1)->uses().begin()->at(0),RangeInRevision(7,2,7,4));
QCOMPARE(top->localDeclarations().at(1)->uses().begin()->at(1),RangeInRevision(8,12,8,14));
QCOMPARE(top->localDeclarations().at(1)->uses().begin()->at(2),RangeInRevision(8,23,8,25));
-
+
{
DUContext* ctx = top->childContexts().at(1);
Declaration* dec = ctx->localDeclarations().first();
@@ -5899,7 +5899,7 @@ void TestDUChain::testPointerToMember()
QVERIFY(structType);
QCOMPARE(structType->qualifiedIdentifier().toString(), QString("BB"));
}
-
+
PtrToMemberType::Ptr ptype = type->baseType().cast<PtrToMemberType>();
{
QVERIFY(ptype);
@@ -5908,7 +5908,7 @@ void TestDUChain::testPointerToMember()
QCOMPARE(structType->qualifiedIdentifier().toString(), QString("AA"));
}
}
-
+
}
#include "test_duchain.moc"
diff --git a/languages/cpp/parser/tests/test_parser.cpp b/languages/cpp/parser/tests/test_parser.cpp
index 06c95fd..0aa96a4 100644
--- a/languages/cpp/parser/tests/test_parser.cpp
+++ b/languages/cpp/parser/tests/test_parser.cpp
@@ -115,7 +115,7 @@ private slots:
QVERIFY(ast != 0);
QVERIFY(ast->declarations != 0);
}
-
+
void testTemplateArguments()
{
QByteArray templatetest("template <int N, int M> struct SeriesAdder{ enum { value = N + SeriesAdder< 0 >::value }; };");
@@ -128,7 +128,7 @@ private slots:
QVERIFY(control.problems().at(i)->description() == "Unexpected end of file");
}
}
-
+
void testManyComparisons()
{
//Should not crash
@@ -148,7 +148,7 @@ private slots:
QVERIFY(ast->declarations != 0);
}
}
-
+
void testParserFail()
{
QByteArray stuff("foo bar !!! nothing that really looks like valid c++ code");
@@ -280,7 +280,7 @@ private slots:
TranslationUnitAST* ast = parse(method, &mem_pool);
CommentFormatter formatter;
-
+
QCOMPARE(formatter.formatComment(ast->comments, lastSession), QByteArray("TranslationUnitComment")); //The comments were merged
const ListNode<DeclarationAST*>* it = ast->declarations;
@@ -370,7 +370,7 @@ private slots:
//QCOMPARE(formatter.formatComment(templDecl->declaration->comments, lastSession), QString("Comment"));
}
-
+
void testComments5()
{
CommentFormatter formatter;
@@ -521,7 +521,7 @@ private slots:
QVERIFY(simpleDecl);
QCOMPARE(simpleDecl->init_declarators->count(), 1);
-
+
}
void testAsmVolatile()
@@ -684,7 +684,7 @@ private slots:
QVERIFY(hasKind(funcAst, AST::Kind_FunctionCall));
QVERIFY(hasKind(funcAst, AST::Kind_InitDeclarator));
}
-
+
void testPtrToMemberAst(){
pool memPool;
TranslationUnitAST* ast = parse("\nstruct AA {"
@@ -697,17 +697,15 @@ private slots:
"\n int AA::* BB::* ppj=&BB::pj;"
"\n}"
, &memPool);
- QVERIFY(ast!=0);
+ QVERIFY(ast!=0);
QCOMPARE(ast->declarations->count(), 3);
QVERIFY(hasKind(ast,AST::Kind_PtrToMember));
FunctionDefinitionAST* f_ast=static_cast<FunctionDefinitionAST*>(getAST(ast,AST::Kind_FunctionDefinition));
QVERIFY(hasKind(f_ast,AST::Kind_PtrToMember));
DeclaratorAST* d_ast=static_cast<DeclaratorAST*>(getAST(f_ast->function_body,AST::Kind_Declarator));
- QCOMPARE(d_ast-> ptr_ops->count(),2);
+ QCOMPARE(d_ast-> ptr_ops->count(),2);
+
- DumpTree dumper;
- dumper.dump(ast, lastSession->token_stream);
-
}
private:
--
1.7.2.3
--=-YJ6GuBAZyr1K7+YjIxxv--
More information about the KDevelop-devel
mailing list