summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/StmtPrinter.cpp
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@boostpro.com>2011-04-28 00:16:57 +0000
committerJohn Wiegley <johnw@boostpro.com>2011-04-28 00:16:57 +0000
commit6242b6a688ccdfeb0195bc1180922118e291229d (patch)
treed2fa0106360df7bec519c3836ba5ae1af08e77cc /clang/lib/AST/StmtPrinter.cpp
parent1e34241abd5cf86d4d4df1f92fc88026a9ead515 (diff)
downloadbcm5719-llvm-6242b6a688ccdfeb0195bc1180922118e291229d.tar.gz
bcm5719-llvm-6242b6a688ccdfeb0195bc1180922118e291229d.zip
Implementation of Embarcadero array type traits
Patch authored by John Wiegley. These are array type traits used for parsing code that employs certain features of the Embarcadero C++ compiler: __array_rank(T) and __array_extent(T, Dim). llvm-svn: 130351
Diffstat (limited to 'clang/lib/AST/StmtPrinter.cpp')
-rw-r--r--clang/lib/AST/StmtPrinter.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/clang/lib/AST/StmtPrinter.cpp b/clang/lib/AST/StmtPrinter.cpp
index b96591b6614..62f06dba165 100644
--- a/clang/lib/AST/StmtPrinter.cpp
+++ b/clang/lib/AST/StmtPrinter.cpp
@@ -1308,6 +1308,14 @@ static const char *getTypeTraitName(BinaryTypeTrait BTT) {
return "";
}
+static const char *getTypeTraitName(ArrayTypeTrait ATT) {
+ switch (ATT) {
+ case ATT_ArrayRank: return "__array_rank";
+ case ATT_ArrayExtent: return "__array_extent";
+ }
+ return "";
+}
+
static const char *getExpressionTraitName(ExpressionTrait ET) {
switch (ET) {
default: llvm_unreachable("Unknown expression trait");
@@ -1328,6 +1336,11 @@ void StmtPrinter::VisitBinaryTypeTraitExpr(BinaryTypeTraitExpr *E) {
<< E->getRhsType().getAsString(Policy) << ")";
}
+void StmtPrinter::VisitArrayTypeTraitExpr(ArrayTypeTraitExpr *E) {
+ OS << getTypeTraitName(E->getTrait()) << "("
+ << E->getQueriedType().getAsString(Policy) << ")";
+}
+
void StmtPrinter::VisitExpressionTraitExpr(ExpressionTraitExpr *E) {
OS << getExpressionTraitName(E->getTrait()) << "(";
PrintExpr(E->getQueriedExpression());
OpenPOWER on IntegriCloud