Replicates all needed state between expanded functions
commit5e6f06cf59Author: Aaron Gutierrez <gutierrez.aaron.m@gmail.com> Date: Thu May 11 15:42:11 2017 -0400 Fixed issue with aliasing local variables ISPC++ now produces valid code, or an appropriate error message, for all of my test cases. commitbfe723e1b7Author: Aaron Gutierrez <gutierrez.aaron.m@gmail.com> Date: Thu May 11 03:09:38 2017 -0400 Actually copy the AST. Type replacement works except for function parameters. commitf65b3e6300Author: Aaron Gutierrez <gutierrez.aaron.m@gmail.com> Date: Thu May 11 01:19:50 2017 -0400 [WIP] Remove cases for ForeachStmt and SymbolExpr commit2e28640860Merge:6a91c5dd020107Author: Aaron Gutierrez <gutierrez.aaron.m@gmail.com> Date: Wed May 10 23:13:40 2017 -0400 Merge branch 'master' into copy_ast commit6a91c5d5acAuthor: Aaron Gutierrez <gutierrez.aaron.m@gmail.com> Date: Wed May 10 11:11:39 2017 -0400 Attempt to replicate AST when expanding polytypes
This commit is contained in:
12
sym.cpp
12
sym.cpp
@@ -95,14 +95,14 @@ SymbolTable::PopScope() {
|
||||
|
||||
|
||||
bool
|
||||
SymbolTable::AddVariable(Symbol *symbol) {
|
||||
SymbolTable::AddVariable(Symbol *symbol, bool issueScopeWarning) {
|
||||
Assert(symbol != NULL);
|
||||
|
||||
// Check to see if a symbol of the same name has already been declared.
|
||||
for (int i = (int)variables.size() - 1; i >= 0; --i) {
|
||||
SymbolMapType &sm = *(variables[i]);
|
||||
if (sm.find(symbol->name) != sm.end()) {
|
||||
if (i == (int)variables.size()-1) {
|
||||
if (i == (int)variables.size()-1 && issueScopeWarning) {
|
||||
// If a symbol of the same name was declared in the
|
||||
// same scope, it's an error.
|
||||
Error(symbol->pos, "Ignoring redeclaration of symbol \"%s\".",
|
||||
@@ -112,9 +112,11 @@ SymbolTable::AddVariable(Symbol *symbol) {
|
||||
else {
|
||||
// Otherwise it's just shadowing something else, which
|
||||
// is legal but dangerous..
|
||||
Warning(symbol->pos,
|
||||
"Symbol \"%s\" shadows symbol declared in outer scope.",
|
||||
symbol->name.c_str());
|
||||
if (issueScopeWarning) {
|
||||
Warning(symbol->pos,
|
||||
"Symbol \"%s\" shadows symbol declared in outer scope.",
|
||||
symbol->name.c_str());
|
||||
}
|
||||
(*variables.back())[symbol->name] = symbol;
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user