[cfe-commits] r39639 - in /cfe/cfe/trunk/include/clang/Parse: AttributeList.h DeclSpec.h
Steve Naroff
snaroff at apple.com
Wed Jul 11 09:46:32 PDT 2007
Author: snaroff
Date: Wed Jul 11 11:46:31 2007
New Revision: 39639
URL: http://llvm.org/viewvc/llvm-project?rev=39639&view=rev
Log:
Bug #:
Submitted by:
Reviewed by:
Add initialization and memory management for AttributeList.
Added a big FIXME comment for handling expressions (which are currently leaked).
Modified:
cfe/cfe/trunk/include/clang/Parse/AttributeList.h
cfe/cfe/trunk/include/clang/Parse/DeclSpec.h
Modified: cfe/cfe/trunk/include/clang/Parse/AttributeList.h
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/include/clang/Parse/AttributeList.h?rev=39639&r1=39638&r2=39639&view=diff
==============================================================================
--- cfe/cfe/trunk/include/clang/Parse/AttributeList.h (original)
+++ cfe/cfe/trunk/include/clang/Parse/AttributeList.h Wed Jul 11 11:46:31 2007
@@ -41,7 +41,18 @@
IdentifierInfo *ParmName, SourceLocation ParmLoc,
Action::ExprTy **args, unsigned numargs, AttributeList *Next);
~AttributeList() {
- delete [] Args;
+ if (Args) {
+ // FIXME: before we delete the vector, we need to make sure the Expr's
+ // have been deleted. Since Action::ExprTy is "void", we are dependent
+ // on the actions module for actually freeing the memory. The specific
+ // hooks are ParseDeclarator, ParseTypeName, ParseParamDeclaratorType,
+ // ParseField, ParseTag. Once these routines have freed the expression,
+ // they should zero out the Args slot (to indicate the memory has been
+ // freed). If any element of the vector is non-null, we should assert.
+ delete [] Args;
+ }
+ if (Next)
+ delete Next;
}
IdentifierInfo *getAttributeName() const { return AttrName; }
Modified: cfe/cfe/trunk/include/clang/Parse/DeclSpec.h
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/include/clang/Parse/DeclSpec.h?rev=39639&r1=39638&r2=39639&view=diff
==============================================================================
--- cfe/cfe/trunk/include/clang/Parse/DeclSpec.h (original)
+++ cfe/cfe/trunk/include/clang/Parse/DeclSpec.h Wed Jul 11 11:46:31 2007
@@ -137,9 +137,12 @@
TypeSpecType(TST_unspecified),
TypeQualifiers(TSS_unspecified),
FS_inline_specified(false),
- TypeRep(0) {
+ TypeRep(0),
+ AttrList(0) {
+ }
+ ~DeclSpec() {
+ delete AttrList;
}
-
// storage-class-specifier
SCS getStorageClassSpec() const { return StorageClassSpec; }
bool isThreadSpecified() const { return SCS_thread_specified; }
@@ -430,7 +433,7 @@
AttributeList *AttrList;
public:
Declarator(const DeclSpec &ds, TheContext C)
- : DS(ds), Identifier(0), Context(C) {
+ : DS(ds), Identifier(0), Context(C), AttrList(0) {
}
~Declarator() {
@@ -461,6 +464,7 @@
assert(0 && "Unknown decl type!");
}
DeclTypeInfo.clear();
+ delete AttrList;
}
/// mayOmitIdentifier - Return true if the identifier is either optional or
More information about the cfe-commits
mailing list