Fix use-after-free bug in RPC handler
[hiphop-php.git] / hphp / compiler / expression / class_constant_expression.h
blobc5b12e4ff5f81039682d0cd9f39949a71354af76
1 /*
2 +----------------------------------------------------------------------+
3 | HipHop for PHP |
4 +----------------------------------------------------------------------+
5 | Copyright (c) 2010-present Facebook, Inc. (http://www.facebook.com) |
6 +----------------------------------------------------------------------+
7 | This source file is subject to version 3.01 of the PHP license, |
8 | that is bundled with this package in the file LICENSE, and is |
9 | available through the world-wide-web at the following url: |
10 | http://www.php.net/license/3_01.txt |
11 | If you did not receive a copy of the PHP license and are unable to |
12 | obtain it through the world-wide-web, please send a note to |
13 | license@php.net so we can mail you a copy immediately. |
14 +----------------------------------------------------------------------+
17 #ifndef incl_HPHP_CLASS_CONSTANT_EXPRESSION_H_
18 #define incl_HPHP_CLASS_CONSTANT_EXPRESSION_H_
20 #include "hphp/compiler/expression/static_class_name.h"
21 #include "hphp/compiler/analysis/block_scope.h"
23 namespace HPHP {
24 ///////////////////////////////////////////////////////////////////////////////
26 DECLARE_BOOST_TYPES(ClassConstantExpression);
28 struct ClassConstantExpression : Expression, StaticClassName {
29 ClassConstantExpression(EXPRESSION_CONSTRUCTOR_PARAMETERS,
30 ExpressionPtr classExp,
31 const std::string &varName);
33 DECLARE_EXPRESSION_VIRTUAL_FUNCTIONS;
34 ExpressionPtr preOptimize(AnalysisResultConstPtr ar) override;
35 int getLocalEffects() const override { return NoEffect; }
37 bool containsDynamicConstant(AnalysisResultPtr ar) const override;
39 const std::string &getConName() const { return m_varName; }
41 ClassScopeRawPtr getOriginalClassScope() const;
43 bool hasClass() const = delete;
44 bool isColonColonClass() const {
45 return (m_varName.size() == strlen("class")) &&
46 !strcasecmp(m_varName.c_str(), "class");
48 private:
49 std::string m_varName;
50 bool m_depsSet;
51 bool m_originalScopeSet;
52 BlockScopeRawPtr m_originalScope;
55 ///////////////////////////////////////////////////////////////////////////////
57 #endif // incl_HPHP_CLASS_CONSTANT_EXPRESSION_H_