[cfe-commits] r39541 - in /cfe/cfe/trunk/include/clang/AST: Attr.h Decl.h

Steve Naroff snaroff at apple.com
Wed Jul 11 09:45:25 PDT 2007


Author: snaroff
Date: Wed Jul 11 11:45:25 2007
New Revision: 39541

URL: http://llvm.org/viewvc/llvm-project?rev=39541&view=rev
Log:
Bug #:
Submitted by:
Reviewed by:
Interface file for GCC attributes.

Added:
    cfe/cfe/trunk/include/clang/AST/Attr.h   (with props)
Modified:
    cfe/cfe/trunk/include/clang/AST/Decl.h

Added: cfe/cfe/trunk/include/clang/AST/Attr.h
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/include/clang/AST/Attr.h?rev=39541&view=auto

==============================================================================
--- cfe/cfe/trunk/include/clang/AST/Attr.h (added)
+++ cfe/cfe/trunk/include/clang/AST/Attr.h Wed Jul 11 11:45:25 2007
@@ -0,0 +1,66 @@
+//===--- Attr.h -------------------------------------------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file was developed by Steve Naroff and is distributed under
+// the University of Illinois Open Source License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file defines the Attribute class interfaces
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_CLANG_AST_ATTR_H
+#define LLVM_CLANG_AST_ATTR_H
+
+#include "clang/Basic/SourceLocation.h"
+#include "clang/AST/Type.h"
+
+namespace llvm {
+namespace clang {
+class IdentifierInfo;
+class Expr;
+
+/// Attr - Represents GCC's __attribute__ declaration. There are
+/// 4 forms of this construct...they are:
+///
+/// 1: __attribute__(( const )). ParmName/Args/NumArgs will all be unused.
+/// 2: __attribute__(( mode(byte) )). ParmName used, Args/NumArgs unused.
+/// 3: __attribute__(( format(printf, 1, 2) )). ParmName/Args/NumArgs all used.
+/// 4: __attribute__(( aligned(16) )). ParmName is unused, Args/Num used.
+///
+class Attr {
+  IdentifierInfo *AttrName;
+  SourceLocation AttrLoc;
+  IdentifierInfo *ParmName;
+  Expr **Args;
+  unsigned NumArgs;
+  Attr *Next;
+public:
+  Attr(SourceLocation L, IdentifierInfo *AttrName, 
+       IdentifierInfo *ParmName, Expr **args, unsigned numargs);
+  ~Attr() {
+    delete [] Args;
+  }
+  
+  IdentifierInfo *getAttributeName() const { return AttrName; }
+  IdentifierInfo *getParameterName() const { return ParmName; }
+  
+  Attr *getNext() const { return Next; }
+  void setNext(Attr *N) { Next = N; }
+
+  /// getNumArgs - Return the number of actual arguments to this attribute.
+  unsigned getNumArgs() const { return NumArgs; }
+  
+  /// getArg - Return the specified argument.
+  Expr *getArg(unsigned Arg) const {
+    assert(Arg < NumArgs && "Arg access out of range!");
+    return Args[Arg];
+  }
+};
+
+}  // end namespace clang
+}  // end namespace llvm
+
+#endif

Propchange: cfe/cfe/trunk/include/clang/AST/Attr.h

------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cfe/cfe/trunk/include/clang/AST/Attr.h

------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

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=39541&r1=39540&r2=39541&view=diff

==============================================================================
--- cfe/cfe/trunk/include/clang/AST/Decl.h (original)
+++ cfe/cfe/trunk/include/clang/AST/Decl.h Wed Jul 11 11:45:25 2007
@@ -36,7 +36,7 @@
     // Concrete sub-classes of TypeDecl
     Typedef, Struct, Union, Class, Enum, 
     // Concrete sub-class of Decl
-    Field, Attribute
+    Field
   };
 
   /// IdentifierNamespace - According to C99 6.2.3, there are four namespaces,
@@ -405,43 +405,6 @@
   static bool classof(const RecordDecl *D) { return true; }
 };
 
-/// AttributeDecl - Represents GCC's __attribute__ declaration. There are
-/// 4 forms of this construct...they are:
-///
-/// 1: __attribute__(( const )). ParmName/Args/NumArgs will all be unused.
-/// 2: __attribute__(( mode(byte) )). ParmName used, Args/NumArgs unused.
-/// 3: __attribute__(( format(printf, 1, 2) )). ParmName/Args/NumArgs all used.
-/// 4: __attribute__(( aligned(16) )). ParmName is unused, Args/Num used.
-///
-class AttributeDecl : public Decl {
-  IdentifierInfo *ParmName;
-  Expr **Args;
-  unsigned NumArgs;
-public:
-  AttributeDecl(SourceLocation L, IdentifierInfo *AttrName, 
-                IdentifierInfo *ParmName, Expr **args, unsigned numargs);
-  ~AttributeDecl() {
-    delete [] Args;
-  }
-  
-  IdentifierInfo *getAttributeName() const { return getIdentifier(); }
-  IdentifierInfo *getParameterName() const { return ParmName; }
-  
-  /// getNumArgs - Return the number of actual arguments to this attribute.
-  unsigned getNumArgs() const { return NumArgs; }
-  
-  /// getArg - Return the specified argument.
-  Expr *getArg(unsigned Arg) const {
-    assert(Arg < NumArgs && "Arg access out of range!");
-    return Args[Arg];
-  }
-  // Implement isa/cast/dyncast/etc.
-  static bool classof(const Decl *D) {
-    return D->getKind() == Attribute;
-  }
-  static bool classof(const AttributeDecl *D) { return true; }
-};
-
 }  // end namespace clang
 }  // end namespace llvm
 





More information about the cfe-commits mailing list