diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-10-25 03:44:56 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-10-25 03:44:56 +0000 |
commit | 4a2a8f7fb857c79c78dd43253706b8fa86c49c8f (patch) | |
tree | 3fa660ab15e7de27e73e19b1cf0c41306ccabb8d /clang/lib/Sema/SemaExprCXX.cpp | |
parent | 016055fa693f20923d68800018d7a8b30a958b56 (diff) | |
download | bcm5719-llvm-4a2a8f7fb857c79c78dd43253706b8fa86c49c8f.tar.gz bcm5719-llvm-4a2a8f7fb857c79c78dd43253706b8fa86c49c8f.zip |
Check for unexpanded parameter packs in the name that guards a
Microsoft __if_exists/__if_not_exists statement. Also note that we
weren't traversing DeclarationNameInfo *at all* within the
RecursiveASTVisitor, which would be rather fatal for variadic
templates.
llvm-svn: 142906
Diffstat (limited to 'clang/lib/Sema/SemaExprCXX.cpp')
-rw-r--r-- | clang/lib/Sema/SemaExprCXX.cpp | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp index 2726906c1b6..9267860d157 100644 --- a/clang/lib/Sema/SemaExprCXX.cpp +++ b/clang/lib/Sema/SemaExprCXX.cpp @@ -4700,10 +4700,24 @@ Sema::CheckMicrosoftIfExistsSymbol(Scope *S, return IER_DoesNotExist; } -Sema::IfExistsResult Sema::CheckMicrosoftIfExistsSymbol(Scope *S, - CXXScopeSpec &SS, - UnqualifiedId &Name) { +Sema::IfExistsResult +Sema::CheckMicrosoftIfExistsSymbol(Scope *S, SourceLocation KeywordLoc, + bool IsIfExists, CXXScopeSpec &SS, + UnqualifiedId &Name) { DeclarationNameInfo TargetNameInfo = GetNameFromUnqualifiedId(Name); + + // Check for unexpanded parameter packs. + SmallVector<UnexpandedParameterPack, 4> Unexpanded; + collectUnexpandedParameterPacks(SS, Unexpanded); + collectUnexpandedParameterPacks(TargetNameInfo, Unexpanded); + if (!Unexpanded.empty()) { + DiagnoseUnexpandedParameterPacks(KeywordLoc, + IsIfExists? UPPC_IfExists + : UPPC_IfNotExists, + Unexpanded); + return IER_Error; + } + return CheckMicrosoftIfExistsSymbol(S, SS, TargetNameInfo); } |