Remove duplicate class forward declarations.
This commit is contained in:
parent
a69936de74
commit
1372d62186
|
|
@ -111,13 +111,18 @@
|
|||
#if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__)
|
||||
# define VL_HAS_UNIQUE_PTR
|
||||
# define VL_HAS_UNORDERED_MAP
|
||||
# define VL_HAS_UNORDERED_SET
|
||||
# define VL_UNIQUE_PTR std::unique_ptr
|
||||
# define VL_UNORDERED_MAP std::unordered_map
|
||||
# define VL_UNORDERED_SET std::unordered_set
|
||||
# define VL_INCLUDE_UNORDERED_MAP <unordered_map>
|
||||
# define VL_INCLUDE_UNORDERED_SET <unordered_set>
|
||||
#else
|
||||
# define VL_UNIQUE_PTR std::auto_ptr
|
||||
# define VL_UNORDERED_MAP std::map
|
||||
# define VL_UNORDERED_SET std::set
|
||||
# define VL_INCLUDE_UNORDERED_MAP <map>
|
||||
# define VL_INCLUDE_UNORDERED_SET <set>
|
||||
#endif
|
||||
|
||||
//=========================================================================
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
#include <map>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
#include VL_INCLUDE_UNORDERED_SET
|
||||
|
||||
#include "V3Global.h"
|
||||
#include "V3String.h"
|
||||
|
|
@ -1881,9 +1882,14 @@ void EmitCImp::emitInt(AstNodeModule* modp) {
|
|||
|
||||
// Declare foreign instances up front to make C++ happy
|
||||
puts("class "+symClassName()+";\n");
|
||||
VL_UNORDERED_SET<string> didClassName;
|
||||
for (AstNode* nodep=modp->stmtsp(); nodep; nodep = nodep->nextp()) {
|
||||
if (AstCell* cellp=nodep->castCell()) {
|
||||
puts("class "+modClassName(cellp->modp())+";\n");
|
||||
string className = modClassName(cellp->modp());
|
||||
if (didClassName.find(className)==didClassName.end()) {
|
||||
puts("class "+className+";\n");
|
||||
didClassName.insert(className);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (v3Global.opt.trace()) {
|
||||
|
|
|
|||
|
|
@ -339,7 +339,7 @@ void EmitCSyms::emitSymHdr() {
|
|||
|
||||
puts("\n// CREATORS\n");
|
||||
puts(symClassName()+"("+topClassName()+"* topp, const char* namep);\n");
|
||||
puts((string)"~"+symClassName()+"() {};\n");
|
||||
puts((string)"~"+symClassName()+"() {}\n");
|
||||
|
||||
puts("\n// METHODS\n");
|
||||
puts("inline const char* name() { return __Vm_namep; }\n");
|
||||
|
|
|
|||
Loading…
Reference in New Issue