[llvm-commits] [hlvm] r37977 - in /hlvm/trunk/hlvm/AST: Bundle.h Function.h LinkageItem.h Node.h Type.h Variable.h
Reid Spencer
reid at x10sys.com
Sat Jul 7 16:58:34 PDT 2007
Author: reid
Date: Sat Jul 7 18:58:34 2007
New Revision: 37977
URL: http://llvm.org/viewvc/llvm-project?rev=37977&view=rev
Log:
Add Type and Variable. Clean up syntax errors.
Added:
hlvm/trunk/hlvm/AST/Type.h
hlvm/trunk/hlvm/AST/Variable.h
Modified:
hlvm/trunk/hlvm/AST/Bundle.h
hlvm/trunk/hlvm/AST/Function.h
hlvm/trunk/hlvm/AST/LinkageItem.h
hlvm/trunk/hlvm/AST/Node.h
Modified: hlvm/trunk/hlvm/AST/Bundle.h
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/AST/Bundle.h?rev=37977&r1=37976&r2=37977&view=diff
==============================================================================
--- hlvm/trunk/hlvm/AST/Bundle.h (original)
+++ hlvm/trunk/hlvm/AST/Bundle.h Sat Jul 7 18:58:34 2007
@@ -36,7 +36,7 @@
/// a Bundle. Bundles can also be nested in other Bundles. All programming
/// constructs are defined as child nodes of some Bundle.
/// @brief HLVM AST Bundle Node
- class Bundle : Node
+ class Bundle : public Node
{
/// @name Constructors
/// @{
@@ -53,6 +53,6 @@
protected:
/// @}
};
-}
-
+} // AST
+} // hlvm
#endif
Modified: hlvm/trunk/hlvm/AST/Function.h
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/AST/Function.h?rev=37977&r1=37976&r2=37977&view=diff
==============================================================================
--- hlvm/trunk/hlvm/AST/Function.h (original)
+++ hlvm/trunk/hlvm/AST/Function.h Sat Jul 7 18:58:34 2007
@@ -25,7 +25,6 @@
#define HLVM_AST_FUNCTION_H
#include <hlvm/AST/LinkageItem.h>
-#include <hlvm/AST/NamedType.h>
namespace hlvm
{
@@ -40,7 +39,7 @@
/// has a name, a set of formal arguments, a return type, and a block of
/// code to execute.
/// @brief HLVM AST Function Node
- class Function : LinkageItem
+ class Function : public LinkageItem
{
/// @name Constructors
/// @{
@@ -60,6 +59,6 @@
std::vector<NamedType> arguments_;///< The formal arguments
/// @}
};
-}
-
+} // AST
+} // hlvm
#endif
Modified: hlvm/trunk/hlvm/AST/LinkageItem.h
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/AST/LinkageItem.h?rev=37977&r1=37976&r2=37977&view=diff
==============================================================================
--- hlvm/trunk/hlvm/AST/LinkageItem.h (original)
+++ hlvm/trunk/hlvm/AST/LinkageItem.h Sat Jul 7 18:58:34 2007
@@ -34,10 +34,10 @@
/// permitted for a LinkageItem.
enum LinkageTypes {
ExternalLinkage, ///< Externally visible item
- InternalLinkage ///< Rename collisions when linking (static funcs)
+ InternalLinkage, ///< Rename collisions when linking (static funcs)
LinkOnceLinkage, ///< Keep one copy of item when linking (inline)
WeakLinkage, ///< Keep one copy of item when linking (weak)
- AppendingLinkage, ///< Append item to an array of similar items
+ AppendingLinkage ///< Append item to an array of similar items
};
/// This class represents an LinkageItem in the HLVM Abstract Syntax Tree.
@@ -45,16 +45,16 @@
/// elsewhere and linked into another bundle to resolve the reference. The
/// LinkageItem declares what kind of linkage is to be performed.
/// @brief HLVM AST Bundle Node
- class LinkageItem : Node
+ class LinkageItem : public Node
{
/// @name Constructors
/// @{
public:
LinkageItem(
- Bundle* parent, ///< The Bundle to which this bundle belongs, or null
+ Node* parent, ///< The Bundle to which this bundle belongs, or null
const std::string& name ///< The name of the bundle
) : Node(parent,name) {}
- virtual ~Bundle();
+ virtual ~LinkageItem();
/// @}
/// @name Data
@@ -63,6 +63,6 @@
LinkageTypes type_; ///< The type of linkage to perform for this item
/// @}
};
-}
-
+} // AST
+} // hlvm
#endif
Modified: hlvm/trunk/hlvm/AST/Node.h
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/AST/Node.h?rev=37977&r1=37976&r2=37977&view=diff
==============================================================================
--- hlvm/trunk/hlvm/AST/Node.h (original)
+++ hlvm/trunk/hlvm/AST/Node.h Sat Jul 7 18:58:34 2007
@@ -46,7 +46,7 @@
/// @{
public:
Node(Node* parent, const std::string& name)
- : parent_(parent), name_(name) {}
+ : name_(name), parent_(parent), kids_() {}
virtual ~Node();
/// @}
@@ -58,5 +58,6 @@
std::vector<Node> kids_; ///< The vector of children nodes.
/// @}
};
-}
+} // AST
+} // hlvm
#endif
Added: hlvm/trunk/hlvm/AST/Type.h
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/AST/Type.h?rev=37977&view=auto
==============================================================================
--- hlvm/trunk/hlvm/AST/Type.h (added)
+++ hlvm/trunk/hlvm/AST/Type.h Sat Jul 7 18:58:34 2007
@@ -0,0 +1,56 @@
+//
+// Copyright (C) 2006 HLVM Group. All Rights Reserved.
+//
+// This program is open source software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License (GPL) as published by
+// the Free Software Foundation; either version 2 of the License, or (at your
+// option) any later version. You should have received a copy of the GPL in a
+// file named COPYING that was included with this program; if not, you can
+// obtain a copy of the license through the Internet at http://www.fsf.org/
+//
+// This program is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+// for more details.
+//
+////////////////////////////////////////////////////////////////////////////////
+/// @file hlvm/AST/Type.h
+/// @author Reid Spencer <reid at hlvm.org> (original author)
+/// @date 2006/05/04
+/// @since 0.1.0
+/// @brief Declares the class hlvm::AST::Type
+////////////////////////////////////////////////////////////////////////////////
+
+#ifndef HLVM_AST_TYPE_H
+#define HLVM_AST_TYPE_H
+
+#include <hlvm/AST/Node.h>
+
+namespace hlvm
+{
+namespace AST
+{
+ /// This class represents a Type in the HLVM Abstract Syntax Tree.
+ /// A Type defines the format of storage.
+ /// @brief HLVM AST Type Node
+ class Type : public Node
+ {
+ /// @name Constructors
+ /// @{
+ public:
+ Type(
+ Node* parent, ///< The bundle in which the function is defined
+ const std::string& name ///< The name of the function
+ ) : Node(parent,name) {}
+ virtual ~Type();
+
+ /// @}
+ /// @name Data
+ /// @{
+ protected:
+ Type* type_; ///< The type of the variable
+ /// @}
+ };
+} // AST
+} // hlvm
+#endif
Added: hlvm/trunk/hlvm/AST/Variable.h
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/AST/Variable.h?rev=37977&view=auto
==============================================================================
--- hlvm/trunk/hlvm/AST/Variable.h (added)
+++ hlvm/trunk/hlvm/AST/Variable.h Sat Jul 7 18:58:34 2007
@@ -0,0 +1,61 @@
+//
+// Copyright (C) 2006 HLVM Group. All Rights Reserved.
+//
+// This program is open source software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License (GPL) as published by
+// the Free Software Foundation; either version 2 of the License, or (at your
+// option) any later version. You should have received a copy of the GPL in a
+// file named COPYING that was included with this program; if not, you can
+// obtain a copy of the license through the Internet at http://www.fsf.org/
+//
+// This program is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+// for more details.
+//
+////////////////////////////////////////////////////////////////////////////////
+/// @file hlvm/AST/Variable.h
+/// @author Reid Spencer <reid at hlvm.org> (original author)
+/// @date 2006/05/04
+/// @since 0.1.0
+/// @brief Declares the class hlvm::AST::Variable
+////////////////////////////////////////////////////////////////////////////////
+
+#ifndef HLVM_AST_VARIABLE_H
+#define HLVM_AST_VARIABLE_H
+
+#include <hlvm/AST/LinkageItem.h>
+
+namespace hlvm
+{
+namespace AST
+{
+ class Type; // Forward declare
+
+ /// This class represents an Variable in the HLVM Abstract Syntax Tree.
+ /// A Variable is a storage location of a specific type. It can either be
+ /// global or local, depending on its parent. Global variables are always
+ /// contained in a Bundle. Local variables are always contained in a
+ /// Function.
+ /// @brief HLVM AST Variable Node
+ class Variable : public LinkageItem
+ {
+ /// @name Constructors
+ /// @{
+ public:
+ Variable(
+ Node* parent, ///< The bundle or function that defines the ariable
+ const std::string& name ///< The name of the variable
+ ) : LinkageItem(parent,name) {}
+ virtual ~Variable();
+
+ /// @}
+ /// @name Data
+ /// @{
+ protected:
+ Type* type_; ///< The type of the variable
+ /// @}
+ };
+} // AST
+} // hlvm
+#endif
More information about the llvm-commits
mailing list