tools/icheck/parser/src/shared/cplusplus/CheckExpression.h
changeset 0 876b1a06bc25
equal deleted inserted replaced
-1:000000000000 0:876b1a06bc25
       
     1 /****************************************************************************
       
     2 **
       
     3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     4 ** All rights reserved.
       
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
       
     6 **
       
     7 ** This file is part of the Qt Mobility Components.
       
     8 **
       
     9 ** $QT_BEGIN_LICENSE:LGPL$
       
    10 ** No Commercial Usage
       
    11 ** This file contains pre-release code and may not be distributed.
       
    12 ** You may use this file in accordance with the terms and conditions
       
    13 ** contained in the Technology Preview License Agreement accompanying
       
    14 ** this package.
       
    15 **
       
    16 ** GNU Lesser General Public License Usage
       
    17 ** Alternatively, this file may be used under the terms of the GNU Lesser
       
    18 ** General Public License version 2.1 as published by the Free Software
       
    19 ** Foundation and appearing in the file LICENSE.LGPL included in the
       
    20 ** packaging of this file.  Please review the following information to
       
    21 ** ensure the GNU Lesser General Public License version 2.1 requirements
       
    22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
       
    23 **
       
    24 ** In addition, as a special exception, Nokia gives you certain additional
       
    25 ** rights.  These rights are described in the Nokia Qt LGPL Exception
       
    26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
       
    27 **
       
    28 ** If you have questions regarding the use of this file, please contact
       
    29 ** Nokia at qt-info@nokia.com.
       
    30 **
       
    31 **
       
    32 **
       
    33 **
       
    34 **
       
    35 **
       
    36 **
       
    37 **
       
    38 ** $QT_END_LICENSE$
       
    39 **
       
    40 ****************************************************************************/
       
    41 // Copyright (c) 2008 Roberto Raggi <roberto.raggi@gmail.com>
       
    42 //
       
    43 // Permission is hereby granted, free of charge, to any person obtaining a copy
       
    44 // of this software and associated documentation files (the "Software"), to deal
       
    45 // in the Software without restriction, including without limitation the rights
       
    46 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
       
    47 // copies of the Software, and to permit persons to whom the Software is
       
    48 // furnished to do so, subject to the following conditions:
       
    49 //
       
    50 // The above copyright notice and this permission notice shall be included in
       
    51 // all copies or substantial portions of the Software.
       
    52 //
       
    53 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
       
    54 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
       
    55 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
       
    56 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
       
    57 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
       
    58 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
       
    59 // THE SOFTWARE.
       
    60 
       
    61 #ifndef CPLUSPLUS_CHECKEXPRESSION_H
       
    62 #define CPLUSPLUS_CHECKEXPRESSION_H
       
    63 
       
    64 #include "CPlusPlusForwardDeclarations.h"
       
    65 #include "SemanticCheck.h"
       
    66 #include "FullySpecifiedType.h"
       
    67 
       
    68 
       
    69 namespace CPlusPlus {
       
    70 
       
    71 class CPLUSPLUS_EXPORT CheckExpression: public SemanticCheck
       
    72 {
       
    73 public:
       
    74     CheckExpression(Semantic *semantic);
       
    75     virtual ~CheckExpression();
       
    76 
       
    77     FullySpecifiedType check(ExpressionAST *expression, Scope *scope);
       
    78 
       
    79 protected:
       
    80     ExpressionAST *switchExpression(ExpressionAST *expression);
       
    81     FullySpecifiedType switchFullySpecifiedType(const FullySpecifiedType &type);
       
    82     Scope *switchScope(Scope *scope);
       
    83 
       
    84     using ASTVisitor::visit;
       
    85 
       
    86     virtual bool visit(BinaryExpressionAST *ast);
       
    87     virtual bool visit(CastExpressionAST *ast);
       
    88     virtual bool visit(ConditionAST *ast);
       
    89     virtual bool visit(ConditionalExpressionAST *ast);
       
    90     virtual bool visit(CppCastExpressionAST *ast);
       
    91     virtual bool visit(DeleteExpressionAST *ast);
       
    92     virtual bool visit(ArrayInitializerAST *ast);
       
    93     virtual bool visit(NewExpressionAST *ast);
       
    94     virtual bool visit(TypeidExpressionAST *ast);
       
    95     virtual bool visit(TypenameCallExpressionAST *ast);
       
    96     virtual bool visit(TypeConstructorCallAST *ast);
       
    97     virtual bool visit(PostfixExpressionAST *ast);
       
    98     virtual bool visit(SizeofExpressionAST *ast);
       
    99     virtual bool visit(NumericLiteralAST *ast);
       
   100     virtual bool visit(BoolLiteralAST *ast);
       
   101     virtual bool visit(ThisExpressionAST *ast);
       
   102     virtual bool visit(NestedExpressionAST *ast);
       
   103     virtual bool visit(StringLiteralAST *ast);
       
   104     virtual bool visit(ThrowExpressionAST *ast);
       
   105     virtual bool visit(TypeIdAST *ast);
       
   106     virtual bool visit(UnaryExpressionAST *ast);
       
   107     virtual bool visit(QtMethodAST *ast);
       
   108     virtual bool visit(CompoundLiteralAST *ast);
       
   109 
       
   110     //names
       
   111     virtual bool visit(QualifiedNameAST *ast);
       
   112     virtual bool visit(OperatorFunctionIdAST *ast);
       
   113     virtual bool visit(ConversionFunctionIdAST *ast);
       
   114     virtual bool visit(SimpleNameAST *ast);
       
   115     virtual bool visit(DestructorNameAST *ast);
       
   116     virtual bool visit(TemplateIdAST *ast);
       
   117 
       
   118     // postfix expressions
       
   119     virtual bool visit(CallAST *ast);
       
   120     virtual bool visit(ArrayAccessAST *ast);
       
   121     virtual bool visit(PostIncrDecrAST *ast);
       
   122     virtual bool visit(MemberAccessAST *ast);
       
   123 
       
   124     // ObjC
       
   125     virtual bool visit(ObjCMessageExpressionAST *ast);
       
   126     virtual bool visit(ObjCEncodeExpressionAST *ast);
       
   127     virtual bool visit(ObjCSelectorExpressionAST *ast);
       
   128 
       
   129 private:
       
   130     ExpressionAST *_expression;
       
   131     FullySpecifiedType _fullySpecifiedType;
       
   132     Scope *_scope;
       
   133     bool _checkOldStyleCasts: 1;
       
   134 };
       
   135 
       
   136 } // end of namespace CPlusPlus
       
   137 
       
   138 
       
   139 #endif // CPLUSPLUS_CHECKEXPRESSION_H