forked from OSchip/llvm-project
Don't consider records with a NULL identifier as a name for typo correction.
Because in C++, "anonymous" doesn't mean "nameless" for records. In other words, RecordDecl::isAnonymousStructOrUnion only returns true if the record lacks a name *and* is not used as the type in an object's declaration. llvm-svn: 200868
This commit is contained in:
parent
ba7cc706d9
commit
21a6617c34
|
@ -4216,7 +4216,7 @@ TypoCorrection Sema::CorrectTypo(const DeclarationNameInfo &TypoName,
|
|||
if (CXXRecordDecl *CD = (*TI)->getAsCXXRecordDecl()) {
|
||||
CD = CD->getCanonicalDecl();
|
||||
if (!CD->isDependentType() && !CD->isAnonymousStructOrUnion() &&
|
||||
!CD->isUnion() &&
|
||||
!CD->isUnion() && CD->getIdentifier() &&
|
||||
(CD->isBeingDefined() || CD->isCompleteDefinition()))
|
||||
Namespaces.AddNameSpecifier(CD);
|
||||
}
|
||||
|
|
|
@ -199,3 +199,11 @@ template <>
|
|||
PR18213::WrapperInfo ::PR18213::Wrappable<int>::kWrapperInfo = { 0 }; // expected-error {{no member named 'PR18213' in 'PR18213::WrapperInfo'; did you mean simply 'PR18213'?}} \
|
||||
// expected-error {{C++ requires a type specifier for all declarations}}
|
||||
}
|
||||
|
||||
namespace PR18651 {
|
||||
struct {
|
||||
int x;
|
||||
} a, b;
|
||||
|
||||
int y = x; // expected-error-re {{use of undeclared identifier 'x'{{$}}}}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue