aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/Type.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2009-09-05 00:15:47 +0000
committerJohn McCall <rjmccall@apple.com>2009-09-05 00:15:47 +0000
commit7da2431c23ef1ee8acb114e39692246e1801afc2 (patch)
tree093cb246a8bbcabd5beb9ae84dcfb9f3982665d4 /lib/AST/Type.cpp
parentd0e3daf2b980b505e535d35b432c938c6d0208ef (diff)
Basic support for representing elaborated type specifiers
directly in the AST. The current thinking is to create these only in C++ mode for efficiency. But for now, they're not being created at all; patch to follow. This will let us do things like verify that tags match during template instantation, as well as signal that an elaborated type specifier was used for clients that actually care. Optimally, the TypeLoc hierarchy should be adjusted to carry tag location information as well. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81057 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/Type.cpp')
-rw-r--r--lib/AST/Type.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/AST/Type.cpp b/lib/AST/Type.cpp
index c6ea357fbd..f4dad13f41 100644
--- a/lib/AST/Type.cpp
+++ b/lib/AST/Type.cpp
@@ -1674,6 +1674,16 @@ void ObjCObjectPointerType::getAsStringInternal(std::string &InnerString,
InnerString = ObjCQIString + InnerString;
}
+void ElaboratedType::getAsStringInternal(std::string &InnerString,
+ const PrintingPolicy &Policy) const {
+ std::string TypeStr;
+ PrintingPolicy InnerPolicy(Policy);
+ InnerPolicy.SuppressTagKind = true;
+ UnderlyingType.getAsStringInternal(InnerString, InnerPolicy);
+
+ InnerString = std::string(getNameForTagKind(getTagKind())) + ' ' + InnerString;
+}
+
void TagType::getAsStringInternal(std::string &InnerString, const PrintingPolicy &Policy) const {
if (Policy.SuppressTag)
return;