summaryrefslogtreecommitdiffstats
path: root/clang/AST/Decl.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-01-25 07:29:02 +0000
committerChris Lattner <sabre@nondot.org>2007-01-25 07:29:02 +0000
commitc1915e2052f5874d030953e01adbf565cbf74b26 (patch)
tree4c913da5a185ff47579cdb5a32cfbd328ab4cb9c /clang/AST/Decl.cpp
parent5f521506aa4689aceb62d425806821e184a39fbe (diff)
downloadbcm5719-llvm-c1915e2052f5874d030953e01adbf565cbf74b26.tar.gz
bcm5719-llvm-c1915e2052f5874d030953e01adbf565cbf74b26.zip
Create EnumConstantDecl objects for each enum value, and fill them into
the EnumDecl when the enum type is complete. This allows us to detect redefinitions of enums. llvm-svn: 39300
Diffstat (limited to 'clang/AST/Decl.cpp')
-rw-r--r--clang/AST/Decl.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/AST/Decl.cpp b/clang/AST/Decl.cpp
index 11d92055c11..7e8cea9ae07 100644
--- a/clang/AST/Decl.cpp
+++ b/clang/AST/Decl.cpp
@@ -47,6 +47,21 @@ void FunctionDecl::setParams(VarDecl **NewParamInfo, unsigned NumParams) {
}
+/// defineElements - When created, EnumDecl correspond to a forward declared
+/// enum. This method is used to mark the decl as being defined, with the
+/// specified contents.
+void EnumDecl::defineElements(EnumConstantDecl **Elts, unsigned NumElts) {
+ assert(!isDefinition() && "Cannot redefine enums!");
+ setDefinition(true);
+ NumElements = NumElts;
+ if (NumElts) {
+ Elements = new EnumConstantDecl*[NumElts];
+ memcpy(Elements, Elts, NumElts*sizeof(Decl*));
+ }
+}
+
+
+
/// defineBody - When created, RecordDecl's correspond to a forward declared
/// record. This method is used to mark the decl as being defined, with the
/// specified contents.
OpenPOWER on IntegriCloud