Remove VN_CAST_CONST and VN_AS_CONST.

The _CONST suffix on these macros is only lexical notation, pointer
constness can be preserved by overloading the underlying
implementations appropriately. Given that the compiler will catch
invalid const usage (trying to assign a non-const pointer to a const
pointer variable, etc.), and that the declarations of symbols should
make their constness obvious, I see no reason to keep the _CONST
flavours.
This commit is contained in:
Geza Lore
2021-10-24 11:43:48 +01:00
parent 20e896ec21
commit 381c87a1eb
18 changed files with 131 additions and 142 deletions
+1 -1
View File
@@ -68,7 +68,7 @@ class EmitCConstPool final : public EmitCConstInit {
void emitVars(const AstConstPool* poolp) {
std::vector<const AstVar*> varps;
for (AstNode* nodep = poolp->modp()->stmtsp(); nodep; nodep = nodep->nextp()) {
if (const AstVar* const varp = VN_CAST_CONST(nodep, Var)) { varps.push_back(varp); }
if (const AstVar* const varp = VN_CAST(nodep, Var)) { varps.push_back(varp); }
}
if (varps.empty()) return; // Constant pool is empty, so we are done