summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaLookup.cpp
diff options
context:
space:
mode:
authorNikola Smiljanic <popizdeh@gmail.com>2014-10-04 10:17:57 +0000
committerNikola Smiljanic <popizdeh@gmail.com>2014-10-04 10:17:57 +0000
commit905bfda957baa9ecdf7313dbe712f555675016a6 (patch)
tree1fee1237528e72e7a50e325a1f76771865625245 /clang/lib/Sema/SemaLookup.cpp
parent5da21da4f6d7c69bbd7b2e7cf3fbdfb337978f9c (diff)
downloadbcm5719-llvm-905bfda957baa9ecdf7313dbe712f555675016a6.tar.gz
bcm5719-llvm-905bfda957baa9ecdf7313dbe712f555675016a6.zip
-ms-extensions: Allow __super in return stements.
llvm-svn: 219050
Diffstat (limited to 'clang/lib/Sema/SemaLookup.cpp')
-rw-r--r--clang/lib/Sema/SemaLookup.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp
index 76e0ba1bcda..639e6511217 100644
--- a/clang/lib/Sema/SemaLookup.cpp
+++ b/clang/lib/Sema/SemaLookup.cpp
@@ -1782,7 +1782,8 @@ bool Sema::LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx,
/// contexts that receive a name and an optional C++ scope specifier
/// (e.g., "N::M::x"). It will then perform either qualified or
/// unqualified name lookup (with LookupQualifiedName or LookupName,
-/// respectively) on the given name and return those results.
+/// respectively) on the given name and return those results. It will
+/// perform a special type of lookup for "__super::" scope specifier.
///
/// @param S The scope from which unqualified name lookup will
/// begin.
@@ -1802,6 +1803,10 @@ bool Sema::LookupParsedName(LookupResult &R, Scope *S, CXXScopeSpec *SS,
}
if (SS && SS->isSet()) {
+ NestedNameSpecifier *NNS = SS->getScopeRep();
+ if (NNS->getKind() == NestedNameSpecifier::Super)
+ return LookupInSuper(R, NNS->getAsRecordDecl());
+
if (DeclContext *DC = computeDeclContext(*SS, EnteringContext)) {
// We have resolved the scope specifier to a particular declaration
// contex, and will perform name lookup in that context.
@@ -1831,7 +1836,9 @@ bool Sema::LookupParsedName(LookupResult &R, Scope *S, CXXScopeSpec *SS,
///
/// \param Class The context in which qualified name lookup will
/// search. Name lookup will search in all base classes merging the results.
-void Sema::LookupInSuper(LookupResult &R, CXXRecordDecl *Class) {
+///
+/// @returns True if any decls were found (but possibly ambiguous)
+bool Sema::LookupInSuper(LookupResult &R, CXXRecordDecl *Class) {
for (const auto &BaseSpec : Class->bases()) {
CXXRecordDecl *RD = cast<CXXRecordDecl>(
BaseSpec.getType()->castAs<RecordType>()->getDecl());
@@ -1843,6 +1850,8 @@ void Sema::LookupInSuper(LookupResult &R, CXXRecordDecl *Class) {
}
R.resolveKind();
+
+ return !R.empty();
}
/// \brief Produce a diagnostic describing the ambiguity that resulted
OpenPOWER on IntegriCloud