r180682 - ArrayRef'ize Sema::ActOnEnumBody. No functionality change.
Dmitri Gribenko
gribozavr at gmail.com
Sat Apr 27 13:23:52 PDT 2013
Author: gribozavr
Date: Sat Apr 27 15:23:52 2013
New Revision: 180682
URL: http://llvm.org/viewvc/llvm-project?rev=180682&view=rev
Log:
ArrayRef'ize Sema::ActOnEnumBody. No functionality change.
Patch by Robert Wilhelm.
Modified:
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/Parse/ParseDecl.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=180682&r1=180681&r2=180682&view=diff
==============================================================================
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Sat Apr 27 15:23:52 2013
@@ -1681,7 +1681,7 @@ public:
SourceLocation EqualLoc, Expr *Val);
void ActOnEnumBody(SourceLocation EnumLoc, SourceLocation LBraceLoc,
SourceLocation RBraceLoc, Decl *EnumDecl,
- Decl **Elements, unsigned NumElements,
+ ArrayRef<Decl *> Elements,
Scope *S, AttributeList *Attr);
DeclContext *getContainingDC(DeclContext *DC);
Modified: cfe/trunk/lib/Parse/ParseDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=180682&r1=180681&r2=180682&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDecl.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDecl.cpp Sat Apr 27 15:23:52 2013
@@ -3753,8 +3753,8 @@ void Parser::ParseEnumBody(SourceLocatio
MaybeParseGNUAttributes(attrs);
Actions.ActOnEnumBody(StartLoc, T.getOpenLocation(), T.getCloseLocation(),
- EnumDecl, EnumConstantDecls.data(),
- EnumConstantDecls.size(), getCurScope(),
+ EnumDecl, EnumConstantDecls,
+ getCurScope(),
attrs.getList());
EnumScope.Exit();
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=180682&r1=180681&r2=180682&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Sat Apr 27 15:23:52 2013
@@ -11559,8 +11559,8 @@ struct DenseMapInfoDupKey {
// Emits a warning when an element is implicitly set a value that
// a previous element has already been set to.
-static void CheckForDuplicateEnumValues(Sema &S, Decl **Elements,
- unsigned NumElements, EnumDecl *Enum,
+static void CheckForDuplicateEnumValues(Sema &S, ArrayRef<Decl *> Elements,
+ EnumDecl *Enum,
QualType EnumType) {
if (S.Diags.getDiagnosticLevel(diag::warn_duplicate_enum_values,
Enum->getLocation()) ==
@@ -11586,7 +11586,7 @@ static void CheckForDuplicateEnumValues(
// Populate the EnumMap with all values represented by enum constants without
// an initialier.
- for (unsigned i = 0; i < NumElements; ++i) {
+ for (unsigned i = 0, e = Elements.size(); i != e; ++i) {
EnumConstantDecl *ECD = cast_or_null<EnumConstantDecl>(Elements[i]);
// Null EnumConstantDecl means a previous diagnostic has been emitted for
@@ -11607,7 +11607,7 @@ static void CheckForDuplicateEnumValues(
}
// Create vectors for any values that has duplicates.
- for (unsigned i = 0; i < NumElements; ++i) {
+ for (unsigned i = 0, e = Elements.size(); i != e; ++i) {
EnumConstantDecl *ECD = cast<EnumConstantDecl>(Elements[i]);
if (!ValidDuplicateEnum(ECD, Enum))
continue;
@@ -11671,7 +11671,7 @@ static void CheckForDuplicateEnumValues(
void Sema::ActOnEnumBody(SourceLocation EnumLoc, SourceLocation LBraceLoc,
SourceLocation RBraceLoc, Decl *EnumDeclX,
- Decl **Elements, unsigned NumElements,
+ ArrayRef<Decl *> Elements,
Scope *S, AttributeList *Attr) {
EnumDecl *Enum = cast<EnumDecl>(EnumDeclX);
QualType EnumType = Context.getTypeDeclType(Enum);
@@ -11680,7 +11680,7 @@ void Sema::ActOnEnumBody(SourceLocation
ProcessDeclAttributeList(S, Enum, Attr);
if (Enum->isDependentType()) {
- for (unsigned i = 0; i != NumElements; ++i) {
+ for (unsigned i = 0, e = Elements.size(); i != e; ++i) {
EnumConstantDecl *ECD =
cast_or_null<EnumConstantDecl>(Elements[i]);
if (!ECD) continue;
@@ -11707,7 +11707,7 @@ void Sema::ActOnEnumBody(SourceLocation
// Keep track of whether all elements have type int.
bool AllElementsInt = true;
- for (unsigned i = 0; i != NumElements; ++i) {
+ for (unsigned i = 0, e = Elements.size(); i != e; ++i) {
EnumConstantDecl *ECD =
cast_or_null<EnumConstantDecl>(Elements[i]);
if (!ECD) continue; // Already issued a diagnostic.
@@ -11824,7 +11824,7 @@ void Sema::ActOnEnumBody(SourceLocation
// Loop over all of the enumerator constants, changing their types to match
// the type of the enum if needed.
- for (unsigned i = 0; i != NumElements; ++i) {
+ for (unsigned i = 0, e = Elements.size(); i != e; ++i) {
EnumConstantDecl *ECD = cast_or_null<EnumConstantDecl>(Elements[i]);
if (!ECD) continue; // Already issued a diagnostic.
@@ -11892,7 +11892,7 @@ void Sema::ActOnEnumBody(SourceLocation
if (InFunctionDeclarator)
DeclsInPrototypeScope.push_back(Enum);
- CheckForDuplicateEnumValues(*this, Elements, NumElements, Enum, EnumType);
+ CheckForDuplicateEnumValues(*this, Elements, Enum, EnumType);
// Now that the enum type is defined, ensure it's not been underaligned.
if (Enum->hasAttrs())
Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp?rev=180682&r1=180681&r2=180682&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp Sat Apr 27 15:23:52 2013
@@ -801,7 +801,7 @@ void TemplateDeclInstantiator::Instantia
// FIXME: Fixup LBraceLoc
SemaRef.ActOnEnumBody(Enum->getLocation(), SourceLocation(),
Enum->getRBraceLoc(), Enum,
- Enumerators.data(), Enumerators.size(),
+ Enumerators,
0, 0);
}
More information about the cfe-commits
mailing list