[cfe-commits] r173574 - Constify some getters of DesignatedInitExpr
Dmitri Gribenko
gribozavr at gmail.com
Sat Jan 26 07:15:52 PST 2013
Author: gribozavr
Date: Sat Jan 26 09:15:52 2013
New Revision: 173574
URL: http://llvm.org/viewvc/llvm-project?rev=173574&view=rev
Log:
Constify some getters of DesignatedInitExpr
Modified:
cfe/trunk/include/clang/AST/Expr.h
cfe/trunk/lib/AST/Expr.cpp
Modified: cfe/trunk/include/clang/AST/Expr.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Expr.h?rev=173574&r1=173573&r2=173574&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Expr.h (original)
+++ cfe/trunk/include/clang/AST/Expr.h Sat Jan 26 09:15:52 2013
@@ -4037,9 +4037,9 @@ public:
void setDesignators(ASTContext &C, const Designator *Desigs,
unsigned NumDesigs);
- Expr *getArrayIndex(const Designator& D);
- Expr *getArrayRangeStart(const Designator& D);
- Expr *getArrayRangeEnd(const Designator& D);
+ Expr *getArrayIndex(const Designator &D) const;
+ Expr *getArrayRangeStart(const Designator &D) const;
+ Expr *getArrayRangeEnd(const Designator &D) const;
/// @brief Retrieve the location of the '=' that precedes the
/// initializer value itself, if present.
Modified: cfe/trunk/lib/AST/Expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Expr.cpp?rev=173574&r1=173573&r2=173574&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Expr.cpp (original)
+++ cfe/trunk/lib/AST/Expr.cpp Sat Jan 26 09:15:52 2013
@@ -3729,27 +3729,30 @@ SourceLocation DesignatedInitExpr::getLo
return getInit()->getLocEnd();
}
-Expr *DesignatedInitExpr::getArrayIndex(const Designator& D) {
+Expr *DesignatedInitExpr::getArrayIndex(const Designator& D) const {
assert(D.Kind == Designator::ArrayDesignator && "Requires array designator");
- char* Ptr = static_cast<char*>(static_cast<void *>(this));
+ char *Ptr = static_cast<char *>(
+ const_cast<void *>(static_cast<const void *>(this)));
Ptr += sizeof(DesignatedInitExpr);
Stmt **SubExprs = reinterpret_cast<Stmt**>(reinterpret_cast<void**>(Ptr));
return cast<Expr>(*(SubExprs + D.ArrayOrRange.Index + 1));
}
-Expr *DesignatedInitExpr::getArrayRangeStart(const Designator& D) {
+Expr *DesignatedInitExpr::getArrayRangeStart(const Designator &D) const {
assert(D.Kind == Designator::ArrayRangeDesignator &&
"Requires array range designator");
- char* Ptr = static_cast<char*>(static_cast<void *>(this));
+ char *Ptr = static_cast<char *>(
+ const_cast<void *>(static_cast<const void *>(this)));
Ptr += sizeof(DesignatedInitExpr);
Stmt **SubExprs = reinterpret_cast<Stmt**>(reinterpret_cast<void**>(Ptr));
return cast<Expr>(*(SubExprs + D.ArrayOrRange.Index + 1));
}
-Expr *DesignatedInitExpr::getArrayRangeEnd(const Designator& D) {
+Expr *DesignatedInitExpr::getArrayRangeEnd(const Designator &D) const {
assert(D.Kind == Designator::ArrayRangeDesignator &&
"Requires array range designator");
- char* Ptr = static_cast<char*>(static_cast<void *>(this));
+ char *Ptr = static_cast<char *>(
+ const_cast<void *>(static_cast<const void *>(this)));
Ptr += sizeof(DesignatedInitExpr);
Stmt **SubExprs = reinterpret_cast<Stmt**>(reinterpret_cast<void**>(Ptr));
return cast<Expr>(*(SubExprs + D.ArrayOrRange.Index + 2));
More information about the cfe-commits
mailing list