//===--- ASTDiagnostic.cpp - Diagnostic Printing Hooks for AST Nodes ------===////// The LLVM Compiler Infrastructure//// This file is distributed under the University of Illinois Open Source// License. See LICENSE.TXT for details.////===----------------------------------------------------------------------===////// This file implements a diagnostic formatting hook for AST elements.////===----------------------------------------------------------------------===//#include"clang/AST/ASTDiagnostic.h"#include"clang/AST/ASTContext.h"#include"clang/AST/DeclObjC.h"#include"clang/AST/TemplateBase.h"#include"clang/AST/ExprCXX.h"#include"clang/AST/DeclTemplate.h"#include"clang/AST/Type.h"#include"llvm/ADT/SmallString.h"#include"llvm/Support/raw_ostream.h"usingnamespaceclang;// Returns a desugared version of the QualType, and marks ShouldAKA as true// whenever we remove significant sugar from the type.staticQualTypeDesugar(ASTContext&Context,QualTypeQT,bool&ShouldAKA){QualifierCollectorQC;while(true){constType*Ty=QC.strip(QT);// Don't aka just because we saw an elaborated type...if(constElaboratedType*ET=dyn_cast<ElaboratedType>(Ty)){QT=ET->desugar();continue;}// ... or a paren type ...if(constParenType*PT=dyn_cast<ParenType>(Ty)){QT=PT->desugar();continue;}// ...or a substituted template type parameter ...if(constSubstTemplateTypeParmType*ST=dyn_cast<SubstTemplateTypeParmType>(Ty)){QT=ST->desugar();continue;}// ...or an attributed type...if(constAttributedType*AT=dyn_cast<AttributedType>(Ty)){QT=AT->desugar();continue;}// ... or an auto type.if(constAutoType*AT=dyn_cast<AutoType>(Ty)){if(!AT->isSugared())break;QT=AT->desugar();continue;}// Don't desugar template specializations, unless it's an alias template.if(constTemplateSpecializationType*TST=