forked from OSchip/llvm-project
[Sema] A tag decl that is marked as invalid and is used in a decl-spec,
should not impede creating a proper TypeLoc info for the decl-spec. This improves our semantic error recovery. llvm-svn: 152481
This commit is contained in:
parent
0900a74ddf
commit
224ec821da
clang
|
@ -572,8 +572,9 @@ public:
|
|||
|
||||
/// \brief True if the tag was defined in this type specifier.
|
||||
bool isDefinition() const {
|
||||
return getDecl()->isCompleteDefinition() &&
|
||||
(getNameLoc().isInvalid() || getNameLoc() == getDecl()->getLocation());
|
||||
TagDecl *D = getDecl();
|
||||
return D->isCompleteDefinition() &&
|
||||
(D->getIdentifier() == 0 || D->getLocation() == getNameLoc());
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -766,9 +766,6 @@ static QualType ConvertDeclSpecToType(TypeProcessingState &state) {
|
|||
ElaboratedTypeKeyword Keyword
|
||||
= ElaboratedType::getKeywordForTypeSpec(DS.getTypeSpecType());
|
||||
Result = S.getElaboratedType(Keyword, DS.getTypeSpecScope(), Result);
|
||||
|
||||
if (D->isInvalidDecl())
|
||||
declarator.setInvalidType(true);
|
||||
break;
|
||||
}
|
||||
case DeclSpec::TST_typename: {
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
struct S {
|
||||
int {
|
||||
};
|
||||
typedef struct S S;
|
||||
|
||||
// RUN: c-index-test -index-file %s | FileCheck %s
|
||||
// CHECK: [indexDeclaration]: kind: struct | name: S |
|
||||
// CHECK-NOT: [indexDeclaration]: kind: struct | name: S |
|
Loading…
Reference in New Issue