summaryrefslogtreecommitdiffstats
path: root/gnu/llvm/tools/clang/lib/Sema/SemaCXXScopeSpec.cpp
diff options
context:
space:
mode:
authorpatrick <patrick@openbsd.org>2019-01-27 16:42:12 +0000
committerpatrick <patrick@openbsd.org>2019-01-27 16:42:12 +0000
commitb773203fb58f3ef282fb69c832d8710cab5bc82d (patch)
treee75913f147570fbd75169647b144df85b88a038c /gnu/llvm/tools/clang/lib/Sema/SemaCXXScopeSpec.cpp
parenttweak errno in previous (diff)
downloadwireguard-openbsd-b773203fb58f3ef282fb69c832d8710cab5bc82d.tar.xz
wireguard-openbsd-b773203fb58f3ef282fb69c832d8710cab5bc82d.zip
Import LLVM 7.0.1 release including clang, lld and lldb.
Diffstat (limited to 'gnu/llvm/tools/clang/lib/Sema/SemaCXXScopeSpec.cpp')
-rw-r--r--gnu/llvm/tools/clang/lib/Sema/SemaCXXScopeSpec.cpp55
1 files changed, 29 insertions, 26 deletions
diff --git a/gnu/llvm/tools/clang/lib/Sema/SemaCXXScopeSpec.cpp b/gnu/llvm/tools/clang/lib/Sema/SemaCXXScopeSpec.cpp
index 6da4d2a2619..4e39d067547 100644
--- a/gnu/llvm/tools/clang/lib/Sema/SemaCXXScopeSpec.cpp
+++ b/gnu/llvm/tools/clang/lib/Sema/SemaCXXScopeSpec.cpp
@@ -24,7 +24,7 @@
#include "llvm/ADT/STLExtras.h"
using namespace clang;
-/// \brief Find the current instantiation that associated with the given type.
+/// Find the current instantiation that associated with the given type.
static CXXRecordDecl *getCurrentInstantiationOf(QualType T,
DeclContext *CurContext) {
if (T.isNull())
@@ -44,7 +44,7 @@ static CXXRecordDecl *getCurrentInstantiationOf(QualType T,
return nullptr;
}
-/// \brief Compute the DeclContext that is associated with the given type.
+/// Compute the DeclContext that is associated with the given type.
///
/// \param T the type for which we are attempting to find a DeclContext.
///
@@ -59,7 +59,7 @@ DeclContext *Sema::computeDeclContext(QualType T) {
return ::getCurrentInstantiationOf(T, CurContext);
}
-/// \brief Compute the DeclContext that is associated with the given
+/// Compute the DeclContext that is associated with the given
/// scope specifier.
///
/// \param SS the C++ scope specifier as it appears in the source
@@ -172,7 +172,7 @@ bool Sema::isDependentScopeSpecifier(const CXXScopeSpec &SS) {
return SS.getScopeRep()->isDependent();
}
-/// \brief If the given nested name specifier refers to the current
+/// If the given nested name specifier refers to the current
/// instantiation, return the declaration that corresponds to that
/// current instantiation (C++0x [temp.dep.type]p1).
///
@@ -188,7 +188,7 @@ CXXRecordDecl *Sema::getCurrentInstantiationOf(NestedNameSpecifier *NNS) {
return ::getCurrentInstantiationOf(T, CurContext);
}
-/// \brief Require that the context specified by SS be complete.
+/// Require that the context specified by SS be complete.
///
/// If SS refers to a type, this routine checks whether the type is
/// complete enough (or can be made complete enough) for name lookup
@@ -305,7 +305,7 @@ bool Sema::ActOnSuperScopeSpecifier(SourceLocation SuperLoc,
return false;
}
-/// \brief Determines whether the given declaration is an valid acceptable
+/// Determines whether the given declaration is an valid acceptable
/// result for name lookup of a nested-name-specifier.
/// \param SD Declaration checked for nested-name-specifier.
/// \param IsExtension If not null and the declaration is accepted as an
@@ -350,7 +350,7 @@ bool Sema::isAcceptableNestedNameSpecifier(const NamedDecl *SD,
return false;
}
-/// \brief If the given nested-name-specifier begins with a bare identifier
+/// If the given nested-name-specifier begins with a bare identifier
/// (e.g., Base::), perform name lookup for that identifier as a
/// nested-name-specifier within the given scope, and return the result of that
/// name lookup.
@@ -401,18 +401,18 @@ bool Sema::isNonTypeNestedNameSpecifier(Scope *S, CXXScopeSpec &SS,
isDependent = isDependentScopeSpecifier(SS);
Found.setContextRange(SS.getRange());
}
-
+
if (LookupCtx) {
// Perform "qualified" name lookup into the declaration context we
// computed, which is either the type of the base of a member access
// expression or the declaration context associated with a prior
// nested-name-specifier.
-
+
// The declaration context must be complete.
if (!LookupCtx->isDependentContext() &&
RequireCompleteDeclContext(SS, LookupCtx))
return false;
-
+
LookupQualifiedName(Found, LookupCtx);
} else if (isDependent) {
return false;
@@ -420,7 +420,7 @@ bool Sema::isNonTypeNestedNameSpecifier(Scope *S, CXXScopeSpec &SS,
LookupName(Found, S);
}
Found.suppressDiagnostics();
-
+
return Found.getAsSingle<NamespaceDecl>();
}
@@ -443,7 +443,7 @@ class NestedNameSpecifierValidatorCCC : public CorrectionCandidateCallback {
}
-/// \brief Build a new nested-name-specifier for "identifier::", as described
+/// Build a new nested-name-specifier for "identifier::", as described
/// by ActOnCXXNestedNameSpecifier.
///
/// \param S Scope in which the nested-name-specifier occurs.
@@ -739,7 +739,7 @@ bool Sema::BuildCXXNestedNameSpecifier(Scope *S, NestedNameSpecInfo &IdInfo,
= TLB.push<UnresolvedUsingTypeLoc>(T);
UnresolvedTL.setNameLoc(IdInfo.IdentifierLoc);
} else if (isa<SubstTemplateTypeParmType>(T)) {
- SubstTemplateTypeParmTypeLoc TL
+ SubstTemplateTypeParmTypeLoc TL
= TLB.push<SubstTemplateTypeParmTypeLoc>(T);
TL.setNameLoc(IdInfo.IdentifierLoc);
} else if (isa<SubstTemplateTypeParmPackType>(T)) {
@@ -772,11 +772,11 @@ bool Sema::BuildCXXNestedNameSpecifier(Scope *S, NestedNameSpecInfo &IdInfo,
}
// In Microsoft mode, if we are within a templated function and we can't
- // resolve Identifier, then extend the SS with Identifier. This will have
- // the effect of resolving Identifier during template instantiation.
+ // resolve Identifier, then extend the SS with Identifier. This will have
+ // the effect of resolving Identifier during template instantiation.
// The goal is to be able to resolve a function call whose
// nested-name-specifier is located inside a dependent base class.
- // Example:
+ // Example:
//
// class C {
// public:
@@ -846,8 +846,11 @@ bool Sema::ActOnCXXNestedNameSpecifierDecltype(CXXScopeSpec &SS,
assert(DS.getTypeSpecType() == DeclSpec::TST_decltype);
QualType T = BuildDecltypeType(DS.getRepAsExpr(), DS.getTypeSpecTypeLoc());
+ if (T.isNull())
+ return true;
+
if (!T->isDependentType() && !T->getAs<TagType>()) {
- Diag(DS.getTypeSpecTypeLoc(), diag::err_expected_class_or_namespace)
+ Diag(DS.getTypeSpecTypeLoc(), diag::err_expected_class_or_namespace)
<< T << getLangOpts().CPlusPlus;
return true;
}
@@ -888,7 +891,7 @@ bool Sema::ActOnCXXNestedNameSpecifier(Scope *S,
bool EnteringContext) {
if (SS.isInvalid())
return true;
-
+
// Translate the parser's template argument list in our AST format.
TemplateArgumentListInfo TemplateArgs(LAngleLoc, RAngleLoc);
translateTemplateArguments(TemplateArgsIn, TemplateArgs);
@@ -902,7 +905,7 @@ bool Sema::ActOnCXXNestedNameSpecifier(Scope *S,
DTN->getQualifier(),
DTN->getIdentifier(),
TemplateArgs);
-
+
// Create source-location information for this type.
TypeLocBuilder Builder;
DependentTemplateSpecializationTypeLoc SpecTL
@@ -915,7 +918,7 @@ bool Sema::ActOnCXXNestedNameSpecifier(Scope *S,
SpecTL.setRAngleLoc(RAngleLoc);
for (unsigned I = 0, N = TemplateArgs.size(); I != N; ++I)
SpecTL.setArgLocInfo(I, TemplateArgs[I].getLocInfo());
-
+
SS.Extend(Context, TemplateKWLoc, Builder.getTypeLocInContext(Context, T),
CCLoc);
return false;
@@ -934,7 +937,7 @@ bool Sema::ActOnCXXNestedNameSpecifier(Scope *S,
return true;
}
- // We were able to resolve the template name to an actual template.
+ // We were able to resolve the template name to an actual template.
// Build an appropriate nested-name-specifier.
QualType T =
CheckTemplateIdType(Template.get(), TemplateNameLoc, TemplateArgs);
@@ -967,8 +970,8 @@ bool Sema::ActOnCXXNestedNameSpecifier(Scope *S,
}
namespace {
- /// \brief A structure that stores a nested-name-specifier annotation,
- /// including both the nested-name-specifier
+ /// A structure that stores a nested-name-specifier annotation,
+ /// including both the nested-name-specifier
struct NestedNameSpecifierAnnotation {
NestedNameSpecifier *NNS;
};
@@ -988,14 +991,14 @@ void *Sema::SaveNestedNameSpecifierAnnotation(CXXScopeSpec &SS) {
return Annotation;
}
-void Sema::RestoreNestedNameSpecifierAnnotation(void *AnnotationPtr,
+void Sema::RestoreNestedNameSpecifierAnnotation(void *AnnotationPtr,
SourceRange AnnotationRange,
CXXScopeSpec &SS) {
if (!AnnotationPtr) {
SS.SetInvalid(AnnotationRange);
return;
}
-
+
NestedNameSpecifierAnnotation *Annotation
= static_cast<NestedNameSpecifierAnnotation *>(AnnotationPtr);
SS.Adopt(NestedNameSpecifierLoc(Annotation->NNS, Annotation + 1));
@@ -1062,7 +1065,7 @@ bool Sema::ActOnCXXEnterDeclaratorScope(Scope *S, CXXScopeSpec &SS) {
// it is a complete declaration context.
if (!DC->isDependentContext() && RequireCompleteDeclContext(SS, DC))
return true;
-
+
EnterDeclaratorContext(S, DC);
// Rebuild the nested name specifier for the new scope.