Attached is a patch that fixes pretty-printing of decl stmt groups. The example below shows that the current type pretty-printer does not print the variable name if Policy.SuppressSpecifiers is set.
~ > cat test.cc
int main(int argc, const char **argv) {
int x=0, y=5;
for (int i=x, j=y; i<j; i++) {
;
}
}
~ > clang -cc1 -ast-print test.cc
int main(int argc, const char **argv) {
int x = 0, = 5;
for (int i = x, = y; i < j; i++) {
;
}
}
Please let me know if this is ok.
Richard
diff --git a/lib/AST/TypePrinter.cpp b/lib/AST/TypePrinter.cpp
index 2c00246..937d16f 100644
--- a/lib/AST/TypePrinter.cpp
+++ b/lib/AST/TypePrinter.cpp
@@ -142,8 +142,10 @@ void TypePrinter::print(const Type *T, Qualifiers Quals, raw_ostream &OS,
return;
}
- if (Policy.SuppressSpecifiers && T->isSpecifierType())
+ if (Policy.SuppressSpecifiers && T->isSpecifierType()) {
+ OS << PlaceHolder;
return;
+ }
SaveAndRestore<bool> PHVal(HasEmptyPlaceHolder, PlaceHolder.empty());
signature.asc
Description: Digital signature
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
