diff options
| author | Richard Smith <richard-llvm@metafoo.co.uk> | 2011-02-20 03:19:35 +0000 |
|---|---|---|
| committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2011-02-20 03:19:35 +0000 |
| commit | 30482bc78659a3bf2bc8515bff417bc9887e9349 (patch) | |
| tree | b4b027ed95b4cb5438999e65259a7b1970e3800d /clang/lib/AST/ASTDiagnostic.cpp | |
| parent | ba1186c23e31207c2e11866beb978bd966a45e19 (diff) | |
| download | bcm5719-llvm-30482bc78659a3bf2bc8515bff417bc9887e9349.tar.gz bcm5719-llvm-30482bc78659a3bf2bc8515bff417bc9887e9349.zip | |
Implement the C++0x deduced 'auto' feature.
This fixes PR 8738, 9060 and 9132.
llvm-svn: 126069
Diffstat (limited to 'clang/lib/AST/ASTDiagnostic.cpp')
| -rw-r--r-- | clang/lib/AST/ASTDiagnostic.cpp | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/clang/lib/AST/ASTDiagnostic.cpp b/clang/lib/AST/ASTDiagnostic.cpp index 9870b515c67..5bf8a38199b 100644 --- a/clang/lib/AST/ASTDiagnostic.cpp +++ b/clang/lib/AST/ASTDiagnostic.cpp @@ -28,18 +28,26 @@ static QualType Desugar(ASTContext &Context, QualType QT, bool &ShouldAKA) { const Type *Ty = QC.strip(QT); // Don't aka just because we saw an elaborated type... - if (isa<ElaboratedType>(Ty)) { - QT = cast<ElaboratedType>(Ty)->desugar(); + if (const ElaboratedType *ET = dyn_cast<ElaboratedType>(Ty)) { + QT = ET->desugar(); continue; } // ... or a paren type ... - if (isa<ParenType>(Ty)) { - QT = cast<ParenType>(Ty)->desugar(); + if (const ParenType *PT = dyn_cast<ParenType>(Ty)) { + QT = PT->desugar(); continue; } - // ...or a substituted template type parameter. - if (isa<SubstTemplateTypeParmType>(Ty)) { - QT = cast<SubstTemplateTypeParmType>(Ty)->desugar(); + // ...or a substituted template type parameter ... + if (const SubstTemplateTypeParmType *ST = + dyn_cast<SubstTemplateTypeParmType>(Ty)) { + QT = ST->desugar(); + continue; + } + // ... or an auto type. + if (const AutoType *AT = dyn_cast<AutoType>(Ty)) { + if (!AT->isSugared()) + break; + QT = AT->desugar(); continue; } |

