Skip to content

Commit 3e8f013

Browse files
committed
Applied suggestions
1 parent b5d1d6b commit 3e8f013

File tree

3 files changed

+6
-9
lines changed

3 files changed

+6
-9
lines changed

clang/lib/Sema/SemaDecl.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3356,12 +3356,8 @@ void Sema::mergeDeclAttributes(NamedDecl *New, Decl *Old,
33563356
}
33573357

33583358
void Sema::CheckAttributesOnDeducedType(Decl *D) {
3359-
if (!D->hasAttrs())
3360-
return;
3361-
3362-
for (const Attr *A : D->getAttrs()) {
3359+
for (const Attr *A : D->attrs())
33633360
checkAttrIsTypeDependent(D, A);
3364-
}
33653361
}
33663362

33673363
// Returns the number of added attributes.

clang/test/SemaCXX/attr-cleanup.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,12 @@ namespace F {
4343

4444
template <typename Ty>
4545
void test3() {
46-
Ty fd [[gnu::cleanup(close)]] = open(); // expected-error {{'cleanup' function 'close' parameter has type 'decltype(open()) *' (aka 'int *') which is incompatible with type 'float *'}}
46+
Ty fd [[gnu::cleanup(close)]] = open(); // #TEST3_CLEANUP
4747
}
4848

4949
int main() {
5050
test2<int>();
51-
test3<float>(); // expected-note {{in instantiation of function template specialization 'F::test3<float>' requested here}}
51+
test3<float>(); // expected-error@#TEST3_CLEANUP {{'cleanup' function 'close' parameter has type 'decltype(open()) *' (aka 'int *') which is incompatible with type 'float *'}} \
52+
expected-note {{in instantiation of function template specialization 'F::test3<float>' requested here}}
5253
}
5354
}

clang/utils/TableGen/ClangAttrEmitter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5052,15 +5052,15 @@ void EmitClangAttrIsTypeDependent(const RecordKeeper &Records,
50525052

50535053
OS << "void checkAttrIsTypeDependent(Decl *D, const Attr *A) {\n";
50545054
OS << " switch (A->getKind()) {\n";
5055+
OS << " default:\n";
5056+
OS << " break;\n";
50555057
for (const auto *A : Records.getAllDerivedDefinitions("Attr")) {
50565058
if (A->getValueAsBit("IsTypeDependent")) {
50575059
OS << " case attr::" << A->getName() << ":\n";
50585060
OS << " ActOn" << A->getName() << "Attr(D, A);\n";
50595061
OS << " break;\n";
50605062
}
50615063
}
5062-
OS << " default:\n";
5063-
OS << " break;\n";
50645064
OS << " }\n";
50655065
OS << "}\n";
50665066
}

0 commit comments

Comments
 (0)