summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/StmtPrinter.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2016-05-19 01:39:10 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2016-05-19 01:39:10 +0000
commit301bc21fd0d767a30192156aa8ae05da56d33fe1 (patch)
tree5a145a5b6137600c472fd0fdf1b93e449b279667 /clang/lib/AST/StmtPrinter.cpp
parentf981ec4582a4c4e8411cda3bd311c461afcd96f6 (diff)
downloadbcm5719-llvm-301bc21fd0d767a30192156aa8ae05da56d33fe1.tar.gz
bcm5719-llvm-301bc21fd0d767a30192156aa8ae05da56d33fe1.zip
Make Sema::getPrintingPolicy less ridiculously expensive. This used to perform
an identifier table lookup, *and* copy the LangOptions (including various std::vector<std::string>s). Twice. We call this function once each time we start parsing a declaration specifier sequence, and once for each call to Sema::Diag. This reduces the compile time for a sample .c file from the linux kernel by 20%. llvm-svn: 270009
Diffstat (limited to 'clang/lib/AST/StmtPrinter.cpp')
-rw-r--r--clang/lib/AST/StmtPrinter.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/clang/lib/AST/StmtPrinter.cpp b/clang/lib/AST/StmtPrinter.cpp
index 0b3f9087909..0aa327da85e 100644
--- a/clang/lib/AST/StmtPrinter.cpp
+++ b/clang/lib/AST/StmtPrinter.cpp
@@ -1397,9 +1397,9 @@ void StmtPrinter::VisitUnaryExprOrTypeTraitExpr(UnaryExprOrTypeTraitExpr *Node){
OS << "sizeof";
break;
case UETT_AlignOf:
- if (Policy.LangOpts.CPlusPlus)
+ if (Policy.Alignof)
OS << "alignof";
- else if (Policy.LangOpts.C11)
+ else if (Policy.UnderscoreAlignof)
OS << "_Alignof";
else
OS << "__alignof";
@@ -1669,7 +1669,7 @@ void StmtPrinter::VisitNoInitExpr(NoInitExpr *Node) {
}
void StmtPrinter::VisitImplicitValueInitExpr(ImplicitValueInitExpr *Node) {
- if (Policy.LangOpts.CPlusPlus) {
+ if (Node->getType()->getAsCXXRecordDecl()) {
OS << "/*implicit*/";
Node->getType().print(OS, Policy);
OS << "()";
OpenPOWER on IntegriCloud