Ignore:
Timestamp:
Nov 13, 2023, 3:43:43 AM (23 months ago)
Author:
JiadaL <j82liang@…>
Branches:
master
Children:
25f2798
Parents:
0030b508 (diff), 2174191 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SymTab/demangler.cc

    r0030b508 rfc12f05  
    22#include <iostream>
    33#include <fstream>
    4 using namespace std;
    54
    6 void f(const std::string & mangleName) {
     5void demangleAndPrint(const std::string & mangleName) {
    76        char * demangleName = cforall_demangle(mangleName.c_str(), 0);
    8         cout << mangleName << " => " << std::flush << demangleName << endl;
     7        std::cout << mangleName << " => " << demangleName << std::endl;
    98        free(demangleName);
    109}
    1110
    12 int main() {
    13         ifstream in("in-demangle.txt");
     11int main(int argc, char * argv[]) {
     12        char const * fileName = (1 < argc) ? argv[1] : "in-demangle.txt";
     13        std::ifstream in(fileName);
     14
    1415        std::string line;
    15         while (getline(in, line)) {
    16                 if (line.empty()) { cout << "=================================" << endl; continue; }
    17                 else if (line[0] == '#') continue;
    18                 f(line);
     16        while (std::getline(in, line)) {
     17                if (line.empty()) {
     18                        std::cout << "=================================" << std::endl;
     19                } else if (line[0] == '#') {
     20                        continue;
     21                } else {
     22                        demangleAndPrint(line);
     23                }
    1924        }
    2025}
Note: See TracChangeset for help on using the changeset viewer.