From 54e5b13a2717293ddd7743ae3183e29d6ec3c9d4 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Thu, 9 Sep 2010 16:14:44 +0000 Subject: Add proper type-source information to UnaryTypeTraitExpr, including libclang visitation. llvm-svn: 113492 --- clang/tools/libclang/CIndex.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'clang/tools/libclang/CIndex.cpp') diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp index a561b4a7f3c..83ae84ef520 100644 --- a/clang/tools/libclang/CIndex.cpp +++ b/clang/tools/libclang/CIndex.cpp @@ -366,7 +366,6 @@ public: bool VisitCaseStmt(CaseStmt *S); bool VisitWhileStmt(WhileStmt *S); bool VisitForStmt(ForStmt *S); -// bool VisitSwitchCase(SwitchCase *S); // Expression visitors bool VisitDeclRefExpr(DeclRefExpr *E); @@ -385,12 +384,13 @@ public: // FIXME: InitListExpr (for the designators) // FIXME: DesignatedInitExpr bool VisitCXXTypeidExpr(CXXTypeidExpr *E); + bool VisitCXXUuidofExpr(CXXUuidofExpr *E); bool VisitCXXDefaultArgExpr(CXXDefaultArgExpr *E) { return false; } bool VisitCXXTemporaryObjectExpr(CXXTemporaryObjectExpr *E); bool VisitCXXScalarValueInitExpr(CXXScalarValueInitExpr *E); bool VisitCXXNewExpr(CXXNewExpr *E); bool VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr *E); - // FIXME: UnaryTypeTraitExpr has poor source-location information. + bool VisitUnaryTypeTraitExpr(UnaryTypeTraitExpr *E); bool VisitOverloadExpr(OverloadExpr *E); bool VisitDependentScopeDeclRefExpr(DependentScopeDeclRefExpr *E); bool VisitCXXUnresolvedConstructExpr(CXXUnresolvedConstructExpr *E); @@ -1590,6 +1590,17 @@ bool CursorVisitor::VisitCXXTypeidExpr(CXXTypeidExpr *E) { return VisitExpr(E); } +bool CursorVisitor::VisitCXXUuidofExpr(CXXUuidofExpr *E) { + if (E->isTypeOperand()) { + if (TypeSourceInfo *TSInfo = E->getTypeOperandSourceInfo()) + return Visit(TSInfo->getTypeLoc()); + + return false; + } + + return VisitExpr(E); +} + bool CursorVisitor::VisitCXXTemporaryObjectExpr(CXXTemporaryObjectExpr *E) { if (TypeSourceInfo *TSInfo = E->getTypeSourceInfo()) return Visit(TSInfo->getTypeLoc()); @@ -1651,6 +1662,10 @@ bool CursorVisitor::VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr *E) { return false; } +bool CursorVisitor::VisitUnaryTypeTraitExpr(UnaryTypeTraitExpr *E) { + return Visit(E->getQueriedTypeSourceInfo()->getTypeLoc()); +} + bool CursorVisitor::VisitOverloadExpr(OverloadExpr *E) { // Visit the nested-name-specifier. if (NestedNameSpecifier *Qualifier = E->getQualifier()) -- cgit v1.2.3