Commit Graph

24 Commits

Author SHA1 Message Date
Howard Hinnant 14fe17f302 Fix demangling crasher. The crasher involved nested <encoding> involving parameter packs, which exposed a logic bug causing an empty vector<string> to be accessed with back(). In addition to fixing the bug, I've inserted numerous preemptive checks for similar bugs in the hopes that if another bug is uncovered, the bug results in an invalid mangled string instead of a demangler crash. Test suite updated with string that was causing the crash.
llvm-svn: 197063
2013-12-11 19:44:25 +00:00
Howard Hinnant 60c16eb7f5 I'd no sooner made the last commit when Matthew Dempsky sent me another test case that led me to yet another closely related test case that the current design could not handle. I've now changed the way forward references are handled completely. It wasn't that much code to change. The demangler, when confronted with a forward reference to a template parameter, now parses things twice. During the second parse, all forward references are remembered from the first parse. Test suite updated with new case.
llvm-svn: 184672
2013-06-23 19:52:45 +00:00
Howard Hinnant cde9e006d8 After a private conversation with Arthur O'Dwyer, and a good night's sleep, I believe this fix is a better fix than what I committed in r184656 yesterday. I've basically moved the checking for '`' from the start of the demangling process to the end of it. In the process I discovered that one of the test cases no longer demangled to the expected string. After further investigation I believe this case to not be a valid mangled string, and so I moved the test case to the 'invalid cases'. The reason I believe it is invalid is that it should use T_ instead of T0_ to index the template parameter.
llvm-svn: 184668
2013-06-23 17:14:35 +00:00
Howard Hinnant ae10f9d45e Filter out '`' in mangled strings and reject them as invalid if found.
llvm-svn: 184656
2013-06-23 03:36:38 +00:00
Howard Hinnant 72a54eab35 I created a random mangled name generator and have thrown about 200 million random strings at the demangler. I succeeded in crashing it twice more and those crashers have been fixed and the test suite updated with the crash cases.
llvm-svn: 184562
2013-06-21 17:04:24 +00:00
Howard Hinnant 8935442538 Another demangler crasher. Updated test suite to prevent regression.
llvm-svn: 184477
2013-06-20 21:49:34 +00:00
Howard Hinnant 763e591461 Protect against invalid mangled names. Add test suite for invalid mangled names.
llvm-svn: 184394
2013-06-20 01:55:07 +00:00
Howard Hinnant b076753454 Demangle objc mangling implemented in r184250
llvm-svn: 184301
2013-06-19 13:43:18 +00:00
Howard Hinnant 862c4a06ee Demangler update: This now demangles many more (all?) C++11 symbols. Demangler tests updated.
llvm-svn: 184097
2013-06-17 18:10:34 +00:00
Howard Hinnant f2ca35cd79 Add capability to demangle invocation functions for ObjC blocks.
llvm-svn: 179208
2013-04-10 19:44:03 +00:00
Howard Hinnant c1c87c15f2 __list::ends_with_template was giving the wrong answer for empty lists. And __parse_unnamed_type_name wasn't properly handling the list of paramters and was not safe against incorrectly mangled lambdas (running past last).
llvm-svn: 169022
2012-11-30 18:43:50 +00:00
Micah Villmow fb89f27a8f Move TargetData to DataLayout.
llvm-svn: 165397
2012-10-08 16:29:26 +00:00
Howard Hinnant 757640b156 Fixes apple: #12020687. This was a problem in the demangler with template
substitution forward references.  That is, sometimes a mangled name refers to
a substitution that hasn't yet been defined.  The demangler was derferencing a
null pointer in this case because it wasn't properly guarded against a
forward reference.  Test case added to catch this problem.

llvm-svn: 161267
2012-08-03 22:02:07 +00:00
Howard Hinnant b2a9cee678 Erik Olofsson: This patch adds support for lambda demangling. I fixed this because it crashed lldb when it tried to demangle the added test.
Not sure how it should identify the lambda so that might need changing from the current 'lambdax'::  Howard:  Please patch CREDITS.TXT.

llvm-svn: 161125
2012-08-01 18:56:46 +00:00
Howard Hinnant ba2e8aeda5 Fix bug in cxa_demangle involving template substitution.
llvm-svn: 155994
2012-05-02 15:38:11 +00:00
Howard Hinnant 31dea02601 corrected namespace in test
llvm-svn: 149635
2012-02-02 22:00:52 +00:00
Howard Hinnant 242566e552 Change header to generic, instead of implementation specific
llvm-svn: 148646
2012-01-22 01:19:20 +00:00
Howard Hinnant bf8a39bb94 Fixed several bugs, implemented support for vector types, and cleaned out dead code.
llvm-svn: 146677
2011-12-15 20:02:15 +00:00
Howard Hinnant 7a084fdd39 Fix size calculation for pointer to member function
llvm-svn: 146463
2011-12-13 01:23:16 +00:00
Howard Hinnant 8de583abf2 Added support for <special-name> ::= TC <first type> <number> _ <second type> # construction vtable for second-in-first, and for <special-name> ::= GR <object name> # reference temporary for object
llvm-svn: 146274
2011-12-09 20:07:56 +00:00
Howard Hinnant dc82cca6bf Updated heuristic regulating small string buffer
llvm-svn: 145543
2011-12-01 00:08:59 +00:00
Howard Hinnant 26a9d23657 demangler: Drop preceeding () from function types, but not from pointers and references to function types
llvm-svn: 137469
2011-08-12 17:33:10 +00:00
Howard Hinnant 471e111324 In cxa_demangle.cpp, rewrite __parse_unresolved_name to reflect updated understanding and sync with updated clang mangling. Also fix think-o in __parse_encoding enabling the parsing of trailing .eh and .b.
llvm-svn: 133632
2011-06-22 19:27:39 +00:00
Howard Hinnant d3da57f99b initial import
llvm-svn: 130921
2011-05-05 15:27:28 +00:00