aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2008-10-24 22:28:18 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2008-10-24 22:28:18 +0000
commitb0d178d78fd9a67627b89a7e2dafde2c93fbcd1c (patch)
tree70683ee514a61c33027273ea9765493e84ca6f14
parenta59620996236d8b09d5bcc3bac6d3226118566b7 (diff)
Add a quote from the standard about the type of 'this'.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58124 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/AST/DeclCXX.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/AST/DeclCXX.cpp b/lib/AST/DeclCXX.cpp
index a62ebad365..0d0b746ad6 100644
--- a/lib/AST/DeclCXX.cpp
+++ b/lib/AST/DeclCXX.cpp
@@ -61,6 +61,12 @@ CXXMethodDecl::Create(ASTContext &C, CXXRecordDecl *RD,
}
QualType CXXMethodDecl::getThisType(ASTContext &C) const {
+ // C++ 9.3.2p1: The type of this in a member function of a class X is X*.
+ // If the member function is declared const, the type of this is const X*,
+ // if the member function is declared volatile, the type of this is
+ // volatile X*, and if the member function is declared const volatile,
+ // the type of this is const volatile X*.
+
assert(isInstance() && "No 'this' for static methods!");
QualType ClassTy = C.getTagDeclType(const_cast<CXXRecordDecl*>(
cast<CXXRecordDecl>(getParent())));