Changeset efa8b6a for src


Ignore:
Timestamp:
Aug 21, 2018, 8:53:11 AM (6 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, no_list, persistent-indexer, pthread-emulation, qualifiedEnum
Children:
cdbab55
Parents:
72b3605
Message:

Demangle type instances that are not in the forall list, fix edge handling for extracting number/name

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SymTab/Demangle.cc

    r72b3605 refa8b6a  
    354354                                Type * parseUnion(Type::Qualifiers tq);
    355355                                Type * parseEnum(Type::Qualifiers tq);
     356                                Type * parseType(Type::Qualifiers tq);
    356357
    357358                                Type * parseType();
     
    390391                                parsers.emplace_back(Encoding::union_t, [this](Type::Qualifiers tq) { return parseUnion(tq); });
    391392                                parsers.emplace_back(Encoding::enum_t, [this](Type::Qualifiers tq) { return parseEnum(tq); });
     393                                parsers.emplace_back(Encoding::type, [this](Type::Qualifiers tq) { return parseType(tq); });
    392394                                parsers.emplace_back(Encoding::zero, [this](Type::Qualifiers tq) { return new ZeroType(tq); });
    393395                                parsers.emplace_back(Encoding::one, [this](Type::Qualifiers tq) { return new OneType(tq); });
     
    396398                        bool StringView::extractNumber(size_t & out) {
    397399                                std::stringstream numss;
     400                                if (idx >= str.size()) return false;
    398401                                while (isdigit(str[idx])) {
    399402                                        numss << str[idx];
    400403                                        ++idx;
    401                                         if (idx >= str.size()) return false;
     404                                        if (idx == str.size()) break;
    402405                                }
    403406                                if (! (numss >> out)) return false;
     407                                PRINT( std::cerr << "extractNumber success: " << out << std::endl; )
    404408                                return true;
    405409                        }
     
    408412                                size_t len;
    409413                                if (! extractNumber(len)) return false;
    410                                 if (idx+len >= str.size()) return false;
     414                                if (idx+len > str.size()) return false;
    411415                                out = str.substr(idx, len);
    412416                                idx += len;
     417                                PRINT( std::cerr << "extractName success: " << out << std::endl; )
    413418                                return true;
    414419                        }
     
    525530                                if (! extractName(name)) return nullptr;
    526531                                return new EnumInstType(tq, name);
     532                        }
     533
     534                        Type * StringView::parseType(Type::Qualifiers tq) {
     535                                PRINT( std::cerr << "type..." << std::endl; )
     536                                std::string name;
     537                                if (! extractName(name)) return nullptr;
     538                                PRINT( std::cerr << "typename..." << name << std::endl; )
     539                                return new TypeInstType(tq, name, false);
    527540                        }
    528541
Note: See TracChangeset for help on using the changeset viewer.