diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-12-15 01:34:56 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-12-15 01:34:56 +0000 |
commit | a6e053e61a4dd1f71e6d90c5265c252fe846523b (patch) | |
tree | 179fa5ce749511e7375db998a57e54829e7189c1 /clang/lib/AST/DeclarationName.cpp | |
parent | 4886cc8be75f8863632924e9828e8188727443ad (diff) | |
download | bcm5719-llvm-a6e053e61a4dd1f71e6d90c5265c252fe846523b.tar.gz bcm5719-llvm-a6e053e61a4dd1f71e6d90c5265c252fe846523b.zip |
Variadic templates: extend the Expr class with a bit that specifies
whether the expression contains an unexpanded parameter pack, in the
same vein as the changes to the Type hierarchy. Compute this bit
within all of the Expr subclasses.
This change required a bunch of reshuffling of dependency
calculations, mainly to consolidate them inside the constructors and
to fuse multiple loops that iterate over arguments to determine type
dependence, value dependence, and (now) containment of unexpanded
parameter packs.
Again, testing is painfully sparse, because all of the diagnostics
will change and it is more important to test the to-be-written visitor
that collects unexpanded parameter packs.
llvm-svn: 121831
Diffstat (limited to 'clang/lib/AST/DeclarationName.cpp')
-rw-r--r-- | clang/lib/AST/DeclarationName.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/clang/lib/AST/DeclarationName.cpp b/clang/lib/AST/DeclarationName.cpp index 860a0b276a7..596ecc593e3 100644 --- a/clang/lib/AST/DeclarationName.cpp +++ b/clang/lib/AST/DeclarationName.cpp @@ -512,6 +512,27 @@ DeclarationNameLoc::DeclarationNameLoc(DeclarationName Name) { } } +bool DeclarationNameInfo::containsUnexpandedParameterPack() const { + switch (Name.getNameKind()) { + case DeclarationName::Identifier: + case DeclarationName::ObjCZeroArgSelector: + case DeclarationName::ObjCOneArgSelector: + case DeclarationName::ObjCMultiArgSelector: + case DeclarationName::CXXOperatorName: + case DeclarationName::CXXLiteralOperatorName: + case DeclarationName::CXXUsingDirective: + return false; + + case DeclarationName::CXXConstructorName: + case DeclarationName::CXXDestructorName: + case DeclarationName::CXXConversionFunctionName: + if (TypeSourceInfo *TInfo = LocInfo.NamedType.TInfo) + return TInfo->getType()->containsUnexpandedParameterPack(); + + return Name.getCXXNameType()->containsUnexpandedParameterPack(); + } +} + std::string DeclarationNameInfo::getAsString() const { std::string Result; llvm::raw_string_ostream OS(Result); |