Bug #:
Submitted by: Reviewed by: Fix a bozo bug in HandleDeclAttribute...only install a new type when appropriate. Also changed setType/setUnderlyingType to return void. llvm-svn: 39716
This commit is contained in:
parent
4ae0ac6a06
commit
4dddb6194b
|
@ -942,16 +942,14 @@ void Sema::HandleDeclAttribute(Decl *New, AttributeList *rawAttr) {
|
|||
if (strcmp(rawAttr->getAttributeName()->getName(), "vector_size") == 0) {
|
||||
if (ValueDecl *vDecl = dyn_cast<ValueDecl>(New)) {
|
||||
QualType newType = HandleVectorTypeAttribute(vDecl->getType(), rawAttr);
|
||||
// install the new vector type into the decl
|
||||
QualType oldType = vDecl->setType(newType);
|
||||
// FIXME: deal with memory management for oldType!
|
||||
if (!newType.isNull()) // install the new vector type into the decl
|
||||
vDecl->setType(newType);
|
||||
}
|
||||
if (TypedefDecl *tDecl = dyn_cast<TypedefDecl>(New)) {
|
||||
QualType newType = HandleVectorTypeAttribute(tDecl->getUnderlyingType(),
|
||||
rawAttr);
|
||||
// install the new vector type into the decl
|
||||
QualType oldType = tDecl->setUnderlyingType(newType);
|
||||
// FIXME: deal with memory management for oldType!
|
||||
if (!newType.isNull()) // install the new vector type into the decl
|
||||
tDecl->setUnderlyingType(newType);
|
||||
}
|
||||
}
|
||||
// FIXME: add other attributes...
|
||||
|
|
|
@ -128,11 +128,7 @@ protected:
|
|||
Decl *PrevDecl) : Decl(DK, L, Id, PrevDecl), DeclType(T) {}
|
||||
public:
|
||||
QualType getType() const { return DeclType; }
|
||||
QualType setType(QualType newType) {
|
||||
QualType oldType = DeclType;
|
||||
DeclType = newType;
|
||||
return oldType;
|
||||
}
|
||||
void setType(QualType newType) { DeclType = newType; }
|
||||
QualType getCanonicalType() const { return DeclType.getCanonicalType(); }
|
||||
|
||||
// Implement isa/cast/dyncast/etc.
|
||||
|
@ -330,11 +326,7 @@ public:
|
|||
: TypeDecl(Typedef, L, Id, PrevDecl), UnderlyingType(T) {}
|
||||
|
||||
QualType getUnderlyingType() const { return UnderlyingType; }
|
||||
QualType setUnderlyingType(QualType newType) {
|
||||
QualType oldType = UnderlyingType;
|
||||
UnderlyingType = newType;
|
||||
return oldType;
|
||||
}
|
||||
void setUnderlyingType(QualType newType) { UnderlyingType = newType; }
|
||||
|
||||
// Implement isa/cast/dyncast/etc.
|
||||
static bool classof(const Decl *D) { return D->getKind() == Typedef; }
|
||||
|
|
Loading…
Reference in New Issue