llvm-project/clang/lib/Parse
David Majnemer 2206bf5d5b [-cxx-abi microsoft] Implement local manglings accurately
Summary:
The MSVC ABI appears to mangle the lexical scope into the names of
statics.  Specifically, a counter is incremented whenever a scope is
entered where things can be declared in such a way that an ambiguity can
arise.  For example, a class scope inside of a class scope doesn't do
anything interesting because the nested class cannot collide with
another nested class.

There are problems with this scheme:
- It is unreliable. The counter is only incremented when a previously
  never encountered scope is entered.  There are cases where this will
  cause ambiguity amongst declarations that have the same name where one
  was introduced in a deep scope while the other was introduced right
  after in the previous lexical scope.
- It is wasteful.  Statements like: {{{{{{{ static int foo = a; }}}}}}}
  will make the mangling of "foo" larger than it need be because the
  scope counter has been incremented many times.

Because of these problems, and practical implementation concerns.  We
choose not to implement this scheme if the local static or local type
isn't visible.  The mangling of these declarations will look very
similar but the numbering will make far more sense, this scheme is
lifted from the Itanium ABI implementation.

Reviewers: rsmith, doug.gregor, rnk, eli.friedman, cdavis5x

Reviewed By: rnk

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D2953

llvm-svn: 202951
2014-03-05 08:57:59 +00:00
..
CMakeLists.txt [CMake] Use LINK_LIBS instead of target_link_libraries(). 2014-02-26 06:41:29 +00:00
Makefile BUILD_ARCHIVE is the default for libraries, no need to set it. 2010-07-18 00:14:47 +00:00
ParseAST.cpp Use SmallVectorImpl instead of SmallVector for iterators and references to avoid specifying the vector size unnecessarily. 2013-07-04 03:08:24 +00:00
ParseCXXInlineMethods.cpp Rename getResultType() on function and method declarations to getReturnType() 2014-01-25 16:55:45 +00:00
ParseDecl.cpp [cleanup] Re-sort includes with llvm/utils/sort_includes.py and fix 2014-03-04 10:05:20 +00:00
ParseDeclCXX.cpp [cleanup] Re-sort includes with llvm/utils/sort_includes.py and fix 2014-03-04 10:05:20 +00:00
ParseExpr.cpp [cleanup] Re-sort includes with llvm/utils/sort_includes.py and fix 2014-03-04 10:05:20 +00:00
ParseExprCXX.cpp [cleanup] Re-sort includes with llvm/utils/sort_includes.py and fix 2014-03-04 10:05:20 +00:00
ParseInit.cpp Support and use token kinds as diagnostic arguments 2013-12-24 09:48:30 +00:00
ParseObjc.cpp ExpectAndConsume: Diagnose errors automatically 2014-01-01 03:08:43 +00:00
ParseOpenMP.cpp [OPENMP] emit error message for clause 'if(1 0)' 2014-03-05 06:53:13 +00:00
ParsePragma.cpp Revert the removal of PPCallbacks::PragmaComment() in r201821 2014-02-20 23:37:45 +00:00
ParseStmt.cpp [-cxx-abi microsoft] Implement local manglings accurately 2014-03-05 08:57:59 +00:00
ParseTemplate.cpp Introduce and use Decl::getAsFunction() to simplify templated function checks 2014-01-22 07:29:52 +00:00
ParseTentative.cpp TryConsume parser cleanups 2014-01-10 11:19:30 +00:00
Parser.cpp argument -> parameter terminology fixes for FunctionTypeInfo 2014-02-26 22:27:52 +00:00
RAIIObjectsForParser.h ExpectAndConsume: Diagnose errors automatically 2014-01-01 03:08:43 +00:00