[cfe-commits] r39716 - in /cfe/cfe/trunk: Sema/SemaDecl.cpp include/clang/AST/Decl.h
Steve Naroff
snaroff at apple.com
Wed Jul 11 09:47:28 PDT 2007
Author: snaroff
Date: Wed Jul 11 11:47:28 2007
New Revision: 39716
URL: http://llvm.org/viewvc/llvm-project?rev=39716&view=rev
Log:
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.
Modified:
cfe/cfe/trunk/Sema/SemaDecl.cpp
cfe/cfe/trunk/include/clang/AST/Decl.h
Modified: cfe/cfe/trunk/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Sema/SemaDecl.cpp?rev=39716&r1=39715&r2=39716&view=diff
==============================================================================
--- cfe/cfe/trunk/Sema/SemaDecl.cpp (original)
+++ cfe/cfe/trunk/Sema/SemaDecl.cpp Wed Jul 11 11:47:28 2007
@@ -942,16 +942,14 @@
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...
Modified: cfe/cfe/trunk/include/clang/AST/Decl.h
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/include/clang/AST/Decl.h?rev=39716&r1=39715&r2=39716&view=diff
==============================================================================
--- cfe/cfe/trunk/include/clang/AST/Decl.h (original)
+++ cfe/cfe/trunk/include/clang/AST/Decl.h Wed Jul 11 11:47:28 2007
@@ -128,11 +128,7 @@
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 @@
: 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; }
More information about the cfe-commits
mailing list